@jsenv/core 32.1.1 → 32.2.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/main.js CHANGED
@@ -17152,6 +17152,7 @@ const addRelationshipWithPackageJson = ({
17152
17152
  * - "css_@import"
17153
17153
  * - "css_url"
17154
17154
  * - "js_import"
17155
+ * - "js_import_script"
17155
17156
  * - "js_url"
17156
17157
  * - "js_inline_content"
17157
17158
  * - "sourcemap_comment"
@@ -17187,7 +17188,7 @@ const jsenvPluginUrlResolution = ({
17187
17188
  "${urlType}" resolution key must be "web" or "node_esm", found "${Object.keys(rest)[0]}"`);
17188
17189
  }
17189
17190
  if (node_esm === undefined) {
17190
- node_esm = urlType === "js_module";
17191
+ node_esm = urlType === "js_import" || urlType === "js_import_script";
17191
17192
  }
17192
17193
  if (web === undefined) {
17193
17194
  web = true;
@@ -17229,13 +17230,17 @@ const jsenvPluginUrlResolution = ({
17229
17230
  if (reference.type === "sourcemap_comment") {
17230
17231
  return resolveUrlUsingWebResolution(reference);
17231
17232
  }
17232
- let urlType;
17233
+ let type;
17234
+ let subtype;
17235
+ const parentUrlInfo = context.urlGraph.getUrlInfo(reference.parentUrl);
17233
17236
  if (reference.injected) {
17234
- urlType = reference.expectedType;
17237
+ type = reference.expectedType;
17238
+ subtype = reference.expectedSubtype;
17235
17239
  } else {
17236
- const parentUrlInfo = context.urlGraph.getUrlInfo(reference.parentUrl);
17237
- urlType = parentUrlInfo ? parentUrlInfo.type : "entry_point";
17240
+ type = parentUrlInfo ? parentUrlInfo.type : "entry_point";
17241
+ subtype = parentUrlInfo ? parentUrlInfo.subtype : "";
17238
17242
  }
17243
+ const urlType = subtype === "self_import_scripts_arg" ? "js_import_script" : type;
17239
17244
  const resolver = resolvers[urlType] || resolvers["*"];
17240
17245
  return resolver(reference, context);
17241
17246
  },
@@ -20894,12 +20899,14 @@ const build = async ({
20894
20899
  }
20895
20900
  sourceDirectoryUrl = assertAndNormalizeDirectoryUrl(sourceDirectoryUrl, "sourceDirectoryUrl");
20896
20901
  buildDirectoryUrl = assertAndNormalizeDirectoryUrl(buildDirectoryUrl, "buildDirectoryUrl");
20897
- if (outDirectoryUrl === undefined && !process.env.CI) {
20898
- const packageDirectoryUrl = lookupPackageDirectory(sourceDirectoryUrl);
20899
- if (packageDirectoryUrl) {
20900
- outDirectoryUrl = `${packageDirectoryUrl}.jsenv/`;
20902
+ if (outDirectoryUrl === undefined) {
20903
+ if (!process.env.CI) {
20904
+ const packageDirectoryUrl = lookupPackageDirectory(sourceDirectoryUrl);
20905
+ if (packageDirectoryUrl) {
20906
+ outDirectoryUrl = `${packageDirectoryUrl}.jsenv/`;
20907
+ }
20901
20908
  }
20902
- } else {
20909
+ } else if (outDirectoryUrl !== null && outDirectoryUrl !== false) {
20903
20910
  outDirectoryUrl = assertAndNormalizeDirectoryUrl(outDirectoryUrl, "outDirectoryUrl");
20904
20911
  }
20905
20912
  if (typeof entryPoints !== "object" || entryPoints === null) {
@@ -22784,12 +22791,14 @@ const startDevServer = async ({
22784
22791
  throw new TypeError(`${unexpectedParamNames.join(",")}: there is no such param`);
22785
22792
  }
22786
22793
  sourceDirectoryUrl = assertAndNormalizeDirectoryUrl(sourceDirectoryUrl, "sourceDirectoryUrl");
22787
- if (outDirectoryUrl === undefined && !process.env.CI) {
22788
- const packageDirectoryUrl = lookupPackageDirectory(sourceDirectoryUrl);
22789
- if (packageDirectoryUrl) {
22790
- outDirectoryUrl = `${packageDirectoryUrl}.jsenv/`;
22794
+ if (outDirectoryUrl === undefined) {
22795
+ if (!process.env.CI) {
22796
+ const packageDirectoryUrl = lookupPackageDirectory(sourceDirectoryUrl);
22797
+ if (packageDirectoryUrl) {
22798
+ outDirectoryUrl = `${packageDirectoryUrl}.jsenv/`;
22799
+ }
22791
22800
  }
22792
- } else {
22801
+ } else if (outDirectoryUrl !== null && outDirectoryUrl !== false) {
22793
22802
  outDirectoryUrl = assertAndNormalizeDirectoryUrl(outDirectoryUrl, "outDirectoryUrl");
22794
22803
  }
22795
22804
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "32.1.1",
3
+ "version": "32.2.0",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -174,12 +174,14 @@ export const build = async ({
174
174
  buildDirectoryUrl,
175
175
  "buildDirectoryUrl",
176
176
  )
177
- if (outDirectoryUrl === undefined && !process.env.CI) {
178
- const packageDirectoryUrl = lookupPackageDirectory(sourceDirectoryUrl)
179
- if (packageDirectoryUrl) {
180
- outDirectoryUrl = `${packageDirectoryUrl}.jsenv/`
177
+ if (outDirectoryUrl === undefined) {
178
+ if (!process.env.CI) {
179
+ const packageDirectoryUrl = lookupPackageDirectory(sourceDirectoryUrl)
180
+ if (packageDirectoryUrl) {
181
+ outDirectoryUrl = `${packageDirectoryUrl}.jsenv/`
182
+ }
181
183
  }
182
- } else {
184
+ } else if (outDirectoryUrl !== null && outDirectoryUrl !== false) {
183
185
  outDirectoryUrl = assertAndNormalizeDirectoryUrl(
184
186
  outDirectoryUrl,
185
187
  "outDirectoryUrl",
@@ -78,12 +78,14 @@ export const startDevServer = async ({
78
78
  sourceDirectoryUrl,
79
79
  "sourceDirectoryUrl",
80
80
  )
81
- if (outDirectoryUrl === undefined && !process.env.CI) {
82
- const packageDirectoryUrl = lookupPackageDirectory(sourceDirectoryUrl)
83
- if (packageDirectoryUrl) {
84
- outDirectoryUrl = `${packageDirectoryUrl}.jsenv/`
81
+ if (outDirectoryUrl === undefined) {
82
+ if (!process.env.CI) {
83
+ const packageDirectoryUrl = lookupPackageDirectory(sourceDirectoryUrl)
84
+ if (packageDirectoryUrl) {
85
+ outDirectoryUrl = `${packageDirectoryUrl}.jsenv/`
86
+ }
85
87
  }
86
- } else {
88
+ } else if (outDirectoryUrl !== null && outDirectoryUrl !== false) {
87
89
  outDirectoryUrl = assertAndNormalizeDirectoryUrl(
88
90
  outDirectoryUrl,
89
91
  "outDirectoryUrl",
@@ -21,6 +21,7 @@
21
21
  * - "css_@import"
22
22
  * - "css_url"
23
23
  * - "js_import"
24
+ * - "js_import_script"
24
25
  * - "js_url"
25
26
  * - "js_inline_content"
26
27
  * - "sourcemap_comment"
@@ -64,7 +65,7 @@ export const jsenvPluginUrlResolution = ({
64
65
  )
65
66
  }
66
67
  if (node_esm === undefined) {
67
- node_esm = urlType === "js_module"
68
+ node_esm = urlType === "js_import" || urlType === "js_import_script"
68
69
  }
69
70
  if (web === undefined) {
70
71
  web = true
@@ -106,13 +107,19 @@ export const jsenvPluginUrlResolution = ({
106
107
  if (reference.type === "sourcemap_comment") {
107
108
  return resolveUrlUsingWebResolution(reference, context)
108
109
  }
109
- let urlType
110
+
111
+ let type
112
+ let subtype
113
+ const parentUrlInfo = context.urlGraph.getUrlInfo(reference.parentUrl)
110
114
  if (reference.injected) {
111
- urlType = reference.expectedType
115
+ type = reference.expectedType
116
+ subtype = reference.expectedSubtype
112
117
  } else {
113
- const parentUrlInfo = context.urlGraph.getUrlInfo(reference.parentUrl)
114
- urlType = parentUrlInfo ? parentUrlInfo.type : "entry_point"
118
+ type = parentUrlInfo ? parentUrlInfo.type : "entry_point"
119
+ subtype = parentUrlInfo ? parentUrlInfo.subtype : ""
115
120
  }
121
+ const urlType =
122
+ subtype === "self_import_scripts_arg" ? "js_import_script" : type
116
123
  const resolver = resolvers[urlType] || resolvers["*"]
117
124
  return resolver(reference, context)
118
125
  },