@cloudbase/cals 1.2.5-alpha.0 → 1.2.6-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/lib/cjs/parser/dependiencies/index.js +38 -15
- package/lib/cjs/utils/dts/auto-generated.d.ts +1 -1
- package/lib/cjs/utils/dts/auto-generated.d.ts.map +1 -1
- package/lib/cjs/utils/dts/auto-generated.js +1 -1
- package/lib/esm/parser/dependiencies/index.js +38 -15
- package/lib/esm/utils/dts/auto-generated.d.ts +1 -1
- package/lib/esm/utils/dts/auto-generated.d.ts.map +1 -1
- package/lib/esm/utils/dts/auto-generated.js +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -106,7 +106,7 @@ class Dependencies {
|
|
|
106
106
|
// 普通组件
|
|
107
107
|
const [{ lcds, components, plugins, actions }] = yield Promise.all([
|
|
108
108
|
loadProdMetaScript(materialName, controlJsPath),
|
|
109
|
-
loadProdMetaStyle(materialName, controlCssPath),
|
|
109
|
+
typeof document === 'object' ? loadProdMetaStyle(materialName, controlCssPath) : null,
|
|
110
110
|
]);
|
|
111
111
|
return handleLcdsCompPluginsActions({
|
|
112
112
|
materialName,
|
|
@@ -492,21 +492,44 @@ _Dependencies_schema = new WeakMap(), _Dependencies_request = new WeakMap(), _De
|
|
|
492
492
|
});
|
|
493
493
|
};
|
|
494
494
|
function loadProdMetaScript(bundleName, filename) {
|
|
495
|
-
return new Promise((resolve, reject) => {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
495
|
+
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
496
|
+
try {
|
|
497
|
+
const script = document.createElement('script');
|
|
498
|
+
script.setAttribute('src', filename);
|
|
499
|
+
script.setAttribute('class', '@weapps-materials-control');
|
|
500
|
+
script.addEventListener('load', () => {
|
|
501
|
+
const moduleName = `@weapps-materials-control-${bundleName}`;
|
|
502
|
+
if (Object.prototype.hasOwnProperty.call(window, moduleName)) {
|
|
503
|
+
const value = window[moduleName];
|
|
504
|
+
return resolve(value);
|
|
505
|
+
}
|
|
506
|
+
return reject(new Error(`meta bundle [${bundleName}] must build with UMD`));
|
|
507
|
+
});
|
|
508
|
+
script.addEventListener('error', (e) => reject(`meta bundle [${bundleName}] load failed: ${(e === null || e === void 0 ? void 0 : e.message) || ''}`));
|
|
509
|
+
document.body.appendChild(script);
|
|
510
|
+
}
|
|
511
|
+
catch (e) {
|
|
512
|
+
const isNode = typeof global === 'object' && global.global === global;
|
|
513
|
+
if (isNode) {
|
|
514
|
+
// node 环境
|
|
515
|
+
const vm = require('vm');
|
|
516
|
+
const _fetch = require('node-fetch');
|
|
517
|
+
const fetch = _fetch.default || _fetch;
|
|
518
|
+
const sandbox = {
|
|
519
|
+
window: {},
|
|
520
|
+
};
|
|
521
|
+
const fetchRes = yield fetch(filename);
|
|
522
|
+
const content = yield fetchRes.text();
|
|
523
|
+
vm.createContext(sandbox);
|
|
524
|
+
vm.runInContext(content, sandbox);
|
|
525
|
+
const moduleName = `@weapps-materials-control-${bundleName}`;
|
|
526
|
+
return resolve(sandbox.window[moduleName]);
|
|
504
527
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
});
|
|
528
|
+
else {
|
|
529
|
+
throw e;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}));
|
|
510
533
|
}
|
|
511
534
|
function loadProdMetaStyle(bundleName, filename, entryDoc = document, isLess = false) {
|
|
512
535
|
if (!filename) {
|