@shijiu/jsview-vue 0.9.280 → 0.9.282
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -16,8 +16,6 @@ var postCssImport = _interopDefaultLegacy(require('postcss-import-sync'));
|
|
|
16
16
|
|
|
17
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
|
|
18
18
|
|
|
19
|
-
const adaptPath = (path.posix || path);
|
|
20
|
-
|
|
21
19
|
var nodeModulesDir = path.resolve(process.cwd(), 'node_modules')
|
|
22
20
|
var cachedCssStyles = {}
|
|
23
21
|
|
|
@@ -109,7 +107,7 @@ function compileCssToJs(sfc, options) {
|
|
|
109
107
|
checkSelectors(node, styleInfo.styleFilePath, styleInfo.styleSelectors); // 检测selector是否已经处理过
|
|
110
108
|
let styleJsFilePath = path.relative(nodeModulesDir, styleInfo.styleJsFilePath);
|
|
111
109
|
styleJsFilePath = styleJsFilePath.replace(/\\/g, '/');
|
|
112
|
-
styleImportContainer += `\nimport "${
|
|
110
|
+
styleImportContainer += `\nimport "${styleJsFilePath}";`
|
|
113
111
|
} else if(node.name === "keyframes") {
|
|
114
112
|
const styleFilePath = node.source.input.file;
|
|
115
113
|
const styleSelectors = new Set([node.params]);
|
|
@@ -201,9 +199,9 @@ function compileImportNode(node) {
|
|
|
201
199
|
throw e;
|
|
202
200
|
}
|
|
203
201
|
|
|
204
|
-
const sourceDir =
|
|
202
|
+
const sourceDir = path.dirname(node.source.input.file);
|
|
205
203
|
let styleFileName = node.params.replace(/^["'](.+(?=["']$))["']$/, '$1')
|
|
206
|
-
const styleFilePath =
|
|
204
|
+
const styleFilePath = path.resolve(sourceDir, styleFileName);
|
|
207
205
|
return compileAndSaveImportedNode(styleFilePath, result.root.nodes);
|
|
208
206
|
}
|
|
209
207
|
|
|
@@ -225,8 +223,8 @@ function compileAndSaveImportedNode(styleFilePath, styleNodes) {
|
|
|
225
223
|
if (!fs.existsSync(cacheDir)) {
|
|
226
224
|
fs.mkdirSync(cacheDir);
|
|
227
225
|
}
|
|
228
|
-
const styleJsFileName =
|
|
229
|
-
const styleJsFilePath =
|
|
226
|
+
const styleJsFileName = path.basename(styleFilePath) + `.${hash(styleFilePath)}.js`;
|
|
227
|
+
const styleJsFilePath = path.join(cacheDir, styleJsFileName);
|
|
230
228
|
|
|
231
229
|
styleContent = "\nObject.assign(window.JsvCode.Dom.StyleSheets, {" + styleContent;
|
|
232
230
|
styleContent += "});\n";
|