es-module-shims 1.5.17 → 1.5.18

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/README.md CHANGED
@@ -29,7 +29,7 @@ Because we are still using the native module loader the edge cases work out comp
29
29
  Include ES Module Shims with a `async` attribute on the script, then include an import map and module scripts normally:
30
30
 
31
31
  ```html
32
- <script async src="https://ga.jspm.io/npm:es-module-shims@1.5.17/dist/es-module-shims.js"></script>
32
+ <script async src="https://ga.jspm.io/npm:es-module-shims@1.5.18/dist/es-module-shims.js"></script>
33
33
 
34
34
  <!-- https://generator.jspm.io/#U2NhYGBkDM0rySzJSU1hKEpNTC5xMLTQM9Az0C1K1jMAAKFS5w0gAA -->
35
35
  <script type="importmap">
@@ -1,4 +1,4 @@
1
- /* ES Module Shims 1.5.17 */
1
+ /* ES Module Shims 1.5.18 */
2
2
  (function () {
3
3
 
4
4
  const hasWindow = typeof window !== 'undefined';
@@ -101,22 +101,14 @@
101
101
  }
102
102
  }
103
103
 
104
- /*
105
- * Import maps implementation
106
- *
107
- * To make lookups fast we pre-resolve the entire import map
108
- * and then match based on backtracked hash lookups
109
- *
110
- */
111
104
  function resolveUrl (relUrl, parentUrl) {
112
105
  return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (isURL(relUrl) ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
113
106
  }
114
107
 
115
108
  function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
116
- // strip off any trailing query params or hashes
117
- const queryHashIndex = parentUrl.indexOf('?', parentUrl.indexOf('#') === -1 ? parentUrl.indexOf('#') : parentUrl.length);
118
- if (queryHashIndex !== -1)
119
- parentUrl = parentUrl.slice(0, queryHashIndex);
109
+ const hIdx = parentUrl.indexOf('#'), qIdx = parentUrl.indexOf('?');
110
+ if (hIdx + qIdx > -2)
111
+ parentUrl = parentUrl.slice(0, hIdx === -1 ? qIdx : qIdx === -1 || qIdx > hIdx ? hIdx : qIdx);
120
112
  if (relUrl.indexOf('\\') !== -1)
121
113
  relUrl = relUrl.replace(backslashRegEx, '/');
122
114
  // protocol-relative
@@ -641,9 +633,9 @@
641
633
  }
642
634
  }
643
635
 
644
- // support progressive cycle binding updates
636
+ // support progressive cycle binding updates (try statement avoids tdz errors)
645
637
  if (load.s)
646
- resolvedSource += `\n;import{u$_}from'${load.s}';u$_({ ${exports.filter(e => e.ln).map(({ s, e, ln }) => `${source.slice(s, e)}: ${ln}`).join(',')} });\n`;
638
+ resolvedSource += `\n;import{u$_}from'${load.s}';try{u$_({${exports.filter(e => e.ln).map(({ s, e, ln }) => `${source.slice(s, e)}: ${ln}`).join(',')}})}catch(_){};\n`;
647
639
 
648
640
  pushStringTo(source.length);
649
641
  }
@@ -1,4 +1,4 @@
1
- /* ES Module Shims Wasm 1.5.17 */
1
+ /* ES Module Shims Wasm 1.5.18 */
2
2
  (function () {
3
3
 
4
4
  const hasWindow = typeof window !== 'undefined';
@@ -101,22 +101,14 @@
101
101
  }
102
102
  }
103
103
 
104
- /*
105
- * Import maps implementation
106
- *
107
- * To make lookups fast we pre-resolve the entire import map
108
- * and then match based on backtracked hash lookups
109
- *
110
- */
111
104
  function resolveUrl (relUrl, parentUrl) {
112
105
  return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (isURL(relUrl) ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
113
106
  }
114
107
 
115
108
  function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
116
- // strip off any trailing query params or hashes
117
- const queryHashIndex = parentUrl.indexOf('?', parentUrl.indexOf('#') === -1 ? parentUrl.indexOf('#') : parentUrl.length);
118
- if (queryHashIndex !== -1)
119
- parentUrl = parentUrl.slice(0, queryHashIndex);
109
+ const hIdx = parentUrl.indexOf('#'), qIdx = parentUrl.indexOf('?');
110
+ if (hIdx + qIdx > -2)
111
+ parentUrl = parentUrl.slice(0, hIdx === -1 ? qIdx : qIdx === -1 || qIdx > hIdx ? hIdx : qIdx);
120
112
  if (relUrl.indexOf('\\') !== -1)
121
113
  relUrl = relUrl.replace(backslashRegEx, '/');
122
114
  // protocol-relative
@@ -641,9 +633,9 @@
641
633
  }
642
634
  }
643
635
 
644
- // support progressive cycle binding updates
636
+ // support progressive cycle binding updates (try statement avoids tdz errors)
645
637
  if (load.s)
646
- resolvedSource += `\n;import{u$_}from'${load.s}';u$_({ ${exports.filter(e => e.ln).map(({ s, e, ln }) => `${source.slice(s, e)}: ${ln}`).join(',')} });\n`;
638
+ resolvedSource += `\n;import{u$_}from'${load.s}';try{u$_({${exports.filter(e => e.ln).map(({ s, e, ln }) => `${source.slice(s, e)}: ${ln}`).join(',')}})}catch(_){};\n`;
647
639
 
648
640
  pushStringTo(source.length);
649
641
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-module-shims",
3
- "version": "1.5.17",
3
+ "version": "1.5.18",
4
4
  "description": "Shims for the latest ES module features",
5
5
  "main": "dist/es-module-shims.js",
6
6
  "exports": {