@micro-zoe/micro-app 0.8.4 → 0.8.5
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/index.esm.js +14 -13
- package/lib/index.esm.js.map +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.map +1 -1
- package/lib/index.umd.js +1 -1
- package/lib/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/typings/global.d.ts +2 -2
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const version = '0.8.
|
|
1
|
+
const version = '0.8.5';
|
|
2
2
|
// do not use isUndefined
|
|
3
3
|
const isBrowser = typeof window !== 'undefined';
|
|
4
4
|
// do not use isUndefined
|
|
@@ -372,7 +372,7 @@ function parseError(msg, linkPath) {
|
|
|
372
372
|
throw err;
|
|
373
373
|
}
|
|
374
374
|
/**
|
|
375
|
-
* Reference
|
|
375
|
+
* Reference https://github.com/reworkcss/css
|
|
376
376
|
* CSSParser mainly deals with 3 scenes: styleRule, @, and comment
|
|
377
377
|
* And scopecss deals with 2 scenes: selector & url
|
|
378
378
|
* And can also disable scopecss with inline comments
|
|
@@ -1605,7 +1605,7 @@ function execScripts(scriptList, app, initHook) {
|
|
|
1605
1605
|
function runScript(url, app, info, isDynamic, callback) {
|
|
1606
1606
|
var _a;
|
|
1607
1607
|
try {
|
|
1608
|
-
const code = bindScope(url, app, info.code, info
|
|
1608
|
+
const code = bindScope(url, app, info.code, info);
|
|
1609
1609
|
if (app.inline || info.module) {
|
|
1610
1610
|
const scriptElement = pureCreateElement('script');
|
|
1611
1611
|
runCode2InlineScript(url, code, info.module, scriptElement, callback);
|
|
@@ -1658,7 +1658,7 @@ function runDynamicRemoteScript(url, info, app, originScript) {
|
|
|
1658
1658
|
app.source.scripts.set(url, info);
|
|
1659
1659
|
info.isGlobal && globalScripts.set(url, code);
|
|
1660
1660
|
try {
|
|
1661
|
-
code = bindScope(url, app, code, info
|
|
1661
|
+
code = bindScope(url, app, code, info);
|
|
1662
1662
|
if (app.inline || info.module) {
|
|
1663
1663
|
runCode2InlineScript(url, code, info.module, replaceElement, dispatchScriptOnLoadEvent);
|
|
1664
1664
|
}
|
|
@@ -1714,13 +1714,13 @@ function runCode2Function(code, info) {
|
|
|
1714
1714
|
* @param url script address
|
|
1715
1715
|
* @param app app
|
|
1716
1716
|
* @param code code
|
|
1717
|
-
* @param
|
|
1717
|
+
* @param info source script info
|
|
1718
1718
|
*/
|
|
1719
|
-
function bindScope(url, app, code,
|
|
1719
|
+
function bindScope(url, app, code, info) {
|
|
1720
1720
|
if (isPlainObject(microApp.plugins)) {
|
|
1721
|
-
code = usePlugins(url, code, app.name, microApp.plugins);
|
|
1721
|
+
code = usePlugins(url, code, app.name, microApp.plugins, info);
|
|
1722
1722
|
}
|
|
1723
|
-
if (app.sandBox && !module) {
|
|
1723
|
+
if (app.sandBox && !info.module) {
|
|
1724
1724
|
globalEnv.rawWindow.__MICRO_APP_PROXY_WINDOW__ = app.sandBox.proxyWindow;
|
|
1725
1725
|
return `;(function(proxyWindow){with(proxyWindow.__MICRO_APP_WINDOW__){(function(${globalKeyToBeCached}){;${code}\n}).call(proxyWindow,${globalKeyToBeCached})}})(window.__MICRO_APP_PROXY_WINDOW__);`;
|
|
1726
1726
|
}
|
|
@@ -1732,19 +1732,20 @@ function bindScope(url, app, code, module) {
|
|
|
1732
1732
|
* @param code code
|
|
1733
1733
|
* @param appName app name
|
|
1734
1734
|
* @param plugins plugin list
|
|
1735
|
+
* @param info source script info
|
|
1735
1736
|
*/
|
|
1736
|
-
function usePlugins(url, code, appName, plugins) {
|
|
1737
|
+
function usePlugins(url, code, appName, plugins, info) {
|
|
1737
1738
|
var _a;
|
|
1738
|
-
const newCode = processCode(plugins.global, code, url);
|
|
1739
|
-
return processCode((_a = plugins.modules) === null || _a === void 0 ? void 0 : _a[appName], newCode, url);
|
|
1739
|
+
const newCode = processCode(plugins.global, code, url, info);
|
|
1740
|
+
return processCode((_a = plugins.modules) === null || _a === void 0 ? void 0 : _a[appName], newCode, url, info);
|
|
1740
1741
|
}
|
|
1741
|
-
function processCode(configs, code, url) {
|
|
1742
|
+
function processCode(configs, code, url, info) {
|
|
1742
1743
|
if (!isArray(configs)) {
|
|
1743
1744
|
return code;
|
|
1744
1745
|
}
|
|
1745
1746
|
return configs.reduce((preCode, config) => {
|
|
1746
1747
|
if (isPlainObject(config) && isFunction(config.loader)) {
|
|
1747
|
-
return config.loader(preCode, url, config.options);
|
|
1748
|
+
return config.loader(preCode, url, config.options, info);
|
|
1748
1749
|
}
|
|
1749
1750
|
return preCode;
|
|
1750
1751
|
}, code);
|