es-module-shims 2.0.6 → 2.0.7
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 +2 -2
- package/dist/es-module-shims-typescript.js +246 -272
- package/dist/es-module-shims.debug.js +21 -6
- package/dist/es-module-shims.js +21 -6
- package/dist/es-module-shims.wasm.js +21 -6
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims 2.0.
|
|
1
|
+
/* ES Module Shims 2.0.7 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const hasDocument = typeof document !== 'undefined';
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
source = `export{default}from'${url}'with{type:"${opts.with.type}"}`;
|
|
469
469
|
url += '?entry';
|
|
470
470
|
}
|
|
471
|
-
return topLevelLoad(url, { credentials: 'same-origin' }, source);
|
|
471
|
+
return topLevelLoad(url, { credentials: 'same-origin' }, source, undefined, undefined);
|
|
472
472
|
}
|
|
473
473
|
|
|
474
474
|
// import.source()
|
|
@@ -894,6 +894,10 @@
|
|
|
894
894
|
}
|
|
895
895
|
|
|
896
896
|
let esmsTsTransform;
|
|
897
|
+
async function initTs() {
|
|
898
|
+
const m = await import(tsTransform);
|
|
899
|
+
if (!esmsTsTransform) esmsTsTransform = m.transform;
|
|
900
|
+
}
|
|
897
901
|
|
|
898
902
|
async function fetchModule(url, fetchOpts, parent) {
|
|
899
903
|
const mapIntegrity = composedImportMap.integrity[url];
|
|
@@ -939,10 +943,7 @@
|
|
|
939
943
|
(tsContentType.test(contentType) || url.endsWith('.ts') || url.endsWith('.mts'))
|
|
940
944
|
) {
|
|
941
945
|
const source = await res.text();
|
|
942
|
-
|
|
943
|
-
if (!esmsTsTransform) {
|
|
944
|
-
({ transform: esmsTsTransform } = await import(tsTransform));
|
|
945
|
-
}
|
|
946
|
+
if (!esmsTsTransform) await initTs();
|
|
946
947
|
const transformed = esmsTsTransform(source, url);
|
|
947
948
|
return { r, s: transformed || source, t: transformed ? 'ts' : 'js' };
|
|
948
949
|
} else
|
|
@@ -1161,6 +1162,20 @@
|
|
|
1161
1162
|
|
|
1162
1163
|
function processScript(script, ready = readyStateCompleteCnt > 0) {
|
|
1163
1164
|
if (epCheck(script, ready)) return;
|
|
1165
|
+
if (script.lang === 'ts' && !script.src) {
|
|
1166
|
+
const source = script.innerHTML;
|
|
1167
|
+
return initTs()
|
|
1168
|
+
.then(() =>
|
|
1169
|
+
topLevelLoad(
|
|
1170
|
+
baseUrl,
|
|
1171
|
+
getFetchOpts(script),
|
|
1172
|
+
esmsTsTransform(source, baseUrl) || source,
|
|
1173
|
+
undefined,
|
|
1174
|
+
undefined
|
|
1175
|
+
)
|
|
1176
|
+
)
|
|
1177
|
+
.catch(throwError);
|
|
1178
|
+
}
|
|
1164
1179
|
console.info(`es-module-shims: checking script ${script.src || '<inline>'}`);
|
|
1165
1180
|
// does this load block readystate complete
|
|
1166
1181
|
const isBlockingReadyScript = script.getAttribute('async') === null && readyStateCompleteCnt > 0;
|
package/dist/es-module-shims.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims 2.0.
|
|
1
|
+
/* ES Module Shims 2.0.7 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const hasDocument = typeof document !== 'undefined';
|
|
@@ -459,7 +459,7 @@
|
|
|
459
459
|
source = `export{default}from'${url}'with{type:"${opts.with.type}"}`;
|
|
460
460
|
url += '?entry';
|
|
461
461
|
}
|
|
462
|
-
return topLevelLoad(url, { credentials: 'same-origin' }, source);
|
|
462
|
+
return topLevelLoad(url, { credentials: 'same-origin' }, source, undefined, undefined);
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
// import.source()
|
|
@@ -879,6 +879,10 @@
|
|
|
879
879
|
}
|
|
880
880
|
|
|
881
881
|
let esmsTsTransform;
|
|
882
|
+
async function initTs() {
|
|
883
|
+
const m = await import(tsTransform);
|
|
884
|
+
if (!esmsTsTransform) esmsTsTransform = m.transform;
|
|
885
|
+
}
|
|
882
886
|
|
|
883
887
|
async function fetchModule(url, fetchOpts, parent) {
|
|
884
888
|
const mapIntegrity = composedImportMap.integrity[url];
|
|
@@ -924,10 +928,7 @@
|
|
|
924
928
|
(tsContentType.test(contentType) || url.endsWith('.ts') || url.endsWith('.mts'))
|
|
925
929
|
) {
|
|
926
930
|
const source = await res.text();
|
|
927
|
-
|
|
928
|
-
if (!esmsTsTransform) {
|
|
929
|
-
({ transform: esmsTsTransform } = await import(tsTransform));
|
|
930
|
-
}
|
|
931
|
+
if (!esmsTsTransform) await initTs();
|
|
931
932
|
const transformed = esmsTsTransform(source, url);
|
|
932
933
|
return { r, s: transformed || source, t: transformed ? 'ts' : 'js' };
|
|
933
934
|
} else
|
|
@@ -1141,6 +1142,20 @@
|
|
|
1141
1142
|
|
|
1142
1143
|
function processScript(script, ready = readyStateCompleteCnt > 0) {
|
|
1143
1144
|
if (epCheck(script, ready)) return;
|
|
1145
|
+
if (script.lang === 'ts' && !script.src) {
|
|
1146
|
+
const source = script.innerHTML;
|
|
1147
|
+
return initTs()
|
|
1148
|
+
.then(() =>
|
|
1149
|
+
topLevelLoad(
|
|
1150
|
+
baseUrl,
|
|
1151
|
+
getFetchOpts(script),
|
|
1152
|
+
esmsTsTransform(source, baseUrl) || source,
|
|
1153
|
+
undefined,
|
|
1154
|
+
undefined
|
|
1155
|
+
)
|
|
1156
|
+
)
|
|
1157
|
+
.catch(throwError);
|
|
1158
|
+
}
|
|
1144
1159
|
// does this load block readystate complete
|
|
1145
1160
|
const isBlockingReadyScript = script.getAttribute('async') === null && readyStateCompleteCnt > 0;
|
|
1146
1161
|
// does this load block DOMContentLoaded
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ES Module Shims Wasm 2.0.
|
|
1
|
+
/* ES Module Shims Wasm 2.0.7 */
|
|
2
2
|
(function () {
|
|
3
3
|
|
|
4
4
|
const hasDocument = typeof document !== 'undefined';
|
|
@@ -459,7 +459,7 @@
|
|
|
459
459
|
source = `export{default}from'${url}'with{type:"${opts.with.type}"}`;
|
|
460
460
|
url += '?entry';
|
|
461
461
|
}
|
|
462
|
-
return topLevelLoad(url, { credentials: 'same-origin' }, source);
|
|
462
|
+
return topLevelLoad(url, { credentials: 'same-origin' }, source, undefined, undefined);
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
// import.source()
|
|
@@ -879,6 +879,10 @@
|
|
|
879
879
|
}
|
|
880
880
|
|
|
881
881
|
let esmsTsTransform;
|
|
882
|
+
async function initTs() {
|
|
883
|
+
const m = await import(tsTransform);
|
|
884
|
+
if (!esmsTsTransform) esmsTsTransform = m.transform;
|
|
885
|
+
}
|
|
882
886
|
|
|
883
887
|
async function fetchModule(url, fetchOpts, parent) {
|
|
884
888
|
const mapIntegrity = composedImportMap.integrity[url];
|
|
@@ -924,10 +928,7 @@
|
|
|
924
928
|
(tsContentType.test(contentType) || url.endsWith('.ts') || url.endsWith('.mts'))
|
|
925
929
|
) {
|
|
926
930
|
const source = await res.text();
|
|
927
|
-
|
|
928
|
-
if (!esmsTsTransform) {
|
|
929
|
-
({ transform: esmsTsTransform } = await import(tsTransform));
|
|
930
|
-
}
|
|
931
|
+
if (!esmsTsTransform) await initTs();
|
|
931
932
|
const transformed = esmsTsTransform(source, url);
|
|
932
933
|
return { r, s: transformed || source, t: transformed ? 'ts' : 'js' };
|
|
933
934
|
} else
|
|
@@ -1141,6 +1142,20 @@
|
|
|
1141
1142
|
|
|
1142
1143
|
function processScript(script, ready = readyStateCompleteCnt > 0) {
|
|
1143
1144
|
if (epCheck(script, ready)) return;
|
|
1145
|
+
if (script.lang === 'ts' && !script.src) {
|
|
1146
|
+
const source = script.innerHTML;
|
|
1147
|
+
return initTs()
|
|
1148
|
+
.then(() =>
|
|
1149
|
+
topLevelLoad(
|
|
1150
|
+
baseUrl,
|
|
1151
|
+
getFetchOpts(script),
|
|
1152
|
+
esmsTsTransform(source, baseUrl) || source,
|
|
1153
|
+
undefined,
|
|
1154
|
+
undefined
|
|
1155
|
+
)
|
|
1156
|
+
)
|
|
1157
|
+
.catch(throwError);
|
|
1158
|
+
}
|
|
1144
1159
|
// does this load block readystate complete
|
|
1145
1160
|
const isBlockingReadyScript = script.getAttribute('async') === null && readyStateCompleteCnt > 0;
|
|
1146
1161
|
// does this load block DOMContentLoaded
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "es-module-shims",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "Shims for the latest ES module features",
|
|
5
5
|
"main": "dist/es-module-shims.js",
|
|
6
6
|
"exports": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@rollup/plugin-replace": "^2.4.2",
|
|
34
|
-
"amaro": "^0.
|
|
34
|
+
"amaro": "^0.3.0",
|
|
35
35
|
"es-module-lexer": "1.6.0",
|
|
36
36
|
"kleur": "^4.1.4",
|
|
37
37
|
"mime-types": "^2.1.33",
|