@shijiu/jsview-vue 0.9.279 → 0.9.283-alpha.0
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
|
|
|
@@ -107,7 +105,9 @@ function compileCssToJs(sfc, options) {
|
|
|
107
105
|
// styleCodeContainer.add(styleCode);
|
|
108
106
|
|
|
109
107
|
checkSelectors(node, styleInfo.styleFilePath, styleInfo.styleSelectors); // 检测selector是否已经处理过
|
|
110
|
-
|
|
108
|
+
let styleJsFilePath = path.relative(nodeModulesDir, styleInfo.styleJsFilePath);
|
|
109
|
+
styleJsFilePath = styleJsFilePath.replace(/\\/g, '/');
|
|
110
|
+
styleImportContainer += `\nimport "${styleJsFilePath}";`
|
|
111
111
|
} else if(node.name === "keyframes") {
|
|
112
112
|
const styleFilePath = node.source.input.file;
|
|
113
113
|
const styleSelectors = new Set([node.params]);
|
|
@@ -199,9 +199,9 @@ function compileImportNode(node) {
|
|
|
199
199
|
throw e;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
const sourceDir =
|
|
202
|
+
const sourceDir = path.dirname(node.source.input.file);
|
|
203
203
|
let styleFileName = node.params.replace(/^["'](.+(?=["']$))["']$/, '$1')
|
|
204
|
-
const styleFilePath =
|
|
204
|
+
const styleFilePath = path.resolve(sourceDir, styleFileName);
|
|
205
205
|
return compileAndSaveImportedNode(styleFilePath, result.root.nodes);
|
|
206
206
|
}
|
|
207
207
|
|
|
@@ -223,8 +223,8 @@ function compileAndSaveImportedNode(styleFilePath, styleNodes) {
|
|
|
223
223
|
if (!fs.existsSync(cacheDir)) {
|
|
224
224
|
fs.mkdirSync(cacheDir);
|
|
225
225
|
}
|
|
226
|
-
const styleJsFileName =
|
|
227
|
-
const styleJsFilePath =
|
|
226
|
+
const styleJsFileName = path.basename(styleFilePath) + `.${hash(styleFilePath)}.js`;
|
|
227
|
+
const styleJsFilePath = path.join(cacheDir, styleJsFileName);
|
|
228
228
|
|
|
229
229
|
styleContent = "\nObject.assign(window.JsvCode.Dom.StyleSheets, {" + styleContent;
|
|
230
230
|
styleContent += "});\n";
|