@jsenv/test 3.7.0 → 3.7.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.
package/dist/exception.js CHANGED
@@ -624,7 +624,11 @@ const URL_META = {
624
624
  */
625
625
 
626
626
 
627
- const isDev = process.execArgv.includes("--conditions=development");
627
+ const isDev = process.execArgv.some(
628
+ (arg) =>
629
+ arg.includes("--conditions=development") ||
630
+ arg.includes("--conditions=dev:"),
631
+ );
628
632
 
629
633
  const createException = (
630
634
  reason,
@@ -3586,6 +3586,9 @@ const readGitHubWorkflowEnv = () => {
3586
3586
 
3587
3587
  // https://nodejs.org/api/packages.html#resolving-user-conditions
3588
3588
  const readCustomConditionsFromProcessArgs = () => {
3589
+ if (process.env.IGNORE_PACKAGE_CONDITIONS) {
3590
+ return [];
3591
+ }
3589
3592
  const packageConditions = [];
3590
3593
  for (const arg of process.execArgv) {
3591
3594
  if (arg.includes("-C=")) {
@@ -4294,7 +4297,27 @@ const applyPackageTargetResolution = (target, resolutionContext) => {
4294
4297
  if (Number.isInteger(key)) {
4295
4298
  throw new Error("Invalid package configuration");
4296
4299
  }
4297
- if (key === "default" || conditions.includes(key)) {
4300
+ let matched;
4301
+ if (key === "default") {
4302
+ matched = true;
4303
+ } else {
4304
+ for (const conditionCandidate of conditions) {
4305
+ if (conditionCandidate === key) {
4306
+ matched = true;
4307
+ break;
4308
+ }
4309
+ if (conditionCandidate.includes("*")) {
4310
+ const conditionCandidateRegex = new RegExp(
4311
+ `^${conditionCandidate.replace(/\*/g, "(.*)")}$`,
4312
+ );
4313
+ if (conditionCandidateRegex.test(key)) {
4314
+ matched = true;
4315
+ break;
4316
+ }
4317
+ }
4318
+ }
4319
+ }
4320
+ if (matched) {
4298
4321
  const targetValue = target[key];
4299
4322
  const resolved = applyPackageTargetResolution(targetValue, {
4300
4323
  ...resolutionContext,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/test",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  "exports": {
18
18
  ".": {
19
19
  "import": {
20
- "development": "./src/main.js",
20
+ "dev:jsenv": "./src/main.js",
21
21
  "default": "./dist/jsenv_test.js"
22
22
  }
23
23
  },
@@ -36,7 +36,7 @@
36
36
  "./dist/jsenv_test.js"
37
37
  ],
38
38
  "scripts": {
39
- "build": "node --conditions=development ./scripts/build.mjs",
39
+ "build": "node --conditions=dev:jsenv ./scripts/build.mjs",
40
40
  "prepublishOnly": "npm run build"
41
41
  },
42
42
  "optionalDependencies": {
@@ -45,9 +45,9 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@c88/v8-coverage": "0.1.1",
48
- "@jsenv/ast": "6.6.10",
49
- "@jsenv/plugin-supervisor": "1.6.14",
50
- "@jsenv/sourcemap": "1.3.6",
48
+ "@jsenv/ast": "6.6.11",
49
+ "@jsenv/plugin-supervisor": "1.6.15",
50
+ "@jsenv/sourcemap": "1.3.7",
51
51
  "he": "1.2.0",
52
52
  "istanbul-lib-coverage": "3.2.2",
53
53
  "istanbul-lib-instrument": "6.0.3",
@@ -58,14 +58,14 @@
58
58
  },
59
59
  "devDependencies": {
60
60
  "@jsenv/abort": "4.3.1",
61
- "@jsenv/exception": "1.1.8",
62
- "@jsenv/filesystem": "4.15.1",
63
- "@jsenv/github-check-run": "0.3.0",
64
- "@jsenv/node-esm-resolution": "1.2.0",
61
+ "@jsenv/exception": "1.2.0",
62
+ "@jsenv/filesystem": "4.15.2",
63
+ "@jsenv/github-check-run": "0.3.1",
64
+ "@jsenv/node-esm-resolution": "1.2.1",
65
65
  "@jsenv/url-meta": "8.5.7",
66
- "@jsenv/urls": "2.7.3",
66
+ "@jsenv/urls": "2.7.4",
67
67
  "@jsenv/utils": "2.3.1",
68
- "@jsenv/humanize": "1.5.1",
68
+ "@jsenv/humanize": "1.5.2",
69
69
  "strip-ansi": "7.1.0",
70
70
  "supports-color": "10.0.0"
71
71
  }