@jsenv/core 39.6.0 → 39.7.0
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/dist/jsenv_core.js
CHANGED
|
@@ -16646,6 +16646,31 @@ const jsenvPluginHtmlReferenceAnalysis = ({
|
|
|
16646
16646
|
actions.push(async () => {
|
|
16647
16647
|
const inlineUrlInfo = inlineReference.urlInfo;
|
|
16648
16648
|
await inlineUrlInfo.cook();
|
|
16649
|
+
const typeAttribute = getHtmlNodeAttribute(node, "type");
|
|
16650
|
+
if (expectedType === "js_classic") {
|
|
16651
|
+
if (
|
|
16652
|
+
typeAttribute !== undefined &&
|
|
16653
|
+
typeAttribute !== "text/javascript"
|
|
16654
|
+
) {
|
|
16655
|
+
// 1. <script type="jsx"> becomes <script>
|
|
16656
|
+
mutations.push(() => {
|
|
16657
|
+
setHtmlNodeAttributes(node, {
|
|
16658
|
+
"type": undefined,
|
|
16659
|
+
"original-type": typeAttribute,
|
|
16660
|
+
});
|
|
16661
|
+
});
|
|
16662
|
+
}
|
|
16663
|
+
} else if (expectedType === "js_module") {
|
|
16664
|
+
// 2. <script type="module/jsx"> becomes <script type="module">
|
|
16665
|
+
if (typeAttribute !== "module") {
|
|
16666
|
+
mutations.push(() => {
|
|
16667
|
+
setHtmlNodeAttributes(node, {
|
|
16668
|
+
"type": "module",
|
|
16669
|
+
"original-type": typeAttribute,
|
|
16670
|
+
});
|
|
16671
|
+
});
|
|
16672
|
+
}
|
|
16673
|
+
}
|
|
16649
16674
|
mutations.push(() => {
|
|
16650
16675
|
if (hotAccept) {
|
|
16651
16676
|
removeHtmlNodeText(node);
|
|
@@ -16710,7 +16735,7 @@ const jsenvPluginHtmlReferenceAnalysis = ({
|
|
|
16710
16735
|
}
|
|
16711
16736
|
: null,
|
|
16712
16737
|
script: (scriptNode) => {
|
|
16713
|
-
const { type, subtype, contentType
|
|
16738
|
+
const { type, subtype, contentType } =
|
|
16714
16739
|
analyzeScriptNode(scriptNode);
|
|
16715
16740
|
if (type === "text") {
|
|
16716
16741
|
// ignore <script type="whatever">foobar</script>
|
|
@@ -16849,31 +16874,12 @@ const jsenvPluginHtmlReferenceAnalysis = ({
|
|
|
16849
16874
|
) {
|
|
16850
16875
|
return;
|
|
16851
16876
|
}
|
|
16852
|
-
|
|
16853
|
-
const inlineRef = visitTextContent(scriptNode, {
|
|
16877
|
+
visitTextContent(scriptNode, {
|
|
16854
16878
|
type: "script",
|
|
16855
16879
|
subtype,
|
|
16856
16880
|
expectedType: type,
|
|
16857
16881
|
contentType,
|
|
16858
16882
|
});
|
|
16859
|
-
if (inlineRef) {
|
|
16860
|
-
// 1. <script type="jsx"> becomes <script>
|
|
16861
|
-
if (type === "js_classic" && extension !== ".js") {
|
|
16862
|
-
mutations.push(() => {
|
|
16863
|
-
setHtmlNodeAttributes(scriptNode, {
|
|
16864
|
-
type: undefined,
|
|
16865
|
-
});
|
|
16866
|
-
});
|
|
16867
|
-
}
|
|
16868
|
-
// 2. <script type="module/jsx"> becomes <script type="module">
|
|
16869
|
-
if (type === "js_module" && extension !== ".js") {
|
|
16870
|
-
mutations.push(() => {
|
|
16871
|
-
setHtmlNodeAttributes(scriptNode, {
|
|
16872
|
-
type: "module",
|
|
16873
|
-
});
|
|
16874
|
-
});
|
|
16875
|
-
}
|
|
16876
|
-
}
|
|
16877
16883
|
},
|
|
16878
16884
|
a: (aNode) => {
|
|
16879
16885
|
visitHref(aNode, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "39.
|
|
3
|
+
"version": "39.7.0",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -69,17 +69,17 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
71
71
|
"@jsenv/abort": "4.3.0",
|
|
72
|
-
"@jsenv/ast": "6.
|
|
72
|
+
"@jsenv/ast": "6.4.0",
|
|
73
73
|
"@jsenv/filesystem": "4.10.13",
|
|
74
74
|
"@jsenv/humanize": "1.2.8",
|
|
75
75
|
"@jsenv/importmap": "1.2.1",
|
|
76
76
|
"@jsenv/integrity": "0.0.2",
|
|
77
|
-
"@jsenv/js-module-fallback": "1.3.
|
|
77
|
+
"@jsenv/js-module-fallback": "1.3.52",
|
|
78
78
|
"@jsenv/node-esm-resolution": "1.0.6",
|
|
79
79
|
"@jsenv/plugin-bundling": "2.7.19",
|
|
80
80
|
"@jsenv/plugin-minification": "1.5.11",
|
|
81
|
-
"@jsenv/plugin-supervisor": "1.5.
|
|
82
|
-
"@jsenv/plugin-transpilation": "1.4.
|
|
81
|
+
"@jsenv/plugin-supervisor": "1.5.31",
|
|
82
|
+
"@jsenv/plugin-transpilation": "1.4.87",
|
|
83
83
|
"@jsenv/runtime-compat": "1.3.1",
|
|
84
84
|
"@jsenv/server": "15.3.3",
|
|
85
85
|
"@jsenv/sourcemap": "1.2.27",
|
|
@@ -280,6 +280,31 @@ export const jsenvPluginHtmlReferenceAnalysis = ({
|
|
|
280
280
|
actions.push(async () => {
|
|
281
281
|
const inlineUrlInfo = inlineReference.urlInfo;
|
|
282
282
|
await inlineUrlInfo.cook();
|
|
283
|
+
const typeAttribute = getHtmlNodeAttribute(node, "type");
|
|
284
|
+
if (expectedType === "js_classic") {
|
|
285
|
+
if (
|
|
286
|
+
typeAttribute !== undefined &&
|
|
287
|
+
typeAttribute !== "text/javascript"
|
|
288
|
+
) {
|
|
289
|
+
// 1. <script type="jsx"> becomes <script>
|
|
290
|
+
mutations.push(() => {
|
|
291
|
+
setHtmlNodeAttributes(node, {
|
|
292
|
+
"type": undefined,
|
|
293
|
+
"original-type": typeAttribute,
|
|
294
|
+
});
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
} else if (expectedType === "js_module") {
|
|
298
|
+
// 2. <script type="module/jsx"> becomes <script type="module">
|
|
299
|
+
if (typeAttribute !== "module") {
|
|
300
|
+
mutations.push(() => {
|
|
301
|
+
setHtmlNodeAttributes(node, {
|
|
302
|
+
"type": "module",
|
|
303
|
+
"original-type": typeAttribute,
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
}
|
|
283
308
|
mutations.push(() => {
|
|
284
309
|
if (hotAccept) {
|
|
285
310
|
removeHtmlNodeText(node);
|
|
@@ -344,7 +369,7 @@ export const jsenvPluginHtmlReferenceAnalysis = ({
|
|
|
344
369
|
}
|
|
345
370
|
: null,
|
|
346
371
|
script: (scriptNode) => {
|
|
347
|
-
const { type, subtype, contentType
|
|
372
|
+
const { type, subtype, contentType } =
|
|
348
373
|
analyzeScriptNode(scriptNode);
|
|
349
374
|
if (type === "text") {
|
|
350
375
|
// ignore <script type="whatever">foobar</script>
|
|
@@ -483,31 +508,12 @@ export const jsenvPluginHtmlReferenceAnalysis = ({
|
|
|
483
508
|
) {
|
|
484
509
|
return;
|
|
485
510
|
}
|
|
486
|
-
|
|
487
|
-
const inlineRef = visitTextContent(scriptNode, {
|
|
511
|
+
visitTextContent(scriptNode, {
|
|
488
512
|
type: "script",
|
|
489
513
|
subtype,
|
|
490
514
|
expectedType: type,
|
|
491
515
|
contentType,
|
|
492
516
|
});
|
|
493
|
-
if (inlineRef) {
|
|
494
|
-
// 1. <script type="jsx"> becomes <script>
|
|
495
|
-
if (type === "js_classic" && extension !== ".js") {
|
|
496
|
-
mutations.push(() => {
|
|
497
|
-
setHtmlNodeAttributes(scriptNode, {
|
|
498
|
-
type: undefined,
|
|
499
|
-
});
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
// 2. <script type="module/jsx"> becomes <script type="module">
|
|
503
|
-
if (type === "js_module" && extension !== ".js") {
|
|
504
|
-
mutations.push(() => {
|
|
505
|
-
setHtmlNodeAttributes(scriptNode, {
|
|
506
|
-
type: "module",
|
|
507
|
-
});
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
517
|
},
|
|
512
518
|
a: (aNode) => {
|
|
513
519
|
visitHref(aNode, {
|