es-module-shims 1.3.2 → 1.3.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ES Module Shims 1.3.3 (2021/11/30))
2
+ * Remove use of document.write (https://github.com/guybedford/es-module-shims/pull/227, @lewisl9029)
3
+
1
4
  ES Module Shims 1.3.2 (2021/11/16)
2
5
  * Fix CSP nonce detection (https://github.com/guybedford/es-module-shims/pull/223, @MathiasWP)
3
6
 
package/README.md CHANGED
@@ -85,7 +85,7 @@ If using CSS modules or JSON modules, since these features are relatively new, t
85
85
 
86
86
  ```html
87
87
  <script>
88
- window.esmsInitOptions = { enable: ['css-modules', 'json-modules'] }
88
+ window.esmsInitOptions = { polyfillEnable: ['css-modules', 'json-modules'] }
89
89
  </script>
90
90
  ```
91
91
 
@@ -1,4 +1,4 @@
1
- /* ES Module Shims 1.3.2 */
1
+ /* ES Module Shims 1.3.3 */
2
2
  (function () {
3
3
 
4
4
  const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
@@ -298,8 +298,7 @@
298
298
  const iframe = document.createElement('iframe');
299
299
  iframe.style.display = 'none';
300
300
  document.head.appendChild(iframe);
301
- // we use document.write here because eg Weixin built-in browser doesn't support setting srcdoc
302
- iframe.contentWindow.document.write(`<script type=importmap nonce="${nonce}">{"imports":{"x":"data:text/javascript,"}}<${''}/script><script nonce="${nonce}">import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<${''}/script>`);
301
+ iframe.src = createBlob(`<script type=importmap nonce="${nonce}">{"imports":{"x":"data:text/javascript,"}}<${''}/script><script nonce="${nonce}">import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<${''}/script>`, 'text/html');
303
302
  })
304
303
  ]);
305
304
  });
@@ -1,4 +1,4 @@
1
- /* ES Module Shims Wasm 1.3.2 */
1
+ /* ES Module Shims Wasm 1.3.3 */
2
2
  (function () {
3
3
 
4
4
  const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
@@ -295,8 +295,7 @@
295
295
  const iframe = document.createElement('iframe');
296
296
  iframe.style.display = 'none';
297
297
  document.head.appendChild(iframe);
298
- // we use document.write here because eg Weixin built-in browser doesn't support setting srcdoc
299
- iframe.contentWindow.document.write(`<script type=importmap nonce="${nonce}">{"imports":{"x":"data:text/javascript,"}}<${''}/script><script nonce="${nonce}">import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<${''}/script>`);
298
+ iframe.src = createBlob(`<script type=importmap nonce="${nonce}">{"imports":{"x":"data:text/javascript,"}}<${''}/script><script nonce="${nonce}">import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<${''}/script>`, 'text/html');
300
299
  })
301
300
  ]);
302
301
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-module-shims",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Shims for the latest ES module features",
5
5
  "main": "dist/es-module-shims.js",
6
6
  "exports": {