Skip to content

Commit 2489bae

Browse files
committed
Upgrade to esmshims 1.3.2
1 parent 3406286 commit 2489bae

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

app/assets/javascripts/es-module-shims.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* ES Module Shims 1.3.0 */
1+
/* ES Module Shims 1.3.2 */
22
(function () {
33

44
const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
@@ -211,7 +211,7 @@
211211
if (!nonce) {
212212
const nonceElement = document.querySelector('script[nonce]');
213213
if (nonceElement)
214-
nonce = nonceElement.getAttribute('nonce');
214+
nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
215215
}
216216

217217
const onerror = globalHook(esmsInitOptions$1.onerror || noop);
@@ -404,7 +404,7 @@
404404
if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
405405
return module;
406406
}
407-
const module = await dynamicImport((shimMode || load.n) ? load.b : load.u, { errUrl: load.u });
407+
const module = await dynamicImport(!shimMode && !load.n && nativelyLoaded ? load.u : load.b, { errUrl: load.u });
408408
// if the top-level load is a shell, run its update function
409409
if (load.s)
410410
(await dynamicImport(load.s)).u$_(module);
@@ -530,9 +530,9 @@
530530
resolvedSource += source.slice(lastIndex);
531531
}
532532

533-
resolvedSource = resolvedSource.replace(/\/\/# sourceMappingURL=(.*)\s*$/, (match, url) => match.replace(url, () => new URL(url, load.r)));
533+
resolvedSource = resolvedSource.replace(/\n\/\/# sourceMappingURL=([^\n]+)\s*$/, (match, url) => match.replace(url, () => new URL(url, load.r)));
534534
let hasSourceURL = false;
535-
resolvedSource = resolvedSource.replace(/\/\/# sourceURL=(.*)\s*$/, (match, url) => (hasSourceURL = true, match.replace(url, () => new URL(url, load.r))));
535+
resolvedSource = resolvedSource.replace(/\n\/\/# sourceURL=([^\n]+)\s*$/, (match, url) => (hasSourceURL = true, match.replace(url, () => new URL(url, load.r))));
536536
if (!hasSourceURL)
537537
resolvedSource += '\n//# sourceURL=' + load.r;
538538

@@ -760,11 +760,12 @@
760760
const isDomContentLoadedScript = domContentLoadedCnt > 0;
761761
if (isReadyScript) readyStateCompleteCnt++;
762762
if (isDomContentLoadedScript) domContentLoadedCnt++;
763-
const loadPromise = topLevelLoad(script.src || `${baseUrl}?${id++}`, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, isReadyScript && lastStaticLoadPromise).catch(e => {
763+
const blocks = script.getAttribute('async') === null && isReadyScript;
764+
const loadPromise = topLevelLoad(script.src || `${baseUrl}?${id++}`, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, blocks && lastStaticLoadPromise).catch(e => {
764765
setTimeout(() => { throw e });
765766
onerror(e);
766767
});
767-
if (isReadyScript)
768+
if (blocks)
768769
lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
769770
if (isDomContentLoadedScript)
770771
loadPromise.then(domContentLoadedCheck);

0 commit comments

Comments
 (0)