es-module-shims 1.3.5 → 1.3.6
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/CHANGELOG.md +3 -0
- package/dist/es-module-shims.js +12 -12
- package/dist/es-module-shims.wasm.js +12 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
ES Module Shims 1.3.6 (2021/12/07)
|
|
2
|
+
* Fix resolve hook via esms options (#233, @ffortier)
|
|
3
|
+
|
|
1
4
|
ES Module Shims 1.3.5 (2021/12/02)
|
|
2
5
|
* Fix trailing comment regex for source mapping normalization with trailling comments (https://github.com/guybedford/es-module-shims/pull/231)
|
|
3
6
|
|
package/dist/es-module-shims.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims 1.3.
|
|
1
|
+
/* ES Module Shims 1.3.6 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
|
|
@@ -199,14 +199,14 @@
|
|
|
199
199
|
|
|
200
200
|
const optionsScript = document.querySelector('script[type=esms-options]');
|
|
201
201
|
|
|
202
|
-
const esmsInitOptions
|
|
202
|
+
const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : self.esmsInitOptions ? self.esmsInitOptions : {};
|
|
203
203
|
|
|
204
|
-
let shimMode = !!esmsInitOptions
|
|
205
|
-
const resolveHook = globalHook(shimMode && esmsInitOptions
|
|
204
|
+
let shimMode = !!esmsInitOptions.shimMode;
|
|
205
|
+
const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);
|
|
206
206
|
|
|
207
|
-
const skip = esmsInitOptions
|
|
207
|
+
const skip = esmsInitOptions.skip ? new RegExp(esmsInitOptions.skip) : null;
|
|
208
208
|
|
|
209
|
-
let nonce = esmsInitOptions
|
|
209
|
+
let nonce = esmsInitOptions.nonce;
|
|
210
210
|
|
|
211
211
|
if (!nonce) {
|
|
212
212
|
const nonceElement = document.querySelector('script[nonce]');
|
|
@@ -214,18 +214,18 @@
|
|
|
214
214
|
nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
const onerror = globalHook(esmsInitOptions
|
|
218
|
-
const onpolyfill = globalHook(esmsInitOptions
|
|
217
|
+
const onerror = globalHook(esmsInitOptions.onerror || noop);
|
|
218
|
+
const onpolyfill = globalHook(esmsInitOptions.onpolyfill || noop);
|
|
219
219
|
|
|
220
|
-
const { revokeBlobURLs, noLoadEventRetriggers } = esmsInitOptions
|
|
220
|
+
const { revokeBlobURLs, noLoadEventRetriggers } = esmsInitOptions;
|
|
221
221
|
|
|
222
|
-
const fetchHook = esmsInitOptions
|
|
222
|
+
const fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;
|
|
223
223
|
|
|
224
224
|
function globalHook (name) {
|
|
225
225
|
return typeof name === 'string' ? self[name] : name;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
const enable = Array.isArray(esmsInitOptions
|
|
228
|
+
const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
|
|
229
229
|
const cssModulesEnabled = enable.includes('css-modules');
|
|
230
230
|
const jsonModulesEnabled = enable.includes('json-modules');
|
|
231
231
|
|
|
@@ -318,7 +318,7 @@
|
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
const resolve = resolveHook ? async (id, parentUrl) => ({ r: await
|
|
321
|
+
const resolve = resolveHook ? async (id, parentUrl) => ({ r: await resolveHook(id, parentUrl, defaultResolve), b: false }) : _resolve;
|
|
322
322
|
|
|
323
323
|
let id = 0;
|
|
324
324
|
const registry = {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims Wasm 1.3.
|
|
1
|
+
/* ES Module Shims Wasm 1.3.6 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const edge = navigator.userAgent.match(/Edge\/\d\d\.\d+$/);
|
|
@@ -199,14 +199,14 @@
|
|
|
199
199
|
|
|
200
200
|
const optionsScript = document.querySelector('script[type=esms-options]');
|
|
201
201
|
|
|
202
|
-
const esmsInitOptions
|
|
202
|
+
const esmsInitOptions = optionsScript ? JSON.parse(optionsScript.innerHTML) : self.esmsInitOptions ? self.esmsInitOptions : {};
|
|
203
203
|
|
|
204
|
-
let shimMode = !!esmsInitOptions
|
|
205
|
-
const resolveHook = globalHook(shimMode && esmsInitOptions
|
|
204
|
+
let shimMode = !!esmsInitOptions.shimMode;
|
|
205
|
+
const resolveHook = globalHook(shimMode && esmsInitOptions.resolve);
|
|
206
206
|
|
|
207
|
-
const skip = esmsInitOptions
|
|
207
|
+
const skip = esmsInitOptions.skip ? new RegExp(esmsInitOptions.skip) : null;
|
|
208
208
|
|
|
209
|
-
let nonce = esmsInitOptions
|
|
209
|
+
let nonce = esmsInitOptions.nonce;
|
|
210
210
|
|
|
211
211
|
if (!nonce) {
|
|
212
212
|
const nonceElement = document.querySelector('script[nonce]');
|
|
@@ -214,18 +214,18 @@
|
|
|
214
214
|
nonce = nonceElement.nonce || nonceElement.getAttribute('nonce');
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
const onerror = globalHook(esmsInitOptions
|
|
218
|
-
const onpolyfill = globalHook(esmsInitOptions
|
|
217
|
+
const onerror = globalHook(esmsInitOptions.onerror || noop);
|
|
218
|
+
const onpolyfill = globalHook(esmsInitOptions.onpolyfill || noop);
|
|
219
219
|
|
|
220
|
-
const { revokeBlobURLs, noLoadEventRetriggers } = esmsInitOptions
|
|
220
|
+
const { revokeBlobURLs, noLoadEventRetriggers } = esmsInitOptions;
|
|
221
221
|
|
|
222
|
-
const fetchHook = esmsInitOptions
|
|
222
|
+
const fetchHook = esmsInitOptions.fetch ? globalHook(esmsInitOptions.fetch) : fetch;
|
|
223
223
|
|
|
224
224
|
function globalHook (name) {
|
|
225
225
|
return typeof name === 'string' ? self[name] : name;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
const enable = Array.isArray(esmsInitOptions
|
|
228
|
+
const enable = Array.isArray(esmsInitOptions.polyfillEnable) ? esmsInitOptions.polyfillEnable : [];
|
|
229
229
|
const cssModulesEnabled = enable.includes('css-modules');
|
|
230
230
|
const jsonModulesEnabled = enable.includes('json-modules');
|
|
231
231
|
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
const resolve = resolveHook ? async (id, parentUrl) => ({ r: await
|
|
319
|
+
const resolve = resolveHook ? async (id, parentUrl) => ({ r: await resolveHook(id, parentUrl, defaultResolve), b: false }) : _resolve;
|
|
320
320
|
|
|
321
321
|
let id = 0;
|
|
322
322
|
const registry = {};
|