es-module-shims 1.7.0 → 1.7.1
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/README.md +912 -912
- package/dist/es-module-shims.debug.js +938 -0
- package/dist/es-module-shims.js +919 -898
- package/dist/es-module-shims.wasm.debug.js +898 -0
- package/dist/es-module-shims.wasm.js +919 -898
- package/index.d.ts +212 -212
- package/package.json +50 -50
|
@@ -1,904 +1,925 @@
|
|
|
1
|
-
/* ES Module Shims Wasm 1.7.
|
|
1
|
+
/* ES Module Shims Wasm 1.7.1 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
|
-
const hasWindow = typeof window !== 'undefined';
|
|
5
|
-
const hasDocument = typeof document !== 'undefined';
|
|
6
|
-
|
|
7
|
-
const noop = () => {};
|
|
8
|
-
|
|
9
|
-
const optionsScript = hasDocument ? document.querySelector('script[type=esms-options]') : undefined;
|
|
10
|
-
|
|
11
|
-
const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : {};
|
|
12
|
-
Object.assign(esmsInitOptions, self.esmsInitOptions || {});
|
|
13
|
-
|
|
14
|
-
let shimMode = hasDocument ? !!esmsInitOptions.shimMode : true;
|
|
15
|
-
|
|
16
|
-
const importHook = globalHook(shimMode && esmsInitOptions.onimport);
|
|
17
|
-
const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);
|
|
18
|
-
let fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;
|
|
19
|
-
const metaHook = esmsInitOptions.meta ? globalHook(shimMode && esmsInitOptions.meta) : noop;
|
|
20
|
-
|
|
21
|
-
const mapOverrides = esmsInitOptions.mapOverrides;
|
|
22
|
-
|
|
23
|
-
let nonce = esmsInitOptions.nonce;
|
|
24
|
-
if (!nonce && hasDocument) {
|
|
25
|
-
const nonceElement = document.querySelector('script[nonce]');
|
|
26
|
-
if (nonceElement)
|
|
27
|
-
nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const onerror = globalHook(esmsInitOptions.onerror || noop);
|
|
31
|
-
const onpolyfill = esmsInitOptions.onpolyfill ? globalHook(esmsInitOptions.onpolyfill) : () => {
|
|
32
|
-
console.log('%c^^ Module TypeError above is polyfilled and can be ignored ^^', 'font-weight:900;color:#391');
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const { revokeBlobURLs, noLoadEventRetriggers, enforceIntegrity } = esmsInitOptions;
|
|
36
|
-
|
|
37
|
-
function globalHook (name) {
|
|
38
|
-
return typeof name === 'string' ? self[name] : name;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
|
|
42
|
-
const cssModulesEnabled = enable.includes('css-modules');
|
|
43
|
-
const jsonModulesEnabled = enable.includes('json-modules');
|
|
44
|
-
|
|
45
|
-
const edge = !navigator.userAgentData && !!navigator.userAgent.match(/Edge\/\d+\.\d+/);
|
|
46
|
-
|
|
47
|
-
const baseUrl = hasDocument
|
|
48
|
-
? document.baseURI
|
|
49
|
-
: `${location.protocol}//${location.host}${location.pathname.includes('/')
|
|
50
|
-
? location.pathname.slice(0, location.pathname.lastIndexOf('/') + 1)
|
|
51
|
-
: location.pathname}`;
|
|
52
|
-
|
|
53
|
-
const createBlob = (source, type = 'text/javascript') => URL.createObjectURL(new Blob([source], { type }));
|
|
54
|
-
let { skip } = esmsInitOptions;
|
|
55
|
-
if (Array.isArray(skip)) {
|
|
56
|
-
const l = skip.map(s => new URL(s, baseUrl).href);
|
|
57
|
-
skip = s => l.some(i => i[i.length - 1] === '/' && s.startsWith(i) || s === i);
|
|
58
|
-
}
|
|
59
|
-
else if (typeof skip === 'string') {
|
|
60
|
-
const r = new RegExp(skip);
|
|
61
|
-
skip = s => r.test(s);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const eoop = err => setTimeout(() => { throw err });
|
|
65
|
-
|
|
66
|
-
const throwError = err => { (self.reportError || hasWindow && window.safari && console.error || eoop)(err), void onerror(err); };
|
|
67
|
-
|
|
68
|
-
function fromParent (parent) {
|
|
69
|
-
return parent ? ` imported from ${parent}` : '';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
let importMapSrcOrLazy = false;
|
|
73
|
-
|
|
74
|
-
function setImportMapSrcOrLazy () {
|
|
75
|
-
importMapSrcOrLazy = true;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// shim mode is determined on initialization, no late shim mode
|
|
79
|
-
if (!shimMode) {
|
|
80
|
-
if (document.querySelectorAll('script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]').length) {
|
|
81
|
-
shimMode = true;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
let seenScript = false;
|
|
85
|
-
for (const script of document.querySelectorAll('script[type=module],script[type=importmap]')) {
|
|
86
|
-
if (!seenScript) {
|
|
87
|
-
if (script.type === 'module' && !script.ep)
|
|
88
|
-
seenScript = true;
|
|
89
|
-
}
|
|
90
|
-
else if (script.type === 'importmap' && seenScript) {
|
|
91
|
-
importMapSrcOrLazy = true;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const backslashRegEx = /\\/g;
|
|
99
|
-
|
|
100
|
-
function isURL (url) {
|
|
101
|
-
if (url.indexOf(':') === -1) return false;
|
|
102
|
-
try {
|
|
103
|
-
new URL(url);
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
catch (_) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function resolveUrl (relUrl, parentUrl) {
|
|
112
|
-
return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (isURL(relUrl) ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
|
|
116
|
-
const hIdx = parentUrl.indexOf('#'), qIdx = parentUrl.indexOf('?');
|
|
117
|
-
if (hIdx + qIdx > -2)
|
|
118
|
-
parentUrl = parentUrl.slice(0, hIdx === -1 ? qIdx : qIdx === -1 || qIdx > hIdx ? hIdx : qIdx);
|
|
119
|
-
if (relUrl.indexOf('\\') !== -1)
|
|
120
|
-
relUrl = relUrl.replace(backslashRegEx, '/');
|
|
121
|
-
// protocol-relative
|
|
122
|
-
if (relUrl[0] === '/' && relUrl[1] === '/') {
|
|
123
|
-
return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
|
|
124
|
-
}
|
|
125
|
-
// relative-url
|
|
126
|
-
else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
|
|
127
|
-
relUrl.length === 1 && (relUrl += '/')) ||
|
|
128
|
-
relUrl[0] === '/') {
|
|
129
|
-
const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
|
|
130
|
-
// Disabled, but these cases will give inconsistent results for deep backtracking
|
|
131
|
-
//if (parentUrl[parentProtocol.length] !== '/')
|
|
132
|
-
// throw new Error('Cannot resolve');
|
|
133
|
-
// read pathname from parent URL
|
|
134
|
-
// pathname taken to be part after leading "/"
|
|
135
|
-
let pathname;
|
|
136
|
-
if (parentUrl[parentProtocol.length + 1] === '/') {
|
|
137
|
-
// resolving to a :// so we need to read out the auth and host
|
|
138
|
-
if (parentProtocol !== 'file:') {
|
|
139
|
-
pathname = parentUrl.slice(parentProtocol.length + 2);
|
|
140
|
-
pathname = pathname.slice(pathname.indexOf('/') + 1);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
pathname = parentUrl.slice(8);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
// resolving to :/ so pathname is the /... part
|
|
148
|
-
pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (relUrl[0] === '/')
|
|
152
|
-
return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
|
|
153
|
-
|
|
154
|
-
// join together and split for removal of .. and . segments
|
|
155
|
-
// looping the string instead of anything fancy for perf reasons
|
|
156
|
-
// '../../../../../z' resolved to 'x/y' is just 'z'
|
|
157
|
-
const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
|
|
158
|
-
|
|
159
|
-
const output = [];
|
|
160
|
-
let segmentIndex = -1;
|
|
161
|
-
for (let i = 0; i < segmented.length; i++) {
|
|
162
|
-
// busy reading a segment - only terminate on '/'
|
|
163
|
-
if (segmentIndex !== -1) {
|
|
164
|
-
if (segmented[i] === '/') {
|
|
165
|
-
output.push(segmented.slice(segmentIndex, i + 1));
|
|
166
|
-
segmentIndex = -1;
|
|
167
|
-
}
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
// new segment - check if it is relative
|
|
171
|
-
else if (segmented[i] === '.') {
|
|
172
|
-
// ../ segment
|
|
173
|
-
if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
|
|
174
|
-
output.pop();
|
|
175
|
-
i += 2;
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
// ./ segment
|
|
179
|
-
else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
|
|
180
|
-
i += 1;
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
// it is the start of a new segment
|
|
185
|
-
while (segmented[i] === '/') i++;
|
|
186
|
-
segmentIndex = i;
|
|
187
|
-
}
|
|
188
|
-
// finish reading out the last segment
|
|
189
|
-
if (segmentIndex !== -1)
|
|
190
|
-
output.push(segmented.slice(segmentIndex));
|
|
191
|
-
return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function resolveAndComposeImportMap (json, baseUrl, parentMap) {
|
|
196
|
-
const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes) };
|
|
197
|
-
|
|
198
|
-
if (json.imports)
|
|
199
|
-
resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap);
|
|
200
|
-
|
|
201
|
-
if (json.scopes)
|
|
202
|
-
for (let s in json.scopes) {
|
|
203
|
-
const resolvedScope = resolveUrl(s, baseUrl);
|
|
204
|
-
resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return outMap;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
function getMatch (path, matchObj) {
|
|
211
|
-
if (matchObj[path])
|
|
212
|
-
return path;
|
|
213
|
-
let sepIndex = path.length;
|
|
214
|
-
do {
|
|
215
|
-
const segment = path.slice(0, sepIndex + 1);
|
|
216
|
-
if (segment in matchObj)
|
|
217
|
-
return segment;
|
|
218
|
-
} while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function applyPackages (id, packages) {
|
|
222
|
-
const pkgName = getMatch(id, packages);
|
|
223
|
-
if (pkgName) {
|
|
224
|
-
const pkg = packages[pkgName];
|
|
225
|
-
if (pkg === null) return;
|
|
226
|
-
return pkg + id.slice(pkgName.length);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
|
|
232
|
-
let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
|
|
233
|
-
while (scopeUrl) {
|
|
234
|
-
const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
|
|
235
|
-
if (packageResolution)
|
|
236
|
-
return packageResolution;
|
|
237
|
-
scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
|
|
238
|
-
}
|
|
239
|
-
return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
|
|
243
|
-
for (let p in packages) {
|
|
244
|
-
const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
|
|
245
|
-
if ((!shimMode || !mapOverrides) && outPackages[resolvedLhs] && (outPackages[resolvedLhs] !== packages[resolvedLhs])) {
|
|
246
|
-
throw Error(`Rejected map override "${resolvedLhs}" from ${outPackages[resolvedLhs]} to ${packages[resolvedLhs]}.`);
|
|
247
|
-
}
|
|
248
|
-
let target = packages[p];
|
|
249
|
-
if (typeof target !== 'string')
|
|
250
|
-
continue;
|
|
251
|
-
const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
|
|
252
|
-
if (mapped) {
|
|
253
|
-
outPackages[resolvedLhs] = mapped;
|
|
254
|
-
continue;
|
|
255
|
-
}
|
|
256
|
-
console.warn(`Mapping "${p}" -> "${packages[p]}" does not resolve`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
let dynamicImport = !hasDocument && (0, eval)('u=>import(u)');
|
|
261
|
-
|
|
262
|
-
let supportsDynamicImport;
|
|
263
|
-
|
|
264
|
-
const dynamicImportCheck = hasDocument && new Promise(resolve => {
|
|
265
|
-
const s = Object.assign(document.createElement('script'), {
|
|
266
|
-
src: createBlob('self._d=u=>import(u)'),
|
|
267
|
-
ep: true
|
|
268
|
-
});
|
|
269
|
-
s.setAttribute('nonce', nonce);
|
|
270
|
-
s.addEventListener('load', () => {
|
|
271
|
-
if (!(supportsDynamicImport = !!(dynamicImport = self._d))) {
|
|
272
|
-
let err;
|
|
273
|
-
window.addEventListener('error', _err => err = _err);
|
|
274
|
-
dynamicImport = (url, opts) => new Promise((resolve, reject) => {
|
|
275
|
-
const s = Object.assign(document.createElement('script'), {
|
|
276
|
-
type: 'module',
|
|
277
|
-
src: createBlob(`import*as m from'${url}';self._esmsi=m`)
|
|
278
|
-
});
|
|
279
|
-
err = undefined;
|
|
280
|
-
s.ep = true;
|
|
281
|
-
if (nonce)
|
|
282
|
-
s.setAttribute('nonce', nonce);
|
|
283
|
-
// Safari is unique in supporting module script error events
|
|
284
|
-
s.addEventListener('error', cb);
|
|
285
|
-
s.addEventListener('load', cb);
|
|
286
|
-
function cb (_err) {
|
|
287
|
-
document.head.removeChild(s);
|
|
288
|
-
if (self._esmsi) {
|
|
289
|
-
resolve(self._esmsi, baseUrl);
|
|
290
|
-
self._esmsi = undefined;
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
reject(!(_err instanceof Event) && _err || err && err.error || new Error(`Error loading ${opts && opts.errUrl || url} (${s.src}).`));
|
|
294
|
-
err = undefined;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
document.head.appendChild(s);
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
document.head.removeChild(s);
|
|
301
|
-
delete self._d;
|
|
302
|
-
resolve();
|
|
303
|
-
});
|
|
304
|
-
document.head.appendChild(s);
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
// support browsers without dynamic import support (eg Firefox 6x)
|
|
308
|
-
let supportsJsonAssertions = false;
|
|
309
|
-
let supportsCssAssertions = false;
|
|
310
|
-
|
|
311
|
-
let supportsImportMaps = hasDocument && HTMLScriptElement.supports ? HTMLScriptElement.supports('importmap') : false;
|
|
312
|
-
let supportsImportMeta = supportsImportMaps;
|
|
313
|
-
|
|
314
|
-
const importMetaCheck = 'import.meta';
|
|
315
|
-
const cssModulesCheck = `import"x"assert{type:"css"}`;
|
|
316
|
-
const jsonModulesCheck = `import"x"assert{type:"json"}`;
|
|
317
|
-
|
|
318
|
-
const featureDetectionPromise = Promise.resolve(dynamicImportCheck).then(() => {
|
|
319
|
-
if (!supportsDynamicImport || supportsImportMaps && !cssModulesEnabled && !jsonModulesEnabled)
|
|
320
|
-
return;
|
|
321
|
-
|
|
322
|
-
if (!hasDocument)
|
|
323
|
-
return Promise.all([
|
|
324
|
-
supportsImportMaps || dynamicImport(createBlob(importMetaCheck)).then(() => supportsImportMeta = true, noop),
|
|
325
|
-
cssModulesEnabled && dynamicImport(createBlob(cssModulesCheck.replace('x', createBlob('', 'text/css')))).then(() => supportsCssAssertions = true, noop),
|
|
326
|
-
jsonModulesEnabled && dynamicImport(createBlob(jsonModulescheck.replace('x', createBlob('{}', 'text/json')))).then(() => supportsJsonAssertions = true, noop),
|
|
327
|
-
]);
|
|
328
|
-
|
|
329
|
-
return new Promise(resolve => {
|
|
330
|
-
const iframe = document.createElement('iframe');
|
|
331
|
-
iframe.style.display = 'none';
|
|
332
|
-
iframe.setAttribute('nonce', nonce);
|
|
333
|
-
function cb ({ data: [a, b, c, d] }) {
|
|
334
|
-
supportsImportMaps = a;
|
|
335
|
-
supportsImportMeta = b;
|
|
336
|
-
supportsCssAssertions = c;
|
|
337
|
-
supportsJsonAssertions = d;
|
|
338
|
-
resolve();
|
|
339
|
-
document.head.removeChild(iframe);
|
|
340
|
-
window.removeEventListener('message', cb, false);
|
|
341
|
-
}
|
|
342
|
-
window.addEventListener('message', cb, false);
|
|
343
|
-
|
|
344
|
-
const importMapTest = `<script nonce=${nonce || ''}>b=(s,type='text/javascript')=>URL.createObjectURL(new Blob([s],{type}));document.head.appendChild(Object.assign(document.createElement('script'),{type:'importmap',nonce:"${nonce}",innerText:\`{"imports":{"x":"\${b('')}"}}\`}));Promise.all([${
|
|
345
|
-
supportsImportMaps ? 'true,true' : `'x',b('${importMetaCheck}')`}, ${cssModulesEnabled ? `b('${cssModulesCheck}'.replace('x',b('','text/css')))` : 'false'}, ${
|
|
346
|
-
jsonModulesEnabled ? `b('${jsonModulesCheck}'.replace('x',b('{}','text/json')))` : 'false'}].map(x =>typeof x==='string'?import(x).then(x =>!!x,()=>false):x)).then(a=>parent.postMessage(a,'*'))<${''}/script>`;
|
|
347
|
-
|
|
348
|
-
iframe.onload = () => {
|
|
349
|
-
// WeChat browser doesn't support setting srcdoc scripts
|
|
350
|
-
// But iframe sandboxes don't support contentDocument so we do this as a fallback
|
|
351
|
-
const doc = iframe.contentDocument;
|
|
352
|
-
if (doc && doc.head.childNodes.length === 0) {
|
|
353
|
-
const s = doc.createElement('script');
|
|
354
|
-
if (nonce)
|
|
355
|
-
s.setAttribute('nonce', nonce);
|
|
356
|
-
s.innerHTML = importMapTest.slice(15 + (nonce ? nonce.length : 0), -9);
|
|
357
|
-
doc.head.appendChild(s);
|
|
358
|
-
}
|
|
359
|
-
};
|
|
360
|
-
// WeChat browser requires append before setting srcdoc
|
|
361
|
-
document.head.appendChild(iframe);
|
|
362
|
-
// setting srcdoc is not supported in React native webviews on iOS
|
|
363
|
-
// setting src to a blob URL results in a navigation event in webviews
|
|
364
|
-
// document.write gives usability warnings
|
|
365
|
-
if ('srcdoc' in iframe)
|
|
366
|
-
iframe.srcdoc = importMapTest;
|
|
367
|
-
else
|
|
368
|
-
iframe.contentDocument.write(importMapTest);
|
|
369
|
-
});
|
|
4
|
+
const hasWindow = typeof window !== 'undefined';
|
|
5
|
+
const hasDocument = typeof document !== 'undefined';
|
|
6
|
+
|
|
7
|
+
const noop = () => {};
|
|
8
|
+
|
|
9
|
+
const optionsScript = hasDocument ? document.querySelector('script[type=esms-options]') : undefined;
|
|
10
|
+
|
|
11
|
+
const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : {};
|
|
12
|
+
Object.assign(esmsInitOptions, self.esmsInitOptions || {});
|
|
13
|
+
|
|
14
|
+
let shimMode = hasDocument ? !!esmsInitOptions.shimMode : true;
|
|
15
|
+
|
|
16
|
+
const importHook = globalHook(shimMode && esmsInitOptions.onimport);
|
|
17
|
+
const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);
|
|
18
|
+
let fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;
|
|
19
|
+
const metaHook = esmsInitOptions.meta ? globalHook(shimMode && esmsInitOptions.meta) : noop;
|
|
20
|
+
|
|
21
|
+
const mapOverrides = esmsInitOptions.mapOverrides;
|
|
22
|
+
|
|
23
|
+
let nonce = esmsInitOptions.nonce;
|
|
24
|
+
if (!nonce && hasDocument) {
|
|
25
|
+
const nonceElement = document.querySelector('script[nonce]');
|
|
26
|
+
if (nonceElement)
|
|
27
|
+
nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const onerror = globalHook(esmsInitOptions.onerror || noop);
|
|
31
|
+
const onpolyfill = esmsInitOptions.onpolyfill ? globalHook(esmsInitOptions.onpolyfill) : () => {
|
|
32
|
+
console.log('%c^^ Module TypeError above is polyfilled and can be ignored ^^', 'font-weight:900;color:#391');
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const { revokeBlobURLs, noLoadEventRetriggers, enforceIntegrity } = esmsInitOptions;
|
|
36
|
+
|
|
37
|
+
function globalHook (name) {
|
|
38
|
+
return typeof name === 'string' ? self[name] : name;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
|
|
42
|
+
const cssModulesEnabled = enable.includes('css-modules');
|
|
43
|
+
const jsonModulesEnabled = enable.includes('json-modules');
|
|
44
|
+
|
|
45
|
+
const edge = !navigator.userAgentData && !!navigator.userAgent.match(/Edge\/\d+\.\d+/);
|
|
46
|
+
|
|
47
|
+
const baseUrl = hasDocument
|
|
48
|
+
? document.baseURI
|
|
49
|
+
: `${location.protocol}//${location.host}${location.pathname.includes('/')
|
|
50
|
+
? location.pathname.slice(0, location.pathname.lastIndexOf('/') + 1)
|
|
51
|
+
: location.pathname}`;
|
|
52
|
+
|
|
53
|
+
const createBlob = (source, type = 'text/javascript') => URL.createObjectURL(new Blob([source], { type }));
|
|
54
|
+
let { skip } = esmsInitOptions;
|
|
55
|
+
if (Array.isArray(skip)) {
|
|
56
|
+
const l = skip.map(s => new URL(s, baseUrl).href);
|
|
57
|
+
skip = s => l.some(i => i[i.length - 1] === '/' && s.startsWith(i) || s === i);
|
|
58
|
+
}
|
|
59
|
+
else if (typeof skip === 'string') {
|
|
60
|
+
const r = new RegExp(skip);
|
|
61
|
+
skip = s => r.test(s);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const eoop = err => setTimeout(() => { throw err });
|
|
65
|
+
|
|
66
|
+
const throwError = err => { (self.reportError || hasWindow && window.safari && console.error || eoop)(err), void onerror(err); };
|
|
67
|
+
|
|
68
|
+
function fromParent (parent) {
|
|
69
|
+
return parent ? ` imported from ${parent}` : '';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let importMapSrcOrLazy = false;
|
|
73
|
+
|
|
74
|
+
function setImportMapSrcOrLazy () {
|
|
75
|
+
importMapSrcOrLazy = true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// shim mode is determined on initialization, no late shim mode
|
|
79
|
+
if (!shimMode) {
|
|
80
|
+
if (document.querySelectorAll('script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]').length) {
|
|
81
|
+
shimMode = true;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
let seenScript = false;
|
|
85
|
+
for (const script of document.querySelectorAll('script[type=module],script[type=importmap]')) {
|
|
86
|
+
if (!seenScript) {
|
|
87
|
+
if (script.type === 'module' && !script.ep)
|
|
88
|
+
seenScript = true;
|
|
89
|
+
}
|
|
90
|
+
else if (script.type === 'importmap' && seenScript) {
|
|
91
|
+
importMapSrcOrLazy = true;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const backslashRegEx = /\\/g;
|
|
99
|
+
|
|
100
|
+
function isURL (url) {
|
|
101
|
+
if (url.indexOf(':') === -1) return false;
|
|
102
|
+
try {
|
|
103
|
+
new URL(url);
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
catch (_) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function resolveUrl (relUrl, parentUrl) {
|
|
112
|
+
return resolveIfNotPlainOrUrl(relUrl, parentUrl) || (isURL(relUrl) ? relUrl : resolveIfNotPlainOrUrl('./' + relUrl, parentUrl));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function resolveIfNotPlainOrUrl (relUrl, parentUrl) {
|
|
116
|
+
const hIdx = parentUrl.indexOf('#'), qIdx = parentUrl.indexOf('?');
|
|
117
|
+
if (hIdx + qIdx > -2)
|
|
118
|
+
parentUrl = parentUrl.slice(0, hIdx === -1 ? qIdx : qIdx === -1 || qIdx > hIdx ? hIdx : qIdx);
|
|
119
|
+
if (relUrl.indexOf('\\') !== -1)
|
|
120
|
+
relUrl = relUrl.replace(backslashRegEx, '/');
|
|
121
|
+
// protocol-relative
|
|
122
|
+
if (relUrl[0] === '/' && relUrl[1] === '/') {
|
|
123
|
+
return parentUrl.slice(0, parentUrl.indexOf(':') + 1) + relUrl;
|
|
124
|
+
}
|
|
125
|
+
// relative-url
|
|
126
|
+
else if (relUrl[0] === '.' && (relUrl[1] === '/' || relUrl[1] === '.' && (relUrl[2] === '/' || relUrl.length === 2 && (relUrl += '/')) ||
|
|
127
|
+
relUrl.length === 1 && (relUrl += '/')) ||
|
|
128
|
+
relUrl[0] === '/') {
|
|
129
|
+
const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
|
|
130
|
+
// Disabled, but these cases will give inconsistent results for deep backtracking
|
|
131
|
+
//if (parentUrl[parentProtocol.length] !== '/')
|
|
132
|
+
// throw new Error('Cannot resolve');
|
|
133
|
+
// read pathname from parent URL
|
|
134
|
+
// pathname taken to be part after leading "/"
|
|
135
|
+
let pathname;
|
|
136
|
+
if (parentUrl[parentProtocol.length + 1] === '/') {
|
|
137
|
+
// resolving to a :// so we need to read out the auth and host
|
|
138
|
+
if (parentProtocol !== 'file:') {
|
|
139
|
+
pathname = parentUrl.slice(parentProtocol.length + 2);
|
|
140
|
+
pathname = pathname.slice(pathname.indexOf('/') + 1);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
pathname = parentUrl.slice(8);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
// resolving to :/ so pathname is the /... part
|
|
148
|
+
pathname = parentUrl.slice(parentProtocol.length + (parentUrl[parentProtocol.length] === '/'));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (relUrl[0] === '/')
|
|
152
|
+
return parentUrl.slice(0, parentUrl.length - pathname.length - 1) + relUrl;
|
|
153
|
+
|
|
154
|
+
// join together and split for removal of .. and . segments
|
|
155
|
+
// looping the string instead of anything fancy for perf reasons
|
|
156
|
+
// '../../../../../z' resolved to 'x/y' is just 'z'
|
|
157
|
+
const segmented = pathname.slice(0, pathname.lastIndexOf('/') + 1) + relUrl;
|
|
158
|
+
|
|
159
|
+
const output = [];
|
|
160
|
+
let segmentIndex = -1;
|
|
161
|
+
for (let i = 0; i < segmented.length; i++) {
|
|
162
|
+
// busy reading a segment - only terminate on '/'
|
|
163
|
+
if (segmentIndex !== -1) {
|
|
164
|
+
if (segmented[i] === '/') {
|
|
165
|
+
output.push(segmented.slice(segmentIndex, i + 1));
|
|
166
|
+
segmentIndex = -1;
|
|
167
|
+
}
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
// new segment - check if it is relative
|
|
171
|
+
else if (segmented[i] === '.') {
|
|
172
|
+
// ../ segment
|
|
173
|
+
if (segmented[i + 1] === '.' && (segmented[i + 2] === '/' || i + 2 === segmented.length)) {
|
|
174
|
+
output.pop();
|
|
175
|
+
i += 2;
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
// ./ segment
|
|
179
|
+
else if (segmented[i + 1] === '/' || i + 1 === segmented.length) {
|
|
180
|
+
i += 1;
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// it is the start of a new segment
|
|
185
|
+
while (segmented[i] === '/') i++;
|
|
186
|
+
segmentIndex = i;
|
|
187
|
+
}
|
|
188
|
+
// finish reading out the last segment
|
|
189
|
+
if (segmentIndex !== -1)
|
|
190
|
+
output.push(segmented.slice(segmentIndex));
|
|
191
|
+
return parentUrl.slice(0, parentUrl.length - pathname.length) + output.join('');
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function resolveAndComposeImportMap (json, baseUrl, parentMap) {
|
|
196
|
+
const outMap = { imports: Object.assign({}, parentMap.imports), scopes: Object.assign({}, parentMap.scopes) };
|
|
197
|
+
|
|
198
|
+
if (json.imports)
|
|
199
|
+
resolveAndComposePackages(json.imports, outMap.imports, baseUrl, parentMap);
|
|
200
|
+
|
|
201
|
+
if (json.scopes)
|
|
202
|
+
for (let s in json.scopes) {
|
|
203
|
+
const resolvedScope = resolveUrl(s, baseUrl);
|
|
204
|
+
resolveAndComposePackages(json.scopes[s], outMap.scopes[resolvedScope] || (outMap.scopes[resolvedScope] = {}), baseUrl, parentMap);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return outMap;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function getMatch (path, matchObj) {
|
|
211
|
+
if (matchObj[path])
|
|
212
|
+
return path;
|
|
213
|
+
let sepIndex = path.length;
|
|
214
|
+
do {
|
|
215
|
+
const segment = path.slice(0, sepIndex + 1);
|
|
216
|
+
if (segment in matchObj)
|
|
217
|
+
return segment;
|
|
218
|
+
} while ((sepIndex = path.lastIndexOf('/', sepIndex - 1)) !== -1)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function applyPackages (id, packages) {
|
|
222
|
+
const pkgName = getMatch(id, packages);
|
|
223
|
+
if (pkgName) {
|
|
224
|
+
const pkg = packages[pkgName];
|
|
225
|
+
if (pkg === null) return;
|
|
226
|
+
return pkg + id.slice(pkgName.length);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
function resolveImportMap (importMap, resolvedOrPlain, parentUrl) {
|
|
232
|
+
let scopeUrl = parentUrl && getMatch(parentUrl, importMap.scopes);
|
|
233
|
+
while (scopeUrl) {
|
|
234
|
+
const packageResolution = applyPackages(resolvedOrPlain, importMap.scopes[scopeUrl]);
|
|
235
|
+
if (packageResolution)
|
|
236
|
+
return packageResolution;
|
|
237
|
+
scopeUrl = getMatch(scopeUrl.slice(0, scopeUrl.lastIndexOf('/')), importMap.scopes);
|
|
238
|
+
}
|
|
239
|
+
return applyPackages(resolvedOrPlain, importMap.imports) || resolvedOrPlain.indexOf(':') !== -1 && resolvedOrPlain;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function resolveAndComposePackages (packages, outPackages, baseUrl, parentMap) {
|
|
243
|
+
for (let p in packages) {
|
|
244
|
+
const resolvedLhs = resolveIfNotPlainOrUrl(p, baseUrl) || p;
|
|
245
|
+
if ((!shimMode || !mapOverrides) && outPackages[resolvedLhs] && (outPackages[resolvedLhs] !== packages[resolvedLhs])) {
|
|
246
|
+
throw Error(`Rejected map override "${resolvedLhs}" from ${outPackages[resolvedLhs]} to ${packages[resolvedLhs]}.`);
|
|
247
|
+
}
|
|
248
|
+
let target = packages[p];
|
|
249
|
+
if (typeof target !== 'string')
|
|
250
|
+
continue;
|
|
251
|
+
const mapped = resolveImportMap(parentMap, resolveIfNotPlainOrUrl(target, baseUrl) || target, baseUrl);
|
|
252
|
+
if (mapped) {
|
|
253
|
+
outPackages[resolvedLhs] = mapped;
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
console.warn(`Mapping "${p}" -> "${packages[p]}" does not resolve`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
let dynamicImport = !hasDocument && (0, eval)('u=>import(u)');
|
|
261
|
+
|
|
262
|
+
let supportsDynamicImport;
|
|
263
|
+
|
|
264
|
+
const dynamicImportCheck = hasDocument && new Promise(resolve => {
|
|
265
|
+
const s = Object.assign(document.createElement('script'), {
|
|
266
|
+
src: createBlob('self._d=u=>import(u)'),
|
|
267
|
+
ep: true
|
|
268
|
+
});
|
|
269
|
+
s.setAttribute('nonce', nonce);
|
|
270
|
+
s.addEventListener('load', () => {
|
|
271
|
+
if (!(supportsDynamicImport = !!(dynamicImport = self._d))) {
|
|
272
|
+
let err;
|
|
273
|
+
window.addEventListener('error', _err => err = _err);
|
|
274
|
+
dynamicImport = (url, opts) => new Promise((resolve, reject) => {
|
|
275
|
+
const s = Object.assign(document.createElement('script'), {
|
|
276
|
+
type: 'module',
|
|
277
|
+
src: createBlob(`import*as m from'${url}';self._esmsi=m`)
|
|
278
|
+
});
|
|
279
|
+
err = undefined;
|
|
280
|
+
s.ep = true;
|
|
281
|
+
if (nonce)
|
|
282
|
+
s.setAttribute('nonce', nonce);
|
|
283
|
+
// Safari is unique in supporting module script error events
|
|
284
|
+
s.addEventListener('error', cb);
|
|
285
|
+
s.addEventListener('load', cb);
|
|
286
|
+
function cb (_err) {
|
|
287
|
+
document.head.removeChild(s);
|
|
288
|
+
if (self._esmsi) {
|
|
289
|
+
resolve(self._esmsi, baseUrl);
|
|
290
|
+
self._esmsi = undefined;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
reject(!(_err instanceof Event) && _err || err && err.error || new Error(`Error loading ${opts && opts.errUrl || url} (${s.src}).`));
|
|
294
|
+
err = undefined;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
document.head.appendChild(s);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
document.head.removeChild(s);
|
|
301
|
+
delete self._d;
|
|
302
|
+
resolve();
|
|
303
|
+
});
|
|
304
|
+
document.head.appendChild(s);
|
|
370
305
|
});
|
|
371
306
|
|
|
372
|
-
|
|
373
|
-
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,o=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;o>0&&C.memory.grow(Math.ceil(o/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,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 D=[],k=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),o=C.se();let K;C.ip()&&(K=J(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),D.push({n:K,s:A,e:Q,ss:I,se:o,d:g,a:B});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),o=I[0],K=B<0?void 0:E.slice(B,g),D=K?K[0]:"";k.push({s:A,e:Q,ls:B,le:g,n:'"'===o||"'"===o?J(I):I,ln:'"'===D||"'"===D?J(K):K});}function J(A){try{return (0,eval)(A)}catch(A){}}return [D,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="AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gAn9/AAMvLgABAQICAgICAgICAgICAgICAgIAAwMDBAQAAAADAAAAAAMDAAUGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUGw8gALfwBBsPIACwdwEwZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAmFpAAgCaWQACQJpcAAKAmVzAAsCZWUADANlbHMADQNl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AgAUYiAhtBACABIAIbEAILIAMLcgEEf0EAKAKgCiEAQQAoAqQKIQECQAJAA0AgAEECaiECIAAgAU8NAQJAAkAgAi8BACIDQaR/ag4CAQQACyACIQAgA0F2ag4EAgEBAgELIABBBGohAAwACwtBACACNgKgChAiQQAPC0EAIAI2AqAKQd0AC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC+IBAgBBgAgLxAEAAHgAcABvAHIAdABtAHAAbwByAHQAZQB0AGEAcgBvAG0AdQBuAGMAdABpAG8AbgBzAHMAZQByAHQAdgBvAHkAaQBlAGQAZQBsAGUAYwBvAG4AdABpAG4AaQBuAHMAdABhAG4AdAB5AGIAcgBlAGEAcgBlAHQAdQByAGQAZQBiAHUAZwBnAGUAYQB3AGEAaQB0AGgAcgB3AGgAaQBsAGUAZgBvAHIAaQBmAGMAYQB0AGMAZgBpAG4AYQBsAGwAZQBsAHMAAEHECQsQAQAAAAIAAAAABAAAMDkAAA==","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;
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
let importMap = { imports: {}, scopes: {} };
|
|
454
|
-
let baselinePassthrough;
|
|
455
|
-
|
|
456
|
-
const initPromise = featureDetectionPromise.then(() => {
|
|
457
|
-
baselinePassthrough = esmsInitOptions.polyfillEnable !== true && supportsDynamicImport && supportsImportMeta && supportsImportMaps && (!jsonModulesEnabled || supportsJsonAssertions) && (!cssModulesEnabled || supportsCssAssertions) && !importMapSrcOrLazy && !false;
|
|
458
|
-
if (hasDocument) {
|
|
459
|
-
if (!supportsImportMaps) {
|
|
460
|
-
const supports = HTMLScriptElement.supports || (type => type === 'classic' || type === 'module');
|
|
461
|
-
HTMLScriptElement.supports = type => type === 'importmap' || supports(type);
|
|
462
|
-
}
|
|
463
|
-
if (shimMode || !baselinePassthrough) {
|
|
464
|
-
new MutationObserver(mutations => {
|
|
465
|
-
for (const mutation of mutations) {
|
|
466
|
-
if (mutation.type !== 'childList') continue;
|
|
467
|
-
for (const node of mutation.addedNodes) {
|
|
468
|
-
if (node.tagName === 'SCRIPT') {
|
|
469
|
-
if (node.type === (shimMode ? 'module-shim' : 'module'))
|
|
470
|
-
processScript(node, true);
|
|
471
|
-
if (node.type === (shimMode ? 'importmap-shim' : 'importmap'))
|
|
472
|
-
processImportMap(node, true);
|
|
473
|
-
}
|
|
474
|
-
else if (node.tagName === 'LINK' && node.rel === (shimMode ? 'modulepreload-shim' : 'modulepreload')) {
|
|
475
|
-
processPreload(node);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
}).observe(document, {childList: true, subtree: true});
|
|
480
|
-
processScriptsAndPreloads();
|
|
481
|
-
if (document.readyState === 'complete') {
|
|
482
|
-
readyStateCompleteCheck();
|
|
483
|
-
}
|
|
484
|
-
else {
|
|
485
|
-
async function readyListener() {
|
|
486
|
-
await initPromise;
|
|
487
|
-
processScriptsAndPreloads();
|
|
488
|
-
if (document.readyState === 'complete') {
|
|
489
|
-
readyStateCompleteCheck();
|
|
490
|
-
document.removeEventListener('readystatechange', readyListener);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
document.addEventListener('readystatechange', readyListener);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
return init;
|
|
307
|
+
// support browsers without dynamic import support (eg Firefox 6x)
|
|
308
|
+
let supportsJsonAssertions = false;
|
|
309
|
+
let supportsCssAssertions = false;
|
|
310
|
+
|
|
311
|
+
const supports = hasDocument && HTMLScriptElement.supports;
|
|
312
|
+
|
|
313
|
+
let supportsImportMaps = supports && supports.name === 'supports' && supports('importmap');
|
|
314
|
+
let supportsImportMeta = supportsDynamicImport;
|
|
315
|
+
|
|
316
|
+
const importMetaCheck = 'import.meta';
|
|
317
|
+
const cssModulesCheck = `import"x"assert{type:"css"}`;
|
|
318
|
+
const jsonModulesCheck = `import"x"assert{type:"json"}`;
|
|
319
|
+
|
|
320
|
+
let featureDetectionPromise = Promise.resolve(dynamicImportCheck).then(() => {
|
|
321
|
+
if (!supportsDynamicImport)
|
|
322
|
+
return;
|
|
323
|
+
|
|
324
|
+
if (!hasDocument)
|
|
325
|
+
return Promise.all([
|
|
326
|
+
supportsImportMaps || dynamicImport(createBlob(importMetaCheck)).then(() => supportsImportMeta = true, noop),
|
|
327
|
+
cssModulesEnabled && dynamicImport(createBlob(cssModulesCheck.replace('x', createBlob('', 'text/css')))).then(() => supportsCssAssertions = true, noop),
|
|
328
|
+
jsonModulesEnabled && dynamicImport(createBlob(jsonModulescheck.replace('x', createBlob('{}', 'text/json')))).then(() => supportsJsonAssertions = true, noop),
|
|
329
|
+
]);
|
|
330
|
+
|
|
331
|
+
return new Promise(resolve => {
|
|
332
|
+
const iframe = document.createElement('iframe');
|
|
333
|
+
iframe.style.display = 'none';
|
|
334
|
+
iframe.setAttribute('nonce', nonce);
|
|
335
|
+
function cb ({ data }) {
|
|
336
|
+
// failed feature detection (security policy) -> revert to default assumptions
|
|
337
|
+
if (Array.isArray(data)) {
|
|
338
|
+
supportsImportMaps = data[0];
|
|
339
|
+
supportsImportMeta = data[1];
|
|
340
|
+
supportsCssAssertions = data[2];
|
|
341
|
+
supportsJsonAssertions = data[3];
|
|
342
|
+
}
|
|
343
|
+
resolve();
|
|
344
|
+
document.head.removeChild(iframe);
|
|
345
|
+
window.removeEventListener('message', cb, false);
|
|
346
|
+
}
|
|
347
|
+
window.addEventListener('message', cb, false);
|
|
348
|
+
|
|
349
|
+
const importMapTest = `<script nonce=${nonce || ''}>b=(s,type='text/javascript')=>URL.createObjectURL(new Blob([s],{type}));document.head.appendChild(Object.assign(document.createElement('script'),{type:'importmap',nonce:"${nonce}",innerText:\`{"imports":{"x":"\${b('')}"}}\`}));Promise.all([${
|
|
350
|
+
supportsImportMaps ? 'true,true' : `'x',b('${importMetaCheck}')`}, ${cssModulesEnabled ? `b('${cssModulesCheck}'.replace('x',b('','text/css')))` : 'false'}, ${
|
|
351
|
+
jsonModulesEnabled ? `b('${jsonModulesCheck}'.replace('x',b('{}','text/json')))` : 'false'}].map(x =>typeof x==='string'?import(x).then(x =>!!x,()=>false):x)).then(a=>parent.postMessage(a,'*'))<${''}/script>`;
|
|
352
|
+
|
|
353
|
+
// Safari will call onload eagerly on head injection, but we don't want the Wechat
|
|
354
|
+
// path to trigger before setting srcdoc, therefore we track the timing
|
|
355
|
+
let readyForOnload = false, onloadCalledWhileNotReady = false;
|
|
356
|
+
function doOnload () {
|
|
357
|
+
if (!readyForOnload) {
|
|
358
|
+
onloadCalledWhileNotReady = true;
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
// WeChat browser doesn't support setting srcdoc scripts
|
|
362
|
+
// But iframe sandboxes don't support contentDocument so we do this as a fallback
|
|
363
|
+
const doc = iframe.contentDocument;
|
|
364
|
+
if (doc && doc.head.childNodes.length === 0) {
|
|
365
|
+
const s = doc.createElement('script');
|
|
366
|
+
if (nonce)
|
|
367
|
+
s.setAttribute('nonce', nonce);
|
|
368
|
+
s.innerHTML = importMapTest.slice(15 + (nonce ? nonce.length : 0), -9);
|
|
369
|
+
doc.head.appendChild(s);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
iframe.onload = doOnload;
|
|
374
|
+
// WeChat browser requires append before setting srcdoc
|
|
375
|
+
document.head.appendChild(iframe);
|
|
376
|
+
|
|
377
|
+
// setting srcdoc is not supported in React native webviews on iOS
|
|
378
|
+
// setting src to a blob URL results in a navigation event in webviews
|
|
379
|
+
// document.write gives usability warnings
|
|
380
|
+
readyForOnload = true;
|
|
381
|
+
if ('srcdoc' in iframe)
|
|
382
|
+
iframe.srcdoc = importMapTest;
|
|
383
|
+
else
|
|
384
|
+
iframe.contentDocument.write(importMapTest);
|
|
385
|
+
// retrigger onload for Safari only if necessary
|
|
386
|
+
if (onloadCalledWhileNotReady) doOnload();
|
|
387
|
+
});
|
|
498
388
|
});
|
|
499
|
-
let importMapPromise = initPromise;
|
|
500
|
-
let firstPolyfillLoad = true;
|
|
501
|
-
let acceptingImportMaps = true;
|
|
502
|
-
|
|
503
|
-
async function topLevelLoad (url, fetchOpts, source, nativelyLoaded, lastStaticLoadPromise) {
|
|
504
|
-
if (!shimMode)
|
|
505
|
-
acceptingImportMaps = false;
|
|
506
|
-
await initPromise;
|
|
507
|
-
await importMapPromise;
|
|
508
|
-
if (importHook) await importHook(url, typeof fetchOpts !== 'string' ? fetchOpts : {}, '');
|
|
509
|
-
// early analysis opt-out - no need to even fetch if we have feature support
|
|
510
|
-
if (!shimMode && baselinePassthrough) {
|
|
511
|
-
// for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
|
|
512
|
-
if (nativelyLoaded)
|
|
513
|
-
return null;
|
|
514
|
-
await lastStaticLoadPromise;
|
|
515
|
-
return dynamicImport(source ? createBlob(source) : url, { errUrl: url || source });
|
|
516
|
-
}
|
|
517
|
-
const load = getOrCreateLoad(url, fetchOpts, null, source);
|
|
518
|
-
const seen = {};
|
|
519
|
-
await loadAll(load, seen);
|
|
520
|
-
lastLoad = undefined;
|
|
521
|
-
resolveDeps(load, seen);
|
|
522
|
-
await lastStaticLoadPromise;
|
|
523
|
-
if (source && !shimMode && !load.n && !false) {
|
|
524
|
-
if (nativelyLoaded) return;
|
|
525
|
-
if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
|
|
526
|
-
return await dynamicImport(createBlob(source), { errUrl: source });
|
|
527
|
-
}
|
|
528
|
-
if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
|
|
529
|
-
onpolyfill();
|
|
530
|
-
firstPolyfillLoad = false;
|
|
531
|
-
}
|
|
532
|
-
const module = await dynamicImport(!shimMode && !load.n && nativelyLoaded ? load.u : load.b, { errUrl: load.u });
|
|
533
|
-
// if the top-level load is a shell, run its update function
|
|
534
|
-
if (load.s)
|
|
535
|
-
(await dynamicImport(load.s)).u$_(module);
|
|
536
|
-
if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
|
|
537
|
-
// when tla is supported, this should return the tla promise as an actual handle
|
|
538
|
-
// so readystate can still correspond to the sync subgraph exec completions
|
|
539
|
-
return module;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
function revokeObjectURLs(registryKeys) {
|
|
543
|
-
let batch = 0;
|
|
544
|
-
const keysLength = registryKeys.length;
|
|
545
|
-
const schedule = self.requestIdleCallback ? self.requestIdleCallback : self.requestAnimationFrame;
|
|
546
|
-
schedule(cleanup);
|
|
547
|
-
function cleanup() {
|
|
548
|
-
const batchStartIndex = batch * 100;
|
|
549
|
-
if (batchStartIndex > keysLength) return
|
|
550
|
-
for (const key of registryKeys.slice(batchStartIndex, batchStartIndex + 100)) {
|
|
551
|
-
const load = registry[key];
|
|
552
|
-
if (load) URL.revokeObjectURL(load.b);
|
|
553
|
-
}
|
|
554
|
-
batch++;
|
|
555
|
-
schedule(cleanup);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
function urlJsString (url) {
|
|
560
|
-
return `'${url.replace(/'/g, "\\'")}'`;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
let lastLoad;
|
|
564
|
-
function resolveDeps (load, seen) {
|
|
565
|
-
if (load.b || !seen[load.u])
|
|
566
|
-
return;
|
|
567
|
-
seen[load.u] = 0;
|
|
568
|
-
|
|
569
|
-
for (const dep of load.d)
|
|
570
|
-
resolveDeps(dep, seen);
|
|
571
|
-
|
|
572
|
-
const [imports, exports] = load.a;
|
|
573
|
-
|
|
574
|
-
// "execution"
|
|
575
|
-
const source = load.S;
|
|
576
|
-
|
|
577
|
-
// edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
|
|
578
|
-
let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
|
|
579
|
-
|
|
580
|
-
if (!imports.length) {
|
|
581
|
-
resolvedSource += source;
|
|
582
|
-
}
|
|
583
|
-
else {
|
|
584
|
-
// once all deps have loaded we can inline the dependency resolution blobs
|
|
585
|
-
// and define this blob
|
|
586
|
-
let lastIndex = 0, depIndex = 0, dynamicImportEndStack = [];
|
|
587
|
-
function pushStringTo (originalIndex) {
|
|
588
|
-
while (dynamicImportEndStack[dynamicImportEndStack.length - 1] < originalIndex) {
|
|
589
|
-
const dynamicImportEnd = dynamicImportEndStack.pop();
|
|
590
|
-
resolvedSource += `${source.slice(lastIndex, dynamicImportEnd)}, ${urlJsString(load.r)}`;
|
|
591
|
-
lastIndex = dynamicImportEnd;
|
|
592
|
-
}
|
|
593
|
-
resolvedSource += source.slice(lastIndex, originalIndex);
|
|
594
|
-
lastIndex = originalIndex;
|
|
595
|
-
}
|
|
596
|
-
for (const { s: start, ss: statementStart, se: statementEnd, d: dynamicImportIndex } of imports) {
|
|
597
|
-
// dependency source replacements
|
|
598
|
-
if (dynamicImportIndex === -1) {
|
|
599
|
-
let depLoad = load.d[depIndex++], blobUrl = depLoad.b, cycleShell = !blobUrl;
|
|
600
|
-
if (cycleShell) {
|
|
601
|
-
// circular shell creation
|
|
602
|
-
if (!(blobUrl = depLoad.s)) {
|
|
603
|
-
blobUrl = depLoad.s = createBlob(`export function u$_(m){${
|
|
604
|
-
depLoad.a[1].map(({ s, e }, i) => {
|
|
605
|
-
const q = depLoad.S[s] === '"' || depLoad.S[s] === "'";
|
|
606
|
-
return `e$_${i}=m${q ? `[` : '.'}${depLoad.S.slice(s, e)}${q ? `]` : ''}`;
|
|
607
|
-
}).join(',')
|
|
608
|
-
}}${
|
|
609
|
-
depLoad.a[1].length ? `let ${depLoad.a[1].map((_, i) => `e$_${i}`).join(',')};` : ''
|
|
610
|
-
}export {${
|
|
611
|
-
depLoad.a[1].map(({ s, e }, i) => `e$_${i} as ${depLoad.S.slice(s, e)}`).join(',')
|
|
612
|
-
}}\n//# sourceURL=${depLoad.r}?cycle`);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
pushStringTo(start - 1);
|
|
617
|
-
resolvedSource += `/*${source.slice(start - 1, statementEnd)}*/${urlJsString(blobUrl)}`;
|
|
618
|
-
|
|
619
|
-
// circular shell execution
|
|
620
|
-
if (!cycleShell && depLoad.s) {
|
|
621
|
-
resolvedSource += `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
|
|
622
|
-
depLoad.s = undefined;
|
|
623
|
-
}
|
|
624
|
-
lastIndex = statementEnd;
|
|
625
|
-
}
|
|
626
|
-
// import.meta
|
|
627
|
-
else if (dynamicImportIndex === -2) {
|
|
628
|
-
load.m = { url: load.r, resolve: metaResolve };
|
|
629
|
-
metaHook(load.m, load.u);
|
|
630
|
-
pushStringTo(start);
|
|
631
|
-
resolvedSource += `importShim._r[${urlJsString(load.u)}].m`;
|
|
632
|
-
lastIndex = statementEnd;
|
|
633
|
-
}
|
|
634
|
-
// dynamic import
|
|
635
|
-
else {
|
|
636
|
-
pushStringTo(statementStart + 6);
|
|
637
|
-
resolvedSource += `Shim(`;
|
|
638
|
-
dynamicImportEndStack.push(statementEnd - 1);
|
|
639
|
-
lastIndex = start;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
// support progressive cycle binding updates (try statement avoids tdz errors)
|
|
644
|
-
if (load.s)
|
|
645
|
-
resolvedSource += `\n;import{u$_}from'${load.s}';try{u$_({${exports.filter(e => e.ln).map(({ s, e, ln }) => `${source.slice(s, e)}:${ln}`).join(',')}})}catch(_){};\n`;
|
|
646
|
-
|
|
647
|
-
pushStringTo(source.length);
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
let hasSourceURL = false;
|
|
651
|
-
resolvedSource = resolvedSource.replace(sourceMapURLRegEx, (match, isMapping, url) => (hasSourceURL = !isMapping, match.replace(url, () => new URL(url, load.r))));
|
|
652
|
-
if (!hasSourceURL)
|
|
653
|
-
resolvedSource += '\n//# sourceURL=' + load.r;
|
|
654
|
-
|
|
655
|
-
load.b = lastLoad = createBlob(resolvedSource);
|
|
656
|
-
load.S = undefined;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
// ; and // trailer support added for Ruby on Rails 7 source maps compatibility
|
|
660
|
-
// https://github.com/guybedford/es-module-shims/issues/228
|
|
661
|
-
const sourceMapURLRegEx = /\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;
|
|
662
|
-
|
|
663
|
-
const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
|
|
664
|
-
const jsonContentType = /^(text|application)\/json(;|$)/;
|
|
665
|
-
const cssContentType = /^(text|application)\/css(;|$)/;
|
|
666
|
-
|
|
667
|
-
const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;
|
|
668
|
-
|
|
669
|
-
// restrict in-flight fetches to a pool of 100
|
|
670
|
-
let p = [];
|
|
671
|
-
let c = 0;
|
|
672
|
-
function pushFetchPool () {
|
|
673
|
-
if (++c > 100)
|
|
674
|
-
return new Promise(r => p.push(r));
|
|
675
|
-
}
|
|
676
|
-
function popFetchPool () {
|
|
677
|
-
c--;
|
|
678
|
-
if (p.length)
|
|
679
|
-
p.shift()();
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
async function doFetch (url, fetchOpts, parent) {
|
|
683
|
-
if (enforceIntegrity && !fetchOpts.integrity)
|
|
684
|
-
throw Error(`No integrity for ${url}${fromParent(parent)}.`);
|
|
685
|
-
const poolQueue = pushFetchPool();
|
|
686
|
-
if (poolQueue) await poolQueue;
|
|
687
|
-
try {
|
|
688
|
-
var res = await fetchHook(url, fetchOpts);
|
|
689
|
-
}
|
|
690
|
-
catch (e) {
|
|
691
|
-
e.message = `Unable to fetch ${url}${fromParent(parent)} - see network log for details.\n` + e.message;
|
|
692
|
-
throw e;
|
|
693
|
-
}
|
|
694
|
-
finally {
|
|
695
|
-
popFetchPool();
|
|
696
|
-
}
|
|
697
|
-
if (!res.ok)
|
|
698
|
-
throw Error(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
|
|
699
|
-
return res;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
async function fetchModule (url, fetchOpts, parent) {
|
|
703
|
-
const res = await doFetch(url, fetchOpts, parent);
|
|
704
|
-
const contentType = res.headers.get('content-type');
|
|
705
|
-
if (jsContentType.test(contentType))
|
|
706
|
-
return { r: res.url, s: await res.text(), t: 'js' };
|
|
707
|
-
else if (jsonContentType.test(contentType))
|
|
708
|
-
return { r: res.url, s: `export default ${await res.text()}`, t: 'json' };
|
|
709
|
-
else if (cssContentType.test(contentType)) {
|
|
710
|
-
return { r: res.url, s: `var s=new CSSStyleSheet();s.replaceSync(${
|
|
711
|
-
JSON.stringify((await res.text()).replace(cssUrlRegEx, (_match, quotes = '', relUrl1, relUrl2) => `url(${quotes}${resolveUrl(relUrl1 || relUrl2, url)}${quotes})`))
|
|
712
|
-
});export default s;`, t: 'css' };
|
|
713
|
-
}
|
|
714
|
-
else
|
|
715
|
-
throw Error(`Unsupported Content-Type "${contentType}" loading ${url}${fromParent(parent)}. Modules must be served with a valid MIME type like application/javascript.`);
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
function getOrCreateLoad (url, fetchOpts, parent, source) {
|
|
719
|
-
let load = registry[url];
|
|
720
|
-
if (load && !source)
|
|
721
|
-
return load;
|
|
722
|
-
|
|
723
|
-
load = {
|
|
724
|
-
// url
|
|
725
|
-
u: url,
|
|
726
|
-
// response url
|
|
727
|
-
r: source ? url : undefined,
|
|
728
|
-
// fetchPromise
|
|
729
|
-
f: undefined,
|
|
730
|
-
// source
|
|
731
|
-
S: undefined,
|
|
732
|
-
// linkPromise
|
|
733
|
-
L: undefined,
|
|
734
|
-
// analysis
|
|
735
|
-
a: undefined,
|
|
736
|
-
// deps
|
|
737
|
-
d: undefined,
|
|
738
|
-
// blobUrl
|
|
739
|
-
b: undefined,
|
|
740
|
-
// shellUrl
|
|
741
|
-
s: undefined,
|
|
742
|
-
// needsShim
|
|
743
|
-
n: false,
|
|
744
|
-
// type
|
|
745
|
-
t: null,
|
|
746
|
-
// meta
|
|
747
|
-
m: null
|
|
748
|
-
};
|
|
749
|
-
if (registry[url]) {
|
|
750
|
-
let i = 0;
|
|
751
|
-
while (registry[load.u + ++i]);
|
|
752
|
-
load.u += i;
|
|
753
|
-
}
|
|
754
|
-
registry[load.u] = load;
|
|
755
|
-
|
|
756
|
-
load.f = (async () => {
|
|
757
|
-
if (!source) {
|
|
758
|
-
// preload fetch options override fetch options (race)
|
|
759
|
-
let t;
|
|
760
|
-
({ r: load.r, s: source, t } = await (fetchCache[url] || fetchModule(url, fetchOpts, parent)));
|
|
761
|
-
if (t && !shimMode) {
|
|
762
|
-
if (t === 'css' && !cssModulesEnabled || t === 'json' && !jsonModulesEnabled)
|
|
763
|
-
throw Error(`${t}-modules require <script type="esms-options">{ "polyfillEnable": ["${t}-modules"] }<${''}/script>`);
|
|
764
|
-
if (t === 'css' && !supportsCssAssertions || t === 'json' && !supportsJsonAssertions)
|
|
765
|
-
load.n = true;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
try {
|
|
769
|
-
load.a = parse(source, load.u);
|
|
770
|
-
}
|
|
771
|
-
catch (e) {
|
|
772
|
-
throwError(e);
|
|
773
|
-
load.a = [[], [], false];
|
|
774
|
-
}
|
|
775
|
-
load.S = source;
|
|
776
|
-
return load;
|
|
777
|
-
})();
|
|
778
|
-
|
|
779
|
-
load.L = load.f.then(async () => {
|
|
780
|
-
let childFetchOpts = fetchOpts;
|
|
781
|
-
load.d = (await Promise.all(load.a[0].map(async ({ n, d }) => {
|
|
782
|
-
if (d >= 0 && !supportsDynamicImport || d === -2 && !supportsImportMeta)
|
|
783
|
-
load.n = true;
|
|
784
|
-
if (d !== -1 || !n) return;
|
|
785
|
-
const { r, b } = await resolve(n, load.r || load.u);
|
|
786
|
-
if (b && (!supportsImportMaps || importMapSrcOrLazy))
|
|
787
|
-
load.n = true;
|
|
788
|
-
if (d !== -1) return;
|
|
789
|
-
if (skip && skip(r)) return { b: r };
|
|
790
|
-
if (childFetchOpts.integrity)
|
|
791
|
-
childFetchOpts = Object.assign({}, childFetchOpts, { integrity: undefined });
|
|
792
|
-
return getOrCreateLoad(r, childFetchOpts, load.r).f;
|
|
793
|
-
}))).filter(l => l);
|
|
794
|
-
});
|
|
795
|
-
|
|
796
|
-
return load;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
function processScriptsAndPreloads (mapsOnly = false) {
|
|
800
|
-
if (!mapsOnly)
|
|
801
|
-
for (const link of document.querySelectorAll(shimMode ? 'link[rel=modulepreload-shim]' : 'link[rel=modulepreload]'))
|
|
802
|
-
processPreload(link);
|
|
803
|
-
for (const script of document.querySelectorAll(shimMode ? 'script[type=importmap-shim]' : 'script[type=importmap]'))
|
|
804
|
-
processImportMap(script);
|
|
805
|
-
if (!mapsOnly)
|
|
806
|
-
for (const script of document.querySelectorAll(shimMode ? 'script[type=module-shim]' : 'script[type=module]'))
|
|
807
|
-
processScript(script);
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
function getFetchOpts (script) {
|
|
811
|
-
const fetchOpts = {};
|
|
812
|
-
if (script.integrity)
|
|
813
|
-
fetchOpts.integrity = script.integrity;
|
|
814
|
-
if (script.referrerPolicy)
|
|
815
|
-
fetchOpts.referrerPolicy = script.referrerPolicy;
|
|
816
|
-
if (script.crossOrigin === 'use-credentials')
|
|
817
|
-
fetchOpts.credentials = 'include';
|
|
818
|
-
else if (script.crossOrigin === 'anonymous')
|
|
819
|
-
fetchOpts.credentials = 'omit';
|
|
820
|
-
else
|
|
821
|
-
fetchOpts.credentials = 'same-origin';
|
|
822
|
-
return fetchOpts;
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
let lastStaticLoadPromise = Promise.resolve();
|
|
826
|
-
|
|
827
|
-
let domContentLoadedCnt = 1;
|
|
828
|
-
function domContentLoadedCheck () {
|
|
829
|
-
if (--domContentLoadedCnt === 0 && !noLoadEventRetriggers && (shimMode || !baselinePassthrough))
|
|
830
|
-
document.dispatchEvent(new Event('DOMContentLoaded'));
|
|
831
|
-
}
|
|
832
|
-
// this should always trigger because we assume es-module-shims is itself a domcontentloaded requirement
|
|
833
|
-
if (hasDocument) {
|
|
834
|
-
document.addEventListener('DOMContentLoaded', async () => {
|
|
835
|
-
await initPromise;
|
|
836
|
-
domContentLoadedCheck();
|
|
837
|
-
});
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
let readyStateCompleteCnt = 1;
|
|
841
|
-
function readyStateCompleteCheck () {
|
|
842
|
-
if (--readyStateCompleteCnt === 0 && !noLoadEventRetriggers && (shimMode || !baselinePassthrough))
|
|
843
|
-
document.dispatchEvent(new Event('readystatechange'));
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
const hasNext = script => script.nextSibling || script.parentNode && hasNext(script.parentNode);
|
|
847
|
-
const epCheck = (script, ready) => script.ep || !ready && (!script.src && !script.innerHTML || !hasNext(script)) || script.getAttribute('noshim') !== null || !(script.ep = true);
|
|
848
|
-
|
|
849
|
-
function processImportMap (script, ready = readyStateCompleteCnt > 0) {
|
|
850
|
-
if (epCheck(script, ready)) return;
|
|
851
|
-
// we dont currently support multiple, external or dynamic imports maps in polyfill mode to match native
|
|
852
|
-
if (script.src) {
|
|
853
|
-
if (!shimMode)
|
|
854
|
-
return;
|
|
855
|
-
setImportMapSrcOrLazy();
|
|
856
|
-
}
|
|
857
|
-
if (acceptingImportMaps) {
|
|
858
|
-
importMapPromise = importMapPromise
|
|
859
|
-
.then(async () => {
|
|
860
|
-
importMap = resolveAndComposeImportMap(script.src ? await (await doFetch(script.src, getFetchOpts(script))).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap);
|
|
861
|
-
})
|
|
862
|
-
.catch(e => {
|
|
863
|
-
console.log(e);
|
|
864
|
-
if (e instanceof SyntaxError)
|
|
865
|
-
e = new Error(`Unable to parse import map ${e.message} in: ${script.src || script.innerHTML}`);
|
|
866
|
-
throwError(e);
|
|
867
|
-
});
|
|
868
|
-
if (!shimMode)
|
|
869
|
-
acceptingImportMaps = false;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
function processScript (script, ready = readyStateCompleteCnt > 0) {
|
|
874
|
-
if (epCheck(script, ready)) return;
|
|
875
|
-
// does this load block readystate complete
|
|
876
|
-
const isBlockingReadyScript = script.getAttribute('async') === null && readyStateCompleteCnt > 0;
|
|
877
|
-
// does this load block DOMContentLoaded
|
|
878
|
-
const isDomContentLoadedScript = domContentLoadedCnt > 0;
|
|
879
|
-
if (isBlockingReadyScript) readyStateCompleteCnt++;
|
|
880
|
-
if (isDomContentLoadedScript) domContentLoadedCnt++;
|
|
881
|
-
const loadPromise = topLevelLoad(script.src || baseUrl, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, isBlockingReadyScript && lastStaticLoadPromise)
|
|
882
|
-
.then(() => {
|
|
883
|
-
// if the type of the script tag "module-shim", browser does not dispatch a "load" event
|
|
884
|
-
// see https://github.com/guybedford/es-module-shims/issues/346
|
|
885
|
-
if (shimMode)
|
|
886
|
-
script.dispatchEvent(new Event('load'));
|
|
887
|
-
})
|
|
888
|
-
.catch(throwError);
|
|
889
|
-
if (isBlockingReadyScript)
|
|
890
|
-
lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
|
|
891
|
-
if (isDomContentLoadedScript)
|
|
892
|
-
loadPromise.then(domContentLoadedCheck);
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
const fetchCache = {};
|
|
896
|
-
function processPreload (link) {
|
|
897
|
-
if (link.ep) return;
|
|
898
|
-
link.ep = true;
|
|
899
|
-
if (fetchCache[link.href])
|
|
900
|
-
return;
|
|
901
|
-
fetchCache[link.href] = fetchModule(link.href, getFetchOpts(link));
|
|
902
|
-
}
|
|
903
389
|
|
|
904
|
-
|
|
390
|
+
/* es-module-lexer 1.2.1 */
|
|
391
|
+
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,o=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;o>0&&C.memory.grow(Math.ceil(o/65536));const D=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,D,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 K=[],k=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),o=C.se();let D;C.ip()&&(D=J(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),K.push({n:D,s:A,e:Q,ss:I,se:o,d:g,a:B});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),o=I[0],D=B<0?void 0:E.slice(B,g),K=D?D[0]:"";k.push({s:A,e:Q,ls:B,le:g,n:'"'===o||"'"===o?J(I):I,ln:'"'===K||"'"===K?J(D):D});}function J(A){try{return (0,eval)(A)}catch(A){}}return [K,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="AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gAn9/AAMvLgABAQICAgICAgICAgICAgICAgIAAwMDBAQAAAADAAAAAAMDAAUGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUGw8gALfwBBsPIACwdwEwZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAmFpAAgCaWQACQJpcAAKAmVzAAsCZWUADANlbHMADQNlbGUADgJyaQAPAnJlABABZgARBXBhcnNlABILX19oZWFwX2Jhc2UDAQqHPC5oAQF/QQAgADYC9AlBACgC0AkiASAAQQF0aiIAQQA7AQBBACAAQQJqIgA2AvgJQQAgADYC/AlBAEEANgLUCUEAQQA2AuQJQQBBADYC3AlBAEEANgLYCUEAQQA2AuwJQQBBADYC4AkgAQufAQEDf0EAKALkCSEEQQB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QXZqDgQCAQECAQsgAEEEaiEADAALC0EAIAI2AqAKECJBAA8LQQAgAjYCoApB3QALSQEDf0EAIQMCQCACRQ0AAkADQCAALQAAIgQgAS0AACIFRw0BIAFBAWohASAAQQFqIQAgAkF/aiICDQAMAgsLIAQgBWshAwsgAwsL4gECAEGACAvEAQAAeABwAG8AcgB0AG0AcABvAHIAdABlAHQAYQByAG8AbQB1AG4AYwB0AGkAbwBuAHMAcwBlAHIAdAB2AG8AeQBpAGUAZABlAGwAZQBjAG8AbgB0AGkAbgBpAG4AcwB0AGEAbgB0AHkAYgByAGUAYQByAGUAdAB1AHIAZABlAGIAdQBnAGcAZQBhAHcAYQBpAHQAaAByAHcAaABpAGwAZQBmAG8AcgBpAGYAYwBhAHQAYwBmAGkAbgBhAGwAbABlAGwAcwAAQcQJCxABAAAAAgAAAAAEAAAwOQAA","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;
|
|
392
|
+
|
|
393
|
+
async function _resolve (id, parentUrl) {
|
|
394
|
+
const urlResolved = resolveIfNotPlainOrUrl(id, parentUrl);
|
|
395
|
+
return {
|
|
396
|
+
r: resolveImportMap(importMap, urlResolved || id, parentUrl) || throwUnresolved(id, parentUrl),
|
|
397
|
+
// b = bare specifier
|
|
398
|
+
b: !urlResolved && !isURL(id)
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const resolve = resolveHook ? async (id, parentUrl) => {
|
|
403
|
+
let result = resolveHook(id, parentUrl, defaultResolve);
|
|
404
|
+
// will be deprecated in next major
|
|
405
|
+
if (result && result.then)
|
|
406
|
+
result = await result;
|
|
407
|
+
return result ? { r: result, b: !resolveIfNotPlainOrUrl(id, parentUrl) && !isURL(id) } : _resolve(id, parentUrl);
|
|
408
|
+
} : _resolve;
|
|
409
|
+
|
|
410
|
+
// importShim('mod');
|
|
411
|
+
// importShim('mod', { opts });
|
|
412
|
+
// importShim('mod', { opts }, parentUrl);
|
|
413
|
+
// importShim('mod', parentUrl);
|
|
414
|
+
async function importShim (id, ...args) {
|
|
415
|
+
// parentUrl if present will be the last argument
|
|
416
|
+
let parentUrl = args[args.length - 1];
|
|
417
|
+
if (typeof parentUrl !== 'string')
|
|
418
|
+
parentUrl = baseUrl;
|
|
419
|
+
// needed for shim check
|
|
420
|
+
await initPromise;
|
|
421
|
+
if (importHook) await importHook(id, typeof args[1] !== 'string' ? args[1] : {}, parentUrl);
|
|
422
|
+
if (acceptingImportMaps || shimMode || !baselinePassthrough) {
|
|
423
|
+
if (hasDocument)
|
|
424
|
+
processScriptsAndPreloads(true);
|
|
425
|
+
if (!shimMode)
|
|
426
|
+
acceptingImportMaps = false;
|
|
427
|
+
}
|
|
428
|
+
await importMapPromise;
|
|
429
|
+
return topLevelLoad((await resolve(id, parentUrl)).r, { credentials: 'same-origin' });
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
self.importShim = importShim;
|
|
433
|
+
|
|
434
|
+
function defaultResolve (id, parentUrl) {
|
|
435
|
+
return resolveImportMap(importMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) || throwUnresolved(id, parentUrl);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
function throwUnresolved (id, parentUrl) {
|
|
439
|
+
throw Error(`Unable to resolve specifier '${id}'${fromParent(parentUrl)}`);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
const resolveSync = (id, parentUrl = baseUrl) => {
|
|
443
|
+
parentUrl = `${parentUrl}`;
|
|
444
|
+
const result = resolveHook && resolveHook(id, parentUrl, defaultResolve);
|
|
445
|
+
return result && !result.then ? result : defaultResolve(id, parentUrl);
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
function metaResolve (id, parentUrl = this.url) {
|
|
449
|
+
return resolveSync(id, parentUrl);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
importShim.resolve = resolveSync;
|
|
453
|
+
importShim.getImportMap = () => JSON.parse(JSON.stringify(importMap));
|
|
454
|
+
importShim.addImportMap = importMapIn => {
|
|
455
|
+
if (!shimMode) throw new Error('Unsupported in polyfill mode.');
|
|
456
|
+
importMap = resolveAndComposeImportMap(importMapIn, baseUrl, importMap);
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
const registry = importShim._r = {};
|
|
460
|
+
|
|
461
|
+
async function loadAll (load, seen) {
|
|
462
|
+
if (load.b || seen[load.u])
|
|
463
|
+
return;
|
|
464
|
+
seen[load.u] = 1;
|
|
465
|
+
await load.L;
|
|
466
|
+
await Promise.all(load.d.map(dep => loadAll(dep, seen)));
|
|
467
|
+
if (!load.n)
|
|
468
|
+
load.n = load.d.some(dep => dep.n);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
let importMap = { imports: {}, scopes: {} };
|
|
472
|
+
let baselinePassthrough;
|
|
473
|
+
|
|
474
|
+
const initPromise = featureDetectionPromise.then(() => {
|
|
475
|
+
baselinePassthrough = esmsInitOptions.polyfillEnable !== true && supportsDynamicImport && supportsImportMeta && supportsImportMaps && (!jsonModulesEnabled || supportsJsonAssertions) && (!cssModulesEnabled || supportsCssAssertions) && !importMapSrcOrLazy;
|
|
476
|
+
if (hasDocument) {
|
|
477
|
+
if (!supportsImportMaps) {
|
|
478
|
+
const supports = HTMLScriptElement.supports || (type => type === 'classic' || type === 'module');
|
|
479
|
+
HTMLScriptElement.supports = type => type === 'importmap' || supports(type);
|
|
480
|
+
}
|
|
481
|
+
if (shimMode || !baselinePassthrough) {
|
|
482
|
+
new MutationObserver(mutations => {
|
|
483
|
+
for (const mutation of mutations) {
|
|
484
|
+
if (mutation.type !== 'childList') continue;
|
|
485
|
+
for (const node of mutation.addedNodes) {
|
|
486
|
+
if (node.tagName === 'SCRIPT') {
|
|
487
|
+
if (node.type === (shimMode ? 'module-shim' : 'module'))
|
|
488
|
+
processScript(node, true);
|
|
489
|
+
if (node.type === (shimMode ? 'importmap-shim' : 'importmap'))
|
|
490
|
+
processImportMap(node, true);
|
|
491
|
+
}
|
|
492
|
+
else if (node.tagName === 'LINK' && node.rel === (shimMode ? 'modulepreload-shim' : 'modulepreload')) {
|
|
493
|
+
processPreload(node);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}).observe(document, {childList: true, subtree: true});
|
|
498
|
+
processScriptsAndPreloads();
|
|
499
|
+
if (document.readyState === 'complete') {
|
|
500
|
+
readyStateCompleteCheck();
|
|
501
|
+
}
|
|
502
|
+
else {
|
|
503
|
+
async function readyListener() {
|
|
504
|
+
await initPromise;
|
|
505
|
+
processScriptsAndPreloads();
|
|
506
|
+
if (document.readyState === 'complete') {
|
|
507
|
+
readyStateCompleteCheck();
|
|
508
|
+
document.removeEventListener('readystatechange', readyListener);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
document.addEventListener('readystatechange', readyListener);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
return init;
|
|
516
|
+
});
|
|
517
|
+
let importMapPromise = initPromise;
|
|
518
|
+
let firstPolyfillLoad = true;
|
|
519
|
+
let acceptingImportMaps = true;
|
|
520
|
+
|
|
521
|
+
async function topLevelLoad (url, fetchOpts, source, nativelyLoaded, lastStaticLoadPromise) {
|
|
522
|
+
if (!shimMode)
|
|
523
|
+
acceptingImportMaps = false;
|
|
524
|
+
await initPromise;
|
|
525
|
+
await importMapPromise;
|
|
526
|
+
if (importHook) await importHook(url, typeof fetchOpts !== 'string' ? fetchOpts : {}, '');
|
|
527
|
+
// early analysis opt-out - no need to even fetch if we have feature support
|
|
528
|
+
if (!shimMode && baselinePassthrough) {
|
|
529
|
+
// for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
|
|
530
|
+
if (nativelyLoaded)
|
|
531
|
+
return null;
|
|
532
|
+
await lastStaticLoadPromise;
|
|
533
|
+
return dynamicImport(source ? createBlob(source) : url, { errUrl: url || source });
|
|
534
|
+
}
|
|
535
|
+
const load = getOrCreateLoad(url, fetchOpts, null, source);
|
|
536
|
+
const seen = {};
|
|
537
|
+
await loadAll(load, seen);
|
|
538
|
+
lastLoad = undefined;
|
|
539
|
+
resolveDeps(load, seen);
|
|
540
|
+
await lastStaticLoadPromise;
|
|
541
|
+
if (source && !shimMode && !load.n) {
|
|
542
|
+
if (nativelyLoaded) return;
|
|
543
|
+
if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
|
|
544
|
+
return await dynamicImport(createBlob(source), { errUrl: source });
|
|
545
|
+
}
|
|
546
|
+
if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
|
|
547
|
+
onpolyfill();
|
|
548
|
+
firstPolyfillLoad = false;
|
|
549
|
+
}
|
|
550
|
+
const module = await dynamicImport(!shimMode && !load.n && nativelyLoaded ? load.u : load.b, { errUrl: load.u });
|
|
551
|
+
// if the top-level load is a shell, run its update function
|
|
552
|
+
if (load.s)
|
|
553
|
+
(await dynamicImport(load.s)).u$_(module);
|
|
554
|
+
if (revokeBlobURLs) revokeObjectURLs(Object.keys(seen));
|
|
555
|
+
// when tla is supported, this should return the tla promise as an actual handle
|
|
556
|
+
// so readystate can still correspond to the sync subgraph exec completions
|
|
557
|
+
return module;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function revokeObjectURLs(registryKeys) {
|
|
561
|
+
let batch = 0;
|
|
562
|
+
const keysLength = registryKeys.length;
|
|
563
|
+
const schedule = self.requestIdleCallback ? self.requestIdleCallback : self.requestAnimationFrame;
|
|
564
|
+
schedule(cleanup);
|
|
565
|
+
function cleanup() {
|
|
566
|
+
const batchStartIndex = batch * 100;
|
|
567
|
+
if (batchStartIndex > keysLength) return
|
|
568
|
+
for (const key of registryKeys.slice(batchStartIndex, batchStartIndex + 100)) {
|
|
569
|
+
const load = registry[key];
|
|
570
|
+
if (load) URL.revokeObjectURL(load.b);
|
|
571
|
+
}
|
|
572
|
+
batch++;
|
|
573
|
+
schedule(cleanup);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function urlJsString (url) {
|
|
578
|
+
return `'${url.replace(/'/g, "\\'")}'`;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
let lastLoad;
|
|
582
|
+
function resolveDeps (load, seen) {
|
|
583
|
+
if (load.b || !seen[load.u])
|
|
584
|
+
return;
|
|
585
|
+
seen[load.u] = 0;
|
|
586
|
+
|
|
587
|
+
for (const dep of load.d)
|
|
588
|
+
resolveDeps(dep, seen);
|
|
589
|
+
|
|
590
|
+
const [imports, exports] = load.a;
|
|
591
|
+
|
|
592
|
+
// "execution"
|
|
593
|
+
const source = load.S;
|
|
594
|
+
|
|
595
|
+
// edge doesnt execute sibling in order, so we fix this up by ensuring all previous executions are explicit dependencies
|
|
596
|
+
let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : '';
|
|
597
|
+
|
|
598
|
+
if (!imports.length) {
|
|
599
|
+
resolvedSource += source;
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
// once all deps have loaded we can inline the dependency resolution blobs
|
|
603
|
+
// and define this blob
|
|
604
|
+
let lastIndex = 0, depIndex = 0, dynamicImportEndStack = [];
|
|
605
|
+
function pushStringTo (originalIndex) {
|
|
606
|
+
while (dynamicImportEndStack[dynamicImportEndStack.length - 1] < originalIndex) {
|
|
607
|
+
const dynamicImportEnd = dynamicImportEndStack.pop();
|
|
608
|
+
resolvedSource += `${source.slice(lastIndex, dynamicImportEnd)}, ${urlJsString(load.r)}`;
|
|
609
|
+
lastIndex = dynamicImportEnd;
|
|
610
|
+
}
|
|
611
|
+
resolvedSource += source.slice(lastIndex, originalIndex);
|
|
612
|
+
lastIndex = originalIndex;
|
|
613
|
+
}
|
|
614
|
+
for (const { s: start, ss: statementStart, se: statementEnd, d: dynamicImportIndex } of imports) {
|
|
615
|
+
// dependency source replacements
|
|
616
|
+
if (dynamicImportIndex === -1) {
|
|
617
|
+
let depLoad = load.d[depIndex++], blobUrl = depLoad.b, cycleShell = !blobUrl;
|
|
618
|
+
if (cycleShell) {
|
|
619
|
+
// circular shell creation
|
|
620
|
+
if (!(blobUrl = depLoad.s)) {
|
|
621
|
+
blobUrl = depLoad.s = createBlob(`export function u$_(m){${
|
|
622
|
+
depLoad.a[1].map(({ s, e }, i) => {
|
|
623
|
+
const q = depLoad.S[s] === '"' || depLoad.S[s] === "'";
|
|
624
|
+
return `e$_${i}=m${q ? `[` : '.'}${depLoad.S.slice(s, e)}${q ? `]` : ''}`;
|
|
625
|
+
}).join(',')
|
|
626
|
+
}}${
|
|
627
|
+
depLoad.a[1].length ? `let ${depLoad.a[1].map((_, i) => `e$_${i}`).join(',')};` : ''
|
|
628
|
+
}export {${
|
|
629
|
+
depLoad.a[1].map(({ s, e }, i) => `e$_${i} as ${depLoad.S.slice(s, e)}`).join(',')
|
|
630
|
+
}}\n//# sourceURL=${depLoad.r}?cycle`);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
pushStringTo(start - 1);
|
|
635
|
+
resolvedSource += `/*${source.slice(start - 1, statementEnd)}*/${urlJsString(blobUrl)}`;
|
|
636
|
+
|
|
637
|
+
// circular shell execution
|
|
638
|
+
if (!cycleShell && depLoad.s) {
|
|
639
|
+
resolvedSource += `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
|
|
640
|
+
depLoad.s = undefined;
|
|
641
|
+
}
|
|
642
|
+
lastIndex = statementEnd;
|
|
643
|
+
}
|
|
644
|
+
// import.meta
|
|
645
|
+
else if (dynamicImportIndex === -2) {
|
|
646
|
+
load.m = { url: load.r, resolve: metaResolve };
|
|
647
|
+
metaHook(load.m, load.u);
|
|
648
|
+
pushStringTo(start);
|
|
649
|
+
resolvedSource += `importShim._r[${urlJsString(load.u)}].m`;
|
|
650
|
+
lastIndex = statementEnd;
|
|
651
|
+
}
|
|
652
|
+
// dynamic import
|
|
653
|
+
else {
|
|
654
|
+
pushStringTo(statementStart + 6);
|
|
655
|
+
resolvedSource += `Shim(`;
|
|
656
|
+
dynamicImportEndStack.push(statementEnd - 1);
|
|
657
|
+
lastIndex = start;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// support progressive cycle binding updates (try statement avoids tdz errors)
|
|
662
|
+
if (load.s)
|
|
663
|
+
resolvedSource += `\n;import{u$_}from'${load.s}';try{u$_({${exports.filter(e => e.ln).map(({ s, e, ln }) => `${source.slice(s, e)}:${ln}`).join(',')}})}catch(_){};\n`;
|
|
664
|
+
|
|
665
|
+
pushStringTo(source.length);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
let hasSourceURL = false;
|
|
669
|
+
resolvedSource = resolvedSource.replace(sourceMapURLRegEx, (match, isMapping, url) => (hasSourceURL = !isMapping, match.replace(url, () => new URL(url, load.r))));
|
|
670
|
+
if (!hasSourceURL)
|
|
671
|
+
resolvedSource += '\n//# sourceURL=' + load.r;
|
|
672
|
+
|
|
673
|
+
load.b = lastLoad = createBlob(resolvedSource);
|
|
674
|
+
load.S = undefined;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// ; and // trailer support added for Ruby on Rails 7 source maps compatibility
|
|
678
|
+
// https://github.com/guybedford/es-module-shims/issues/228
|
|
679
|
+
const sourceMapURLRegEx = /\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;
|
|
680
|
+
|
|
681
|
+
const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
|
|
682
|
+
const jsonContentType = /^(text|application)\/json(;|$)/;
|
|
683
|
+
const cssContentType = /^(text|application)\/css(;|$)/;
|
|
684
|
+
|
|
685
|
+
const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;
|
|
686
|
+
|
|
687
|
+
// restrict in-flight fetches to a pool of 100
|
|
688
|
+
let p = [];
|
|
689
|
+
let c = 0;
|
|
690
|
+
function pushFetchPool () {
|
|
691
|
+
if (++c > 100)
|
|
692
|
+
return new Promise(r => p.push(r));
|
|
693
|
+
}
|
|
694
|
+
function popFetchPool () {
|
|
695
|
+
c--;
|
|
696
|
+
if (p.length)
|
|
697
|
+
p.shift()();
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
async function doFetch (url, fetchOpts, parent) {
|
|
701
|
+
if (enforceIntegrity && !fetchOpts.integrity)
|
|
702
|
+
throw Error(`No integrity for ${url}${fromParent(parent)}.`);
|
|
703
|
+
const poolQueue = pushFetchPool();
|
|
704
|
+
if (poolQueue) await poolQueue;
|
|
705
|
+
try {
|
|
706
|
+
var res = await fetchHook(url, fetchOpts);
|
|
707
|
+
}
|
|
708
|
+
catch (e) {
|
|
709
|
+
e.message = `Unable to fetch ${url}${fromParent(parent)} - see network log for details.\n` + e.message;
|
|
710
|
+
throw e;
|
|
711
|
+
}
|
|
712
|
+
finally {
|
|
713
|
+
popFetchPool();
|
|
714
|
+
}
|
|
715
|
+
if (!res.ok)
|
|
716
|
+
throw Error(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
|
|
717
|
+
return res;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
async function fetchModule (url, fetchOpts, parent) {
|
|
721
|
+
const res = await doFetch(url, fetchOpts, parent);
|
|
722
|
+
const contentType = res.headers.get('content-type');
|
|
723
|
+
if (jsContentType.test(contentType))
|
|
724
|
+
return { r: res.url, s: await res.text(), t: 'js' };
|
|
725
|
+
else if (jsonContentType.test(contentType))
|
|
726
|
+
return { r: res.url, s: `export default ${await res.text()}`, t: 'json' };
|
|
727
|
+
else if (cssContentType.test(contentType)) {
|
|
728
|
+
return { r: res.url, s: `var s=new CSSStyleSheet();s.replaceSync(${
|
|
729
|
+
JSON.stringify((await res.text()).replace(cssUrlRegEx, (_match, quotes = '', relUrl1, relUrl2) => `url(${quotes}${resolveUrl(relUrl1 || relUrl2, url)}${quotes})`))
|
|
730
|
+
});export default s;`, t: 'css' };
|
|
731
|
+
}
|
|
732
|
+
else
|
|
733
|
+
throw Error(`Unsupported Content-Type "${contentType}" loading ${url}${fromParent(parent)}. Modules must be served with a valid MIME type like application/javascript.`);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
function getOrCreateLoad (url, fetchOpts, parent, source) {
|
|
737
|
+
let load = registry[url];
|
|
738
|
+
if (load && !source)
|
|
739
|
+
return load;
|
|
740
|
+
|
|
741
|
+
load = {
|
|
742
|
+
// url
|
|
743
|
+
u: url,
|
|
744
|
+
// response url
|
|
745
|
+
r: source ? url : undefined,
|
|
746
|
+
// fetchPromise
|
|
747
|
+
f: undefined,
|
|
748
|
+
// source
|
|
749
|
+
S: undefined,
|
|
750
|
+
// linkPromise
|
|
751
|
+
L: undefined,
|
|
752
|
+
// analysis
|
|
753
|
+
a: undefined,
|
|
754
|
+
// deps
|
|
755
|
+
d: undefined,
|
|
756
|
+
// blobUrl
|
|
757
|
+
b: undefined,
|
|
758
|
+
// shellUrl
|
|
759
|
+
s: undefined,
|
|
760
|
+
// needsShim
|
|
761
|
+
n: false,
|
|
762
|
+
// type
|
|
763
|
+
t: null,
|
|
764
|
+
// meta
|
|
765
|
+
m: null
|
|
766
|
+
};
|
|
767
|
+
if (registry[url]) {
|
|
768
|
+
let i = 0;
|
|
769
|
+
while (registry[load.u + ++i]);
|
|
770
|
+
load.u += i;
|
|
771
|
+
}
|
|
772
|
+
registry[load.u] = load;
|
|
773
|
+
|
|
774
|
+
load.f = (async () => {
|
|
775
|
+
if (!source) {
|
|
776
|
+
// preload fetch options override fetch options (race)
|
|
777
|
+
let t;
|
|
778
|
+
({ r: load.r, s: source, t } = await (fetchCache[url] || fetchModule(url, fetchOpts, parent)));
|
|
779
|
+
if (t && !shimMode) {
|
|
780
|
+
if (t === 'css' && !cssModulesEnabled || t === 'json' && !jsonModulesEnabled)
|
|
781
|
+
throw Error(`${t}-modules require <script type="esms-options">{ "polyfillEnable": ["${t}-modules"] }<${''}/script>`);
|
|
782
|
+
if (t === 'css' && !supportsCssAssertions || t === 'json' && !supportsJsonAssertions)
|
|
783
|
+
load.n = true;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
try {
|
|
787
|
+
load.a = parse(source, load.u);
|
|
788
|
+
}
|
|
789
|
+
catch (e) {
|
|
790
|
+
throwError(e);
|
|
791
|
+
load.a = [[], [], false];
|
|
792
|
+
}
|
|
793
|
+
load.S = source;
|
|
794
|
+
return load;
|
|
795
|
+
})();
|
|
796
|
+
|
|
797
|
+
load.L = load.f.then(async () => {
|
|
798
|
+
let childFetchOpts = fetchOpts;
|
|
799
|
+
load.d = (await Promise.all(load.a[0].map(async ({ n, d }) => {
|
|
800
|
+
if (d >= 0 && !supportsDynamicImport || d === -2 && !supportsImportMeta)
|
|
801
|
+
load.n = true;
|
|
802
|
+
if (d !== -1 || !n) return;
|
|
803
|
+
const { r, b } = await resolve(n, load.r || load.u);
|
|
804
|
+
if (b && (!supportsImportMaps || importMapSrcOrLazy))
|
|
805
|
+
load.n = true;
|
|
806
|
+
if (d !== -1) return;
|
|
807
|
+
if (skip && skip(r)) return { b: r };
|
|
808
|
+
if (childFetchOpts.integrity)
|
|
809
|
+
childFetchOpts = Object.assign({}, childFetchOpts, { integrity: undefined });
|
|
810
|
+
return getOrCreateLoad(r, childFetchOpts, load.r).f;
|
|
811
|
+
}))).filter(l => l);
|
|
812
|
+
});
|
|
813
|
+
|
|
814
|
+
return load;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
function processScriptsAndPreloads (mapsOnly = false) {
|
|
818
|
+
if (!mapsOnly)
|
|
819
|
+
for (const link of document.querySelectorAll(shimMode ? 'link[rel=modulepreload-shim]' : 'link[rel=modulepreload]'))
|
|
820
|
+
processPreload(link);
|
|
821
|
+
for (const script of document.querySelectorAll(shimMode ? 'script[type=importmap-shim]' : 'script[type=importmap]'))
|
|
822
|
+
processImportMap(script);
|
|
823
|
+
if (!mapsOnly)
|
|
824
|
+
for (const script of document.querySelectorAll(shimMode ? 'script[type=module-shim]' : 'script[type=module]'))
|
|
825
|
+
processScript(script);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
function getFetchOpts (script) {
|
|
829
|
+
const fetchOpts = {};
|
|
830
|
+
if (script.integrity)
|
|
831
|
+
fetchOpts.integrity = script.integrity;
|
|
832
|
+
if (script.referrerPolicy)
|
|
833
|
+
fetchOpts.referrerPolicy = script.referrerPolicy;
|
|
834
|
+
if (script.crossOrigin === 'use-credentials')
|
|
835
|
+
fetchOpts.credentials = 'include';
|
|
836
|
+
else if (script.crossOrigin === 'anonymous')
|
|
837
|
+
fetchOpts.credentials = 'omit';
|
|
838
|
+
else
|
|
839
|
+
fetchOpts.credentials = 'same-origin';
|
|
840
|
+
return fetchOpts;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
let lastStaticLoadPromise = Promise.resolve();
|
|
844
|
+
|
|
845
|
+
let domContentLoadedCnt = 1;
|
|
846
|
+
function domContentLoadedCheck () {
|
|
847
|
+
if (--domContentLoadedCnt === 0 && !noLoadEventRetriggers && (shimMode || !baselinePassthrough)) {
|
|
848
|
+
document.dispatchEvent(new Event('DOMContentLoaded'));
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
// this should always trigger because we assume es-module-shims is itself a domcontentloaded requirement
|
|
852
|
+
if (hasDocument) {
|
|
853
|
+
document.addEventListener('DOMContentLoaded', async () => {
|
|
854
|
+
await initPromise;
|
|
855
|
+
domContentLoadedCheck();
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
let readyStateCompleteCnt = 1;
|
|
860
|
+
function readyStateCompleteCheck () {
|
|
861
|
+
if (--readyStateCompleteCnt === 0 && !noLoadEventRetriggers && (shimMode || !baselinePassthrough)) {
|
|
862
|
+
document.dispatchEvent(new Event('readystatechange'));
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
const hasNext = script => script.nextSibling || script.parentNode && hasNext(script.parentNode);
|
|
867
|
+
const epCheck = (script, ready) => script.ep || !ready && (!script.src && !script.innerHTML || !hasNext(script)) || script.getAttribute('noshim') !== null || !(script.ep = true);
|
|
868
|
+
|
|
869
|
+
function processImportMap (script, ready = readyStateCompleteCnt > 0) {
|
|
870
|
+
if (epCheck(script, ready)) return;
|
|
871
|
+
// we dont currently support multiple, external or dynamic imports maps in polyfill mode to match native
|
|
872
|
+
if (script.src) {
|
|
873
|
+
if (!shimMode)
|
|
874
|
+
return;
|
|
875
|
+
setImportMapSrcOrLazy();
|
|
876
|
+
}
|
|
877
|
+
if (acceptingImportMaps) {
|
|
878
|
+
importMapPromise = importMapPromise
|
|
879
|
+
.then(async () => {
|
|
880
|
+
importMap = resolveAndComposeImportMap(script.src ? await (await doFetch(script.src, getFetchOpts(script))).json() : JSON.parse(script.innerHTML), script.src || baseUrl, importMap);
|
|
881
|
+
})
|
|
882
|
+
.catch(e => {
|
|
883
|
+
console.log(e);
|
|
884
|
+
if (e instanceof SyntaxError)
|
|
885
|
+
e = new Error(`Unable to parse import map ${e.message} in: ${script.src || script.innerHTML}`);
|
|
886
|
+
throwError(e);
|
|
887
|
+
});
|
|
888
|
+
if (!shimMode)
|
|
889
|
+
acceptingImportMaps = false;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
function processScript (script, ready = readyStateCompleteCnt > 0) {
|
|
894
|
+
if (epCheck(script, ready)) return;
|
|
895
|
+
// does this load block readystate complete
|
|
896
|
+
const isBlockingReadyScript = script.getAttribute('async') === null && readyStateCompleteCnt > 0;
|
|
897
|
+
// does this load block DOMContentLoaded
|
|
898
|
+
const isDomContentLoadedScript = domContentLoadedCnt > 0;
|
|
899
|
+
if (isBlockingReadyScript) readyStateCompleteCnt++;
|
|
900
|
+
if (isDomContentLoadedScript) domContentLoadedCnt++;
|
|
901
|
+
const loadPromise = topLevelLoad(script.src || baseUrl, getFetchOpts(script), !script.src && script.innerHTML, !shimMode, isBlockingReadyScript && lastStaticLoadPromise)
|
|
902
|
+
.then(() => {
|
|
903
|
+
// if the type of the script tag "module-shim", browser does not dispatch a "load" event
|
|
904
|
+
// see https://github.com/guybedford/es-module-shims/issues/346
|
|
905
|
+
if (shimMode) {
|
|
906
|
+
script.dispatchEvent(new Event('load'));
|
|
907
|
+
}
|
|
908
|
+
})
|
|
909
|
+
.catch(throwError);
|
|
910
|
+
if (isBlockingReadyScript)
|
|
911
|
+
lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
|
|
912
|
+
if (isDomContentLoadedScript)
|
|
913
|
+
loadPromise.then(domContentLoadedCheck);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
const fetchCache = {};
|
|
917
|
+
function processPreload (link) {
|
|
918
|
+
if (link.ep) return;
|
|
919
|
+
link.ep = true;
|
|
920
|
+
if (fetchCache[link.href])
|
|
921
|
+
return;
|
|
922
|
+
fetchCache[link.href] = fetchModule(link.href, getFetchOpts(link));
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
})();
|