@jsenv/core 40.0.10 → 40.1.1

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,12 @@
1
- import { assertAndNormalizeDirectoryUrl$2 as assertAndNormalizeDirectoryUrl, createLogger$2 as createLogger, Abort$1 as Abort, raceProcessTeardownEvents$1 as raceProcessTeardownEvents, createTaskLog$2 as createTaskLog, urlToExtension$2 as urlToExtension, urlToPathname$2 as urlToPathname } from "../jsenv_core_packages.js";
2
1
  import { startServer, jsenvServiceCORS, jsenvServiceErrorHandler, jsenvAccessControlAllowedHeaders, createFileSystemFetch } from "@jsenv/server";
3
2
  import { existsSync } from "node:fs";
4
- import "string-width";
3
+ import { assertAndNormalizeDirectoryUrl$2 as assertAndNormalizeDirectoryUrl, createLogger$2 as createLogger, Abort$1 as Abort, raceProcessTeardownEvents$1 as raceProcessTeardownEvents, createTaskLog$2 as createTaskLog, urlToExtension$2 as urlToExtension, urlToPathname$2 as urlToPathname } from "../jsenv_core_packages.js";
4
+ import "strip-ansi";
5
+ import "../jsenv_core_node_modules.js";
5
6
  import "node:process";
6
7
  import "node:os";
7
8
  import "node:tty";
9
+ import "node:util";
8
10
  import "node:path";
9
11
  import "node:crypto";
10
12
  import "node:url";
@@ -1,18 +1,19 @@
1
- import { lookupPackageDirectory, registerDirectoryLifecycle, urlToRelativeUrl, moveUrl, urlIsInsideOf, ensureWindowsDriveLetter, createDetailedMessage, stringifyUrlSite, generateContentFrame, validateResponseIntegrity, setUrlFilename, getCallerPosition, urlToBasename, urlToExtension, asSpecifierWithoutSearch, asUrlWithoutSearch, injectQueryParamsIntoSpecifier, bufferToEtag, isFileSystemPath, urlToPathname, setUrlBasename, urlToFileSystemPath, writeFileSync, createLogger, URL_META, applyNodeEsmResolution, normalizeUrl, ANSI, CONTENT_TYPE, DATA_URL, normalizeImportMap, composeTwoImportMaps, resolveImport, JS_QUOTES, readCustomConditionsFromProcessArgs, defaultLookupPackageScope, defaultReadPackageJson, readEntryStatSync, urlToFilename, ensurePathnameTrailingSlash, comparePathnames, applyFileSystemMagicResolution, getExtensionsToTry, setUrlExtension, jsenvPluginTranspilation, memoizeByFirstArgument, assertAndNormalizeDirectoryUrl, createTaskLog } from "../jsenv_core_packages.js";
2
1
  import { WebSocketResponse, pickContentType, ServerEvents, jsenvServiceCORS, jsenvAccessControlAllowedHeaders, composeTwoResponses, serveDirectory, jsenvServiceErrorHandler, startServer } from "@jsenv/server";
3
2
  import { convertFileSystemErrorToResponseProperties } from "@jsenv/server/src/internal/convertFileSystemErrorToResponseProperties.js";
3
+ import { lookupPackageDirectory, registerDirectoryLifecycle, urlToRelativeUrl, moveUrl, urlIsInsideOf, ensureWindowsDriveLetter, createDetailedMessage, stringifyUrlSite, generateContentFrame, validateResponseIntegrity, setUrlFilename, getCallerPosition, urlToBasename, urlToExtension, asSpecifierWithoutSearch, asUrlWithoutSearch, injectQueryParamsIntoSpecifier, bufferToEtag, isFileSystemPath, urlToPathname, setUrlBasename, urlToFileSystemPath, writeFileSync, createLogger, URL_META, applyNodeEsmResolution, RUNTIME_COMPAT, normalizeUrl, ANSI, CONTENT_TYPE, DATA_URL, normalizeImportMap, composeTwoImportMaps, resolveImport, JS_QUOTES, defaultLookupPackageScope, defaultReadPackageJson, readCustomConditionsFromProcessArgs, readEntryStatSync, urlToFilename, ensurePathnameTrailingSlash, compareFileUrls, applyFileSystemMagicResolution, getExtensionsToTry, setUrlExtension, jsenvPluginTranspilation, memoizeByFirstArgument, assertAndNormalizeDirectoryUrl, createTaskLog } from "../jsenv_core_packages.js";
4
4
  import { readFileSync, existsSync, readdirSync, lstatSync, realpathSync } from "node:fs";
5
- import { RUNTIME_COMPAT } from "@jsenv/runtime-compat";
6
5
  import { pathToFileURL } from "node:url";
7
6
  import { generateSourcemapFileUrl, createMagicSource, composeTwoSourcemaps, generateSourcemapDataUrl, SOURCEMAP } from "@jsenv/sourcemap";
8
7
  import { parseHtml, injectHtmlNodeAsEarlyAsPossible, createHtmlNode, stringifyHtmlAst, applyBabelPlugins, generateUrlForInlineContent, parseJsWithAcorn, parseCssUrls, getHtmlNodeAttribute, getHtmlNodePosition, getHtmlNodeAttributePosition, setHtmlNodeAttributes, parseSrcSet, getUrlForContentInsideHtml, removeHtmlNodeText, setHtmlNodeText, getHtmlNodeText, analyzeScriptNode, visitHtmlNodes, parseJsUrls, getUrlForContentInsideJs, analyzeLinkNode, injectJsenvScript } from "@jsenv/ast";
9
8
  import { performance } from "node:perf_hooks";
10
9
  import { jsenvPluginSupervisor } from "@jsenv/plugin-supervisor";
11
10
  import { createRequire } from "node:module";
12
- import "string-width";
11
+ import "strip-ansi";
12
+ import "../jsenv_core_node_modules.js";
13
13
  import "node:process";
14
14
  import "node:os";
15
15
  import "node:tty";
16
+ import "node:util";
16
17
  import "node:path";
17
18
  import "node:crypto";
18
19
  import "@jsenv/js-module-fallback";
@@ -541,7 +542,7 @@ const assertFetchedContentCompliance = ({ urlInfo, content }) => {
541
542
  }
542
543
  const { expectedType } = urlInfo.firstReference;
543
544
  if (expectedType && urlInfo.type !== expectedType) {
544
- if (urlInfo.type === "asset" && urlInfo.context.build) ; else {
545
+ if (urlInfo.type === "entry_build" && urlInfo.context.build) ; else {
545
546
  throw new Error(
546
547
  `type must be "${expectedType}", got "${urlInfo.type}" on ${urlInfo.url}`,
547
548
  );
@@ -2665,7 +2666,7 @@ const shouldHandleSourcemap = (urlInfo) => {
2665
2666
  };
2666
2667
 
2667
2668
  const inlineContentClientFileUrl = new URL(
2668
- "../client/inline_content/inline_content.js",
2669
+ "./client/inline_content.js",
2669
2670
  import.meta.url,
2670
2671
  ).href;
2671
2672
 
@@ -2718,7 +2719,7 @@ const createKitchen = ({
2718
2719
  sourcemaps,
2719
2720
  outDirectoryUrl,
2720
2721
  },
2721
- resolve: (specifier, importer) => {
2722
+ resolve: (specifier, importer = rootDirectoryUrl) => {
2722
2723
  const { url, packageDirectoryUrl, packageJson } = applyNodeEsmResolution({
2723
2724
  conditions: packageConditions,
2724
2725
  parentUrl: importer,
@@ -3378,7 +3379,7 @@ const inferUrlInfoType = (urlInfo) => {
3378
3379
 
3379
3380
  const jsenvPluginHtmlSyntaxErrorFallback = () => {
3380
3381
  const htmlSyntaxErrorFileUrl = import.meta.resolve(
3381
- "../client/html_syntax_error/html_syntax_error.html",
3382
+ "./client/html_syntax_error.html",
3382
3383
  );
3383
3384
 
3384
3385
  return {
@@ -4841,7 +4842,7 @@ const parseAndTransformJsReferences = async (
4841
4842
  let filenameHint;
4842
4843
  if (
4843
4844
  externalReferenceInfo.subtype === "import_dynamic" &&
4844
- isBareSpecifier(externalReferenceInfo.specifier)
4845
+ isBareSpecifier$1(externalReferenceInfo.specifier)
4845
4846
  ) {
4846
4847
  filenameHint = `${externalReferenceInfo.specifier}.js`;
4847
4848
  }
@@ -4931,7 +4932,7 @@ const parseAndTransformJsReferences = async (
4931
4932
  return { content, sourcemap };
4932
4933
  };
4933
4934
 
4934
- const isBareSpecifier = (specifier) => {
4935
+ const isBareSpecifier$1 = (specifier) => {
4935
4936
  if (
4936
4937
  specifier[0] === "/" ||
4937
4938
  specifier.startsWith("./") ||
@@ -5045,7 +5046,6 @@ const jsenvPluginReferenceAnalysis = ({
5045
5046
  inlineContent = true,
5046
5047
  inlineConvertedScript = false,
5047
5048
  fetchInlineUrls = true,
5048
- directoryReferenceEffect,
5049
5049
  }) => {
5050
5050
  return [
5051
5051
  jsenvPluginDirectoryReferenceAnalysis(),
@@ -5146,18 +5146,18 @@ const jsenvPluginInlineContentFetcher = () => {
5146
5146
 
5147
5147
 
5148
5148
  const createNodeEsmResolver = ({
5149
- build,
5150
5149
  runtimeCompat,
5151
- packageConditions,
5150
+ rootDirectoryUrl,
5151
+ packageConditions = {},
5152
5152
  preservesSymlink,
5153
5153
  }) => {
5154
- const nodeRuntimeEnabled = Object.keys(runtimeCompat).includes("node");
5155
- // https://nodejs.org/api/esm.html#resolver-algorithm-specification
5156
- packageConditions = packageConditions || [
5157
- ...(build ? [] : readCustomConditionsFromProcessArgs()),
5158
- nodeRuntimeEnabled ? "node" : "browser",
5159
- "import",
5160
- ];
5154
+ const buildPackageConditions = createBuildPackageConditions(
5155
+ packageConditions,
5156
+ {
5157
+ rootDirectoryUrl,
5158
+ runtimeCompat,
5159
+ },
5160
+ );
5161
5161
 
5162
5162
  return (reference) => {
5163
5163
  if (reference.type === "package_json") {
@@ -5178,10 +5178,12 @@ const createNodeEsmResolver = ({
5178
5178
  if (!parentUrl.startsWith("file:")) {
5179
5179
  return null; // let it to jsenv_web_resolution
5180
5180
  }
5181
+ const { specifier } = reference;
5182
+ const conditions = buildPackageConditions(specifier, parentUrl);
5181
5183
  const { url, type, isMain, packageDirectoryUrl } = applyNodeEsmResolution({
5182
- conditions: packageConditions,
5184
+ conditions,
5183
5185
  parentUrl,
5184
- specifier: reference.specifier,
5186
+ specifier,
5185
5187
  preservesSymlink,
5186
5188
  });
5187
5189
  // try to give a more meaningful filename after build
@@ -5245,6 +5247,107 @@ const createNodeEsmResolver = ({
5245
5247
  };
5246
5248
  };
5247
5249
 
5250
+ const createBuildPackageConditions = (
5251
+ packageConditions,
5252
+ { rootDirectoryUrl, runtimeCompat },
5253
+ ) => {
5254
+ const nodeRuntimeEnabled = Object.keys(runtimeCompat).includes("node");
5255
+ // https://nodejs.org/api/esm.html#resolver-algorithm-specification
5256
+ const processArgConditions = readCustomConditionsFromProcessArgs();
5257
+ const packageConditionsDefaultResolvers = {};
5258
+ for (const processArgCondition of processArgConditions) {
5259
+ packageConditionsDefaultResolvers[processArgCondition] = true;
5260
+ }
5261
+ const packageConditionResolvers = {
5262
+ ...packageConditionsDefaultResolvers,
5263
+ development: (specifier, importer) => {
5264
+ if (isBareSpecifier(specifier)) {
5265
+ const { url } = applyNodeEsmResolution({
5266
+ specifier,
5267
+ parentUrl: importer,
5268
+ });
5269
+ return !url.includes("/node_modules/");
5270
+ }
5271
+ return !importer.includes("/node_modules/");
5272
+ },
5273
+ node: nodeRuntimeEnabled,
5274
+ browser: !nodeRuntimeEnabled,
5275
+ import: true,
5276
+ };
5277
+ for (const condition of Object.keys(packageConditions)) {
5278
+ const value = packageConditions[condition];
5279
+ let customResolver;
5280
+ if (typeof value === "object") {
5281
+ const associations = URL_META.resolveAssociations(
5282
+ { applies: value },
5283
+ (pattern) => {
5284
+ if (isBareSpecifier(pattern)) {
5285
+ try {
5286
+ if (pattern.endsWith("/")) {
5287
+ // avoid package path not exported
5288
+ const { packageDirectoryUrl } = applyNodeEsmResolution({
5289
+ specifier: pattern.slice(0, -1),
5290
+ parentUrl: rootDirectoryUrl,
5291
+ });
5292
+ return packageDirectoryUrl;
5293
+ }
5294
+ const { url } = applyNodeEsmResolution({
5295
+ specifier: pattern,
5296
+ parentUrl: rootDirectoryUrl,
5297
+ });
5298
+ return url;
5299
+ } catch {
5300
+ return new URL(pattern, rootDirectoryUrl);
5301
+ }
5302
+ }
5303
+ return new URL(pattern, rootDirectoryUrl);
5304
+ },
5305
+ );
5306
+ customResolver = (specifier, importer) => {
5307
+ if (isBareSpecifier(specifier)) {
5308
+ const { url } = applyNodeEsmResolution({
5309
+ specifier,
5310
+ parentUrl: importer,
5311
+ });
5312
+ const { applies } = URL_META.applyAssociations({ url, associations });
5313
+ return applies;
5314
+ }
5315
+ return URL_META.applyAssociations({ url: importer, associations })
5316
+ .applies;
5317
+ };
5318
+ } else if (typeof value === "function") {
5319
+ customResolver = value;
5320
+ } else {
5321
+ customResolver = () => value;
5322
+ }
5323
+ const existing = packageConditionResolvers[condition];
5324
+ if (existing) {
5325
+ packageConditionResolvers[condition] = (...args) => {
5326
+ const customResult = customResolver(...args);
5327
+ return customResult === undefined ? existing(...args) : customResult;
5328
+ };
5329
+ } else {
5330
+ packageConditionResolvers[condition] = customResolver;
5331
+ }
5332
+ }
5333
+
5334
+ return (specifier, importer) => {
5335
+ const conditions = [];
5336
+ for (const conditionCandidate of Object.keys(packageConditionResolvers)) {
5337
+ const packageConditionResolver =
5338
+ packageConditionResolvers[conditionCandidate];
5339
+ if (typeof packageConditionResolver === "function") {
5340
+ if (packageConditionResolver(specifier, importer)) {
5341
+ conditions.push(conditionCandidate);
5342
+ }
5343
+ } else if (packageConditionResolver) {
5344
+ conditions.push(conditionCandidate);
5345
+ }
5346
+ }
5347
+ return conditions;
5348
+ };
5349
+ };
5350
+
5248
5351
  const addRelationshipWithPackageJson = ({
5249
5352
  reference,
5250
5353
  packageJsonUrl,
@@ -5279,9 +5382,51 @@ const addRelationshipWithPackageJson = ({
5279
5382
  }
5280
5383
  };
5281
5384
 
5282
- const jsenvPluginNodeEsmResolution = (resolutionConfig = {}) => {
5385
+ const isBareSpecifier = (specifier) => {
5386
+ if (
5387
+ specifier[0] === "/" ||
5388
+ specifier.startsWith("./") ||
5389
+ specifier.startsWith("../")
5390
+ ) {
5391
+ return false;
5392
+ }
5393
+ try {
5394
+ // eslint-disable-next-line no-new
5395
+ new URL(specifier);
5396
+ return false;
5397
+ } catch {
5398
+ return true;
5399
+ }
5400
+ };
5401
+
5402
+ const jsenvPluginNodeEsmResolution = (
5403
+ resolutionConfig = {},
5404
+ packageConditions,
5405
+ ) => {
5283
5406
  let nodeEsmResolverDefault;
5284
- const resolvers = {};
5407
+ const resolverMap = new Map();
5408
+ let anyTypeResolver;
5409
+
5410
+ const resolverFromObject = (
5411
+ { preservesSymlink, ...rest },
5412
+ { kitchenContext, urlType },
5413
+ ) => {
5414
+ const unexpectedKeys = Object.keys(rest);
5415
+ if (unexpectedKeys.length) {
5416
+ throw new TypeError(
5417
+ `${unexpectedKeys.join(
5418
+ ",",
5419
+ )}: there is no such configuration on "${urlType}"`,
5420
+ );
5421
+ }
5422
+ return createNodeEsmResolver({
5423
+ build: kitchenContext.build,
5424
+ runtimeCompat: kitchenContext.runtimeCompat,
5425
+ rootDirectoryUrl: kitchenContext.rootDirectoryUrl,
5426
+ packageConditions,
5427
+ preservesSymlink,
5428
+ });
5429
+ };
5285
5430
 
5286
5431
  return {
5287
5432
  name: "jsenv:node_esm_resolution",
@@ -5290,47 +5435,38 @@ const jsenvPluginNodeEsmResolution = (resolutionConfig = {}) => {
5290
5435
  nodeEsmResolverDefault = createNodeEsmResolver({
5291
5436
  build: kitchenContext.build,
5292
5437
  runtimeCompat: kitchenContext.runtimeCompat,
5438
+ rootDirectoryUrl: kitchenContext.rootDirectoryUrl,
5293
5439
  preservesSymlink: true,
5440
+ packageConditions,
5294
5441
  });
5295
- Object.keys(resolutionConfig).forEach((urlType) => {
5442
+ for (const urlType of Object.keys(resolutionConfig)) {
5443
+ let resolver;
5296
5444
  const config = resolutionConfig[urlType];
5297
5445
  if (config === true) {
5298
- resolvers[urlType] = (...args) => nodeEsmResolverDefault(...args);
5446
+ resolver = nodeEsmResolverDefault;
5299
5447
  } else if (config === false) {
5300
- resolvers[urlType] = () => null;
5448
+ // resolverMap.set(urlType, () => null);
5449
+ continue;
5301
5450
  } else if (typeof config === "object") {
5302
- const {
5303
- runtimeCompat,
5304
- packageConditions,
5305
- preservesSymlink,
5306
- ...rest
5307
- } = config;
5308
- const unexpectedKeys = Object.keys(rest);
5309
- if (unexpectedKeys.length) {
5310
- throw new TypeError(
5311
- `${unexpectedKeys.join(
5312
- ",",
5313
- )}: there is no such configuration on "${urlType}"`,
5314
- );
5315
- }
5316
- resolvers[urlType] = createNodeEsmResolver({
5317
- build: kitchenContext.build,
5318
- runtimeCompat,
5319
- packageConditions,
5320
- preservesSymlink,
5321
- });
5451
+ resolver = resolverFromObject(config, { kitchenContext, urlType });
5322
5452
  } else {
5323
5453
  throw new TypeError(
5324
- `config must be true, false or an object, got ${config} on "${urlType}"`,
5454
+ `The value "${config}" for ${urlType} in nodeEsmResolution is invalid: it must be true, false or an object.`,
5325
5455
  );
5326
5456
  }
5327
- });
5328
5457
 
5329
- if (resolvers.js_module === undefined) {
5330
- resolvers.js_module = nodeEsmResolverDefault;
5458
+ if (urlType === "*") {
5459
+ anyTypeResolver = resolver;
5460
+ } else {
5461
+ resolverMap.set(urlType, resolver);
5462
+ }
5463
+ }
5464
+
5465
+ if (!resolverMap.has("js_module")) {
5466
+ resolverMap.set("js_module", nodeEsmResolverDefault);
5331
5467
  }
5332
- if (resolvers.js_classic === undefined) {
5333
- resolvers.js_classic = (reference) => {
5468
+ if (!resolverMap.has("js_classic")) {
5469
+ resolverMap.set("js_classic", (reference) => {
5334
5470
  if (reference.subtype === "self_import_scripts_arg") {
5335
5471
  return nodeEsmResolverDefault(reference);
5336
5472
  }
@@ -5339,7 +5475,7 @@ const jsenvPluginNodeEsmResolution = (resolutionConfig = {}) => {
5339
5475
  return nodeEsmResolverDefault(reference);
5340
5476
  }
5341
5477
  return null;
5342
- };
5478
+ });
5343
5479
  }
5344
5480
  },
5345
5481
  resolveReference: (reference) => {
@@ -5349,8 +5485,14 @@ const jsenvPluginNodeEsmResolution = (resolutionConfig = {}) => {
5349
5485
  return result;
5350
5486
  }
5351
5487
  const urlType = urlTypeFromReference(reference);
5352
- const resolver = resolvers[urlType];
5353
- return resolver ? resolver(reference) : null;
5488
+ const resolver = resolverMap.get(urlType);
5489
+ if (resolver) {
5490
+ return resolver(reference);
5491
+ }
5492
+ if (anyTypeResolver) {
5493
+ return anyTypeResolver(reference);
5494
+ }
5495
+ return null;
5354
5496
  },
5355
5497
  // when specifier is prefixed by "file:///@ignore/"
5356
5498
  // we return an empty js module
@@ -5592,7 +5734,7 @@ return {
5592
5734
 
5593
5735
 
5594
5736
  const htmlFileUrlForDirectory = import.meta.resolve(
5595
- "../client/directory_listing/directory_listing.html",
5737
+ "./client/directory_listing.html",
5596
5738
  );
5597
5739
 
5598
5740
  const jsenvPluginDirectoryListing = ({
@@ -5947,9 +6089,8 @@ const getDirectoryContentItems = ({
5947
6089
  fileUrls.push(fileUrlObject);
5948
6090
  }
5949
6091
  }
5950
- fileUrls.sort((a, b) => {
5951
- return comparePathnames(a.pathname, b.pathname);
5952
- });
6092
+ fileUrls.sort(compareFileUrls);
6093
+
5953
6094
  const items = [];
5954
6095
  for (const fileUrl of fileUrls) {
5955
6096
  const urlRelativeToCurrentDirectory = urlToRelativeUrl(
@@ -6378,7 +6519,25 @@ const asValidFilename = (string) => {
6378
6519
 
6379
6520
  const jsenvPluginDirectoryReferenceEffect = (
6380
6521
  directoryReferenceEffect = "error",
6522
+ { rootDirectoryUrl },
6381
6523
  ) => {
6524
+ let getDirectoryReferenceEffect;
6525
+ if (typeof directoryReferenceEffect === "string") {
6526
+ getDirectoryReferenceEffect = () => directoryReferenceEffect;
6527
+ } else if (typeof directoryReferenceEffect === "function") {
6528
+ getDirectoryReferenceEffect = directoryReferenceEffect;
6529
+ } else if (typeof directoryReferenceEffect === "object") {
6530
+ const associations = URL_META.resolveAssociations(
6531
+ { effect: directoryReferenceEffect },
6532
+ rootDirectoryUrl,
6533
+ );
6534
+ getDirectoryReferenceEffect = (reference) => {
6535
+ const { url } = reference;
6536
+ const meta = URL_META.applyAssociations({ url, associations });
6537
+ return meta.effect || "error";
6538
+ };
6539
+ }
6540
+
6382
6541
  return {
6383
6542
  name: "jsenv:directory_reference_effect",
6384
6543
  appliesDuring: "*",
@@ -6415,12 +6574,8 @@ const jsenvPluginDirectoryReferenceEffect = (
6415
6574
  actionForDirectory = "copy";
6416
6575
  } else if (reference.type === "http_request") {
6417
6576
  actionForDirectory = "preserve";
6418
- } else if (typeof directoryReferenceEffect === "string") {
6419
- actionForDirectory = directoryReferenceEffect;
6420
- } else if (typeof directoryReferenceEffect === "function") {
6421
- actionForDirectory = directoryReferenceEffect(reference);
6422
6577
  } else {
6423
- actionForDirectory = "error";
6578
+ actionForDirectory = getDirectoryReferenceEffect(reference);
6424
6579
  }
6425
6580
  reference.actionForDirectory = actionForDirectory;
6426
6581
  if (actionForDirectory !== "copy") {
@@ -7275,7 +7430,7 @@ const htmlNodeCanHotReload = (node) => {
7275
7430
 
7276
7431
  const jsenvPluginImportMetaHot = () => {
7277
7432
  const importMetaHotClientFileUrl = import.meta.resolve(
7278
- "../client/import_meta_hot/import_meta_hot.js",
7433
+ "./client/import_meta_hot.js",
7279
7434
  );
7280
7435
 
7281
7436
  return {
@@ -7387,7 +7542,7 @@ import.meta.hot = createImportMetaHot(import.meta.url);
7387
7542
  };
7388
7543
 
7389
7544
  const jsenvPluginAutoreloadClient = () => {
7390
- const autoreloadClientFileUrl = import.meta.resolve("../client/autoreload/autoreload.js");
7545
+ const autoreloadClientFileUrl = import.meta.resolve("./client/autoreload.js");
7391
7546
 
7392
7547
  return {
7393
7548
  name: "jsenv:autoreload_client",
@@ -7906,7 +8061,7 @@ const jsenvPluginRibbon = ({
7906
8061
  rootDirectoryUrl,
7907
8062
  htmlInclude = "/**/*.html",
7908
8063
  }) => {
7909
- const ribbonClientFileUrl = import.meta.resolve("../client/ribbon/ribbon.js");
8064
+ const ribbonClientFileUrl = import.meta.resolve("./client/ribbon.js");
7910
8065
  const associations = URL_META.resolveAssociations(
7911
8066
  {
7912
8067
  ribbon: {
@@ -7994,6 +8149,7 @@ const getCorePlugins = ({
7994
8149
 
7995
8150
  referenceAnalysis = {},
7996
8151
  nodeEsmResolution = {},
8152
+ packageConditions,
7997
8153
  magicExtensions,
7998
8154
  magicDirectoryIndex,
7999
8155
  directoryListing = true,
@@ -8064,10 +8220,12 @@ const getCorePlugins = ({
8064
8220
  },
8065
8221
  },
8066
8222
  ...(nodeEsmResolution
8067
- ? [jsenvPluginNodeEsmResolution(nodeEsmResolution)]
8223
+ ? [jsenvPluginNodeEsmResolution(nodeEsmResolution, packageConditions)]
8068
8224
  : []),
8069
8225
  jsenvPluginWebResolution(),
8070
- jsenvPluginDirectoryReferenceEffect(directoryReferenceEffect),
8226
+ jsenvPluginDirectoryReferenceEffect(directoryReferenceEffect, {
8227
+ rootDirectoryUrl,
8228
+ }),
8071
8229
  jsenvPluginVersionSearchParam(),
8072
8230
 
8073
8231
  // "jsenvPluginSupervisor" MUST be after "jsenvPluginInlining" as it needs inline script to be cooked
@@ -8095,7 +8253,7 @@ const getCorePlugins = ({
8095
8253
 
8096
8254
 
8097
8255
  const serverEventsClientFileUrl = new URL(
8098
- "../client/server_events_client/server_events_client.js",
8256
+ "./client/server_events_client.js",
8099
8257
  import.meta.url,
8100
8258
  ).href;
8101
8259
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "40.0.10",
3
+ "version": "40.1.1",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -78,24 +78,22 @@
78
78
  "dependencies": {
79
79
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
80
80
  "@jsenv/abort": "4.3.1",
81
- "@jsenv/ast": "6.6.6",
82
- "@jsenv/filesystem": "4.14.5",
83
- "@jsenv/humanize": "1.3.1",
81
+ "@jsenv/ast": "6.6.7",
82
+ "@jsenv/filesystem": "4.14.6",
83
+ "@jsenv/humanize": "1.4.0",
84
84
  "@jsenv/importmap": "1.2.2",
85
85
  "@jsenv/integrity": "0.0.2",
86
- "@jsenv/js-module-fallback": "1.4.4",
87
- "@jsenv/node-esm-resolution": "1.1.0",
88
- "@jsenv/plugin-bundling": "2.8.6",
86
+ "@jsenv/js-module-fallback": "1.4.5",
87
+ "@jsenv/node-esm-resolution": "1.2.0",
88
+ "@jsenv/plugin-bundling": "2.8.7",
89
89
  "@jsenv/plugin-minification": "1.6.2",
90
- "@jsenv/plugin-supervisor": "1.6.11",
91
- "@jsenv/plugin-transpilation": "1.5.7",
92
- "@jsenv/runtime-compat": "1.3.4",
93
- "@jsenv/server": "16.0.5",
94
- "@jsenv/sourcemap": "1.3.3",
90
+ "@jsenv/plugin-supervisor": "1.6.12",
91
+ "@jsenv/plugin-transpilation": "1.5.8",
92
+ "@jsenv/server": "16.0.6",
93
+ "@jsenv/sourcemap": "1.3.4",
95
94
  "@jsenv/url-meta": "8.5.6",
96
- "@jsenv/urls": "2.7.0",
97
- "@jsenv/utils": "2.2.1",
98
- "string-width": "7.2.0"
95
+ "@jsenv/urls": "2.7.1",
96
+ "@jsenv/utils": "2.3.0"
99
97
  },
100
98
  "devDependencies": {
101
99
  "@babel/plugin-syntax-decorators": "7.25.9",
@@ -114,6 +112,9 @@
114
112
  "@jsenv/router": "workspace:*",
115
113
  "@jsenv/snapshot": "workspace:*",
116
114
  "@jsenv/test": "workspace:*",
115
+ "@jsenv/terminal-table": "workspace:*",
116
+ "@jsenv/os-metrics": "workspace:*",
117
+ "@jsenv/runtime-compat": "workspace:*",
117
118
  "@playwright/browser-chromium": "1.51.0",
118
119
  "@playwright/browser-firefox": "1.51.0",
119
120
  "@playwright/browser-webkit": "1.51.0",