ava 7.0.0 → 8.0.0
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/entrypoints/{eslint-plugin-helper.cjs → eslint-plugin-helper.js} +10 -13
- package/entrypoints/{internal.d.mts → internal.d.ts} +1 -1
- package/entrypoints/{main.d.mts → main.d.ts} +5 -5
- package/entrypoints/{main.mjs → main.js} +1 -1
- package/entrypoints/{plugin.d.cts → plugin.d.ts} +2 -2
- package/entrypoints/plugin.js +1 -0
- package/index.d.ts +2 -2
- package/lib/api-event-iterator.js +2 -2
- package/lib/api.js +6 -6
- package/lib/assert.js +6 -5
- package/lib/cli.js +7 -27
- package/lib/create-chain.js +68 -25
- package/lib/extensions.js +5 -7
- package/lib/fork.js +3 -3
- package/lib/{glob-helpers.cjs → glob-helpers.js} +16 -30
- package/lib/globs.js +3 -3
- package/lib/{ipc-flow-control.cjs → ipc-flow-control.js} +1 -4
- package/lib/load-config.js +2 -3
- package/lib/{now-and-timers.cjs → now-and-timers.js} +11 -8
- package/lib/pkg.js +1 -0
- package/lib/plugin-support/shared-worker-loader.js +2 -2
- package/lib/plugin-support/shared-workers.js +3 -3
- package/lib/provider-manager.js +6 -5
- package/lib/reporters/default.js +1 -1
- package/lib/reporters/improper-usage-messages.js +1 -1
- package/lib/reporters/tap.js +10 -4
- package/lib/runner.js +5 -5
- package/lib/scheduler.js +1 -1
- package/lib/snapshot-manager.js +2 -2
- package/lib/test.js +15 -8
- package/lib/watcher.js +10 -18
- package/lib/worker/base.js +17 -41
- package/lib/worker/{channel.cjs → channel.js} +21 -25
- package/lib/worker/completion-handlers.js +3 -3
- package/lib/worker/{guard-environment.cjs → guard-environment.js} +4 -5
- package/lib/worker/line-numbers.js +3 -7
- package/lib/worker/main.js +11 -0
- package/lib/worker/{options.cjs → options.js} +4 -5
- package/lib/worker/{plugin.cjs → plugin.js} +8 -10
- package/lib/worker/state.js +5 -0
- package/lib/worker/utils.js +5 -0
- package/package.json +28 -36
- package/plugin.d.ts +1 -1
- package/types/{test-fn.d.cts → test-fn.d.ts} +24 -3
- package/types/{try-fn.d.cts → try-fn.d.ts} +1 -2
- package/entrypoints/main.cjs +0 -2
- package/entrypoints/main.d.cts +0 -12
- package/entrypoints/plugin.cjs +0 -2
- package/entrypoints/plugin.d.mts +0 -6
- package/entrypoints/plugin.mjs +0 -4
- package/lib/module-types.js +0 -85
- package/lib/pkg.cjs +0 -2
- package/lib/slash.cjs +0 -36
- package/lib/worker/main.cjs +0 -12
- package/lib/worker/state.cjs +0 -6
- package/lib/worker/utils.cjs +0 -6
- /package/entrypoints/{cli.mjs → cli.js} +0 -0
- /package/types/{assertions.d.cts → assertions.d.ts} +0 -0
- /package/types/{shared-worker.d.cts → shared-worker.d.ts} +0 -0
- /package/types/{state-change-events.d.cts → state-change-events.d.ts} +0 -0
- /package/types/{subscribable.d.cts → subscribable.d.ts} +0 -0
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
|
-
import {
|
|
2
|
+
import {findSourceMap} from 'node:module';
|
|
3
3
|
import {pathToFileURL} from 'node:url';
|
|
4
4
|
|
|
5
|
+
import * as acorn from 'acorn';
|
|
6
|
+
import * as walk from 'acorn-walk';
|
|
5
7
|
import callsites from 'callsites';
|
|
6
8
|
|
|
7
|
-
const require = createRequire(import.meta.url);
|
|
8
|
-
|
|
9
9
|
function parse(file) {
|
|
10
|
-
// Avoid loading these until we actually need to select tests by line number.
|
|
11
|
-
const acorn = require('acorn');
|
|
12
|
-
const walk = require('acorn-walk');
|
|
13
|
-
|
|
14
10
|
const ast = acorn.parse(fs.readFileSync(file, 'utf8'), {
|
|
15
11
|
ecmaVersion: 'latest',
|
|
16
12
|
locations: true,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './guard-environment.js'; // eslint-disable-line import-x/no-unassigned-import
|
|
2
|
+
|
|
3
|
+
import assert from 'node:assert';
|
|
4
|
+
|
|
5
|
+
import {flags, refs} from './state.js';
|
|
6
|
+
|
|
7
|
+
assert.ok(refs.runnerChain);
|
|
8
|
+
|
|
9
|
+
flags.loadedMain = true;
|
|
10
|
+
|
|
11
|
+
export default refs.runnerChain;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
'use strict';
|
|
2
1
|
let options = null;
|
|
3
|
-
|
|
2
|
+
export function get() {
|
|
4
3
|
if (!options) {
|
|
5
4
|
throw new Error('Options have not yet been set');
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
return options;
|
|
9
|
-
}
|
|
8
|
+
}
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
export function set(newOptions) {
|
|
12
11
|
if (options) {
|
|
13
12
|
throw new Error('Options have already been set');
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
options = newOptions;
|
|
17
|
-
}
|
|
16
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import pkg from '../pkg.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {registerSharedWorker as register} from './channel.js';
|
|
4
|
+
import {get as getOptions} from './options.js';
|
|
5
|
+
import {sharedWorkerTeardowns, waitForReady} from './state.js';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
import './guard-environment.js'; // eslint-disable-line import-x/no-unassigned-import
|
|
8
8
|
|
|
9
9
|
const workers = new Map();
|
|
10
10
|
const workerTeardownFns = new WeakMap();
|
|
@@ -83,13 +83,13 @@ function createSharedWorker(filename, initialData, teardown) {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
function registerSharedWorker({
|
|
86
|
+
export function registerSharedWorker({
|
|
87
87
|
filename,
|
|
88
88
|
initialData,
|
|
89
89
|
supportedProtocols,
|
|
90
90
|
teardown,
|
|
91
91
|
}) {
|
|
92
|
-
const options_ =
|
|
92
|
+
const options_ = getOptions();
|
|
93
93
|
|
|
94
94
|
if (!options_.workerThreads) {
|
|
95
95
|
throw new Error('Shared workers can be used only when worker threads are enabled');
|
|
@@ -108,7 +108,7 @@ function registerSharedWorker({
|
|
|
108
108
|
// order. Any error will crash the worker.
|
|
109
109
|
const teardownFns = workerTeardownFns.get(worker);
|
|
110
110
|
if (teardownFns !== undefined) {
|
|
111
|
-
for await (const fn of [...teardownFns].
|
|
111
|
+
for await (const fn of [...teardownFns].toReversed()) {
|
|
112
112
|
await fn();
|
|
113
113
|
}
|
|
114
114
|
}
|
|
@@ -126,5 +126,3 @@ function registerSharedWorker({
|
|
|
126
126
|
|
|
127
127
|
return worker;
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
exports.registerSharedWorker = registerSharedWorker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ava",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Node.js test runner that lets you develop with confidence.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -9,37 +9,25 @@
|
|
|
9
9
|
},
|
|
10
10
|
"homepage": "https://avajs.dev",
|
|
11
11
|
"bin": {
|
|
12
|
-
"ava": "entrypoints/cli.
|
|
12
|
+
"ava": "entrypoints/cli.js"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
"default": "./entrypoints/main.mjs"
|
|
19
|
-
},
|
|
20
|
-
"require": {
|
|
21
|
-
"types": "./entrypoints/main.d.cts",
|
|
22
|
-
"default": "./entrypoints/main.cjs"
|
|
23
|
-
}
|
|
16
|
+
"types": "./entrypoints/main.d.ts",
|
|
17
|
+
"default": "./entrypoints/main.js"
|
|
24
18
|
},
|
|
25
|
-
"./eslint-plugin-helper": "./entrypoints/eslint-plugin-helper.
|
|
19
|
+
"./eslint-plugin-helper": "./entrypoints/eslint-plugin-helper.js",
|
|
26
20
|
"./plugin": {
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
"default": "./entrypoints/plugin.mjs"
|
|
30
|
-
},
|
|
31
|
-
"require": {
|
|
32
|
-
"types": "./entrypoints/plugin.d.cts",
|
|
33
|
-
"default": "./entrypoints/plugin.cjs"
|
|
34
|
-
}
|
|
21
|
+
"types": "./entrypoints/plugin.d.ts",
|
|
22
|
+
"default": "./entrypoints/plugin.js"
|
|
35
23
|
},
|
|
36
24
|
"./internal": {
|
|
37
|
-
"types": "./entrypoints/internal.d.
|
|
25
|
+
"types": "./entrypoints/internal.d.ts"
|
|
38
26
|
}
|
|
39
27
|
},
|
|
40
28
|
"type": "module",
|
|
41
29
|
"engines": {
|
|
42
|
-
"node": "^
|
|
30
|
+
"node": "^22.20 || ^24.12 || >=25"
|
|
43
31
|
},
|
|
44
32
|
"scripts": {
|
|
45
33
|
"test": "./scripts/test.sh"
|
|
@@ -86,66 +74,70 @@
|
|
|
86
74
|
"typescript"
|
|
87
75
|
],
|
|
88
76
|
"dependencies": {
|
|
89
|
-
"@vercel/nft": "^1.
|
|
77
|
+
"@vercel/nft": "^1.5.0",
|
|
90
78
|
"acorn": "^8.16.0",
|
|
91
79
|
"acorn-walk": "^8.3.5",
|
|
92
80
|
"ansi-styles": "^6.2.3",
|
|
93
81
|
"arrgv": "^1.0.2",
|
|
94
82
|
"arrify": "^3.0.0",
|
|
95
83
|
"callsites": "^4.2.0",
|
|
96
|
-
"cbor": "^10.0.
|
|
84
|
+
"cbor": "^10.0.12",
|
|
97
85
|
"chalk": "^5.6.2",
|
|
98
86
|
"chunkd": "^2.0.1",
|
|
99
87
|
"ci-info": "^4.4.0",
|
|
100
88
|
"ci-parallel-vars": "^1.0.1",
|
|
101
|
-
"cli-truncate": "^
|
|
89
|
+
"cli-truncate": "^6.0.0",
|
|
102
90
|
"code-excerpt": "^4.0.0",
|
|
103
91
|
"common-path-prefix": "^3.0.0",
|
|
104
92
|
"concordance": "^5.0.4",
|
|
105
93
|
"currently-unhandled": "^0.4.1",
|
|
106
94
|
"debug": "^4.4.3",
|
|
107
|
-
"emittery": "^
|
|
95
|
+
"emittery": "^2.0.0",
|
|
108
96
|
"figures": "^6.1.0",
|
|
109
|
-
"globby": "^16.
|
|
97
|
+
"globby": "^16.2.0",
|
|
110
98
|
"ignore-by-default": "^2.1.0",
|
|
111
99
|
"indent-string": "^5.0.0",
|
|
112
100
|
"is-plain-object": "^5.0.0",
|
|
113
101
|
"is-promise": "^4.0.0",
|
|
114
102
|
"matcher": "^6.0.0",
|
|
115
|
-
"memoize": "^
|
|
103
|
+
"memoize": "^11.0.0",
|
|
116
104
|
"ms": "^2.1.3",
|
|
117
105
|
"p-map": "^7.0.4",
|
|
118
106
|
"package-config": "^5.0.0",
|
|
119
|
-
"picomatch": "^4.0.
|
|
107
|
+
"picomatch": "^4.0.4",
|
|
120
108
|
"plur": "^6.0.0",
|
|
121
109
|
"pretty-ms": "^9.3.0",
|
|
122
110
|
"resolve-cwd": "^3.0.0",
|
|
111
|
+
"slash": "^5.1.0",
|
|
123
112
|
"stack-utils": "^2.0.6",
|
|
124
113
|
"supertap": "^3.0.1",
|
|
125
114
|
"temp-dir": "^3.0.0",
|
|
126
|
-
"write-file-atomic": "^7.0.
|
|
115
|
+
"write-file-atomic": "^7.0.1",
|
|
127
116
|
"yargs": "^18.0.0"
|
|
128
117
|
},
|
|
129
118
|
"devDependencies": {
|
|
130
119
|
"@ava/test": "github:avajs/test",
|
|
131
|
-
"@ava/typescript": "^
|
|
120
|
+
"@ava/typescript": "^7.0.0",
|
|
132
121
|
"@sindresorhus/tsconfig": "^8.1.0",
|
|
133
|
-
"@types/node": "^24.
|
|
122
|
+
"@types/node": "^24.12.2",
|
|
134
123
|
"ansi-escapes": "^7.3.0",
|
|
135
124
|
"c8": "^11.0.0",
|
|
136
125
|
"execa": "^9.6.1",
|
|
137
|
-
"expect": "^30.
|
|
138
|
-
"sinon": "^21.0.
|
|
139
|
-
"tap": "^21.6.
|
|
126
|
+
"expect": "^30.3.0",
|
|
127
|
+
"sinon": "^21.0.3",
|
|
128
|
+
"tap": "^21.6.3",
|
|
140
129
|
"tempy": "^3.2.0",
|
|
141
130
|
"tsd": "^0.33.0",
|
|
142
|
-
"typescript": "~
|
|
143
|
-
"xo": "^
|
|
131
|
+
"typescript": "~6.0.2",
|
|
132
|
+
"xo": "^2.0.2",
|
|
144
133
|
"zen-observable": "^0.10.0"
|
|
145
134
|
},
|
|
146
135
|
"overrides": {
|
|
147
136
|
"c8": {
|
|
148
137
|
"yargs": "^18.0.0"
|
|
138
|
+
},
|
|
139
|
+
"test-exclude": {
|
|
140
|
+
"glob": ">=13"
|
|
149
141
|
}
|
|
150
142
|
},
|
|
151
143
|
"peerDependencies": {
|
package/plugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {Assertions} from './assertions.
|
|
2
|
-
import type {Subscribable} from './subscribable.
|
|
3
|
-
import type {TryFn} from './try-fn.
|
|
1
|
+
import type {Assertions} from './assertions.js';
|
|
2
|
+
import type {Subscribable} from './subscribable.js';
|
|
3
|
+
import type {TryFn} from './try-fn.js';
|
|
4
4
|
|
|
5
5
|
/** The `t` value passed to test & hook implementations. */
|
|
6
6
|
export type ExecutionContext<Context = unknown> = {
|
|
@@ -15,6 +15,7 @@ export type ExecutionContext<Context = unknown> = {
|
|
|
15
15
|
|
|
16
16
|
readonly log: LogFn;
|
|
17
17
|
readonly plan: PlanFn;
|
|
18
|
+
/** Declare a function to be run after the test has ended. */
|
|
18
19
|
readonly teardown: TeardownFn;
|
|
19
20
|
readonly timeout: TimeoutFn;
|
|
20
21
|
readonly try: TryFn<Context>;
|
|
@@ -90,8 +91,13 @@ export type TestFn<Context = unknown> = {
|
|
|
90
91
|
macro: MacroFn<Context>;
|
|
91
92
|
meta: Meta;
|
|
92
93
|
only: OnlyFn<Context>;
|
|
94
|
+
/** Declare a test that only runs when `condition` is true; otherwise the test is skipped. */
|
|
95
|
+
runIf: RunIfFn<TestFn<Context>>;
|
|
93
96
|
serial: SerialFn<Context>;
|
|
94
97
|
skip: SkipFn<Context>;
|
|
98
|
+
/** Declare a test that is skipped when `condition` is true. */
|
|
99
|
+
skipIf: SkipIfFn<TestFn<Context>>;
|
|
100
|
+
/** Declare a test that should be implemented later. */
|
|
95
101
|
todo: TodoFn;
|
|
96
102
|
};
|
|
97
103
|
|
|
@@ -158,7 +164,11 @@ export type FailingFn<Context = unknown> = {
|
|
|
158
164
|
<Args extends unknown[]>(macro: Macro<Args, Context>, ...args: Args): void;
|
|
159
165
|
|
|
160
166
|
only: OnlyFn<Context>;
|
|
167
|
+
/** Declare a test that only runs when `condition` is true; otherwise the test is skipped. */
|
|
168
|
+
runIf: RunIfFn<FailingFn<Context>>;
|
|
161
169
|
skip: SkipFn<Context>;
|
|
170
|
+
/** Declare a test that is skipped when `condition` is true. */
|
|
171
|
+
skipIf: SkipIfFn<FailingFn<Context>>;
|
|
162
172
|
};
|
|
163
173
|
|
|
164
174
|
export type HookSkipFn<Context = unknown> = {
|
|
@@ -183,6 +193,9 @@ export type OnlyFn<Context = unknown> = {
|
|
|
183
193
|
<Args extends unknown[]>(macro: Macro<Args, Context>, ...args: Args): void;
|
|
184
194
|
};
|
|
185
195
|
|
|
196
|
+
/** Declare a test that only runs when `condition` is true; otherwise the test is skipped. */
|
|
197
|
+
export type RunIfFn<Chain> = (condition: boolean) => Chain;
|
|
198
|
+
|
|
186
199
|
export type SerialFn<Context = unknown> = {
|
|
187
200
|
/** Declare a serial test. Additional arguments are passed to the implementation or macro. */
|
|
188
201
|
<Args extends unknown[]>(title: string, implementation: Implementation<Args, Context>, ...args: Args): void;
|
|
@@ -198,7 +211,12 @@ export type SerialFn<Context = unknown> = {
|
|
|
198
211
|
beforeEach: BeforeFn<Context>;
|
|
199
212
|
failing: FailingFn<Context>;
|
|
200
213
|
only: OnlyFn<Context>;
|
|
214
|
+
/** Declare a test that only runs when `condition` is true; otherwise the test is skipped. */
|
|
215
|
+
runIf: RunIfFn<SerialFn<Context>>;
|
|
201
216
|
skip: SkipFn<Context>;
|
|
217
|
+
/** Declare a test that is skipped when `condition` is true. */
|
|
218
|
+
skipIf: SkipIfFn<SerialFn<Context>>;
|
|
219
|
+
/** Declare a test that should be implemented later. */
|
|
202
220
|
todo: TodoFn;
|
|
203
221
|
};
|
|
204
222
|
|
|
@@ -210,6 +228,9 @@ export type SkipFn<Context = unknown> = {
|
|
|
210
228
|
<Args extends unknown[]>(macro: Macro<Args, Context>, ...args: Args): void;
|
|
211
229
|
};
|
|
212
230
|
|
|
231
|
+
/** Declare a test that is skipped when `condition` is true. */
|
|
232
|
+
export type SkipIfFn<Chain> = (condition: boolean) => Chain;
|
|
233
|
+
|
|
213
234
|
/** Declare a test that should be implemented later. */
|
|
214
235
|
export type TodoFn = (title: string) => void;
|
|
215
236
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {Implementation} from './test-fn.
|
|
1
|
+
import type {Implementation} from './test-fn.js';
|
|
2
2
|
|
|
3
3
|
export type CommitDiscardOptions = {
|
|
4
4
|
/**
|
|
@@ -55,4 +55,3 @@ export type TryFn<Context = unknown> = {
|
|
|
55
55
|
*/
|
|
56
56
|
<Args extends unknown[]>(fn: Implementation<Args, Context>, ...args: Args): Promise<TryResult>;
|
|
57
57
|
};
|
|
58
|
-
|
package/entrypoints/main.cjs
DELETED
package/entrypoints/main.d.cts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type {TestFn} from '../types/test-fn.cjs';
|
|
2
|
-
|
|
3
|
-
export type * from '../types/assertions.cjs';
|
|
4
|
-
export type * from '../types/try-fn.cjs';
|
|
5
|
-
export type * from '../types/test-fn.cjs';
|
|
6
|
-
export type * from '../types/subscribable.cjs';
|
|
7
|
-
|
|
8
|
-
/** Call to declare a test, or chain to declare hooks or test modifiers */
|
|
9
|
-
declare const test: TestFn;
|
|
10
|
-
|
|
11
|
-
/** Call to declare a test, or chain to declare hooks or test modifiers */
|
|
12
|
-
export default test;
|
package/entrypoints/plugin.cjs
DELETED
package/entrypoints/plugin.d.mts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type {SharedWorker} from '../types/shared-worker.cjs';
|
|
2
|
-
|
|
3
|
-
export function registerSharedWorker<Data = unknown>(options: SharedWorker.Plugin.RegistrationOptions<'ava-4', Data>): SharedWorker.Plugin.Protocol<Data>;
|
|
4
|
-
// Add overloads for additional protocols.
|
|
5
|
-
|
|
6
|
-
export type {SharedWorker} from '../types/shared-worker.cjs';
|
package/entrypoints/plugin.mjs
DELETED
package/lib/module-types.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
const requireTrueValue = value => {
|
|
2
|
-
if (value !== true) {
|
|
3
|
-
throw new TypeError('When specifying module types, use `true` for ’cjs’, ’mjs’ and ’js’ extensions');
|
|
4
|
-
}
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const normalize = (extension, type, defaultModuleType) => {
|
|
8
|
-
switch (extension) {
|
|
9
|
-
case 'cjs': {
|
|
10
|
-
requireTrueValue(type);
|
|
11
|
-
return 'commonjs';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
case 'mjs': {
|
|
15
|
-
requireTrueValue(type);
|
|
16
|
-
return 'module';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
case 'js': {
|
|
20
|
-
requireTrueValue(type);
|
|
21
|
-
return defaultModuleType;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
default: {
|
|
25
|
-
if (type !== 'commonjs' && type !== 'module') {
|
|
26
|
-
throw new TypeError(`Module type for ’${extension}’ must be ’commonjs’ or ’module’`);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return type;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const deriveFromObject = (extensionsObject, defaultModuleType) => {
|
|
35
|
-
const moduleTypes = {};
|
|
36
|
-
for (const [extension, type] of Object.entries(extensionsObject)) {
|
|
37
|
-
moduleTypes[extension] = normalize(extension, type, defaultModuleType);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return moduleTypes;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const deriveFromArray = (extensions, defaultModuleType) => {
|
|
44
|
-
const moduleTypes = {};
|
|
45
|
-
for (const extension of extensions) {
|
|
46
|
-
switch (extension) {
|
|
47
|
-
case 'cjs': {
|
|
48
|
-
moduleTypes.cjs = 'commonjs';
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
case 'mjs': {
|
|
53
|
-
moduleTypes.mjs = 'module';
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
case 'js': {
|
|
58
|
-
moduleTypes.js = defaultModuleType;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
default: {
|
|
63
|
-
moduleTypes[extension] = 'commonjs';
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return moduleTypes;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export default function moduleTypes(configuredExtensions, defaultModuleType) {
|
|
72
|
-
if (configuredExtensions === undefined) {
|
|
73
|
-
return {
|
|
74
|
-
cjs: 'commonjs',
|
|
75
|
-
mjs: 'module',
|
|
76
|
-
js: defaultModuleType,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (Array.isArray(configuredExtensions)) {
|
|
81
|
-
return deriveFromArray(configuredExtensions, defaultModuleType);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return deriveFromObject(configuredExtensions, defaultModuleType);
|
|
85
|
-
}
|
package/lib/pkg.cjs
DELETED
package/lib/slash.cjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Inlined from
|
|
3
|
-
<https://github.com/sindresorhus/slash/blob/98b618f5a3bfcb5dd374b204868818845b87bb2f/index.js>,
|
|
4
|
-
since we need a CJS version.
|
|
5
|
-
|
|
6
|
-
Copyright 2023 Sindre Sorhus
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
9
|
-
this software and associated documentation files (the “Software”), to deal in
|
|
10
|
-
the Software without restriction, including without limitation the rights to
|
|
11
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
12
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
13
|
-
subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
20
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
21
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
22
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
23
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
function slash(path) {
|
|
27
|
-
const isExtendedLengthPath = path.startsWith('\\\\?\\');
|
|
28
|
-
|
|
29
|
-
if (isExtendedLengthPath) {
|
|
30
|
-
return path;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return path.replaceAll('\\', '/');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
module.exports = slash;
|
package/lib/worker/main.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
require('./guard-environment.cjs'); // eslint-disable-line import-x/no-unassigned-import
|
|
3
|
-
|
|
4
|
-
const assert = require('node:assert');
|
|
5
|
-
|
|
6
|
-
const {flags, refs} = require('./state.cjs');
|
|
7
|
-
|
|
8
|
-
assert(refs.runnerChain);
|
|
9
|
-
|
|
10
|
-
flags.loadedMain = true;
|
|
11
|
-
|
|
12
|
-
module.exports = refs.runnerChain;
|
package/lib/worker/state.cjs
DELETED
package/lib/worker/utils.cjs
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|