|
1 |
| -/* ES Module Shims CSP 0.15.1 */ |
| 1 | +/* ES Module Shims 1.0.0 */ |
2 | 2 | (function () {
|
3 | 3 |
|
4 |
| - Promise.resolve(); |
5 |
| - |
6 | 4 | const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
|
7 | 5 |
|
8 | 6 | let baseUrl;
|
|
331 | 329 |
|
332 | 330 | let importMap = { imports: {}, scopes: {} };
|
333 | 331 | let importMapSrcOrLazy = false;
|
334 |
| - let importMapPromise = featureDetectionPromise; |
| 332 | + let importMapPromise = featureDetectionPromise.then(() => undefined); |
335 | 333 |
|
336 | 334 | let acceptingImportMaps = true;
|
337 | 335 | let nativeAcceptingImportMaps = true;
|
|
346 | 344 | }
|
347 | 345 | await importMapPromise;
|
348 | 346 | // early analysis opt-out - no need to even fetch if we have feature support
|
349 |
| - if (!shimMode && supportsDynamicImport && supportsImportMeta && supportsImportMaps && (!jsonModulesEnabled || supportsJsonAssertions) && (!cssModulesEnabled || supportsCssAssertions) && !importMapSrcOrLazy) { |
| 347 | + if (!shimMode && supportsDynamicImport && supportsImportMeta && supportsImportMaps && (!jsonModulesEnabled || supportsJsonAssertions) && (!cssModulesEnabled || supportsCssAssertions) && !importMapSrcOrLazy && !false) { |
350 | 348 | // for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
|
351 | 349 | if (nativelyLoaded)
|
352 | 350 | return null;
|
353 | 351 | await lastStaticLoadPromise;
|
354 | 352 | return dynamicImport(source ? createBlob(source) : url, { errUrl: url || source });
|
355 | 353 | }
|
356 |
| - await undefined; |
357 | 354 | const load = getOrCreateLoad(url, fetchOpts, source);
|
358 | 355 | const seen = {};
|
359 | 356 | await loadAll(load, seen);
|
360 | 357 | lastLoad = undefined;
|
361 | 358 | resolveDeps(load, seen);
|
362 | 359 | await lastStaticLoadPromise;
|
363 |
| - if (source && !shimMode && !load.n) { |
| 360 | + if (source && !shimMode && !load.n && !false) { |
364 | 361 | const module = await dynamicImport(createBlob(source), { errUrl: source });
|
365 | 362 | if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
|
366 | 363 | return module;
|
|
490 | 487 | resolvedSource += source.slice(lastIndex);
|
491 | 488 | }
|
492 | 489 |
|
493 |
| - resolvedSource = resolvedSource.replace(/\/\/# sourceMappingURL=(.*)\s*$/, (match, url) => { |
494 |
| - return match.replace(url, new URL(url, load.r)); |
495 |
| - }); |
| 490 | + resolvedSource = resolvedSource.replace(/\/\/# sourceMappingURL=(.*)\s*$/, (match, url) => match.replace(url, () => new URL(url, load.r))); |
496 | 491 | let hasSourceURL = false;
|
497 |
| - resolvedSource = resolvedSource.replace(/\/\/# sourceURL=(.*)\s*$/, (match, url) => { |
498 |
| - hasSourceURL = true; |
499 |
| - return match.replace(url, new URL(url, load.r)); |
500 |
| - }); |
501 |
| - if (!hasSourceURL) { |
| 492 | + resolvedSource = resolvedSource.replace(/\/\/# sourceURL=(.*)\s*$/, (match, url) => (hasSourceURL = true, match.replace(url, () => new URL(url, load.r)))); |
| 493 | + if (!hasSourceURL) |
502 | 494 | resolvedSource += '\n//# sourceURL=' + load.r;
|
503 |
| - } |
504 | 495 |
|
505 | 496 | load.b = lastLoad = createBlob(resolvedSource);
|
506 | 497 | load.S = undefined;
|
|
627 | 618 | return load;
|
628 | 619 | }
|
629 | 620 |
|
630 |
| - const scriptQuery = 'script[type="module-shim"],script[type="importmap-shim"],script[type="module"],script[type="importmap"]'; |
631 |
| - const preloadQuery = 'link[rel="modulepreload"]'; |
632 |
| - |
633 | 621 | function processScripts () {
|
634 |
| - for (const link of document.querySelectorAll(preloadQuery)) |
| 622 | + for (const link of document.querySelectorAll('link[rel="modulepreload"]')) |
635 | 623 | processPreload(link);
|
636 |
| - const scripts = document.querySelectorAll(scriptQuery); |
| 624 | + const scripts = document.querySelectorAll('script[type="module-shim"],script[type="importmap-shim"],script[type="module"],script[type="importmap"]'); |
637 | 625 | // early shim mode opt-in
|
638 | 626 | if (!shimMode) {
|
639 | 627 | for (const script of scripts) {
|
|
0 commit comments