es-module-shims 1.3.1 → 1.3.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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/es-module-shims.js +7 -6
- package/dist/es-module-shims.wasm.js +7 -6
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
ES Module Shims 1.3.5 (2021/12/02)
|
|
2
|
+
* Fix trailing comment regex for source mapping normalization with trailling comments (https://github.com/guybedford/es-module-shims/pull/231)
|
|
3
|
+
|
|
4
|
+
ES Module Shims 1.3.4 (2021/12/02)
|
|
5
|
+
* Support source mapping normalization with trailing comments (https://github.com/guybedford/es-module-shims/pull/229)
|
|
6
|
+
|
|
7
|
+
ES Module Shims 1.3.3 (2021/11/30))
|
|
8
|
+
* Remove use of document.write (https://github.com/guybedford/es-module-shims/pull/227, @lewisl9029)
|
|
9
|
+
|
|
10
|
+
ES Module Shims 1.3.2 (2021/11/16)
|
|
11
|
+
* Fix CSP nonce detection (https://github.com/guybedford/es-module-shims/pull/223, @MathiasWP)
|
|
12
|
+
|
|
1
13
|
ES Module Shims 1.3.1 (2021/11/04)
|
|
2
14
|
* Feature: Support "async" attribute ordering on polyfill and shim scripts (https://github.com/guybedford/es-module-shims/pull/221)
|
|
3
15
|
* Fix: Sourcemap regex fix (https://github.com/guybedford/es-module-shims/pull/218)
|
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 = {
|
|
88
|
+
window.esmsInitOptions = { polyfillEnable: ['css-modules', 'json-modules'] }
|
|
89
89
|
</script>
|
|
90
90
|
```
|
|
91
91
|
|
package/dist/es-module-shims.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims 1.3.
|
|
1
|
+
/* ES Module Shims 1.3.5 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
if (!nonce) {
|
|
212
212
|
const nonceElement = document.querySelector('script[nonce]');
|
|
213
213
|
if (nonceElement)
|
|
214
|
-
nonce = nonceElement.getAttribute('nonce');
|
|
214
|
+
nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
const onerror = globalHook(esmsInitOptions$1.onerror || noop);
|
|
@@ -298,8 +298,7 @@
|
|
|
298
298
|
const iframe = document.createElement('iframe');
|
|
299
299
|
iframe.style.display = 'none';
|
|
300
300
|
document.head.appendChild(iframe);
|
|
301
|
-
|
|
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
|
});
|
|
@@ -530,9 +529,9 @@
|
|
|
530
529
|
resolvedSource += source.slice(lastIndex);
|
|
531
530
|
}
|
|
532
531
|
|
|
533
|
-
|
|
532
|
+
// ; and // trailer support added for Ruby 7 source maps compatibility
|
|
534
533
|
let hasSourceURL = false;
|
|
535
|
-
resolvedSource = resolvedSource.replace(
|
|
534
|
+
resolvedSource = resolvedSource.replace(sourceMapURLRegEx, (match, isMapping, url) => (hasSourceURL = !isMapping, match.replace(url, () => new URL(url, load.r))));
|
|
536
535
|
if (!hasSourceURL)
|
|
537
536
|
resolvedSource += '\n//# sourceURL=' + load.r;
|
|
538
537
|
|
|
@@ -540,6 +539,8 @@
|
|
|
540
539
|
load.S = undefined;
|
|
541
540
|
}
|
|
542
541
|
|
|
542
|
+
const sourceMapURLRegEx = /\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;
|
|
543
|
+
|
|
543
544
|
const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
|
|
544
545
|
const jsonContentType = /^(text|application)\/json(;|$)/;
|
|
545
546
|
const cssContentType = /^(text|application)\/css(;|$)/;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims Wasm 1.3.
|
|
1
|
+
/* ES Module Shims Wasm 1.3.5 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
if (!nonce) {
|
|
212
212
|
const nonceElement = document.querySelector('script[nonce]');
|
|
213
213
|
if (nonceElement)
|
|
214
|
-
nonce = nonceElement.getAttribute('nonce');
|
|
214
|
+
nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
const onerror = globalHook(esmsInitOptions$1.onerror || noop);
|
|
@@ -295,8 +295,7 @@
|
|
|
295
295
|
const iframe = document.createElement('iframe');
|
|
296
296
|
iframe.style.display = 'none';
|
|
297
297
|
document.head.appendChild(iframe);
|
|
298
|
-
|
|
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
|
});
|
|
@@ -528,9 +527,9 @@
|
|
|
528
527
|
resolvedSource += source.slice(lastIndex);
|
|
529
528
|
}
|
|
530
529
|
|
|
531
|
-
|
|
530
|
+
// ; and // trailer support added for Ruby 7 source maps compatibility
|
|
532
531
|
let hasSourceURL = false;
|
|
533
|
-
resolvedSource = resolvedSource.replace(
|
|
532
|
+
resolvedSource = resolvedSource.replace(sourceMapURLRegEx, (match, isMapping, url) => (hasSourceURL = !isMapping, match.replace(url, () => new URL(url, load.r))));
|
|
534
533
|
if (!hasSourceURL)
|
|
535
534
|
resolvedSource += '\n//# sourceURL=' + load.r;
|
|
536
535
|
|
|
@@ -538,6 +537,8 @@
|
|
|
538
537
|
load.S = undefined;
|
|
539
538
|
}
|
|
540
539
|
|
|
540
|
+
const sourceMapURLRegEx = /\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;
|
|
541
|
+
|
|
541
542
|
const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
|
|
542
543
|
const jsonContentType = /^(text|application)\/json(;|$)/;
|
|
543
544
|
const cssContentType = /^(text|application)\/css(;|$)/;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-module-shims",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.5",
|
|
4
4
|
"description": "Shims for the latest ES module features",
|
|
5
5
|
"main": "dist/es-module-shims.js",
|
|
6
6
|
"exports": {
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"build": "rollup -c",
|
|
12
12
|
"bench": "bash bench/bench.sh",
|
|
13
13
|
"bench:clear": "rm -rf bench/results",
|
|
14
|
-
"footprint": "npm run build
|
|
15
|
-
"footprint:csp": "npm run build
|
|
14
|
+
"footprint": "npm run build ; cat dist/es-module-shims.js | brotli | wc -c",
|
|
15
|
+
"footprint:csp": "npm run build ; cat dist/es-module-shims.csp.js | brotli | wc -c",
|
|
16
16
|
"prepublishOnly": "npm run build",
|
|
17
|
-
"test": "npm run test:test-base-href
|
|
17
|
+
"test": "npm run test:test-base-href ; npm run test:test-csp ; npm run test:test-dom-order ; npm run test:test-early-module-load ; npm run test:test-polyfill ; npm run test:test-polyfill-wasm ; npm run test:test-preload-case ; npm run test:test-revoke-blob-urls ; npm run test:test-shim",
|
|
18
18
|
"test:test-base-href": "cross-env TEST_NAME=test-base-href node test/server.mjs",
|
|
19
19
|
"test:test-csp": "cross-env TEST_NAME=test-csp node test/server.mjs",
|
|
20
20
|
"test:test-dom-order": "cross-env TEST_NAME=test-dom-order node test/server.mjs",
|