@jsenv/core 30.3.5 → 30.3.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/dist/main.js CHANGED
@@ -6905,13 +6905,18 @@ const createServerEventsDispatcher = () => {
6905
6905
  const firstClient = clients.shift();
6906
6906
  firstClient.close();
6907
6907
  }
6908
- return () => {
6909
- client.close();
6908
+ const removeClient = () => {
6910
6909
  const index = clients.indexOf(client);
6911
6910
  if (index > -1) {
6912
6911
  clients.splice(index, 1);
6913
6912
  }
6914
6913
  };
6914
+ client.onclose = () => {
6915
+ removeClient();
6916
+ };
6917
+ return () => {
6918
+ client.close();
6919
+ };
6915
6920
  };
6916
6921
  return {
6917
6922
  addWebsocket: (websocket, request) => {
@@ -6946,6 +6951,10 @@ const createServerEventsDispatcher = () => {
6946
6951
  client.sendEvent({
6947
6952
  type: "welcome"
6948
6953
  });
6954
+ websocket.onclose = () => {
6955
+ client.onclose();
6956
+ };
6957
+ client.onclose = () => {};
6949
6958
  return addClient(client);
6950
6959
  },
6951
6960
  // we could add "addEventSource" and let clients connect using
@@ -9056,12 +9065,15 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
9056
9065
  await urlInfoTransformer.applyIntermediateTransformations(urlInfo, transformReturnValue);
9057
9066
  });
9058
9067
  } catch (error) {
9059
- throw createTransformUrlContentError({
9068
+ urlGraph.updateReferences(urlInfo, references); // ensure reference are updated even in case of error
9069
+ const transformError = createTransformUrlContentError({
9060
9070
  pluginController,
9061
9071
  reference: context.reference,
9062
9072
  urlInfo,
9063
9073
  error
9064
9074
  });
9075
+ urlInfo.error = transformError;
9076
+ throw transformError;
9065
9077
  }
9066
9078
  // after "transform" all references from originalContent
9067
9079
  // and the one injected by plugin are known
@@ -9651,7 +9663,7 @@ const jsenvPluginReferenceExpectedTypes = () => {
9651
9663
  name: "jsenv:reference_expected_types",
9652
9664
  appliesDuring: "*",
9653
9665
  redirectUrl: {
9654
- script_src: redirectJsUrls,
9666
+ script: redirectJsUrls,
9655
9667
  js_url: redirectJsUrls,
9656
9668
  js_import: redirectJsUrls
9657
9669
  }
@@ -9860,7 +9872,7 @@ const visitHtmlUrls = ({
9860
9872
  return;
9861
9873
  }
9862
9874
  visitAttributeAsUrlSpecifier({
9863
- type: "script_src",
9875
+ type: "script",
9864
9876
  subtype: type,
9865
9877
  expectedType: type,
9866
9878
  node,
@@ -9945,7 +9957,7 @@ const decideLinkExpectedType = (linkMention, mentions) => {
9945
9957
  return "css";
9946
9958
  }
9947
9959
  if (as === "script") {
9948
- const firstScriptOnThisUrl = mentions.find(mentionCandidate => mentionCandidate.url === linkMention.url && mentionCandidate.type === "script_src");
9960
+ const firstScriptOnThisUrl = mentions.find(mentionCandidate => mentionCandidate.url === linkMention.url && mentionCandidate.type === "script");
9949
9961
  if (firstScriptOnThisUrl) {
9950
9962
  return firstScriptOnThisUrl.expectedType;
9951
9963
  }
@@ -10176,6 +10188,28 @@ const findOriginalDirectoryReference = (urlInfo, context) => {
10176
10188
  const jsenvPluginHtmlInlineContent = ({
10177
10189
  analyzeConvertedScripts
10178
10190
  }) => {
10191
+ const cookInlineContent = async ({
10192
+ context,
10193
+ inlineContentUrlInfo,
10194
+ inlineContentReference
10195
+ }) => {
10196
+ try {
10197
+ await context.cook(inlineContentUrlInfo, {
10198
+ reference: inlineContentReference
10199
+ });
10200
+ } catch (e) {
10201
+ if (e.code === "PARSE_ERROR") {
10202
+ // When something like <style> or <script> contains syntax error
10203
+ // the HTML in itself it still valid
10204
+ // keep the syntax error and continue with the HTML
10205
+ const messageStart = inlineContentUrlInfo.type === "css" ? `Syntax error on css declared inside <style>` : `Syntax error on js declared inside <script>`;
10206
+ context.logger.error(`${messageStart}: ${e.cause.reasonCode}
10207
+ ${e.traceMessage}`);
10208
+ } else {
10209
+ throw e;
10210
+ }
10211
+ }
10212
+ };
10179
10213
  return {
10180
10214
  name: "jsenv:html_inline_content",
10181
10215
  appliesDuring: "*",
@@ -10210,7 +10244,7 @@ const jsenvPluginHtmlInlineContent = ({
10210
10244
  const debug = getHtmlNodeAttribute(styleNode, "jsenv-debug") !== undefined;
10211
10245
  const [inlineStyleReference, inlineStyleUrlInfo] = context.referenceUtils.foundInline({
10212
10246
  node: styleNode,
10213
- type: "link_href",
10247
+ type: "style",
10214
10248
  expectedType: "css",
10215
10249
  isOriginalPosition: isOriginal,
10216
10250
  // we remove 1 to the line because imagine the following html:
@@ -10224,8 +10258,10 @@ const jsenvPluginHtmlInlineContent = ({
10224
10258
  debug
10225
10259
  });
10226
10260
  actions.push(async () => {
10227
- await context.cook(inlineStyleUrlInfo, {
10228
- reference: inlineStyleReference
10261
+ await cookInlineContent({
10262
+ context,
10263
+ inlineContentUrlInfo: inlineStyleUrlInfo,
10264
+ inlineContentReference: inlineStyleReference
10229
10265
  });
10230
10266
  });
10231
10267
  mutations.push(() => {
@@ -10274,7 +10310,7 @@ const jsenvPluginHtmlInlineContent = ({
10274
10310
  const debug = getHtmlNodeAttribute(scriptNode, "jsenv-debug") !== undefined;
10275
10311
  const [inlineScriptReference, inlineScriptUrlInfo] = context.referenceUtils.foundInline({
10276
10312
  node: scriptNode,
10277
- type: "script_src",
10313
+ type: "script",
10278
10314
  expectedType: type,
10279
10315
  // we remove 1 to the line because imagine the following html:
10280
10316
  // <script>console.log('ok')</script>
@@ -10288,8 +10324,10 @@ const jsenvPluginHtmlInlineContent = ({
10288
10324
  debug
10289
10325
  });
10290
10326
  actions.push(async () => {
10291
- await context.cook(inlineScriptUrlInfo, {
10292
- reference: inlineScriptReference
10327
+ await cookInlineContent({
10328
+ context,
10329
+ inlineContentUrlInfo: inlineScriptUrlInfo,
10330
+ inlineContentReference: inlineScriptReference
10293
10331
  });
10294
10332
  });
10295
10333
  mutations.push(() => {
@@ -10695,13 +10733,27 @@ const getOriginalName = (path, name) => {
10695
10733
  return getOriginalName(path, importedName);
10696
10734
  }
10697
10735
  if (binding.path.type === "VariableDeclarator") {
10736
+ const {
10737
+ node
10738
+ } = binding.path;
10698
10739
  const {
10699
10740
  init
10700
- } = binding.path.node;
10741
+ } = node;
10701
10742
  if (init && init.type === "Identifier") {
10702
10743
  const previousName = init.name;
10703
10744
  return getOriginalName(path, previousName);
10704
10745
  }
10746
+ if (node.id && node.id.type === "Identifier") {
10747
+ const {
10748
+ constantViolations
10749
+ } = binding;
10750
+ if (constantViolations && constantViolations.length > 0) {
10751
+ const lastViolation = constantViolations[constantViolations.length - 1];
10752
+ if (lastViolation && lastViolation.node.type === "AssignmentExpression" && lastViolation.node.right.type === "MemberExpression" && lastViolation.node.right.property.type === "Identifier") {
10753
+ return lastViolation.node.right.property.name;
10754
+ }
10755
+ }
10756
+ }
10705
10757
  }
10706
10758
  return name;
10707
10759
  };
@@ -10800,7 +10852,8 @@ const jsenvPluginInlineQueryParam = () => {
10800
10852
  // this should be done during dev and postbuild but not build
10801
10853
  // so that the bundled file gets inlined and not the entry point
10802
10854
  "link_href": () => null,
10803
- "script_src": () => null,
10855
+ "style": () => null,
10856
+ "script": () => null,
10804
10857
  // if the referenced url is a worker we could use
10805
10858
  // https://www.oreilly.com/library/view/web-workers/9781449322120/ch04.html
10806
10859
  // but maybe we should rather use ?object_url
@@ -14661,7 +14714,7 @@ const jsenvPluginAsJsClassicHtml = ({
14661
14714
  }
14662
14715
  return null;
14663
14716
  },
14664
- script_src: (reference, context) => {
14717
+ script: (reference, context) => {
14665
14718
  if (context.systemJsTranspilation && reference.expectedType === "js_module") {
14666
14719
  return turnIntoJsClassicProxy(reference);
14667
14720
  }
@@ -14718,7 +14771,7 @@ const jsenvPluginAsJsClassicHtml = ({
14718
14771
  }
14719
14772
  const src = getHtmlNodeAttribute(node, "src");
14720
14773
  if (src) {
14721
- const reference = context.referenceUtils.find(ref => ref.generatedSpecifier === src && ref.type === "script_src" && ref.subtype === "js_module");
14774
+ const reference = context.referenceUtils.find(ref => ref.generatedSpecifier === src && ref.type === "script" && ref.subtype === "js_module");
14722
14775
  if (!reference) {
14723
14776
  return;
14724
14777
  }
@@ -14789,7 +14842,7 @@ const jsenvPluginAsJsClassicHtml = ({
14789
14842
  });
14790
14843
  }
14791
14844
  const [systemJsReference, systemJsUrlInfo] = context.referenceUtils.inject({
14792
- type: "script_src",
14845
+ type: "script",
14793
14846
  expectedType: "js_classic",
14794
14847
  isInline: true,
14795
14848
  contentType: "text/javascript",
@@ -15725,7 +15778,7 @@ const jsenvPluginImportmap = () => {
15725
15778
  columnEnd
15726
15779
  });
15727
15780
  const [inlineImportmapReference, inlineImportmapUrlInfo] = context.referenceUtils.foundInline({
15728
- type: "script_src",
15781
+ type: "script",
15729
15782
  isOriginalPosition: isOriginal,
15730
15783
  specifierLine: line - 1,
15731
15784
  specifierColumn: column,
@@ -16860,7 +16913,8 @@ const addRelationshipWithPackageJson = ({
16860
16913
  * - "http_request"
16861
16914
  * - "entry_point"
16862
16915
  * - "link_href"
16863
- * - "script_src"
16916
+ * - "style"
16917
+ * - "script"
16864
16918
  * - "a_href"
16865
16919
  * - "iframe_src
16866
16920
  * - "img_src"
@@ -17397,7 +17451,8 @@ const jsenvPluginSupervisor = ({
17397
17451
  columnEnd
17398
17452
  });
17399
17453
  const [inlineScriptReference] = context.referenceUtils.foundInline({
17400
- type: "script_src",
17454
+ type: "script",
17455
+ subtype: "inline",
17401
17456
  expectedType: type,
17402
17457
  isOriginalPosition: isOriginal,
17403
17458
  specifierLine: line - 1,
@@ -17470,7 +17525,7 @@ const jsenvPluginSupervisor = ({
17470
17525
  specifier: scriptTypeModuleSupervisorFileUrl
17471
17526
  });
17472
17527
  const [supervisorFileReference] = context.referenceUtils.inject({
17473
- type: "script_src",
17528
+ type: "script",
17474
17529
  expectedType: "js_classic",
17475
17530
  specifier: supervisorFileUrl
17476
17531
  });
@@ -19450,7 +19505,7 @@ const htmlNodeCanHotReload = node => {
19450
19505
  return rel === "icon";
19451
19506
  }
19452
19507
  return [
19453
- // "script_src", // script src cannot hot reload
19508
+ // "script", // script cannot hot reload
19454
19509
  "a",
19455
19510
  // Iframe will have their own event source client
19456
19511
  // and can hot reload independently
@@ -19709,7 +19764,7 @@ const jsenvPluginAutoreloadClient = () => {
19709
19764
  html: (htmlUrlInfo, context) => {
19710
19765
  const htmlAst = parseHtmlString(htmlUrlInfo.content);
19711
19766
  const [autoreloadClientReference] = context.referenceUtils.inject({
19712
- type: "script_src",
19767
+ type: "script",
19713
19768
  subtype: "js_module",
19714
19769
  expectedType: "js_module",
19715
19770
  specifier: autoreloadClientFileUrl
@@ -20064,7 +20119,7 @@ const jsenvPluginRibbon = ({
20064
20119
  }
20065
20120
  const htmlAst = parseHtmlString(urlInfo.content);
20066
20121
  const [ribbonClientFileReference] = context.referenceUtils.inject({
20067
- type: "script_src",
20122
+ type: "script",
20068
20123
  subtype: "js_module",
20069
20124
  expectedType: "js_module",
20070
20125
  specifier: ribbonClientFileUrl.href
@@ -21074,7 +21129,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
21074
21129
  const dependentUrlInfo = rawGraph.getUrlInfo(dependent);
21075
21130
  for (const reference of dependentUrlInfo.references) {
21076
21131
  if (reference.url === referencedUrlInfo.url) {
21077
- willAlreadyBeBundled = reference.subtype === "import_dynamic" || reference.type === "script_src";
21132
+ willAlreadyBeBundled = reference.subtype === "import_dynamic" || reference.type === "script";
21078
21133
  }
21079
21134
  }
21080
21135
  }
@@ -22022,7 +22077,7 @@ const jsenvPluginServerEventsClientInjection = () => {
22022
22077
  html: (htmlUrlInfo, context) => {
22023
22078
  const htmlAst = parseHtmlString(htmlUrlInfo.content);
22024
22079
  const [serverEventsClientFileReference] = context.referenceUtils.inject({
22025
- type: "script_src",
22080
+ type: "script",
22026
22081
  subtype: "js_module",
22027
22082
  expectedType: "js_module",
22028
22083
  specifier: serverEventsClientFileUrl
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "30.3.5",
3
+ "version": "30.3.7",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -67,7 +67,7 @@
67
67
  "@c88/v8-coverage": "0.1.1",
68
68
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
69
69
  "@jsenv/abort": "4.2.4",
70
- "@jsenv/ast": "3.0.1",
70
+ "@jsenv/ast": "3.0.2",
71
71
  "@jsenv/babel-plugins": "1.1.3",
72
72
  "@jsenv/plugin-bundling": "1.1.2",
73
73
  "@jsenv/filesystem": "4.1.9",
@@ -755,7 +755,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
755
755
  if (reference.url === referencedUrlInfo.url) {
756
756
  willAlreadyBeBundled =
757
757
  reference.subtype === "import_dynamic" ||
758
- reference.type === "script_src"
758
+ reference.type === "script"
759
759
  }
760
760
  }
761
761
  }
@@ -593,12 +593,15 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
593
593
  },
594
594
  )
595
595
  } catch (error) {
596
- throw createTransformUrlContentError({
596
+ urlGraph.updateReferences(urlInfo, references) // ensure reference are updated even in case of error
597
+ const transformError = createTransformUrlContentError({
597
598
  pluginController,
598
599
  reference: context.reference,
599
600
  urlInfo,
600
601
  error,
601
602
  })
603
+ urlInfo.error = transformError
604
+ throw transformError
602
605
  }
603
606
  // after "transform" all references from originalContent
604
607
  // and the one injected by plugin are known
@@ -18,7 +18,7 @@ export const jsenvPluginAutoreloadClient = () => {
18
18
  html: (htmlUrlInfo, context) => {
19
19
  const htmlAst = parseHtmlString(htmlUrlInfo.content)
20
20
  const [autoreloadClientReference] = context.referenceUtils.inject({
21
- type: "script_src",
21
+ type: "script",
22
22
  subtype: "js_module",
23
23
  expectedType: "js_module",
24
24
  specifier: autoreloadClientFileUrl,
@@ -130,7 +130,7 @@ const htmlNodeCanHotReload = (node) => {
130
130
  return rel === "icon"
131
131
  }
132
132
  return [
133
- // "script_src", // script src cannot hot reload
133
+ // "script", // script cannot hot reload
134
134
  "a",
135
135
  // Iframe will have their own event source client
136
136
  // and can hot reload independently
@@ -121,7 +121,7 @@ export const jsenvPluginImportmap = () => {
121
121
  })
122
122
  const [inlineImportmapReference, inlineImportmapUrlInfo] =
123
123
  context.referenceUtils.foundInline({
124
- type: "script_src",
124
+ type: "script",
125
125
  isOriginalPosition: isOriginal,
126
126
  specifierLine: line - 1,
127
127
  specifierColumn: column,
@@ -13,6 +13,33 @@ import {
13
13
  import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js"
14
14
 
15
15
  export const jsenvPluginHtmlInlineContent = ({ analyzeConvertedScripts }) => {
16
+ const cookInlineContent = async ({
17
+ context,
18
+ inlineContentUrlInfo,
19
+ inlineContentReference,
20
+ }) => {
21
+ try {
22
+ await context.cook(inlineContentUrlInfo, {
23
+ reference: inlineContentReference,
24
+ })
25
+ } catch (e) {
26
+ if (e.code === "PARSE_ERROR") {
27
+ // When something like <style> or <script> contains syntax error
28
+ // the HTML in itself it still valid
29
+ // keep the syntax error and continue with the HTML
30
+ const messageStart =
31
+ inlineContentUrlInfo.type === "css"
32
+ ? `Syntax error on css declared inside <style>`
33
+ : `Syntax error on js declared inside <script>`
34
+
35
+ context.logger.error(`${messageStart}: ${e.cause.reasonCode}
36
+ ${e.traceMessage}`)
37
+ } else {
38
+ throw e
39
+ }
40
+ }
41
+ }
42
+
16
43
  return {
17
44
  name: "jsenv:html_inline_content",
18
45
  appliesDuring: "*",
@@ -44,7 +71,7 @@ export const jsenvPluginHtmlInlineContent = ({ analyzeConvertedScripts }) => {
44
71
  const [inlineStyleReference, inlineStyleUrlInfo] =
45
72
  context.referenceUtils.foundInline({
46
73
  node: styleNode,
47
- type: "link_href",
74
+ type: "style",
48
75
  expectedType: "css",
49
76
  isOriginalPosition: isOriginal,
50
77
  // we remove 1 to the line because imagine the following html:
@@ -58,8 +85,10 @@ export const jsenvPluginHtmlInlineContent = ({ analyzeConvertedScripts }) => {
58
85
  debug,
59
86
  })
60
87
  actions.push(async () => {
61
- await context.cook(inlineStyleUrlInfo, {
62
- reference: inlineStyleReference,
88
+ await cookInlineContent({
89
+ context,
90
+ inlineContentUrlInfo: inlineStyleUrlInfo,
91
+ inlineContentReference: inlineStyleReference,
63
92
  })
64
93
  })
65
94
  mutations.push(() => {
@@ -113,7 +142,7 @@ export const jsenvPluginHtmlInlineContent = ({ analyzeConvertedScripts }) => {
113
142
  const [inlineScriptReference, inlineScriptUrlInfo] =
114
143
  context.referenceUtils.foundInline({
115
144
  node: scriptNode,
116
- type: "script_src",
145
+ type: "script",
117
146
  expectedType: type,
118
147
  // we remove 1 to the line because imagine the following html:
119
148
  // <script>console.log('ok')</script>
@@ -127,8 +156,10 @@ export const jsenvPluginHtmlInlineContent = ({ analyzeConvertedScripts }) => {
127
156
  debug,
128
157
  })
129
158
  actions.push(async () => {
130
- await context.cook(inlineScriptUrlInfo, {
131
- reference: inlineScriptReference,
159
+ await cookInlineContent({
160
+ context,
161
+ inlineContentUrlInfo: inlineScriptUrlInfo,
162
+ inlineContentReference: inlineScriptReference,
132
163
  })
133
164
  })
134
165
  mutations.push(() => {
@@ -9,7 +9,8 @@ export const jsenvPluginInlineQueryParam = () => {
9
9
  // this should be done during dev and postbuild but not build
10
10
  // so that the bundled file gets inlined and not the entry point
11
11
  "link_href": () => null,
12
- "script_src": () => null,
12
+ "style": () => null,
13
+ "script": () => null,
13
14
  // if the referenced url is a worker we could use
14
15
  // https://www.oreilly.com/library/view/web-workers/9781449322120/ch04.html
15
16
  // but maybe we should rather use ?object_url
@@ -274,11 +274,26 @@ const getOriginalName = (path, name) => {
274
274
  return getOriginalName(path, importedName)
275
275
  }
276
276
  if (binding.path.type === "VariableDeclarator") {
277
- const { init } = binding.path.node
277
+ const { node } = binding.path
278
+ const { init } = node
278
279
  if (init && init.type === "Identifier") {
279
280
  const previousName = init.name
280
281
  return getOriginalName(path, previousName)
281
282
  }
283
+ if (node.id && node.id.type === "Identifier") {
284
+ const { constantViolations } = binding
285
+ if (constantViolations && constantViolations.length > 0) {
286
+ const lastViolation = constantViolations[constantViolations.length - 1]
287
+ if (
288
+ lastViolation &&
289
+ lastViolation.node.type === "AssignmentExpression" &&
290
+ lastViolation.node.right.type === "MemberExpression" &&
291
+ lastViolation.node.right.property.type === "Identifier"
292
+ ) {
293
+ return lastViolation.node.right.property.name
294
+ }
295
+ }
296
+ }
282
297
  }
283
298
  return name
284
299
  }
@@ -37,7 +37,7 @@ export const jsenvPluginRibbon = ({
37
37
  }
38
38
  const htmlAst = parseHtmlString(urlInfo.content)
39
39
  const [ribbonClientFileReference] = context.referenceUtils.inject({
40
- type: "script_src",
40
+ type: "script",
41
41
  subtype: "js_module",
42
42
  expectedType: "js_module",
43
43
  specifier: ribbonClientFileUrl.href,
@@ -24,7 +24,7 @@ export const jsenvPluginServerEventsClientInjection = () => {
24
24
  const htmlAst = parseHtmlString(htmlUrlInfo.content)
25
25
  const [serverEventsClientFileReference] = context.referenceUtils.inject(
26
26
  {
27
- type: "script_src",
27
+ type: "script",
28
28
  subtype: "js_module",
29
29
  expectedType: "js_module",
30
30
  specifier: serverEventsClientFileUrl,
@@ -8,13 +8,18 @@ export const createServerEventsDispatcher = () => {
8
8
  const firstClient = clients.shift()
9
9
  firstClient.close()
10
10
  }
11
- return () => {
12
- client.close()
11
+ const removeClient = () => {
13
12
  const index = clients.indexOf(client)
14
13
  if (index > -1) {
15
14
  clients.splice(index, 1)
16
15
  }
17
16
  }
17
+ client.onclose = () => {
18
+ removeClient(client)
19
+ }
20
+ return () => {
21
+ client.close()
22
+ }
18
23
  }
19
24
 
20
25
  return {
@@ -48,6 +53,10 @@ export const createServerEventsDispatcher = () => {
48
53
  },
49
54
  }
50
55
  client.sendEvent({ type: "welcome" })
56
+ websocket.onclose = () => {
57
+ client.onclose()
58
+ }
59
+ client.onclose = () => {}
51
60
  return addClient(client)
52
61
  },
53
62
  // we could add "addEventSource" and let clients connect using
@@ -232,7 +232,8 @@ export const jsenvPluginSupervisor = ({
232
232
  columnEnd,
233
233
  })
234
234
  const [inlineScriptReference] = context.referenceUtils.foundInline({
235
- type: "script_src",
235
+ type: "script",
236
+ subtype: "inline",
236
237
  expectedType: type,
237
238
  isOriginalPosition: isOriginal,
238
239
  specifierLine: line - 1,
@@ -307,7 +308,7 @@ export const jsenvPluginSupervisor = ({
307
308
  specifier: scriptTypeModuleSupervisorFileUrl,
308
309
  })
309
310
  const [supervisorFileReference] = context.referenceUtils.inject({
310
- type: "script_src",
311
+ type: "script",
311
312
  expectedType: "js_classic",
312
313
  specifier: supervisorFileUrl,
313
314
  })
@@ -47,7 +47,7 @@ export const jsenvPluginAsJsClassicHtml = ({
47
47
  }
48
48
  return null
49
49
  },
50
- script_src: (reference, context) => {
50
+ script: (reference, context) => {
51
51
  if (
52
52
  context.systemJsTranspilation &&
53
53
  reference.expectedType === "js_module"
@@ -117,7 +117,7 @@ export const jsenvPluginAsJsClassicHtml = ({
117
117
  const reference = context.referenceUtils.find(
118
118
  (ref) =>
119
119
  ref.generatedSpecifier === src &&
120
- ref.type === "script_src" &&
120
+ ref.type === "script" &&
121
121
  ref.subtype === "js_module",
122
122
  )
123
123
  if (!reference) {
@@ -192,7 +192,7 @@ export const jsenvPluginAsJsClassicHtml = ({
192
192
  }
193
193
  const [systemJsReference, systemJsUrlInfo] =
194
194
  context.referenceUtils.inject({
195
- type: "script_src",
195
+ type: "script",
196
196
  expectedType: "js_classic",
197
197
  isInline: true,
198
198
  contentType: "text/javascript",
@@ -212,7 +212,7 @@ const visitHtmlUrls = ({ url, htmlAst }) => {
212
212
  return
213
213
  }
214
214
  visitAttributeAsUrlSpecifier({
215
- type: "script_src",
215
+ type: "script",
216
216
  subtype: type,
217
217
  expectedType: type,
218
218
  node,
@@ -301,7 +301,7 @@ const decideLinkExpectedType = (linkMention, mentions) => {
301
301
  const firstScriptOnThisUrl = mentions.find(
302
302
  (mentionCandidate) =>
303
303
  mentionCandidate.url === linkMention.url &&
304
- mentionCandidate.type === "script_src",
304
+ mentionCandidate.type === "script",
305
305
  )
306
306
  if (firstScriptOnThisUrl) {
307
307
  return firstScriptOnThisUrl.expectedType
@@ -44,7 +44,7 @@ export const jsenvPluginReferenceExpectedTypes = () => {
44
44
  name: "jsenv:reference_expected_types",
45
45
  appliesDuring: "*",
46
46
  redirectUrl: {
47
- script_src: redirectJsUrls,
47
+ script: redirectJsUrls,
48
48
  js_url: redirectJsUrls,
49
49
  js_import: redirectJsUrls,
50
50
  },
@@ -8,7 +8,8 @@
8
8
  * - "http_request"
9
9
  * - "entry_point"
10
10
  * - "link_href"
11
- * - "script_src"
11
+ * - "style"
12
+ * - "script"
12
13
  * - "a_href"
13
14
  * - "iframe_src
14
15
  * - "img_src"