@jsenv/core 40.12.6 → 40.12.8

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.
@@ -5510,6 +5510,10 @@ const applyNodeEsmResolution = ({
5510
5510
  return resolution;
5511
5511
  };
5512
5512
 
5513
+ const createResolutionResult = (data) => {
5514
+ return data;
5515
+ };
5516
+
5513
5517
  const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
5514
5518
  const { parentUrl } = resolutionContext;
5515
5519
  // relative specifier
@@ -5527,10 +5531,10 @@ const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
5527
5531
  return browserFieldResolution;
5528
5532
  }
5529
5533
  }
5530
- return {
5534
+ return createResolutionResult({
5531
5535
  type: "relative_specifier",
5532
5536
  url: new URL(specifier, parentUrl).href,
5533
- };
5537
+ });
5534
5538
  }
5535
5539
  if (specifier[0] === "#") {
5536
5540
  return applyPackageImportsResolution(specifier, resolutionContext);
@@ -5538,15 +5542,15 @@ const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
5538
5542
  try {
5539
5543
  const urlObject = new URL(specifier);
5540
5544
  if (specifier.startsWith("node:")) {
5541
- return {
5545
+ return createResolutionResult({
5542
5546
  type: "node_builtin_specifier",
5543
5547
  url: specifier,
5544
- };
5548
+ });
5545
5549
  }
5546
- return {
5550
+ return createResolutionResult({
5547
5551
  type: "absolute_specifier",
5548
5552
  url: urlObject.href,
5549
- };
5553
+ });
5550
5554
  } catch {
5551
5555
  // bare specifier
5552
5556
  const browserFieldResolution = applyBrowserFieldResolution(
@@ -5607,13 +5611,13 @@ const applyBrowserFieldResolution = (specifier, resolutionContext) => {
5607
5611
  }
5608
5612
  }
5609
5613
  if (url) {
5610
- return {
5614
+ return createResolutionResult({
5611
5615
  type: "field:browser",
5612
5616
  isMain: true,
5613
5617
  packageDirectoryUrl,
5614
5618
  packageJson,
5615
5619
  url,
5616
- };
5620
+ });
5617
5621
  }
5618
5622
  return null;
5619
5623
  };
@@ -5662,10 +5666,10 @@ const applyPackageResolve = (packageSpecifier, resolutionContext) => {
5662
5666
  conditions.includes("node") &&
5663
5667
  isSpecifierForNodeBuiltin(packageSpecifier)
5664
5668
  ) {
5665
- return {
5669
+ return createResolutionResult({
5666
5670
  type: "node_builtin_specifier",
5667
5671
  url: `node:${packageSpecifier}`,
5668
- };
5672
+ });
5669
5673
  }
5670
5674
  let { packageName, packageSubpath } = parsePackageSpecifier(packageSpecifier);
5671
5675
  if (
@@ -5858,7 +5862,7 @@ const applyPackageTargetResolution = (target, resolutionContext) => {
5858
5862
  resolutionContext,
5859
5863
  );
5860
5864
  }
5861
- return {
5865
+ return createResolutionResult({
5862
5866
  type: isImport ? "field:imports" : "field:exports",
5863
5867
  isMain: subpath === "" || subpath === ".",
5864
5868
  packageDirectoryUrl,
@@ -5866,7 +5870,7 @@ const applyPackageTargetResolution = (target, resolutionContext) => {
5866
5870
  url: pattern
5867
5871
  ? targetUrl.replaceAll("*", subpath)
5868
5872
  : new URL(subpath, targetUrl).href,
5869
- };
5873
+ });
5870
5874
  }
5871
5875
  if (!isImport || target.startsWith("../") || isValidUrl(target)) {
5872
5876
  throw createInvalidPackageTargetError(
@@ -6087,13 +6091,13 @@ const applyLegacySubpathResolution = (packageSubpath, resolutionContext) => {
6087
6091
  if (browserFieldResolution) {
6088
6092
  return browserFieldResolution;
6089
6093
  }
6090
- return {
6094
+ return createResolutionResult({
6091
6095
  type: "subpath",
6092
6096
  isMain: packageSubpath === ".",
6093
6097
  packageDirectoryUrl,
6094
6098
  packageJson,
6095
6099
  url: new URL(packageSubpath, packageDirectoryUrl).href,
6096
- };
6100
+ });
6097
6101
  };
6098
6102
 
6099
6103
  const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
@@ -6105,22 +6109,22 @@ const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
6105
6109
  }
6106
6110
  const resolved = conditionResolver(resolutionContext);
6107
6111
  if (resolved) {
6108
- return {
6112
+ return createResolutionResult({
6109
6113
  type: resolved.type,
6110
6114
  isMain: resolved.isMain,
6111
6115
  packageDirectoryUrl,
6112
6116
  packageJson,
6113
6117
  url: new URL(resolved.path, packageDirectoryUrl).href,
6114
- };
6118
+ });
6115
6119
  }
6116
6120
  }
6117
- return {
6121
+ return createResolutionResult({
6118
6122
  type: "field:main", // the absence of "main" field
6119
6123
  isMain: true,
6120
6124
  packageDirectoryUrl,
6121
6125
  packageJson,
6122
6126
  url: new URL("index.js", packageDirectoryUrl).href,
6123
- };
6127
+ });
6124
6128
  };
6125
6129
  const mainLegacyResolvers = {
6126
6130
  import: ({ packageJson }) => {
@@ -10984,4 +10988,4 @@ const escapeRegexpSpecialChars = (string) => {
10984
10988
  });
10985
10989
  };
10986
10990
 
10987
- export { ANSI, Abort, CONTENT_TYPE, DATA_URL, JS_QUOTES, RUNTIME_COMPAT, UNICODE, URL_META, applyFileSystemMagicResolution, applyNodeEsmResolution, asSpecifierWithoutSearch, asUrlWithoutSearch, assertAndNormalizeDirectoryUrl, browserDefaultRuntimeCompat, bufferToEtag, clearDirectorySync, compareFileUrls, comparePathnames, composeTwoImportMaps, createDetailedMessage$1 as createDetailedMessage, createDynamicLog, createLogger, createLookupPackageDirectory, createTaskLog, defaultLookupPackageScope, defaultReadPackageJson, distributePercentages, ensureEmptyDirectory, ensurePathnameTrailingSlash, ensureWindowsDriveLetter, errorToHTML, escapeRegexpSpecialChars, generateContentFrame, getCallerPosition, getExtensionsToTry, humanizeDuration, humanizeFileSize, humanizeMemory, inferRuntimeCompatFromClosestPackage, injectQueryParamIntoSpecifierWithoutEncoding, injectQueryParams, injectQueryParamsIntoSpecifier, isFileSystemPath, isSpecifierForNodeBuiltin, lookupPackageDirectory, moveUrl, nodeDefaultRuntimeCompat, normalizeImportMap, normalizeUrl, raceProcessTeardownEvents, readCustomConditionsFromProcessArgs, readEntryStatSync, readPackageAtOrNull, registerDirectoryLifecycle, renderBigSection, renderDetails, renderTable, renderUrlOrRelativeUrlFilename, resolveImport, setUrlBasename, setUrlExtension, setUrlFilename, startMonitoringCpuUsage, startMonitoringMemoryUsage, stringifyUrlSite, updateJsonFileSync, urlIsOrIsInsideOf, urlToBasename, urlToExtension$1 as urlToExtension, urlToFileSystemPath, urlToFilename$1 as urlToFilename, urlToPathname$1 as urlToPathname, urlToRelativeUrl, validateResponseIntegrity, writeFileSync };
10991
+ export { ANSI, Abort, CONTENT_TYPE, DATA_URL, JS_QUOTES, RUNTIME_COMPAT, UNICODE, URL_META, applyFileSystemMagicResolution, applyNodeEsmResolution, asSpecifierWithoutSearch, asUrlWithoutSearch, assertAndNormalizeDirectoryUrl, browserDefaultRuntimeCompat, bufferToEtag, clearDirectorySync, compareFileUrls, comparePathnames, composeTwoImportMaps, createDetailedMessage$1 as createDetailedMessage, createDynamicLog, createLogger, createLookupPackageDirectory, createTaskLog, distributePercentages, ensureEmptyDirectory, ensurePathnameTrailingSlash, ensureWindowsDriveLetter, errorToHTML, escapeRegexpSpecialChars, generateContentFrame, getCallerPosition, getExtensionsToTry, humanizeDuration, humanizeFileSize, humanizeMemory, inferRuntimeCompatFromClosestPackage, injectQueryParamIntoSpecifierWithoutEncoding, injectQueryParams, injectQueryParamsIntoSpecifier, isFileSystemPath, isSpecifierForNodeBuiltin, lookupPackageDirectory, moveUrl, nodeDefaultRuntimeCompat, normalizeImportMap, normalizeUrl, raceProcessTeardownEvents, readCustomConditionsFromProcessArgs, readEntryStatSync, readPackageAtOrNull, registerDirectoryLifecycle, renderBigSection, renderDetails, renderTable, renderUrlOrRelativeUrlFilename, resolveImport, setUrlBasename, setUrlExtension, setUrlFilename, startMonitoringCpuUsage, startMonitoringMemoryUsage, stringifyUrlSite, updateJsonFileSync, urlIsOrIsInsideOf, urlToBasename, urlToExtension$1 as urlToExtension, urlToFileSystemPath, urlToFilename$1 as urlToFilename, urlToPathname$1 as urlToPathname, urlToRelativeUrl, validateResponseIntegrity, writeFileSync };
@@ -1,6 +1,6 @@
1
1
  import { createSupportsColor, isUnicodeSupported, emojiRegex, eastAsianWidth, clearTerminal, eraseLines } from "./jsenv_core_node_modules.js";
2
2
  import { stripVTControlCharacters } from "node:util";
3
- import { existsSync, readFileSync, chmodSync, statSync, lstatSync, readdirSync, openSync, closeSync, unlinkSync, rmdirSync, mkdirSync, writeFileSync as writeFileSync$1, watch, realpathSync } from "node:fs";
3
+ import { readFileSync, existsSync, chmodSync, statSync, lstatSync, readdirSync, openSync, closeSync, unlinkSync, rmdirSync, mkdirSync, writeFileSync as writeFileSync$1, watch, realpathSync } from "node:fs";
4
4
  import { extname } from "node:path";
5
5
  import crypto, { createHash } from "node:crypto";
6
6
  import { pathToFileURL, fileURLToPath } from "node:url";
@@ -4140,6 +4140,10 @@ const applyNodeEsmResolution = ({
4140
4140
  return resolution;
4141
4141
  };
4142
4142
 
4143
+ const createResolutionResult = (data) => {
4144
+ return data;
4145
+ };
4146
+
4143
4147
  const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
4144
4148
  const { parentUrl } = resolutionContext;
4145
4149
  // relative specifier
@@ -4157,10 +4161,10 @@ const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
4157
4161
  return browserFieldResolution;
4158
4162
  }
4159
4163
  }
4160
- return {
4164
+ return createResolutionResult({
4161
4165
  type: "relative_specifier",
4162
4166
  url: new URL(specifier, parentUrl).href,
4163
- };
4167
+ });
4164
4168
  }
4165
4169
  if (specifier[0] === "#") {
4166
4170
  return applyPackageImportsResolution(specifier, resolutionContext);
@@ -4168,15 +4172,15 @@ const applyPackageSpecifierResolution = (specifier, resolutionContext) => {
4168
4172
  try {
4169
4173
  const urlObject = new URL(specifier);
4170
4174
  if (specifier.startsWith("node:")) {
4171
- return {
4175
+ return createResolutionResult({
4172
4176
  type: "node_builtin_specifier",
4173
4177
  url: specifier,
4174
- };
4178
+ });
4175
4179
  }
4176
- return {
4180
+ return createResolutionResult({
4177
4181
  type: "absolute_specifier",
4178
4182
  url: urlObject.href,
4179
- };
4183
+ });
4180
4184
  } catch {
4181
4185
  // bare specifier
4182
4186
  const browserFieldResolution = applyBrowserFieldResolution(
@@ -4237,13 +4241,13 @@ const applyBrowserFieldResolution = (specifier, resolutionContext) => {
4237
4241
  }
4238
4242
  }
4239
4243
  if (url) {
4240
- return {
4244
+ return createResolutionResult({
4241
4245
  type: "field:browser",
4242
4246
  isMain: true,
4243
4247
  packageDirectoryUrl,
4244
4248
  packageJson,
4245
4249
  url,
4246
- };
4250
+ });
4247
4251
  }
4248
4252
  return null;
4249
4253
  };
@@ -4292,10 +4296,10 @@ const applyPackageResolve = (packageSpecifier, resolutionContext) => {
4292
4296
  conditions.includes("node") &&
4293
4297
  isSpecifierForNodeBuiltin(packageSpecifier)
4294
4298
  ) {
4295
- return {
4299
+ return createResolutionResult({
4296
4300
  type: "node_builtin_specifier",
4297
4301
  url: `node:${packageSpecifier}`,
4298
- };
4302
+ });
4299
4303
  }
4300
4304
  let { packageName, packageSubpath } = parsePackageSpecifier(packageSpecifier);
4301
4305
  if (
@@ -4488,7 +4492,7 @@ const applyPackageTargetResolution = (target, resolutionContext) => {
4488
4492
  resolutionContext,
4489
4493
  );
4490
4494
  }
4491
- return {
4495
+ return createResolutionResult({
4492
4496
  type: isImport ? "field:imports" : "field:exports",
4493
4497
  isMain: subpath === "" || subpath === ".",
4494
4498
  packageDirectoryUrl,
@@ -4496,7 +4500,7 @@ const applyPackageTargetResolution = (target, resolutionContext) => {
4496
4500
  url: pattern
4497
4501
  ? targetUrl.replaceAll("*", subpath)
4498
4502
  : new URL(subpath, targetUrl).href,
4499
- };
4503
+ });
4500
4504
  }
4501
4505
  if (!isImport || target.startsWith("../") || isValidUrl(target)) {
4502
4506
  throw createInvalidPackageTargetError(
@@ -4717,13 +4721,13 @@ const applyLegacySubpathResolution = (packageSubpath, resolutionContext) => {
4717
4721
  if (browserFieldResolution) {
4718
4722
  return browserFieldResolution;
4719
4723
  }
4720
- return {
4724
+ return createResolutionResult({
4721
4725
  type: "subpath",
4722
4726
  isMain: packageSubpath === ".",
4723
4727
  packageDirectoryUrl,
4724
4728
  packageJson,
4725
4729
  url: new URL(packageSubpath, packageDirectoryUrl).href,
4726
- };
4730
+ });
4727
4731
  };
4728
4732
 
4729
4733
  const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
@@ -4735,22 +4739,22 @@ const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
4735
4739
  }
4736
4740
  const resolved = conditionResolver(resolutionContext);
4737
4741
  if (resolved) {
4738
- return {
4742
+ return createResolutionResult({
4739
4743
  type: resolved.type,
4740
4744
  isMain: resolved.isMain,
4741
4745
  packageDirectoryUrl,
4742
4746
  packageJson,
4743
4747
  url: new URL(resolved.path, packageDirectoryUrl).href,
4744
- };
4748
+ });
4745
4749
  }
4746
4750
  }
4747
- return {
4751
+ return createResolutionResult({
4748
4752
  type: "field:main", // the absence of "main" field
4749
4753
  isMain: true,
4750
4754
  packageDirectoryUrl,
4751
4755
  packageJson,
4752
4756
  url: new URL("index.js", packageDirectoryUrl).href,
4753
- };
4757
+ });
4754
4758
  };
4755
4759
  const mainLegacyResolvers = {
4756
4760
  import: ({ packageJson }) => {
@@ -6302,4 +6306,4 @@ const memoizeByFirstArgument = (compute) => {
6302
6306
  return fnWithMemoization;
6303
6307
  };
6304
6308
 
6305
- export { ANSI, CONTENT_TYPE, DATA_URL, JS_QUOTES, RUNTIME_COMPAT, URL_META, applyFileSystemMagicResolution, applyNodeEsmResolution, asSpecifierWithoutSearch, asUrlWithoutSearch, assertAndNormalizeDirectoryUrl, bufferToEtag, compareFileUrls, composeTwoImportMaps, createDetailedMessage$1 as createDetailedMessage, createLogger, createTaskLog, defaultLookupPackageScope, defaultReadPackageJson, ensurePathnameTrailingSlash, ensureWindowsDriveLetter, errorToHTML, formatError, generateContentFrame, getCallerPosition, getExtensionsToTry, injectQueryParamsIntoSpecifier, isFileSystemPath, isSpecifierForNodeBuiltin, lookupPackageDirectory, memoizeByFirstArgument, moveUrl, normalizeImportMap, normalizeUrl, readCustomConditionsFromProcessArgs, readEntryStatSync, readPackageAtOrNull, registerDirectoryLifecycle, resolveImport, setUrlBasename, setUrlExtension, setUrlFilename, stringifyUrlSite, urlIsOrIsInsideOf, urlToBasename, urlToExtension$1 as urlToExtension, urlToFileSystemPath, urlToFilename$1 as urlToFilename, urlToPathname$1 as urlToPathname, urlToRelativeUrl, validateResponseIntegrity, writeFileSync };
6309
+ export { ANSI, CONTENT_TYPE, DATA_URL, JS_QUOTES, RUNTIME_COMPAT, URL_META, applyFileSystemMagicResolution, applyNodeEsmResolution, asSpecifierWithoutSearch, asUrlWithoutSearch, assertAndNormalizeDirectoryUrl, bufferToEtag, compareFileUrls, composeTwoImportMaps, createDetailedMessage$1 as createDetailedMessage, createLogger, createTaskLog, ensurePathnameTrailingSlash, ensureWindowsDriveLetter, errorToHTML, formatError, generateContentFrame, getCallerPosition, getExtensionsToTry, injectQueryParams, injectQueryParamsIntoSpecifier, isFileSystemPath, isSpecifierForNodeBuiltin, lookupPackageDirectory, memoizeByFirstArgument, moveUrl, normalizeImportMap, normalizeUrl, readCustomConditionsFromProcessArgs, readEntryStatSync, readPackageAtOrNull, registerDirectoryLifecycle, resolveImport, setUrlBasename, setUrlExtension, setUrlFilename, stringifyUrlSite, urlIsOrIsInsideOf, urlToBasename, urlToExtension$1 as urlToExtension, urlToFileSystemPath, urlToFilename$1 as urlToFilename, urlToPathname$1 as urlToPathname, urlToRelativeUrl, validateResponseIntegrity, writeFileSync };