@bemedev/dev-utils 0.1.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/LICENSE +21 -0
- package/README.md +577 -0
- package/lib/_virtual/_rolldown/runtime.cjs +33 -0
- package/lib/_virtual/_rolldown/runtime.js +13 -0
- package/lib/build-tests/addTarball.cjs +23 -0
- package/lib/build-tests/addTarball.cjs.map +1 -0
- package/lib/build-tests/addTarball.d.ts +1 -0
- package/lib/build-tests/addTarball.js +18 -0
- package/lib/build-tests/addTarball.js.map +1 -0
- package/lib/build-tests/buildPackageJson.cjs +53 -0
- package/lib/build-tests/buildPackageJson.cjs.map +1 -0
- package/lib/build-tests/buildPackageJson.d.ts +8 -0
- package/lib/build-tests/buildPackageJson.js +49 -0
- package/lib/build-tests/buildPackageJson.js.map +1 -0
- package/lib/build-tests/cleanup.cjs +15 -0
- package/lib/build-tests/cleanup.cjs.map +1 -0
- package/lib/build-tests/cleanup.d.ts +1 -0
- package/lib/build-tests/cleanup.js +12 -0
- package/lib/build-tests/cleanup.js.map +1 -0
- package/lib/build-tests/cli/cli.cjs +23 -0
- package/lib/build-tests/cli/cli.cjs.map +1 -0
- package/lib/build-tests/cli/cli.d.ts +52 -0
- package/lib/build-tests/cli/cli.js +20 -0
- package/lib/build-tests/cli/cli.js.map +1 -0
- package/lib/build-tests/cli/index.cjs +8 -0
- package/lib/build-tests/cli/index.cjs.map +1 -0
- package/lib/build-tests/cli/index.d.ts +2 -0
- package/lib/build-tests/cli/index.js +9 -0
- package/lib/build-tests/cli/index.js.map +1 -0
- package/lib/build-tests/cli/post.cjs +18 -0
- package/lib/build-tests/cli/post.cjs.map +1 -0
- package/lib/build-tests/cli/post.d.ts +5 -0
- package/lib/build-tests/cli/post.js +17 -0
- package/lib/build-tests/cli/post.js.map +1 -0
- package/lib/build-tests/cli/pre.cjs +18 -0
- package/lib/build-tests/cli/pre.cjs.map +1 -0
- package/lib/build-tests/cli/pre.d.ts +5 -0
- package/lib/build-tests/cli/pre.js +17 -0
- package/lib/build-tests/cli/pre.js.map +1 -0
- package/lib/build-tests/cli/test.cjs +41 -0
- package/lib/build-tests/cli/test.cjs.map +1 -0
- package/lib/build-tests/cli/test.d.ts +15 -0
- package/lib/build-tests/cli/test.js +38 -0
- package/lib/build-tests/cli/test.js.map +1 -0
- package/lib/build-tests/constants.cjs +42 -0
- package/lib/build-tests/constants.cjs.map +1 -0
- package/lib/build-tests/constants.d.ts +19 -0
- package/lib/build-tests/constants.js +28 -0
- package/lib/build-tests/constants.js.map +1 -0
- package/lib/build-tests/getRelativePath.cjs +13 -0
- package/lib/build-tests/getRelativePath.cjs.map +1 -0
- package/lib/build-tests/getRelativePath.d.ts +4 -0
- package/lib/build-tests/getRelativePath.js +11 -0
- package/lib/build-tests/getRelativePath.js.map +1 -0
- package/lib/build-tests/getTypescriptOutdir.cjs +14 -0
- package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -0
- package/lib/build-tests/getTypescriptOutdir.d.ts +4 -0
- package/lib/build-tests/getTypescriptOutdir.js +11 -0
- package/lib/build-tests/getTypescriptOutdir.js.map +1 -0
- package/lib/build-tests/index.cjs +20 -0
- package/lib/build-tests/index.cjs.map +1 -0
- package/lib/build-tests/index.d.ts +2 -0
- package/lib/build-tests/index.js +12 -0
- package/lib/build-tests/index.js.map +1 -0
- package/lib/build-tests/pack.cjs +25 -0
- package/lib/build-tests/pack.cjs.map +1 -0
- package/lib/build-tests/pack.d.ts +4 -0
- package/lib/build-tests/pack.js +22 -0
- package/lib/build-tests/pack.js.map +1 -0
- package/lib/index.cjs +36 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +6 -0
- package/lib/rolldown-config/config.cjs +86 -0
- package/lib/rolldown-config/config.cjs.map +1 -0
- package/lib/rolldown-config/config.d.ts +2 -0
- package/lib/rolldown-config/config.js +83 -0
- package/lib/rolldown-config/config.js.map +1 -0
- package/lib/rolldown-config/constants.cjs +31 -0
- package/lib/rolldown-config/constants.cjs.map +1 -0
- package/lib/rolldown-config/constants.d.ts +8 -0
- package/lib/rolldown-config/constants.js +26 -0
- package/lib/rolldown-config/constants.js.map +1 -0
- package/lib/rolldown-config/helpers.cjs +37 -0
- package/lib/rolldown-config/helpers.cjs.map +1 -0
- package/lib/rolldown-config/helpers.d.ts +2 -0
- package/lib/rolldown-config/helpers.js +34 -0
- package/lib/rolldown-config/helpers.js.map +1 -0
- package/lib/rolldown-config/index.cjs +22 -0
- package/lib/rolldown-config/index.cjs.map +1 -0
- package/lib/rolldown-config/index.d.ts +3 -0
- package/lib/rolldown-config/index.js +13 -0
- package/lib/rolldown-config/index.js.map +1 -0
- package/lib/rolldown-config/input.cjs +13 -0
- package/lib/rolldown-config/input.cjs.map +1 -0
- package/lib/rolldown-config/input.d.ts +2 -0
- package/lib/rolldown-config/input.js +11 -0
- package/lib/rolldown-config/input.js.map +1 -0
- package/lib/rolldown-config/output.cjs +23 -0
- package/lib/rolldown-config/output.cjs.map +1 -0
- package/lib/rolldown-config/output.d.ts +15 -0
- package/lib/rolldown-config/output.js +22 -0
- package/lib/rolldown-config/output.js.map +1 -0
- package/lib/rolldown-config/plugins/alias.cjs +17 -0
- package/lib/rolldown-config/plugins/alias.cjs.map +1 -0
- package/lib/rolldown-config/plugins/alias.d.ts +25 -0
- package/lib/rolldown-config/plugins/alias.js +14 -0
- package/lib/rolldown-config/plugins/alias.js.map +1 -0
- package/lib/rolldown-config/plugins/circulars.cjs +37 -0
- package/lib/rolldown-config/plugins/circulars.cjs.map +1 -0
- package/lib/rolldown-config/plugins/circulars.d.ts +11 -0
- package/lib/rolldown-config/plugins/circulars.js +35 -0
- package/lib/rolldown-config/plugins/circulars.js.map +1 -0
- package/lib/rolldown-config/plugins/clean.cjs +45 -0
- package/lib/rolldown-config/plugins/clean.cjs.map +1 -0
- package/lib/rolldown-config/plugins/clean.d.ts +15 -0
- package/lib/rolldown-config/plugins/clean.js +43 -0
- package/lib/rolldown-config/plugins/clean.js.map +1 -0
- package/lib/rolldown-config/plugins/externals.cjs +16 -0
- package/lib/rolldown-config/plugins/externals.cjs.map +1 -0
- package/lib/rolldown-config/plugins/externals.d.ts +9 -0
- package/lib/rolldown-config/plugins/externals.js +14 -0
- package/lib/rolldown-config/plugins/externals.js.map +1 -0
- package/lib/rolldown-config/plugins/index.cjs +29 -0
- package/lib/rolldown-config/plugins/index.cjs.map +1 -0
- package/lib/rolldown-config/plugins/index.d.ts +27 -0
- package/lib/rolldown-config/plugins/index.js +27 -0
- package/lib/rolldown-config/plugins/index.js.map +1 -0
- package/lib/rolldown-config/plugins/tsPaths.cjs +17 -0
- package/lib/rolldown-config/plugins/tsPaths.cjs.map +1 -0
- package/lib/rolldown-config/plugins/tsPaths.d.ts +9 -0
- package/lib/rolldown-config/plugins/tsPaths.js +14 -0
- package/lib/rolldown-config/plugins/tsPaths.js.map +1 -0
- package/lib/rolldown-config/plugins/typescript.cjs +56 -0
- package/lib/rolldown-config/plugins/typescript.cjs.map +1 -0
- package/lib/rolldown-config/plugins/typescript.config.cjs +58 -0
- package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -0
- package/lib/rolldown-config/plugins/typescript.config.d.ts +2 -0
- package/lib/rolldown-config/plugins/typescript.config.js +55 -0
- package/lib/rolldown-config/plugins/typescript.config.js.map +1 -0
- package/lib/rolldown-config/plugins/typescript.d.ts +9 -0
- package/lib/rolldown-config/plugins/typescript.js +53 -0
- package/lib/rolldown-config/plugins/typescript.js.map +1 -0
- package/lib/rolldown-config/types.d.ts +20 -0
- package/lib/rolldown-config/utils.cjs +11 -0
- package/lib/rolldown-config/utils.cjs.map +1 -0
- package/lib/rolldown-config/utils.d.ts +2 -0
- package/lib/rolldown-config/utils.js +10 -0
- package/lib/rolldown-config/utils.js.map +1 -0
- package/lib/utils/index.cjs +3 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/sleep.cjs +9 -0
- package/lib/utils/sleep.cjs.map +1 -0
- package/lib/utils/sleep.d.ts +1 -0
- package/lib/utils/sleep.js +8 -0
- package/lib/utils/sleep.js.map +1 -0
- package/lib/utils/types.d.ts +1 -0
- package/lib/vitest-alias/index.cjs +19 -0
- package/lib/vitest-alias/index.cjs.map +1 -0
- package/lib/vitest-alias/index.d.ts +1 -0
- package/lib/vitest-alias/index.js +11 -0
- package/lib/vitest-alias/index.js.map +1 -0
- package/lib/vitest-alias/vitest.cjs +77 -0
- package/lib/vitest-alias/vitest.cjs.map +1 -0
- package/lib/vitest-alias/vitest.d.ts +38 -0
- package/lib/vitest-alias/vitest.js +74 -0
- package/lib/vitest-alias/vitest.js.map +1 -0
- package/lib/vitest-exclude/constants.cjs +7 -0
- package/lib/vitest-exclude/constants.cjs.map +1 -0
- package/lib/vitest-exclude/constants.d.ts +1 -0
- package/lib/vitest-exclude/constants.js +6 -0
- package/lib/vitest-exclude/constants.js.map +1 -0
- package/lib/vitest-exclude/index.cjs +15 -0
- package/lib/vitest-exclude/index.cjs.map +1 -0
- package/lib/vitest-exclude/index.d.ts +1 -0
- package/lib/vitest-exclude/index.js +8 -0
- package/lib/vitest-exclude/index.js.map +1 -0
- package/lib/vitest-exclude/types.d.ts +14 -0
- package/lib/vitest-exclude/vitest.cjs +57 -0
- package/lib/vitest-exclude/vitest.cjs.map +1 -0
- package/lib/vitest-exclude/vitest.d.ts +16 -0
- package/lib/vitest-exclude/vitest.js +56 -0
- package/lib/vitest-exclude/vitest.js.map +1 -0
- package/lib/vitest-exclude/vitest.utils.cjs +31 -0
- package/lib/vitest-exclude/vitest.utils.cjs.map +1 -0
- package/lib/vitest-exclude/vitest.utils.d.ts +4 -0
- package/lib/vitest-exclude/vitest.utils.js +26 -0
- package/lib/vitest-exclude/vitest.utils.js.map +1 -0
- package/lib/vitest-extended/acceptation.cjs +24 -0
- package/lib/vitest-extended/acceptation.cjs.map +1 -0
- package/lib/vitest-extended/acceptation.d.ts +7 -0
- package/lib/vitest-extended/acceptation.js +21 -0
- package/lib/vitest-extended/acceptation.js.map +1 -0
- package/lib/vitest-extended/bemedev/globals/types.d.ts +3 -0
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs +17 -0
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs.map +1 -0
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.d.ts +11 -0
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.js +16 -0
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.js.map +1 -0
- package/lib/vitest-extended/createTests.cjs +89 -0
- package/lib/vitest-extended/createTests.cjs.map +1 -0
- package/lib/vitest-extended/createTests.d.ts +58 -0
- package/lib/vitest-extended/createTests.js +87 -0
- package/lib/vitest-extended/createTests.js.map +1 -0
- package/lib/vitest-extended/createTests.types.d.ts +10 -0
- package/lib/vitest-extended/done.cjs +81 -0
- package/lib/vitest-extended/done.cjs.map +1 -0
- package/lib/vitest-extended/done.d.ts +14 -0
- package/lib/vitest-extended/done.js +79 -0
- package/lib/vitest-extended/done.js.map +1 -0
- package/lib/vitest-extended/each/error.cjs +23 -0
- package/lib/vitest-extended/each/error.cjs.map +1 -0
- package/lib/vitest-extended/each/error.d.ts +3 -0
- package/lib/vitest-extended/each/error.js +20 -0
- package/lib/vitest-extended/each/error.js.map +1 -0
- package/lib/vitest-extended/each/error.types.d.ts +5 -0
- package/lib/vitest-extended/each/index.cjs +7 -0
- package/lib/vitest-extended/each/index.d.ts +2 -0
- package/lib/vitest-extended/each/index.js +3 -0
- package/lib/vitest-extended/each/pass.cjs +56 -0
- package/lib/vitest-extended/each/pass.cjs.map +1 -0
- package/lib/vitest-extended/each/pass.d.ts +32 -0
- package/lib/vitest-extended/each/pass.js +53 -0
- package/lib/vitest-extended/each/pass.js.map +1 -0
- package/lib/vitest-extended/each/pass.types.d.ts +6 -0
- package/lib/vitest-extended/fakeWaiter.cjs +29 -0
- package/lib/vitest-extended/fakeWaiter.cjs.map +1 -0
- package/lib/vitest-extended/fakeWaiter.d.ts +9 -0
- package/lib/vitest-extended/fakeWaiter.js +28 -0
- package/lib/vitest-extended/fakeWaiter.js.map +1 -0
- package/lib/vitest-extended/fixtures/coverage.cjs +11 -0
- package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -0
- package/lib/vitest-extended/fixtures/coverage.js +8 -0
- package/lib/vitest-extended/fixtures/coverage.js.map +1 -0
- package/lib/vitest-extended/fixtures/partialCall.cjs +19 -0
- package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -0
- package/lib/vitest-extended/fixtures/partialCall.js +18 -0
- package/lib/vitest-extended/fixtures/partialCall.js.map +1 -0
- package/lib/vitest-extended/fixtures/toUpper.cjs +13 -0
- package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -0
- package/lib/vitest-extended/fixtures/toUpper.js +11 -0
- package/lib/vitest-extended/fixtures/toUpper.js.map +1 -0
- package/lib/vitest-extended/fixtures/vitest.cjs +7 -0
- package/lib/vitest-extended/fixtures/vitest.cjs.map +1 -0
- package/lib/vitest-extended/fixtures/vitest.js +6 -0
- package/lib/vitest-extended/fixtures/vitest.js.map +1 -0
- package/lib/vitest-extended/fixtures/zod.cjs +23 -0
- package/lib/vitest-extended/fixtures/zod.cjs.map +1 -0
- package/lib/vitest-extended/fixtures/zod.js +19 -0
- package/lib/vitest-extended/fixtures/zod.js.map +1 -0
- package/lib/vitest-extended/identity.cjs +14 -0
- package/lib/vitest-extended/identity.cjs.map +1 -0
- package/lib/vitest-extended/identity.d.ts +2 -0
- package/lib/vitest-extended/identity.js +11 -0
- package/lib/vitest-extended/identity.js.map +1 -0
- package/lib/vitest-extended/index.cjs +39 -0
- package/lib/vitest-extended/index.cjs.map +1 -0
- package/lib/vitest-extended/index.d.ts +6 -0
- package/lib/vitest-extended/index.js +24 -0
- package/lib/vitest-extended/index.js.map +1 -0
- package/lib/vitest-extended/isDefined.cjs +9 -0
- package/lib/vitest-extended/isDefined.cjs.map +1 -0
- package/lib/vitest-extended/isDefined.d.ts +2 -0
- package/lib/vitest-extended/isDefined.js +8 -0
- package/lib/vitest-extended/isDefined.js.map +1 -0
- package/lib/vitest-extended/isFunction.cjs +12 -0
- package/lib/vitest-extended/isFunction.cjs.map +1 -0
- package/lib/vitest-extended/isFunction.d.ts +1 -0
- package/lib/vitest-extended/isFunction.js +11 -0
- package/lib/vitest-extended/isFunction.js.map +1 -0
- package/lib/vitest-extended/toArray.cjs +35 -0
- package/lib/vitest-extended/toArray.cjs.map +1 -0
- package/lib/vitest-extended/toArray.d.ts +3 -0
- package/lib/vitest-extended/toArray.js +33 -0
- package/lib/vitest-extended/toArray.js.map +1 -0
- package/lib/vitest-extended/toStringFlat.cjs +18 -0
- package/lib/vitest-extended/toStringFlat.cjs.map +1 -0
- package/lib/vitest-extended/toStringFlat.d.ts +2 -0
- package/lib/vitest-extended/toStringFlat.js +17 -0
- package/lib/vitest-extended/toStringFlat.js.map +1 -0
- package/lib/vitest-extended/types.d.ts +64 -0
- package/package.json +149 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 chlbri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
# @bemedev/dev-utils
|
|
2
|
+
|
|
3
|
+
A collection of utilities for Node.js development, including build tools,
|
|
4
|
+
testing utilities, and configuration management.
|
|
5
|
+
|
|
6
|
+
## Modules
|
|
7
|
+
|
|
8
|
+
| Module | Description |
|
|
9
|
+
| ----------------------------------- | --------------------------------------------- |
|
|
10
|
+
| [`vitestAlias`](#vitestalias) | Vitest plugin to inject tsconfig path aliases |
|
|
11
|
+
| [`vitestExclude`](#vitestexclude) | Vitest plugin for glob-based include/exclude |
|
|
12
|
+
| [`vitestExtended`](#vitestextended) | Extended test helpers for Vitest |
|
|
13
|
+
| [`rolldownConfig`](#rolldownconfig) | Rolldown bundler configuration factory |
|
|
14
|
+
| [`buildTests`](#buildtests) | CLI tooling to build and test packages |
|
|
15
|
+
|
|
16
|
+
<br/>
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm add @bemedev/dev-utils
|
|
22
|
+
# or
|
|
23
|
+
npm install @bemedev/dev-utils
|
|
24
|
+
# or
|
|
25
|
+
yarn add @bemedev/dev-utils
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**Peer dependencies:** `typescript ^5 || ^6`
|
|
29
|
+
|
|
30
|
+
<br/>
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import {
|
|
36
|
+
vitestAlias,
|
|
37
|
+
vitestExclude,
|
|
38
|
+
vitestExtended,
|
|
39
|
+
rolldownConfig,
|
|
40
|
+
buildTests,
|
|
41
|
+
} from '@bemedev/dev-utils';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Each module is exported as a namespace.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## `vitestAlias`
|
|
49
|
+
|
|
50
|
+
Vitest plugin that reads your `tsconfig.json` path mappings and injects
|
|
51
|
+
them as Vitest/Vite aliases — no manual duplication needed.
|
|
52
|
+
|
|
53
|
+
### `createAlias(tsconfig?)`
|
|
54
|
+
|
|
55
|
+
Converts `compilerOptions.paths` (and optional `baseUrl`) from a tsconfig
|
|
56
|
+
object into a Vite-compatible alias map.
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import tsconfig from './tsconfig.json';
|
|
60
|
+
import { vitestAlias } from '@bemedev/dev-utils';
|
|
61
|
+
|
|
62
|
+
// vitest.config.ts
|
|
63
|
+
export default defineConfig({
|
|
64
|
+
test: {
|
|
65
|
+
alias: vitestAlias.createAlias(tsconfig),
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Parameters**
|
|
71
|
+
|
|
72
|
+
| Name | Type | Description |
|
|
73
|
+
| ---------- | --------------------- | --------------------------- |
|
|
74
|
+
| `tsconfig` | `TsConf \| undefined` | Parsed tsconfig JSON object |
|
|
75
|
+
|
|
76
|
+
**Returns** `Record<string, string>` — alias map ready for `test.alias`.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### `aliasTs(tsconfig?)`
|
|
81
|
+
|
|
82
|
+
A Vitest/Vite plugin that automatically calls `createAlias` and merges the
|
|
83
|
+
result into `test.alias`.
|
|
84
|
+
|
|
85
|
+
> **Note:** Make sure `"resolveJsonModule": true` is set in your
|
|
86
|
+
> `compilerOptions`, or pass the parsed JSON directly.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import tsconfig from './tsconfig.json';
|
|
90
|
+
import { vitestAlias } from '@bemedev/dev-utils';
|
|
91
|
+
|
|
92
|
+
// vitest.config.ts
|
|
93
|
+
export default defineConfig({
|
|
94
|
+
plugins: [vitestAlias.aliasTs(tsconfig)],
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Parameters**
|
|
99
|
+
|
|
100
|
+
| Name | Type | Description |
|
|
101
|
+
| ---------- | --------------------- | --------------------------- |
|
|
102
|
+
| `tsconfig` | `TsConf \| undefined` | Parsed tsconfig JSON object |
|
|
103
|
+
|
|
104
|
+
**Returns** a Vitest `Plugin`.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## `vitestExclude`
|
|
109
|
+
|
|
110
|
+
Vitest plugin that uses glob patterns to dynamically build `test.include`
|
|
111
|
+
and `coverage.include` lists — no need to maintain `test.exclude` manually.
|
|
112
|
+
|
|
113
|
+
### `exclude(args?)`
|
|
114
|
+
|
|
115
|
+
Uses default patterns (`src/**/*.ts` for coverage,
|
|
116
|
+
`src/**/*.{test,spec}.{ts,js,tsx,jsx}` for tests) and applies optional
|
|
117
|
+
ignore lists.
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import { vitestExclude } from '@bemedev/dev-utils';
|
|
121
|
+
|
|
122
|
+
// vitest.config.ts
|
|
123
|
+
export default defineConfig({
|
|
124
|
+
plugins: [
|
|
125
|
+
vitestExclude.exclude({
|
|
126
|
+
ignoreTestFiles: ['src/fixtures/**'],
|
|
127
|
+
ignoreCoverageFiles: ['src/**/*.types.ts'],
|
|
128
|
+
}),
|
|
129
|
+
],
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**Parameters (`args`)**
|
|
134
|
+
|
|
135
|
+
| Property | Type | Description |
|
|
136
|
+
| --------------------- | ----------------------- | -------------------------------------------- |
|
|
137
|
+
| `ignoreTestFiles` | `string[] \| undefined` | Glob patterns to exclude from test discovery |
|
|
138
|
+
| `ignoreCoverageFiles` | `string[] \| undefined` | Glob patterns to exclude from coverage |
|
|
139
|
+
|
|
140
|
+
**Returns** a Vitest `Plugin`.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### `exclude.withPattern(patterns, args)`
|
|
145
|
+
|
|
146
|
+
Same as `exclude`, but lets you provide custom glob patterns instead of the
|
|
147
|
+
defaults.
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
vitestExclude.exclude.withPattern(
|
|
151
|
+
{
|
|
152
|
+
patternTest: 'tests/**/*.test.ts',
|
|
153
|
+
patternCov: 'src/**/*.ts',
|
|
154
|
+
},
|
|
155
|
+
{ ignoreTestFiles: ['tests/fixtures/**'] },
|
|
156
|
+
);
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Parameters**
|
|
160
|
+
|
|
161
|
+
| Name | Type | Description |
|
|
162
|
+
| ------------- | -------------------- | ----------------------------------- |
|
|
163
|
+
| `patternTest` | `string \| string[]` | Glob(s) for test file discovery |
|
|
164
|
+
| `patternCov` | `string \| string[]` | Glob(s) for coverage file discovery |
|
|
165
|
+
| `args` | same as `exclude` | Optional ignore lists |
|
|
166
|
+
|
|
167
|
+
**Returns** a Vitest `Plugin`.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## `vitestExtended`
|
|
172
|
+
|
|
173
|
+
Extended helpers for writing structured, type-safe Vitest tests.
|
|
174
|
+
|
|
175
|
+
### `createTests(func, args?)`
|
|
176
|
+
|
|
177
|
+
Creates a reusable test suite for a function with `acceptation`, `success`,
|
|
178
|
+
and `fails` runners.
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
import { vitestExtended } from '@bemedev/dev-utils';
|
|
182
|
+
|
|
183
|
+
const { createTests } = vitestExtended;
|
|
184
|
+
|
|
185
|
+
// add.ts
|
|
186
|
+
export const add = (a: number, b: number) => a + b;
|
|
187
|
+
|
|
188
|
+
// add.test.ts
|
|
189
|
+
const { acceptation, success, fails } = createTests(add);
|
|
190
|
+
|
|
191
|
+
describe('add', () => {
|
|
192
|
+
describe('acceptation', acceptation());
|
|
193
|
+
|
|
194
|
+
describe(
|
|
195
|
+
'success',
|
|
196
|
+
success(
|
|
197
|
+
{ invite: '1 + 2 = 3', parameters: [1, 2], expected: 3 },
|
|
198
|
+
{ invite: '0 + 0 = 0', parameters: [0, 0], expected: 0 },
|
|
199
|
+
),
|
|
200
|
+
);
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
> **Note:** When the first parameter is an array, wrap it in another array:
|
|
205
|
+
> `parameters: [[1, 2, 3]]`.
|
|
206
|
+
|
|
207
|
+
**Parameters**
|
|
208
|
+
|
|
209
|
+
| Name | Type | Description |
|
|
210
|
+
| ---------------- | --------------------------- | --------------------------------------------------------------- |
|
|
211
|
+
| `func` | `Fn` | The function under test |
|
|
212
|
+
| `args.transform` | `NextFn<F> \| undefined` | Optional transformer applied to the return value |
|
|
213
|
+
| `args.toError` | `ToError_F<F> \| undefined` | Optional function that derives an expected error from the input |
|
|
214
|
+
|
|
215
|
+
**Returns** `{ acceptation, success, fails }`:
|
|
216
|
+
|
|
217
|
+
| Method | Signature | Description |
|
|
218
|
+
| ------------------- | ------------ | ------------------------------------------------------ |
|
|
219
|
+
| `acceptation()` | `() => void` | Runs two checks: function is defined and is a function |
|
|
220
|
+
| `success(...cases)` | `() => void` | Runs `test.concurrent.each` for passing cases |
|
|
221
|
+
| `fails(...cases)` | `() => void` | Runs `test.concurrent.each` and expects thrown errors |
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
### `createTests.withImplementation(f, opts)`
|
|
226
|
+
|
|
227
|
+
Same as `createTests` but replaces the implementation with a `vi.fn()` mock
|
|
228
|
+
before the test suite runs.
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
const { acceptation, success } = createTests.withImplementation(myFn, {
|
|
232
|
+
name: 'myFn',
|
|
233
|
+
instanciation: async () => realImpl,
|
|
234
|
+
});
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**`opts` properties**
|
|
238
|
+
|
|
239
|
+
| Property | Type | Description |
|
|
240
|
+
| --------------- | --------------------------- | -------------------------------------------------------- |
|
|
241
|
+
| `instanciation` | `() => Promise<F> \| F` | Factory called in `beforeAll` to set mock implementation |
|
|
242
|
+
| `name` | `string` | Display name used in acceptation tests |
|
|
243
|
+
| `transform` | `NextFn<F> \| undefined` | Optional return-value transformer |
|
|
244
|
+
| `toError` | `ToError_F<F> \| undefined` | Optional error deriver |
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
### `doneTest(invite, fn, options?)`
|
|
249
|
+
|
|
250
|
+
Wraps a callback-style (done-based) test into a Vitest `test`. The test
|
|
251
|
+
passes only when `done()` is called within the timeout.
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import { vitestExtended } from '@bemedev/dev-utils';
|
|
255
|
+
|
|
256
|
+
vitestExtended.doneTest('fires callback', done => {
|
|
257
|
+
emitter.once('event', done);
|
|
258
|
+
emitter.emit('event');
|
|
259
|
+
});
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Parameters**
|
|
263
|
+
|
|
264
|
+
| Name | Type | Default | Description |
|
|
265
|
+
| --------- | ---------------------------- | ------- | ------------------------------------- |
|
|
266
|
+
| `invite` | `string` | — | Test description |
|
|
267
|
+
| `fn` | `(done: () => void) => void` | — | Test body (sync, receives `done`) |
|
|
268
|
+
| `options` | `number \| TestOptions` | `100` | Timeout in ms or Vitest `TestOptions` |
|
|
269
|
+
|
|
270
|
+
**Variants**
|
|
271
|
+
|
|
272
|
+
| Variant | Description |
|
|
273
|
+
| ------------------------------------------- | -------------------------- |
|
|
274
|
+
| `doneTest.fails(invite, fn, options?)` | Expects the test to fail |
|
|
275
|
+
| `doneTest.concurrent(invite, fn, options?)` | Runs the test concurrently |
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
### `createFakeWaiter(vi)`
|
|
280
|
+
|
|
281
|
+
Creates a fake-timer-aware async waiter. If fake timers are active it
|
|
282
|
+
advances them; otherwise it uses a real `sleep`.
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
import { vitestExtended } from '@bemedev/dev-utils';
|
|
286
|
+
|
|
287
|
+
const wait = vitestExtended.createFakeWaiter(vi);
|
|
288
|
+
|
|
289
|
+
test('advances time', async () => {
|
|
290
|
+
vi.useFakeTimers();
|
|
291
|
+
await wait(500); // advances fake timers by 500 ms
|
|
292
|
+
});
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Parameters**
|
|
296
|
+
|
|
297
|
+
| Name | Type | Description |
|
|
298
|
+
| ---- | ------------- | ------------------ |
|
|
299
|
+
| `vi` | `VitestUtils` | Vitest `vi` object |
|
|
300
|
+
|
|
301
|
+
**Returns** `(ms?: number, times?: number) => Promise<void>`
|
|
302
|
+
|
|
303
|
+
**Variants**
|
|
304
|
+
|
|
305
|
+
| Variant | Signature | Description |
|
|
306
|
+
| -------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
307
|
+
| `createFakeWaiter.withDefaultDelay(vi, ms?)` | `(index, times?) => [string, () => Promise<void>]` | Returns a labelled waiter with a fixed delay |
|
|
308
|
+
| `createFakeWaiter.all(vi)` | `(index, ms?, times?) => [string, () => Promise<void>]` | Returns a labelled waiter with configurable delay and repetitions |
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
### `useEach(func, transform?)`
|
|
313
|
+
|
|
314
|
+
A typed wrapper around `test.concurrent.each` for synchronous functions.
|
|
315
|
+
|
|
316
|
+
```typescript
|
|
317
|
+
import { vitestExtended } from '@bemedev/dev-utils';
|
|
318
|
+
|
|
319
|
+
const run = vitestExtended.useEach(add);
|
|
320
|
+
|
|
321
|
+
run(['1+2', [1, 2], 3], ['0+0', [0, 0], 0]);
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
**Parameters**
|
|
325
|
+
|
|
326
|
+
| Name | Type | Description |
|
|
327
|
+
| ----------- | ------------------------ | --------------------------------- |
|
|
328
|
+
| `func` | `Fn` | Function under test |
|
|
329
|
+
| `transform` | `NextFn<F> \| undefined` | Optional return-value transformer |
|
|
330
|
+
|
|
331
|
+
**Returns** `(...cases: TestArgs2<F>) => void`
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
### `useEachAsync(func, transform?)`
|
|
336
|
+
|
|
337
|
+
Same as `useEach` but awaits the function result.
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
### `useErrorAsyncEach(func, transform?, toError?)`
|
|
342
|
+
|
|
343
|
+
Runs async error cases using `expect(fn).rejects.toThrowError(error)`.
|
|
344
|
+
|
|
345
|
+
```typescript
|
|
346
|
+
const runErrors = vitestExtended.useErrorAsyncEach(
|
|
347
|
+
divide,
|
|
348
|
+
undefined,
|
|
349
|
+
([_, b]) => (b === 0 ? 'Division by zero' : undefined),
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
runErrors(['divide by 0', [1, 0], undefined]);
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
### `useTestFunctionAcceptation(f, name?)` / `useTFA`
|
|
358
|
+
|
|
359
|
+
Runs two acceptation checks: the function is defined and is actually a
|
|
360
|
+
function.
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
vitestExtended.useTFA(myFunction, 'myFunction');
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
### Utility helpers
|
|
369
|
+
|
|
370
|
+
| Export | Signature | Description |
|
|
371
|
+
| ---------------------------------- | ----------------------------------- | ------------------------------------------------- |
|
|
372
|
+
| `isDefined(value?)` | `(value?: T \| null) => value is T` | Type guard — not `undefined` or `null` |
|
|
373
|
+
| `isFunction(arg)` | `(arg: any) => boolean` | Type guard — checks if arg is a callable function |
|
|
374
|
+
| `identity(value)` | `<T>(value: T) => T` | Returns the value unchanged |
|
|
375
|
+
| `defaultEquality(value, expected)` | `(a, b) => void` | Strict equality; sorts arrays before comparing |
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## `rolldownConfig`
|
|
380
|
+
|
|
381
|
+
Rolldown bundler configuration factory with built-in plugins for TypeScript
|
|
382
|
+
declarations, path aliasing, circular dependency detection, and
|
|
383
|
+
tree-shaking externals.
|
|
384
|
+
|
|
385
|
+
### `defineConfig(additionals?)`
|
|
386
|
+
|
|
387
|
+
Shorthand for `defineConfig.default`.
|
|
388
|
+
|
|
389
|
+
### `defineConfig.default(params?)`
|
|
390
|
+
|
|
391
|
+
Produces a full Rolldown config with the default plugin pipeline:
|
|
392
|
+
|
|
393
|
+
1. **alias** — resolves tsconfig path aliases (`rollup-plugin-tsc-alias`)
|
|
394
|
+
2. **tsPaths** — resolves tsconfig path imports at bundle time
|
|
395
|
+
(`rollup-plugin-tsconfig-paths`)
|
|
396
|
+
3. **circulars** — warns on circular dependencies
|
|
397
|
+
(`rollup-plugin-circular-dependency`)
|
|
398
|
+
4. **externals** — marks `dependencies` and `peerDependencies` as external
|
|
399
|
+
(`rollup-plugin-node-externals`)
|
|
400
|
+
5. **typescript** — emits `.d.ts` declarations via the TypeScript compiler
|
|
401
|
+
API
|
|
402
|
+
6. **clean** — removes JS outputs for files that produce empty chunks
|
|
403
|
+
|
|
404
|
+
```typescript
|
|
405
|
+
// rolldown.config.ts
|
|
406
|
+
import { rolldownConfig } from '@bemedev/dev-utils';
|
|
407
|
+
|
|
408
|
+
export default rolldownConfig.defineConfig.default({
|
|
409
|
+
dir: 'lib',
|
|
410
|
+
sourcemap: true,
|
|
411
|
+
excludesTS: ['src/fixtures/**/*.ts'],
|
|
412
|
+
});
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
**`Params` properties**
|
|
416
|
+
|
|
417
|
+
| Property | Type | Default | Description |
|
|
418
|
+
| ---------------- | --------------------------------------- | ------------- | ------------------------------------------------------- |
|
|
419
|
+
| `dir` | `string` | `'lib'` | Output directory |
|
|
420
|
+
| `sourcemap` | `boolean` | `false` | Emit sourcemaps |
|
|
421
|
+
| `declarationMap` | `boolean` | `undefined` | Emit declaration maps |
|
|
422
|
+
| `excludesTS` | `string \| string[]` | `[]` | Extra TS files to exclude from declaration emit |
|
|
423
|
+
| `circularDeps` | `string \| string[]` | `[]` | Extra patterns exempt from circular-dep warnings |
|
|
424
|
+
| `ignoresJS` | `string \| string[]` | `[]` | Patterns whose empty-bundle warnings are suppressed |
|
|
425
|
+
| `externals` | `string \| string[]` | `[]` | Additional packages to mark as external |
|
|
426
|
+
| `plugins` | `(RolldownPluginOption \| PluginKey)[]` | default order | Custom plugin list; string keys select built-in plugins |
|
|
427
|
+
|
|
428
|
+
**Default excluded files** (always applied):
|
|
429
|
+
|
|
430
|
+
```
|
|
431
|
+
**/node_modules/**/*
|
|
432
|
+
**/__tests__/**/*
|
|
433
|
+
**/*.test.ts / **/*.test-d.ts
|
|
434
|
+
**/*.fixtures.ts / **/fixtures.ts
|
|
435
|
+
src/fixtures/**/*.ts
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**Output format:** both `esm` (`.js`) and `cjs` (`.cjs`), with
|
|
439
|
+
`preserveModules: true`.
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
### `defineConfig.bemedev(params?)`
|
|
444
|
+
|
|
445
|
+
Opinionated preset that extends `defineConfig.default` with:
|
|
446
|
+
|
|
447
|
+
- Sourcemaps **enabled by default**
|
|
448
|
+
- `DEFAULT_CIRCULAR_DEPS` merged into `circularDeps` (`**/types.ts`,
|
|
449
|
+
`**/*.types.ts`, …)
|
|
450
|
+
- `DEFAULT_EXCLUDE` merged into `excludesTS`
|
|
451
|
+
- `DEFAULT_CIRCULAR_DEPS` merged into `ignoresJS`
|
|
452
|
+
|
|
453
|
+
```typescript
|
|
454
|
+
export default rolldownConfig.defineConfig.bemedev({
|
|
455
|
+
excludesTS: ['src/my-fixtures/**'],
|
|
456
|
+
});
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
---
|
|
460
|
+
|
|
461
|
+
### Plugin builders (`PLUGIN_BUILDERS`)
|
|
462
|
+
|
|
463
|
+
Individual plugin factories are available for custom pipeline assembly:
|
|
464
|
+
|
|
465
|
+
| Key | Function | Wraps |
|
|
466
|
+
| ------------ | ---------------------- | ------------------------------------- |
|
|
467
|
+
| `alias` | `alias(options?)` | `rollup-plugin-tsc-alias` |
|
|
468
|
+
| `tsPaths` | `tsPaths(options?)` | `rollup-plugin-tsconfig-paths` |
|
|
469
|
+
| `circulars` | `circulars(options?)` | `rollup-plugin-circular-dependency` |
|
|
470
|
+
| `externals` | `externals(options?)` | `rollup-plugin-node-externals` |
|
|
471
|
+
| `typescript` | `typescript(options?)` | TypeScript compiler API + `tsc-alias` |
|
|
472
|
+
| `clean` | `clean(options?)` | Custom post-build JS cleanup |
|
|
473
|
+
|
|
474
|
+
Pass plugin keys as strings in the `plugins` array to reorder or subset
|
|
475
|
+
them:
|
|
476
|
+
|
|
477
|
+
```typescript
|
|
478
|
+
rolldownConfig.defineConfig.default({
|
|
479
|
+
plugins: ['alias', 'tsPaths', 'externals', 'typescript'],
|
|
480
|
+
});
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
## `buildTests`
|
|
486
|
+
|
|
487
|
+
CLI tooling that packs your built library as a local tarball, installs it
|
|
488
|
+
under the alias `this-gen-1`, runs your test suite against the real
|
|
489
|
+
distributable, then tears down.
|
|
490
|
+
|
|
491
|
+
### CLI usage
|
|
492
|
+
|
|
493
|
+
The binary is `build-tests`. It exposes three subcommands:
|
|
494
|
+
|
|
495
|
+
```bash
|
|
496
|
+
# Install the tarball (pre-test hook)
|
|
497
|
+
build-tests pre
|
|
498
|
+
|
|
499
|
+
# Run tests with pre/post lifecycle
|
|
500
|
+
build-tests test [--pretest] [--posttest]
|
|
501
|
+
|
|
502
|
+
# Clean up tarball + uninstall (post-test hook)
|
|
503
|
+
build-tests post
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
`package.json` integration (auto-configured):
|
|
507
|
+
|
|
508
|
+
```json
|
|
509
|
+
{
|
|
510
|
+
"scripts": {
|
|
511
|
+
"pretest": "build && build-tests pre",
|
|
512
|
+
"posttest": "fmt && build-tests post"
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
### `addTarball()`
|
|
520
|
+
|
|
521
|
+
Programmatic API for the `pre` step:
|
|
522
|
+
|
|
523
|
+
1. Builds the `package.json` for the `outDir` (strips `scripts`,
|
|
524
|
+
`devDependencies`, `files`; fixes paths)
|
|
525
|
+
2. Runs `pnpm pack` into `.pack/`
|
|
526
|
+
3. Installs the resulting `.tgz` as `this-gen-1` in `devDependencies`
|
|
527
|
+
|
|
528
|
+
```typescript
|
|
529
|
+
import { buildTests } from '@bemedev/dev-utils';
|
|
530
|
+
|
|
531
|
+
await buildTests.addTarball();
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
### `cleanup()`
|
|
537
|
+
|
|
538
|
+
Programmatic API for the `post` step:
|
|
539
|
+
|
|
540
|
+
1. Removes the `.pack/` folder
|
|
541
|
+
2. Runs `pnpm remove this-gen-1`
|
|
542
|
+
|
|
543
|
+
```typescript
|
|
544
|
+
import { buildTests } from '@bemedev/dev-utils';
|
|
545
|
+
|
|
546
|
+
buildTests.cleanup();
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
<br/>
|
|
552
|
+
|
|
553
|
+
## Licence
|
|
554
|
+
|
|
555
|
+
MIT
|
|
556
|
+
|
|
557
|
+
## CHANGELOG
|
|
558
|
+
|
|
559
|
+
Read [CHANGELOG.md](CHANGELOG.md) for details about all changes and
|
|
560
|
+
versions.
|
|
561
|
+
|
|
562
|
+
<br/>
|
|
563
|
+
|
|
564
|
+
## Author
|
|
565
|
+
|
|
566
|
+
chlbri (bri_lvi@icloud.com)
|
|
567
|
+
|
|
568
|
+
[My github](https://github.com/chlbri?tab=repositories)
|
|
569
|
+
|
|
570
|
+
[<svg width="98" height="96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#24292f"/></svg>](https://github.com/chlbri?tab=repositories)
|
|
571
|
+
|
|
572
|
+
<br/>
|
|
573
|
+
|
|
574
|
+
## Links
|
|
575
|
+
|
|
576
|
+
- [GitHub Repository](https://github.com/chlbri/node-dev-utils)
|
|
577
|
+
- [Website](https://bemedev.vercel.app)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __exportAll = (all, no_symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
|
+
return target;
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
19
|
+
key = keys[i];
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
+
get: ((k) => from[k]).bind(null, key),
|
|
22
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.__exportAll = __exportAll;
|
|
33
|
+
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_build_tests_constants = require("./constants.cjs");
|
|
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
|
+
let shelljs = require("shelljs");
|
|
8
|
+
shelljs = require_runtime.__toESM(shelljs);
|
|
9
|
+
let sort_keys = require("sort-keys");
|
|
10
|
+
sort_keys = require_runtime.__toESM(sort_keys);
|
|
11
|
+
//#region src/build-tests/addTarball.ts
|
|
12
|
+
const addTarball = async () => {
|
|
13
|
+
const packed = `${require_build_tests_constants.FILE_ORIGIN}:${await require_build_tests_pack.pack()}`;
|
|
14
|
+
shelljs.default.exec(`pnpm add -D ${require_build_tests_constants.this1}@${packed}`);
|
|
15
|
+
const file = (0, edit_json_file.default)(require_build_tests_constants.PACKAGE_PATH);
|
|
16
|
+
const devDeps = (0, sort_keys.default)(file.get(require_build_tests_constants.devKey));
|
|
17
|
+
file.set(require_build_tests_constants.devKey, devDeps);
|
|
18
|
+
file.save();
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.addTarball = addTarball;
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=addTarball.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addTarball.cjs","names":["FILE_ORIGIN","pack","this1","PACKAGE_PATH","devKey"],"sources":["../../src/build-tests/addTarball.ts"],"sourcesContent":["import editJsonFile from 'edit-json-file';\nimport sh from 'shelljs';\nimport sortKeys from 'sort-keys';\nimport { devKey, FILE_ORIGIN, PACKAGE_PATH, this1 } from './constants';\nimport { pack } from './pack';\n\nexport const addTarball = async () => {\n // #region Install the tarball\n const _packed = await pack();\n const packed = `${FILE_ORIGIN}:${_packed}`;\n sh.exec(`pnpm add -D ${this1}@${packed}`);\n // #endregion\n\n const file = editJsonFile(PACKAGE_PATH);\n\n const devDeps = sortKeys(file.get(devKey));\n file.set(devKey, devDeps);\n file.save();\n};\n"],"mappings":";;;;;;;;;;;AAMA,MAAa,aAAa,YAAY;CAGpC,MAAM,SAAS,GAAGA,8BAAAA,YAAY,GADd,MAAMC,yBAAAA,MAAM;AAE5B,SAAA,QAAG,KAAK,eAAeC,8BAAAA,MAAM,GAAG,SAAS;CAGzC,MAAM,QAAA,GAAA,eAAA,SAAoBC,8BAAAA,aAAa;CAEvC,MAAM,WAAA,GAAA,UAAA,SAAmB,KAAK,IAAIC,8BAAAA,OAAO,CAAC;AAC1C,MAAK,IAAIA,8BAAAA,QAAQ,QAAQ;AACzB,MAAK,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const addTarball: () => Promise<void>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FILE_ORIGIN, PACKAGE_PATH, devKey, this1 } from "./constants.js";
|
|
2
|
+
import { pack } from "./pack.js";
|
|
3
|
+
import editJsonFile from "edit-json-file";
|
|
4
|
+
import sh from "shelljs";
|
|
5
|
+
import sortKeys from "sort-keys";
|
|
6
|
+
//#region src/build-tests/addTarball.ts
|
|
7
|
+
const addTarball = async () => {
|
|
8
|
+
const packed = `${FILE_ORIGIN}:${await pack()}`;
|
|
9
|
+
sh.exec(`pnpm add -D ${this1}@${packed}`);
|
|
10
|
+
const file = editJsonFile(PACKAGE_PATH);
|
|
11
|
+
const devDeps = sortKeys(file.get(devKey));
|
|
12
|
+
file.set(devKey, devDeps);
|
|
13
|
+
file.save();
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { addTarball };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=addTarball.js.map
|