@bemedev/dev-utils 0.6.1 → 0.6.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 +14 -6
- package/lib/build-tests/addTarball.d.ts +1 -1
- package/lib/build-tests/cli/cli.d.ts +51 -1
- package/lib/build-tests/cli/post.d.ts +5 -1
- package/lib/build-tests/cli/pre.d.ts +5 -1
- package/lib/build-tests/cli/test.d.ts +15 -1
- package/lib/rolldown-config/config.cjs +1 -1
- package/lib/rolldown-config/config.cjs.map +1 -1
- package/lib/rolldown-config/config.js +1 -1
- package/lib/rolldown-config/config.js.map +1 -1
- package/lib/rolldown-config/constants.d.ts +3 -3
- package/lib/rolldown-config/helpers.d.ts +1 -1
- package/lib/rolldown-config/plugins/clean.d.ts +10 -1
- package/lib/rolldown-config/plugins/index.d.ts +11 -2
- package/lib/rolldown-config/plugins/typescript.cjs +8 -7
- package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.js +8 -8
- package/lib/rolldown-config/plugins/typescript.js.map +1 -1
- package/lib/utils/sleep.d.ts +1 -1
- package/lib/vitest-alias/vitest.d.ts +3 -1
- package/lib/vitest-exclude/vitest.d.ts +10 -4
- package/lib/vitest-exclude/vitest.utils.d.ts +1 -1
- package/lib/vitest-extended/createTests.cjs.map +1 -1
- package/lib/vitest-extended/createTests.d.ts +4 -4
- package/lib/vitest-extended/createTests.js.map +1 -1
- package/package.json +12 -12
- package/lib/_virtual/_rolldown/runtime.js +0 -5
package/README.md
CHANGED
|
@@ -302,11 +302,19 @@ const { acceptation, success } = createTests.withImplementation(myFn, {
|
|
|
302
302
|
### `doneTest(invite, fn, options?)`
|
|
303
303
|
|
|
304
304
|
Wraps a callback-style (done-based) test into a Vitest `test`. The test
|
|
305
|
-
passes only when `done()` is called within the timeout.
|
|
305
|
+
passes only when `done()` is called within the timeout. Supports both sync
|
|
306
|
+
and async test functions.
|
|
306
307
|
|
|
307
308
|
```typescript
|
|
308
309
|
import { doneTest } from '@bemedev/dev-utils/vitest-extended';
|
|
309
310
|
|
|
311
|
+
// Async example with await
|
|
312
|
+
doneTest('async callback', async done => {
|
|
313
|
+
await service.start();
|
|
314
|
+
await service.send('event');
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
// Sync example
|
|
310
318
|
doneTest('fires callback', done => {
|
|
311
319
|
emitter.once('event', done);
|
|
312
320
|
emitter.emit('event');
|
|
@@ -315,11 +323,11 @@ doneTest('fires callback', done => {
|
|
|
315
323
|
|
|
316
324
|
**Parameters**
|
|
317
325
|
|
|
318
|
-
| Name | Type
|
|
319
|
-
| --------- |
|
|
320
|
-
| `invite` | `string`
|
|
321
|
-
| `fn` | `(done: () => void) => void
|
|
322
|
-
| `options` | `number \| TestOptions`
|
|
326
|
+
| Name | Type | Default | Description |
|
|
327
|
+
| --------- | ------------------------------------------------- | ------- | ---------------------------------------------- |
|
|
328
|
+
| `invite` | `string` | — | Test description |
|
|
329
|
+
| `fn` | `(done: () => void) => void \| Promise<void>` | — | Test body (sync or async, receives `done`) |
|
|
330
|
+
| `options` | `number \| TestOptions` | `100` | Timeout in ms or Vitest `TestOptions` |
|
|
323
331
|
|
|
324
332
|
**Variants**
|
|
325
333
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const addTarball: () =>
|
|
1
|
+
export declare const addTarball: () => Promise<void>;
|
|
@@ -1,2 +1,52 @@
|
|
|
1
1
|
export declare const BIN = "build-tests";
|
|
2
|
-
export declare const cli:
|
|
2
|
+
export declare const cli: Partial<import("cmd-ts/dist/cjs/argparser").Register> & {
|
|
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
|
+
} | {
|
|
10
|
+
command: "test";
|
|
11
|
+
args: {
|
|
12
|
+
pretest: boolean;
|
|
13
|
+
posttest: boolean;
|
|
14
|
+
pre: boolean;
|
|
15
|
+
post: boolean;
|
|
16
|
+
};
|
|
17
|
+
}>>;
|
|
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
|
+
} | {
|
|
25
|
+
command: "test";
|
|
26
|
+
args: {
|
|
27
|
+
pretest: boolean;
|
|
28
|
+
posttest: boolean;
|
|
29
|
+
pre: boolean;
|
|
30
|
+
post: boolean;
|
|
31
|
+
};
|
|
32
|
+
}, {
|
|
33
|
+
command: "posttest";
|
|
34
|
+
value: void;
|
|
35
|
+
} | {
|
|
36
|
+
command: "pretest";
|
|
37
|
+
value: Promise<void>;
|
|
38
|
+
} | {
|
|
39
|
+
command: "test";
|
|
40
|
+
value: Promise<void>;
|
|
41
|
+
}> & {
|
|
42
|
+
run(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<{
|
|
43
|
+
command: "posttest";
|
|
44
|
+
value: void;
|
|
45
|
+
} | {
|
|
46
|
+
command: "pretest";
|
|
47
|
+
value: Promise<void>;
|
|
48
|
+
} | {
|
|
49
|
+
command: "test";
|
|
50
|
+
value: Promise<void>;
|
|
51
|
+
}>>;
|
|
52
|
+
};
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export declare const posttest:
|
|
1
|
+
export declare const posttest: Partial<import("cmd-ts/dist/cjs/argparser").Register> & {
|
|
2
|
+
parse(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<{}>>;
|
|
3
|
+
} & import("cmd-ts/dist/cjs/helpdoc").PrintHelp & import("cmd-ts/dist/cjs/helpdoc").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc").Named & Partial<import("cmd-ts/dist/cjs/helpdoc").Versioned> & import("cmd-ts/dist/cjs/argparser").Register & import("cmd-ts/dist/cjs/runner").Handling<{}, void> & {
|
|
4
|
+
run(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<void>>;
|
|
5
|
+
} & Partial<import("cmd-ts/dist/cjs/helpdoc").Versioned & import("cmd-ts/dist/cjs/helpdoc").Descriptive & import("cmd-ts/dist/cjs/helpdoc").Aliased>;
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export declare const pretest:
|
|
1
|
+
export declare const pretest: Partial<import("cmd-ts/dist/cjs/argparser").Register> & {
|
|
2
|
+
parse(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<{}>>;
|
|
3
|
+
} & import("cmd-ts/dist/cjs/helpdoc").PrintHelp & import("cmd-ts/dist/cjs/helpdoc").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc").Named & Partial<import("cmd-ts/dist/cjs/helpdoc").Versioned> & import("cmd-ts/dist/cjs/argparser").Register & import("cmd-ts/dist/cjs/runner").Handling<{}, Promise<void>> & {
|
|
4
|
+
run(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<Promise<void>>>;
|
|
5
|
+
} & Partial<import("cmd-ts/dist/cjs/helpdoc").Versioned & import("cmd-ts/dist/cjs/helpdoc").Descriptive & import("cmd-ts/dist/cjs/helpdoc").Aliased>;
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
export declare const test:
|
|
1
|
+
export declare const test: Partial<import("cmd-ts/dist/cjs/argparser").Register> & {
|
|
2
|
+
parse(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<{
|
|
3
|
+
pretest: boolean;
|
|
4
|
+
posttest: boolean;
|
|
5
|
+
pre: boolean;
|
|
6
|
+
post: boolean;
|
|
7
|
+
}>>;
|
|
8
|
+
} & import("cmd-ts/dist/cjs/helpdoc").PrintHelp & import("cmd-ts/dist/cjs/helpdoc").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc").Named & Partial<import("cmd-ts/dist/cjs/helpdoc").Versioned> & import("cmd-ts/dist/cjs/argparser").Register & import("cmd-ts/dist/cjs/runner").Handling<{
|
|
9
|
+
pretest: boolean;
|
|
10
|
+
posttest: boolean;
|
|
11
|
+
pre: boolean;
|
|
12
|
+
post: boolean;
|
|
13
|
+
}, Promise<void>> & {
|
|
14
|
+
run(context: import("cmd-ts/dist/cjs/argparser").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser").ParsingResult<Promise<void>>>;
|
|
15
|
+
} & Partial<import("cmd-ts/dist/cjs/helpdoc").Versioned & import("cmd-ts/dist/cjs/helpdoc").Descriptive & import("cmd-ts/dist/cjs/helpdoc").Aliased>;
|
|
@@ -40,8 +40,8 @@ const producePlugins = ({ circularDeps, ignoresJS, dir = "lib", sourcemap = fals
|
|
|
40
40
|
unordered.tsPaths(),
|
|
41
41
|
unordered.circulars(),
|
|
42
42
|
unordered.externals(),
|
|
43
|
-
unordered.typescript(),
|
|
44
43
|
(0, rolldown_plugins.esmExternalRequirePlugin)(),
|
|
44
|
+
unordered.typescript(),
|
|
45
45
|
unordered.clean()
|
|
46
46
|
];
|
|
47
47
|
return plugins ? plugins.map((p) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","names":["buildInput","toArray","DEFAULT_EXCLUDE","PLUGIN_BUILDERS","buildOutput","DEFAULT_CIRCULAR_DEPS"],"sources":["../../src/rolldown-config/config.ts"],"sourcesContent":["import { defineConfig as _defineConfig } from 'rolldown';\nimport { esmExternalRequirePlugin } from 'rolldown/plugins';\nimport {\n DEFAULT_CIRCULAR_DEPS,\n DEFAULT_DIR,\n DEFAULT_EXCLUDE,\n} from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\nimport { toArray } from './utils';\n\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n dir = DEFAULT_DIR,\n sourcemap = false,\n excludesTS,\n declarationMap,\n plugins,\n}: Params = {}) => {\n const include = buildInput(...toArray(excludesTS));\n const exclude = DEFAULT_EXCLUDE.concat(toArray(excludesTS));\n const unordered = {\n alias: () => PLUGIN_BUILDERS.alias(),\n typescript: () =>\n PLUGIN_BUILDERS.typescript({\n include,\n exclude,\n declarationMap,\n dir,\n }),\n circulars: () =>\n PLUGIN_BUILDERS.circulars({\n exclude: circularDeps,\n }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n tsPaths: () => PLUGIN_BUILDERS.tsPaths({ colors: true }),\n clean: () =>\n PLUGIN_BUILDERS.clean({\n ignoresJS,\n sourcemap,\n dir,\n }),\n };\n\n const defaultOrdered = () => [\n unordered.alias(),\n unordered.tsPaths(),\n unordered.circulars(),\n unordered.externals(),\n
|
|
1
|
+
{"version":3,"file":"config.cjs","names":["buildInput","toArray","DEFAULT_EXCLUDE","PLUGIN_BUILDERS","buildOutput","DEFAULT_CIRCULAR_DEPS"],"sources":["../../src/rolldown-config/config.ts"],"sourcesContent":["import { defineConfig as _defineConfig } from 'rolldown';\nimport { esmExternalRequirePlugin } from 'rolldown/plugins';\nimport {\n DEFAULT_CIRCULAR_DEPS,\n DEFAULT_DIR,\n DEFAULT_EXCLUDE,\n} from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\nimport { toArray } from './utils';\n\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n dir = DEFAULT_DIR,\n sourcemap = false,\n excludesTS,\n declarationMap,\n plugins,\n}: Params = {}) => {\n const include = buildInput(...toArray(excludesTS));\n const exclude = DEFAULT_EXCLUDE.concat(toArray(excludesTS));\n const unordered = {\n alias: () => PLUGIN_BUILDERS.alias(),\n typescript: () =>\n PLUGIN_BUILDERS.typescript({\n include,\n exclude,\n declarationMap,\n dir,\n }),\n circulars: () =>\n PLUGIN_BUILDERS.circulars({\n exclude: circularDeps,\n }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n tsPaths: () => PLUGIN_BUILDERS.tsPaths({ colors: true }),\n clean: () =>\n PLUGIN_BUILDERS.clean({\n ignoresJS,\n sourcemap,\n dir,\n }),\n };\n\n const defaultOrdered = () => [\n unordered.alias(),\n unordered.tsPaths(),\n unordered.circulars(),\n unordered.externals(),\n esmExternalRequirePlugin(),\n unordered.typescript(),\n unordered.clean(),\n ];\n\n return plugins\n ? plugins\n .map(p => {\n if (typeof p === 'string') return unordered[p]();\n return p;\n })\n .filter(p => !!p)\n : defaultOrdered();\n};\n\ndefineConfig.default = ({\n dir = DEFAULT_DIR,\n sourcemap = false,\n ...rest\n}: Params = {}) => {\n const input = buildInput();\n const external = rest.externals;\n const output = buildOutput(dir, sourcemap);\n\n const plugins = producePlugins({\n dir,\n sourcemap,\n ...rest,\n });\n\n return _defineConfig({\n input,\n plugins,\n external,\n output,\n platform: 'node',\n });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n const ignoresJS = toArray(additionals?.ignoresJS).concat(\n DEFAULT_CIRCULAR_DEPS,\n );\n\n const excludesTS = DEFAULT_EXCLUDE.concat(\n toArray(additionals?.excludesTS),\n );\n const _sourcemap = additionals?.sourcemap;\n const sourcemap = _sourcemap === undefined || _sourcemap === true;\n // #endregion\n\n return defineConfig.default({\n ...additionals,\n circularDeps,\n excludesTS,\n ignoresJS,\n sourcemap,\n });\n};\n"],"mappings":";;;;;;;;;;AAaA,MAAa,gBAAyB,gBAAe;AACnD,QAAO,aAAa,QAAQ,YAAY;;AAG1C,MAAM,kBAAkB,EACtB,cACA,WACA,MAAA,OACA,YAAY,OACZ,YACA,gBACA,YACU,EAAE,KAAK;CACjB,MAAM,UAAUA,8BAAAA,WAAW,GAAGC,8BAAAA,QAAQ,WAAW,CAAC;CAClD,MAAM,UAAUC,kCAAAA,gBAAgB,OAAOD,8BAAAA,QAAQ,WAAW,CAAC;CAC3D,MAAM,YAAY;EAChB,aAAaE,sCAAAA,gBAAgB,OAAO;EACpC,kBACEA,sCAAAA,gBAAgB,WAAW;GACzB;GACA;GACA;GACA;GACD,CAAC;EACJ,iBACEA,sCAAAA,gBAAgB,UAAU,EACxB,SAAS,cACV,CAAC;EACJ,iBACEA,sCAAAA,gBAAgB,UAAU;GAExB,SAAS;GACT,gBAAgB;GAChB,SAAS;GACV,CAAC;EACJ,eAAeA,sCAAAA,gBAAgB,QAAQ,EAAE,QAAQ,MAAM,CAAC;EACxD,aACEA,sCAAAA,gBAAgB,MAAM;GACpB;GACA;GACA;GACD,CAAC;EACL;CAED,MAAM,uBAAuB;EAC3B,UAAU,OAAO;EACjB,UAAU,SAAS;EACnB,UAAU,WAAW;EACrB,UAAU,WAAW;kDACK;EAC1B,UAAU,YAAY;EACtB,UAAU,OAAO;EAClB;AAED,QAAO,UACH,QACG,KAAI,MAAK;AACR,MAAI,OAAO,MAAM,SAAU,QAAO,UAAU,IAAI;AAChD,SAAO;GACP,CACD,QAAO,MAAK,CAAC,CAAC,EAAE,GACnB,gBAAgB;;AAGtB,aAAa,WAAW,EACtB,MAAA,OACA,YAAY,OACZ,GAAG,SACO,EAAE,KAAK;CACjB,MAAM,QAAQH,8BAAAA,YAAY;CAC1B,MAAM,WAAW,KAAK;CACtB,MAAM,SAASI,+BAAAA,YAAY,KAAK,UAAU;AAQ1C,SAAA,GAAA,SAAA,cAAqB;EACnB;EACA,SARc,eAAe;GAC7B;GACA;GACA,GAAG;GACJ,CAAC;EAKA;EACA;EACA,UAAU;EACX,CAAC;;AAGJ,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAeC,kCAAAA,sBAAsB,OACzCJ,8BAAAA,QAAQ,aAAa,aAAa,CACnC;CACD,MAAM,YAAYA,8BAAAA,QAAQ,aAAa,UAAU,CAAC,OAChDI,kCAAAA,sBACD;CAED,MAAM,aAAaH,kCAAAA,gBAAgB,OACjCD,8BAAAA,QAAQ,aAAa,WAAW,CACjC;CACD,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;AAG7D,QAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;EACA;EACD,CAAC"}
|
|
@@ -38,8 +38,8 @@ const producePlugins = ({ circularDeps, ignoresJS, dir = "lib", sourcemap = fals
|
|
|
38
38
|
unordered.tsPaths(),
|
|
39
39
|
unordered.circulars(),
|
|
40
40
|
unordered.externals(),
|
|
41
|
-
unordered.typescript(),
|
|
42
41
|
esmExternalRequirePlugin(),
|
|
42
|
+
unordered.typescript(),
|
|
43
43
|
unordered.clean()
|
|
44
44
|
];
|
|
45
45
|
return plugins ? plugins.map((p) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["_defineConfig"],"sources":["../../src/rolldown-config/config.ts"],"sourcesContent":["import { defineConfig as _defineConfig } from 'rolldown';\nimport { esmExternalRequirePlugin } from 'rolldown/plugins';\nimport {\n DEFAULT_CIRCULAR_DEPS,\n DEFAULT_DIR,\n DEFAULT_EXCLUDE,\n} from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\nimport { toArray } from './utils';\n\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n dir = DEFAULT_DIR,\n sourcemap = false,\n excludesTS,\n declarationMap,\n plugins,\n}: Params = {}) => {\n const include = buildInput(...toArray(excludesTS));\n const exclude = DEFAULT_EXCLUDE.concat(toArray(excludesTS));\n const unordered = {\n alias: () => PLUGIN_BUILDERS.alias(),\n typescript: () =>\n PLUGIN_BUILDERS.typescript({\n include,\n exclude,\n declarationMap,\n dir,\n }),\n circulars: () =>\n PLUGIN_BUILDERS.circulars({\n exclude: circularDeps,\n }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n tsPaths: () => PLUGIN_BUILDERS.tsPaths({ colors: true }),\n clean: () =>\n PLUGIN_BUILDERS.clean({\n ignoresJS,\n sourcemap,\n dir,\n }),\n };\n\n const defaultOrdered = () => [\n unordered.alias(),\n unordered.tsPaths(),\n unordered.circulars(),\n unordered.externals(),\n
|
|
1
|
+
{"version":3,"file":"config.js","names":["_defineConfig"],"sources":["../../src/rolldown-config/config.ts"],"sourcesContent":["import { defineConfig as _defineConfig } from 'rolldown';\nimport { esmExternalRequirePlugin } from 'rolldown/plugins';\nimport {\n DEFAULT_CIRCULAR_DEPS,\n DEFAULT_DIR,\n DEFAULT_EXCLUDE,\n} from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\nimport { toArray } from './utils';\n\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n dir = DEFAULT_DIR,\n sourcemap = false,\n excludesTS,\n declarationMap,\n plugins,\n}: Params = {}) => {\n const include = buildInput(...toArray(excludesTS));\n const exclude = DEFAULT_EXCLUDE.concat(toArray(excludesTS));\n const unordered = {\n alias: () => PLUGIN_BUILDERS.alias(),\n typescript: () =>\n PLUGIN_BUILDERS.typescript({\n include,\n exclude,\n declarationMap,\n dir,\n }),\n circulars: () =>\n PLUGIN_BUILDERS.circulars({\n exclude: circularDeps,\n }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n tsPaths: () => PLUGIN_BUILDERS.tsPaths({ colors: true }),\n clean: () =>\n PLUGIN_BUILDERS.clean({\n ignoresJS,\n sourcemap,\n dir,\n }),\n };\n\n const defaultOrdered = () => [\n unordered.alias(),\n unordered.tsPaths(),\n unordered.circulars(),\n unordered.externals(),\n esmExternalRequirePlugin(),\n unordered.typescript(),\n unordered.clean(),\n ];\n\n return plugins\n ? plugins\n .map(p => {\n if (typeof p === 'string') return unordered[p]();\n return p;\n })\n .filter(p => !!p)\n : defaultOrdered();\n};\n\ndefineConfig.default = ({\n dir = DEFAULT_DIR,\n sourcemap = false,\n ...rest\n}: Params = {}) => {\n const input = buildInput();\n const external = rest.externals;\n const output = buildOutput(dir, sourcemap);\n\n const plugins = producePlugins({\n dir,\n sourcemap,\n ...rest,\n });\n\n return _defineConfig({\n input,\n plugins,\n external,\n output,\n platform: 'node',\n });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n const ignoresJS = toArray(additionals?.ignoresJS).concat(\n DEFAULT_CIRCULAR_DEPS,\n );\n\n const excludesTS = DEFAULT_EXCLUDE.concat(\n toArray(additionals?.excludesTS),\n );\n const _sourcemap = additionals?.sourcemap;\n const sourcemap = _sourcemap === undefined || _sourcemap === true;\n // #endregion\n\n return defineConfig.default({\n ...additionals,\n circularDeps,\n excludesTS,\n ignoresJS,\n sourcemap,\n });\n};\n"],"mappings":";;;;;;;;AAaA,MAAa,gBAAyB,gBAAe;AACnD,QAAO,aAAa,QAAQ,YAAY;;AAG1C,MAAM,kBAAkB,EACtB,cACA,WACA,MAAA,OACA,YAAY,OACZ,YACA,gBACA,YACU,EAAE,KAAK;CACjB,MAAM,UAAU,WAAW,GAAG,QAAQ,WAAW,CAAC;CAClD,MAAM,UAAU,gBAAgB,OAAO,QAAQ,WAAW,CAAC;CAC3D,MAAM,YAAY;EAChB,aAAa,gBAAgB,OAAO;EACpC,kBACE,gBAAgB,WAAW;GACzB;GACA;GACA;GACA;GACD,CAAC;EACJ,iBACE,gBAAgB,UAAU,EACxB,SAAS,cACV,CAAC;EACJ,iBACE,gBAAgB,UAAU;GAExB,SAAS;GACT,gBAAgB;GAChB,SAAS;GACV,CAAC;EACJ,eAAe,gBAAgB,QAAQ,EAAE,QAAQ,MAAM,CAAC;EACxD,aACE,gBAAgB,MAAM;GACpB;GACA;GACA;GACD,CAAC;EACL;CAED,MAAM,uBAAuB;EAC3B,UAAU,OAAO;EACjB,UAAU,SAAS;EACnB,UAAU,WAAW;EACrB,UAAU,WAAW;EACrB,0BAA0B;EAC1B,UAAU,YAAY;EACtB,UAAU,OAAO;EAClB;AAED,QAAO,UACH,QACG,KAAI,MAAK;AACR,MAAI,OAAO,MAAM,SAAU,QAAO,UAAU,IAAI;AAChD,SAAO;GACP,CACD,QAAO,MAAK,CAAC,CAAC,EAAE,GACnB,gBAAgB;;AAGtB,aAAa,WAAW,EACtB,MAAA,OACA,YAAY,OACZ,GAAG,SACO,EAAE,KAAK;CACjB,MAAM,QAAQ,YAAY;CAC1B,MAAM,WAAW,KAAK;CACtB,MAAM,SAAS,YAAY,KAAK,UAAU;AAQ1C,QAAOA,eAAc;EACnB;EACA,SARc,eAAe;GAC7B;GACA;GACA,GAAG;GACJ,CAAC;EAKA;EACA;EACA,UAAU;EACX,CAAC;;AAGJ,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAe,sBAAsB,OACzC,QAAQ,aAAa,aAAa,CACnC;CACD,MAAM,YAAY,QAAQ,aAAa,UAAU,CAAC,OAChD,sBACD;CAED,MAAM,aAAa,gBAAgB,OACjC,QAAQ,aAAa,WAAW,CACjC;CACD,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;AAG7D,QAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;EACA;EACD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const DEFAULT_EXCLUDE:
|
|
2
|
-
export declare const DEFAULT_CIRCULAR_DEPS:
|
|
3
|
-
export declare const IGNORE:
|
|
1
|
+
export declare const DEFAULT_EXCLUDE: string[];
|
|
2
|
+
export declare const DEFAULT_CIRCULAR_DEPS: string[];
|
|
3
|
+
export declare const IGNORE: string[];
|
|
4
4
|
export declare const DEFAULT_DIR = "lib";
|
|
5
5
|
export declare const WARNING_CODES: {
|
|
6
6
|
EMPTY_BUNDLE: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const withoutExtension: (file: string) =>
|
|
1
|
+
export declare const withoutExtension: (file: string) => string;
|
|
2
2
|
export declare const cleanupJS: (files: Set<string>, dir: string, sourcemap: boolean) => void;
|
|
@@ -3,4 +3,13 @@ export type EndPluginOptions = {
|
|
|
3
3
|
sourcemap?: boolean;
|
|
4
4
|
dir?: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const clean: (options?: EndPluginOptions) =>
|
|
6
|
+
export declare const clean: (options?: EndPluginOptions) => {
|
|
7
|
+
name: string;
|
|
8
|
+
onLog: {
|
|
9
|
+
handler: (this: import("rolldown").MinimalPluginContext, _: import("rolldown").LogLevel, { code, names }: import("rolldown").RolldownLog) => false | undefined;
|
|
10
|
+
};
|
|
11
|
+
closeBundle: {
|
|
12
|
+
order: "post";
|
|
13
|
+
handler: () => void;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -13,6 +13,15 @@ export declare const PLUGIN_BUILDERS: {
|
|
|
13
13
|
tsPaths: typeof tsPaths;
|
|
14
14
|
circulars: typeof circulars;
|
|
15
15
|
externals: typeof externals;
|
|
16
|
-
clean: (options?: import("./clean").EndPluginOptions) =>
|
|
16
|
+
clean: (options?: import("./clean").EndPluginOptions) => {
|
|
17
|
+
name: string;
|
|
18
|
+
onLog: {
|
|
19
|
+
handler: (this: import("rolldown").MinimalPluginContext, _: import("rolldown").LogLevel, { code, names }: import("rolldown").RolldownLog) => false | undefined;
|
|
20
|
+
};
|
|
21
|
+
closeBundle: {
|
|
22
|
+
order: "post";
|
|
23
|
+
handler: () => void;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
17
26
|
};
|
|
18
|
-
export declare const DEFAULT_PLUGINS_ORDER:
|
|
27
|
+
export declare const DEFAULT_PLUGINS_ORDER: string[];
|
|
@@ -3,7 +3,6 @@ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
|
3
3
|
const require_rolldown_config_utils = require("../utils.cjs");
|
|
4
4
|
const require_rolldown_config_plugins_typescript_config = require("./typescript.config.cjs");
|
|
5
5
|
let fs = require("fs");
|
|
6
|
-
let path = require("path");
|
|
7
6
|
let tsc_alias = require("tsc-alias");
|
|
8
7
|
let typescript = require("typescript");
|
|
9
8
|
typescript = require_runtime.__toESM(typescript, 1);
|
|
@@ -24,11 +23,6 @@ const typescript$1 = ({ exclude, include, declarationMap, dir: outDir } = {}) =>
|
|
|
24
23
|
const tsconfigPath = typescript.default.findConfigFile(cwd, fs.existsSync, "tsconfig.json");
|
|
25
24
|
const configFile = require_rolldown_config_plugins_typescript_config.readTsConfig(tsconfigPath);
|
|
26
25
|
const host = typescript.default.createCompilerHost(configFile.options);
|
|
27
|
-
const libLocation = (0, path.join)((0, path.dirname)(require.resolve("typescript")), "lib");
|
|
28
|
-
host.getDefaultLibLocation = () => libLocation;
|
|
29
|
-
host.getDefaultLibFileName = (options) => {
|
|
30
|
-
return (0, path.join)(libLocation, typescript.default.getDefaultLibFileName(options));
|
|
31
|
-
};
|
|
32
26
|
const parsed = typescript.default.parseJsonConfigFileContent({
|
|
33
27
|
...configFile,
|
|
34
28
|
include,
|
|
@@ -42,7 +36,14 @@ const typescript$1 = ({ exclude, include, declarationMap, dir: outDir } = {}) =>
|
|
|
42
36
|
declarationMap
|
|
43
37
|
}
|
|
44
38
|
}, typescript.default.sys, cwd);
|
|
45
|
-
const program = typescript.default.createProgram(parsed.fileNames,
|
|
39
|
+
const program = typescript.default.createProgram(parsed.fileNames, {
|
|
40
|
+
...configFile.options,
|
|
41
|
+
outDir,
|
|
42
|
+
noEmit: false,
|
|
43
|
+
emitDeclarationOnly: true,
|
|
44
|
+
declaration: true,
|
|
45
|
+
declarationMap
|
|
46
|
+
}, host);
|
|
46
47
|
const emitResult = program.emit();
|
|
47
48
|
const errors = typescript.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics).filter((d) => d.category === typescript.default.DiagnosticCategory.Error);
|
|
48
49
|
if (errors.length > 0) console.error(typescript.default.formatDiagnosticsWithColorAndContext(errors, host));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.cjs","names":["typescript","toArray","ts","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\nimport { readTsConfig } from './typescript.config';\
|
|
1
|
+
{"version":3,"file":"typescript.cjs","names":["typescript","toArray","ts","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir: outDir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({\n configFile: tsconfigPath,\n outDir,\n });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;AAcA,MAAaA,gBAAc,EACzB,SACA,SACA,gBACA,KAAK,WACI,EAAE,KAA2B;CACtC,IAAI,OAAO;AAEX,QAAO;EACL,MAAM;EACN,QAAQ,MAAM;AAIZ,QAAK,WAAW,CAAC,GAHAC,8BAAAA,QAAQ,KAAK,SAAS,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,OAC5C,EAC6B,qBAAqB;AACnD,UAAO;;EAET,aAAa;GACX,OAAO;GACP,MAAM,UAAU;AACd,QAAI,KAAM;IACV,MAAM,MAAM,QAAQ,KAAK;IAEzB,MAAM,eAAeC,WAAAA,QAAG,eACtB,KACAC,GAAAA,YACA,gBACD;IAED,MAAM,aAAaC,kDAAAA,aAAa,aAAa;IAC7C,MAAM,OAAOF,WAAAA,QAAG,mBAAmB,WAAW,QAAQ;IAEtD,MAAM,SAASA,WAAAA,QAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAGD,8BAAAA,QAAQ,QAAQ,EAAE,OAAO;KACtC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;MACD;KACF,EACDC,WAAAA,QAAG,KACH,IACD;IAED,MAAM,UAAUA,WAAAA,QAAG,cACjB,OAAO,WACP;KACE,GAAG,WAAW;KACd;KACA,QAAQ;KACR,qBAAqB;KACrB,aAAa;KACb;KACD,EACD,KACD;IAED,MAAM,aAAa,QAAQ,MAAM;IAEjC,MAAM,SAASA,WAAAA,QACZ,sBAAsB,QAAQ,CAC9B,OAAO,WAAW,YAAY,CAC9B,QAAO,MAAK,EAAE,aAAaA,WAAAA,QAAG,mBAAmB,MAAM;AAE1D,QAAI,OAAO,SAAS,EAClB,SAAQ,MACNA,WAAAA,QAAG,qCAAqC,QAAQ,KAAK,CACtD;AAGH,WAAA,GAAA,UAAA,sBAA2B;KACzB,YAAY;KACZ;KACD,CAAC;AAEF,WAAO;AACP,YAAQ,IAAI,0BAA0B;;GAEzC;EACF"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { __require } from "../../_virtual/_rolldown/runtime.js";
|
|
2
1
|
import { toArray } from "../utils.js";
|
|
3
2
|
import { readTsConfig } from "./typescript.config.js";
|
|
4
3
|
import { existsSync } from "fs";
|
|
5
|
-
import { dirname, join } from "path";
|
|
6
4
|
import { replaceTscAliasPaths } from "tsc-alias";
|
|
7
5
|
import ts from "typescript";
|
|
8
6
|
//#region src/rolldown-config/plugins/typescript.ts
|
|
@@ -22,11 +20,6 @@ const typescript = ({ exclude, include, declarationMap, dir: outDir } = {}) => {
|
|
|
22
20
|
const tsconfigPath = ts.findConfigFile(cwd, existsSync, "tsconfig.json");
|
|
23
21
|
const configFile = readTsConfig(tsconfigPath);
|
|
24
22
|
const host = ts.createCompilerHost(configFile.options);
|
|
25
|
-
const libLocation = join(dirname(__require.resolve("typescript")), "lib");
|
|
26
|
-
host.getDefaultLibLocation = () => libLocation;
|
|
27
|
-
host.getDefaultLibFileName = (options) => {
|
|
28
|
-
return join(libLocation, ts.getDefaultLibFileName(options));
|
|
29
|
-
};
|
|
30
23
|
const parsed = ts.parseJsonConfigFileContent({
|
|
31
24
|
...configFile,
|
|
32
25
|
include,
|
|
@@ -40,7 +33,14 @@ const typescript = ({ exclude, include, declarationMap, dir: outDir } = {}) => {
|
|
|
40
33
|
declarationMap
|
|
41
34
|
}
|
|
42
35
|
}, ts.sys, cwd);
|
|
43
|
-
const program = ts.createProgram(parsed.fileNames,
|
|
36
|
+
const program = ts.createProgram(parsed.fileNames, {
|
|
37
|
+
...configFile.options,
|
|
38
|
+
outDir,
|
|
39
|
+
noEmit: false,
|
|
40
|
+
emitDeclarationOnly: true,
|
|
41
|
+
declaration: true,
|
|
42
|
+
declarationMap
|
|
43
|
+
}, host);
|
|
44
44
|
const emitResult = program.emit();
|
|
45
45
|
const errors = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics).filter((d) => d.category === ts.DiagnosticCategory.Error);
|
|
46
46
|
if (errors.length > 0) console.error(ts.formatDiagnosticsWithColorAndContext(errors, host));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\nimport { readTsConfig } from './typescript.config';\
|
|
1
|
+
{"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir: outDir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({\n configFile: tsconfigPath,\n outDir,\n });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;AAcA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,KAAK,WACI,EAAE,KAA2B;CACtC,IAAI,OAAO;AAEX,QAAO;EACL,MAAM;EACN,QAAQ,MAAM;AAIZ,QAAK,WAAW,CAAC,GAHA,QAAQ,KAAK,SAAS,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,OAC5C,EAC6B,qBAAqB;AACnD,UAAO;;EAET,aAAa;GACX,OAAO;GACP,MAAM,UAAU;AACd,QAAI,KAAM;IACV,MAAM,MAAM,QAAQ,KAAK;IAEzB,MAAM,eAAe,GAAG,eACtB,KACA,YACA,gBACD;IAED,MAAM,aAAa,aAAa,aAAa;IAC7C,MAAM,OAAO,GAAG,mBAAmB,WAAW,QAAQ;IAEtD,MAAM,SAAS,GAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAG,QAAQ,QAAQ,EAAE,OAAO;KACtC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;MACD;KACF,EACD,GAAG,KACH,IACD;IAED,MAAM,UAAU,GAAG,cACjB,OAAO,WACP;KACE,GAAG,WAAW;KACd;KACA,QAAQ;KACR,qBAAqB;KACrB,aAAa;KACb;KACD,EACD,KACD;IAED,MAAM,aAAa,QAAQ,MAAM;IAEjC,MAAM,SAAS,GACZ,sBAAsB,QAAQ,CAC9B,OAAO,WAAW,YAAY,CAC9B,QAAO,MAAK,EAAE,aAAa,GAAG,mBAAmB,MAAM;AAE1D,QAAI,OAAO,SAAS,EAClB,SAAQ,MACN,GAAG,qCAAqC,QAAQ,KAAK,CACtD;AAGH,UAAM,qBAAqB;KACzB,YAAY;KACZ;KACD,CAAC;AAEF,WAAO;AACP,YAAQ,IAAI,0BAA0B;;GAEzC;EACF"}
|
package/lib/utils/sleep.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const sleep: (ms: number) =>
|
|
1
|
+
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
@@ -20,7 +20,9 @@ type Plugin = Exclude<ViteUserConfig['plugins'], undefined>[number];
|
|
|
20
20
|
* }
|
|
21
21
|
*</code>
|
|
22
22
|
*/
|
|
23
|
-
export declare const createAlias: (tsconfig?: TsConf) =>
|
|
23
|
+
export declare const createAlias: (tsconfig?: TsConf) => {
|
|
24
|
+
[k: string]: string;
|
|
25
|
+
};
|
|
24
26
|
/**
|
|
25
27
|
* Plugin to add alias from tsconfig to test.alias
|
|
26
28
|
*
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import type { Args, WithPattern } from './types';
|
|
1
|
+
import type { Args, Plugin, WithPattern } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Create includeTest and includeCoverage arrays from glob patterns
|
|
4
4
|
*
|
|
5
5
|
* @param args Globs to ignore for test and coverage files
|
|
6
6
|
* @returns an object with includeTest and includeCoverage string arrays
|
|
7
7
|
*/
|
|
8
|
-
export declare function create(args?: Args[1]):
|
|
8
|
+
export declare function create(args?: Args[1]): Promise<{
|
|
9
|
+
files: string[];
|
|
10
|
+
coverage: string[];
|
|
11
|
+
}>;
|
|
9
12
|
export declare namespace create {
|
|
10
|
-
var withPattern: ({ patternTest, patternCov, }?: Partial<Args[0]>, { ignoreTestFiles, ignoreCoverageFiles }?: Args[1]) =>
|
|
13
|
+
var withPattern: ({ patternTest, patternCov, }?: Partial<Args[0]>, { ignoreTestFiles, ignoreCoverageFiles }?: Args[1]) => Promise<{
|
|
14
|
+
files: string[];
|
|
15
|
+
coverage: string[];
|
|
16
|
+
}>;
|
|
11
17
|
}
|
|
12
18
|
/**
|
|
13
19
|
* Plugin to add files with glob patterns to vitest
|
|
@@ -20,7 +26,7 @@ export declare namespace create {
|
|
|
20
26
|
* You don't have to use test.exclude.
|
|
21
27
|
* The default search patter is './src/**\/*.ts'
|
|
22
28
|
*/
|
|
23
|
-
export declare function exclude(args?: Args[1]):
|
|
29
|
+
export declare function exclude(args?: Args[1]): Plugin;
|
|
24
30
|
export declare namespace exclude {
|
|
25
31
|
var withPattern: WithPattern;
|
|
26
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const hasSrc: () => boolean;
|
|
2
2
|
export declare const defaultCovPattern: () => string;
|
|
3
|
-
export declare const buildInclude: (pattern: string | string[], ignore?: string[]) =>
|
|
3
|
+
export declare const buildInclude: (pattern: string | string[], ignore?: string[]) => Promise<string[]>;
|
|
4
4
|
export declare const testPattern: () => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTests.cjs","names":["useTFA","useErrorAsyncEach","toStringFlat","useEachAsync","vi"],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import type { Fn } from './bemedev/globals/types';\nimport { beforeAll, vi } from 'vitest';\nimport { useTFA } from './acceptation';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport type { ToError_F } from './each/error.types';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\nimport type { Identity, NextFn } from './types';\n\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(func, transform, toError);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func, transform);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, expected, test }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, expected, test };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n };\n};\n\n/**\n * Creates tests for function in a better way\n * NB : We use strict-equality, {@link useEach|see}\n * @param library The test library\n * @param f The function to test\n * @param\n * @returns A test.each like function to tests many cases\n *\n * NB: If the first argument is an array, wrap the value in another array,\n *\n * @example\n * // ./add.ts\n *export const add = (args: string[]) => args.reduce(\n * (acc, value) => {\n * acc+=value\n * return acc;\n * },\n * 0)\n *\n *\n * // .add.test.ts\n *import { createTests } from '@bemedev/vitest-extended';\n *import { add } from './add';\n *\n *const useTests = createTests(add)\n *\n *useTests(\n * {\n * invite: 'For : 1,2,3,4,5,6,7,8,9',\n * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!\n * }\n *)\n *\n */\nexport const createTests = <\n F extends Fn,\n T extends NextFn<F> = Identity<F>,\n>(\n func: F,\n args?: { transform?: T; toError?: ToError_F<F> },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <\n F extends Fn,\n T extends NextFn<F> = Identity<F>,\n>(\n f: F,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<F> | F;\n name: string;\n transform?: T;\n toError?: ToError_F<F>;\n },\n) => {\n const func = vi.fn(f);\n\n if (instanciation) {\n beforeAll(async () => {\n const impl = await instanciation();\n func.mockImplementation(impl);\n });\n }\n\n return _create(func, transform, toError, name);\n};\n\ncreateTests.withoutImplementation = createTests;\n"],"mappings":";;;;;;;;AAcA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;AAClE,QAAO;EACL,mBAAmBA,oCAAAA,OAAO,MAAM,KAAK;EAErC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;AAErB,gBAAa;AAWX,WAViBC,mCAAAA,kBAAkB,MAAM,WAAW,QAAQ,CAU5C,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;AAGjD,YADY;MAAE,QADC,IAAIC,qCAAAA,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAO;MAG5C,CAEyB;;;EAI9B,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;AACrB,gBAAa;AAWX,WAViBC,kCAAAA,aAAa,MAAM,UAAU,CAU9B,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;AAG1D,YADY;MAAE,QADC,IAAID,qCAAAA,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAU;MAAM;MAGrD,CAEyB;;;EAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCH,MAAa,eAIX,MACA,SACG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,EAAE;AACzC,QAAO,QAAQ,MAAM,WAAW,QAAQ;;AAG1C,YAAY,sBAIV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAOE,OAAAA,GAAG,GAAG,EAAE;AAErB,KAAI,cACF,EAAA,GAAA,OAAA,WAAU,YAAY;EACpB,MAAM,OAAO,MAAM,eAAe;AAClC,OAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"createTests.cjs","names":["useTFA","useErrorAsyncEach","toStringFlat","useEachAsync","vi"],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import type { Fn } from './bemedev/globals/types';\nimport { beforeAll, vi } from 'vitest';\nimport { useTFA } from './acceptation';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport type { ToError_F } from './each/error.types';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\nimport type { Identity, NextFn } from './types';\n\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(func, transform, toError);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func, transform);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, expected, test }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, expected, test };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n };\n};\n\n/**\n * Creates tests for function in a better way\n * NB : We use strict-equality, {@link useEach|see}\n * @param library The test library\n * @param f The function to test\n * @param\n * @returns A test.each like function to tests many cases\n *\n * NB: If the first argument is an array, wrap the value in another array,\n *\n * @example\n * // ./add.ts\n *export const add = (args: string[]) => args.reduce(\n * (acc, value) => {\n * acc+=value\n * return acc;\n * },\n * 0)\n *\n *\n * // .add.test.ts\n *import { createTests } from '@bemedev/vitest-extended';\n *import { add } from './add';\n *\n *const useTests = createTests(add)\n *\n *useTests(\n * {\n * invite: 'For : 1,2,3,4,5,6,7,8,9',\n * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!\n * }\n *)\n *\n */\nexport const createTests = <\n F extends Fn,\n T extends NextFn<F> = Identity<F>,\n>(\n func: F,\n args?: { transform?: T; toError?: ToError_F<F> },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <\n F extends Fn,\n T extends NextFn<F> = Identity<F>,\n>(\n f: F,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<F> | F;\n name: string;\n transform?: T;\n toError?: ToError_F<F>;\n },\n) => {\n const func = vi.fn(f);\n\n if (instanciation) {\n beforeAll(async () => {\n const impl = await instanciation();\n func.mockImplementation(impl as any);\n });\n }\n\n return _create(func, transform, toError, name);\n};\n\ncreateTests.withoutImplementation = createTests;\n"],"mappings":";;;;;;;;AAcA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;AAClE,QAAO;EACL,mBAAmBA,oCAAAA,OAAO,MAAM,KAAK;EAErC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;AAErB,gBAAa;AAWX,WAViBC,mCAAAA,kBAAkB,MAAM,WAAW,QAAQ,CAU5C,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;AAGjD,YADY;MAAE,QADC,IAAIC,qCAAAA,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAO;MAG5C,CAEyB;;;EAI9B,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;AACrB,gBAAa;AAWX,WAViBC,kCAAAA,aAAa,MAAM,UAAU,CAU9B,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;AAG1D,YADY;MAAE,QADC,IAAID,qCAAAA,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAU;MAAM;MAGrD,CAEyB;;;EAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCH,MAAa,eAIX,MACA,SACG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,EAAE;AACzC,QAAO,QAAQ,MAAM,WAAW,QAAQ;;AAG1C,YAAY,sBAIV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAOE,OAAAA,GAAG,GAAG,EAAE;AAErB,KAAI,cACF,EAAA,GAAA,OAAA,WAAU,YAAY;EACpB,MAAM,OAAO,MAAM,eAAe;AAClC,OAAK,mBAAmB,KAAY;GACpC;AAGJ,QAAO,QAAQ,MAAM,WAAW,SAAS,KAAK;;AAGhD,YAAY,wBAAwB"}
|
|
@@ -41,8 +41,8 @@ export declare const createTests: {
|
|
|
41
41
|
toError?: ToError_F<F>;
|
|
42
42
|
}): {
|
|
43
43
|
acceptation: () => void;
|
|
44
|
-
success: (...cases: import("./types").TestArgs<import("./types").ChainedFn<
|
|
45
|
-
fails: (...cases: import("./types").TestErrors<import("./types").ChainedFn<
|
|
44
|
+
success: (...cases: import("./types").TestArgs<import("./types").ChainedFn<F, T>>) => () => void;
|
|
45
|
+
fails: (...cases: import("./types").TestErrors<import("./types").ChainedFn<F, T>>) => () => void;
|
|
46
46
|
};
|
|
47
47
|
withImplementation<F extends Fn, T extends NextFn<F> = Identity<F>>(f: F, { instanciation, name, transform, toError, }: {
|
|
48
48
|
instanciation: () => Promise<F> | F;
|
|
@@ -51,8 +51,8 @@ export declare const createTests: {
|
|
|
51
51
|
toError?: ToError_F<F>;
|
|
52
52
|
}): {
|
|
53
53
|
acceptation: () => void;
|
|
54
|
-
success: (...cases: import("./types").TestArgs<import("./types").ChainedFn<
|
|
55
|
-
fails: (...cases: import("./types").TestErrors<import("./types").ChainedFn<
|
|
54
|
+
success: (...cases: import("./types").TestArgs<import("./types").ChainedFn<F, T>>) => () => void;
|
|
55
|
+
fails: (...cases: import("./types").TestErrors<import("./types").ChainedFn<F, T>>) => () => void;
|
|
56
56
|
};
|
|
57
57
|
withoutImplementation: /*elided*/ any;
|
|
58
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTests.js","names":[],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import type { Fn } from './bemedev/globals/types';\nimport { beforeAll, vi } from 'vitest';\nimport { useTFA } from './acceptation';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport type { ToError_F } from './each/error.types';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\nimport type { Identity, NextFn } from './types';\n\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(func, transform, toError);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func, transform);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, expected, test }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, expected, test };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n };\n};\n\n/**\n * Creates tests for function in a better way\n * NB : We use strict-equality, {@link useEach|see}\n * @param library The test library\n * @param f The function to test\n * @param\n * @returns A test.each like function to tests many cases\n *\n * NB: If the first argument is an array, wrap the value in another array,\n *\n * @example\n * // ./add.ts\n *export const add = (args: string[]) => args.reduce(\n * (acc, value) => {\n * acc+=value\n * return acc;\n * },\n * 0)\n *\n *\n * // .add.test.ts\n *import { createTests } from '@bemedev/vitest-extended';\n *import { add } from './add';\n *\n *const useTests = createTests(add)\n *\n *useTests(\n * {\n * invite: 'For : 1,2,3,4,5,6,7,8,9',\n * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!\n * }\n *)\n *\n */\nexport const createTests = <\n F extends Fn,\n T extends NextFn<F> = Identity<F>,\n>(\n func: F,\n args?: { transform?: T; toError?: ToError_F<F> },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <\n F extends Fn,\n T extends NextFn<F> = Identity<F>,\n>(\n f: F,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<F> | F;\n name: string;\n transform?: T;\n toError?: ToError_F<F>;\n },\n) => {\n const func = vi.fn(f);\n\n if (instanciation) {\n beforeAll(async () => {\n const impl = await instanciation();\n func.mockImplementation(impl);\n });\n }\n\n return _create(func, transform, toError, name);\n};\n\ncreateTests.withoutImplementation = createTests;\n"],"mappings":";;;;;;AAcA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;AAClE,QAAO;EACL,mBAAmB,OAAO,MAAM,KAAK;EAErC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;AAErB,gBAAa;AAWX,WAViB,kBAAkB,MAAM,WAAW,QAAQ,CAU5C,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;AAGjD,YADY;MAAE,QADC,IAAI,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAO;MAG5C,CAEyB;;;EAI9B,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;AACrB,gBAAa;AAWX,WAViB,aAAa,MAAM,UAAU,CAU9B,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;AAG1D,YADY;MAAE,QADC,IAAI,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAU;MAAM;MAGrD,CAEyB;;;EAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCH,MAAa,eAIX,MACA,SACG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,EAAE;AACzC,QAAO,QAAQ,MAAM,WAAW,QAAQ;;AAG1C,YAAY,sBAIV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAO,GAAG,GAAG,EAAE;AAErB,KAAI,cACF,WAAU,YAAY;EACpB,MAAM,OAAO,MAAM,eAAe;AAClC,OAAK,mBAAmB,
|
|
1
|
+
{"version":3,"file":"createTests.js","names":[],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import type { Fn } from './bemedev/globals/types';\nimport { beforeAll, vi } from 'vitest';\nimport { useTFA } from './acceptation';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport type { ToError_F } from './each/error.types';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\nimport type { Identity, NextFn } from './types';\n\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(func, transform, toError);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func, transform);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, expected, test }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, expected, test };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n };\n};\n\n/**\n * Creates tests for function in a better way\n * NB : We use strict-equality, {@link useEach|see}\n * @param library The test library\n * @param f The function to test\n * @param\n * @returns A test.each like function to tests many cases\n *\n * NB: If the first argument is an array, wrap the value in another array,\n *\n * @example\n * // ./add.ts\n *export const add = (args: string[]) => args.reduce(\n * (acc, value) => {\n * acc+=value\n * return acc;\n * },\n * 0)\n *\n *\n * // .add.test.ts\n *import { createTests } from '@bemedev/vitest-extended';\n *import { add } from './add';\n *\n *const useTests = createTests(add)\n *\n *useTests(\n * {\n * invite: 'For : 1,2,3,4,5,6,7,8,9',\n * parameters: [[1, 2, 3, 4, 5, 6, 7, 8, 9]], // like this!\n * }\n *)\n *\n */\nexport const createTests = <\n F extends Fn,\n T extends NextFn<F> = Identity<F>,\n>(\n func: F,\n args?: { transform?: T; toError?: ToError_F<F> },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <\n F extends Fn,\n T extends NextFn<F> = Identity<F>,\n>(\n f: F,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<F> | F;\n name: string;\n transform?: T;\n toError?: ToError_F<F>;\n },\n) => {\n const func = vi.fn(f);\n\n if (instanciation) {\n beforeAll(async () => {\n const impl = await instanciation();\n func.mockImplementation(impl as any);\n });\n }\n\n return _create(func, transform, toError, name);\n};\n\ncreateTests.withoutImplementation = createTests;\n"],"mappings":";;;;;;AAcA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;AAClE,QAAO;EACL,mBAAmB,OAAO,MAAM,KAAK;EAErC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;AAErB,gBAAa;AAWX,WAViB,kBAAkB,MAAM,WAAW,QAAQ,CAU5C,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;AAGjD,YADY;MAAE,QADC,IAAI,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAO;MAG5C,CAEyB;;;EAI9B,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;AACrB,gBAAa;AAWX,WAViB,aAAa,MAAM,UAAU,CAU9B,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;AAG1D,YADY;MAAE,QADC,IAAI,aAAa,QAAQ,GAAG,OAAO,CAAC,MAAM;MACnC;MAAY;MAAU;MAAM;MAGrD,CAEyB;;;EAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCH,MAAa,eAIX,MACA,SACG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,EAAE;AACzC,QAAO,QAAQ,MAAM,WAAW,QAAQ;;AAG1C,YAAY,sBAIV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAO,GAAG,GAAG,EAAE;AAErB,KAAI,cACF,WAAU,YAAY;EACpB,MAAM,OAAO,MAAM,eAAe;AAClC,OAAK,mBAAmB,KAAY;GACpC;AAGJ,QAAO,QAAQ,MAAM,WAAW,SAAS,KAAK;;AAGhD,YAAY,wBAAwB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemedev/dev-utils",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.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",
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
"ci:admin": "pnpm run rm && pnpm run upgrade:fast && pnpm run ci",
|
|
82
82
|
"config": "pnpm install",
|
|
83
83
|
"config:off": "pnpm run config --offline",
|
|
84
|
-
"config:fast": "pnpm add -D @vitest/coverage-v8@3.2.4 @vitest/ui@3.2.4 vitest@3.2.4 @bemedev/app-ts@2.3.0 @bemedev/basifun@0.5.3",
|
|
85
84
|
"_lint": "oxlint",
|
|
86
85
|
"lint:fix": "oxlint --fix",
|
|
87
86
|
"lint": "pnpm run fmt && pnpm run lint:fix",
|
|
@@ -107,9 +106,9 @@
|
|
|
107
106
|
"test:type:watch": "vitest -c \"vitest.config.type.ts\"",
|
|
108
107
|
"test:ui": "vitest --ui",
|
|
109
108
|
"test:watch": "vitest",
|
|
110
|
-
"upgrade": "pnpm dlx @bemedev/upgrade-npm-package
|
|
109
|
+
"upgrade": "pnpm dlx @bemedev/upgrade-npm-package",
|
|
111
110
|
"size": "size-limit",
|
|
112
|
-
"upgrade:fast": "pnpm up --latest
|
|
111
|
+
"upgrade:fast": "pnpm up --latest"
|
|
113
112
|
},
|
|
114
113
|
"size-limit": [
|
|
115
114
|
{
|
|
@@ -134,14 +133,15 @@
|
|
|
134
133
|
"tsc-alias": "^1.8.16"
|
|
135
134
|
},
|
|
136
135
|
"devDependencies": {
|
|
137
|
-
"@bemedev/app-ts": "
|
|
136
|
+
"@bemedev/app-ts": "3.0.1",
|
|
138
137
|
"@bemedev/basifun": "0.5.3",
|
|
138
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
139
139
|
"@size-limit/file": "^12.1.0",
|
|
140
140
|
"@types/edit-json-file": "^1.7.4",
|
|
141
141
|
"@types/node": "^25.6.0",
|
|
142
142
|
"@types/shelljs": "^0.10.0",
|
|
143
|
-
"@vitest/coverage-v8": "
|
|
144
|
-
"@vitest/ui": "
|
|
143
|
+
"@vitest/coverage-v8": "4.1.4",
|
|
144
|
+
"@vitest/ui": "4.1.4",
|
|
145
145
|
"globals": "^17.5.0",
|
|
146
146
|
"husky": "^9.1.7",
|
|
147
147
|
"is-in-ci": "^2.0.0",
|
|
@@ -158,13 +158,13 @@
|
|
|
158
158
|
"tslib": "^2.8.1",
|
|
159
159
|
"tsx": "^4.21.0",
|
|
160
160
|
"typescript": "^6.0.3",
|
|
161
|
-
"vitest": "
|
|
161
|
+
"vitest": "4.1.4",
|
|
162
162
|
"zod": "^4.3.6"
|
|
163
163
|
},
|
|
164
164
|
"peerDependencies": {
|
|
165
|
-
"@vitest/coverage-v8": "
|
|
166
|
-
"rolldown": "1.0.0-rc.
|
|
167
|
-
"typescript": "^6.0.
|
|
168
|
-
"vitest": "
|
|
165
|
+
"@vitest/coverage-v8": "4.1.4",
|
|
166
|
+
"rolldown": "1.0.0-rc.16",
|
|
167
|
+
"typescript": "^6.0.3",
|
|
168
|
+
"vitest": "4.1.4"
|
|
169
169
|
}
|
|
170
170
|
}
|