@jsenv/core 41.5.4 → 41.5.6

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.
@@ -1,10 +1,10 @@
1
1
  import { parseHtml, injectHtmlNodeAsEarlyAsPossible, createHtmlNode, stringifyHtmlAst, applyBabelPlugins, generateUrlForInlineContent, injectJsenvScript, parseJsWithAcorn, visitHtmlNodes, analyzeScriptNode, getHtmlNodeText, getHtmlNodeAttribute, getHtmlNodePosition, getUrlForContentInsideHtml, setHtmlNodeAttributes, setHtmlNodeText, parseCssUrls, getHtmlNodeAttributePosition, parseSrcSet, removeHtmlNodeText, parseJsUrls, getUrlForContentInsideJs, renderCssTemplateLiteral, visitJsAst, getImportMetaPropertyName, visitJsAstUntil, analyzeLinkNode, findHtmlNode, removeHtmlNode, insertHtmlNodeAfter } from "@jsenv/ast";
2
+ import { lookupPackageDirectory, urlIsOrIsInsideOf, registerDirectoryLifecycle, urlToRelativeUrl, createDetailedMessage, stringifyUrlSite, generateContentFrame, validateResponseIntegrity, ensureWindowsDriveLetter, setUrlFilename, moveUrl, getCallerPosition, urlToBasename, urlToExtension, asSpecifierWithoutSearch, asUrlWithoutSearch, injectQueryParamsIntoSpecifier, bufferToEtag, isFileSystemPath, urlToPathname, setUrlBasename, urlToFileSystemPath, writeFileSync, createLogger, URL_META, applyNodeEsmResolution, normalizeUrl, ANSI, RUNTIME_COMPAT, CONTENT_TYPE, readPackageAtOrNull, urlToFilename, DATA_URL, errorToHTML, normalizeImportMap, composeTwoImportMaps, resolveImport, JS_QUOTES, readCustomConditionsFromProcessArgs, collectFiles, readEntryStatSync, applyFileSystemMagicResolution, getExtensionsToTry, ensurePathnameTrailingSlash, compareFileUrls, setUrlExtension, isSpecifierForNodeBuiltin, injectQueryParams, renderDetails, humanizeDuration, humanizeFileSize, renderTable, renderBigSection, distributePercentages, humanizeMemory, comparePathnames, UNICODE, escapeRegexpSpecialChars, injectQueryParamIntoSpecifierWithoutEncoding, renderUrlOrRelativeUrlFilename, assertAndNormalizeDirectoryUrl, Abort, raceProcessTeardownEvents, startMonitoringMemoryUsage, inferRuntimeCompatFromClosestPackage, browserDefaultRuntimeCompat, nodeDefaultRuntimeCompat, clearDirectorySync, createTaskLog, createLookupPackageDirectory, ensureEmptyDirectory, updateJsonFileSync, createDynamicLog } from "./jsenv_core_packages.js";
2
3
  import { bundleJsModules, jsenvPluginBundling } from "@jsenv/plugin-bundling";
3
4
  import { jsenvPluginMinification } from "@jsenv/plugin-minification";
4
5
  import { jsenvPluginTranspilation, jsenvPluginJsModuleFallback } from "@jsenv/plugin-transpilation";
5
6
  import { memoryUsage } from "node:process";
6
7
  import { readFileSync, existsSync, realpathSync, readdirSync, lstatSync, statSync } from "node:fs";
7
- import { lookupPackageDirectory, urlIsOrIsInsideOf, registerDirectoryLifecycle, urlToRelativeUrl, createDetailedMessage, stringifyUrlSite, generateContentFrame, validateResponseIntegrity, ensureWindowsDriveLetter, setUrlFilename, moveUrl, getCallerPosition, urlToBasename, urlToExtension, asSpecifierWithoutSearch, asUrlWithoutSearch, injectQueryParamsIntoSpecifier, bufferToEtag, isFileSystemPath, urlToPathname, setUrlBasename, urlToFileSystemPath, writeFileSync, createLogger, URL_META, applyNodeEsmResolution, normalizeUrl, ANSI, RUNTIME_COMPAT, CONTENT_TYPE, readPackageAtOrNull, urlToFilename, DATA_URL, errorToHTML, normalizeImportMap, composeTwoImportMaps, resolveImport, JS_QUOTES, readCustomConditionsFromProcessArgs, collectFiles, readEntryStatSync, applyFileSystemMagicResolution, getExtensionsToTry, ensurePathnameTrailingSlash, compareFileUrls, setUrlExtension, isSpecifierForNodeBuiltin, injectQueryParams, renderDetails, humanizeDuration, humanizeFileSize, renderTable, renderBigSection, distributePercentages, humanizeMemory, comparePathnames, UNICODE, escapeRegexpSpecialChars, injectQueryParamIntoSpecifierWithoutEncoding, renderUrlOrRelativeUrlFilename, assertAndNormalizeDirectoryUrl, Abort, raceProcessTeardownEvents, startMonitoringMemoryUsage, inferRuntimeCompatFromClosestPackage, browserDefaultRuntimeCompat, nodeDefaultRuntimeCompat, clearDirectorySync, createTaskLog, createLookupPackageDirectory, ensureEmptyDirectory, updateJsonFileSync, createDynamicLog } from "./jsenv_core_packages.js";
8
8
  import { pathToFileURL } from "node:url";
9
9
  import { generateSourcemapFileUrl, createMagicSource, composeTwoSourcemaps, generateSourcemapDataUrl, SOURCEMAP } from "@jsenv/sourcemap";
10
10
  import { createPluginsController } from "@jsenv/server/src/plugins_controller.js";
@@ -13185,10 +13185,31 @@ entryPoints: {
13185
13185
  ).href;
13186
13186
  packageSideEffectUrlSet.add(sideEffectFileUrl);
13187
13187
  }
13188
+ // A side effect entry is outdated (and pruned) only when this build
13189
+ // owns it: it is inside the build directory AND the clean patterns
13190
+ // would remove it. A file kept by buildDirectoryCleanPatterns
13191
+ // belongs to another build writing inside this directory (e.g. a
13192
+ // dev-flavored build in a subdirectory, possibly running in
13193
+ // parallel): its entries must be preserved, like files outside the
13194
+ // build directory.
13195
+ const cleanAssociations = URL_META.resolveAssociations(
13196
+ { remove: buildDirectoryCleanPatterns },
13197
+ buildDirectoryUrl,
13198
+ );
13199
+ const isOwnedByThisBuild = (url) => {
13200
+ if (!urlIsOrIsInsideOf(url, buildDirectoryUrl)) {
13201
+ return false;
13202
+ }
13203
+ const { remove } = URL_META.applyAssociations({
13204
+ url,
13205
+ associations: cleanAssociations,
13206
+ });
13207
+ return Boolean(remove);
13208
+ };
13188
13209
  let hasSomeOutdatedSideEffectUrl = false;
13189
13210
  for (const packageSideEffectUrl of packageSideEffectUrlSet) {
13190
13211
  if (
13191
- urlIsOrIsInsideOf(packageSideEffectUrl, buildDirectoryUrl) &&
13212
+ isOwnedByThisBuild(packageSideEffectUrl) &&
13192
13213
  !buildSideEffectUrlSet.has(packageSideEffectUrl)
13193
13214
  ) {
13194
13215
  hasSomeOutdatedSideEffectUrl = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "41.5.4",
3
+ "version": "41.5.6",
4
4
  "type": "module",
5
5
  "description": "Tool to develop, test and build js projects",
6
6
  "repository": {
@@ -74,13 +74,13 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@jsenv/ast": "6.10.1",
77
- "@jsenv/js-module-fallback": "1.6.2",
78
- "@jsenv/plugin-bundling": "2.10.20",
79
- "@jsenv/plugin-minification": "1.7.15",
80
- "@jsenv/plugin-supervisor": "1.8.17",
81
- "@jsenv/plugin-transpilation": "1.7.2",
77
+ "@jsenv/js-module-fallback": "1.6.3",
78
+ "@jsenv/plugin-bundling": "2.10.21",
79
+ "@jsenv/plugin-minification": "1.7.16",
80
+ "@jsenv/plugin-supervisor": "1.8.18",
81
+ "@jsenv/plugin-transpilation": "1.7.3",
82
82
  "@jsenv/server": "17.6.3",
83
- "@jsenv/sourcemap": "1.4.3",
83
+ "@jsenv/sourcemap": "1.4.4",
84
84
  "react-table": "7.8.0"
85
85
  },
86
86
  "devDependencies": {
@@ -39,6 +39,7 @@ import {
39
39
  } from "@jsenv/humanize";
40
40
  import { applyNodeEsmResolution } from "@jsenv/node-esm-resolution";
41
41
  import { startMonitoringMemoryUsage } from "@jsenv/os-metrics";
42
+ import { URL_META } from "@jsenv/url-meta";
42
43
  import { jsenvPluginBundling } from "@jsenv/plugin-bundling";
43
44
  import { jsenvPluginMinification } from "@jsenv/plugin-minification";
44
45
  import { jsenvPluginJsModuleFallback } from "@jsenv/plugin-transpilation";
@@ -858,10 +859,31 @@ entryPoints: {
858
859
  ).href;
859
860
  packageSideEffectUrlSet.add(sideEffectFileUrl);
860
861
  }
862
+ // A side effect entry is outdated (and pruned) only when this build
863
+ // owns it: it is inside the build directory AND the clean patterns
864
+ // would remove it. A file kept by buildDirectoryCleanPatterns
865
+ // belongs to another build writing inside this directory (e.g. a
866
+ // dev-flavored build in a subdirectory, possibly running in
867
+ // parallel): its entries must be preserved, like files outside the
868
+ // build directory.
869
+ const cleanAssociations = URL_META.resolveAssociations(
870
+ { remove: buildDirectoryCleanPatterns },
871
+ buildDirectoryUrl,
872
+ );
873
+ const isOwnedByThisBuild = (url) => {
874
+ if (!urlIsOrIsInsideOf(url, buildDirectoryUrl)) {
875
+ return false;
876
+ }
877
+ const { remove } = URL_META.applyAssociations({
878
+ url,
879
+ associations: cleanAssociations,
880
+ });
881
+ return Boolean(remove);
882
+ };
861
883
  let hasSomeOutdatedSideEffectUrl = false;
862
884
  for (const packageSideEffectUrl of packageSideEffectUrlSet) {
863
885
  if (
864
- urlIsOrIsInsideOf(packageSideEffectUrl, buildDirectoryUrl) &&
886
+ isOwnedByThisBuild(packageSideEffectUrl) &&
865
887
  !buildSideEffectUrlSet.has(packageSideEffectUrl)
866
888
  ) {
867
889
  hasSomeOutdatedSideEffectUrl = true;