@bemedev/dev-utils 0.3.1 → 0.3.2
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/README.md +30 -36
- package/lib/build-tests/addTarball.cjs +2 -2
- package/lib/build-tests/addTarball.js +1 -1
- package/lib/build-tests/cli/cli.d.ts +18 -18
- package/lib/build-tests/pack.cjs +2 -2
- package/lib/build-tests/pack.js +2 -2
- package/lib/rolldown-config/config.cjs +1 -1
- package/lib/rolldown-config/config.js +1 -1
- package/lib/rolldown-config/helpers.cjs +1 -1
- package/lib/rolldown-config/helpers.js +1 -1
- package/lib/rolldown-config/input.cjs +1 -1
- package/lib/rolldown-config/input.js +1 -1
- package/lib/rolldown-config/plugins/circulars.cjs +1 -1
- package/lib/rolldown-config/plugins/circulars.js +1 -1
- package/lib/rolldown-config/plugins/clean.cjs +1 -1
- package/lib/rolldown-config/plugins/clean.js +1 -1
- package/lib/rolldown-config/plugins/typescript.config.cjs +1 -1
- package/lib/rolldown-config/plugins/typescript.config.js +1 -1
- package/lib/vitest-exclude/vitest.cjs +1 -1
- package/lib/vitest-exclude/vitest.js +1 -1
- package/lib/vitest-exclude/vitest.utils.cjs +2 -2
- package/lib/vitest-exclude/vitest.utils.js +2 -2
- package/lib/vitest-extended/createTests.cjs +1 -1
- package/lib/vitest-extended/createTests.js +1 -1
- package/lib/vitest-extended/each/error.cjs +1 -1
- package/lib/vitest-extended/each/error.js +1 -1
- package/lib/vitest-extended/each/pass.cjs +1 -1
- package/lib/vitest-extended/each/pass.js +1 -1
- package/package.json +3 -9
- package/lib/index.cjs +0 -31
- package/lib/index.d.ts +0 -11
- package/lib/index.js +0 -14
package/README.md
CHANGED
|
@@ -31,21 +31,17 @@ yarn add @bemedev/dev-utils
|
|
|
31
31
|
|
|
32
32
|
## Usage
|
|
33
33
|
|
|
34
|
+
Each module is available as a dedicated sub-path export — there is no
|
|
35
|
+
root barrel export:
|
|
36
|
+
|
|
34
37
|
```typescript
|
|
35
|
-
import {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
createTests,
|
|
41
|
-
createFakeWaiter,
|
|
42
|
-
addTarball,
|
|
43
|
-
cleanup,
|
|
44
|
-
} from '@bemedev/dev-utils';
|
|
38
|
+
import { createAlias, aliasTs } from '@bemedev/dev-utils/vitest-alias';
|
|
39
|
+
import { exclude } from '@bemedev/dev-utils/vitest-exclude';
|
|
40
|
+
import { createTests, createFakeWaiter } from '@bemedev/dev-utils/vitest-extended';
|
|
41
|
+
import { defineConfig } from '@bemedev/dev-utils/rolldown';
|
|
42
|
+
import { addTarball, cleanup } from '@bemedev/dev-utils/build-tests';
|
|
45
43
|
```
|
|
46
44
|
|
|
47
|
-
All utilities are exported as named exports from the package root.
|
|
48
|
-
|
|
49
45
|
---
|
|
50
46
|
|
|
51
47
|
## `vitestAlias`
|
|
@@ -60,12 +56,12 @@ object into a Vite-compatible alias map.
|
|
|
60
56
|
|
|
61
57
|
```typescript
|
|
62
58
|
import tsconfig from './tsconfig.json';
|
|
63
|
-
import {
|
|
59
|
+
import { createAlias } from '@bemedev/dev-utils/vitest-alias';
|
|
64
60
|
|
|
65
61
|
// vitest.config.ts
|
|
66
62
|
export default defineConfig({
|
|
67
63
|
test: {
|
|
68
|
-
alias:
|
|
64
|
+
alias: createAlias(tsconfig),
|
|
69
65
|
},
|
|
70
66
|
});
|
|
71
67
|
```
|
|
@@ -90,11 +86,11 @@ result into `test.alias`.
|
|
|
90
86
|
|
|
91
87
|
```typescript
|
|
92
88
|
import tsconfig from './tsconfig.json';
|
|
93
|
-
import {
|
|
89
|
+
import { aliasTs } from '@bemedev/dev-utils/vitest-alias';
|
|
94
90
|
|
|
95
91
|
// vitest.config.ts
|
|
96
92
|
export default defineConfig({
|
|
97
|
-
plugins: [
|
|
93
|
+
plugins: [aliasTs(tsconfig)],
|
|
98
94
|
});
|
|
99
95
|
```
|
|
100
96
|
|
|
@@ -120,12 +116,12 @@ Uses default patterns (`src/**/*.ts` for coverage,
|
|
|
120
116
|
ignore lists.
|
|
121
117
|
|
|
122
118
|
```typescript
|
|
123
|
-
import {
|
|
119
|
+
import { exclude } from '@bemedev/dev-utils/vitest-exclude';
|
|
124
120
|
|
|
125
121
|
// vitest.config.ts
|
|
126
122
|
export default defineConfig({
|
|
127
123
|
plugins: [
|
|
128
|
-
|
|
124
|
+
exclude({
|
|
129
125
|
ignoreTestFiles: ['src/fixtures/**'],
|
|
130
126
|
ignoreCoverageFiles: ['src/**/*.types.ts'],
|
|
131
127
|
}),
|
|
@@ -150,7 +146,7 @@ Same as `exclude`, but lets you provide custom glob patterns instead of the
|
|
|
150
146
|
defaults.
|
|
151
147
|
|
|
152
148
|
```typescript
|
|
153
|
-
|
|
149
|
+
exclude.withPattern(
|
|
154
150
|
{
|
|
155
151
|
patternTest: 'tests/**/*.test.ts',
|
|
156
152
|
patternCov: 'src/**/*.ts',
|
|
@@ -181,9 +177,7 @@ Creates a reusable test suite for a function with `acceptation`, `success`,
|
|
|
181
177
|
and `fails` runners.
|
|
182
178
|
|
|
183
179
|
```typescript
|
|
184
|
-
import {
|
|
185
|
-
|
|
186
|
-
const { createTests } = vitestExtended;
|
|
180
|
+
import { createTests } from '@bemedev/dev-utils/vitest-extended';
|
|
187
181
|
|
|
188
182
|
// add.ts
|
|
189
183
|
export const add = (a: number, b: number) => a + b;
|
|
@@ -254,9 +248,9 @@ Wraps a callback-style (done-based) test into a Vitest `test`. The test
|
|
|
254
248
|
passes only when `done()` is called within the timeout.
|
|
255
249
|
|
|
256
250
|
```typescript
|
|
257
|
-
import {
|
|
251
|
+
import { doneTest } from '@bemedev/dev-utils/vitest-extended';
|
|
258
252
|
|
|
259
|
-
|
|
253
|
+
doneTest('fires callback', done => {
|
|
260
254
|
emitter.once('event', done);
|
|
261
255
|
emitter.emit('event');
|
|
262
256
|
});
|
|
@@ -285,9 +279,9 @@ Creates a fake-timer-aware async waiter. If fake timers are active it
|
|
|
285
279
|
advances them; otherwise it uses a real `sleep`.
|
|
286
280
|
|
|
287
281
|
```typescript
|
|
288
|
-
import {
|
|
282
|
+
import { createFakeWaiter } from '@bemedev/dev-utils/vitest-extended';
|
|
289
283
|
|
|
290
|
-
const wait =
|
|
284
|
+
const wait = createFakeWaiter(vi);
|
|
291
285
|
|
|
292
286
|
test('advances time', async () => {
|
|
293
287
|
vi.useFakeTimers();
|
|
@@ -317,9 +311,9 @@ test('advances time', async () => {
|
|
|
317
311
|
A typed wrapper around `test.concurrent.each` for synchronous functions.
|
|
318
312
|
|
|
319
313
|
```typescript
|
|
320
|
-
import {
|
|
314
|
+
import { useEach } from '@bemedev/dev-utils/vitest-extended';
|
|
321
315
|
|
|
322
|
-
const run =
|
|
316
|
+
const run = useEach(add);
|
|
323
317
|
|
|
324
318
|
run(['1+2', [1, 2], 3], ['0+0', [0, 0], 0]);
|
|
325
319
|
```
|
|
@@ -406,9 +400,9 @@ Produces a full Rolldown config with the default plugin pipeline:
|
|
|
406
400
|
|
|
407
401
|
```typescript
|
|
408
402
|
// rolldown.config.ts
|
|
409
|
-
import {
|
|
403
|
+
import { defineConfig } from '@bemedev/dev-utils/rolldown';
|
|
410
404
|
|
|
411
|
-
export default
|
|
405
|
+
export default defineConfig.default({
|
|
412
406
|
dir: 'lib',
|
|
413
407
|
sourcemap: true,
|
|
414
408
|
excludesTS: ['src/fixtures/**/*.ts'],
|
|
@@ -454,7 +448,7 @@ Opinionated preset that extends `defineConfig.default` with:
|
|
|
454
448
|
- `DEFAULT_CIRCULAR_DEPS` merged into `ignoresJS`
|
|
455
449
|
|
|
456
450
|
```typescript
|
|
457
|
-
export default
|
|
451
|
+
export default defineConfig.bemedev({
|
|
458
452
|
excludesTS: ['src/my-fixtures/**'],
|
|
459
453
|
});
|
|
460
454
|
```
|
|
@@ -478,7 +472,7 @@ Pass plugin keys as strings in the `plugins` array to reorder or subset
|
|
|
478
472
|
them:
|
|
479
473
|
|
|
480
474
|
```typescript
|
|
481
|
-
|
|
475
|
+
defineConfig.default({
|
|
482
476
|
plugins: ['alias', 'tsPaths', 'externals', 'typescript'],
|
|
483
477
|
});
|
|
484
478
|
```
|
|
@@ -529,9 +523,9 @@ Programmatic API for the `pre` step:
|
|
|
529
523
|
3. Installs the resulting `.tgz` as `this-gen-1` in `devDependencies`
|
|
530
524
|
|
|
531
525
|
```typescript
|
|
532
|
-
import {
|
|
526
|
+
import { addTarball } from '@bemedev/dev-utils/build-tests';
|
|
533
527
|
|
|
534
|
-
await
|
|
528
|
+
await addTarball();
|
|
535
529
|
```
|
|
536
530
|
|
|
537
531
|
---
|
|
@@ -544,9 +538,9 @@ Programmatic API for the `post` step:
|
|
|
544
538
|
2. Runs `pnpm remove this-gen-1`
|
|
545
539
|
|
|
546
540
|
```typescript
|
|
547
|
-
import {
|
|
541
|
+
import { cleanup } from '@bemedev/dev-utils/build-tests';
|
|
548
542
|
|
|
549
|
-
|
|
543
|
+
cleanup();
|
|
550
544
|
```
|
|
551
545
|
|
|
552
546
|
---
|
|
@@ -2,10 +2,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_build_tests_constants = require("./constants.cjs");
|
|
4
4
|
const require_build_tests_pack = require("./pack.cjs");
|
|
5
|
-
let edit_json_file = require("edit-json-file");
|
|
6
|
-
edit_json_file = require_runtime.__toESM(edit_json_file);
|
|
7
5
|
let shelljs = require("shelljs");
|
|
8
6
|
shelljs = require_runtime.__toESM(shelljs);
|
|
7
|
+
let edit_json_file = require("edit-json-file");
|
|
8
|
+
edit_json_file = require_runtime.__toESM(edit_json_file);
|
|
9
9
|
let sort_keys = require("sort-keys");
|
|
10
10
|
sort_keys = require_runtime.__toESM(sort_keys);
|
|
11
11
|
//#region src/build-tests/addTarball.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FILE_ORIGIN, PACKAGE_PATH, devKey, this1 } from "./constants.js";
|
|
2
2
|
import { pack } from "./pack.js";
|
|
3
|
-
import editJsonFile from "edit-json-file";
|
|
4
3
|
import sh from "shelljs";
|
|
4
|
+
import editJsonFile from "edit-json-file";
|
|
5
5
|
import sortKeys from "sort-keys";
|
|
6
6
|
//#region src/build-tests/addTarball.ts
|
|
7
7
|
const addTarball = async () => {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export declare const BIN = "build-tests";
|
|
2
2
|
export declare const cli: Partial<import("cmd-ts/dist/cjs/argparser").Register> & {
|
|
3
3
|
parse(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<{
|
|
4
|
+
command: "posttest";
|
|
5
|
+
args: {};
|
|
6
|
+
} | {
|
|
7
|
+
command: "pretest";
|
|
8
|
+
args: {};
|
|
9
|
+
} | {
|
|
4
10
|
command: "test";
|
|
5
11
|
args: {
|
|
6
12
|
pretest: boolean;
|
|
@@ -8,14 +14,14 @@ export declare const cli: Partial<import("cmd-ts/dist/cjs/argparser").Register>
|
|
|
8
14
|
pre: boolean;
|
|
9
15
|
post: boolean;
|
|
10
16
|
};
|
|
11
|
-
} | {
|
|
12
|
-
command: "posttest";
|
|
13
|
-
args: {};
|
|
14
|
-
} | {
|
|
15
|
-
command: "pretest";
|
|
16
|
-
args: {};
|
|
17
17
|
}>>;
|
|
18
18
|
} & import("cmd-ts/dist/cjs/helpdoc").Named & Partial<import("cmd-ts/dist/cjs/helpdoc").Descriptive & import("cmd-ts/dist/cjs/helpdoc").Versioned> & import("cmd-ts/dist/cjs/helpdoc").PrintHelp & Partial<import("cmd-ts/dist/cjs/helpdoc").Versioned> & import("cmd-ts/dist/cjs/argparser").Register & import("cmd-ts/dist/cjs/runner").Handling<{
|
|
19
|
+
command: "posttest";
|
|
20
|
+
args: {};
|
|
21
|
+
} | {
|
|
22
|
+
command: "pretest";
|
|
23
|
+
args: {};
|
|
24
|
+
} | {
|
|
19
25
|
command: "test";
|
|
20
26
|
args: {
|
|
21
27
|
pretest: boolean;
|
|
@@ -23,30 +29,24 @@ export declare const cli: Partial<import("cmd-ts/dist/cjs/argparser").Register>
|
|
|
23
29
|
pre: boolean;
|
|
24
30
|
post: boolean;
|
|
25
31
|
};
|
|
26
|
-
} | {
|
|
27
|
-
command: "posttest";
|
|
28
|
-
args: {};
|
|
29
|
-
} | {
|
|
30
|
-
command: "pretest";
|
|
31
|
-
args: {};
|
|
32
32
|
}, {
|
|
33
|
-
command: "test";
|
|
34
|
-
value: Promise<void>;
|
|
35
|
-
} | {
|
|
36
33
|
command: "posttest";
|
|
37
34
|
value: void;
|
|
38
35
|
} | {
|
|
39
36
|
command: "pretest";
|
|
40
37
|
value: Promise<void>;
|
|
38
|
+
} | {
|
|
39
|
+
command: "test";
|
|
40
|
+
value: Promise<void>;
|
|
41
41
|
}> & {
|
|
42
42
|
run(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<{
|
|
43
|
-
command: "test";
|
|
44
|
-
value: Promise<void>;
|
|
45
|
-
} | {
|
|
46
43
|
command: "posttest";
|
|
47
44
|
value: void;
|
|
48
45
|
} | {
|
|
49
46
|
command: "pretest";
|
|
50
47
|
value: Promise<void>;
|
|
48
|
+
} | {
|
|
49
|
+
command: "test";
|
|
50
|
+
value: Promise<void>;
|
|
51
51
|
}>>;
|
|
52
52
|
};
|
package/lib/build-tests/pack.cjs
CHANGED
|
@@ -3,10 +3,10 @@ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
|
3
3
|
const require_build_tests_constants = require("./constants.cjs");
|
|
4
4
|
const require_build_tests_buildPackageJson = require("./buildPackageJson.cjs");
|
|
5
5
|
const require_build_tests_getRelativePath = require("./getRelativePath.cjs");
|
|
6
|
+
let path = require("path");
|
|
7
|
+
let fs_promises = require("fs/promises");
|
|
6
8
|
let shelljs = require("shelljs");
|
|
7
9
|
shelljs = require_runtime.__toESM(shelljs);
|
|
8
|
-
let fs_promises = require("fs/promises");
|
|
9
|
-
let path = require("path");
|
|
10
10
|
//#region src/build-tests/pack.ts
|
|
11
11
|
const pack = async () => {
|
|
12
12
|
const { packageJson, outDir } = require_build_tests_buildPackageJson.buildPackageJson();
|
package/lib/build-tests/pack.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PACKAGE_PATH, TARBALL_FOLDER } from "./constants.js";
|
|
2
2
|
import { buildPackageJson } from "./buildPackageJson.js";
|
|
3
3
|
import { getRelativePath0 } from "./getRelativePath.js";
|
|
4
|
-
import sh from "shelljs";
|
|
5
|
-
import { writeFile } from "fs/promises";
|
|
6
4
|
import { join } from "path";
|
|
5
|
+
import { writeFile } from "fs/promises";
|
|
6
|
+
import sh from "shelljs";
|
|
7
7
|
//#region src/build-tests/pack.ts
|
|
8
8
|
const pack = async () => {
|
|
9
9
|
const { packageJson, outDir } = buildPackageJson();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_rolldown_config_utils = require("./utils.cjs");
|
|
4
|
+
const require_rolldown_config_output = require("./output.cjs");
|
|
4
5
|
const require_rolldown_config_constants = require("./constants.cjs");
|
|
5
6
|
const require_rolldown_config_input = require("./input.cjs");
|
|
6
|
-
const require_rolldown_config_output = require("./output.cjs");
|
|
7
7
|
const require_rolldown_config_plugins_index = require("./plugins/index.cjs");
|
|
8
8
|
let path = require("path");
|
|
9
9
|
path = require_runtime.__toESM(path);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toArray } from "./utils.js";
|
|
2
|
+
import { buildOutput } from "./output.js";
|
|
2
3
|
import { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from "./constants.js";
|
|
3
4
|
import { buildInput } from "./input.js";
|
|
4
|
-
import { buildOutput } from "./output.js";
|
|
5
5
|
import { PLUGIN_BUILDERS } from "./plugins/index.js";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import { defineConfig as defineConfig$1 } from "rolldown";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
-
let path = require("path");
|
|
4
3
|
let fs = require("fs");
|
|
4
|
+
let path = require("path");
|
|
5
5
|
//#region src/rolldown-config/helpers.ts
|
|
6
6
|
const withoutExtension = (file) => {
|
|
7
7
|
return file.slice(0, file.length - (0, path.extname)(file).length);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { extname, relative, resolve } from "path";
|
|
2
1
|
import { rmSync } from "fs";
|
|
2
|
+
import { extname, relative, resolve } from "path";
|
|
3
3
|
//#region src/rolldown-config/helpers.ts
|
|
4
4
|
const withoutExtension = (file) => {
|
|
5
5
|
return file.slice(0, file.length - extname(file).length);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
const require_rolldown_config_constants = require("./constants.cjs");
|
|
4
|
-
let path = require("path");
|
|
5
4
|
let glob = require("glob");
|
|
5
|
+
let path = require("path");
|
|
6
6
|
//#region src/rolldown-config/input.ts
|
|
7
7
|
const buildInput = (...ignores) => Object.fromEntries((0, glob.globSync)("src/**/*.ts", { ignore: require_rolldown_config_constants.DEFAULT_EXCLUDE.concat(ignores) }).map((file) => {
|
|
8
8
|
return [(0, path.relative)("src", file.slice(0, file.length - (0, path.extname)(file).length)), `${process.cwd()}/${file}`];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_EXCLUDE } from "./constants.js";
|
|
2
|
-
import { extname, relative } from "path";
|
|
3
2
|
import { globSync } from "glob";
|
|
3
|
+
import { extname, relative } from "path";
|
|
4
4
|
//#region src/rolldown-config/input.ts
|
|
5
5
|
const buildInput = (...ignores) => Object.fromEntries(globSync("src/**/*.ts", { ignore: DEFAULT_EXCLUDE.concat(ignores) }).map((file) => {
|
|
6
6
|
return [relative("src", file.slice(0, file.length - extname(file).length)), `${process.cwd()}/${file}`];
|
|
@@ -3,8 +3,8 @@ require("../../_virtual/_rolldown/runtime.cjs");
|
|
|
3
3
|
const require_rolldown_config_utils = require("../utils.cjs");
|
|
4
4
|
const require_rolldown_config_constants = require("../constants.cjs");
|
|
5
5
|
const require_rolldown_config_helpers = require("../helpers.cjs");
|
|
6
|
-
let path = require("path");
|
|
7
6
|
let glob = require("glob");
|
|
7
|
+
let path = require("path");
|
|
8
8
|
let rollup_plugin_circular_dependencies = require("rollup-plugin-circular-dependencies");
|
|
9
9
|
//#region src/rolldown-config/plugins/circulars.ts
|
|
10
10
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { toArray } from "../utils.js";
|
|
2
2
|
import { WARNING_CODES } from "../constants.js";
|
|
3
3
|
import { withoutExtension } from "../helpers.js";
|
|
4
|
-
import { relative } from "path";
|
|
5
4
|
import { globSync } from "glob";
|
|
5
|
+
import { relative } from "path";
|
|
6
6
|
import { circularDependencies } from "rollup-plugin-circular-dependencies";
|
|
7
7
|
//#region src/rolldown-config/plugins/circulars.ts
|
|
8
8
|
/**
|
|
@@ -3,8 +3,8 @@ require("../../_virtual/_rolldown/runtime.cjs");
|
|
|
3
3
|
const require_rolldown_config_utils = require("../utils.cjs");
|
|
4
4
|
const require_rolldown_config_constants = require("../constants.cjs");
|
|
5
5
|
const require_rolldown_config_helpers = require("../helpers.cjs");
|
|
6
|
-
let path = require("path");
|
|
7
6
|
let glob = require("glob");
|
|
7
|
+
let path = require("path");
|
|
8
8
|
//#region src/rolldown-config/plugins/clean.ts
|
|
9
9
|
const clean = (options = {}) => {
|
|
10
10
|
const { ignoresJS, sourcemap = false, dir = "" } = options;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { toArray } from "../utils.js";
|
|
2
2
|
import { WARNING_CODES } from "../constants.js";
|
|
3
3
|
import { cleanupJS, withoutExtension } from "../helpers.js";
|
|
4
|
-
import { relative } from "path";
|
|
5
4
|
import { globSync } from "glob";
|
|
5
|
+
import { relative } from "path";
|
|
6
6
|
//#region src/rolldown-config/plugins/clean.ts
|
|
7
7
|
const clean = (options = {}) => {
|
|
8
8
|
const { ignoresJS, sourcemap = false, dir = "" } = options;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
-
let path = require("path");
|
|
4
3
|
let fs = require("fs");
|
|
4
|
+
let path = require("path");
|
|
5
5
|
let typescript = require("typescript");
|
|
6
6
|
typescript = require_runtime.__toESM(typescript);
|
|
7
7
|
//#region src/rolldown-config/plugins/typescript.config.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { join, resolve } from "path";
|
|
2
1
|
import { existsSync, readFileSync, readdirSync, statSync } from "fs";
|
|
2
|
+
import { join, resolve } from "path";
|
|
3
3
|
import ts from "typescript";
|
|
4
4
|
//#region src/rolldown-config/plugins/typescript.config.ts
|
|
5
5
|
const _readFile = (filePath) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vitest_exclude_constants = require("./constants.cjs");
|
|
3
2
|
const require_vitest_exclude_vitest_utils = require("./vitest.utils.cjs");
|
|
3
|
+
const require_vitest_exclude_constants = require("./constants.cjs");
|
|
4
4
|
//#region src/vitest-exclude/vitest.ts
|
|
5
5
|
/**
|
|
6
6
|
* Plugin to add files with glob patterns to vitest
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
-
let path = require("path");
|
|
4
|
-
let glob = require("glob");
|
|
5
3
|
let fs = require("fs");
|
|
4
|
+
let glob = require("glob");
|
|
5
|
+
let path = require("path");
|
|
6
6
|
//#region src/vitest-exclude/vitest.utils.ts
|
|
7
7
|
const hasSrc = () => {
|
|
8
8
|
return (0, fs.existsSync)((0, path.join)(process.cwd(), "src"));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { join } from "path";
|
|
2
|
-
import { glob } from "glob";
|
|
3
1
|
import { existsSync } from "fs";
|
|
2
|
+
import { glob } from "glob";
|
|
3
|
+
import { join } from "path";
|
|
4
4
|
//#region src/vitest-exclude/vitest.utils.ts
|
|
5
5
|
const hasSrc = () => {
|
|
6
6
|
return existsSync(join(process.cwd(), "src"));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_vitest_extended_toStringFlat = require("./toStringFlat.cjs");
|
|
3
4
|
const require_vitest_extended_acceptation = require("./acceptation.cjs");
|
|
4
5
|
const require_vitest_extended_each_error = require("./each/error.cjs");
|
|
5
6
|
const require_vitest_extended_each_pass = require("./each/pass.cjs");
|
|
6
|
-
const require_vitest_extended_toStringFlat = require("./toStringFlat.cjs");
|
|
7
7
|
let vitest = require("vitest");
|
|
8
8
|
//#region src/vitest-extended/createTests.ts
|
|
9
9
|
const _create = (func, transform, toError, name) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { toStringFlat } from "./toStringFlat.js";
|
|
1
2
|
import { useTFA } from "./acceptation.js";
|
|
2
3
|
import { useErrorAsyncEach } from "./each/error.js";
|
|
3
4
|
import { useEachAsync } from "./each/pass.js";
|
|
4
|
-
import { toStringFlat } from "./toStringFlat.js";
|
|
5
5
|
import { beforeAll, vi } from "vitest";
|
|
6
6
|
//#region src/vitest-extended/createTests.ts
|
|
7
7
|
const _create = (func, transform, toError, name) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
-
const require_vitest_extended_identity = require("../identity.cjs");
|
|
4
3
|
const require_vitest_extended_toArray = require("../toArray.cjs");
|
|
4
|
+
const require_vitest_extended_identity = require("../identity.cjs");
|
|
5
5
|
let vitest = require("vitest");
|
|
6
6
|
//#region src/vitest-extended/each/error.ts
|
|
7
7
|
const useErrorAsyncEachCases = (f, transform = require_vitest_extended_identity.identity, toError = () => void 0, ...cases) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { identity } from "../identity.js";
|
|
2
1
|
import { toArrayVitest } from "../toArray.js";
|
|
2
|
+
import { identity } from "../identity.js";
|
|
3
3
|
import { expect, test } from "vitest";
|
|
4
4
|
//#region src/vitest-extended/each/error.ts
|
|
5
5
|
const useErrorAsyncEachCases = (f, transform = identity, toError = () => void 0, ...cases) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
-
const require_vitest_extended_identity = require("../identity.cjs");
|
|
4
3
|
const require_vitest_extended_toArray = require("../toArray.cjs");
|
|
4
|
+
const require_vitest_extended_identity = require("../identity.cjs");
|
|
5
5
|
let vitest = require("vitest");
|
|
6
6
|
//#region src/vitest-extended/each/pass.ts
|
|
7
7
|
const useEachCases = (func, transform = require_vitest_extended_identity.identity, ...cases) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defaultEquality, identity } from "../identity.js";
|
|
2
1
|
import { toArrayVitest } from "../toArray.js";
|
|
2
|
+
import { defaultEquality, identity } from "../identity.js";
|
|
3
3
|
import { test } from "vitest";
|
|
4
4
|
//#region src/vitest-extended/each/pass.ts
|
|
5
5
|
const useEachCases = (func, transform = identity, ...cases) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemedev/dev-utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "A collection of utilities for Node.js development, including build tools, testing utilities, and configuration management.",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "bri_lvi@icloud.com",
|
|
@@ -13,14 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"type": "module",
|
|
16
|
-
"main": "lib/index.js",
|
|
17
|
-
"types": "lib/index.d.ts",
|
|
18
|
-
"module": "lib/index.js",
|
|
19
16
|
"exports": {
|
|
20
|
-
".": {
|
|
21
|
-
"import": "./lib/index.js",
|
|
22
|
-
"require": "./lib/index.cjs"
|
|
23
|
-
},
|
|
24
17
|
"./build-tests": {
|
|
25
18
|
"import": "./lib/build-tests/cli/index.js",
|
|
26
19
|
"require": "./lib/build-tests/cli/index.cjs"
|
|
@@ -40,7 +33,8 @@
|
|
|
40
33
|
"./vitest-extended": {
|
|
41
34
|
"import": "./lib/vitest-extended/index.js",
|
|
42
35
|
"require": "./lib/vitest-extended/index.cjs"
|
|
43
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
44
38
|
},
|
|
45
39
|
"maintainers": [
|
|
46
40
|
{
|
package/lib/index.cjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_build_tests_addTarball = require("./build-tests/addTarball.cjs");
|
|
3
|
-
const require_build_tests_cleanup = require("./build-tests/cleanup.cjs");
|
|
4
|
-
const require_rolldown_config_plugins_index = require("./rolldown-config/plugins/index.cjs");
|
|
5
|
-
const require_rolldown_config_config = require("./rolldown-config/config.cjs");
|
|
6
|
-
const require_vitest_alias_vitest = require("./vitest-alias/vitest.cjs");
|
|
7
|
-
const require_vitest_exclude_vitest = require("./vitest-exclude/vitest.cjs");
|
|
8
|
-
const require_vitest_extended_acceptation = require("./vitest-extended/acceptation.cjs");
|
|
9
|
-
const require_vitest_extended_each_error = require("./vitest-extended/each/error.cjs");
|
|
10
|
-
const require_vitest_extended_each_pass = require("./vitest-extended/each/pass.cjs");
|
|
11
|
-
const require_vitest_extended_createTests = require("./vitest-extended/createTests.cjs");
|
|
12
|
-
const require_vitest_extended_done = require("./vitest-extended/done.cjs");
|
|
13
|
-
require("./vitest-extended/each/index.cjs");
|
|
14
|
-
const require_vitest_extended_fakeWaiter = require("./vitest-extended/fakeWaiter.cjs");
|
|
15
|
-
exports.DEFAULT_PLUGINS_ORDER = require_rolldown_config_plugins_index.DEFAULT_PLUGINS_ORDER;
|
|
16
|
-
exports.PLUGIN_BUILDERS = require_rolldown_config_plugins_index.PLUGIN_BUILDERS;
|
|
17
|
-
exports.addTarball = require_build_tests_addTarball.addTarball;
|
|
18
|
-
exports.aliasTs = require_vitest_alias_vitest.aliasTs;
|
|
19
|
-
exports.cleanup = require_build_tests_cleanup.cleanup;
|
|
20
|
-
exports.createAlias = require_vitest_alias_vitest.createAlias;
|
|
21
|
-
exports.createFakeWaiter = require_vitest_extended_fakeWaiter.createFakeWaiter;
|
|
22
|
-
exports.createTests = require_vitest_extended_createTests.createTests;
|
|
23
|
-
exports.defineConfig = require_rolldown_config_config.defineConfig;
|
|
24
|
-
exports.doneTest = require_vitest_extended_done.doneTest;
|
|
25
|
-
exports.exclude = require_vitest_exclude_vitest.exclude;
|
|
26
|
-
exports.useEach = require_vitest_extended_each_pass.useEach;
|
|
27
|
-
exports.useEachAsync = require_vitest_extended_each_pass.useEachAsync;
|
|
28
|
-
exports.useErrorAsyncEach = require_vitest_extended_each_error.useErrorAsyncEach;
|
|
29
|
-
exports.useErrorAsyncEachCases = require_vitest_extended_each_error.useErrorAsyncEachCases;
|
|
30
|
-
exports.useTFA = require_vitest_extended_acceptation.useTFA;
|
|
31
|
-
exports.useTestFunctionAcceptation = require_vitest_extended_acceptation.useTestFunctionAcceptation;
|
package/lib/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './build-tests/addTarball';
|
|
2
|
-
export * from './build-tests/cleanup';
|
|
3
|
-
export * from './rolldown-config/config';
|
|
4
|
-
export * from './rolldown-config/plugins';
|
|
5
|
-
export * from './vitest-alias/vitest';
|
|
6
|
-
export * from './vitest-exclude/vitest';
|
|
7
|
-
export * from './vitest-extended/acceptation';
|
|
8
|
-
export * from './vitest-extended/createTests';
|
|
9
|
-
export * from './vitest-extended/done';
|
|
10
|
-
export * from './vitest-extended/each';
|
|
11
|
-
export * from './vitest-extended/fakeWaiter';
|
package/lib/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { addTarball } from "./build-tests/addTarball.js";
|
|
2
|
-
import { cleanup } from "./build-tests/cleanup.js";
|
|
3
|
-
import { DEFAULT_PLUGINS_ORDER, PLUGIN_BUILDERS } from "./rolldown-config/plugins/index.js";
|
|
4
|
-
import { defineConfig } from "./rolldown-config/config.js";
|
|
5
|
-
import { aliasTs, createAlias } from "./vitest-alias/vitest.js";
|
|
6
|
-
import { exclude } from "./vitest-exclude/vitest.js";
|
|
7
|
-
import { useTFA, useTestFunctionAcceptation } from "./vitest-extended/acceptation.js";
|
|
8
|
-
import { useErrorAsyncEach, useErrorAsyncEachCases } from "./vitest-extended/each/error.js";
|
|
9
|
-
import { useEach, useEachAsync } from "./vitest-extended/each/pass.js";
|
|
10
|
-
import { createTests } from "./vitest-extended/createTests.js";
|
|
11
|
-
import { doneTest } from "./vitest-extended/done.js";
|
|
12
|
-
import "./vitest-extended/each/index.js";
|
|
13
|
-
import { createFakeWaiter } from "./vitest-extended/fakeWaiter.js";
|
|
14
|
-
export { DEFAULT_PLUGINS_ORDER, PLUGIN_BUILDERS, addTarball, aliasTs, cleanup, createAlias, createFakeWaiter, createTests, defineConfig, doneTest, exclude, useEach, useEachAsync, useErrorAsyncEach, useErrorAsyncEachCases, useTFA, useTestFunctionAcceptation };
|