es-module-shims 2.5.1 → 2.6.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 +93 -19
- package/dist/es-module-shims.debug.js +1144 -1140
- package/dist/es-module-shims.js +1124 -1120
- package/dist/es-module-shims.wasm.js +1124 -1120
- package/index.d.ts +161 -33
- package/package.json +1 -1
|
@@ -1,276 +1,280 @@
|
|
|
1
|
-
/** ES Module Shims Wasm @version 2.
|
|
1
|
+
/** ES Module Shims Wasm @version 2.6.1 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
|
-
let invalidate;
|
|
5
|
-
const hotReload$1 = url => invalidate(new URL(url, baseUrl).href);
|
|
6
|
-
const initHotReload = () => {
|
|
7
|
-
let _importHook = importHook,
|
|
8
|
-
_resolveHook = resolveHook,
|
|
9
|
-
_metaHook = metaHook;
|
|
10
|
-
|
|
11
|
-
let defaultResolve;
|
|
12
|
-
let hotResolveHook = (id, parent, _defaultResolve) => {
|
|
13
|
-
if (!defaultResolve) defaultResolve = _defaultResolve;
|
|
14
|
-
const originalParent = stripVersion(parent);
|
|
15
|
-
const url = stripVersion(defaultResolve(id, originalParent));
|
|
16
|
-
const hotState = getHotState(url);
|
|
17
|
-
const parents = hotState.p;
|
|
18
|
-
if (!parents.includes(originalParent)) parents.push(originalParent);
|
|
19
|
-
return toVersioned(url, hotState);
|
|
20
|
-
};
|
|
21
|
-
const hotImportHook = (url, _, __, source, sourceType) => {
|
|
22
|
-
const hotState = getHotState(url);
|
|
23
|
-
hotState.e = typeof source === 'string' ? source : true;
|
|
24
|
-
hotState.t = sourceType;
|
|
25
|
-
};
|
|
26
|
-
const hotMetaHook = (metaObj, url) =>
|
|
27
|
-
metaObj.hot = new Hot(url);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const Hot = class Hot {
|
|
31
|
-
constructor(url) {
|
|
32
|
-
this.data = getHotState((this.url = stripVersion(url))).d;
|
|
33
|
-
}
|
|
34
|
-
accept(deps, cb) {
|
|
35
|
-
if (typeof deps === 'function') {
|
|
36
|
-
cb = deps;
|
|
37
|
-
deps = null;
|
|
38
|
-
}
|
|
39
|
-
const hotState = getHotState(this.url);
|
|
40
|
-
if (!hotState.A) return;
|
|
41
|
-
(hotState.a = hotState.a || []).push([
|
|
42
|
-
typeof deps === 'string' ? defaultResolve(deps, this.url)
|
|
43
|
-
: deps ? deps.map(d => defaultResolve(d, this.url))
|
|
44
|
-
: null,
|
|
45
|
-
cb
|
|
46
|
-
]);
|
|
47
|
-
}
|
|
48
|
-
dispose(cb) {
|
|
49
|
-
getHotState(this.url).u = cb;
|
|
50
|
-
}
|
|
51
|
-
invalidate() {
|
|
52
|
-
const hotState = getHotState(this.url);
|
|
53
|
-
hotState.a = null;
|
|
54
|
-
hotState.A = true;
|
|
55
|
-
const seen = [this.url];
|
|
56
|
-
for (const p of hotState.p) invalidate(p, this.url, seen);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const versionedRegEx = /\?v=\d+$/;
|
|
61
|
-
const stripVersion = url => {
|
|
62
|
-
const versionMatch = url.match(versionedRegEx);
|
|
63
|
-
return versionMatch ? url.slice(0, -versionMatch[0].length) : url;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const toVersioned = (url, hotState) => {
|
|
67
|
-
const { v } = hotState;
|
|
68
|
-
return url + (v ? '?v=' + v : '');
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
let hotRegistry = {},
|
|
72
|
-
curInvalidationRoots = new Set(),
|
|
73
|
-
curInvalidationInterval;
|
|
74
|
-
const getHotState = url =>
|
|
75
|
-
hotRegistry[url] ||
|
|
76
|
-
(hotRegistry[url] = {
|
|
77
|
-
// version
|
|
78
|
-
v: 0,
|
|
79
|
-
// accept list ([deps, cb] pairs)
|
|
80
|
-
a: null,
|
|
81
|
-
// accepting acceptors
|
|
82
|
-
A: true,
|
|
83
|
-
// unload callback
|
|
84
|
-
u: null,
|
|
85
|
-
// entry point or inline script source
|
|
86
|
-
e: false,
|
|
87
|
-
// hot data
|
|
88
|
-
d: {},
|
|
89
|
-
// parents
|
|
90
|
-
p: [],
|
|
91
|
-
// source type
|
|
92
|
-
t: undefined
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
invalidate = (url, fromUrl, seen = []) => {
|
|
96
|
-
const hotState = hotRegistry[url];
|
|
97
|
-
if (!hotState || seen.includes(url)) return false;
|
|
98
|
-
seen.push(url);
|
|
99
|
-
hotState.A = false;
|
|
100
|
-
if (
|
|
101
|
-
fromUrl &&
|
|
102
|
-
hotState.a &&
|
|
103
|
-
hotState.a.some(([d]) => d && (typeof d === 'string' ? d === fromUrl : d.includes(fromUrl)))
|
|
104
|
-
) {
|
|
105
|
-
curInvalidationRoots.add(fromUrl);
|
|
106
|
-
} else {
|
|
107
|
-
if (hotState.e || hotState.a) curInvalidationRoots.add(url);
|
|
108
|
-
hotState.v++;
|
|
109
|
-
if (!hotState.a) for (const parent of hotState.p) invalidate(parent, url, seen);
|
|
110
|
-
}
|
|
111
|
-
if (!curInvalidationInterval) curInvalidationInterval = setTimeout(handleInvalidations, hotReloadInterval);
|
|
112
|
-
return true;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const handleInvalidations = () => {
|
|
116
|
-
curInvalidationInterval = null;
|
|
117
|
-
const earlyRoots = new Set();
|
|
118
|
-
for (const root of curInvalidationRoots) {
|
|
119
|
-
const hotState = hotRegistry[root];
|
|
120
|
-
topLevelLoad(
|
|
121
|
-
toVersioned(root, hotState),
|
|
122
|
-
baseUrl,
|
|
123
|
-
defaultFetchOpts,
|
|
124
|
-
typeof hotState.e === 'string' ? hotState.e : undefined,
|
|
125
|
-
false,
|
|
126
|
-
undefined,
|
|
127
|
-
hotState.t
|
|
128
|
-
).then(m => {
|
|
129
|
-
if (hotState.a) {
|
|
130
|
-
hotState.a.every(([d, c]) => d === null && !earlyRoots.has(c) && c(m));
|
|
131
|
-
// unload should be the latest unload handler from the just loaded module
|
|
132
|
-
if (hotState.u) {
|
|
133
|
-
hotState.u(hotState.d);
|
|
134
|
-
hotState.u = null;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
for (const parent of hotState.p) {
|
|
138
|
-
const hotState = hotRegistry[parent];
|
|
139
|
-
if (hotState && hotState.a)
|
|
140
|
-
hotState.a.every(async ([d, c]) => {
|
|
141
|
-
return (
|
|
142
|
-
d &&
|
|
143
|
-
!earlyRoots.has(c) &&
|
|
144
|
-
(typeof d === 'string' ?
|
|
145
|
-
d === root && c(m)
|
|
146
|
-
: c(await Promise.all(d.map(d => (earlyRoots.push(c), importShim(toVersioned(d, getHotState(d))))))))
|
|
147
|
-
);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
}, throwError);
|
|
151
|
-
}
|
|
152
|
-
curInvalidationRoots = new Set();
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
return [
|
|
156
|
-
_importHook ? chain(_importHook, hotImportHook) : hotImportHook,
|
|
157
|
-
_resolveHook ?
|
|
158
|
-
(id, parent, defaultResolve) =>
|
|
159
|
-
hotResolveHook(id, parent, (id, parent) => _resolveHook(id, parent, defaultResolve))
|
|
160
|
-
: hotResolveHook,
|
|
161
|
-
_metaHook ? chain(_metaHook, hotMetaHook) : hotMetaHook
|
|
162
|
-
];
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
const hasDocument = typeof document !== 'undefined';
|
|
166
|
-
|
|
167
|
-
const noop = () => {};
|
|
168
|
-
|
|
169
|
-
const dynamicImport = (u, errUrl) => import(u);
|
|
170
|
-
|
|
171
|
-
const defineValue = (obj, prop, value) =>
|
|
172
|
-
Object.defineProperty(obj, prop, { writable: false, configurable: false, value });
|
|
173
|
-
|
|
174
|
-
const optionsScript = hasDocument ? document.querySelector('script[type=esms-options]') : undefined;
|
|
175
|
-
|
|
176
|
-
const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : {};
|
|
177
|
-
Object.assign(esmsInitOptions, self.esmsInitOptions || {});
|
|
178
|
-
|
|
179
|
-
const version = "2.5.1";
|
|
180
|
-
|
|
181
|
-
const r = esmsInitOptions.version;
|
|
182
|
-
if (self.importShim || (r && r !== version)) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// shim mode is determined on initialization, no late shim mode
|
|
187
|
-
const shimMode =
|
|
188
|
-
esmsInitOptions.shimMode ||
|
|
189
|
-
(hasDocument &&
|
|
190
|
-
document.querySelectorAll('script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]')
|
|
191
|
-
.length > 0);
|
|
192
|
-
|
|
193
|
-
let importHook,
|
|
194
|
-
resolveHook,
|
|
195
|
-
fetchHook = fetch,
|
|
196
|
-
metaHook,
|
|
197
|
-
tsTransform =
|
|
198
|
-
esmsInitOptions.tsTransform ||
|
|
199
|
-
(hasDocument && document.currentScript && document.currentScript.src.replace(/(\.\w+)?\.js$/, '-typescript.js')) ||
|
|
200
|
-
'./es-module-shims-typescript.js';
|
|
201
|
-
|
|
202
|
-
const defaultFetchOpts = { credentials: 'same-origin' };
|
|
203
|
-
|
|
204
|
-
const {
|
|
205
|
-
revokeBlobURLs,
|
|
206
|
-
noLoadEventRetriggers,
|
|
207
|
-
enforceIntegrity,
|
|
208
|
-
hotReload,
|
|
209
|
-
hotReloadInterval = 100,
|
|
210
|
-
nativePassthrough = !hotReload
|
|
211
|
-
} = esmsInitOptions;
|
|
212
|
-
|
|
213
|
-
const globalHook = name => (typeof name === 'string' ? self[name] : name);
|
|
214
|
-
|
|
215
|
-
if (esmsInitOptions.onimport) importHook = globalHook(esmsInitOptions.onimport);
|
|
216
|
-
if (esmsInitOptions.resolve) resolveHook = globalHook(esmsInitOptions.resolve);
|
|
217
|
-
if (esmsInitOptions.fetch) fetchHook = globalHook(esmsInitOptions.fetch);
|
|
218
|
-
if (esmsInitOptions.meta) metaHook = globalHook(esmsInitOptions.meta);
|
|
219
|
-
|
|
220
|
-
if (hotReload) [importHook, resolveHook, metaHook] = initHotReload();
|
|
221
|
-
|
|
222
|
-
const mapOverrides = esmsInitOptions.mapOverrides;
|
|
223
|
-
|
|
224
|
-
let nonce = esmsInitOptions.nonce;
|
|
225
|
-
if (!nonce && hasDocument) {
|
|
226
|
-
const nonceElement = document.querySelector('script[nonce]');
|
|
227
|
-
if (nonceElement) nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
|
|
228
|
-
}
|
|
4
|
+
let invalidate;
|
|
5
|
+
const hotReload$1 = url => invalidate(new URL(url, baseUrl).href);
|
|
6
|
+
const initHotReload = () => {
|
|
7
|
+
let _importHook = importHook,
|
|
8
|
+
_resolveHook = resolveHook,
|
|
9
|
+
_metaHook = metaHook;
|
|
10
|
+
|
|
11
|
+
let defaultResolve;
|
|
12
|
+
let hotResolveHook = (id, parent, _defaultResolve) => {
|
|
13
|
+
if (!defaultResolve) defaultResolve = _defaultResolve;
|
|
14
|
+
const originalParent = stripVersion(parent);
|
|
15
|
+
const url = stripVersion(defaultResolve(id, originalParent));
|
|
16
|
+
const hotState = getHotState(url);
|
|
17
|
+
const parents = hotState.p;
|
|
18
|
+
if (!parents.includes(originalParent)) parents.push(originalParent);
|
|
19
|
+
return toVersioned(url, hotState);
|
|
20
|
+
};
|
|
21
|
+
const hotImportHook = (url, _, __, source, sourceType) => {
|
|
22
|
+
const hotState = getHotState(url);
|
|
23
|
+
hotState.e = typeof source === 'string' ? source : true;
|
|
24
|
+
hotState.t = sourceType;
|
|
25
|
+
};
|
|
26
|
+
const hotMetaHook = (metaObj, url) => (metaObj.hot = new Hot(url));
|
|
229
27
|
|
|
230
|
-
|
|
28
|
+
const Hot = class Hot {
|
|
29
|
+
constructor(url) {
|
|
30
|
+
this.data = getHotState((this.url = stripVersion(url))).d;
|
|
31
|
+
}
|
|
32
|
+
accept(deps, cb) {
|
|
33
|
+
if (typeof deps === 'function') {
|
|
34
|
+
cb = deps;
|
|
35
|
+
deps = null;
|
|
36
|
+
}
|
|
37
|
+
const hotState = getHotState(this.url);
|
|
38
|
+
if (!hotState.A) return;
|
|
39
|
+
(hotState.a = hotState.a || []).push([
|
|
40
|
+
typeof deps === 'string' ? defaultResolve(deps, this.url)
|
|
41
|
+
: deps ? deps.map(d => defaultResolve(d, this.url))
|
|
42
|
+
: null,
|
|
43
|
+
cb
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
dispose(cb) {
|
|
47
|
+
getHotState(this.url).u = cb;
|
|
48
|
+
}
|
|
49
|
+
invalidate() {
|
|
50
|
+
const hotState = getHotState(this.url);
|
|
51
|
+
hotState.a = hotState.A = null;
|
|
52
|
+
const seen = [this.url];
|
|
53
|
+
hotState.p.forEach(p => invalidate(p, this.url, seen));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
231
56
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
enable.includes('wasm-modules') || enable.includes('wasm-module-sources') || enableAll;
|
|
238
|
-
const deferPhaseEnabled = enable.includes('import-defer') || enableAll;
|
|
57
|
+
const versionedRegEx = /\?v=\d+$/;
|
|
58
|
+
const stripVersion = url => {
|
|
59
|
+
const versionMatch = url.match(versionedRegEx);
|
|
60
|
+
return versionMatch ? url.slice(0, -versionMatch[0].length) : url;
|
|
61
|
+
};
|
|
239
62
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
console.log(`%c^^ Module error above is polyfilled and can be ignored ^^`, 'font-weight:900;color:#391');
|
|
245
|
-
};
|
|
63
|
+
const toVersioned = (url, hotState) => {
|
|
64
|
+
const { v } = hotState;
|
|
65
|
+
return url + (v ? '?v=' + v : '');
|
|
66
|
+
};
|
|
246
67
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
68
|
+
let hotRegistry = {},
|
|
69
|
+
curInvalidationRoots = new Set(),
|
|
70
|
+
curInvalidationInterval;
|
|
71
|
+
const getHotState = url =>
|
|
72
|
+
hotRegistry[url] ||
|
|
73
|
+
(hotRegistry[url] = {
|
|
74
|
+
// version
|
|
75
|
+
v: 0,
|
|
76
|
+
// accept list ([deps, cb] pairs)
|
|
77
|
+
a: null,
|
|
78
|
+
// accepting acceptors
|
|
79
|
+
A: true,
|
|
80
|
+
// unload callback
|
|
81
|
+
u: null,
|
|
82
|
+
// entry point or inline script source
|
|
83
|
+
e: false,
|
|
84
|
+
// hot data
|
|
85
|
+
d: {},
|
|
86
|
+
// parents
|
|
87
|
+
p: [],
|
|
88
|
+
// source type
|
|
89
|
+
t: undefined
|
|
90
|
+
});
|
|
255
91
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
92
|
+
invalidate = (url, fromUrl, seen = []) => {
|
|
93
|
+
const hotState = hotRegistry[url];
|
|
94
|
+
if (!hotState || seen.includes(url)) return false;
|
|
95
|
+
seen.push(url);
|
|
96
|
+
hotState.A = false;
|
|
97
|
+
if (
|
|
98
|
+
fromUrl &&
|
|
99
|
+
hotState.a &&
|
|
100
|
+
hotState.a.some(([d]) => d && (typeof d === 'string' ? d === fromUrl : d.includes(fromUrl)))
|
|
101
|
+
) {
|
|
102
|
+
curInvalidationRoots.add(fromUrl);
|
|
103
|
+
} else {
|
|
104
|
+
if (hotState.e || hotState.a) curInvalidationRoots.add(url);
|
|
105
|
+
hotState.v++;
|
|
106
|
+
if (!hotState.a) hotState.p.forEach(p => invalidate(p, url, seen));
|
|
107
|
+
}
|
|
108
|
+
if (!curInvalidationInterval) curInvalidationInterval = setTimeout(handleInvalidations, hotReloadInterval);
|
|
109
|
+
return true;
|
|
110
|
+
};
|
|
267
111
|
|
|
268
|
-
|
|
112
|
+
const handleInvalidations = () => {
|
|
113
|
+
curInvalidationInterval = null;
|
|
114
|
+
const earlyRoots = new Set();
|
|
115
|
+
for (const root of curInvalidationRoots) {
|
|
116
|
+
const hotState = hotRegistry[root];
|
|
117
|
+
topLevelLoad(
|
|
118
|
+
toVersioned(root, hotState),
|
|
119
|
+
baseUrl,
|
|
120
|
+
defaultFetchOpts,
|
|
121
|
+
typeof hotState.e === 'string' ? hotState.e : undefined,
|
|
122
|
+
false,
|
|
123
|
+
undefined,
|
|
124
|
+
hotState.t
|
|
125
|
+
).then(m => {
|
|
126
|
+
if (hotState.a) {
|
|
127
|
+
hotState.a.forEach(([d, c]) => d === null && !earlyRoots.has(c) && c(m));
|
|
128
|
+
// unload should be the latest unload handler from the just loaded module
|
|
129
|
+
if (hotState.u) {
|
|
130
|
+
hotState.u(hotState.d);
|
|
131
|
+
hotState.u = null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
hotState.p.forEach(p => {
|
|
135
|
+
const hotState = hotRegistry[p];
|
|
136
|
+
if (hotState && hotState.a)
|
|
137
|
+
hotState.a.forEach(
|
|
138
|
+
async ([d, c]) =>
|
|
139
|
+
d &&
|
|
140
|
+
!earlyRoots.has(c) &&
|
|
141
|
+
(typeof d === 'string' ?
|
|
142
|
+
d === root && c(m)
|
|
143
|
+
: c(await Promise.all(d.map(d => (earlyRoots.push(c), importShim(toVersioned(d, getHotState(d))))))))
|
|
144
|
+
);
|
|
145
|
+
});
|
|
146
|
+
}, throwError);
|
|
147
|
+
}
|
|
148
|
+
curInvalidationRoots = new Set();
|
|
149
|
+
};
|
|
269
150
|
|
|
270
|
-
|
|
271
|
-
|
|
151
|
+
return [
|
|
152
|
+
_importHook ? chain(_importHook, hotImportHook) : hotImportHook,
|
|
153
|
+
_resolveHook ?
|
|
154
|
+
(id, parent, defaultResolve) =>
|
|
155
|
+
hotResolveHook(id, parent, (id, parent) => _resolveHook(id, parent, defaultResolve))
|
|
156
|
+
: hotResolveHook,
|
|
157
|
+
_metaHook ? chain(_metaHook, hotMetaHook) : hotMetaHook
|
|
158
|
+
];
|
|
272
159
|
};
|
|
273
160
|
|
|
161
|
+
const hasDocument = typeof document !== 'undefined';
|
|
162
|
+
|
|
163
|
+
const noop = () => {};
|
|
164
|
+
|
|
165
|
+
const dynamicImport = (u, errUrl) => import(u);
|
|
166
|
+
|
|
167
|
+
const defineValue = (obj, prop, value) =>
|
|
168
|
+
Object.defineProperty(obj, prop, { writable: false, configurable: false, value });
|
|
169
|
+
|
|
170
|
+
const optionsScript = hasDocument ? document.querySelector('script[type=esms-options]') : undefined;
|
|
171
|
+
|
|
172
|
+
const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : {};
|
|
173
|
+
Object.assign(esmsInitOptions, self.esmsInitOptions || {});
|
|
174
|
+
|
|
175
|
+
const version = "2.6.1";
|
|
176
|
+
|
|
177
|
+
const r = esmsInitOptions.version;
|
|
178
|
+
if (self.importShim || (r && r !== version)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// shim mode is determined on initialization, no late shim mode
|
|
183
|
+
const shimMode =
|
|
184
|
+
esmsInitOptions.shimMode ||
|
|
185
|
+
(hasDocument &&
|
|
186
|
+
document.querySelectorAll('script[type=module-shim],script[type=importmap-shim],link[rel=modulepreload-shim]')
|
|
187
|
+
.length > 0);
|
|
188
|
+
|
|
189
|
+
let importHook,
|
|
190
|
+
resolveHook,
|
|
191
|
+
fetchHook = fetch,
|
|
192
|
+
sourceHook,
|
|
193
|
+
metaHook,
|
|
194
|
+
tsTransform =
|
|
195
|
+
esmsInitOptions.tsTransform ||
|
|
196
|
+
(hasDocument && document.currentScript && document.currentScript.src.replace(/(\.\w+)?\.js$/, '-typescript.js')) ||
|
|
197
|
+
'./es-module-shims-typescript.js';
|
|
198
|
+
|
|
199
|
+
const defaultFetchOpts = { credentials: 'same-origin' };
|
|
200
|
+
|
|
201
|
+
const globalHook = name => (typeof name === 'string' ? self[name] : name);
|
|
202
|
+
|
|
203
|
+
if (esmsInitOptions.onimport) importHook = globalHook(esmsInitOptions.onimport);
|
|
204
|
+
if (esmsInitOptions.resolve) resolveHook = globalHook(esmsInitOptions.resolve);
|
|
205
|
+
if (esmsInitOptions.fetch) fetchHook = globalHook(esmsInitOptions.fetch);
|
|
206
|
+
if (esmsInitOptions.source) sourceHook = globalHook(esmsInitOptions.source);
|
|
207
|
+
if (esmsInitOptions.meta) metaHook = globalHook(esmsInitOptions.meta);
|
|
208
|
+
|
|
209
|
+
const hasCustomizationHooks = importHook || resolveHook || fetchHook !== fetch || sourceHook || metaHook;
|
|
210
|
+
|
|
211
|
+
const {
|
|
212
|
+
noLoadEventRetriggers,
|
|
213
|
+
enforceIntegrity,
|
|
214
|
+
hotReload,
|
|
215
|
+
hotReloadInterval = 100,
|
|
216
|
+
nativePassthrough = !hasCustomizationHooks && !hotReload
|
|
217
|
+
} = esmsInitOptions;
|
|
218
|
+
|
|
219
|
+
if (hotReload) [importHook, resolveHook, metaHook] = initHotReload();
|
|
220
|
+
|
|
221
|
+
const mapOverrides = esmsInitOptions.mapOverrides;
|
|
222
|
+
|
|
223
|
+
let nonce = esmsInitOptions.nonce;
|
|
224
|
+
if (!nonce && hasDocument) {
|
|
225
|
+
const nonceElement = document.querySelector('script[nonce]');
|
|
226
|
+
if (nonceElement) nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const onerror = globalHook(esmsInitOptions.onerror || console.error.bind(console));
|
|
230
|
+
|
|
231
|
+
const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
|
|
232
|
+
const disable = Array.isArray(esmsInitOptions.polyfillDisable) ? esmsInitOptions.polyfillDisable : [];
|
|
233
|
+
|
|
234
|
+
const enableAll = esmsInitOptions.polyfillEnable === 'all' || enable.includes('all');
|
|
235
|
+
const wasmInstancePhaseEnabled =
|
|
236
|
+
enable.includes('wasm-modules') || enable.includes('wasm-module-instances') || enableAll;
|
|
237
|
+
const wasmSourcePhaseEnabled =
|
|
238
|
+
enable.includes('wasm-modules') || enable.includes('wasm-module-sources') || enableAll;
|
|
239
|
+
const deferPhaseEnabled = enable.includes('import-defer') || enableAll;
|
|
240
|
+
const cssModulesEnabled = !disable.includes('css-modules');
|
|
241
|
+
const jsonModulesEnabled = !disable.includes('json-modules');
|
|
242
|
+
|
|
243
|
+
const onpolyfill =
|
|
244
|
+
esmsInitOptions.onpolyfill ?
|
|
245
|
+
globalHook(esmsInitOptions.onpolyfill)
|
|
246
|
+
: () => {
|
|
247
|
+
console.log(`%c^^ Module error above is polyfilled and can be ignored ^^`, 'font-weight:900;color:#391');
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const baseUrl =
|
|
251
|
+
hasDocument ?
|
|
252
|
+
document.baseURI
|
|
253
|
+
: `${location.protocol}//${location.host}${
|
|
254
|
+
location.pathname.includes('/') ?
|
|
255
|
+
location.pathname.slice(0, location.pathname.lastIndexOf('/') + 1)
|
|
256
|
+
: location.pathname
|
|
257
|
+
}`;
|
|
258
|
+
|
|
259
|
+
const createBlob = (source, type = 'text/javascript') => URL.createObjectURL(new Blob([source], { type }));
|
|
260
|
+
let { skip } = esmsInitOptions;
|
|
261
|
+
if (Array.isArray(skip)) {
|
|
262
|
+
const l = skip.map(s => new URL(s, baseUrl).href);
|
|
263
|
+
skip = s => l.some(i => (i[i.length - 1] === '/' && s.startsWith(i)) || s === i);
|
|
264
|
+
} else if (typeof skip === 'string') {
|
|
265
|
+
const r = new RegExp(skip);
|
|
266
|
+
skip = s => r.test(s);
|
|
267
|
+
} else if (skip instanceof RegExp) {
|
|
268
|
+
skip = s => skip.test(s);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const dispatchError = error => self.dispatchEvent(Object.assign(new Event('error'), { error }));
|
|
272
|
+
|
|
273
|
+
const throwError = err => {
|
|
274
|
+
(self.reportError || dispatchError)(err);
|
|
275
|
+
onerror(err);
|
|
276
|
+
};
|
|
277
|
+
|
|
274
278
|
const fromParent = parent => (parent ? ` imported from ${parent}` : '');
|
|
275
279
|
|
|
276
280
|
const backslashRegEx = /\\/g;
|
|
@@ -530,13 +534,15 @@
|
|
|
530
534
|
|
|
531
535
|
// Feature checking with careful avoidance of unnecessary work - all gated on initial import map supports check. CSS gates on JSON feature check, Wasm instance phase gates on wasm source phase check.
|
|
532
536
|
const importMapTest = `<script nonce=${nonce || ''}>b=(s,type='text/javascript')=>URL.createObjectURL(new Blob([s],{type}));c=u=>import(u).then(()=>true,()=>false);i=innerText=>document.head.appendChild(Object.assign(document.createElement('script'),{type:'importmap',nonce:"${nonce}",innerText}));i(\`{"imports":{"x":"\${b('')}"}}\`);i(\`{"imports":{"y":"\${b('')}"}}\`);cm=${
|
|
533
|
-
supportsImportMaps ? `c(b(\`import"\${b('{}','text/json')}"with{type:"json"}\`))` : 'false'
|
|
537
|
+
supportsImportMaps && jsonModulesEnabled ? `c(b(\`import"\${b('{}','text/json')}"with{type:"json"}\`))` : 'false'
|
|
534
538
|
};sp=${
|
|
535
539
|
supportsImportMaps && wasmSourcePhaseEnabled ?
|
|
536
540
|
`c(b(\`import source x from "\${b(new Uint8Array(${JSON.stringify(wasmBytes)}),'application/wasm')\}"\`))`
|
|
537
541
|
: 'false'
|
|
538
542
|
};Promise.all([${supportsImportMaps ? 'true' : "c('x')"},${supportsImportMaps ? "c('y')" : false},cm,${
|
|
539
|
-
supportsImportMaps
|
|
543
|
+
supportsImportMaps && cssModulesEnabled ?
|
|
544
|
+
`cm.then(s=>s?c(b(\`import"\${b('','text/css')\}"with{type:"css"}\`)):false)`
|
|
545
|
+
: 'false'
|
|
540
546
|
},sp,${
|
|
541
547
|
supportsImportMaps && wasmInstancePhaseEnabled ?
|
|
542
548
|
`${wasmSourcePhaseEnabled ? 'sp.then(s=>s?' : ''}c(b(\`import"\${b(new Uint8Array(${JSON.stringify(wasmBytes)}),'application/wasm')\}"\`))${wasmSourcePhaseEnabled ? ':false)' : ''}`
|
|
@@ -581,862 +587,860 @@
|
|
|
581
587
|
/* es-module-lexer 1.7.0 */
|
|
582
588
|
var ImportType;!function(A){A[A.Static=1]="Static",A[A.Dynamic=2]="Dynamic",A[A.ImportMeta=3]="ImportMeta",A[A.StaticSourcePhase=4]="StaticSourcePhase",A[A.DynamicSourcePhase=5]="DynamicSourcePhase",A[A.StaticDeferPhase=6]="StaticDeferPhase",A[A.DynamicDeferPhase=7]="DynamicDeferPhase";}(ImportType||(ImportType={}));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,w=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;w>0&&C.memory.grow(Math.ceil(w/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 o=[],D=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.it(),g=C.ai(),I=C.id(),w=C.ss(),K=C.se();let D;C.ip()&&(D=k(E.slice(-1===I?A-1:A,-1===I?Q+1:Q))),o.push({n:D,t:B,s:A,e:Q,ss:w,se:K,d:I,a:g});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),w=I[0],K=B<0?void 0:E.slice(B,g),o=K?K[0]:"";D.push({s:A,e:Q,ls:B,le:g,n:'"'===w||"'"===w?k(I):I,ln:'"'===o||"'"===o?k(K):K});}function k(A){try{return (0,eval)(A)}catch(A){}}return [o,D,!!C.f(),!!C.ms()]}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 E=()=>{return A="AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/A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cgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=","undefined"!=typeof Buffer?Buffer.from(A,"base64"):Uint8Array.from(atob(A),(A=>A.charCodeAt(0)));var A;};const init=WebAssembly.compile(E()).then(WebAssembly.instantiate).then((({exports:A})=>{C=A;}));
|
|
583
589
|
|
|
584
|
-
const _resolve = (id, parentUrl = baseUrl) => {
|
|
585
|
-
const urlResolved = resolveIfNotPlainOrUrl(id, parentUrl) || asURL(id);
|
|
586
|
-
const firstResolved = firstImportMap && resolveImportMap(firstImportMap, urlResolved || id, parentUrl);
|
|
587
|
-
const composedResolved =
|
|
588
|
-
composedImportMap === firstImportMap ? firstResolved : (
|
|
589
|
-
resolveImportMap(composedImportMap, urlResolved || id, parentUrl)
|
|
590
|
-
);
|
|
591
|
-
const resolved = composedResolved || firstResolved || throwUnresolved(id, parentUrl);
|
|
592
|
-
// needsShim, shouldShim per load record to set on parent
|
|
593
|
-
let n = false,
|
|
594
|
-
N = false;
|
|
595
|
-
if (!supportsImportMaps) {
|
|
596
|
-
// bare specifier -> needs shim
|
|
597
|
-
if (!urlResolved) n = true;
|
|
598
|
-
// url mapping -> should shim
|
|
599
|
-
else if (urlResolved !== resolved) N = true;
|
|
600
|
-
} else if (!supportsMultipleImportMaps) {
|
|
601
|
-
// bare specifier and not resolved by first import map -> needs shim
|
|
602
|
-
if (!urlResolved && !firstResolved) n = true;
|
|
603
|
-
// resolution doesn't match first import map -> should shim
|
|
604
|
-
if (firstResolved && resolved !== firstResolved) N = true;
|
|
605
|
-
}
|
|
606
|
-
return { r: resolved, n, N };
|
|
607
|
-
};
|
|
608
|
-
|
|
609
|
-
const resolve = (id, parentUrl) => {
|
|
610
|
-
if (!resolveHook) return _resolve(id, parentUrl);
|
|
611
|
-
const result = resolveHook(id, parentUrl, defaultResolve);
|
|
612
|
-
|
|
613
|
-
return result ? { r: result, n: true, N: true } : _resolve(id, parentUrl);
|
|
614
|
-
};
|
|
615
|
-
|
|
616
|
-
// import()
|
|
617
|
-
async function importShim$1(id, opts, parentUrl) {
|
|
618
|
-
if (typeof opts === 'string') {
|
|
619
|
-
parentUrl = opts;
|
|
620
|
-
opts = undefined;
|
|
621
|
-
}
|
|
622
|
-
await initPromise; // needed for shim check
|
|
623
|
-
if (shimMode || !
|
|
624
|
-
if (hasDocument) processScriptsAndPreloads();
|
|
625
|
-
legacyAcceptingImportMaps = false;
|
|
626
|
-
}
|
|
627
|
-
let sourceType = undefined;
|
|
628
|
-
if (typeof opts === 'object') {
|
|
629
|
-
if (opts.lang === 'ts') sourceType = 'ts';
|
|
630
|
-
if (typeof opts.with === 'object' && typeof opts.with.type === 'string') {
|
|
631
|
-
sourceType = opts.with.type;
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
return topLevelLoad(id, parentUrl || baseUrl, defaultFetchOpts, undefined, undefined, undefined, sourceType);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
// import.source()
|
|
638
|
-
// (opts not currently supported as no use cases yet)
|
|
639
|
-
if (shimMode || wasmSourcePhaseEnabled)
|
|
640
|
-
importShim$1.source = async (id, opts, parentUrl) => {
|
|
641
|
-
if (typeof opts === 'string') {
|
|
642
|
-
parentUrl = opts;
|
|
643
|
-
opts = undefined;
|
|
644
|
-
}
|
|
645
|
-
await initPromise; // needed for shim check
|
|
646
|
-
if (shimMode || !
|
|
647
|
-
if (hasDocument) processScriptsAndPreloads();
|
|
648
|
-
legacyAcceptingImportMaps = false;
|
|
649
|
-
}
|
|
650
|
-
await importMapPromise;
|
|
651
|
-
const url = resolve(id, parentUrl || baseUrl).r;
|
|
652
|
-
const load = getOrCreateLoad(url, defaultFetchOpts, undefined, undefined);
|
|
653
|
-
if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
|
|
654
|
-
onpolyfill();
|
|
655
|
-
firstPolyfillLoad = false;
|
|
656
|
-
}
|
|
657
|
-
await load.f;
|
|
658
|
-
return importShim$1._s[load.r];
|
|
659
|
-
};
|
|
660
|
-
|
|
661
|
-
// import.defer() is just a proxy for import(), since we can't actually defer
|
|
662
|
-
if (shimMode || deferPhaseEnabled) importShim$1.defer = importShim$1;
|
|
663
|
-
|
|
664
|
-
if (hotReload) importShim$1.hotReload = hotReload$1;
|
|
665
|
-
|
|
666
|
-
const defaultResolve = (id, parentUrl) => {
|
|
667
|
-
return (
|
|
668
|
-
resolveImportMap(composedImportMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) ||
|
|
669
|
-
throwUnresolved(id, parentUrl)
|
|
670
|
-
);
|
|
671
|
-
};
|
|
672
|
-
|
|
673
|
-
const throwUnresolved = (id, parentUrl) => {
|
|
674
|
-
throw Error(`Unable to resolve specifier '${id}'${fromParent(parentUrl)}`);
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
const metaResolve = function (id, parentUrl = this.url) {
|
|
678
|
-
return resolve(id, `${parentUrl}`).r;
|
|
679
|
-
};
|
|
680
|
-
|
|
681
|
-
importShim$1.resolve = (id, parentUrl) => resolve(id, parentUrl).r;
|
|
682
|
-
importShim$1.getImportMap = () => JSON.parse(JSON.stringify(composedImportMap));
|
|
683
|
-
importShim$1.addImportMap = importMapIn => {
|
|
684
|
-
if (!shimMode) throw new Error('Unsupported in polyfill mode.');
|
|
685
|
-
composedImportMap = resolveAndComposeImportMap(importMapIn, baseUrl, composedImportMap);
|
|
686
|
-
};
|
|
687
|
-
importShim$1.version = version;
|
|
688
|
-
|
|
689
|
-
const registry = (importShim$1._r = {});
|
|
690
|
-
// Wasm caches
|
|
691
|
-
const sourceCache = (importShim$1._s = {});
|
|
692
|
-
(importShim$1._i = new WeakMap());
|
|
693
|
-
|
|
694
|
-
// Ensure this version is the only version
|
|
695
|
-
defineValue(self, 'importShim', Object.freeze(importShim$1));
|
|
696
|
-
const shimModeOptions = { ...esmsInitOptions, shimMode: true };
|
|
697
|
-
if (optionsScript) optionsScript.innerHTML = JSON.stringify(shimModeOptions);
|
|
698
|
-
self.esmsInitOptions = shimModeOptions;
|
|
699
|
-
|
|
700
|
-
const loadAll = async (load, seen) => {
|
|
701
|
-
seen[load.u] = 1;
|
|
702
|
-
await load.L;
|
|
703
|
-
await Promise.all(
|
|
704
|
-
load.d.map(({ l: dep, s: sourcePhase }) => {
|
|
705
|
-
if (dep.b || seen[dep.u]) return;
|
|
706
|
-
if (sourcePhase) return dep.f;
|
|
707
|
-
return loadAll(dep, seen);
|
|
708
|
-
})
|
|
709
|
-
);
|
|
710
|
-
};
|
|
711
|
-
|
|
712
|
-
let importMapSrc = false;
|
|
713
|
-
let multipleImportMaps = false;
|
|
714
|
-
let firstImportMap = null;
|
|
715
|
-
// To support polyfilling multiple import maps, we separately track the composed import map from the first import map
|
|
716
|
-
let composedImportMap = { imports: {}, scopes: {}, integrity: {} };
|
|
717
|
-
let
|
|
718
|
-
|
|
719
|
-
const initPromise = featureDetectionPromise.then(() => {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
(!
|
|
726
|
-
|
|
727
|
-
!
|
|
728
|
-
|
|
729
|
-
!
|
|
730
|
-
if (!shimMode && typeof WebAssembly !== 'undefined') {
|
|
731
|
-
if (wasmSourcePhaseEnabled && !Object.getPrototypeOf(WebAssembly.Module).name) {
|
|
732
|
-
const s = Symbol();
|
|
733
|
-
const brand = m => defineValue(m, s, 'WebAssembly.Module');
|
|
734
|
-
class AbstractModuleSource {
|
|
735
|
-
get [Symbol.toStringTag]() {
|
|
736
|
-
if (this[s]) return this[s];
|
|
737
|
-
throw new TypeError('Not an AbstractModuleSource');
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
const { Module: wasmModule, compile: wasmCompile, compileStreaming: wasmCompileStreaming } = WebAssembly;
|
|
741
|
-
WebAssembly.Module = Object.setPrototypeOf(
|
|
742
|
-
Object.assign(function Module(...args) {
|
|
743
|
-
return brand(new wasmModule(...args));
|
|
744
|
-
}, wasmModule),
|
|
745
|
-
AbstractModuleSource
|
|
746
|
-
);
|
|
747
|
-
WebAssembly.Module.prototype = Object.setPrototypeOf(wasmModule.prototype, AbstractModuleSource.prototype);
|
|
748
|
-
WebAssembly.compile = function compile(...args) {
|
|
749
|
-
return wasmCompile(...args).then(brand);
|
|
750
|
-
};
|
|
751
|
-
WebAssembly.compileStreaming = function compileStreaming(...args) {
|
|
752
|
-
return wasmCompileStreaming(...args).then(brand);
|
|
753
|
-
};
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
if (hasDocument) {
|
|
757
|
-
if (!supportsImportMaps) {
|
|
758
|
-
const supports = HTMLScriptElement.supports || (type => type === 'classic' || type === 'module');
|
|
759
|
-
HTMLScriptElement.supports = type => type === 'importmap' || supports(type);
|
|
760
|
-
}
|
|
761
|
-
if (shimMode || !
|
|
762
|
-
attachMutationObserver();
|
|
763
|
-
if (document.readyState === 'complete') {
|
|
764
|
-
readyStateCompleteCheck();
|
|
765
|
-
} else {
|
|
766
|
-
document.addEventListener('readystatechange', readyListener);
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
processScriptsAndPreloads();
|
|
770
|
-
}
|
|
771
|
-
return init;
|
|
772
|
-
});
|
|
773
|
-
|
|
774
|
-
const attachMutationObserver = () => {
|
|
775
|
-
const observer = new MutationObserver(mutations => {
|
|
776
|
-
for (const mutation of mutations) {
|
|
777
|
-
if (mutation.type !== 'childList') continue;
|
|
778
|
-
for (const node of mutation.addedNodes) {
|
|
779
|
-
if (node.tagName === 'SCRIPT') {
|
|
780
|
-
if (node.type === (shimMode ? 'module-shim' : 'module') && !node.ep) processScript(node, true);
|
|
781
|
-
if (node.type === (shimMode ? 'importmap-shim' : 'importmap') && !node.ep) processImportMap(node, true);
|
|
782
|
-
} else if (
|
|
783
|
-
node.tagName === 'LINK' &&
|
|
784
|
-
node.rel === (shimMode ? 'modulepreload-shim' : 'modulepreload') &&
|
|
785
|
-
!node.ep
|
|
786
|
-
) {
|
|
787
|
-
processPreload(node);
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
});
|
|
792
|
-
observer.observe(document, { childList: true });
|
|
793
|
-
observer.observe(document.head, { childList: true });
|
|
794
|
-
processScriptsAndPreloads();
|
|
795
|
-
};
|
|
796
|
-
|
|
797
|
-
let importMapPromise = initPromise;
|
|
798
|
-
let firstPolyfillLoad = true;
|
|
799
|
-
let legacyAcceptingImportMaps = true;
|
|
800
|
-
|
|
801
|
-
const topLevelLoad = async (
|
|
802
|
-
url,
|
|
803
|
-
parentUrl,
|
|
804
|
-
fetchOpts,
|
|
805
|
-
source,
|
|
806
|
-
nativelyLoaded,
|
|
807
|
-
lastStaticLoadPromise,
|
|
808
|
-
sourceType
|
|
809
|
-
) => {
|
|
810
|
-
await initPromise;
|
|
811
|
-
await importMapPromise;
|
|
812
|
-
url = (await resolve(url, parentUrl)).r;
|
|
813
|
-
|
|
814
|
-
// we mock import('./x.css', { with: { type: 'css' }}) support via an inline static reexport
|
|
815
|
-
// because we can't syntactically pass through to dynamic import with a second argument
|
|
816
|
-
if (sourceType === 'css' || sourceType === 'json') {
|
|
817
|
-
// Direct reexport for hot reloading skipped due to Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=1965620
|
|
818
|
-
source = `import m from'${url}'with{type:"${sourceType}"};export default m;`;
|
|
819
|
-
url += '?entry';
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
if (importHook) await importHook(url, typeof fetchOpts !== 'string' ? fetchOpts : {}, parentUrl, source, sourceType);
|
|
823
|
-
// early analysis opt-out - no need to even fetch if we have feature support
|
|
824
|
-
if (!shimMode &&
|
|
825
|
-
// for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
|
|
826
|
-
if (nativelyLoaded) return null;
|
|
827
|
-
await lastStaticLoadPromise;
|
|
828
|
-
return dynamicImport(source ? createBlob(source) : url);
|
|
829
|
-
}
|
|
830
|
-
const load = getOrCreateLoad(url, fetchOpts, undefined, source);
|
|
831
|
-
linkLoad(load, fetchOpts);
|
|
832
|
-
const seen = {};
|
|
833
|
-
await loadAll(load, seen);
|
|
834
|
-
resolveDeps(load, seen);
|
|
835
|
-
await lastStaticLoadPromise;
|
|
836
|
-
if (!shimMode && !load.n) {
|
|
837
|
-
if (nativelyLoaded) {
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
840
|
-
if (source) {
|
|
841
|
-
return await dynamicImport(createBlob(source));
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
|
|
845
|
-
onpolyfill();
|
|
846
|
-
firstPolyfillLoad = false;
|
|
847
|
-
}
|
|
848
|
-
const module = await (shimMode || load.n || load.N || !nativePassthrough || (!nativelyLoaded && source) ?
|
|
849
|
-
dynamicImport(load.b, load.u)
|
|
850
|
-
: import(load.u));
|
|
851
|
-
// if the top-level load is a shell, run its update function
|
|
852
|
-
if (load.s) (await dynamicImport(load.s, load.u)).u$_(module);
|
|
853
|
-
|
|
854
|
-
return module;
|
|
855
|
-
};
|
|
856
|
-
|
|
857
|
-
const revokeObjectURLs = registryKeys => {
|
|
858
|
-
let curIdx = 0;
|
|
859
|
-
const handler = self.requestIdleCallback || self.requestAnimationFrame;
|
|
860
|
-
handler(cleanup);
|
|
861
|
-
function cleanup() {
|
|
862
|
-
for (const key of registryKeys.slice(curIdx, (curIdx += 100))) {
|
|
863
|
-
const load = registry[key];
|
|
864
|
-
if (load && load.b && load.b !== load.u) URL.revokeObjectURL(load.b);
|
|
865
|
-
}
|
|
866
|
-
if (curIdx < registryKeys.length) handler(cleanup);
|
|
867
|
-
}
|
|
868
|
-
};
|
|
869
|
-
|
|
870
|
-
const urlJsString = url => `'${url.replace(/'/g, "\\'")}'`;
|
|
871
|
-
|
|
872
|
-
let resolvedSource, lastIndex;
|
|
873
|
-
const pushStringTo = (load, originalIndex, dynamicImportEndStack) => {
|
|
874
|
-
while (dynamicImportEndStack[dynamicImportEndStack.length - 1] < originalIndex) {
|
|
875
|
-
const dynamicImportEnd = dynamicImportEndStack.pop();
|
|
876
|
-
resolvedSource += `${load.S.slice(lastIndex, dynamicImportEnd)}, ${urlJsString(load.r)}`;
|
|
877
|
-
lastIndex = dynamicImportEnd;
|
|
878
|
-
}
|
|
879
|
-
resolvedSource += load.S.slice(lastIndex, originalIndex);
|
|
880
|
-
lastIndex = originalIndex;
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
const pushSourceURL = (load, commentPrefix, commentStart, dynamicImportEndStack) => {
|
|
884
|
-
const urlStart = commentStart + commentPrefix.length;
|
|
885
|
-
const commentEnd = load.S.indexOf('\n', urlStart);
|
|
886
|
-
const urlEnd = commentEnd !== -1 ? commentEnd : load.S.length;
|
|
887
|
-
let sourceUrl = load.S.slice(urlStart, urlEnd);
|
|
888
|
-
try {
|
|
889
|
-
sourceUrl = new URL(sourceUrl, load.r).href;
|
|
890
|
-
} catch {}
|
|
891
|
-
pushStringTo(load, urlStart, dynamicImportEndStack);
|
|
892
|
-
resolvedSource += sourceUrl;
|
|
893
|
-
lastIndex = urlEnd;
|
|
894
|
-
};
|
|
895
|
-
|
|
896
|
-
const resolveDeps = (load, seen) => {
|
|
897
|
-
if (load.b || !seen[load.u]) return;
|
|
898
|
-
seen[load.u] = 0;
|
|
899
|
-
|
|
900
|
-
for (const { l: dep, s: sourcePhase } of load.d) {
|
|
901
|
-
if (!sourcePhase) resolveDeps(dep, seen);
|
|
902
|
-
}
|
|
903
|
-
|
|
904
|
-
if (!load.n) load.n = load.d.some(dep => dep.l.n);
|
|
905
|
-
if (!load.N) load.N = load.d.some(dep => dep.l.N);
|
|
906
|
-
|
|
907
|
-
// use native loader whenever possible (n = needs shim) via executable subgraph passthrough
|
|
908
|
-
// so long as the module doesn't use dynamic import or unsupported URL mappings (N = should shim)
|
|
909
|
-
if (nativePassthrough && !shimMode && !load.n && !load.N) {
|
|
910
|
-
load.b = load.u;
|
|
911
|
-
load.S = undefined;
|
|
912
|
-
return;
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
const [imports, exports] = load.a;
|
|
916
|
-
|
|
917
|
-
// "execution"
|
|
918
|
-
let source = load.S,
|
|
919
|
-
depIndex = 0,
|
|
920
|
-
dynamicImportEndStack = [];
|
|
921
|
-
|
|
922
|
-
// once all deps have loaded we can inline the dependency resolution blobs
|
|
923
|
-
// and define this blob
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
.
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
depLoad.
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
.
|
|
1004
|
-
.
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
let
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
if (
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
load.
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
if (
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
};
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
};
|
|
1147
|
-
|
|
1148
|
-
const
|
|
1149
|
-
if (
|
|
1150
|
-
|
|
1151
|
-
(
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
);
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
//
|
|
1168
|
-
|
|
1169
|
-
//
|
|
1170
|
-
|
|
1171
|
-
//
|
|
1172
|
-
|
|
1173
|
-
//
|
|
1174
|
-
|
|
1175
|
-
//
|
|
1176
|
-
|
|
1177
|
-
//
|
|
1178
|
-
|
|
1179
|
-
//
|
|
1180
|
-
|
|
1181
|
-
//
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
if (!
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
if (
|
|
1244
|
-
|
|
1245
|
-
if (
|
|
1246
|
-
if (
|
|
1247
|
-
if (
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
if (script.type === '
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
if (script.
|
|
1278
|
-
if (script.
|
|
1279
|
-
if (script.
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
let
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
script.
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
if (
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
// does this load block
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
if (
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
script
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
script
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
};
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
fetchCache[link.href] = fetchModule(link.href, getFetchOpts(link));
|
|
1439
|
-
});
|
|
590
|
+
const _resolve = (id, parentUrl = baseUrl) => {
|
|
591
|
+
const urlResolved = resolveIfNotPlainOrUrl(id, parentUrl) || asURL(id);
|
|
592
|
+
const firstResolved = firstImportMap && resolveImportMap(firstImportMap, urlResolved || id, parentUrl);
|
|
593
|
+
const composedResolved =
|
|
594
|
+
composedImportMap === firstImportMap ? firstResolved : (
|
|
595
|
+
resolveImportMap(composedImportMap, urlResolved || id, parentUrl)
|
|
596
|
+
);
|
|
597
|
+
const resolved = composedResolved || firstResolved || throwUnresolved(id, parentUrl);
|
|
598
|
+
// needsShim, shouldShim per load record to set on parent
|
|
599
|
+
let n = false,
|
|
600
|
+
N = false;
|
|
601
|
+
if (!supportsImportMaps) {
|
|
602
|
+
// bare specifier -> needs shim
|
|
603
|
+
if (!urlResolved) n = true;
|
|
604
|
+
// url mapping -> should shim
|
|
605
|
+
else if (urlResolved !== resolved) N = true;
|
|
606
|
+
} else if (!supportsMultipleImportMaps) {
|
|
607
|
+
// bare specifier and not resolved by first import map -> needs shim
|
|
608
|
+
if (!urlResolved && !firstResolved) n = true;
|
|
609
|
+
// resolution doesn't match first import map -> should shim
|
|
610
|
+
if (firstResolved && resolved !== firstResolved) N = true;
|
|
611
|
+
}
|
|
612
|
+
return { r: resolved, n, N };
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
const resolve = (id, parentUrl) => {
|
|
616
|
+
if (!resolveHook) return _resolve(id, parentUrl);
|
|
617
|
+
const result = resolveHook(id, parentUrl, defaultResolve);
|
|
618
|
+
|
|
619
|
+
return result ? { r: result, n: true, N: true } : _resolve(id, parentUrl);
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
// import()
|
|
623
|
+
async function importShim$1(id, opts, parentUrl) {
|
|
624
|
+
if (typeof opts === 'string') {
|
|
625
|
+
parentUrl = opts;
|
|
626
|
+
opts = undefined;
|
|
627
|
+
}
|
|
628
|
+
await initPromise; // needed for shim check
|
|
629
|
+
if (shimMode || !baselineSupport) {
|
|
630
|
+
if (hasDocument) processScriptsAndPreloads();
|
|
631
|
+
legacyAcceptingImportMaps = false;
|
|
632
|
+
}
|
|
633
|
+
let sourceType = undefined;
|
|
634
|
+
if (typeof opts === 'object') {
|
|
635
|
+
if (opts.lang === 'ts') sourceType = 'ts';
|
|
636
|
+
if (typeof opts.with === 'object' && typeof opts.with.type === 'string') {
|
|
637
|
+
sourceType = opts.with.type;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return topLevelLoad(id, parentUrl || baseUrl, defaultFetchOpts, undefined, undefined, undefined, sourceType);
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// import.source()
|
|
644
|
+
// (opts not currently supported as no use cases yet)
|
|
645
|
+
if (shimMode || wasmSourcePhaseEnabled)
|
|
646
|
+
importShim$1.source = async (id, opts, parentUrl) => {
|
|
647
|
+
if (typeof opts === 'string') {
|
|
648
|
+
parentUrl = opts;
|
|
649
|
+
opts = undefined;
|
|
650
|
+
}
|
|
651
|
+
await initPromise; // needed for shim check
|
|
652
|
+
if (shimMode || !baselineSupport) {
|
|
653
|
+
if (hasDocument) processScriptsAndPreloads();
|
|
654
|
+
legacyAcceptingImportMaps = false;
|
|
655
|
+
}
|
|
656
|
+
await importMapPromise;
|
|
657
|
+
const url = resolve(id, parentUrl || baseUrl).r;
|
|
658
|
+
const load = getOrCreateLoad(url, defaultFetchOpts, undefined, undefined);
|
|
659
|
+
if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
|
|
660
|
+
onpolyfill();
|
|
661
|
+
firstPolyfillLoad = false;
|
|
662
|
+
}
|
|
663
|
+
await load.f;
|
|
664
|
+
return importShim$1._s[load.r];
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
// import.defer() is just a proxy for import(), since we can't actually defer
|
|
668
|
+
if (shimMode || deferPhaseEnabled) importShim$1.defer = importShim$1;
|
|
669
|
+
|
|
670
|
+
if (hotReload) importShim$1.hotReload = hotReload$1;
|
|
671
|
+
|
|
672
|
+
const defaultResolve = (id, parentUrl) => {
|
|
673
|
+
return (
|
|
674
|
+
resolveImportMap(composedImportMap, resolveIfNotPlainOrUrl(id, parentUrl) || id, parentUrl) ||
|
|
675
|
+
throwUnresolved(id, parentUrl)
|
|
676
|
+
);
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
const throwUnresolved = (id, parentUrl) => {
|
|
680
|
+
throw Error(`Unable to resolve specifier '${id}'${fromParent(parentUrl)}`);
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
const metaResolve = function (id, parentUrl = this.url) {
|
|
684
|
+
return resolve(id, `${parentUrl}`).r;
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
importShim$1.resolve = (id, parentUrl) => resolve(id, parentUrl).r;
|
|
688
|
+
importShim$1.getImportMap = () => JSON.parse(JSON.stringify(composedImportMap));
|
|
689
|
+
importShim$1.addImportMap = importMapIn => {
|
|
690
|
+
if (!shimMode) throw new Error('Unsupported in polyfill mode.');
|
|
691
|
+
composedImportMap = resolveAndComposeImportMap(importMapIn, baseUrl, composedImportMap);
|
|
692
|
+
};
|
|
693
|
+
importShim$1.version = version;
|
|
694
|
+
|
|
695
|
+
const registry = (importShim$1._r = {});
|
|
696
|
+
// Wasm caches
|
|
697
|
+
const sourceCache = (importShim$1._s = {});
|
|
698
|
+
(importShim$1._i = new WeakMap());
|
|
699
|
+
|
|
700
|
+
// Ensure this version is the only version
|
|
701
|
+
defineValue(self, 'importShim', Object.freeze(importShim$1));
|
|
702
|
+
const shimModeOptions = { ...esmsInitOptions, shimMode: true };
|
|
703
|
+
if (optionsScript) optionsScript.innerHTML = JSON.stringify(shimModeOptions);
|
|
704
|
+
self.esmsInitOptions = shimModeOptions;
|
|
705
|
+
|
|
706
|
+
const loadAll = async (load, seen) => {
|
|
707
|
+
seen[load.u] = 1;
|
|
708
|
+
await load.L;
|
|
709
|
+
await Promise.all(
|
|
710
|
+
load.d.map(({ l: dep, s: sourcePhase }) => {
|
|
711
|
+
if (dep.b || seen[dep.u]) return;
|
|
712
|
+
if (sourcePhase) return dep.f;
|
|
713
|
+
return loadAll(dep, seen);
|
|
714
|
+
})
|
|
715
|
+
);
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
let importMapSrc = false;
|
|
719
|
+
let multipleImportMaps = false;
|
|
720
|
+
let firstImportMap = null;
|
|
721
|
+
// To support polyfilling multiple import maps, we separately track the composed import map from the first import map
|
|
722
|
+
let composedImportMap = { imports: {}, scopes: {}, integrity: {} };
|
|
723
|
+
let baselineSupport;
|
|
724
|
+
|
|
725
|
+
const initPromise = featureDetectionPromise.then(() => {
|
|
726
|
+
baselineSupport =
|
|
727
|
+
supportsImportMaps &&
|
|
728
|
+
(!jsonModulesEnabled || supportsJsonType) &&
|
|
729
|
+
(!cssModulesEnabled || supportsCssType) &&
|
|
730
|
+
(!wasmInstancePhaseEnabled || supportsWasmInstancePhase) &&
|
|
731
|
+
(!wasmSourcePhaseEnabled || supportsWasmSourcePhase) &&
|
|
732
|
+
!deferPhaseEnabled &&
|
|
733
|
+
(!multipleImportMaps || supportsMultipleImportMaps) &&
|
|
734
|
+
!importMapSrc &&
|
|
735
|
+
!hasCustomizationHooks;
|
|
736
|
+
if (!shimMode && typeof WebAssembly !== 'undefined') {
|
|
737
|
+
if (wasmSourcePhaseEnabled && !Object.getPrototypeOf(WebAssembly.Module).name) {
|
|
738
|
+
const s = Symbol();
|
|
739
|
+
const brand = m => defineValue(m, s, 'WebAssembly.Module');
|
|
740
|
+
class AbstractModuleSource {
|
|
741
|
+
get [Symbol.toStringTag]() {
|
|
742
|
+
if (this[s]) return this[s];
|
|
743
|
+
throw new TypeError('Not an AbstractModuleSource');
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
const { Module: wasmModule, compile: wasmCompile, compileStreaming: wasmCompileStreaming } = WebAssembly;
|
|
747
|
+
WebAssembly.Module = Object.setPrototypeOf(
|
|
748
|
+
Object.assign(function Module(...args) {
|
|
749
|
+
return brand(new wasmModule(...args));
|
|
750
|
+
}, wasmModule),
|
|
751
|
+
AbstractModuleSource
|
|
752
|
+
);
|
|
753
|
+
WebAssembly.Module.prototype = Object.setPrototypeOf(wasmModule.prototype, AbstractModuleSource.prototype);
|
|
754
|
+
WebAssembly.compile = function compile(...args) {
|
|
755
|
+
return wasmCompile(...args).then(brand);
|
|
756
|
+
};
|
|
757
|
+
WebAssembly.compileStreaming = function compileStreaming(...args) {
|
|
758
|
+
return wasmCompileStreaming(...args).then(brand);
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
if (hasDocument) {
|
|
763
|
+
if (!supportsImportMaps) {
|
|
764
|
+
const supports = HTMLScriptElement.supports || (type => type === 'classic' || type === 'module');
|
|
765
|
+
HTMLScriptElement.supports = type => type === 'importmap' || supports(type);
|
|
766
|
+
}
|
|
767
|
+
if (shimMode || !baselineSupport) {
|
|
768
|
+
attachMutationObserver();
|
|
769
|
+
if (document.readyState === 'complete') {
|
|
770
|
+
readyStateCompleteCheck();
|
|
771
|
+
} else {
|
|
772
|
+
document.addEventListener('readystatechange', readyListener);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
processScriptsAndPreloads();
|
|
776
|
+
}
|
|
777
|
+
return init;
|
|
778
|
+
});
|
|
779
|
+
|
|
780
|
+
const attachMutationObserver = () => {
|
|
781
|
+
const observer = new MutationObserver(mutations => {
|
|
782
|
+
for (const mutation of mutations) {
|
|
783
|
+
if (mutation.type !== 'childList') continue;
|
|
784
|
+
for (const node of mutation.addedNodes) {
|
|
785
|
+
if (node.tagName === 'SCRIPT') {
|
|
786
|
+
if (node.type === (shimMode ? 'module-shim' : 'module') && !node.ep) processScript(node, true);
|
|
787
|
+
if (node.type === (shimMode ? 'importmap-shim' : 'importmap') && !node.ep) processImportMap(node, true);
|
|
788
|
+
} else if (
|
|
789
|
+
node.tagName === 'LINK' &&
|
|
790
|
+
node.rel === (shimMode ? 'modulepreload-shim' : 'modulepreload') &&
|
|
791
|
+
!node.ep
|
|
792
|
+
) {
|
|
793
|
+
processPreload(node);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
observer.observe(document, { childList: true });
|
|
799
|
+
observer.observe(document.head, { childList: true });
|
|
800
|
+
processScriptsAndPreloads();
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
let importMapPromise = initPromise;
|
|
804
|
+
let firstPolyfillLoad = true;
|
|
805
|
+
let legacyAcceptingImportMaps = true;
|
|
806
|
+
|
|
807
|
+
const topLevelLoad = async (
|
|
808
|
+
url,
|
|
809
|
+
parentUrl,
|
|
810
|
+
fetchOpts,
|
|
811
|
+
source,
|
|
812
|
+
nativelyLoaded,
|
|
813
|
+
lastStaticLoadPromise,
|
|
814
|
+
sourceType
|
|
815
|
+
) => {
|
|
816
|
+
await initPromise;
|
|
817
|
+
await importMapPromise;
|
|
818
|
+
url = (await resolve(url, parentUrl)).r;
|
|
819
|
+
|
|
820
|
+
// we mock import('./x.css', { with: { type: 'css' }}) support via an inline static reexport
|
|
821
|
+
// because we can't syntactically pass through to dynamic import with a second argument
|
|
822
|
+
if (sourceType === 'css' || sourceType === 'json') {
|
|
823
|
+
// Direct reexport for hot reloading skipped due to Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=1965620
|
|
824
|
+
source = `import m from'${url}'with{type:"${sourceType}"};export default m;`;
|
|
825
|
+
url += '?entry';
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
if (importHook) await importHook(url, typeof fetchOpts !== 'string' ? fetchOpts : {}, parentUrl, source, sourceType);
|
|
829
|
+
// early analysis opt-out - no need to even fetch if we have feature support
|
|
830
|
+
if (!shimMode && baselineSupport && nativePassthrough && sourceType !== 'ts') {
|
|
831
|
+
// for polyfill case, only dynamic import needs a return value here, and dynamic import will never pass nativelyLoaded
|
|
832
|
+
if (nativelyLoaded) return null;
|
|
833
|
+
await lastStaticLoadPromise;
|
|
834
|
+
return dynamicImport(source ? createBlob(source) : url);
|
|
835
|
+
}
|
|
836
|
+
const load = getOrCreateLoad(url, fetchOpts, undefined, source);
|
|
837
|
+
linkLoad(load, fetchOpts);
|
|
838
|
+
const seen = {};
|
|
839
|
+
await loadAll(load, seen);
|
|
840
|
+
resolveDeps(load, seen);
|
|
841
|
+
await lastStaticLoadPromise;
|
|
842
|
+
if (!shimMode && !load.n) {
|
|
843
|
+
if (nativelyLoaded) {
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
if (source) {
|
|
847
|
+
return await dynamicImport(createBlob(source));
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (firstPolyfillLoad && !shimMode && load.n && nativelyLoaded) {
|
|
851
|
+
onpolyfill();
|
|
852
|
+
firstPolyfillLoad = false;
|
|
853
|
+
}
|
|
854
|
+
const module = await (shimMode || load.n || load.N || !nativePassthrough || (!nativelyLoaded && source) ?
|
|
855
|
+
dynamicImport(load.b, load.u)
|
|
856
|
+
: import(load.u));
|
|
857
|
+
// if the top-level load is a shell, run its update function
|
|
858
|
+
if (load.s) (await dynamicImport(load.s, load.u)).u$_(module);
|
|
859
|
+
revokeObjectURLs(Object.keys(seen));
|
|
860
|
+
return module;
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
const revokeObjectURLs = registryKeys => {
|
|
864
|
+
let curIdx = 0;
|
|
865
|
+
const handler = self.requestIdleCallback || self.requestAnimationFrame || (fn => setTimeout(fn, 0));
|
|
866
|
+
handler(cleanup);
|
|
867
|
+
function cleanup() {
|
|
868
|
+
for (const key of registryKeys.slice(curIdx, (curIdx += 100))) {
|
|
869
|
+
const load = registry[key];
|
|
870
|
+
if (load && load.b && load.b !== load.u) URL.revokeObjectURL(load.b);
|
|
871
|
+
}
|
|
872
|
+
if (curIdx < registryKeys.length) handler(cleanup);
|
|
873
|
+
}
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
const urlJsString = url => `'${url.replace(/'/g, "\\'")}'`;
|
|
877
|
+
|
|
878
|
+
let resolvedSource, lastIndex;
|
|
879
|
+
const pushStringTo = (load, originalIndex, dynamicImportEndStack) => {
|
|
880
|
+
while (dynamicImportEndStack[dynamicImportEndStack.length - 1] < originalIndex) {
|
|
881
|
+
const dynamicImportEnd = dynamicImportEndStack.pop();
|
|
882
|
+
resolvedSource += `${load.S.slice(lastIndex, dynamicImportEnd)}, ${urlJsString(load.r)}`;
|
|
883
|
+
lastIndex = dynamicImportEnd;
|
|
884
|
+
}
|
|
885
|
+
resolvedSource += load.S.slice(lastIndex, originalIndex);
|
|
886
|
+
lastIndex = originalIndex;
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
const pushSourceURL = (load, commentPrefix, commentStart, dynamicImportEndStack) => {
|
|
890
|
+
const urlStart = commentStart + commentPrefix.length;
|
|
891
|
+
const commentEnd = load.S.indexOf('\n', urlStart);
|
|
892
|
+
const urlEnd = commentEnd !== -1 ? commentEnd : load.S.length;
|
|
893
|
+
let sourceUrl = load.S.slice(urlStart, urlEnd);
|
|
894
|
+
try {
|
|
895
|
+
sourceUrl = new URL(sourceUrl, load.r).href;
|
|
896
|
+
} catch {}
|
|
897
|
+
pushStringTo(load, urlStart, dynamicImportEndStack);
|
|
898
|
+
resolvedSource += sourceUrl;
|
|
899
|
+
lastIndex = urlEnd;
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
const resolveDeps = (load, seen) => {
|
|
903
|
+
if (load.b || !seen[load.u]) return;
|
|
904
|
+
seen[load.u] = 0;
|
|
905
|
+
|
|
906
|
+
for (const { l: dep, s: sourcePhase } of load.d) {
|
|
907
|
+
if (!sourcePhase) resolveDeps(dep, seen);
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
if (!load.n) load.n = load.d.some(dep => dep.l.n);
|
|
911
|
+
if (!load.N) load.N = load.d.some(dep => dep.l.N);
|
|
912
|
+
|
|
913
|
+
// use native loader whenever possible (n = needs shim) via executable subgraph passthrough
|
|
914
|
+
// so long as the module doesn't use dynamic import or unsupported URL mappings (N = should shim)
|
|
915
|
+
if (nativePassthrough && !shimMode && !load.n && !load.N) {
|
|
916
|
+
load.b = load.u;
|
|
917
|
+
load.S = undefined;
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
const [imports, exports] = load.a;
|
|
922
|
+
|
|
923
|
+
// "execution"
|
|
924
|
+
let source = load.S,
|
|
925
|
+
depIndex = 0,
|
|
926
|
+
dynamicImportEndStack = [];
|
|
927
|
+
|
|
928
|
+
// once all deps have loaded we can inline the dependency resolution blobs
|
|
929
|
+
// and define this blob
|
|
930
|
+
resolvedSource = '';
|
|
931
|
+
lastIndex = 0;
|
|
932
|
+
|
|
933
|
+
for (const { s: start, e: end, ss: statementStart, se: statementEnd, d: dynamicImportIndex, t, a } of imports) {
|
|
934
|
+
// source phase
|
|
935
|
+
if (t === 4) {
|
|
936
|
+
let { l: depLoad } = load.d[depIndex++];
|
|
937
|
+
pushStringTo(load, statementStart, dynamicImportEndStack);
|
|
938
|
+
resolvedSource += `${source.slice(statementStart, start - 1).replace('source', '')}/*${source.slice(start - 1, end + 1)}*/'${createBlob(`export default importShim._s[${urlJsString(depLoad.r)}]`)}'`;
|
|
939
|
+
lastIndex = end + 1;
|
|
940
|
+
}
|
|
941
|
+
// dependency source replacements
|
|
942
|
+
else if (dynamicImportIndex === -1) {
|
|
943
|
+
let keepAssertion = false;
|
|
944
|
+
if (a > 0 && !shimMode) {
|
|
945
|
+
const assertion = source.slice(a, statementEnd - 1);
|
|
946
|
+
// strip assertions only when unsupported in polyfill mode
|
|
947
|
+
keepAssertion =
|
|
948
|
+
nativePassthrough &&
|
|
949
|
+
((supportsJsonType && assertion.includes('json')) || (supportsCssType && assertion.includes('css')));
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// defer phase stripping
|
|
953
|
+
if (t === 6) {
|
|
954
|
+
pushStringTo(load, statementStart, dynamicImportEndStack);
|
|
955
|
+
resolvedSource += source.slice(statementStart, start - 1).replace('defer', '');
|
|
956
|
+
lastIndex = start;
|
|
957
|
+
}
|
|
958
|
+
let { l: depLoad } = load.d[depIndex++],
|
|
959
|
+
blobUrl = depLoad.b,
|
|
960
|
+
cycleShell = !blobUrl;
|
|
961
|
+
if (cycleShell) {
|
|
962
|
+
// circular shell creation
|
|
963
|
+
if (!(blobUrl = depLoad.s)) {
|
|
964
|
+
blobUrl = depLoad.s = createBlob(
|
|
965
|
+
`export function u$_(m){${depLoad.a[1]
|
|
966
|
+
.map(({ s, e }, i) => {
|
|
967
|
+
const q = depLoad.S[s] === '"' || depLoad.S[s] === "'";
|
|
968
|
+
return `e$_${i}=m${q ? `[` : '.'}${depLoad.S.slice(s, e)}${q ? `]` : ''}`;
|
|
969
|
+
})
|
|
970
|
+
.join(',')}}${
|
|
971
|
+
depLoad.a[1].length ? `let ${depLoad.a[1].map((_, i) => `e$_${i}`).join(',')};` : ''
|
|
972
|
+
}export {${depLoad.a[1]
|
|
973
|
+
.map(({ s, e }, i) => `e$_${i} as ${depLoad.S.slice(s, e)}`)
|
|
974
|
+
.join(',')}}\n//# sourceURL=${depLoad.r}?cycle`
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
pushStringTo(load, start - 1, dynamicImportEndStack);
|
|
980
|
+
resolvedSource += `/*${source.slice(start - 1, end + 1)}*/'${blobUrl}'`;
|
|
981
|
+
|
|
982
|
+
// circular shell execution
|
|
983
|
+
if (!cycleShell && depLoad.s) {
|
|
984
|
+
resolvedSource += `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
|
|
985
|
+
depLoad.s = undefined;
|
|
986
|
+
}
|
|
987
|
+
lastIndex = keepAssertion ? end + 1 : statementEnd;
|
|
988
|
+
}
|
|
989
|
+
// import.meta
|
|
990
|
+
else if (dynamicImportIndex === -2) {
|
|
991
|
+
load.m = { url: load.r, resolve: metaResolve };
|
|
992
|
+
if (metaHook) metaHook(load.m, load.u);
|
|
993
|
+
pushStringTo(load, start, dynamicImportEndStack);
|
|
994
|
+
resolvedSource += `importShim._r[${urlJsString(load.u)}].m`;
|
|
995
|
+
lastIndex = statementEnd;
|
|
996
|
+
}
|
|
997
|
+
// dynamic import
|
|
998
|
+
else {
|
|
999
|
+
pushStringTo(load, statementStart + 6, dynamicImportEndStack);
|
|
1000
|
+
resolvedSource += `Shim${t === 5 ? '.source' : ''}(`;
|
|
1001
|
+
dynamicImportEndStack.push(statementEnd - 1);
|
|
1002
|
+
lastIndex = start;
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// support progressive cycle binding updates (try statement avoids tdz errors)
|
|
1007
|
+
if (load.s && (imports.length === 0 || imports[imports.length - 1].d === -1))
|
|
1008
|
+
resolvedSource += `\n;import{u$_}from'${load.s}';try{u$_({${exports
|
|
1009
|
+
.filter(e => e.ln)
|
|
1010
|
+
.map(({ s, e, ln }) => `${source.slice(s, e)}:${ln}`)
|
|
1011
|
+
.join(',')}})}catch(_){};\n`;
|
|
1012
|
+
|
|
1013
|
+
let sourceURLCommentStart = source.lastIndexOf(sourceURLCommentPrefix);
|
|
1014
|
+
let sourceMapURLCommentStart = source.lastIndexOf(sourceMapURLCommentPrefix);
|
|
1015
|
+
|
|
1016
|
+
// ignore sourceMap comments before already spliced code
|
|
1017
|
+
if (sourceURLCommentStart < lastIndex) sourceURLCommentStart = -1;
|
|
1018
|
+
if (sourceMapURLCommentStart < lastIndex) sourceMapURLCommentStart = -1;
|
|
1019
|
+
|
|
1020
|
+
// sourceURL first / only
|
|
1021
|
+
if (
|
|
1022
|
+
sourceURLCommentStart !== -1 &&
|
|
1023
|
+
(sourceMapURLCommentStart === -1 || sourceMapURLCommentStart > sourceURLCommentStart)
|
|
1024
|
+
) {
|
|
1025
|
+
pushSourceURL(load, sourceURLCommentPrefix, sourceURLCommentStart, dynamicImportEndStack);
|
|
1026
|
+
}
|
|
1027
|
+
// sourceMappingURL
|
|
1028
|
+
if (sourceMapURLCommentStart !== -1) {
|
|
1029
|
+
pushSourceURL(load, sourceMapURLCommentPrefix, sourceMapURLCommentStart, dynamicImportEndStack);
|
|
1030
|
+
// sourceURL last
|
|
1031
|
+
if (sourceURLCommentStart !== -1 && sourceURLCommentStart > sourceMapURLCommentStart)
|
|
1032
|
+
pushSourceURL(load, sourceURLCommentPrefix, sourceURLCommentStart, dynamicImportEndStack);
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
pushStringTo(load, source.length, dynamicImportEndStack);
|
|
1036
|
+
|
|
1037
|
+
if (sourceURLCommentStart === -1) resolvedSource += sourceURLCommentPrefix + load.r;
|
|
1038
|
+
|
|
1039
|
+
load.b = createBlob(resolvedSource);
|
|
1040
|
+
load.S = resolvedSource = undefined;
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
const sourceURLCommentPrefix = '\n//# sourceURL=';
|
|
1044
|
+
const sourceMapURLCommentPrefix = '\n//# sourceMappingURL=';
|
|
1045
|
+
const cssUrlRegEx = /url\(\s*(?:(["'])((?:\\.|[^\n\\"'])+)\1|((?:\\.|[^\s,"'()\\])+))\s*\)/g;
|
|
1046
|
+
|
|
1047
|
+
// restrict in-flight fetches to a pool of 100
|
|
1048
|
+
let p = [];
|
|
1049
|
+
let c = 0;
|
|
1050
|
+
const pushFetchPool = () => {
|
|
1051
|
+
if (++c > 100) return new Promise(r => p.push(r));
|
|
1052
|
+
};
|
|
1053
|
+
const popFetchPool = () => {
|
|
1054
|
+
c--;
|
|
1055
|
+
if (p.length) p.shift()();
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1058
|
+
const doFetch = async (url, fetchOpts, parent) => {
|
|
1059
|
+
if (enforceIntegrity && !fetchOpts.integrity) throw Error(`No integrity for ${url}${fromParent(parent)}.`);
|
|
1060
|
+
const poolQueue = pushFetchPool();
|
|
1061
|
+
if (poolQueue) await poolQueue;
|
|
1062
|
+
try {
|
|
1063
|
+
var res = await fetchHook(url, fetchOpts);
|
|
1064
|
+
} catch (e) {
|
|
1065
|
+
e.message = `Unable to fetch ${url}${fromParent(parent)} - see network log for details.\n` + e.message;
|
|
1066
|
+
throw e;
|
|
1067
|
+
} finally {
|
|
1068
|
+
popFetchPool();
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
if (!res.ok) {
|
|
1072
|
+
const error = new TypeError(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
|
|
1073
|
+
error.response = res;
|
|
1074
|
+
throw error;
|
|
1075
|
+
}
|
|
1076
|
+
return res;
|
|
1077
|
+
};
|
|
1078
|
+
|
|
1079
|
+
let esmsTsTransform;
|
|
1080
|
+
const initTs = async () => {
|
|
1081
|
+
const m = await import(tsTransform);
|
|
1082
|
+
if (!esmsTsTransform) esmsTsTransform = m.transform;
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
const contentTypeRegEx = /^(text|application)\/((x-)?javascript|wasm|json|css|typescript)(;|$)/;
|
|
1086
|
+
async function defaultSourceHook(url, fetchOpts, parent) {
|
|
1087
|
+
const res = await doFetch(url, fetchOpts, parent);
|
|
1088
|
+
let [, , t] = (res.headers.get('content-type') || '').match(contentTypeRegEx) || [];
|
|
1089
|
+
if (!t) {
|
|
1090
|
+
if (url.endsWith('.ts') || url.endsWith('.mts')) t = 'ts';
|
|
1091
|
+
else
|
|
1092
|
+
throw Error(
|
|
1093
|
+
`Unsupported Content-Type "${contentType}" loading ${url}${fromParent(parent)}. Modules must be served with a valid MIME type like application/javascript.`
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
return {
|
|
1097
|
+
url: res.url,
|
|
1098
|
+
source: t === 'wasm' ? await WebAssembly.compileStreaming(res) : await res.text(),
|
|
1099
|
+
type:
|
|
1100
|
+
t[0] === 'x' || (t[0] === 'j' && t[1] === 'a') ? 'js'
|
|
1101
|
+
: t[0] === 't' ? 'ts'
|
|
1102
|
+
: t
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
const hotPrefix = 'var h=import.meta.hot,';
|
|
1107
|
+
const fetchModule = async (reqUrl, fetchOpts, parent) => {
|
|
1108
|
+
const mapIntegrity = composedImportMap.integrity[reqUrl];
|
|
1109
|
+
fetchOpts = mapIntegrity && !fetchOpts.integrity ? { ...fetchOpts, integrity: mapIntegrity } : fetchOpts;
|
|
1110
|
+
let {
|
|
1111
|
+
url = reqUrl,
|
|
1112
|
+
source,
|
|
1113
|
+
type
|
|
1114
|
+
} = (await (sourceHook || defaultSourceHook)(reqUrl, fetchOpts, parent, defaultSourceHook)) || {};
|
|
1115
|
+
if (type === 'wasm') {
|
|
1116
|
+
const exports = WebAssembly.Module.exports((sourceCache[url] = source));
|
|
1117
|
+
const imports = WebAssembly.Module.imports(source);
|
|
1118
|
+
const rStr = urlJsString(url);
|
|
1119
|
+
source = `import*as $_ns from${rStr};`;
|
|
1120
|
+
let i = 0,
|
|
1121
|
+
obj = '';
|
|
1122
|
+
for (const { module, kind } of imports) {
|
|
1123
|
+
const specifier = urlJsString(module);
|
|
1124
|
+
source += `import*as impt${i} from${specifier};\n`;
|
|
1125
|
+
obj += `${specifier}:${kind === 'global' ? `importShim._i.get(impt${i})||impt${i++}` : `impt${i++}`},`;
|
|
1126
|
+
}
|
|
1127
|
+
source += `${hotPrefix}i=await WebAssembly.instantiate(importShim._s[${rStr}],{${obj}});importShim._i.set($_ns,i);`;
|
|
1128
|
+
obj = '';
|
|
1129
|
+
for (const { name, kind } of exports) {
|
|
1130
|
+
source += `export let ${name}=i.exports['${name}'];`;
|
|
1131
|
+
if (kind === 'global') source += `try{${name}=${name}.value}catch{${name}=undefined}`;
|
|
1132
|
+
obj += `${name},`;
|
|
1133
|
+
}
|
|
1134
|
+
source += `if(h)h.accept(m=>({${obj}}=m))`;
|
|
1135
|
+
} else if (type === 'json') {
|
|
1136
|
+
source = `${hotPrefix}j=${source};export{j as default};if(h)h.accept(m=>j=m.default)`;
|
|
1137
|
+
} else if (type === 'css') {
|
|
1138
|
+
source = `${hotPrefix}s=h&&h.data.s||new CSSStyleSheet();s.replaceSync(${JSON.stringify(
|
|
1139
|
+
source.replace(
|
|
1140
|
+
cssUrlRegEx,
|
|
1141
|
+
(_match, quotes = '', relUrl1, relUrl2) => `url(${quotes}${resolveUrl(relUrl1 || relUrl2, url)}${quotes})`
|
|
1142
|
+
)
|
|
1143
|
+
)});if(h){h.data.s=s;h.accept(()=>{})}export default s`;
|
|
1144
|
+
} else if (type === 'ts') {
|
|
1145
|
+
if (!esmsTsTransform) await initTs();
|
|
1146
|
+
const transformed = esmsTsTransform(source, url);
|
|
1147
|
+
// even if the TypeScript is valid JavaScript, unless it was a top-level inline source, it wasn't served with
|
|
1148
|
+
// a valid JS MIME here, so we must still polyfill it
|
|
1149
|
+
source = transformed === undefined ? source : transformed;
|
|
1150
|
+
}
|
|
1151
|
+
return { url, source, type };
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1154
|
+
const getOrCreateLoad = (url, fetchOpts, parent, source) => {
|
|
1155
|
+
if (source && registry[url]) {
|
|
1156
|
+
let i = 0;
|
|
1157
|
+
while (registry[url + '#' + ++i]);
|
|
1158
|
+
url += '#' + i;
|
|
1159
|
+
}
|
|
1160
|
+
let load = registry[url];
|
|
1161
|
+
if (load) return load;
|
|
1162
|
+
registry[url] = load = {
|
|
1163
|
+
// url
|
|
1164
|
+
u: url,
|
|
1165
|
+
// response url
|
|
1166
|
+
r: source ? url : undefined,
|
|
1167
|
+
// fetchPromise
|
|
1168
|
+
f: undefined,
|
|
1169
|
+
// source
|
|
1170
|
+
S: source,
|
|
1171
|
+
// linkPromise
|
|
1172
|
+
L: undefined,
|
|
1173
|
+
// analysis
|
|
1174
|
+
a: undefined,
|
|
1175
|
+
// deps
|
|
1176
|
+
d: undefined,
|
|
1177
|
+
// blobUrl
|
|
1178
|
+
b: undefined,
|
|
1179
|
+
// shellUrl
|
|
1180
|
+
s: undefined,
|
|
1181
|
+
// needsShim: does it fail execution in the current native loader?
|
|
1182
|
+
n: false,
|
|
1183
|
+
// shouldShim: does it need to be loaded by the polyfill loader?
|
|
1184
|
+
N: false,
|
|
1185
|
+
// type
|
|
1186
|
+
t: null,
|
|
1187
|
+
// meta
|
|
1188
|
+
m: null
|
|
1189
|
+
};
|
|
1190
|
+
load.f = (async () => {
|
|
1191
|
+
if (load.S === undefined) {
|
|
1192
|
+
// preload fetch options override fetch options (race)
|
|
1193
|
+
({ url: load.r, source: load.S, type: load.t } = await (fetchCache[url] || fetchModule(url, fetchOpts, parent)));
|
|
1194
|
+
if (
|
|
1195
|
+
!load.n &&
|
|
1196
|
+
load.t !== 'js' &&
|
|
1197
|
+
!shimMode &&
|
|
1198
|
+
((load.t === 'css' && !supportsCssType) ||
|
|
1199
|
+
(load.t === 'json' && !supportsJsonType) ||
|
|
1200
|
+
(load.t === 'wasm' && !supportsWasmInstancePhase && !supportsWasmSourcePhase) ||
|
|
1201
|
+
load.t === 'ts')
|
|
1202
|
+
) {
|
|
1203
|
+
load.n = true;
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
try {
|
|
1207
|
+
load.a = parse(load.S, load.u);
|
|
1208
|
+
} catch (e) {
|
|
1209
|
+
throwError(e);
|
|
1210
|
+
load.a = [[], [], false];
|
|
1211
|
+
}
|
|
1212
|
+
return load;
|
|
1213
|
+
})();
|
|
1214
|
+
return load;
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
const featErr = feat =>
|
|
1218
|
+
Error(
|
|
1219
|
+
`${feat} feature must be enabled via <script type="esms-options">{ "polyfillEnable": ["${feat}"] }<${''}/script>`
|
|
1220
|
+
);
|
|
1221
|
+
|
|
1222
|
+
const linkLoad = (load, fetchOpts) => {
|
|
1223
|
+
if (load.L) return;
|
|
1224
|
+
load.L = load.f.then(async () => {
|
|
1225
|
+
let childFetchOpts = fetchOpts;
|
|
1226
|
+
load.d = load.a[0]
|
|
1227
|
+
.map(({ n, d, t, a, se }) => {
|
|
1228
|
+
const phaseImport = t >= 4;
|
|
1229
|
+
const sourcePhase = phaseImport && t < 6;
|
|
1230
|
+
if (phaseImport) {
|
|
1231
|
+
if (!shimMode && (sourcePhase ? !wasmSourcePhaseEnabled : !deferPhaseEnabled))
|
|
1232
|
+
throw featErr(sourcePhase ? 'wasm-module-sources' : 'import-defer');
|
|
1233
|
+
if (!sourcePhase || !supportsWasmSourcePhase) load.n = true;
|
|
1234
|
+
}
|
|
1235
|
+
let source = undefined;
|
|
1236
|
+
if (a > 0 && !shimMode && nativePassthrough) {
|
|
1237
|
+
const assertion = load.S.slice(a, se - 1);
|
|
1238
|
+
// no need to fetch JSON/CSS if supported, since it's a leaf node, we'll just strip the assertion syntax
|
|
1239
|
+
if (assertion.includes('json')) {
|
|
1240
|
+
if (supportsJsonType) source = '';
|
|
1241
|
+
else load.n = true;
|
|
1242
|
+
} else if (assertion.includes('css')) {
|
|
1243
|
+
if (supportsCssType) source = '';
|
|
1244
|
+
else load.n = true;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
if (d !== -1 || !n) return;
|
|
1248
|
+
const resolved = resolve(n, load.r || load.u);
|
|
1249
|
+
if (resolved.n || hasCustomizationHooks) load.n = true;
|
|
1250
|
+
if (d >= 0 || resolved.N) load.N = true;
|
|
1251
|
+
if (d !== -1) return;
|
|
1252
|
+
if (skip && skip(resolved.r) && !sourcePhase) return { l: { b: resolved.r }, s: false };
|
|
1253
|
+
if (childFetchOpts.integrity) childFetchOpts = { ...childFetchOpts, integrity: undefined };
|
|
1254
|
+
const child = { l: getOrCreateLoad(resolved.r, childFetchOpts, load.r, source), s: sourcePhase };
|
|
1255
|
+
// assertion case -> inline the CSS / JSON URL directly
|
|
1256
|
+
if (source === '') child.l.b = child.l.u;
|
|
1257
|
+
if (!child.s) linkLoad(child.l, fetchOpts);
|
|
1258
|
+
// load, sourcePhase
|
|
1259
|
+
return child;
|
|
1260
|
+
})
|
|
1261
|
+
.filter(l => l);
|
|
1262
|
+
});
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
const processScriptsAndPreloads = () => {
|
|
1266
|
+
for (const link of document.querySelectorAll(shimMode ? 'link[rel=modulepreload-shim]' : 'link[rel=modulepreload]')) {
|
|
1267
|
+
if (!link.ep) processPreload(link);
|
|
1268
|
+
}
|
|
1269
|
+
for (const script of document.querySelectorAll('script[type]')) {
|
|
1270
|
+
if (script.type === 'importmap' + (shimMode ? '-shim' : '')) {
|
|
1271
|
+
if (!script.ep) processImportMap(script);
|
|
1272
|
+
} else if (script.type === 'module' + (shimMode ? '-shim' : '')) {
|
|
1273
|
+
legacyAcceptingImportMaps = false;
|
|
1274
|
+
if (!script.ep) processScript(script);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
const getFetchOpts = script => {
|
|
1280
|
+
const fetchOpts = {};
|
|
1281
|
+
if (script.integrity) fetchOpts.integrity = script.integrity;
|
|
1282
|
+
if (script.referrerPolicy) fetchOpts.referrerPolicy = script.referrerPolicy;
|
|
1283
|
+
if (script.fetchPriority) fetchOpts.priority = script.fetchPriority;
|
|
1284
|
+
if (script.crossOrigin === 'use-credentials') fetchOpts.credentials = 'include';
|
|
1285
|
+
else if (script.crossOrigin === 'anonymous') fetchOpts.credentials = 'omit';
|
|
1286
|
+
else fetchOpts.credentials = 'same-origin';
|
|
1287
|
+
return fetchOpts;
|
|
1288
|
+
};
|
|
1289
|
+
|
|
1290
|
+
let lastStaticLoadPromise = Promise.resolve();
|
|
1291
|
+
|
|
1292
|
+
let domContentLoaded = false;
|
|
1293
|
+
let domContentLoadedCnt = 1;
|
|
1294
|
+
const domContentLoadedCheck = m => {
|
|
1295
|
+
if (m === undefined) {
|
|
1296
|
+
if (domContentLoaded) return;
|
|
1297
|
+
domContentLoaded = true;
|
|
1298
|
+
domContentLoadedCnt--;
|
|
1299
|
+
}
|
|
1300
|
+
if (--domContentLoadedCnt === 0 && !noLoadEventRetriggers && (shimMode || !baselineSupport)) {
|
|
1301
|
+
document.removeEventListener('DOMContentLoaded', domContentLoadedEvent);
|
|
1302
|
+
document.dispatchEvent(new Event('DOMContentLoaded'));
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
let loadCnt = 1;
|
|
1306
|
+
const loadCheck = () => {
|
|
1307
|
+
if (--loadCnt === 0 && !noLoadEventRetriggers && (shimMode || !baselineSupport)) {
|
|
1308
|
+
window.removeEventListener('load', loadEvent);
|
|
1309
|
+
window.dispatchEvent(new Event('load'));
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1312
|
+
|
|
1313
|
+
const domContentLoadedEvent = async () => {
|
|
1314
|
+
await initPromise;
|
|
1315
|
+
domContentLoadedCheck();
|
|
1316
|
+
};
|
|
1317
|
+
const loadEvent = async () => {
|
|
1318
|
+
await initPromise;
|
|
1319
|
+
domContentLoadedCheck();
|
|
1320
|
+
loadCheck();
|
|
1321
|
+
};
|
|
1322
|
+
|
|
1323
|
+
// this should always trigger because we assume es-module-shims is itself a domcontentloaded requirement
|
|
1324
|
+
if (hasDocument) {
|
|
1325
|
+
document.addEventListener('DOMContentLoaded', domContentLoadedEvent);
|
|
1326
|
+
window.addEventListener('load', loadEvent);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
const readyListener = async () => {
|
|
1330
|
+
await initPromise;
|
|
1331
|
+
processScriptsAndPreloads();
|
|
1332
|
+
if (document.readyState === 'complete') {
|
|
1333
|
+
readyStateCompleteCheck();
|
|
1334
|
+
}
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
let readyStateCompleteCnt = 1;
|
|
1338
|
+
const readyStateCompleteCheck = () => {
|
|
1339
|
+
if (--readyStateCompleteCnt === 0) {
|
|
1340
|
+
domContentLoadedCheck();
|
|
1341
|
+
if (!noLoadEventRetriggers && (shimMode || !baselineSupport)) {
|
|
1342
|
+
document.removeEventListener('readystatechange', readyListener);
|
|
1343
|
+
document.dispatchEvent(new Event('readystatechange'));
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1348
|
+
const hasNext = script => script.nextSibling || (script.parentNode && hasNext(script.parentNode));
|
|
1349
|
+
const epCheck = (script, ready) =>
|
|
1350
|
+
script.ep ||
|
|
1351
|
+
(!ready && ((!script.src && !script.innerHTML) || !hasNext(script))) ||
|
|
1352
|
+
script.getAttribute('noshim') !== null ||
|
|
1353
|
+
!(script.ep = true);
|
|
1354
|
+
|
|
1355
|
+
const processImportMap = (script, ready = readyStateCompleteCnt > 0) => {
|
|
1356
|
+
if (epCheck(script, ready)) return;
|
|
1357
|
+
// we dont currently support external import maps in polyfill mode to match native
|
|
1358
|
+
if (script.src) {
|
|
1359
|
+
if (!shimMode) return;
|
|
1360
|
+
importMapSrc = true;
|
|
1361
|
+
}
|
|
1362
|
+
importMapPromise = importMapPromise
|
|
1363
|
+
.then(async () => {
|
|
1364
|
+
composedImportMap = resolveAndComposeImportMap(
|
|
1365
|
+
script.src ? await (await doFetch(script.src, getFetchOpts(script))).json() : JSON.parse(script.innerHTML),
|
|
1366
|
+
script.src || baseUrl,
|
|
1367
|
+
composedImportMap
|
|
1368
|
+
);
|
|
1369
|
+
})
|
|
1370
|
+
.catch(e => {
|
|
1371
|
+
if (e instanceof SyntaxError)
|
|
1372
|
+
e = new Error(`Unable to parse import map ${e.message} in: ${script.src || script.innerHTML}`);
|
|
1373
|
+
throwError(e);
|
|
1374
|
+
});
|
|
1375
|
+
if (!firstImportMap && legacyAcceptingImportMaps) importMapPromise.then(() => (firstImportMap = composedImportMap));
|
|
1376
|
+
if (!legacyAcceptingImportMaps && !multipleImportMaps) {
|
|
1377
|
+
multipleImportMaps = true;
|
|
1378
|
+
if (!shimMode && baselineSupport && !supportsMultipleImportMaps) {
|
|
1379
|
+
baselineSupport = false;
|
|
1380
|
+
if (hasDocument) attachMutationObserver();
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
legacyAcceptingImportMaps = false;
|
|
1384
|
+
};
|
|
1385
|
+
|
|
1386
|
+
const processScript = (script, ready = readyStateCompleteCnt > 0) => {
|
|
1387
|
+
if (epCheck(script, ready)) return;
|
|
1388
|
+
// does this load block readystate complete
|
|
1389
|
+
const isBlockingReadyScript = script.getAttribute('async') === null && readyStateCompleteCnt > 0;
|
|
1390
|
+
// does this load block DOMContentLoaded
|
|
1391
|
+
const isDomContentLoadedScript = domContentLoadedCnt > 0;
|
|
1392
|
+
const isLoadScript = loadCnt > 0;
|
|
1393
|
+
if (isLoadScript) loadCnt++;
|
|
1394
|
+
if (isBlockingReadyScript) readyStateCompleteCnt++;
|
|
1395
|
+
if (isDomContentLoadedScript) domContentLoadedCnt++;
|
|
1396
|
+
let loadPromise;
|
|
1397
|
+
const ts = script.lang === 'ts';
|
|
1398
|
+
if (ts && !script.src) {
|
|
1399
|
+
loadPromise = Promise.resolve(esmsTsTransform || initTs())
|
|
1400
|
+
.then(() => {
|
|
1401
|
+
const transformed = esmsTsTransform(script.innerHTML, baseUrl);
|
|
1402
|
+
if (transformed !== undefined) {
|
|
1403
|
+
onpolyfill();
|
|
1404
|
+
firstPolyfillLoad = false;
|
|
1405
|
+
}
|
|
1406
|
+
return topLevelLoad(
|
|
1407
|
+
script.src || baseUrl,
|
|
1408
|
+
baseUrl,
|
|
1409
|
+
getFetchOpts(script),
|
|
1410
|
+
transformed === undefined ? script.innerHTML : transformed,
|
|
1411
|
+
!shimMode && transformed === undefined,
|
|
1412
|
+
isBlockingReadyScript && lastStaticLoadPromise,
|
|
1413
|
+
'ts'
|
|
1414
|
+
);
|
|
1415
|
+
})
|
|
1416
|
+
.catch(throwError);
|
|
1417
|
+
} else {
|
|
1418
|
+
loadPromise = topLevelLoad(
|
|
1419
|
+
script.src || baseUrl,
|
|
1420
|
+
baseUrl,
|
|
1421
|
+
getFetchOpts(script),
|
|
1422
|
+
!script.src ? script.innerHTML : undefined,
|
|
1423
|
+
!shimMode,
|
|
1424
|
+
isBlockingReadyScript && lastStaticLoadPromise,
|
|
1425
|
+
ts ? 'ts' : undefined
|
|
1426
|
+
).catch(throwError);
|
|
1427
|
+
}
|
|
1428
|
+
if (!noLoadEventRetriggers) loadPromise.then(() => script.dispatchEvent(new Event('load')));
|
|
1429
|
+
if (isBlockingReadyScript && !ts) {
|
|
1430
|
+
lastStaticLoadPromise = loadPromise.then(readyStateCompleteCheck);
|
|
1431
|
+
}
|
|
1432
|
+
if (isDomContentLoadedScript) loadPromise.then(domContentLoadedCheck);
|
|
1433
|
+
if (isLoadScript) loadPromise.then(loadCheck);
|
|
1434
|
+
};
|
|
1435
|
+
|
|
1436
|
+
const fetchCache = {};
|
|
1437
|
+
const processPreload = link => {
|
|
1438
|
+
link.ep = true;
|
|
1439
|
+
initPromise.then(() => {
|
|
1440
|
+
if (baselineSupport && !shimMode) return;
|
|
1441
|
+
if (fetchCache[link.href]) return;
|
|
1442
|
+
fetchCache[link.href] = fetchModule(link.href, getFetchOpts(link));
|
|
1443
|
+
});
|
|
1440
1444
|
};
|
|
1441
1445
|
|
|
1442
1446
|
})();
|