@micro-zoe/micro-app 0.7.0 → 0.7.1

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 CHANGED
@@ -1,4 +1,4 @@
1
- const version = '0.7.0';
1
+ const version = '0.7.1';
2
2
  // do not use isUndefined
3
3
  const isBrowser = typeof window !== 'undefined';
4
4
  // do not use isUndefined
@@ -340,7 +340,7 @@ var keepAliveStates;
340
340
  keepAliveStates["KEEP_ALIVE_SHOW"] = "KEEP_ALIVE_SHOW";
341
341
  keepAliveStates["KEEP_ALIVE_HIDDEN"] = "KEEP_ALIVE_HIDDEN";
342
342
  })(keepAliveStates || (keepAliveStates = {}));
343
- const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Promise,Function,Proxy,WeakMap,WeakRef,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,location,navigator,undefined';
343
+ const globalKeyToBeCached = 'window,self,globalThis,Array,Object,String,Boolean,Math,Number,Symbol,Date,Promise,Function,Proxy,WeakMap,WeakSet,Set,Map,Reflect,Element,Node,Document,RegExp,Error,TypeError,JSON,isNaN,parseFloat,parseInt,performance,console,decodeURI,encodeURI,decodeURIComponent,encodeURIComponent,location,navigator,undefined';
344
344
 
345
345
  /**
346
346
  * fetch source of html, js, css
@@ -491,7 +491,7 @@ function scopedStyleRule(rule, prefix) {
491
491
  */
492
492
  function scopedHost(cssText, baseURI, textContent, linkpath) {
493
493
  return cssText.replace(/url\(["']?([^)"']+)["']?\)/gm, (all, $1) => {
494
- if (/^(data|blob):/.test($1)) {
494
+ if (/^((data|blob):|#)/.test($1)) {
495
495
  return all;
496
496
  }
497
497
  else if (/^(https?:)?\/\//.test($1)) {
@@ -739,7 +739,12 @@ function fetchLinkSuccess(url, info, data, microAppHead, app) {
739
739
  styleLink.textContent = data;
740
740
  styleLink.__MICRO_APP_LINK_PATH__ = url;
741
741
  styleLink.setAttribute('data-origin-href', url);
742
- microAppHead.replaceChild(scopedCSS(styleLink, app), info.placeholder);
742
+ if (info.placeholder.parentNode) {
743
+ info.placeholder.parentNode.replaceChild(scopedCSS(styleLink, app), info.placeholder);
744
+ }
745
+ else {
746
+ microAppHead.appendChild(scopedCSS(styleLink, app));
747
+ }
743
748
  info.placeholder = null;
744
749
  info.code = data;
745
750
  }
@@ -2062,7 +2067,7 @@ class SandBox {
2062
2067
  });
2063
2068
  }
2064
2069
  createDescriptorFormicroAppWindow(key, value) {
2065
- const { configurable = true, enumerable = true, writable, set } = Object.getOwnPropertyDescriptor(globalEnv.rawWindow, key) || {};
2070
+ const { configurable = true, enumerable = true, writable, set } = Object.getOwnPropertyDescriptor(globalEnv.rawWindow, key) || { writable: true };
2066
2071
  const descriptor = {
2067
2072
  value,
2068
2073
  configurable,