@jsenv/core 41.5.27 → 41.5.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.
@@ -13852,6 +13852,29 @@ const prepareEntryPointBuild = async (
13852
13852
  if (!otherEntryBuildInfo) {
13853
13853
  return null;
13854
13854
  }
13855
+ if (urlInfo.subtypeHint === "service_worker") {
13856
+ // A registered service worker is already an entry of the build
13857
+ // registering it: that build owns its bundle and the resources list
13858
+ // it precaches. A second owner from "entryPoints" would receive
13859
+ // neither, so the configuration is refused.
13860
+ const workerRelativeUrl = urlToRelativeUrl(
13861
+ urlInfo.url,
13862
+ sourceDirectoryUrl,
13863
+ );
13864
+ const registeringRelativeUrl = urlToRelativeUrl(
13865
+ urlInfo.firstReference.ownerUrlInfo.url,
13866
+ sourceDirectoryUrl,
13867
+ );
13868
+ throw new Error(
13869
+ createDetailedMessage(
13870
+ `"${workerRelativeUrl}" is registered as a service worker and declared in "entryPoints"`,
13871
+ {
13872
+ "registered by": registeringRelativeUrl,
13873
+ "suggestion": `remove "./${workerRelativeUrl}" from "entryPoints": a registered service worker is built as its own entry by the build registering it, and its "injections" go under "${sourceRelativeUrl}" keyed by "./${workerRelativeUrl}"`,
13874
+ },
13875
+ ),
13876
+ );
13877
+ }
13855
13878
  urlInfo.otherEntryBuildInfo = otherEntryBuildInfo;
13856
13879
  return {
13857
13880
  type: "entry_build", // this ensure the rest of jsenv do not try to scan or modify the content
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "41.5.27",
3
+ "version": "41.5.29",
4
4
  "type": "module",
5
5
  "description": "Tool to develop, test and build js projects",
6
6
  "repository": {
@@ -29,6 +29,7 @@ import {
29
29
  } from "@jsenv/filesystem";
30
30
  import {
31
31
  ANSI,
32
+ createDetailedMessage,
32
33
  createDynamicLog,
33
34
  createLogger,
34
35
  createTaskLog,
@@ -1234,6 +1235,29 @@ const prepareEntryPointBuild = async (
1234
1235
  if (!otherEntryBuildInfo) {
1235
1236
  return null;
1236
1237
  }
1238
+ if (urlInfo.subtypeHint === "service_worker") {
1239
+ // A registered service worker is already an entry of the build
1240
+ // registering it: that build owns its bundle and the resources list
1241
+ // it precaches. A second owner from "entryPoints" would receive
1242
+ // neither, so the configuration is refused.
1243
+ const workerRelativeUrl = urlToRelativeUrl(
1244
+ urlInfo.url,
1245
+ sourceDirectoryUrl,
1246
+ );
1247
+ const registeringRelativeUrl = urlToRelativeUrl(
1248
+ urlInfo.firstReference.ownerUrlInfo.url,
1249
+ sourceDirectoryUrl,
1250
+ );
1251
+ throw new Error(
1252
+ createDetailedMessage(
1253
+ `"${workerRelativeUrl}" is registered as a service worker and declared in "entryPoints"`,
1254
+ {
1255
+ "registered by": registeringRelativeUrl,
1256
+ "suggestion": `remove "./${workerRelativeUrl}" from "entryPoints": a registered service worker is built as its own entry by the build registering it, and its "injections" go under "${sourceRelativeUrl}" keyed by "./${workerRelativeUrl}"`,
1257
+ },
1258
+ ),
1259
+ );
1260
+ }
1237
1261
  urlInfo.otherEntryBuildInfo = otherEntryBuildInfo;
1238
1262
  return {
1239
1263
  type: "entry_build", // this ensure the rest of jsenv do not try to scan or modify the content