summaryrefslogtreecommitdiff
path: root/node_modules/css-tree/cjs/syntax/create.cjs
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:05:55 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:05:55 +0800
commitc06f7ee0a40255214c477e13d9b956a7e07c2900 (patch)
treef5982a568ef8fab865d0142e71c7494fea3e4c1b /node_modules/css-tree/cjs/syntax/create.cjs
parent3fd9400d4dccc25aa29b5702216732e0b7542073 (diff)
postcss,(plugins): nanocss, postcss-preset-env
Diffstat (limited to 'node_modules/css-tree/cjs/syntax/create.cjs')
-rw-r--r--node_modules/css-tree/cjs/syntax/create.cjs57
1 files changed, 57 insertions, 0 deletions
diff --git a/node_modules/css-tree/cjs/syntax/create.cjs b/node_modules/css-tree/cjs/syntax/create.cjs
new file mode 100644
index 00000000..aee487fb
--- /dev/null
+++ b/node_modules/css-tree/cjs/syntax/create.cjs
@@ -0,0 +1,57 @@
+'use strict';
+
+const index = require('../tokenizer/index.cjs');
+const create = require('../parser/create.cjs');
+const create$2 = require('../generator/create.cjs');
+const create$3 = require('../convertor/create.cjs');
+const create$1 = require('../walker/create.cjs');
+const Lexer = require('../lexer/Lexer.cjs');
+const mix = require('./config/mix.cjs');
+
+function createSyntax(config) {
+ const parse = create.createParser(config);
+ const walk = create$1.createWalker(config);
+ const generate = create$2.createGenerator(config);
+ const { fromPlainObject, toPlainObject } = create$3.createConvertor(walk);
+
+ const syntax = {
+ lexer: null,
+ createLexer: config => new Lexer.Lexer(config, syntax, syntax.lexer.structure),
+
+ tokenize: index.tokenize,
+ parse,
+ generate,
+
+ walk,
+ find: walk.find,
+ findLast: walk.findLast,
+ findAll: walk.findAll,
+
+ fromPlainObject,
+ toPlainObject,
+
+ fork(extension) {
+ const base = mix({}, config); // copy of config
+
+ return createSyntax(
+ typeof extension === 'function'
+ ? extension(base, Object.assign)
+ : mix(base, extension)
+ );
+ }
+ };
+
+ syntax.lexer = new Lexer.Lexer({
+ generic: true,
+ units: config.units,
+ types: config.types,
+ atrules: config.atrules,
+ properties: config.properties,
+ node: config.node
+ }, syntax);
+
+ return syntax;
+}
+const createSyntax$1 = config => createSyntax(mix({}, config));
+
+module.exports = createSyntax$1;