es-module-shims 1.8.0 → 1.8.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 +1 -1
- package/dist/es-module-shims.debug.js +10 -3
- package/dist/es-module-shims.js +10 -3
- package/dist/es-module-shims.wasm.js +10 -3
- package/index.d.ts +12 -12
- package/package.json +13 -4
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Because we are still using the native module loader the edge cases work out comp
|
|
|
29
29
|
Include ES Module Shims with a `async` attribute on the script, then include an import map and module scripts normally:
|
|
30
30
|
|
|
31
31
|
```html
|
|
32
|
-
<script async src="https://ga.jspm.io/npm:es-module-shims@1.8.
|
|
32
|
+
<script async src="https://ga.jspm.io/npm:es-module-shims@1.8.1/dist/es-module-shims.js"></script>
|
|
33
33
|
|
|
34
34
|
<!-- https://generator.jspm.io/#U2NhYGBkDM0rySzJSU1hKEpNTC5xMLTQM9Az0C1K1jMAAKFS5w0gAA -->
|
|
35
35
|
<script type="importmap">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims DEBUG BUILD 1.8.
|
|
1
|
+
/* ES Module Shims DEBUG BUILD 1.8.1 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const hasWindow = typeof window !== 'undefined';
|
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
relUrl.length === 1 && (relUrl += '/')) ||
|
|
128
128
|
relUrl[0] === '/') {
|
|
129
129
|
const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
|
|
130
|
+
if (parentProtocol === 'blob:') {
|
|
131
|
+
throw new TypeError(`Failed to resolve module specifier "${relUrl}". Invalid relative url or base scheme isn't hierarchical.`);
|
|
132
|
+
}
|
|
130
133
|
// Disabled, but these cases will give inconsistent results for deep backtracking
|
|
131
134
|
//if (parentUrl[parentProtocol.length] !== '/')
|
|
132
135
|
// throw new Error('Cannot resolve');
|
|
@@ -743,8 +746,12 @@
|
|
|
743
746
|
finally {
|
|
744
747
|
popFetchPool();
|
|
745
748
|
}
|
|
746
|
-
|
|
747
|
-
|
|
749
|
+
|
|
750
|
+
if (!res.ok) {
|
|
751
|
+
const error = new TypeError(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
|
|
752
|
+
error.response = res;
|
|
753
|
+
throw error;
|
|
754
|
+
}
|
|
748
755
|
return res;
|
|
749
756
|
}
|
|
750
757
|
|
package/dist/es-module-shims.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims 1.8.
|
|
1
|
+
/* ES Module Shims 1.8.1 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const hasWindow = typeof window !== 'undefined';
|
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
relUrl.length === 1 && (relUrl += '/')) ||
|
|
128
128
|
relUrl[0] === '/') {
|
|
129
129
|
const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
|
|
130
|
+
if (parentProtocol === 'blob:') {
|
|
131
|
+
throw new TypeError(`Failed to resolve module specifier "${relUrl}". Invalid relative url or base scheme isn't hierarchical.`);
|
|
132
|
+
}
|
|
130
133
|
// Disabled, but these cases will give inconsistent results for deep backtracking
|
|
131
134
|
//if (parentUrl[parentProtocol.length] !== '/')
|
|
132
135
|
// throw new Error('Cannot resolve');
|
|
@@ -736,8 +739,12 @@
|
|
|
736
739
|
finally {
|
|
737
740
|
popFetchPool();
|
|
738
741
|
}
|
|
739
|
-
|
|
740
|
-
|
|
742
|
+
|
|
743
|
+
if (!res.ok) {
|
|
744
|
+
const error = new TypeError(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
|
|
745
|
+
error.response = res;
|
|
746
|
+
throw error;
|
|
747
|
+
}
|
|
741
748
|
return res;
|
|
742
749
|
}
|
|
743
750
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims Wasm 1.8.
|
|
1
|
+
/* ES Module Shims Wasm 1.8.1 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const hasWindow = typeof window !== 'undefined';
|
|
@@ -127,6 +127,9 @@
|
|
|
127
127
|
relUrl.length === 1 && (relUrl += '/')) ||
|
|
128
128
|
relUrl[0] === '/') {
|
|
129
129
|
const parentProtocol = parentUrl.slice(0, parentUrl.indexOf(':') + 1);
|
|
130
|
+
if (parentProtocol === 'blob:') {
|
|
131
|
+
throw new TypeError(`Failed to resolve module specifier "${relUrl}". Invalid relative url or base scheme isn't hierarchical.`);
|
|
132
|
+
}
|
|
130
133
|
// Disabled, but these cases will give inconsistent results for deep backtracking
|
|
131
134
|
//if (parentUrl[parentProtocol.length] !== '/')
|
|
132
135
|
// throw new Error('Cannot resolve');
|
|
@@ -736,8 +739,12 @@
|
|
|
736
739
|
finally {
|
|
737
740
|
popFetchPool();
|
|
738
741
|
}
|
|
739
|
-
|
|
740
|
-
|
|
742
|
+
|
|
743
|
+
if (!res.ok) {
|
|
744
|
+
const error = new TypeError(`${res.status} ${res.statusText} ${res.url}${fromParent(parent)}`);
|
|
745
|
+
error.response = res;
|
|
746
|
+
throw error;
|
|
747
|
+
}
|
|
741
748
|
return res;
|
|
742
749
|
}
|
|
743
750
|
|
package/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface ESMSInitOptions {
|
|
|
8
8
|
* Enable polyfill features.
|
|
9
9
|
* Currently supports ['css-modules', 'json-modules']
|
|
10
10
|
*/
|
|
11
|
-
polyfillEnable?:
|
|
11
|
+
polyfillEnable?: Array<'css-modules' | 'json-modules'>
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* #### Enforce Integrity
|
|
@@ -16,7 +16,7 @@ interface ESMSInitOptions {
|
|
|
16
16
|
* Set to *true* to enable secure mode to not support loading modules without integrity (integrity is always verified though).
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
|
-
enforceIntegrity
|
|
19
|
+
enforceIntegrity?: boolean;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Nonce for CSP build
|
|
@@ -26,7 +26,7 @@ interface ESMSInitOptions {
|
|
|
26
26
|
/**
|
|
27
27
|
* Disable retriggering of document readystate
|
|
28
28
|
*/
|
|
29
|
-
noLoadEventRetriggers
|
|
29
|
+
noLoadEventRetriggers?: true;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* #### Skip Processing Stability
|
|
@@ -49,7 +49,7 @@ interface ESMSInitOptions {
|
|
|
49
49
|
* By default, this expression supports jspm.dev, dev.jspm.io and
|
|
50
50
|
* cdn.pika.dev.
|
|
51
51
|
*/
|
|
52
|
-
skip
|
|
52
|
+
skip?: RegExp;
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* #### Error hook
|
|
@@ -57,7 +57,7 @@ interface ESMSInitOptions {
|
|
|
57
57
|
* Register a callback for any ES Module Shims module errors.
|
|
58
58
|
*
|
|
59
59
|
*/
|
|
60
|
-
onerror
|
|
60
|
+
onerror?: (e: any) => any;
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* #### Polyfill hook
|
|
@@ -65,7 +65,7 @@ interface ESMSInitOptions {
|
|
|
65
65
|
* Register a callback invoked when polyfill mode first engages.
|
|
66
66
|
*
|
|
67
67
|
*/
|
|
68
|
-
onpolyfill
|
|
68
|
+
onpolyfill?: () => void;
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* #### Resolve Hook
|
|
@@ -74,7 +74,7 @@ interface ESMSInitOptions {
|
|
|
74
74
|
*
|
|
75
75
|
* Provide a custom resolver function.
|
|
76
76
|
*/
|
|
77
|
-
resolve
|
|
77
|
+
resolve?: (
|
|
78
78
|
id: string,
|
|
79
79
|
parentUrl: string,
|
|
80
80
|
resolve: (id: string, parentUrl: string) => string
|
|
@@ -142,7 +142,7 @@ interface ESMSInitOptions {
|
|
|
142
142
|
* }
|
|
143
143
|
* ```
|
|
144
144
|
*/
|
|
145
|
-
fetch
|
|
145
|
+
fetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* #### Revoke Blob URLs
|
|
@@ -151,7 +151,7 @@ interface ESMSInitOptions {
|
|
|
151
151
|
* Can cost some compute time for large loads.
|
|
152
152
|
*
|
|
153
153
|
*/
|
|
154
|
-
revokeBlobURLs
|
|
154
|
+
revokeBlobURLs?: boolean;
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
157
|
* #### Map Overrides
|
|
@@ -159,7 +159,7 @@ interface ESMSInitOptions {
|
|
|
159
159
|
* Set to *true* to permit overrides to import maps.
|
|
160
160
|
*
|
|
161
161
|
*/
|
|
162
|
-
mapOverrides
|
|
162
|
+
mapOverrides?: boolean;
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
165
|
* #### Meta hook
|
|
@@ -167,7 +167,7 @@ interface ESMSInitOptions {
|
|
|
167
167
|
* Register a callback for import.meta construction.
|
|
168
168
|
*
|
|
169
169
|
*/
|
|
170
|
-
meta
|
|
170
|
+
meta?: (meta: any, url: string) => void;
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
173
|
* #### On import hook
|
|
@@ -175,7 +175,7 @@ interface ESMSInitOptions {
|
|
|
175
175
|
* Register a callback for top-level imports.
|
|
176
176
|
*
|
|
177
177
|
*/
|
|
178
|
-
onimport
|
|
178
|
+
onimport?: (url: string, options: any, parentUrl: string) => void;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
interface ImportMap {
|
package/package.json
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-module-shims",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Shims for the latest ES module features",
|
|
5
5
|
"main": "dist/es-module-shims.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
".":
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"default": "./dist/es-module-shims.js"
|
|
10
|
+
},
|
|
11
|
+
"./debug": {
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"default": "./dist/es-module-shims.debug.js"
|
|
14
|
+
},
|
|
15
|
+
"./wasm": {
|
|
16
|
+
"types": "./index.d.ts",
|
|
17
|
+
"default": "./dist/es-module-shims.wasm.js"
|
|
18
|
+
}
|
|
10
19
|
},
|
|
11
20
|
"types": "index.d.ts",
|
|
12
21
|
"type": "module",
|