@jsenv/core 29.4.3 → 29.4.4

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
@@ -8922,34 +8922,6 @@ const parseJsUrls = async ({
8922
8922
  return jsUrls;
8923
8923
  };
8924
8924
 
8925
- const sortByDependencies = nodes => {
8926
- const visited = [];
8927
- const sorted = [];
8928
- const circular = [];
8929
- const visit = url => {
8930
- const isSorted = sorted.includes(url);
8931
- if (isSorted) {
8932
- return;
8933
- }
8934
- const isVisited = visited.includes(url);
8935
- if (isVisited) {
8936
- circular.push(url);
8937
- sorted.push(url);
8938
- } else {
8939
- visited.push(url);
8940
- nodes[url].dependencies.forEach(dependencyUrl => {
8941
- visit(dependencyUrl);
8942
- });
8943
- sorted.push(url);
8944
- }
8945
- };
8946
- Object.keys(nodes).forEach(url => {
8947
- visit(url);
8948
- });
8949
- sorted.circular = circular;
8950
- return sorted;
8951
- };
8952
-
8953
8925
  const urlSpecifierEncoding = {
8954
8926
  encode: reference => {
8955
8927
  const {
@@ -21389,6 +21361,35 @@ const jsenvPluginNodeRuntime = ({
21389
21361
  };
21390
21362
  };
21391
21363
 
21364
+ const sortByDependencies = nodes => {
21365
+ const visited = [];
21366
+ const sorted = [];
21367
+ const circular = [];
21368
+ const visit = url => {
21369
+ const isSorted = sorted.includes(url);
21370
+ if (isSorted) {
21371
+ return;
21372
+ }
21373
+ const isVisited = visited.includes(url);
21374
+ if (isVisited) {
21375
+ if (!circular.includes(url)) {
21376
+ circular.push(url);
21377
+ }
21378
+ } else {
21379
+ visited.push(url);
21380
+ nodes[url].dependencies.forEach(dependencyUrl => {
21381
+ visit(dependencyUrl);
21382
+ });
21383
+ sorted.push(url);
21384
+ }
21385
+ };
21386
+ Object.keys(nodes).forEach(url => {
21387
+ visit(url);
21388
+ });
21389
+ sorted.circular = circular;
21390
+ return sorted;
21391
+ };
21392
+
21392
21393
  /*
21393
21394
  * Each @import found in css is replaced by the file content
21394
21395
  * - There is no need to worry about urls (such as background-image: url())
@@ -22801,19 +22802,17 @@ ${globalName}.__v__ = function (specifier) {
22801
22802
  // https://github.com/rollup/rollup/blob/5a5391971d695c808eed0c5d7d2c6ccb594fc689/src/Chunk.ts#L870
22802
22803
  const createVersionGenerator = () => {
22803
22804
  const hash = createHash("sha256");
22804
- const augmentWithContent = ({
22805
- content,
22806
- contentType = "application/octet-stream",
22807
- lineBreakNormalization = false
22808
- }) => {
22809
- hash.update(lineBreakNormalization && CONTENT_TYPE.isTextual(contentType) ? normalizeLineBreaks(content) : content);
22810
- };
22811
- const augmentWithDependencyVersion = version => {
22812
- hash.update(version);
22813
- };
22814
22805
  return {
22815
- augmentWithContent,
22816
- augmentWithDependencyVersion,
22806
+ augmentWithContent: ({
22807
+ content,
22808
+ contentType = "application/octet-stream",
22809
+ lineBreakNormalization = false
22810
+ }) => {
22811
+ hash.update(lineBreakNormalization && CONTENT_TYPE.isTextual(contentType) ? normalizeLineBreaks(content) : content);
22812
+ },
22813
+ augment: value => {
22814
+ hash.update(value);
22815
+ },
22817
22816
  generate: () => {
22818
22817
  return hash.digest("hex").slice(0, 8);
22819
22818
  }
@@ -23550,6 +23549,8 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
23550
23549
  buildTask.done();
23551
23550
  }
23552
23551
  }
23552
+ const versionMap = new Map();
23553
+ const versionedUrlMap = new Map();
23553
23554
  {
23554
23555
  inject_version_in_urls: {
23555
23556
  if (!versioning) {
@@ -23559,12 +23560,13 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
23559
23560
  disabled: logger.levels.debug || !logger.levels.info
23560
23561
  });
23561
23562
  try {
23562
- const urlsSorted = sortByDependencies(finalGraph.toObject());
23563
- urlsSorted.forEach(url => {
23564
- if (url.startsWith("data:")) {
23563
+ // see also https://github.com/rollup/rollup/pull/4543
23564
+ const contentVersionMap = new Map();
23565
+ const hashCallbacks = [];
23566
+ GRAPH.forEach(finalGraph, urlInfo => {
23567
+ if (urlInfo.url.startsWith("data:")) {
23565
23568
  return;
23566
23569
  }
23567
- const urlInfo = finalGraph.getUrlInfo(url);
23568
23570
  if (urlInfo.type === "sourcemap") {
23569
23571
  return;
23570
23572
  }
@@ -23584,7 +23586,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
23584
23586
  if (!urlInfo.shouldHandle) {
23585
23587
  return;
23586
23588
  }
23587
- if (!urlInfo.isEntryPoint && urlInfo.dependents.size === 0) {
23589
+ if (urlInfo.dependents.size === 0 && !urlInfo.isEntryPoint) {
23588
23590
  return;
23589
23591
  }
23590
23592
  const urlContent = urlInfo.type === "html" ? stringifyHtmlAst(parseHtmlString(urlInfo.content, {
@@ -23592,55 +23594,78 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
23592
23594
  }), {
23593
23595
  cleanupJsenvAttributes: true
23594
23596
  }) : urlInfo.content;
23595
- const versionGenerator = createVersionGenerator();
23596
- versionGenerator.augmentWithContent({
23597
+ const contentVersionGenerator = createVersionGenerator();
23598
+ contentVersionGenerator.augmentWithContent({
23597
23599
  content: urlContent,
23598
23600
  contentType: urlInfo.contentType,
23599
23601
  lineBreakNormalization
23600
23602
  });
23601
- urlInfo.dependencies.forEach(dependencyUrl => {
23602
- // this dependency is inline
23603
- if (dependencyUrl.startsWith("data:")) {
23604
- return;
23605
- }
23606
- const dependencyUrlInfo = finalGraph.getUrlInfo(dependencyUrl);
23607
- if (
23608
- // this content is part of the file, no need to take into account twice
23609
- dependencyUrlInfo.isInline ||
23610
- // this dependency content is not known
23611
- !dependencyUrlInfo.shouldHandle) {
23612
- return;
23613
- }
23614
- if (dependencyUrlInfo.data.version) {
23615
- versionGenerator.augmentWithDependencyVersion(dependencyUrlInfo.data.version);
23603
+ const contentVersion = contentVersionGenerator.generate();
23604
+ contentVersionMap.set(urlInfo.url, contentVersion);
23605
+ const versionMutations = [];
23606
+ const seen = new Set();
23607
+ const visitReferences = urlInfo => {
23608
+ urlInfo.references.forEach(reference => {
23609
+ if (seen.has(reference)) return;
23610
+ seen.add(reference);
23611
+ const referencedUrlInfo = finalGraph.getUrlInfo(reference.url);
23612
+ versionMutations.push(() => {
23613
+ const dependencyContentVersion = contentVersionMap.get(reference.url);
23614
+ if (!dependencyContentVersion) {
23615
+ // no content generated for this dependency
23616
+ // (inline, data:, sourcemap, shouldHandle is false, ...)
23617
+ return null;
23618
+ }
23619
+ const parentUrlInfo = finalGraph.getUrlInfo(reference.parentUrl);
23620
+ if (parentUrlInfo.jsQuote) {
23621
+ // __v__() makes versioning dynamic: no need to take into account
23622
+ return null;
23623
+ }
23624
+ if (reference.type === "js_url_specifier" || reference.subtype === "import_dynamic") {
23625
+ // __v__() makes versioning dynamic: no need to take into account
23626
+ return null;
23627
+ }
23628
+ return dependencyContentVersion;
23629
+ });
23630
+ visitReferences(referencedUrlInfo);
23631
+ });
23632
+ };
23633
+ visitReferences(urlInfo);
23634
+ hashCallbacks.push(() => {
23635
+ let version;
23636
+ if (versionMutations.length === 0) {
23637
+ version = contentVersion;
23616
23638
  } else {
23617
- // because all dependencies are know, if the dependency has no version
23618
- // it means there is a circular dependency between this file
23619
- // and it's dependency
23620
- // in that case we'll use the dependency content
23621
- versionGenerator.augmentWithContent({
23622
- content: dependencyUrlInfo.content,
23623
- contentType: dependencyUrlInfo.contentType,
23624
- lineBreakNormalization
23639
+ const versionGenerator = createVersionGenerator();
23640
+ versionGenerator.augment(contentVersion);
23641
+ versionMutations.forEach(versionMutation => {
23642
+ const value = versionMutation();
23643
+ if (value) {
23644
+ versionGenerator.augment(value);
23645
+ }
23625
23646
  });
23647
+ version = versionGenerator.generate();
23626
23648
  }
23649
+ versionMap.set(urlInfo.url, version);
23650
+ const buildUrlObject = new URL(urlInfo.url);
23651
+ // remove ?as_js_classic as
23652
+ // this information is already hold into ".nomodule"
23653
+ buildUrlObject.searchParams.delete("as_js_classic");
23654
+ buildUrlObject.searchParams.delete("as_js_classic_library");
23655
+ buildUrlObject.searchParams.delete("as_json_module");
23656
+ buildUrlObject.searchParams.delete("as_css_module");
23657
+ buildUrlObject.searchParams.delete("as_text_module");
23658
+ const buildUrl = buildUrlObject.href;
23659
+ finalRedirections.set(urlInfo.url, buildUrl);
23660
+ versionedUrlMap.set(urlInfo.url, normalizeUrl(injectVersionIntoBuildUrl({
23661
+ buildUrl,
23662
+ version,
23663
+ versioningMethod
23664
+ })));
23627
23665
  });
23628
- urlInfo.data.version = versionGenerator.generate();
23629
- const buildUrlObject = new URL(urlInfo.url);
23630
- // remove ?as_js_classic as
23631
- // this information is already hold into ".nomodule"
23632
- buildUrlObject.searchParams.delete("as_js_classic");
23633
- buildUrlObject.searchParams.delete("as_js_classic_library");
23634
- buildUrlObject.searchParams.delete("as_json_module");
23635
- buildUrlObject.searchParams.delete("as_css_module");
23636
- buildUrlObject.searchParams.delete("as_text_module");
23637
- const buildUrl = buildUrlObject.href;
23638
- finalRedirections.set(urlInfo.url, buildUrl);
23639
- urlInfo.data.versionedUrl = normalizeUrl(injectVersionIntoBuildUrl({
23640
- buildUrl,
23641
- version: urlInfo.data.version,
23642
- versioningMethod
23643
- }));
23666
+ });
23667
+ hashCallbacks.forEach(callback => {
23668
+ callback();
23644
23669
  });
23645
23670
  const versionMappings = {};
23646
23671
  const usedVersionMappings = new Set();
@@ -23702,7 +23727,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
23702
23727
  if (!referencedUrlInfo.shouldHandle) {
23703
23728
  return null;
23704
23729
  }
23705
- const versionedUrl = referencedUrlInfo.data.versionedUrl;
23730
+ const versionedUrl = versionedUrlMap.get(reference.url);
23706
23731
  if (!versionedUrl) {
23707
23732
  // happens for sourcemap
23708
23733
  return `${baseUrl}${urlToRelativeUrl(referencedUrlInfo.url, buildDirectoryUrl)}`;
@@ -23909,34 +23934,18 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
23909
23934
  if (!urlInfo.url.startsWith("file:")) {
23910
23935
  return;
23911
23936
  }
23912
- const versionedUrl = urlInfo.data.versionedUrl;
23913
- if (!versionedUrl) {
23937
+ if (!canUseVersionedUrl(urlInfo)) {
23914
23938
  // when url is not versioned we compute a "version" for that url anyway
23915
23939
  // so that service worker source still changes and navigator
23916
23940
  // detect there is a change
23917
- const versionGenerator = createVersionGenerator();
23918
- versionGenerator.augmentWithContent({
23919
- content: urlInfo.content,
23920
- contentType: urlInfo.contentType,
23921
- lineBreakNormalization
23922
- });
23923
- const version = versionGenerator.generate();
23924
- urlInfo.data.version = version;
23925
- const specifier = findKey(buildUrls, urlInfo.url);
23926
- serviceWorkerUrls[specifier] = {
23927
- versioned: false,
23928
- version
23929
- };
23930
- return;
23931
- }
23932
- if (!canUseVersionedUrl(urlInfo)) {
23933
23941
  const specifier = findKey(buildUrls, urlInfo.url);
23934
23942
  serviceWorkerUrls[specifier] = {
23935
23943
  versioned: false,
23936
- version: urlInfo.data.version
23944
+ version: versionMap.get(urlInfo.url)
23937
23945
  };
23938
23946
  return;
23939
23947
  }
23948
+ const versionedUrl = versionedUrlMap.get(urlInfo.url);
23940
23949
  const versionedSpecifier = findKey(buildUrls, versionedUrl);
23941
23950
  serviceWorkerUrls[versionedSpecifier] = {
23942
23951
  versioned: true
@@ -23980,7 +23989,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
23980
23989
  const buildRelativeUrl = urlToRelativeUrl(urlInfo.url, buildDirectoryUrl);
23981
23990
  buildInlineContents[buildRelativeUrl] = urlInfo.content;
23982
23991
  } else {
23983
- const versionedUrl = urlInfo.data.versionedUrl;
23992
+ const versionedUrl = versionedUrlMap.get(urlInfo.url);
23984
23993
  if (versionedUrl && canUseVersionedUrl(urlInfo)) {
23985
23994
  const buildRelativeUrl = urlToRelativeUrl(urlInfo.url, buildDirectoryUrl);
23986
23995
  const versionedBuildRelativeUrl = urlToRelativeUrl(versionedUrl, buildDirectoryUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "29.4.3",
3
+ "version": "29.4.4",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -50,7 +50,6 @@ import {
50
50
  removeHtmlNode,
51
51
  } from "@jsenv/ast"
52
52
 
53
- import { sortByDependencies } from "../kitchen/url_graph/sort_by_dependencies.js"
54
53
  import { createUrlGraph } from "../kitchen/url_graph.js"
55
54
  import { createKitchen } from "../kitchen/kitchen.js"
56
55
  import { createUrlGraphLoader } from "../kitchen/url_graph/url_graph_loader.js"
@@ -851,6 +850,8 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
851
850
  }
852
851
  }
853
852
 
853
+ const versionMap = new Map()
854
+ const versionedUrlMap = new Map()
854
855
  refine: {
855
856
  inject_version_in_urls: {
856
857
  if (!versioning) {
@@ -860,12 +861,13 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
860
861
  disabled: logger.levels.debug || !logger.levels.info,
861
862
  })
862
863
  try {
863
- const urlsSorted = sortByDependencies(finalGraph.toObject())
864
- urlsSorted.forEach((url) => {
865
- if (url.startsWith("data:")) {
864
+ // see also https://github.com/rollup/rollup/pull/4543
865
+ const contentVersionMap = new Map()
866
+ const hashCallbacks = []
867
+ GRAPH.forEach(finalGraph, (urlInfo) => {
868
+ if (urlInfo.url.startsWith("data:")) {
866
869
  return
867
870
  }
868
- const urlInfo = finalGraph.getUrlInfo(url)
869
871
  if (urlInfo.type === "sourcemap") {
870
872
  return
871
873
  }
@@ -885,7 +887,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
885
887
  if (!urlInfo.shouldHandle) {
886
888
  return
887
889
  }
888
- if (!urlInfo.isEntryPoint && urlInfo.dependents.size === 0) {
890
+ if (urlInfo.dependents.size === 0 && !urlInfo.isEntryPoint) {
889
891
  return
890
892
  }
891
893
  const urlContent =
@@ -897,62 +899,93 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
897
899
  { cleanupJsenvAttributes: true },
898
900
  )
899
901
  : urlInfo.content
900
- const versionGenerator = createVersionGenerator()
901
- versionGenerator.augmentWithContent({
902
+ const contentVersionGenerator = createVersionGenerator()
903
+ contentVersionGenerator.augmentWithContent({
902
904
  content: urlContent,
903
905
  contentType: urlInfo.contentType,
904
906
  lineBreakNormalization,
905
907
  })
906
- urlInfo.dependencies.forEach((dependencyUrl) => {
907
- // this dependency is inline
908
- if (dependencyUrl.startsWith("data:")) {
909
- return
910
- }
911
- const dependencyUrlInfo = finalGraph.getUrlInfo(dependencyUrl)
912
- if (
913
- // this content is part of the file, no need to take into account twice
914
- dependencyUrlInfo.isInline ||
915
- // this dependency content is not known
916
- !dependencyUrlInfo.shouldHandle
917
- ) {
918
- return
919
- }
920
- if (dependencyUrlInfo.data.version) {
921
- versionGenerator.augmentWithDependencyVersion(
922
- dependencyUrlInfo.data.version,
923
- )
908
+ const contentVersion = contentVersionGenerator.generate()
909
+ contentVersionMap.set(urlInfo.url, contentVersion)
910
+ const versionMutations = []
911
+ const seen = new Set()
912
+ const visitReferences = (urlInfo) => {
913
+ urlInfo.references.forEach((reference) => {
914
+ if (seen.has(reference)) return
915
+ seen.add(reference)
916
+ const referencedUrlInfo = finalGraph.getUrlInfo(reference.url)
917
+ versionMutations.push(() => {
918
+ const dependencyContentVersion = contentVersionMap.get(
919
+ reference.url,
920
+ )
921
+ if (!dependencyContentVersion) {
922
+ // no content generated for this dependency
923
+ // (inline, data:, sourcemap, shouldHandle is false, ...)
924
+ return null
925
+ }
926
+ const parentUrlInfo = finalGraph.getUrlInfo(
927
+ reference.parentUrl,
928
+ )
929
+ if (parentUrlInfo.jsQuote) {
930
+ // __v__() makes versioning dynamic: no need to take into account
931
+ return null
932
+ }
933
+ if (
934
+ reference.type === "js_url_specifier" ||
935
+ reference.subtype === "import_dynamic"
936
+ ) {
937
+ // __v__() makes versioning dynamic: no need to take into account
938
+ return null
939
+ }
940
+ return dependencyContentVersion
941
+ })
942
+ visitReferences(referencedUrlInfo)
943
+ })
944
+ }
945
+ visitReferences(urlInfo)
946
+
947
+ hashCallbacks.push(() => {
948
+ let version
949
+ if (versionMutations.length === 0) {
950
+ version = contentVersion
924
951
  } else {
925
- // because all dependencies are know, if the dependency has no version
926
- // it means there is a circular dependency between this file
927
- // and it's dependency
928
- // in that case we'll use the dependency content
929
- versionGenerator.augmentWithContent({
930
- content: dependencyUrlInfo.content,
931
- contentType: dependencyUrlInfo.contentType,
932
- lineBreakNormalization,
952
+ const versionGenerator = createVersionGenerator()
953
+ versionGenerator.augment(contentVersion)
954
+ versionMutations.forEach((versionMutation) => {
955
+ const value = versionMutation()
956
+ if (value) {
957
+ versionGenerator.augment(value)
958
+ }
933
959
  })
960
+ version = versionGenerator.generate()
934
961
  }
962
+ versionMap.set(urlInfo.url, version)
963
+ const buildUrlObject = new URL(urlInfo.url)
964
+ // remove ?as_js_classic as
965
+ // this information is already hold into ".nomodule"
966
+ buildUrlObject.searchParams.delete("as_js_classic")
967
+ buildUrlObject.searchParams.delete("as_js_classic_library")
968
+ buildUrlObject.searchParams.delete("as_json_module")
969
+ buildUrlObject.searchParams.delete("as_css_module")
970
+ buildUrlObject.searchParams.delete("as_text_module")
971
+ const buildUrl = buildUrlObject.href
972
+ finalRedirections.set(urlInfo.url, buildUrl)
973
+ versionedUrlMap.set(
974
+ urlInfo.url,
975
+ normalizeUrl(
976
+ injectVersionIntoBuildUrl({
977
+ buildUrl,
978
+ version,
979
+ versioningMethod,
980
+ }),
981
+ ),
982
+ )
935
983
  })
936
- urlInfo.data.version = versionGenerator.generate()
937
-
938
- const buildUrlObject = new URL(urlInfo.url)
939
- // remove ?as_js_classic as
940
- // this information is already hold into ".nomodule"
941
- buildUrlObject.searchParams.delete("as_js_classic")
942
- buildUrlObject.searchParams.delete("as_js_classic_library")
943
- buildUrlObject.searchParams.delete("as_json_module")
944
- buildUrlObject.searchParams.delete("as_css_module")
945
- buildUrlObject.searchParams.delete("as_text_module")
946
- const buildUrl = buildUrlObject.href
947
- finalRedirections.set(urlInfo.url, buildUrl)
948
- urlInfo.data.versionedUrl = normalizeUrl(
949
- injectVersionIntoBuildUrl({
950
- buildUrl,
951
- version: urlInfo.data.version,
952
- versioningMethod,
953
- }),
954
- )
955
984
  })
985
+ hashCallbacks.forEach((callback) => {
986
+ callback()
987
+ })
988
+
956
989
  const versionMappings = {}
957
990
  const usedVersionMappings = new Set()
958
991
  const versioningKitchen = createKitchen({
@@ -1019,7 +1052,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
1019
1052
  if (!referencedUrlInfo.shouldHandle) {
1020
1053
  return null
1021
1054
  }
1022
- const versionedUrl = referencedUrlInfo.data.versionedUrl
1055
+ const versionedUrl = versionedUrlMap.get(reference.url)
1023
1056
  if (!versionedUrl) {
1024
1057
  // happens for sourcemap
1025
1058
  return `${baseUrl}${urlToRelativeUrl(
@@ -1284,31 +1317,18 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
1284
1317
  if (!urlInfo.url.startsWith("file:")) {
1285
1318
  return
1286
1319
  }
1287
- const versionedUrl = urlInfo.data.versionedUrl
1288
- if (!versionedUrl) {
1320
+ if (!canUseVersionedUrl(urlInfo)) {
1289
1321
  // when url is not versioned we compute a "version" for that url anyway
1290
1322
  // so that service worker source still changes and navigator
1291
1323
  // detect there is a change
1292
- const versionGenerator = createVersionGenerator()
1293
- versionGenerator.augmentWithContent({
1294
- content: urlInfo.content,
1295
- contentType: urlInfo.contentType,
1296
- lineBreakNormalization,
1297
- })
1298
- const version = versionGenerator.generate()
1299
- urlInfo.data.version = version
1300
- const specifier = findKey(buildUrls, urlInfo.url)
1301
- serviceWorkerUrls[specifier] = { versioned: false, version }
1302
- return
1303
- }
1304
- if (!canUseVersionedUrl(urlInfo)) {
1305
1324
  const specifier = findKey(buildUrls, urlInfo.url)
1306
1325
  serviceWorkerUrls[specifier] = {
1307
1326
  versioned: false,
1308
- version: urlInfo.data.version,
1327
+ version: versionMap.get(urlInfo.url),
1309
1328
  }
1310
1329
  return
1311
1330
  }
1331
+ const versionedUrl = versionedUrlMap.get(urlInfo.url)
1312
1332
  const versionedSpecifier = findKey(buildUrls, versionedUrl)
1313
1333
  serviceWorkerUrls[versionedSpecifier] = { versioned: true }
1314
1334
  })
@@ -1365,7 +1385,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
1365
1385
  )
1366
1386
  buildInlineContents[buildRelativeUrl] = urlInfo.content
1367
1387
  } else {
1368
- const versionedUrl = urlInfo.data.versionedUrl
1388
+ const versionedUrl = versionedUrlMap.get(urlInfo.url)
1369
1389
  if (versionedUrl && canUseVersionedUrl(urlInfo)) {
1370
1390
  const buildRelativeUrl = urlToRelativeUrl(
1371
1391
  urlInfo.url,
@@ -7,25 +7,21 @@ import { CONTENT_TYPE } from "@jsenv/utils/src/content_type/content_type.js"
7
7
  export const createVersionGenerator = () => {
8
8
  const hash = createHash("sha256")
9
9
 
10
- const augmentWithContent = ({
11
- content,
12
- contentType = "application/octet-stream",
13
- lineBreakNormalization = false,
14
- }) => {
15
- hash.update(
16
- lineBreakNormalization && CONTENT_TYPE.isTextual(contentType)
17
- ? normalizeLineBreaks(content)
18
- : content,
19
- )
20
- }
21
-
22
- const augmentWithDependencyVersion = (version) => {
23
- hash.update(version)
24
- }
25
-
26
10
  return {
27
- augmentWithContent,
28
- augmentWithDependencyVersion,
11
+ augmentWithContent: ({
12
+ content,
13
+ contentType = "application/octet-stream",
14
+ lineBreakNormalization = false,
15
+ }) => {
16
+ hash.update(
17
+ lineBreakNormalization && CONTENT_TYPE.isTextual(contentType)
18
+ ? normalizeLineBreaks(content)
19
+ : content,
20
+ )
21
+ },
22
+ augment: (value) => {
23
+ hash.update(value)
24
+ },
29
25
  generate: () => {
30
26
  return hash.digest("hex").slice(0, 8)
31
27
  },
@@ -9,8 +9,9 @@ export const sortByDependencies = (nodes) => {
9
9
  }
10
10
  const isVisited = visited.includes(url)
11
11
  if (isVisited) {
12
- circular.push(url)
13
- sorted.push(url)
12
+ if (!circular.includes(url)) {
13
+ circular.push(url)
14
+ }
14
15
  } else {
15
16
  visited.push(url)
16
17
  nodes[url].dependencies.forEach((dependencyUrl) => {