@jsenv/core 20.0.2 → 20.0.6

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.
@@ -2517,7 +2517,7 @@
2517
2517
  });
2518
2518
 
2519
2519
  /*
2520
- * SJS 6.10.2
2520
+ * SJS 6.10.3
2521
2521
  * Minimal SystemJS Build
2522
2522
  */
2523
2523
  (function () {
@@ -2988,15 +2988,26 @@
2988
2988
  window.addEventListener('DOMContentLoaded', processScripts);
2989
2989
  }
2990
2990
 
2991
+ var inlineScripts = {};
2992
+
2991
2993
  function processScripts() {
2992
- [].forEach.call(document.querySelectorAll('script'), function (script) {
2994
+ [].forEach.call(document.querySelectorAll('script'), function (script, index) {
2993
2995
  if (script.sp) // sp marker = systemjs processed
2994
2996
  return; // TODO: deprecate systemjs-module in next major now that we have auto import
2995
2997
 
2996
2998
  if (script.type === 'systemjs-module') {
2997
2999
  script.sp = true;
2998
- if (!script.src) return;
2999
- System.import(script.src.slice(0, 7) === 'import:' ? script.src.slice(7) : resolveUrl(script.src, baseUrl)).catch(function (e) {
3000
+ var scriptSrc = script.src;
3001
+ var importUrl;
3002
+
3003
+ if (scriptSrc) {
3004
+ importUrl = scriptSrc.slice(0, 7) === "import:" ? scriptSrc.slice(7) : resolveUrl(scriptSrc, baseUrl);
3005
+ } else {
3006
+ importUrl = document.location.href + "_inline_script_" + index;
3007
+ inlineScripts[importUrl] = script.textContent;
3008
+ }
3009
+
3010
+ System.import(importUrl).catch(function (e) {
3000
3011
  // if there is a script load error, dispatch an "error" event
3001
3012
  // on the script tag.
3002
3013
  if (e.message.indexOf('https://git.io/JvFET#3') > -1) {
@@ -3108,6 +3119,14 @@
3108
3119
  }
3109
3120
 
3110
3121
  var loader = this;
3122
+ var inlineScriptContent = inlineScripts[url];
3123
+
3124
+ if (typeof inlineScriptContent === "string") {
3125
+ if (inlineScriptContent.indexOf("//# sourceURL=") < 0) inlineScriptContent += "\n//# sourceURL=" + url;
3126
+ (0, eval)(inlineScriptContent);
3127
+ return loader.getRegister(url);
3128
+ }
3129
+
3111
3130
  return new Promise(function (resolve, reject) {
3112
3131
  var script = systemJSPrototype.createScript(url);
3113
3132
  script.addEventListener('error', function () {
@@ -3120,7 +3139,7 @@
3120
3139
  if (lastWindowErrorUrl === url) {
3121
3140
  reject(lastWindowError);
3122
3141
  } else {
3123
- var register = loader.getRegister(); // Clear any auto import registration for dynamic import scripts during load
3142
+ var register = loader.getRegister(url); // Clear any auto import registration for dynamic import scripts during load
3124
3143
 
3125
3144
  if (register && register[0] === lastAutoImportDeps) clearTimeout(lastAutoImportTimeout);
3126
3145
  resolve(register);
@@ -3155,7 +3174,7 @@
3155
3174
  return res.text().then(function (source) {
3156
3175
  if (source.indexOf('//# sourceURL=') < 0) source += '\n//# sourceURL=' + url;
3157
3176
  (0, eval)(source);
3158
- return loader.getRegister();
3177
+ return loader.getRegister(url);
3159
3178
  });
3160
3179
  });
3161
3180
  };
@@ -3191,7 +3210,7 @@
3191
3210
  var loader = this;
3192
3211
  return Promise.resolve().then(function () {
3193
3212
  importScripts(url);
3194
- return loader.getRegister();
3213
+ return loader.getRegister(url);
3195
3214
  });
3196
3215
  };
3197
3216
  })();