chore:更换到主分支

This commit is contained in:
张益铭
2021-03-01 15:26:05 +08:00
parent 9064b372e8
commit 6a5f1810f9
3530 changed files with 59613 additions and 479452 deletions

View File

@@ -32,7 +32,7 @@ class Core {
load(sourceString, sourcePath, trace, pathFetcher) {
let parser = new _parser2.default(pathFetcher, trace);
return (0, _postcss2.default)(this.plugins.concat([parser.plugin])).process(sourceString, { from: "/" + sourcePath }).then(result => {
return (0, _postcss2.default)(this.plugins.concat([parser.plugin()])).process(sourceString, { from: "/" + sourcePath }).then(result => {
return {
injectableSource: result.css,
exportTokens: parser.exportTokens

View File

@@ -22,8 +22,14 @@ class Parser {
this.trace = trace;
}
plugin(css) {
return Promise.all(this.fetchAllImports(css)).then(() => this.linkImportedSymbols(css)).then(() => this.extractExports(css));
plugin() {
const parser = this;
return {
postcssPlugin: "css-modules-parser",
OnceExit(css) {
return Promise.all(parser.fetchAllImports(css)).then(() => parser.linkImportedSymbols(css)).then(() => parser.extractExports(css));
}
};
}
fetchAllImports(css) {