importmap-rails 0.5.2 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,698 +0,0 @@
1
- /* ES Module Shims 0.12.8 */
2
- (function () {
3
- // Bail on all shimming for Chrome until https://github.com/guybedford/es-module-shims/issues/150
4
- if (navigator.userAgent.match("Chrome")) return
5
-
6
- const resolvedPromise = Promise.resolve();
7
-
8
- let baseUrl;
9
-
10
- function createBlob (source, type = 'text/javascript') {
11
- return URL.createObjectURL(new Blob([source], { type }));
12
- }
13
-
14
- const hasDocument = typeof document !== 'undefined';
15
-
16
- // support browsers without dynamic import support (eg Firefox 6x)
17
- let supportsDynamicImport = false;
18
- let supportsJsonAssertions = false;
19
- let supportsCssAssertions = false;
20
- let dynamicImport;
21
- try {
22
- dynamicImport = (0, eval)('u=>import(u)');
23
- supportsDynamicImport = true;
24
- }
25
- catch (e) {
26
- if (hasDocument) {
27
- let err;
28
- self.addEventListener('error', e => err = e.error);
29
- dynamicImport = blobUrl => {
30
- const topLevelBlobUrl = createBlob(
31
- `import*as m from'${blobUrl}';self._esmsi=m;`
32
- );
33
- const s = document.createElement('script');
34
- s.type = 'module';
35
- s.src = topLevelBlobUrl;
36
- document.head.appendChild(s);
37
- return new Promise((resolve, reject) => {
38
- s.addEventListener('load', () => {
39
- document.head.removeChild(s);
40
- if (self._esmsi) {
41
- resolve(self._esmsi, baseUrl);
42
- self._esmsi = null;
43
- }
44
- else {
45
- reject(err);
46
- }
47
- });
48
- });
49
- };
50
- }
51
- }
52
-
53
- let supportsImportMeta = false;
54
- let supportsImportMaps = false;
55
-
56
- const featureDetectionPromise = Promise.all([
57
- dynamicImport(createBlob('import"data:text/css,{}"assert{type:"css"}')).then(() => supportsCssAssertions = true, () => {}),
58
- dynamicImport(createBlob('import"data:text/json,{}"assert{type:"json"}')).then(() => supportsJsonAssertions = true, () => {}),
59
- dynamicImport(createBlob('import.meta')).then(() => supportsImportMeta = true, () => {}),
60
- supportsDynamicImport && hasDocument && new Promise(resolve => {
61
- self._$s = v => {
62
- document.body.removeChild(iframe);
63
- if (v) supportsImportMaps = true;
64
- delete self._$s;
65
- resolve();
66
- };
67
- const iframe = document.createElement('iframe');
68
- iframe.style.display = 'none';
69
- iframe.srcdoc = `<script type=importmap>{"imports":{"x":"data:text/javascript,"}}<${''}/script><script>import('x').then(()=>1,()=>0).then(v=>parent._$s(v))<${''}/script>`, 'text/html';
70
- document.body.appendChild(iframe);
71
- })
72
- ]);
73
-
74
- if (hasDocument) {
75
- const baseEl = document.querySelector('base[href]');
76
- if (baseEl)
77
- baseUrl = baseEl.href;
78
- }
79
-
80
- if (!baseUrl && typeof location !== 'undefined') {
81
- baseUrl = location.href.split('#')[0].split('?')[0];
82
- const lastSepIndex = baseUrl.lastIndexOf('/');
83
- if (lastSepIndex !== -1)
84
- baseUrl = baseUrl.slice(0, lastSepIndex + 1);
85
- }
86
-
87
- const backslashRegEx = /\\/g;
88
- function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
89
- // strip off any trailing query params or hashes
90
- parentUrl = parentUrl && parentUrl.split('#')[0].split('?')[0];
91
- if (relUrl.indexOf('\\') !== -1)
92
- relUrl = relUrl.replace(backslashRegEx, '/');
93
- // protocol-relative
94
- if (relUrl[0] === '/' && relUrl[1] === '/') {
95
- return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
96
- }
97
- // relative-url
98
- else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
99
- relUrl.length === 1 && (relUrl += '/')) ||
100
- relUrl[0] === '/') {
101
- const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
102
- // Disabled, but these cases will give inconsistent results for deep backtracking
103
- //if (parentUrl[parentProtocol.length] !== '/')
104
- // throw new Error('Cannot resolve');
105
- // read pathname from parent URL
106
- // pathname taken to be part after leading "/"
107
- let pathname;
108
- if (parentUrl[parentProtocol.length + 1] === '/') {
109
- // resolving to a :// so we need to read out the auth and host
110
- if (parentProtocol !== 'file:') {
111
- pathname = parentUrl.slice(parentProtocol.length + 2);
112
- pathname = pathname.slice(pathname.indexOf('/') + 1);
113
- }
114
- else {
115
- pathname = parentUrl.slice(8);
116
- }
117
- }
118
- else {
119
- // resolving to :/ so pathname is the /... part
120
- pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
121
- }
122
-
123
- if (relUrl[0] === '/')
124
- return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
125
-
126
- // join together and split for removal of .. and . segments
127
- // looping the string instead of anything fancy for perf reasons
128
- // '../../../../../z' resolved to 'x/y' is just 'z'
129
- const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
130
-
131
- const output = [];
132
- let segmentIndex = -1;
133
- for (let i = 0; i < segmented.length; i++) {
134
- // busy reading a segment - only terminate on '/'
135
- if (segmentIndex !== -1) {
136
- if (segmented[i] === '/') {
137
- output.push(segmented.slice(segmentIndex, i + 1));
138
- segmentIndex = -1;
139
- }
140
- }
141
-
142
- // new segment - check if it is relative
143
- else if (segmented[i] === '.') {
144
- // ../ segment
145
- if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
146
- output.pop();
147
- i += 2;
148
- }
149
- // ./ segment
150
- else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
151
- i += 1;
152
- }
153
- else {
154
- // the start of a new segment as below
155
- segmentIndex = i;
156
- }
157
- }
158
- // it is the start of a new segment
159
- else {
160
- segmentIndex = i;
161
- }
162
- }
163
- // finish reading out the last segment
164
- if (segmentIndex !== -1)
165
- output.push(segmented.slice(segmentIndex));
166
- return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
167
- }
168
- }
169
-
170
- /*
171
- * Import maps implementation
172
- *
173
- * To make lookups fast we pre-resolve the entire import map
174
- * and then match based on backtracked hash lookups
175
- *
176
- */
177
- function resolveUrl (relUrl, parentUrl) {
178
- return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (relUrl.indexOf(':') !== -1 ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
179
- }
180
-
181
- function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
182
- for (let p in packages) {
183
- const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
184
- let target = packages[p];
185
- if (typeof target !== 'string')
186
- continue;
187
- const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
188
- if (mapped) {
189
- outPackages[resolvedLhs] = mapped;
190
- continue;
191
- }
192
- targetWarning(p, packages[p], 'bare specifier did not resolve');
193
- }
194
- }
195
-
196
- function resolveAndComposeImportMap (json, baseUrl, parentMap) {
197
- const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes) };
198
-
199
- if (json.imports)
200
- resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap);
201
-
202
- if (json.scopes)
203
- for (let s in json.scopes) {
204
- const resolvedScope = resolveUrl(s, baseUrl);
205
- resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
206
- }
207
-
208
- return outMap;
209
- }
210
-
211
- function getMatch (path, matchObj) {
212
- if (matchObj[path])
213
- return path;
214
- let sepIndex = path.length;
215
- do {
216
- const segment = path.slice(0, sepIndex + 1);
217
- if (segment in matchObj)
218
- return segment;
219
- } while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
220
- }
221
-
222
- function applyPackages (id, packages) {
223
- const pkgName = getMatch(id, packages);
224
- if (pkgName) {
225
- const pkg = packages[pkgName];
226
- if (pkg === null) return;
227
- if (id.length > pkgName.length && pkg[pkg.length - 1] !== '/')
228
- targetWarning(pkgName, pkg, "should have a trailing '/'");
229
- else
230
- return pkg + id.slice(pkgName.length);
231
- }
232
- }
233
-
234
- function targetWarning (match, target, msg) {
235
- console.warn("Package target " + msg + ", resolving target '" + target + "' for " + match);
236
- }
237
-
238
- function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
239
- let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
240
- while (scopeUrl) {
241
- const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
242
- if (packageResolution)
243
- return packageResolution;
244
- scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
245
- }
246
- return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
247
- }
248
-
249
- /* es-module-lexer 0.7.1 */
250
- const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(E,g="@"){if(!C)return init.then(()=>parse(E));const I=E.length+1,D=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;D>0&&C.memory.grow(Math.ceil(D/65536));const w=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,w,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const L=[],k=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),D=C.se();let w;C.ip()&&(w=o(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),L.push({n:w,s:A,e:Q,ss:I,se:D,d:g,a:B});}for(;C.re();)k.push(E.slice(C.es(),C.ee()));function o(A){try{return (0,eval)(A)}catch{}}return [L,k,!!C.f()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<B;)Q[C]=A.charCodeAt(C++);}let C;const init=WebAssembly.compile((E="AGFzbQEAAAABXA1gAX8Bf2AEf39/fwBgAn9/AGAAAX9gAABgAX8AYAZ/f39/f38Bf2AEf39/fwF/YAN/f38Bf2AHf39/f39/fwF/YAV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oiA0EDSw0CIAIhACADDgQAAgIAAAtBACACNgLkCBAfQQAPCwJAAkAgBA4CAQABC0EAIAI2AuQIQd0ADwsgAEEEaiEADAALC0kBAX9BACEHAkAgAC8BCiAGRw0AIAAvAQggBUcNACAALwEGIARHDQAgAC8BBCADRw0AIAAvAQIgAkcNACAALwEAIAFGIQcLIAcLUwEBf0EAIQgCQCAALwEMIAdHDQAgAC8BCiAGRw0AIAAvAQggBUcNACAALwEGIARHDQAgAC8BBCADRw0AIAAvAQIgAkcNACAALwEAIAFGIQgLIAgLCx8CAEGACAsCAAAAQYQICxABAAAAAgAAAAAEAABwOAAA","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),A=>A.charCodeAt(0)))).then(WebAssembly.instantiate).then(({exports:A})=>{C=A;});var E;
251
-
252
- let id = 0;
253
- const registry = {};
254
- if (self.ESMS_DEBUG) {
255
- self._esmsr = registry;
256
- }
257
-
258
- async function loadAll (load, seen) {
259
- if (load.b || seen[load.u])
260
- return;
261
- seen[load.u] = 1;
262
- await load.L;
263
- await Promise.all(load.d.map(dep => loadAll(dep, seen)));
264
- if (!load.n)
265
- load.n = load.d.some(dep => dep.n);
266
- }
267
-
268
- let importMap = { imports: {}, scopes: {} };
269
- let importMapSrcOrLazy = false;
270
- let importMapPromise = resolvedPromise;
271
-
272
- let waitingForImportMapsInterval;
273
- let firstTopLevelProcess = true;
274
- async function topLevelLoad (url, fetchOpts, source, nativelyLoaded, lastStaticLoadPromise) {
275
- // no need to even fetch if we have feature support
276
- await featureDetectionPromise;
277
- if (waitingForImportMapsInterval > 0) {
278
- clearTimeout(waitingForImportMapsInterval);
279
- waitingForImportMapsInterval = 0;
280
- }
281
- if (firstTopLevelProcess) {
282
- firstTopLevelProcess = false;
283
- processScripts();
284
- }
285
- await importMapPromise;
286
- // early analysis opt-out
287
- if (nativelyLoaded && supportsDynamicImport && supportsImportMeta && supportsImportMaps && supportsJsonAssertions && supportsCssAssertions && !importMapSrcOrLazy) {
288
- // dont reexec inline for polyfills -> just return null (since no module id for executed inline module scripts)
289
- return source && nativelyLoaded ? null : dynamicImport(source ? createBlob(source) : url);
290
- }
291
- await init;
292
- const load = getOrCreateLoad(url, fetchOpts, source);
293
- const seen = {};
294
- await loadAll(load, seen);
295
- lastLoad = undefined;
296
- resolveDeps(load, seen);
297
- await lastStaticLoadPromise;
298
- if (source && !shimMode && !load.n) {
299
- if (lastStaticLoadPromise) {
300
- didExecForReadyPromise = true;
301
- if (domContentLoaded)
302
- didExecForDomContentLoaded = true;
303
- }
304
- const module = dynamicImport(createBlob(source));
305
- if (shouldRevokeBlobURLs) revokeObjectURLs(Object.keys(seen));
306
- return module;
307
- }
308
- const module = await dynamicImport(load.b);
309
- if (lastStaticLoadPromise && (!nativelyLoaded || load.b !== load.u)) {
310
- didExecForReadyPromise = true;
311
- if (domContentLoaded)
312
- didExecForDomContentLoaded = true;
313
- }
314
- // if the top-level load is a shell, run its update function
315
- if (load.s) {
316
- (await dynamicImport(load.s)).u$_(module);
317
- }
318
- if (shouldRevokeBlobURLs) revokeObjectURLs(Object.keys(seen));
319
- // when tla is supported, this should return the tla promise as an actual handle
320
- // so readystate can still correspond to the sync subgraph exec completions
321
- return module;
322
- }
323
-
324
- function revokeObjectURLs(registryKeys) {
325
- let batch = 0;
326
- const keysLength = registryKeys.length;
327
- const schedule = self.requestIdleCallback ? self.requestIdleCallback : self.requestAnimationFrame;
328
- schedule(cleanup);
329
- function cleanup() {
330
- const batchStartIndex = batch * 100;
331
- if (batchStartIndex > keysLength) return
332
- for (const key of registryKeys.slice(batchStartIndex, batchStartIndex + 100)) {
333
- const load = registry[key];
334
- if (load) URL.revokeObjectURL(load.b);
335
- }
336
- batch++;
337
- schedule(cleanup);
338
- }
339
- }
340
-
341
- async function importShim (id, parentUrl = baseUrl, _assertion) {
342
- await featureDetectionPromise;
343
- // Make sure all the "in-flight" import maps are loaded and applied.
344
- await importMapPromise;
345
- const resolved = await resolve(id, parentUrl);
346
- return topLevelLoad(resolved.r || throwUnresolved(id, parentUrl), { credentials: 'same-origin' });
347
- }
348
-
349
- self.importShim = importShim;
350
-
351
- const meta = {};
352
-
353
- const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
354
-
355
- async function importMetaResolve (id, parentUrl = this.url) {
356
- await importMapPromise;
357
- const resolved = await resolve(id, `${parentUrl}`);
358
- return resolved.r || throwUnresolved(id, parentUrl);
359
- }
360
-
361
- self._esmsm = meta;
362
-
363
- const esmsInitOptions = self.esmsInitOptions || {};
364
- delete self.esmsInitOptions;
365
- let shimMode = typeof esmsInitOptions.shimMode === 'boolean' ? esmsInitOptions.shimMode : !!esmsInitOptions.fetch || !!document.querySelector('script[type="module-shim"],script[type="importmap-shim"]');
366
- const fetchHook = esmsInitOptions.fetch || ((url, opts) => fetch(url, opts));
367
- const skip = esmsInitOptions.skip || /^https?:\/\/(cdn\.skypack\.dev|jspm\.dev)\//;
368
- const onerror = esmsInitOptions.onerror || ((e) => { throw e; });
369
- const shouldRevokeBlobURLs = esmsInitOptions.revokeBlobURLs;
370
- const noLoadEventRetriggers = esmsInitOptions.noLoadEventRetriggers;
371
-
372
- function urlJsString (url) {
373
- return `'${url.replace(/'/g, "\\'")}'`;
374
- }
375
-
376
- let lastLoad;
377
- function resolveDeps (load, seen) {
378
- if (load.b || !seen[load.u])
379
- return;
380
- seen[load.u] = 0;
381
-
382
- for (const dep of load.d)
383
- resolveDeps(dep, seen);
384
-
385
- // use direct native execution when possible
386
- // load.n is therefore conservative
387
- if (!shimMode && !load.n) {
388
- load.b = lastLoad = load.u;
389
- load.S = undefined;
390
- return;
391
- }
392
-
393
- const [imports] = load.a;
394
-
395
- // "execution"
396
- const source = load.S;
397
-
398
- // edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
399
- let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
400
-
401
- if (!imports.length) {
402
- resolvedSource += source;
403
- }
404
- else {
405
- // once all deps have loaded we can inline the dependency resolution blobs
406
- // and define this blob
407
- let lastIndex = 0, depIndex = 0;
408
- for (const { s: start, se: end, d: dynamicImportIndex } of imports) {
409
- // dependency source replacements
410
- if (dynamicImportIndex === -1) {
411
- const depLoad = load.d[depIndex++];
412
- let blobUrl = depLoad.b;
413
- if (!blobUrl) {
414
- // circular shell creation
415
- if (!(blobUrl = depLoad.s)) {
416
- blobUrl = depLoad.s = createBlob(`export function u$_(m){${
417
- depLoad.a[1].map(
418
- name => name === 'default' ? `$_default=m.default` : `${name}=m.${name}`
419
- ).join(',')
420
- }}${
421
- depLoad.a[1].map(name =>
422
- name === 'default' ? `let $_default;export{$_default as default}` : `export let ${name}`
423
- ).join(';')
424
- }\n//# sourceURL=${depLoad.r}?cycle`);
425
- }
426
- }
427
- // circular shell execution
428
- else if (depLoad.s) {
429
- resolvedSource += `${source.slice(lastIndex, start - 1)}/*${source.slice(start - 1, end)}*/${urlJsString(blobUrl)};import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
430
- lastIndex = end;
431
- depLoad.s = undefined;
432
- continue;
433
- }
434
- resolvedSource += `${source.slice(lastIndex, start - 1)}/*${source.slice(start - 1, end)}*/${urlJsString(blobUrl)}`;
435
- lastIndex = end;
436
- }
437
- // import.meta
438
- else if (dynamicImportIndex === -2) {
439
- meta[load.r] = { url: load.r, resolve: importMetaResolve };
440
- resolvedSource += `${source.slice(lastIndex, start)}self._esmsm[${urlJsString(load.r)}]`;
441
- lastIndex = end;
442
- }
443
- // dynamic import
444
- else {
445
- resolvedSource += `${source.slice(lastIndex, dynamicImportIndex + 6)}Shim(${source.slice(start, end)}, ${load.r && urlJsString(load.r)}`;
446
- lastIndex = end;
447
- }
448
- }
449
-
450
- resolvedSource += source.slice(lastIndex);
451
- }
452
-
453
- resolvedSource = resolvedSource.replace(/\/\/# sourceMappingURL=(.*)\s*$/, (match, url) => {
454
- return match.replace(url, new URL(url, load.r));
455
- });
456
- let hasSourceURL = false;
457
- resolvedSource = resolvedSource.replace(/\/\/# sourceURL=(.*)\s*$/, (match, url) => {
458
- hasSourceURL = true;
459
- return match.replace(url, new URL(url, load.r));
460
- });
461
- if (!hasSourceURL) {
462
- resolvedSource += '\n//# sourceURL=' + load.r;
463
- }
464
-
465
- load.b = lastLoad = createBlob(resolvedSource);
466
- load.S = undefined;
467
- }
468
-
469
- const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
470
- const jsonContentType = /^application\/json(;|$)/;
471
- const cssContentType = /^text\/css(;|$)/;
472
- const wasmContentType = /^application\/wasm(;|$)/;
473
-
474
- const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;
475
-
476
- async function doFetch (url, fetchOpts) {
477
- const res = await fetchHook(url, fetchOpts);
478
- if (!res.ok)
479
- throw new Error(`${res.status} ${res.statusText} ${res.url}`);
480
- const contentType = res.headers.get('content-type');
481
- if (jsContentType.test(contentType))
482
- return { r: res.url, s: await res.text(), t: 'js' };
483
- else if (jsonContentType.test(contentType))
484
- return { r: res.url, s: `export default ${await res.text()}`, t: 'json' };
485
- else if (cssContentType.test(contentType))
486
- return { r: res.url, s: `var s=new CSSStyleSheet();s.replaceSync(${
487
- JSON.stringify((await res.text()).replace(cssUrlRegEx, (_match, quotes, relUrl1, relUrl2) => `url(${quotes}${resolveUrl(relUrl1 || relUrl2, url)}${quotes})`))
488
- });export default s;`, t: 'css' };
489
- else if (wasmContentType.test(contentType))
490
- throw new Error('WASM modules not yet supported');
491
- else
492
- throw new Error(`Unknown Content-Type "${contentType}"`);
493
- }
494
-
495
- function getOrCreateLoad (url, fetchOpts, source) {
496
- let load = registry[url];
497
- if (load)
498
- return load;
499
-
500
- load = registry[url] = {
501
- // url
502
- u: url,
503
- // response url
504
- r: undefined,
505
- // fetchPromise
506
- f: undefined,
507
- // source
508
- S: undefined,
509
- // linkPromise
510
- L: undefined,
511
- // analysis
512
- a: undefined,
513
- // deps
514
- d: undefined,
515
- // blobUrl
516
- b: undefined,
517
- // shellUrl
518
- s: undefined,
519
- // needsShim
520
- n: false,
521
- // type
522
- t: null
523
- };
524
-
525
- load.f = (async () => {
526
- if (!source) {
527
- // preload fetch options override fetch options (race)
528
- let t;
529
- ({ r: load.r, s: source, t } = await (fetchCache[url] || doFetch(url, fetchOpts)));
530
- if (t === 'css' && !supportsCssAssertions || t === 'json' && !supportsJsonAssertions)
531
- load.n = true;
532
- }
533
- try {
534
- load.a = parse(source, load.u);
535
- }
536
- catch (e) {
537
- console.warn(e);
538
- load.a = [[], []];
539
- }
540
- load.S = source;
541
- return load;
542
- })();
543
-
544
- load.L = load.f.then(async () => {
545
- let childFetchOpts = fetchOpts;
546
- load.d = (await Promise.all(load.a[0].map(async ({ n, d, a }) => {
547
- if (d >= 0 && !supportsDynamicImport ||
548
- d === 2 && (!supportsImportMeta || source.slice(end, end + 8) === '.resolve'))
549
- load.n = true;
550
- if (!n) return;
551
- const { r, m } = await resolve(n, load.r || load.u);
552
- if (m && (!supportsImportMaps || importMapSrcOrLazy))
553
- load.n = true;
554
- if (d !== -1) return;
555
- if (!r)
556
- throwUnresolved(n, load.r || load.u);
557
- if (skip.test(r)) return { b: r };
558
- if (childFetchOpts.integrity)
559
- childFetchOpts = Object.assign({}, childFetchOpts, { integrity: undefined });
560
- return getOrCreateLoad(r, childFetchOpts).f;
561
- }))).filter(l => l);
562
- });
563
-
564
- return load;
565
- }
566
-
567
- function processScripts () {
568
- if (waitingForImportMapsInterval > 0 && document.readyState !== 'loading') {
569
- clearTimeout(waitingForImportMapsInterval);
570
- waitingForImportMapsInterval = 0;
571
- }
572
- for (const link of document.querySelectorAll('link[rel="modulepreload"]'))
573
- processPreload(link);
574
- for (const script of document.querySelectorAll('script[type="module-shim"],script[type="importmap-shim"],script[type="module"],script[type="importmap"]'))
575
- processScript(script);
576
- }
577
-
578
- function getFetchOpts (script) {
579
- const fetchOpts = {};
580
- if (script.integrity)
581
- fetchOpts.integrity = script.integrity;
582
- if (script.referrerpolicy)
583
- fetchOpts.referrerPolicy = script.referrerpolicy;
584
- if (script.crossorigin === 'use-credentials')
585
- fetchOpts.credentials = 'include';
586
- else if (script.crossorigin === 'anonymous')
587
- fetchOpts.credentials = 'omit';
588
- else
589
- fetchOpts.credentials = 'same-origin';
590
- return fetchOpts;
591
- }
592
-
593
- let staticLoadCnt = 0;
594
- let didExecForReadyPromise = false;
595
- let didExecForDomContentLoaded = false;
596
- let lastStaticLoadPromise = Promise.resolve();
597
- let domContentLoaded = false;
598
- document.addEventListener('DOMContentLoaded', () => domContentLoaded = true);
599
- function staticLoadCheck () {
600
- staticLoadCnt--;
601
- if (staticLoadCnt === 0 && !noLoadEventRetriggers) {
602
- if (didExecForDomContentLoaded)
603
- document.dispatchEvent(new Event('DOMContentLoaded'));
604
- if (didExecForReadyPromise && document.readyState === 'complete')
605
- document.dispatchEvent(new Event('readystatechange'));
606
- }
607
- }
608
-
609
- function processScript (script, dynamic) {
610
- if (script.ep) // ep marker = script processed
611
- return;
612
- const shim = script.type.endsWith('-shim');
613
- if (shim) shimMode = true;
614
- const type = shimMode ? script.type.slice(0, -5) : script.type;
615
- // dont process module scripts in shim mode or noshim module scripts in polyfill mode
616
- if (!shim && shimMode || script.getAttribute('noshim') !== null)
617
- return;
618
- // empty inline scripts sometimes show before domready
619
- if (!script.src && !script.innerHTML)
620
- return;
621
- script.ep = true;
622
- if (type === 'module') {
623
- const isReadyScript = document.readyState !== 'complete';
624
- if (isReadyScript) staticLoadCnt++;
625
- const p = topLevelLoad(script.src || `${baseUrl}?${id++}`, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, isReadyScript && lastStaticLoadPromise);
626
- p.catch(onerror);
627
- if (isReadyScript) {
628
- lastStaticLoadPromise = p.catch(staticLoadCheck);
629
- p.then(staticLoadCheck);
630
- }
631
- }
632
- else if (type === 'importmap') {
633
- importMapPromise = importMapPromise.then(async () => {
634
- if (script.src || dynamic)
635
- importMapSrcOrLazy = true;
636
- importMap = resolveAndComposeImportMap(script.src ? await (await fetchHook(script.src)).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap);
637
- });
638
- }
639
- }
640
-
641
- const fetchCache = {};
642
- function processPreload (link) {
643
- if (link.ep) // ep marker = processed
644
- return;
645
- link.ep = true;
646
- if (fetchCache[link.href])
647
- return;
648
- fetchCache[link.href] = doFetch(link.href, getFetchOpts(link));
649
- }
650
-
651
- new MutationObserver(mutations => {
652
- for (const mutation of mutations) {
653
- if (mutation.type !== 'childList') continue;
654
- for (const node of mutation.addedNodes) {
655
- if (node.tagName === 'SCRIPT' && node.type)
656
- processScript(node, !firstTopLevelProcess);
657
- else if (node.tagName === 'LINK' && node.rel === 'modulepreload')
658
- processPreload(node);
659
- else if (node.querySelectorAll) {
660
- for (const script of node.querySelectorAll('script[type="module-shim"],script[type="importmap-shim"],script[type="module"],script[type="importmap"]')) {
661
- processScript(script, !firstTopLevelProcess);
662
- }
663
- for (const link of node.querySelectorAll('link[rel=modulepreload]')) {
664
- processPreload(link);
665
- }
666
- }
667
- }
668
- }
669
- }).observe(document, { childList: true, subtree: true });
670
-
671
- async function defaultResolve (id, parentUrl) {
672
- return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl);
673
- }
674
-
675
- async function resolve (id, parentUrl) {
676
- let urlResolved = resolveIfNotPlainOrUrl(id, parentUrl);
677
-
678
- let resolved;
679
- if (esmsInitOptions.resolve) {
680
- resolved = await esmsInitOptions.resolve(id, parentUrl, defaultResolve);
681
- }
682
- else {
683
- resolved = resolveImportMap(importMap, urlResolved || id, parentUrl);
684
- }
685
-
686
- return { r: resolved, m: urlResolved !== resolved };
687
- }
688
-
689
- function throwUnresolved (id, parentUrl) {
690
- throw Error("Unable to resolve specifier '" + id + (parentUrl ? "' from " + parentUrl : "'"));
691
- }
692
-
693
- if (hasDocument) {
694
- processScripts();
695
- waitingForImportMapsInterval = setInterval(processScripts, 20);
696
- }
697
-
698
- }());