@jsenv/core 41.4.28 → 41.4.29

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.
@@ -12154,6 +12154,25 @@ const splitFileExtension = (filename) => {
12154
12154
  return [filename.slice(0, dotLastIndex), filename.slice(dotLastIndex)];
12155
12155
  };
12156
12156
 
12157
+ const resolveImportIdPath = (ownerUrlInfo, dynamicImportId) => {
12158
+ const ancestorImportIds = [];
12159
+ let ancestorUrlInfo = ownerUrlInfo;
12160
+ let currentImportId = dynamicImportId;
12161
+ while (ancestorUrlInfo) {
12162
+ const ancestorDynamicImportId =
12163
+ ancestorUrlInfo.searchParams.get("dynamic_import_id");
12164
+ if (!ancestorDynamicImportId) {
12165
+ break;
12166
+ }
12167
+ if (ancestorDynamicImportId !== currentImportId) {
12168
+ ancestorImportIds.push(ancestorDynamicImportId);
12169
+ currentImportId = ancestorDynamicImportId;
12170
+ }
12171
+ ancestorUrlInfo = ancestorUrlInfo.firstReference?.ownerUrlInfo;
12172
+ }
12173
+ return [...ancestorImportIds, dynamicImportId].join("/");
12174
+ };
12175
+
12157
12176
  const determineDirectoryPath = ({
12158
12177
  sourceDirectoryUrl,
12159
12178
  assetsDirectory,
@@ -12176,23 +12195,24 @@ const determineDirectoryPath = ({
12176
12195
  }
12177
12196
  const dynamicImportId = urlInfo.searchParams.get("dynamic_import_id");
12178
12197
  if (dynamicImportId) {
12179
- const ancestorImportIds = [];
12180
- let ancestorUrlInfo = ownerUrlInfo;
12181
- let currentImportId = dynamicImportId;
12182
- while (ancestorUrlInfo) {
12183
- const ancestorDynamicImportId =
12184
- ancestorUrlInfo.searchParams.get("dynamic_import_id");
12185
- if (!ancestorDynamicImportId) {
12186
- break;
12187
- }
12188
- if (ancestorDynamicImportId !== currentImportId) {
12189
- ancestorImportIds.push(ancestorDynamicImportId);
12190
- currentImportId = ancestorDynamicImportId;
12191
- }
12192
- ancestorUrlInfo = ancestorUrlInfo.firstReference?.ownerUrlInfo;
12198
+ // Inside the isolated group that asked for it — but only while ONE did.
12199
+ // A chunk several groups reach belongs to none of them: put inside the
12200
+ // first asker it would move the day another one asks first, and the others
12201
+ // would import it out of a sibling's directory.
12202
+ const importIdPathSet = new Set();
12203
+ for (const referenceFromOther of urlInfo.referenceFromOthersSet) {
12204
+ importIdPathSet.add(
12205
+ resolveImportIdPath(referenceFromOther.ownerUrlInfo, dynamicImportId),
12206
+ );
12207
+ }
12208
+ if (importIdPathSet.size === 0) {
12209
+ importIdPathSet.add(resolveImportIdPath(ownerUrlInfo, dynamicImportId));
12210
+ }
12211
+ if (importIdPathSet.size === 1) {
12212
+ const [importIdPath] = importIdPathSet;
12213
+ return `${assetsDirectory}${importIdPath}/`;
12193
12214
  }
12194
- const importIdPath = [...ancestorImportIds, dynamicImportId].join("/");
12195
- return `${assetsDirectory}${importIdPath}/`;
12215
+ return `${assetsDirectory}${dynamicImportId}/`;
12196
12216
  }
12197
12217
  if (urlInfo.isEntryPoint && !urlInfo.isDynamicEntryPoint) {
12198
12218
  return "";
@@ -12943,12 +12963,10 @@ entryPoints: {
12943
12963
  for (const entryPoint of entryPointArray) {
12944
12964
  let { runtimeCompat } = entryPoint.params;
12945
12965
  if (runtimeCompat === undefined) {
12946
- const runtimeCompatFromPackage = inferRuntimeCompatFromClosestPackage(
12947
- entryPoint.sourceUrl,
12948
- {
12966
+ const runtimeCompatFromPackage =
12967
+ await inferRuntimeCompatFromClosestPackage(entryPoint.sourceUrl, {
12949
12968
  runtimeType: entryPoint.runtimeType,
12950
- },
12951
- );
12969
+ });
12952
12970
  if (runtimeCompatFromPackage) {
12953
12971
  entryPoint.params.runtimeCompat = runtimeCompat =
12954
12972
  runtimeCompatFromPackage;
@@ -6786,6 +6786,7 @@ const featuresCompatMap = {
6786
6786
  samsung: "15",
6787
6787
  firefox: "108",
6788
6788
  safari: "16.4",
6789
+ ios_safari: "16.4",
6789
6790
  },
6790
6791
  import_type_json: {
6791
6792
  chrome: "123",
@@ -6812,6 +6813,7 @@ const featuresCompatMap = {
6812
6813
  safari: "4",
6813
6814
  ios_safari: "5",
6814
6815
  android: "4.4",
6816
+ samsung: "4",
6815
6817
  },
6816
6818
  // https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker#browser_compatibility
6817
6819
  worker_type_module: {
@@ -6829,6 +6831,7 @@ const featuresCompatMap = {
6829
6831
  opera: "27",
6830
6832
  ios_safari: "11.3",
6831
6833
  android: "12.12",
6834
+ samsung: "4",
6832
6835
  },
6833
6836
  service_worker_type_module: {
6834
6837
  chrome: "80",
@@ -6881,6 +6884,7 @@ const featuresCompatMap = {
6881
6884
  ios_safari: "9",
6882
6885
  android: "4",
6883
6886
  node: "4",
6887
+ samsung: "4",
6884
6888
  },
6885
6889
  arrow_function: {
6886
6890
  chrome: "47",
@@ -7016,7 +7020,7 @@ const inferRuntimeCompatFromClosestPackage = async (
7016
7020
  if (!browserslistQuery) {
7017
7021
  return null;
7018
7022
  }
7019
- const namespace = await import("./browserslist_index_1/browserslist_index2.js");
7023
+ const namespace = await import("../browserslist_index/browserslist_index.js");
7020
7024
  const browserslist = namespace.default;
7021
7025
  const browserslistResult = browserslist(browserslistQuery);
7022
7026
  const runtimeCompat = {};
@@ -5034,6 +5034,7 @@ const featuresCompatMap = {
5034
5034
  samsung: "15",
5035
5035
  firefox: "108",
5036
5036
  safari: "16.4",
5037
+ ios_safari: "16.4",
5037
5038
  },
5038
5039
  import_type_json: {
5039
5040
  chrome: "123",
@@ -5060,6 +5061,7 @@ const featuresCompatMap = {
5060
5061
  safari: "4",
5061
5062
  ios_safari: "5",
5062
5063
  android: "4.4",
5064
+ samsung: "4",
5063
5065
  },
5064
5066
  // https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker#browser_compatibility
5065
5067
  worker_type_module: {
@@ -5077,6 +5079,7 @@ const featuresCompatMap = {
5077
5079
  opera: "27",
5078
5080
  ios_safari: "11.3",
5079
5081
  android: "12.12",
5082
+ samsung: "4",
5080
5083
  },
5081
5084
  service_worker_type_module: {
5082
5085
  chrome: "80",
@@ -5129,6 +5132,7 @@ const featuresCompatMap = {
5129
5132
  ios_safari: "9",
5130
5133
  android: "4",
5131
5134
  node: "4",
5135
+ samsung: "4",
5132
5136
  },
5133
5137
  arrow_function: {
5134
5138
  chrome: "47",
@@ -5264,7 +5268,7 @@ const inferRuntimeCompatFromClosestPackage = async (
5264
5268
  if (!browserslistQuery) {
5265
5269
  return null;
5266
5270
  }
5267
- const namespace = await import("./browserslist_index/browserslist_index.js");
5271
+ const namespace = await import("../browserslist_index/browserslist_index.js");
5268
5272
  const browserslist = namespace.default;
5269
5273
  const browserslistResult = browserslist(browserslistQuery);
5270
5274
  const runtimeCompat = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "41.4.28",
3
+ "version": "41.4.29",
4
4
  "type": "module",
5
5
  "description": "Tool to develop, test and build js projects",
6
6
  "repository": {
@@ -75,7 +75,7 @@
75
75
  "dependencies": {
76
76
  "@jsenv/ast": "6.9.3",
77
77
  "@jsenv/js-module-fallback": "1.5.2",
78
- "@jsenv/plugin-bundling": "2.10.18",
78
+ "@jsenv/plugin-bundling": "2.10.19",
79
79
  "@jsenv/plugin-minification": "1.7.11",
80
80
  "@jsenv/plugin-supervisor": "1.8.14",
81
81
  "@jsenv/plugin-transpilation": "1.6.4",
@@ -679,12 +679,10 @@ entryPoints: {
679
679
  for (const entryPoint of entryPointArray) {
680
680
  let { runtimeCompat } = entryPoint.params;
681
681
  if (runtimeCompat === undefined) {
682
- const runtimeCompatFromPackage = inferRuntimeCompatFromClosestPackage(
683
- entryPoint.sourceUrl,
684
- {
682
+ const runtimeCompatFromPackage =
683
+ await inferRuntimeCompatFromClosestPackage(entryPoint.sourceUrl, {
685
684
  runtimeType: entryPoint.runtimeType,
686
- },
687
- );
685
+ });
688
686
  if (runtimeCompatFromPackage) {
689
687
  entryPoint.params.runtimeCompat = runtimeCompat =
690
688
  runtimeCompatFromPackage;
@@ -154,6 +154,25 @@ const splitFileExtension = (filename) => {
154
154
  return [filename.slice(0, dotLastIndex), filename.slice(dotLastIndex)];
155
155
  };
156
156
 
157
+ const resolveImportIdPath = (ownerUrlInfo, dynamicImportId) => {
158
+ const ancestorImportIds = [];
159
+ let ancestorUrlInfo = ownerUrlInfo;
160
+ let currentImportId = dynamicImportId;
161
+ while (ancestorUrlInfo) {
162
+ const ancestorDynamicImportId =
163
+ ancestorUrlInfo.searchParams.get("dynamic_import_id");
164
+ if (!ancestorDynamicImportId) {
165
+ break;
166
+ }
167
+ if (ancestorDynamicImportId !== currentImportId) {
168
+ ancestorImportIds.push(ancestorDynamicImportId);
169
+ currentImportId = ancestorDynamicImportId;
170
+ }
171
+ ancestorUrlInfo = ancestorUrlInfo.firstReference?.ownerUrlInfo;
172
+ }
173
+ return [...ancestorImportIds, dynamicImportId].join("/");
174
+ };
175
+
157
176
  const determineDirectoryPath = ({
158
177
  sourceDirectoryUrl,
159
178
  assetsDirectory,
@@ -176,23 +195,24 @@ const determineDirectoryPath = ({
176
195
  }
177
196
  const dynamicImportId = urlInfo.searchParams.get("dynamic_import_id");
178
197
  if (dynamicImportId) {
179
- const ancestorImportIds = [];
180
- let ancestorUrlInfo = ownerUrlInfo;
181
- let currentImportId = dynamicImportId;
182
- while (ancestorUrlInfo) {
183
- const ancestorDynamicImportId =
184
- ancestorUrlInfo.searchParams.get("dynamic_import_id");
185
- if (!ancestorDynamicImportId) {
186
- break;
187
- }
188
- if (ancestorDynamicImportId !== currentImportId) {
189
- ancestorImportIds.push(ancestorDynamicImportId);
190
- currentImportId = ancestorDynamicImportId;
191
- }
192
- ancestorUrlInfo = ancestorUrlInfo.firstReference?.ownerUrlInfo;
198
+ // Inside the isolated group that asked for it — but only while ONE did.
199
+ // A chunk several groups reach belongs to none of them: put inside the
200
+ // first asker it would move the day another one asks first, and the others
201
+ // would import it out of a sibling's directory.
202
+ const importIdPathSet = new Set();
203
+ for (const referenceFromOther of urlInfo.referenceFromOthersSet) {
204
+ importIdPathSet.add(
205
+ resolveImportIdPath(referenceFromOther.ownerUrlInfo, dynamicImportId),
206
+ );
207
+ }
208
+ if (importIdPathSet.size === 0) {
209
+ importIdPathSet.add(resolveImportIdPath(ownerUrlInfo, dynamicImportId));
210
+ }
211
+ if (importIdPathSet.size === 1) {
212
+ const [importIdPath] = importIdPathSet;
213
+ return `${assetsDirectory}${importIdPath}/`;
193
214
  }
194
- const importIdPath = [...ancestorImportIds, dynamicImportId].join("/");
195
- return `${assetsDirectory}${importIdPath}/`;
215
+ return `${assetsDirectory}${dynamicImportId}/`;
196
216
  }
197
217
  if (urlInfo.isEntryPoint && !urlInfo.isDynamicEntryPoint) {
198
218
  return "";