@jsenv/core 41.5.26 → 41.5.28

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.
@@ -11555,6 +11555,11 @@ const createBuildSpecifierManager = ({
11555
11555
  // when versioning is dynamic no need to take into account
11556
11556
  continue;
11557
11557
  }
11558
+ if (referenceVersioningInfo.type === "not_versioned") {
11559
+ // the specifier is emitted bare (entry point, webmanifest, ...):
11560
+ // the referencing file's bytes cannot change with that file's content
11561
+ continue;
11562
+ }
11558
11563
  placeholderInfluencingVersionSet.add(containedPlaceholder);
11559
11564
  const referencedUrlInfo = reference.urlInfo;
11560
11565
  visitContainedPlaceholders(referencedUrlInfo);
@@ -13847,6 +13852,29 @@ const prepareEntryPointBuild = async (
13847
13852
  if (!otherEntryBuildInfo) {
13848
13853
  return null;
13849
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
+ }
13850
13878
  urlInfo.otherEntryBuildInfo = otherEntryBuildInfo;
13851
13879
  return {
13852
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.26",
3
+ "version": "41.5.28",
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
@@ -626,6 +626,11 @@ export const createBuildSpecifierManager = ({
626
626
  // when versioning is dynamic no need to take into account
627
627
  continue;
628
628
  }
629
+ if (referenceVersioningInfo.type === "not_versioned") {
630
+ // the specifier is emitted bare (entry point, webmanifest, ...):
631
+ // the referencing file's bytes cannot change with that file's content
632
+ continue;
633
+ }
629
634
  placeholderInfluencingVersionSet.add(containedPlaceholder);
630
635
  const referencedUrlInfo = reference.urlInfo;
631
636
  visitContainedPlaceholders(referencedUrlInfo);