@bemedev/dev-utils 1.0.2 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -6
- package/lib/build-tests/cli/index.cjs.map +1 -1
- package/lib/build-tests/imports/helper.cjs.map +1 -1
- package/lib/build-tests/imports/helper.d.ts +1 -1
- package/lib/build-tests/imports/helper.js.map +1 -1
- package/lib/rolldown-config/config.cjs +23 -2
- package/lib/rolldown-config/config.cjs.map +1 -1
- package/lib/rolldown-config/config.js +23 -2
- package/lib/rolldown-config/config.js.map +1 -1
- package/lib/rolldown-config/output.cjs +4 -2
- package/lib/rolldown-config/output.cjs.map +1 -1
- package/lib/rolldown-config/output.js +4 -2
- package/lib/rolldown-config/output.js.map +1 -1
- package/lib/rolldown-config/plugins/clean.cjs +1 -1
- package/lib/rolldown-config/plugins/clean.js +1 -1
- package/lib/rolldown-config/plugins/index.cjs +8 -8
- package/lib/rolldown-config/plugins/index.cjs.map +1 -1
- package/lib/rolldown-config/plugins/index.d.ts +9 -1
- package/lib/rolldown-config/plugins/index.js +6 -7
- package/lib/rolldown-config/plugins/index.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.cjs +5 -0
- package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.d.ts +1 -0
- package/lib/rolldown-config/plugins/typescript.config.js +5 -1
- package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.fast.cjs +80 -0
- package/lib/rolldown-config/plugins/typescript.fast.cjs.map +1 -0
- package/lib/rolldown-config/plugins/typescript.fast.d.ts +9 -0
- package/lib/rolldown-config/plugins/typescript.fast.js +77 -0
- package/lib/rolldown-config/plugins/typescript.fast.js.map +1 -0
- package/lib/rolldown-config/types.d.ts +1 -0
- package/lib/{vitest-extended → utils}/bemedev/globals/types.d.ts +1 -0
- package/lib/{vitest-extended → utils}/bemedev/globals/utils/_unknown.cjs +1 -1
- package/lib/utils/bemedev/globals/utils/_unknown.cjs.map +1 -0
- package/lib/{vitest-extended → utils}/bemedev/globals/utils/_unknown.js +1 -1
- package/lib/utils/bemedev/globals/utils/_unknown.js.map +1 -0
- package/lib/utils/bemedev/globals/utils/expandFn.cjs +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.cjs.map +1 -0
- package/lib/utils/bemedev/globals/utils/expandFn.d.ts +2 -0
- package/lib/utils/bemedev/globals/utils/expandFn.js +10 -0
- package/lib/utils/bemedev/globals/utils/expandFn.js.map +1 -0
- package/lib/utils/index.cjs +2 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +2 -1
- package/lib/utils/types.d.ts +1 -1
- package/lib/vitest-extended/acceptation.cjs.map +1 -1
- package/lib/vitest-extended/acceptation.d.ts +1 -1
- package/lib/vitest-extended/acceptation.js.map +1 -1
- package/lib/vitest-extended/createTests.cjs.map +1 -1
- package/lib/vitest-extended/createTests.d.ts +1 -1
- package/lib/vitest-extended/createTests.js.map +1 -1
- package/lib/vitest-extended/createTests.types.d.ts +1 -1
- package/lib/vitest-extended/each/error.types.d.ts +1 -1
- package/lib/vitest-extended/each/pass.types.d.ts +1 -1
- package/lib/vitest-extended/isDefined.cjs.map +1 -1
- package/lib/vitest-extended/isDefined.d.ts +1 -1
- package/lib/vitest-extended/isDefined.js.map +1 -1
- package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
- package/lib/vitest-extended/toStringFlat.d.ts +1 -1
- package/lib/vitest-extended/toStringFlat.js.map +1 -1
- package/lib/vitest-extended/types.d.ts +1 -1
- package/package.json +4 -4
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs.map +0 -1
- package/lib/vitest-extended/bemedev/globals/utils/_unknown.js.map +0 -1
- /package/lib/{vitest-extended → utils}/bemedev/globals/utils/_unknown.d.ts +0 -0
package/README.md
CHANGED
|
@@ -482,16 +482,39 @@ export default defineConfig.bemedev({
|
|
|
482
482
|
|
|
483
483
|
---
|
|
484
484
|
|
|
485
|
+
### `defineConfig.fast(params?)`
|
|
486
|
+
|
|
487
|
+
A fast build configuration preset that optimizes TypeScript declaration
|
|
488
|
+
emitting. It uses the `fast` (`typescriptFast`) plugin wrapping
|
|
489
|
+
`oxc-transform` instead of the standard compiler API.
|
|
490
|
+
|
|
491
|
+
It runs the following plugin pipeline:
|
|
492
|
+
|
|
493
|
+
1. **circulars** — warns on circular dependencies
|
|
494
|
+
2. **externals** — marks `dependencies` and `peerDependencies` as external
|
|
495
|
+
3. **esm** — injects ESM external require helpers
|
|
496
|
+
(`esmExternalRequirePlugin`)
|
|
497
|
+
4. **fast** — generates `.d.ts` files quickly using `oxc-transform`
|
|
498
|
+
5. **clean** — removes empty JS chunks
|
|
499
|
+
|
|
500
|
+
```typescript
|
|
501
|
+
export default defineConfig.fast({ excludesTS: ['src/my-fixtures/**'] });
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
485
506
|
### Plugin builders (`PLUGIN_BUILDERS`)
|
|
486
507
|
|
|
487
508
|
Individual plugin factories are available for custom pipeline assembly:
|
|
488
509
|
|
|
489
|
-
| Key | Function | Wraps
|
|
490
|
-
| ------------ | ---------------------- |
|
|
491
|
-
| `circulars` | `circulars(options?)` | `rollup-plugin-circular-dependency`
|
|
492
|
-
| `externals` | `externals(options?)` | `rollup-plugin-node-externals`
|
|
493
|
-
| `
|
|
494
|
-
| `
|
|
510
|
+
| Key | Function | Wraps |
|
|
511
|
+
| ------------ | ---------------------- | ------------------------------------------------------------------------------------------ |
|
|
512
|
+
| `circulars` | `circulars(options?)` | `rollup-plugin-circular-dependency` |
|
|
513
|
+
| `externals` | `externals(options?)` | `rollup-plugin-node-externals` |
|
|
514
|
+
| `esm` | `esm` | `esmExternalRequirePlugin` from Rolldown |
|
|
515
|
+
| `typescript` | `typescript(options?)` | TypeScript compiler API + `tsc-alias` |
|
|
516
|
+
| `fast` | `fast(options?)` | `oxc-transform` + `tsc-alias`, for ONLY compilerOptions.isolatedDeclarations set to `true` |
|
|
517
|
+
| `clean` | `clean(options?)` | Custom post-build JS cleanup |
|
|
495
518
|
|
|
496
519
|
Pass plugin keys as strings in the `plugins` array to reorder or subset
|
|
497
520
|
them:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["cli"],"sources":["../../../src/build-tests/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { run } from 'cmd-ts';\n\nimport { cli } from './cli';\n\nrun(cli, process.argv.slice(2));\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["cli"],"sources":["../../../src/build-tests/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { run } from 'cmd-ts';\n\nimport { cli } from './cli';\n\nrun(cli, process.argv.slice(2));\n"],"mappings":";;;CAMIA,mBAAAA,CAAAA,CAAAA,IAAAA,CAAAA,4BAAAA,KAAK,QAAQ,KAAK,MAAM,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.cjs","names":["customImport"],"sources":["../../../src/build-tests/imports/helper.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nimport type { Fn } from '../../
|
|
1
|
+
{"version":3,"file":"helper.cjs","names":["customImport"],"sources":["../../../src/build-tests/imports/helper.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nimport type { Fn } from '../../utils/bemedev/globals/types';\nimport { customImport } from '../import';\n\nexport type Helper_F = (args: {\n path?: string;\n fn: string;\n}) => Promise<void>;\n\nexport const helperFn = async <T extends Fn = Fn>({\n path,\n fn,\n}: {\n path?: string;\n fn: string;\n}) => {\n const _fn = await customImport<T>({ path, fn: m => m[fn] });\n expect(_fn).toBeDefined();\n expect(_fn).toBeTypeOf('function');\n};\n"],"mappings":";;;;AAUA,MAAa,WAAW,OAA0B,EAChD,MACA,SAII;CACJ,MAAM,MAAM,MAAMA,2BAAAA,aAAgB;EAAE;EAAM,KAAI,MAAK,EAAE;CAAI,CAAC;CAC1D,CAAA,GAAA,OAAA,OAAA,CAAO,GAAG,CAAC,CAAC,YAAY;CACxB,CAAA,GAAA,OAAA,OAAA,CAAO,GAAG,CAAC,CAAC,WAAW,UAAU;AACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","names":[],"sources":["../../../src/build-tests/imports/helper.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nimport type { Fn } from '../../
|
|
1
|
+
{"version":3,"file":"helper.js","names":[],"sources":["../../../src/build-tests/imports/helper.ts"],"sourcesContent":["import { expect } from 'vitest';\n\nimport type { Fn } from '../../utils/bemedev/globals/types';\nimport { customImport } from '../import';\n\nexport type Helper_F = (args: {\n path?: string;\n fn: string;\n}) => Promise<void>;\n\nexport const helperFn = async <T extends Fn = Fn>({\n path,\n fn,\n}: {\n path?: string;\n fn: string;\n}) => {\n const _fn = await customImport<T>({ path, fn: m => m[fn] });\n expect(_fn).toBeDefined();\n expect(_fn).toBeTypeOf('function');\n};\n"],"mappings":";;;AAUA,MAAa,WAAW,OAA0B,EAChD,MACA,SAII;CACJ,MAAM,MAAM,MAAM,aAAgB;EAAE;EAAM,KAAI,MAAK,EAAE;CAAI,CAAC;CAC1D,OAAO,GAAG,CAAC,CAAC,YAAY;CACxB,OAAO,GAAG,CAAC,CAAC,WAAW,UAAU;AACnC"}
|
|
@@ -30,12 +30,21 @@ const producePlugins = ({ circularDeps, ignoresJS, dir, sourcemap = false, exclu
|
|
|
30
30
|
ignoresJS,
|
|
31
31
|
sourcemap,
|
|
32
32
|
dir
|
|
33
|
-
})
|
|
33
|
+
}),
|
|
34
|
+
fast: () => {
|
|
35
|
+
return require_rolldown_config_plugins_index.PLUGIN_BUILDERS.fast({
|
|
36
|
+
include,
|
|
37
|
+
exclude,
|
|
38
|
+
declarationMap,
|
|
39
|
+
dir
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
esm: rolldown_plugins.esmExternalRequirePlugin
|
|
34
43
|
};
|
|
35
44
|
const defaultOrdered = () => [
|
|
36
45
|
unordered.circulars(),
|
|
37
46
|
unordered.externals(),
|
|
38
|
-
|
|
47
|
+
unordered.esm(),
|
|
39
48
|
unordered.typescript(),
|
|
40
49
|
unordered.clean()
|
|
41
50
|
];
|
|
@@ -60,6 +69,18 @@ defineConfig.default = ({ dir, sourcemap = false, ...rest } = {}) => {
|
|
|
60
69
|
platform: "node"
|
|
61
70
|
});
|
|
62
71
|
};
|
|
72
|
+
defineConfig.fast = (rest) => {
|
|
73
|
+
return defineConfig.default({
|
|
74
|
+
...rest,
|
|
75
|
+
plugins: [
|
|
76
|
+
"circulars",
|
|
77
|
+
"externals",
|
|
78
|
+
"esm",
|
|
79
|
+
"fast",
|
|
80
|
+
"clean"
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
};
|
|
63
84
|
defineConfig.bemedev = (additionals) => {
|
|
64
85
|
const circularDeps = require_rolldown_config_constants.DEFAULT_CIRCULAR_DEPS.concat(require_utils_array.toArray(additionals?.circularDeps));
|
|
65
86
|
const ignoresJS = require_utils_array.toArray(additionals?.ignoresJS).concat(require_rolldown_config_constants.DEFAULT_CIRCULAR_DEPS);
|
|
@@ -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';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\n\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n 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 typescript: () =>\n PLUGIN_BUILDERS.typescript({\n include,\n exclude,\n declarationMap,\n dir,\n }),\n circulars: () => PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n clean: () => PLUGIN_BUILDERS.clean({ ignoresJS, sourcemap, dir }),\n };\n\n const defaultOrdered = () => [\n unordered.circulars(),\n unordered.externals(),\n
|
|
1
|
+
{"version":3,"file":"config.cjs","names":["buildInput","toArray","DEFAULT_EXCLUDE","PLUGIN_BUILDERS","esmExternalRequirePlugin","buildOutput","DEFAULT_CIRCULAR_DEPS"],"sources":["../../src/rolldown-config/config.ts"],"sourcesContent":["import { defineConfig as _defineConfig } from 'rolldown';\nimport { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\n\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n 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 typescript: () =>\n PLUGIN_BUILDERS.typescript({\n include,\n exclude,\n declarationMap,\n dir,\n }),\n circulars: () => PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n clean: () => PLUGIN_BUILDERS.clean({ ignoresJS, sourcemap, dir }),\n fast: () => {\n return PLUGIN_BUILDERS.fast({\n include,\n exclude,\n declarationMap,\n dir,\n });\n },\n esm: esmExternalRequirePlugin,\n };\n\n const defaultOrdered = () => [\n unordered.circulars(),\n unordered.externals(),\n unordered.esm(),\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 = ({ dir, sourcemap = false, ...rest } = {}) => {\n const input = buildInput();\n const external = rest.externals;\n const output = buildOutput(dir, sourcemap);\n\n const plugins = producePlugins({ dir, sourcemap, ...rest });\n\n return _defineConfig({\n input,\n plugins,\n external,\n output,\n platform: 'node',\n });\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({\n ...rest,\n plugins: ['circulars', 'externals', 'esm', 'fast', 'clean'],\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":";;;;;;;;;AAWA,MAAa,gBAAyB,gBAAe;CACnD,OAAO,aAAa,QAAQ,WAAW;AACzC;AAEA,MAAM,kBAAkB,EACtB,cACA,WACA,KACA,YAAY,OACZ,YACA,gBACA,YACU,CAAC,MAAM;CACjB,MAAM,UAAUA,8BAAAA,WAAW,GAAGC,oBAAAA,QAAQ,UAAU,CAAC;CACjD,MAAM,UAAUC,kCAAAA,gBAAgB,OAAOD,oBAAAA,QAAQ,UAAU,CAAC;CAC1D,MAAM,YAAY;EAChB,kBACEE,sCAAAA,gBAAgB,WAAW;GACzB;GACA;GACA;GACA;EACF,CAAC;EACH,iBAAiBA,sCAAAA,gBAAgB,UAAU,EAAE,SAAS,aAAa,CAAC;EACpE,iBACEA,sCAAAA,gBAAgB,UAAU;GAExB,SAAS;GACT,gBAAgB;GAChB,SAAS;EACX,CAAC;EACH,aAAaA,sCAAAA,gBAAgB,MAAM;GAAE;GAAW;GAAW;EAAI,CAAC;EAChE,YAAY;GACV,OAAOA,sCAAAA,gBAAgB,KAAK;IAC1B;IACA;IACA;IACA;GACF,CAAC;EACH;EACA,KAAKC,iBAAAA;CACP;CAEA,MAAM,uBAAuB;EAC3B,UAAU,UAAU;EACpB,UAAU,UAAU;EACpB,UAAU,IAAI;EACd,UAAU,WAAW;EACrB,UAAU,MAAM;CAClB;CAEA,OAAO,UACH,QACG,KAAI,MAAK;EACR,IAAI,OAAO,MAAM,UAAU,OAAO,UAAU,EAAE,CAAC;EAC/C,OAAO;CACT,CAAC,CAAC,CACD,QAAO,MAAK,CAAC,CAAC,CAAC,IAClB,eAAe;AACrB;AAEA,aAAa,WAAW,EAAE,KAAK,YAAY,OAAO,GAAG,SAAS,CAAC,MAAM;CACnE,MAAM,QAAQJ,8BAAAA,WAAW;CACzB,MAAM,WAAW,KAAK;CACtB,MAAM,SAASK,+BAAAA,YAAY,KAAK,SAAS;CAIzC,QAAA,GAAA,SAAA,aAAA,CAAqB;EACnB;EACA,SAJc,eAAe;GAAE;GAAK;GAAW,GAAG;EAAK,CAIjD;EACN;EACA;EACA,UAAU;CACZ,CAAC;AACH;AAEA,aAAa,QAAO,SAAQ;CAC1B,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH,SAAS;GAAC;GAAa;GAAa;GAAO;GAAQ;EAAO;CAC5D,CAAC;AACH;AAEA,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAeC,kCAAAA,sBAAsB,OACzCL,oBAAAA,QAAQ,aAAa,YAAY,CACnC;CACA,MAAM,YAAYA,oBAAAA,QAAQ,aAAa,SAAS,CAAC,CAAC,OAChDK,kCAAAA,qBACF;CAEA,MAAM,aAAaJ,kCAAAA,gBAAgB,OACjCD,oBAAAA,QAAQ,aAAa,UAAU,CACjC;CACA,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;EACA;CACF,CAAC;AACH"}
|
|
@@ -29,12 +29,21 @@ const producePlugins = ({ circularDeps, ignoresJS, dir, sourcemap = false, exclu
|
|
|
29
29
|
ignoresJS,
|
|
30
30
|
sourcemap,
|
|
31
31
|
dir
|
|
32
|
-
})
|
|
32
|
+
}),
|
|
33
|
+
fast: () => {
|
|
34
|
+
return PLUGIN_BUILDERS.fast({
|
|
35
|
+
include,
|
|
36
|
+
exclude,
|
|
37
|
+
declarationMap,
|
|
38
|
+
dir
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
esm: esmExternalRequirePlugin
|
|
33
42
|
};
|
|
34
43
|
const defaultOrdered = () => [
|
|
35
44
|
unordered.circulars(),
|
|
36
45
|
unordered.externals(),
|
|
37
|
-
|
|
46
|
+
unordered.esm(),
|
|
38
47
|
unordered.typescript(),
|
|
39
48
|
unordered.clean()
|
|
40
49
|
];
|
|
@@ -59,6 +68,18 @@ defineConfig.default = ({ dir, sourcemap = false, ...rest } = {}) => {
|
|
|
59
68
|
platform: "node"
|
|
60
69
|
});
|
|
61
70
|
};
|
|
71
|
+
defineConfig.fast = (rest) => {
|
|
72
|
+
return defineConfig.default({
|
|
73
|
+
...rest,
|
|
74
|
+
plugins: [
|
|
75
|
+
"circulars",
|
|
76
|
+
"externals",
|
|
77
|
+
"esm",
|
|
78
|
+
"fast",
|
|
79
|
+
"clean"
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
};
|
|
62
83
|
defineConfig.bemedev = (additionals) => {
|
|
63
84
|
const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(toArray(additionals?.circularDeps));
|
|
64
85
|
const ignoresJS = toArray(additionals?.ignoresJS).concat(DEFAULT_CIRCULAR_DEPS);
|
|
@@ -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';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\n\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n 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 typescript: () =>\n PLUGIN_BUILDERS.typescript({\n include,\n exclude,\n declarationMap,\n dir,\n }),\n circulars: () => PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n clean: () => PLUGIN_BUILDERS.clean({ ignoresJS, sourcemap, dir }),\n };\n\n const defaultOrdered = () => [\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';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\n\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n 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 typescript: () =>\n PLUGIN_BUILDERS.typescript({\n include,\n exclude,\n declarationMap,\n dir,\n }),\n circulars: () => PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n clean: () => PLUGIN_BUILDERS.clean({ ignoresJS, sourcemap, dir }),\n fast: () => {\n return PLUGIN_BUILDERS.fast({\n include,\n exclude,\n declarationMap,\n dir,\n });\n },\n esm: esmExternalRequirePlugin,\n };\n\n const defaultOrdered = () => [\n unordered.circulars(),\n unordered.externals(),\n unordered.esm(),\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 = ({ dir, sourcemap = false, ...rest } = {}) => {\n const input = buildInput();\n const external = rest.externals;\n const output = buildOutput(dir, sourcemap);\n\n const plugins = producePlugins({ dir, sourcemap, ...rest });\n\n return _defineConfig({\n input,\n plugins,\n external,\n output,\n platform: 'node',\n });\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({\n ...rest,\n plugins: ['circulars', 'externals', 'esm', 'fast', 'clean'],\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":";;;;;;;;AAWA,MAAa,gBAAyB,gBAAe;CACnD,OAAO,aAAa,QAAQ,WAAW;AACzC;AAEA,MAAM,kBAAkB,EACtB,cACA,WACA,KACA,YAAY,OACZ,YACA,gBACA,YACU,CAAC,MAAM;CACjB,MAAM,UAAU,WAAW,GAAG,QAAQ,UAAU,CAAC;CACjD,MAAM,UAAU,gBAAgB,OAAO,QAAQ,UAAU,CAAC;CAC1D,MAAM,YAAY;EAChB,kBACE,gBAAgB,WAAW;GACzB;GACA;GACA;GACA;EACF,CAAC;EACH,iBAAiB,gBAAgB,UAAU,EAAE,SAAS,aAAa,CAAC;EACpE,iBACE,gBAAgB,UAAU;GAExB,SAAS;GACT,gBAAgB;GAChB,SAAS;EACX,CAAC;EACH,aAAa,gBAAgB,MAAM;GAAE;GAAW;GAAW;EAAI,CAAC;EAChE,YAAY;GACV,OAAO,gBAAgB,KAAK;IAC1B;IACA;IACA;IACA;GACF,CAAC;EACH;EACA,KAAK;CACP;CAEA,MAAM,uBAAuB;EAC3B,UAAU,UAAU;EACpB,UAAU,UAAU;EACpB,UAAU,IAAI;EACd,UAAU,WAAW;EACrB,UAAU,MAAM;CAClB;CAEA,OAAO,UACH,QACG,KAAI,MAAK;EACR,IAAI,OAAO,MAAM,UAAU,OAAO,UAAU,EAAE,CAAC;EAC/C,OAAO;CACT,CAAC,CAAC,CACD,QAAO,MAAK,CAAC,CAAC,CAAC,IAClB,eAAe;AACrB;AAEA,aAAa,WAAW,EAAE,KAAK,YAAY,OAAO,GAAG,SAAS,CAAC,MAAM;CACnE,MAAM,QAAQ,WAAW;CACzB,MAAM,WAAW,KAAK;CACtB,MAAM,SAAS,YAAY,KAAK,SAAS;CAIzC,OAAOA,eAAc;EACnB;EACA,SAJc,eAAe;GAAE;GAAK;GAAW,GAAG;EAAK,CAIjD;EACN;EACA;EACA,UAAU;CACZ,CAAC;AACH;AAEA,aAAa,QAAO,SAAQ;CAC1B,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH,SAAS;GAAC;GAAa;GAAa;GAAO;GAAQ;EAAO;CAC5D,CAAC;AACH;AAEA,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAe,sBAAsB,OACzC,QAAQ,aAAa,YAAY,CACnC;CACA,MAAM,YAAY,QAAQ,aAAa,SAAS,CAAC,CAAC,OAChD,qBACF;CAEA,MAAM,aAAa,gBAAgB,OACjC,QAAQ,aAAa,UAAU,CACjC;CACA,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;EACA;CACF,CAAC;AACH"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./constants.cjs");
|
|
3
|
+
const require_rolldown_config_plugins_typescript_config = require("./plugins/typescript.config.cjs");
|
|
3
4
|
//#region src/rolldown-config/output.ts
|
|
4
5
|
const buildOutput = (dir = "lib", sourcemap) => {
|
|
6
|
+
const outDir = require_rolldown_config_plugins_typescript_config.getConfig(process.cwd()).options.outDir ?? dir ?? "lib";
|
|
5
7
|
return [{
|
|
6
8
|
format: "es",
|
|
7
9
|
sourcemap,
|
|
8
10
|
preserveModulesRoot: "src",
|
|
9
|
-
dir,
|
|
11
|
+
dir: outDir,
|
|
10
12
|
preserveModules: true,
|
|
11
13
|
entryFileNames: "[name].js"
|
|
12
14
|
}, {
|
|
13
15
|
format: "cjs",
|
|
14
16
|
sourcemap,
|
|
15
17
|
preserveModulesRoot: "src",
|
|
16
|
-
dir,
|
|
18
|
+
dir: outDir,
|
|
17
19
|
preserveModules: true,
|
|
18
20
|
entryFileNames: "[name].cjs"
|
|
19
21
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.cjs","names":[],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nimport { DEFAULT_DIR } from './constants';\n\nexport const buildOutput = (dir = DEFAULT_DIR, sourcemap: boolean) => {\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"output.cjs","names":["getConfig"],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nimport { DEFAULT_DIR } from './constants';\nimport { getConfig } from './plugins/typescript.config';\n\nexport const buildOutput = (dir = DEFAULT_DIR, sourcemap: boolean) => {\n const config = getConfig(process.cwd());\n const outDir = config.options.outDir ?? dir ?? DEFAULT_DIR;\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";;;;AAKA,MAAa,eAAe,MAAA,OAAmB,cAAuB;CAEpE,MAAM,SADSA,kDAAAA,UAAU,QAAQ,IAAI,CACjB,CAAC,CAAC,QAAQ,UAAU,OAAA;CACxC,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,GACA;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,CACF;AACF"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import "./constants.js";
|
|
2
|
+
import { getConfig } from "./plugins/typescript.config.js";
|
|
2
3
|
//#region src/rolldown-config/output.ts
|
|
3
4
|
const buildOutput = (dir = "lib", sourcemap) => {
|
|
5
|
+
const outDir = getConfig(process.cwd()).options.outDir ?? dir ?? "lib";
|
|
4
6
|
return [{
|
|
5
7
|
format: "es",
|
|
6
8
|
sourcemap,
|
|
7
9
|
preserveModulesRoot: "src",
|
|
8
|
-
dir,
|
|
10
|
+
dir: outDir,
|
|
9
11
|
preserveModules: true,
|
|
10
12
|
entryFileNames: "[name].js"
|
|
11
13
|
}, {
|
|
12
14
|
format: "cjs",
|
|
13
15
|
sourcemap,
|
|
14
16
|
preserveModulesRoot: "src",
|
|
15
|
-
dir,
|
|
17
|
+
dir: outDir,
|
|
16
18
|
preserveModules: true,
|
|
17
19
|
entryFileNames: "[name].cjs"
|
|
18
20
|
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","names":[],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nimport { DEFAULT_DIR } from './constants';\n\nexport const buildOutput = (dir = DEFAULT_DIR, sourcemap: boolean) => {\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"output.js","names":[],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nimport { DEFAULT_DIR } from './constants';\nimport { getConfig } from './plugins/typescript.config';\n\nexport const buildOutput = (dir = DEFAULT_DIR, sourcemap: boolean) => {\n const config = getConfig(process.cwd());\n const outDir = config.options.outDir ?? dir ?? DEFAULT_DIR;\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir: outDir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";;;AAKA,MAAa,eAAe,MAAA,OAAmB,cAAuB;CAEpE,MAAM,SADS,UAAU,QAAQ,IAAI,CACjB,CAAC,CAAC,QAAQ,UAAU,OAAA;CACxC,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,GACA;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB,KAAK;EACL,iBAAiB;EACjB,gBAAgB;CAClB,CACF;AACF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_utils_array = require("../../utils/array.cjs");
|
|
3
3
|
const require_rolldown_config_constants = require("../constants.cjs");
|
|
4
|
-
const require_rolldown_config_helpers = require("../helpers.cjs");
|
|
5
4
|
const require_rolldown_config_plugins_typescript_config = require("./typescript.config.cjs");
|
|
5
|
+
const require_rolldown_config_helpers = require("../helpers.cjs");
|
|
6
6
|
let fs = require("fs");
|
|
7
7
|
let path = require("path");
|
|
8
8
|
let glob = require("glob");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toArray } from "../../utils/array.js";
|
|
2
2
|
import { WARNING_CODES } from "../constants.js";
|
|
3
|
-
import { cleanupJS, withoutExtension } from "../helpers.js";
|
|
4
3
|
import { readTsConfig } from "./typescript.config.js";
|
|
4
|
+
import { cleanupJS, withoutExtension } from "../helpers.js";
|
|
5
5
|
import { existsSync } from "fs";
|
|
6
6
|
import { relative } from "path";
|
|
7
7
|
import { globSync } from "glob";
|
|
@@ -2,19 +2,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_rolldown_config_plugins_circulars = require("./circulars.cjs");
|
|
3
3
|
const require_rolldown_config_plugins_clean = require("./clean.cjs");
|
|
4
4
|
const require_rolldown_config_plugins_externals = require("./externals.cjs");
|
|
5
|
+
const require_rolldown_config_plugins_typescript = require("./typescript.cjs");
|
|
6
|
+
const require_rolldown_config_plugins_typescript_fast = require("./typescript.fast.cjs");
|
|
7
|
+
let rolldown_plugins = require("rolldown/plugins");
|
|
5
8
|
//#region src/rolldown-config/plugins/index.ts
|
|
6
9
|
const PLUGIN_BUILDERS = {
|
|
7
|
-
typescript:
|
|
10
|
+
typescript: require_rolldown_config_plugins_typescript.typescript,
|
|
8
11
|
circulars: require_rolldown_config_plugins_circulars.circulars,
|
|
9
12
|
externals: require_rolldown_config_plugins_externals.externals,
|
|
10
|
-
clean: require_rolldown_config_plugins_clean.clean
|
|
13
|
+
clean: require_rolldown_config_plugins_clean.clean,
|
|
14
|
+
fast: require_rolldown_config_plugins_typescript_fast.typescriptFast,
|
|
15
|
+
esm: rolldown_plugins.esmExternalRequirePlugin
|
|
11
16
|
};
|
|
12
|
-
const DEFAULT_PLUGINS_ORDER =
|
|
13
|
-
"typescript",
|
|
14
|
-
"circulars",
|
|
15
|
-
"externals",
|
|
16
|
-
"clean"
|
|
17
|
-
];
|
|
17
|
+
const DEFAULT_PLUGINS_ORDER = Object.keys(PLUGIN_BUILDERS);
|
|
18
18
|
//#endregion
|
|
19
19
|
exports.DEFAULT_PLUGINS_ORDER = DEFAULT_PLUGINS_ORDER;
|
|
20
20
|
exports.PLUGIN_BUILDERS = PLUGIN_BUILDERS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { typescript } from './typescript';\
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["typescriptFast","esmExternalRequirePlugin"],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { typescript } from './typescript';\nimport { typescriptFast } from './typescript.fast';\n\nexport const PLUGIN_BUILDERS = {\n typescript,\n circulars,\n externals,\n clean,\n fast: typescriptFast,\n esm: esmExternalRequirePlugin,\n};\n\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n PLUGIN_BUILDERS,\n) as (keyof typeof PLUGIN_BUILDERS)[];\n"],"mappings":";;;;;;;;AAQA,MAAa,kBAAkB;CAC7B,YAAA,2CAAA;CACA,WAAA,0CAAA;CACA,WAAA,0CAAA;CACA,OAAA,sCAAA;CACA,MAAMA,gDAAAA;CACN,KAAKC,iBAAAA;AACP;AAEA,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { esmExternalRequirePlugin } from 'rolldown/plugins';
|
|
1
2
|
import { circulars } from './circulars';
|
|
2
3
|
import { externals } from './externals';
|
|
3
4
|
export declare const PLUGIN_BUILDERS: {
|
|
@@ -19,5 +20,12 @@ export declare const PLUGIN_BUILDERS: {
|
|
|
19
20
|
handler: () => void;
|
|
20
21
|
};
|
|
21
22
|
};
|
|
23
|
+
fast: ({ exclude, include, declarationMap, dir, }?: {
|
|
24
|
+
exclude?: string | string[];
|
|
25
|
+
include?: Record<string, string>;
|
|
26
|
+
declarationMap?: boolean;
|
|
27
|
+
dir?: string;
|
|
28
|
+
}) => import("rolldown").RolldownPluginOption;
|
|
29
|
+
esm: typeof esmExternalRequirePlugin;
|
|
22
30
|
};
|
|
23
|
-
export declare const DEFAULT_PLUGINS_ORDER:
|
|
31
|
+
export declare const DEFAULT_PLUGINS_ORDER: (keyof typeof PLUGIN_BUILDERS)[];
|
|
@@ -2,19 +2,18 @@ import { circulars } from "./circulars.js";
|
|
|
2
2
|
import { clean } from "./clean.js";
|
|
3
3
|
import { externals } from "./externals.js";
|
|
4
4
|
import { typescript } from "./typescript.js";
|
|
5
|
+
import { typescriptFast } from "./typescript.fast.js";
|
|
6
|
+
import { esmExternalRequirePlugin } from "rolldown/plugins";
|
|
5
7
|
//#region src/rolldown-config/plugins/index.ts
|
|
6
8
|
const PLUGIN_BUILDERS = {
|
|
7
9
|
typescript,
|
|
8
10
|
circulars,
|
|
9
11
|
externals,
|
|
10
|
-
clean
|
|
12
|
+
clean,
|
|
13
|
+
fast: typescriptFast,
|
|
14
|
+
esm: esmExternalRequirePlugin
|
|
11
15
|
};
|
|
12
|
-
const DEFAULT_PLUGINS_ORDER =
|
|
13
|
-
"typescript",
|
|
14
|
-
"circulars",
|
|
15
|
-
"externals",
|
|
16
|
-
"clean"
|
|
17
|
-
];
|
|
16
|
+
const DEFAULT_PLUGINS_ORDER = Object.keys(PLUGIN_BUILDERS);
|
|
18
17
|
//#endregion
|
|
19
18
|
export { DEFAULT_PLUGINS_ORDER, PLUGIN_BUILDERS };
|
|
20
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { typescript } from './typescript';\
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { typescript } from './typescript';\nimport { typescriptFast } from './typescript.fast';\n\nexport const PLUGIN_BUILDERS = {\n typescript,\n circulars,\n externals,\n clean,\n fast: typescriptFast,\n esm: esmExternalRequirePlugin,\n};\n\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n PLUGIN_BUILDERS,\n) as (keyof typeof PLUGIN_BUILDERS)[];\n"],"mappings":";;;;;;;AAQA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA,MAAM;CACN,KAAK;AACP;AAEA,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
|
|
@@ -43,6 +43,10 @@ const _host = {
|
|
|
43
43
|
fileExists: fs.existsSync,
|
|
44
44
|
readFile: _readFile
|
|
45
45
|
};
|
|
46
|
+
function getConfig(searchPath, configName = "tsconfig.json") {
|
|
47
|
+
const tsconfigPath = _typescript_typescript6.default.findConfigFile(searchPath, fs.existsSync, configName);
|
|
48
|
+
return readTsConfig(tsconfigPath);
|
|
49
|
+
}
|
|
46
50
|
const readTsConfig = (path$1) => {
|
|
47
51
|
const configFile = _typescript_typescript6.default.readConfigFile(path$1, _readFile);
|
|
48
52
|
if (configFile.error) throw new Error(_typescript_typescript6.default.formatDiagnostic(configFile.error, {
|
|
@@ -53,6 +57,7 @@ const readTsConfig = (path$1) => {
|
|
|
53
57
|
return _typescript_typescript6.default.parseJsonConfigFileContent(configFile.config, _host, (0, path.dirname)(path$1));
|
|
54
58
|
};
|
|
55
59
|
//#endregion
|
|
60
|
+
exports.getConfig = getConfig;
|
|
56
61
|
exports.readTsConfig = readTsConfig;
|
|
57
62
|
|
|
58
63
|
//# sourceMappingURL=typescript.config.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.config.cjs","names":["existsSync","ts","path"],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport ts from '@typescript/typescript6';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;;;;AAKA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,QAAA,GAAA,GAAA,aAAA,CAAoB,UAAU,OAAO;CACvC,QAAQ;EACN;CACF;AACF;AAEA,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,CAAC;CAE3B,MAAM,QAAQ,KAAa,iBAAyB;EAClD,IAAI,UAAU,KAAA,KAAa,eAAe,OAAO;EAEjD,IAAI;EACJ,IAAI;GACF,WAAA,GAAA,GAAA,YAAA,CAAsB,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,YAAA,GAAA,KAAA,KAAA,CAAgB,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,QAAA,GAAA,GAAA,SAAA,CAAgB,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IACL,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAE1C,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAYA,GAAAA;CACZ,UAAU;AACZ;AAEA,MAAa,gBAAgB,WAAiB;CAC5C,MAAM,aAAaC,wBAAAA,QAAG,eAAeC,QAAM,SAAS;CAEpD,IAAI,WAAW,OACb,MAAM,IAAI,MACRD,wBAAAA,QAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,IAAI;EACvC,kBAAkB;CACpB,CAAC,CACH;CASF,OANqBA,wBAAAA,QAAG,2BACtB,WAAW,QACX,QAAA,GAAA,KAAA,QAAA,CACQC,MAAI,CAGI;AACpB"}
|
|
1
|
+
{"version":3,"file":"typescript.config.cjs","names":["existsSync","ts","path"],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport ts from '@typescript/typescript6';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport function getConfig(\n searchPath: string,\n configName: string = 'tsconfig.json',\n) {\n const tsconfigPath = ts.findConfigFile(\n searchPath,\n existsSync,\n configName,\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n return configFile;\n}\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;;;;AAKA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,QAAA,GAAA,GAAA,aAAA,CAAoB,UAAU,OAAO;CACvC,QAAQ;EACN;CACF;AACF;AAEA,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,CAAC;CAE3B,MAAM,QAAQ,KAAa,iBAAyB;EAClD,IAAI,UAAU,KAAA,KAAa,eAAe,OAAO;EAEjD,IAAI;EACJ,IAAI;GACF,WAAA,GAAA,GAAA,YAAA,CAAsB,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,YAAA,GAAA,KAAA,KAAA,CAAgB,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,QAAA,GAAA,GAAA,SAAA,CAAgB,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IACL,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAE1C,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAYA,GAAAA;CACZ,UAAU;AACZ;AAEA,SAAgB,UACd,YACA,aAAqB,iBACrB;CACA,MAAM,eAAeC,wBAAAA,QAAG,eACtB,YACAD,GAAAA,YACA,UACF;CAGA,OADmB,aAAa,YAChB;AAClB;AAEA,MAAa,gBAAgB,WAAiB;CAC5C,MAAM,aAAaC,wBAAAA,QAAG,eAAeC,QAAM,SAAS;CAEpD,IAAI,WAAW,OACb,MAAM,IAAI,MACRD,wBAAAA,QAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,IAAI;EACvC,kBAAkB;CACpB,CAAC,CACH;CASF,OANqBA,wBAAAA,QAAG,2BACtB,WAAW,QACX,QAAA,GAAA,KAAA,QAAA,CACQC,MAAI,CAGI;AACpB"}
|
|
@@ -40,6 +40,10 @@ const _host = {
|
|
|
40
40
|
fileExists: existsSync,
|
|
41
41
|
readFile: _readFile
|
|
42
42
|
};
|
|
43
|
+
function getConfig(searchPath, configName = "tsconfig.json") {
|
|
44
|
+
const tsconfigPath = ts.findConfigFile(searchPath, existsSync, configName);
|
|
45
|
+
return readTsConfig(tsconfigPath);
|
|
46
|
+
}
|
|
43
47
|
const readTsConfig = (path) => {
|
|
44
48
|
const configFile = ts.readConfigFile(path, _readFile);
|
|
45
49
|
if (configFile.error) throw new Error(ts.formatDiagnostic(configFile.error, {
|
|
@@ -50,6 +54,6 @@ const readTsConfig = (path) => {
|
|
|
50
54
|
return ts.parseJsonConfigFileContent(configFile.config, _host, dirname(path));
|
|
51
55
|
};
|
|
52
56
|
//#endregion
|
|
53
|
-
export { readTsConfig };
|
|
57
|
+
export { getConfig, readTsConfig };
|
|
54
58
|
|
|
55
59
|
//# sourceMappingURL=typescript.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.config.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport ts from '@typescript/typescript6';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;AAKA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,OAAO,aAAa,UAAU,OAAO;CACvC,QAAQ;EACN;CACF;AACF;AAEA,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,CAAC;CAE3B,MAAM,QAAQ,KAAa,iBAAyB;EAClD,IAAI,UAAU,KAAA,KAAa,eAAe,OAAO;EAEjD,IAAI;EACJ,IAAI;GACF,UAAU,YAAY,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,WAAW,KAAK,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,OAAO,SAAS,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IACL,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAE1C,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAY;CACZ,UAAU;AACZ;AAEA,MAAa,gBAAgB,SAAiB;CAC5C,MAAM,aAAa,GAAG,eAAe,MAAM,SAAS;CAEpD,IAAI,WAAW,OACb,MAAM,IAAI,MACR,GAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,IAAI;EACvC,kBAAkB;CACpB,CAAC,CACH;CASF,OANqB,GAAG,2BACtB,WAAW,QACX,OACA,QAAQ,IAAI,CAGI;AACpB"}
|
|
1
|
+
{"version":3,"file":"typescript.config.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport ts from '@typescript/typescript6';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport function getConfig(\n searchPath: string,\n configName: string = 'tsconfig.json',\n) {\n const tsconfigPath = ts.findConfigFile(\n searchPath,\n existsSync,\n configName,\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n return configFile;\n}\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;AAKA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,OAAO,aAAa,UAAU,OAAO;CACvC,QAAQ;EACN;CACF;AACF;AAEA,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,CAAC;CAE3B,MAAM,QAAQ,KAAa,iBAAyB;EAClD,IAAI,UAAU,KAAA,KAAa,eAAe,OAAO;EAEjD,IAAI;EACJ,IAAI;GACF,UAAU,YAAY,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,WAAW,KAAK,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,OAAO,SAAS,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IACL,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAE1C,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAY;CACZ,UAAU;AACZ;AAEA,SAAgB,UACd,YACA,aAAqB,iBACrB;CACA,MAAM,eAAe,GAAG,eACtB,YACA,YACA,UACF;CAGA,OADmB,aAAa,YAChB;AAClB;AAEA,MAAa,gBAAgB,SAAiB;CAC5C,MAAM,aAAa,GAAG,eAAe,MAAM,SAAS;CAEpD,IAAI,WAAW,OACb,MAAM,IAAI,MACR,GAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,IAAI;EACvC,kBAAkB;CACpB,CAAC,CACH;CASF,OANqB,GAAG,2BACtB,WAAW,QACX,OACA,QAAQ,IAAI,CAGI;AACpB"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_utils_array = require("../../utils/array.cjs");
|
|
4
|
+
require("../constants.cjs");
|
|
5
|
+
const require_rolldown_config_plugins_typescript_config = require("./typescript.config.cjs");
|
|
6
|
+
let fs = require("fs");
|
|
7
|
+
let path = require("path");
|
|
8
|
+
let glob = require("glob");
|
|
9
|
+
let _typescript_typescript6 = require("@typescript/typescript6");
|
|
10
|
+
_typescript_typescript6 = require_runtime.__toESM(_typescript_typescript6, 1);
|
|
11
|
+
let tsc_alias = require("tsc-alias");
|
|
12
|
+
let oxc_transform = require("oxc-transform");
|
|
13
|
+
//#region src/rolldown-config/plugins/typescript.fast.ts
|
|
14
|
+
const typescriptFast = ({ exclude, include, declarationMap, dir } = {}) => {
|
|
15
|
+
let done = false;
|
|
16
|
+
return {
|
|
17
|
+
name: "bemedev-fast-dts",
|
|
18
|
+
options(opts) {
|
|
19
|
+
opts.external = [...require_utils_array.toArray(opts.external).filter((v) => typeof v === "string" || v instanceof RegExp), "source-map-support"];
|
|
20
|
+
return opts;
|
|
21
|
+
},
|
|
22
|
+
closeBundle: {
|
|
23
|
+
order: "pre",
|
|
24
|
+
async handler() {
|
|
25
|
+
if (done) return;
|
|
26
|
+
const cwd = process.cwd();
|
|
27
|
+
const tsconfigPath = _typescript_typescript6.default.findConfigFile(cwd, fs.existsSync, "tsconfig.json");
|
|
28
|
+
const configFile = require_rolldown_config_plugins_typescript_config.readTsConfig(tsconfigPath);
|
|
29
|
+
const outDir = configFile.options.outDir ?? dir ?? "lib";
|
|
30
|
+
const rootDir = configFile.options.rootDir ?? (0, path.join)(cwd, "src");
|
|
31
|
+
let files;
|
|
32
|
+
if (include && Object.keys(include).length > 0) files = Object.values(include);
|
|
33
|
+
else files = (0, glob.globSync)((0, path.join)(rootDir, "**/*.{ts,tsx,cts,mts}"), { ignore: require_utils_array.toArray(exclude) });
|
|
34
|
+
files = files.filter((file) => !file.endsWith(".d.ts") && !file.endsWith(".d.cts") && !file.endsWith(".d.mts"));
|
|
35
|
+
const errors = [];
|
|
36
|
+
for (const file of files) try {
|
|
37
|
+
const result = (0, oxc_transform.transformSync)(file, (0, fs.readFileSync)(file, "utf-8"), {
|
|
38
|
+
sourcemap: !!declarationMap,
|
|
39
|
+
typescript: { declaration: { sourcemap: !!declarationMap } }
|
|
40
|
+
});
|
|
41
|
+
if (result.errors && result.errors.length > 0) errors.push(...result.errors);
|
|
42
|
+
const relativePath = (0, path.relative)(rootDir, file);
|
|
43
|
+
let dtsName = relativePath;
|
|
44
|
+
if (relativePath.endsWith(".tsx")) dtsName = relativePath.slice(0, -4) + ".d.ts";
|
|
45
|
+
else if (relativePath.endsWith(".ts")) dtsName = relativePath.slice(0, -3) + ".d.ts";
|
|
46
|
+
else if (relativePath.endsWith(".cts")) dtsName = relativePath.slice(0, -4) + ".d.cts";
|
|
47
|
+
else if (relativePath.endsWith(".mts")) dtsName = relativePath.slice(0, -4) + ".d.mts";
|
|
48
|
+
const outPath = (0, path.join)(outDir, dtsName);
|
|
49
|
+
const outMapPath = outPath + ".map";
|
|
50
|
+
(0, fs.mkdirSync)((0, path.dirname)(outPath), { recursive: true });
|
|
51
|
+
let dtsCode = result.declaration ?? "";
|
|
52
|
+
if (declarationMap && result.declarationMap) {
|
|
53
|
+
dtsCode += `\n//# sourceMappingURL=${(0, path.basename)(dtsName)}.map\n`;
|
|
54
|
+
(0, fs.writeFileSync)(outMapPath, JSON.stringify(result.declarationMap), "utf-8");
|
|
55
|
+
}
|
|
56
|
+
(0, fs.writeFileSync)(outPath, dtsCode, "utf-8");
|
|
57
|
+
} catch (err) {
|
|
58
|
+
console.error(`[bemedev-dts] Failed to process ${file}:`, err);
|
|
59
|
+
}
|
|
60
|
+
if (errors.length > 0) {
|
|
61
|
+
console.error(`[bemedev-dts] Generation completed with errors:`);
|
|
62
|
+
for (const err of errors) {
|
|
63
|
+
console.error(`Error in ${err.filename || "unknown file"}: ${err.message}`);
|
|
64
|
+
if (err.codeframe) console.error(err.codeframe);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
await (0, tsc_alias.replaceTscAliasPaths)({
|
|
68
|
+
configFile: tsconfigPath,
|
|
69
|
+
outDir
|
|
70
|
+
});
|
|
71
|
+
done = true;
|
|
72
|
+
console.log("DTS generation complete");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
exports.typescriptFast = typescriptFast;
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=typescript.fast.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.fast.cjs","names":["toArray","ts","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/typescript.fast.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n} from 'node:fs';\nimport { basename, dirname, join, relative } from 'node:path';\n\nimport ts from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport { transformSync } from 'oxc-transform';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\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 typescriptFast = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-fast-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 outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n const rootDir = configFile.options.rootDir ?? join(cwd, 'src');\n\n let files: string[];\n if (include && Object.keys(include).length > 0) {\n files = Object.values(include);\n } else {\n files = globSync(join(rootDir, '**/*.{ts,tsx,cts,mts}'), {\n ignore: toArray(exclude),\n });\n }\n\n files = files.filter(\n file =>\n !file.endsWith('.d.ts') &&\n !file.endsWith('.d.cts') &&\n !file.endsWith('.d.mts'),\n );\n\n const errors: any[] = [];\n\n for (const file of files) {\n try {\n const content = readFileSync(file, 'utf-8');\n const result = transformSync(file, content, {\n sourcemap: !!declarationMap,\n typescript: { declaration: { sourcemap: !!declarationMap } },\n });\n\n if (result.errors && result.errors.length > 0) {\n errors.push(...result.errors);\n }\n\n // Compute output path relative to rootDir\n const relativePath = relative(rootDir, file);\n let dtsName = relativePath;\n if (relativePath.endsWith('.tsx')) {\n dtsName = relativePath.slice(0, -4) + '.d.ts';\n } else if (relativePath.endsWith('.ts')) {\n dtsName = relativePath.slice(0, -3) + '.d.ts';\n } else if (relativePath.endsWith('.cts')) {\n dtsName = relativePath.slice(0, -4) + '.d.cts';\n } else if (relativePath.endsWith('.mts')) {\n dtsName = relativePath.slice(0, -4) + '.d.mts';\n }\n\n const outPath = join(outDir, dtsName);\n const outMapPath = outPath + '.map';\n\n // Ensure output directory exists\n mkdirSync(dirname(outPath), { recursive: true });\n\n let dtsCode = result.declaration ?? '';\n if (declarationMap && result.declarationMap) {\n dtsCode += `\\n//# sourceMappingURL=${basename(dtsName)}.map\\n`;\n writeFileSync(\n outMapPath,\n JSON.stringify(result.declarationMap),\n 'utf-8',\n );\n }\n\n writeFileSync(outPath, dtsCode, 'utf-8');\n } catch (err: any) {\n console.error(`[bemedev-dts] Failed to process ${file}:`, err);\n }\n }\n\n if (errors.length > 0) {\n console.error(`[bemedev-dts] Generation completed with errors:`);\n for (const err of errors) {\n console.error(\n `Error in ${err.filename || 'unknown file'}: ${err.message}`,\n );\n if (err.codeframe) {\n console.error(err.codeframe);\n }\n }\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;AA0BA,MAAa,kBAAkB,EAC7B,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHAA,oBAAAA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,MAElB,GAAG,oBAAoB;GAClD,OAAO;EACT;EACA,aAAa;GACX,OAAO;GACP,MAAM,UAAU;IACd,IAAI,MAAM;IACV,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAeC,wBAAAA,QAAG,eACtB,KACAC,GAAAA,YACA,eACF;IAEA,MAAM,aAAaC,kDAAAA,aAAa,YAAY;IAC5C,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAC5C,MAAM,UAAU,WAAW,QAAQ,YAAA,GAAA,KAAA,KAAA,CAAgB,KAAK,KAAK;IAE7D,IAAI;IACJ,IAAI,WAAW,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,GAC3C,QAAQ,OAAO,OAAO,OAAO;SAE7B,SAAA,GAAA,KAAA,SAAA,EAAA,GAAA,KAAA,KAAA,CAAsB,SAAS,uBAAuB,GAAG,EACvD,QAAQH,oBAAAA,QAAQ,OAAO,EACzB,CAAC;IAGH,QAAQ,MAAM,QACZ,SACE,CAAC,KAAK,SAAS,OAAO,KACtB,CAAC,KAAK,SAAS,QAAQ,KACvB,CAAC,KAAK,SAAS,QAAQ,CAC3B;IAEA,MAAM,SAAgB,CAAC;IAEvB,KAAK,MAAM,QAAQ,OACjB,IAAI;KAEF,MAAM,UAAA,GAAA,cAAA,cAAA,CAAuB,OAAA,GAAA,GAAA,aAAA,CADA,MAAM,OACM,GAAG;MAC1C,WAAW,CAAC,CAAC;MACb,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,eAAe,EAAE;KAC7D,CAAC;KAED,IAAI,OAAO,UAAU,OAAO,OAAO,SAAS,GAC1C,OAAO,KAAK,GAAG,OAAO,MAAM;KAI9B,MAAM,gBAAA,GAAA,KAAA,SAAA,CAAwB,SAAS,IAAI;KAC3C,IAAI,UAAU;KACd,IAAI,aAAa,SAAS,MAAM,GAC9B,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;UACjC,IAAI,aAAa,SAAS,KAAK,GACpC,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;UACjC,IAAI,aAAa,SAAS,MAAM,GACrC,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;UACjC,IAAI,aAAa,SAAS,MAAM,GACrC,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;KAGxC,MAAM,WAAA,GAAA,KAAA,KAAA,CAAe,QAAQ,OAAO;KACpC,MAAM,aAAa,UAAU;KAG7B,CAAA,GAAA,GAAA,UAAA,EAAA,GAAA,KAAA,QAAA,CAAkB,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;KAE/C,IAAI,UAAU,OAAO,eAAe;KACpC,IAAI,kBAAkB,OAAO,gBAAgB;MAC3C,WAAW,2BAAA,GAAA,KAAA,SAAA,CAAmC,OAAO,EAAE;MACvD,CAAA,GAAA,GAAA,cAAA,CACE,YACA,KAAK,UAAU,OAAO,cAAc,GACpC,OACF;KACF;KAEA,CAAA,GAAA,GAAA,cAAA,CAAc,SAAS,SAAS,OAAO;IACzC,SAAS,KAAU;KACjB,QAAQ,MAAM,mCAAmC,KAAK,IAAI,GAAG;IAC/D;IAGF,IAAI,OAAO,SAAS,GAAG;KACrB,QAAQ,MAAM,iDAAiD;KAC/D,KAAK,MAAM,OAAO,QAAQ;MACxB,QAAQ,MACN,YAAY,IAAI,YAAY,eAAe,IAAI,IAAI,SACrD;MACA,IAAI,IAAI,WACN,QAAQ,MAAM,IAAI,SAAS;KAE/B;IACF;IAEA,OAAA,GAAA,UAAA,qBAAA,CAA2B;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RolldownPluginOption } from 'rolldown';
|
|
2
|
+
type Props = {
|
|
3
|
+
exclude?: string | string[];
|
|
4
|
+
include?: Record<string, string>;
|
|
5
|
+
declarationMap?: boolean;
|
|
6
|
+
dir?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const typescriptFast: ({ exclude, include, declarationMap, dir, }?: Props) => RolldownPluginOption;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { toArray } from "../../utils/array.js";
|
|
2
|
+
import "../constants.js";
|
|
3
|
+
import { readTsConfig } from "./typescript.config.js";
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
5
|
+
import { basename, dirname, join, relative } from "path";
|
|
6
|
+
import { globSync } from "glob";
|
|
7
|
+
import ts from "@typescript/typescript6";
|
|
8
|
+
import { replaceTscAliasPaths } from "tsc-alias";
|
|
9
|
+
import { transformSync } from "oxc-transform";
|
|
10
|
+
//#region src/rolldown-config/plugins/typescript.fast.ts
|
|
11
|
+
const typescriptFast = ({ exclude, include, declarationMap, dir } = {}) => {
|
|
12
|
+
let done = false;
|
|
13
|
+
return {
|
|
14
|
+
name: "bemedev-fast-dts",
|
|
15
|
+
options(opts) {
|
|
16
|
+
opts.external = [...toArray(opts.external).filter((v) => typeof v === "string" || v instanceof RegExp), "source-map-support"];
|
|
17
|
+
return opts;
|
|
18
|
+
},
|
|
19
|
+
closeBundle: {
|
|
20
|
+
order: "pre",
|
|
21
|
+
async handler() {
|
|
22
|
+
if (done) return;
|
|
23
|
+
const cwd = process.cwd();
|
|
24
|
+
const tsconfigPath = ts.findConfigFile(cwd, existsSync, "tsconfig.json");
|
|
25
|
+
const configFile = readTsConfig(tsconfigPath);
|
|
26
|
+
const outDir = configFile.options.outDir ?? dir ?? "lib";
|
|
27
|
+
const rootDir = configFile.options.rootDir ?? join(cwd, "src");
|
|
28
|
+
let files;
|
|
29
|
+
if (include && Object.keys(include).length > 0) files = Object.values(include);
|
|
30
|
+
else files = globSync(join(rootDir, "**/*.{ts,tsx,cts,mts}"), { ignore: toArray(exclude) });
|
|
31
|
+
files = files.filter((file) => !file.endsWith(".d.ts") && !file.endsWith(".d.cts") && !file.endsWith(".d.mts"));
|
|
32
|
+
const errors = [];
|
|
33
|
+
for (const file of files) try {
|
|
34
|
+
const result = transformSync(file, readFileSync(file, "utf-8"), {
|
|
35
|
+
sourcemap: !!declarationMap,
|
|
36
|
+
typescript: { declaration: { sourcemap: !!declarationMap } }
|
|
37
|
+
});
|
|
38
|
+
if (result.errors && result.errors.length > 0) errors.push(...result.errors);
|
|
39
|
+
const relativePath = relative(rootDir, file);
|
|
40
|
+
let dtsName = relativePath;
|
|
41
|
+
if (relativePath.endsWith(".tsx")) dtsName = relativePath.slice(0, -4) + ".d.ts";
|
|
42
|
+
else if (relativePath.endsWith(".ts")) dtsName = relativePath.slice(0, -3) + ".d.ts";
|
|
43
|
+
else if (relativePath.endsWith(".cts")) dtsName = relativePath.slice(0, -4) + ".d.cts";
|
|
44
|
+
else if (relativePath.endsWith(".mts")) dtsName = relativePath.slice(0, -4) + ".d.mts";
|
|
45
|
+
const outPath = join(outDir, dtsName);
|
|
46
|
+
const outMapPath = outPath + ".map";
|
|
47
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
48
|
+
let dtsCode = result.declaration ?? "";
|
|
49
|
+
if (declarationMap && result.declarationMap) {
|
|
50
|
+
dtsCode += `\n//# sourceMappingURL=${basename(dtsName)}.map\n`;
|
|
51
|
+
writeFileSync(outMapPath, JSON.stringify(result.declarationMap), "utf-8");
|
|
52
|
+
}
|
|
53
|
+
writeFileSync(outPath, dtsCode, "utf-8");
|
|
54
|
+
} catch (err) {
|
|
55
|
+
console.error(`[bemedev-dts] Failed to process ${file}:`, err);
|
|
56
|
+
}
|
|
57
|
+
if (errors.length > 0) {
|
|
58
|
+
console.error(`[bemedev-dts] Generation completed with errors:`);
|
|
59
|
+
for (const err of errors) {
|
|
60
|
+
console.error(`Error in ${err.filename || "unknown file"}: ${err.message}`);
|
|
61
|
+
if (err.codeframe) console.error(err.codeframe);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
await replaceTscAliasPaths({
|
|
65
|
+
configFile: tsconfigPath,
|
|
66
|
+
outDir
|
|
67
|
+
});
|
|
68
|
+
done = true;
|
|
69
|
+
console.log("DTS generation complete");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { typescriptFast };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=typescript.fast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.fast.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.fast.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n} from 'node:fs';\nimport { basename, dirname, join, relative } from 'node:path';\n\nimport ts from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport { transformSync } from 'oxc-transform';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\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 typescriptFast = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-fast-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 outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n const rootDir = configFile.options.rootDir ?? join(cwd, 'src');\n\n let files: string[];\n if (include && Object.keys(include).length > 0) {\n files = Object.values(include);\n } else {\n files = globSync(join(rootDir, '**/*.{ts,tsx,cts,mts}'), {\n ignore: toArray(exclude),\n });\n }\n\n files = files.filter(\n file =>\n !file.endsWith('.d.ts') &&\n !file.endsWith('.d.cts') &&\n !file.endsWith('.d.mts'),\n );\n\n const errors: any[] = [];\n\n for (const file of files) {\n try {\n const content = readFileSync(file, 'utf-8');\n const result = transformSync(file, content, {\n sourcemap: !!declarationMap,\n typescript: { declaration: { sourcemap: !!declarationMap } },\n });\n\n if (result.errors && result.errors.length > 0) {\n errors.push(...result.errors);\n }\n\n // Compute output path relative to rootDir\n const relativePath = relative(rootDir, file);\n let dtsName = relativePath;\n if (relativePath.endsWith('.tsx')) {\n dtsName = relativePath.slice(0, -4) + '.d.ts';\n } else if (relativePath.endsWith('.ts')) {\n dtsName = relativePath.slice(0, -3) + '.d.ts';\n } else if (relativePath.endsWith('.cts')) {\n dtsName = relativePath.slice(0, -4) + '.d.cts';\n } else if (relativePath.endsWith('.mts')) {\n dtsName = relativePath.slice(0, -4) + '.d.mts';\n }\n\n const outPath = join(outDir, dtsName);\n const outMapPath = outPath + '.map';\n\n // Ensure output directory exists\n mkdirSync(dirname(outPath), { recursive: true });\n\n let dtsCode = result.declaration ?? '';\n if (declarationMap && result.declarationMap) {\n dtsCode += `\\n//# sourceMappingURL=${basename(dtsName)}.map\\n`;\n writeFileSync(\n outMapPath,\n JSON.stringify(result.declarationMap),\n 'utf-8',\n );\n }\n\n writeFileSync(outPath, dtsCode, 'utf-8');\n } catch (err: any) {\n console.error(`[bemedev-dts] Failed to process ${file}:`, err);\n }\n }\n\n if (errors.length > 0) {\n console.error(`[bemedev-dts] Generation completed with errors:`);\n for (const err of errors) {\n console.error(\n `Error in ${err.filename || 'unknown file'}: ${err.message}`,\n );\n if (err.codeframe) {\n console.error(err.codeframe);\n }\n }\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;AA0BA,MAAa,kBAAkB,EAC7B,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,MAElB,GAAG,oBAAoB;GAClD,OAAO;EACT;EACA,aAAa;GACX,OAAO;GACP,MAAM,UAAU;IACd,IAAI,MAAM;IACV,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAe,GAAG,eACtB,KACA,YACA,eACF;IAEA,MAAM,aAAa,aAAa,YAAY;IAC5C,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAC5C,MAAM,UAAU,WAAW,QAAQ,WAAW,KAAK,KAAK,KAAK;IAE7D,IAAI;IACJ,IAAI,WAAW,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,GAC3C,QAAQ,OAAO,OAAO,OAAO;SAE7B,QAAQ,SAAS,KAAK,SAAS,uBAAuB,GAAG,EACvD,QAAQ,QAAQ,OAAO,EACzB,CAAC;IAGH,QAAQ,MAAM,QACZ,SACE,CAAC,KAAK,SAAS,OAAO,KACtB,CAAC,KAAK,SAAS,QAAQ,KACvB,CAAC,KAAK,SAAS,QAAQ,CAC3B;IAEA,MAAM,SAAgB,CAAC;IAEvB,KAAK,MAAM,QAAQ,OACjB,IAAI;KAEF,MAAM,SAAS,cAAc,MADb,aAAa,MAAM,OACM,GAAG;MAC1C,WAAW,CAAC,CAAC;MACb,YAAY,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,eAAe,EAAE;KAC7D,CAAC;KAED,IAAI,OAAO,UAAU,OAAO,OAAO,SAAS,GAC1C,OAAO,KAAK,GAAG,OAAO,MAAM;KAI9B,MAAM,eAAe,SAAS,SAAS,IAAI;KAC3C,IAAI,UAAU;KACd,IAAI,aAAa,SAAS,MAAM,GAC9B,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;UACjC,IAAI,aAAa,SAAS,KAAK,GACpC,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;UACjC,IAAI,aAAa,SAAS,MAAM,GACrC,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;UACjC,IAAI,aAAa,SAAS,MAAM,GACrC,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;KAGxC,MAAM,UAAU,KAAK,QAAQ,OAAO;KACpC,MAAM,aAAa,UAAU;KAG7B,UAAU,QAAQ,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;KAE/C,IAAI,UAAU,OAAO,eAAe;KACpC,IAAI,kBAAkB,OAAO,gBAAgB;MAC3C,WAAW,0BAA0B,SAAS,OAAO,EAAE;MACvD,cACE,YACA,KAAK,UAAU,OAAO,cAAc,GACpC,OACF;KACF;KAEA,cAAc,SAAS,SAAS,OAAO;IACzC,SAAS,KAAU;KACjB,QAAQ,MAAM,mCAAmC,KAAK,IAAI,GAAG;IAC/D;IAGF,IAAI,OAAO,SAAS,GAAG;KACrB,QAAQ,MAAM,iDAAiD;KAC/D,KAAK,MAAM,OAAO,QAAQ;MACxB,QAAQ,MACN,YAAY,IAAI,YAAY,eAAe,IAAI,IAAI,SACrD;MACA,IAAI,IAAI,WACN,QAAQ,MAAM,IAAI,SAAS;KAE/B;IACF;IAEA,MAAM,qBAAqB;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
|
|
@@ -16,5 +16,6 @@ export type BuildInput_F = (...ignores: string[]) => Record<string, string>;
|
|
|
16
16
|
export type Config_F = {
|
|
17
17
|
(additionals?: Params): RolldownOptions;
|
|
18
18
|
bemedev: (additionals?: Params) => RolldownOptions;
|
|
19
|
+
fast: (additionals?: Omit<Params, 'plugins'>) => RolldownOptions;
|
|
19
20
|
default: (additionals?: Params) => RolldownOptions;
|
|
20
21
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_unknown.cjs","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be\n * modified. Any manual changes will be overwritten during the next\n * generation.\n *\n * @author chlbri (bri_lvi@icloud.com)\n * @generated\n * @readonly\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,YAAe,UAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_unknown.js","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be\n * modified. Any manual changes will be overwritten during the next\n * generation.\n *\n * @author chlbri (bri_lvi@icloud.com)\n * @generated\n * @readonly\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,YAAe,UAAoB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/utils/bemedev/globals/utils/expandFn.ts
|
|
3
|
+
const expandFn = (main, extensions) => {
|
|
4
|
+
const out = main;
|
|
5
|
+
if (extensions) Object.assign(out, extensions);
|
|
6
|
+
return out;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.expandFn = expandFn;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=expandFn.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expandFn.cjs","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from '../types';\n\nexport const expandFn = <\n Main extends Fn,\n const Tr extends object = object,\n>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n if (extensions) {\n Object.assign(out, extensions);\n }\n\n return out;\n};\n"],"mappings":";;AAEA,MAAa,YAIX,MACA,eACsB;CACtB,MAAM,MAAW;CAEjB,IAAI,YACF,OAAO,OAAO,KAAK,UAAU;CAG/B,OAAO;AACT"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/utils/bemedev/globals/utils/expandFn.ts
|
|
2
|
+
const expandFn = (main, extensions) => {
|
|
3
|
+
const out = main;
|
|
4
|
+
if (extensions) Object.assign(out, extensions);
|
|
5
|
+
return out;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { expandFn };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=expandFn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expandFn.js","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from '../types';\n\nexport const expandFn = <\n Main extends Fn,\n const Tr extends object = object,\n>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n if (extensions) {\n Object.assign(out, extensions);\n }\n\n return out;\n};\n"],"mappings":";AAEA,MAAa,YAIX,MACA,eACsB;CACtB,MAAM,MAAW;CAEjB,IAAI,YACF,OAAO,OAAO,KAAK,UAAU;CAG/B,OAAO;AACT"}
|
package/lib/utils/index.cjs
CHANGED
|
@@ -2,6 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_utils_sleep = require("./sleep.cjs");
|
|
3
3
|
const require_utils_identity = require("./identity.cjs");
|
|
4
4
|
const require_utils_array = require("./array.cjs");
|
|
5
|
+
const require_utils_bemedev_globals_utils__unknown = require("./bemedev/globals/utils/_unknown.cjs");
|
|
6
|
+
exports._unknown = require_utils_bemedev_globals_utils__unknown._unknown;
|
|
5
7
|
exports.identity = require_utils_identity.identity;
|
|
6
8
|
exports.sleep = require_utils_sleep.sleep;
|
|
7
9
|
exports.toArray = require_utils_array.toArray;
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { sleep } from "./sleep.js";
|
|
2
2
|
import { identity } from "./identity.js";
|
|
3
3
|
import { toArray } from "./array.js";
|
|
4
|
-
|
|
4
|
+
import { _unknown } from "./bemedev/globals/utils/_unknown.js";
|
|
5
|
+
export { _unknown, identity, sleep, toArray };
|
package/lib/utils/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './bemedev/globals/types';
|
|
2
2
|
export type ToArray_F = <T>(value?: T | T[]) => T[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptation.cjs","names":["isFunction"],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport type { Fn } from '
|
|
1
|
+
{"version":3,"file":"acceptation.cjs","names":["isFunction"],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport type { Fn } from '../utils/bemedev/globals/types';\nimport { isFunction } from './isFunction';\n\nexport const useTestFunctionAcceptation = (f: Fn, _name?: string) => {\n const name = _name ?? f.name;\n\n test(`#01 => ${name} is defined`, () => {\n expect(f).toBeDefined();\n });\n test(`#02 => ${name} is a function`, () => {\n const check = isFunction(f);\n expect(check).toBe(true);\n });\n};\n\n/** For test only useTestFunctionAcceptation */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":";;;;AAKA,MAAa,8BAA8B,GAAO,UAAmB;CACnE,MAAM,OAAO,SAAS,EAAE;CAExB,CAAA,GAAA,OAAA,KAAA,CAAK,UAAU,KAAK,oBAAoB;EACtC,CAAA,GAAA,OAAA,OAAA,CAAO,CAAC,CAAC,CAAC,YAAY;CACxB,CAAC;CACD,CAAA,GAAA,OAAA,KAAA,CAAK,UAAU,KAAK,uBAAuB;EAEzC,CAAA,GAAA,OAAA,OAAA,CADcA,mCAAAA,WAAW,CACd,CAAC,CAAC,CAAC,KAAK,IAAI;CACzB,CAAC;AACH;;AAGA,MAAa,SAAS"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fn } from '
|
|
1
|
+
import type { Fn } from '../utils/bemedev/globals/types';
|
|
2
2
|
export declare const useTestFunctionAcceptation: (f: Fn, _name?: string) => void;
|
|
3
3
|
/** For test only useTestFunctionAcceptation */
|
|
4
4
|
export declare const useTFA: (f: Fn, _name?: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptation.js","names":[],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport type { Fn } from '
|
|
1
|
+
{"version":3,"file":"acceptation.js","names":[],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport type { Fn } from '../utils/bemedev/globals/types';\nimport { isFunction } from './isFunction';\n\nexport const useTestFunctionAcceptation = (f: Fn, _name?: string) => {\n const name = _name ?? f.name;\n\n test(`#01 => ${name} is defined`, () => {\n expect(f).toBeDefined();\n });\n test(`#02 => ${name} is a function`, () => {\n const check = isFunction(f);\n expect(check).toBe(true);\n });\n};\n\n/** For test only useTestFunctionAcceptation */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":";;;AAKA,MAAa,8BAA8B,GAAO,UAAmB;CACnE,MAAM,OAAO,SAAS,EAAE;CAExB,KAAK,UAAU,KAAK,oBAAoB;EACtC,OAAO,CAAC,CAAC,CAAC,YAAY;CACxB,CAAC;CACD,KAAK,UAAU,KAAK,uBAAuB;EAEzC,OADc,WAAW,CACd,CAAC,CAAC,CAAC,KAAK,IAAI;CACzB,CAAC;AACH;;AAGA,MAAa,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTests.cjs","names":["useTFA","useErrorAsyncEach","toStringFlat","useEachAsync","vi"],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import { beforeAll, vi } from 'vitest';\n\nimport {
|
|
1
|
+
{"version":3,"file":"createTests.cjs","names":["useTFA","useErrorAsyncEach","toStringFlat","useEachAsync","vi"],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import { beforeAll, vi } from 'vitest';\n\nimport type { Fn } from '../utils/bemedev/globals/types';\nimport { useTFA } from './acceptation';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type { _CreateTests_F };\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(\n func,\n transform as any,\n toError,\n );\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 as any, 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 NB : We use strict-equality,\n * {@link useEach|see}\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 * @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 NB: If the first\n * argument is an array, wrap the value in another array,\n */\nexport const createTests = <F0 extends any[], F1, F2 = F1>(\n func: Fn<F0, F1>,\n args?: {\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <F0 extends any[], F1, F2 = F1>(\n f: Fn<NoInfer<F0>, NoInfer<F1>>,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<Fn<F0, F1>> | Fn<F0, F1>;\n name: string;\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\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":";;;;;;;AAeA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;CAClE,OAAO;EACL,mBAAmBA,oCAAAA,OAAO,MAAM,IAAI;EAEpC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;GAErB,aAAa;IAeX,OAdiBC,mCAAAA,kBACf,MACA,WACA,OAWY,CAAC,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;KAGjD,OAAO;MADO,QAAA,IADKC,qCAAAA,aAAa,QAAQ,GAAG,MAAM,EAAE,MAAM;MACnC;MAAY;KACzB;IACX,CAGsB,CAAC;GAC3B;EACF;EAEA,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;GACrB,aAAa;IAWX,OAViBC,kCAAAA,aAAa,MAAa,SAU7B,CAAC,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;KAG1D,OAAO;MADO,QAAA,IADKD,qCAAAA,aAAa,QAAQ,GAAG,MAAM,EAAE,MAAM;MACnC;MAAY;MAAU;KACnC;IACX,CAGsB,CAAC;GAC3B;EACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,eACX,MACA,SAIG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,CAAC;CACxC,OAAO,QAAQ,MAAM,WAAW,OAAO;AACzC;AAEA,YAAY,sBACV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAOE,OAAAA,GAAG,GAAG,CAAC;CAEpB,IAAI,eACF,CAAA,GAAA,OAAA,UAAA,CAAU,YAAY;EACpB,MAAM,OAAO,MAAM,cAAc;EACjC,KAAK,mBAAmB,IAAI;CAC9B,CAAC;CAGH,OAAO,QAAQ,MAAM,WAAW,SAAS,IAAI;AAC/C;AAEA,YAAY,wBAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTests.js","names":[],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import { beforeAll, vi } from 'vitest';\n\nimport {
|
|
1
|
+
{"version":3,"file":"createTests.js","names":[],"sources":["../../src/vitest-extended/createTests.ts"],"sourcesContent":["import { beforeAll, vi } from 'vitest';\n\nimport type { Fn } from '../utils/bemedev/globals/types';\nimport { useTFA } from './acceptation';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport {\n useEachAsync,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n type useEach,\n} from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type { _CreateTests_F };\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(\n func,\n transform as any,\n toError,\n );\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 as any, 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 NB : We use strict-equality,\n * {@link useEach|see}\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 * @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 NB: If the first\n * argument is an array, wrap the value in another array,\n */\nexport const createTests = <F0 extends any[], F1, F2 = F1>(\n func: Fn<F0, F1>,\n args?: {\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\n },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\ncreateTests.withImplementation = <F0 extends any[], F1, F2 = F1>(\n f: Fn<NoInfer<F0>, NoInfer<F1>>,\n {\n instanciation,\n name,\n transform,\n toError,\n }: {\n instanciation: () => Promise<Fn<F0, F1>> | Fn<F0, F1>;\n name: string;\n transform?: Fn<[Awaited<F1>], F2>;\n toError?: Fn<F0, string | undefined>;\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":";;;;;;AAeA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;CAClE,OAAO;EACL,mBAAmB,OAAO,MAAM,IAAI;EAEpC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;GAErB,aAAa;IAeX,OAdiB,kBACf,MACA,WACA,OAWY,CAAC,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,SAAS,UAAU;KAGjD,OAAO;MADO,QAAA,IADK,aAAa,QAAQ,GAAG,MAAM,EAAE,MAAM;MACnC;MAAY;KACzB;IACX,CAGsB,CAAC;GAC3B;EACF;EAEA,UAAU,GAAG,UAAU;GACrB,MAAM,SAAS,MAAM;GACrB,aAAa;IAWX,OAViB,aAAa,MAAa,SAU7B,CAAC,CAAC,GARI,MAAM,KACvB,EAAE,QAAQ,SAAS,YAAY,UAAU,QAAQ,UAAU;KAG1D,OAAO;MADO,QAAA,IADK,aAAa,QAAQ,GAAG,MAAM,EAAE,MAAM;MACnC;MAAY;MAAU;KACnC;IACX,CAGsB,CAAC;GAC3B;EACF;CACF;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,eACX,MACA,SAIG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,CAAC;CACxC,OAAO,QAAQ,MAAM,WAAW,OAAO;AACzC;AAEA,YAAY,sBACV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAO,GAAG,GAAG,CAAC;CAEpB,IAAI,eACF,UAAU,YAAY;EACpB,MAAM,OAAO,MAAM,cAAc;EACjC,KAAK,mBAAmB,IAAI;CAC9B,CAAC;CAGH,OAAO,QAAQ,MAAM,WAAW,SAAS,IAAI;AAC/C;AAEA,YAAY,wBAAwB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fn } from '
|
|
1
|
+
import type { Fn } from '../../utils/bemedev/globals/types';
|
|
2
2
|
import type { Identity, NextFn, TestErrors } from '../types';
|
|
3
3
|
export type ToError_F<F extends Fn> = (...params: Parameters<F>) => string | undefined;
|
|
4
4
|
export type _UseErrorEach_F = <F extends Fn, T extends NextFn<F> = Identity<F>>(f: F, transform?: T, toError?: ToError_F<F>, ...cases: TestErrors<F>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fn } from '
|
|
1
|
+
import type { Fn } from '../../utils/bemedev/globals/types';
|
|
2
2
|
import type { ChainedFn, Identity, NextFn, TestArgs } from '../types';
|
|
3
3
|
export type _UseEach_F = <F extends Fn, T extends NextFn<F> = Identity<F>>(f: F, transform?: T, ...cases: TestArgs<ChainedFn<F, T>>) => void;
|
|
4
4
|
export type UseEach_F = <F extends Fn, T extends NextFn<F> = Identity<F>>(f: F, transform?: T) => (...cases: TestArgs<ChainedFn<F, T>>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDefined.cjs","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from '
|
|
1
|
+
{"version":3,"file":"isDefined.cjs","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from '../utils/bemedev/globals/types';\nexport type { Undefiny };\n\nexport const isDefined = <T>(value?: Undefiny<T>): value is T => {\n return value !== undefined && value !== null;\n};\n"],"mappings":";;AAGA,MAAa,aAAgB,UAAoC;CAC/D,OAAO,UAAU,KAAA,KAAa,UAAU;AAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDefined.js","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from '
|
|
1
|
+
{"version":3,"file":"isDefined.js","names":[],"sources":["../../src/vitest-extended/isDefined.ts"],"sourcesContent":["import type { Undefiny } from '../utils/bemedev/globals/types';\nexport type { Undefiny };\n\nexport const isDefined = <T>(value?: Undefiny<T>): value is T => {\n return value !== undefined && value !== null;\n};\n"],"mappings":";AAGA,MAAa,aAAgB,UAAoC;CAC/D,OAAO,UAAU,KAAA,KAAa,UAAU;AAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toStringFlat.cjs","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from '
|
|
1
|
+
{"version":3,"file":"toStringFlat.cjs","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from '../utils/bemedev/globals/types';\n\nconst log10: Fn<[value: number], number> = (value: number) => {\n return Math.floor(Math.log10(value));\n};\n\nexport const toStringFlat: Fn<[value: number, len: number], string> = (\n _value,\n _len,\n) => {\n const logLength = log10(_len);\n const logValue = log10(_value);\n const length = logLength - logValue;\n\n let out = '';\n Array.from({ length }).forEach(() => {\n out += '0';\n });\n\n out += _value;\n\n return out;\n};\n"],"mappings":";;AAEA,MAAM,SAAsC,UAAkB;CAC5D,OAAO,KAAK,MAAM,KAAK,MAAM,KAAK,CAAC;AACrC;AAEA,MAAa,gBACX,QACA,SACG;CAGH,MAAM,SAFY,MAAM,IAED,IADN,MAAM,MACW;CAElC,IAAI,MAAM;CACV,MAAM,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,cAAc;EACnC,OAAO;CACT,CAAC;CAED,OAAO;CAEP,OAAO;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { type Fn } from '
|
|
1
|
+
import { type Fn } from '../utils/bemedev/globals/types';
|
|
2
2
|
export declare const toStringFlat: Fn<[value: number, len: number], string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toStringFlat.js","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from '
|
|
1
|
+
{"version":3,"file":"toStringFlat.js","names":[],"sources":["../../src/vitest-extended/toStringFlat.ts"],"sourcesContent":["import { type Fn } from '../utils/bemedev/globals/types';\n\nconst log10: Fn<[value: number], number> = (value: number) => {\n return Math.floor(Math.log10(value));\n};\n\nexport const toStringFlat: Fn<[value: number, len: number], string> = (\n _value,\n _len,\n) => {\n const logLength = log10(_len);\n const logValue = log10(_value);\n const length = logLength - logValue;\n\n let out = '';\n Array.from({ length }).forEach(() => {\n out += '0';\n });\n\n out += _value;\n\n return out;\n};\n"],"mappings":";AAEA,MAAM,SAAsC,UAAkB;CAC5D,OAAO,KAAK,MAAM,KAAK,MAAM,KAAK,CAAC;AACrC;AAEA,MAAa,gBACX,QACA,SACG;CAGH,MAAM,SAFY,MAAM,IAED,IADN,MAAM,MACW;CAElC,IAAI,MAAM;CACV,MAAM,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,cAAc;EACnC,OAAO;CACT,CAAC;CAED,OAAO;CAEP,OAAO;AACT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemedev/dev-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"cmd-ts": "^0.15.0",
|
|
91
91
|
"edit-json-file": "^1.8.1",
|
|
92
92
|
"glob": "^13.0.6",
|
|
93
|
-
"oxc-transform": "^0.
|
|
93
|
+
"oxc-transform": "^0.141.0",
|
|
94
94
|
"rollup-plugin-circular-dependencies": "^2.0.1",
|
|
95
95
|
"rollup-plugin-node-externals": "^9.0.1",
|
|
96
96
|
"shelljs": "^0.10.0",
|
|
@@ -105,14 +105,14 @@
|
|
|
105
105
|
"@types/node": "^26.1.1",
|
|
106
106
|
"@types/shelljs": "^0.10.0",
|
|
107
107
|
"@vitest/ui": "4.1.10",
|
|
108
|
-
"rolldown": "^1.
|
|
108
|
+
"rolldown": "^1.2.0",
|
|
109
109
|
"unplugin-dts": "^1.0.3",
|
|
110
110
|
"vitest": "4.1.10",
|
|
111
111
|
"zod": "^4.4.3",
|
|
112
112
|
"zx": "^8.8.5"
|
|
113
113
|
},
|
|
114
114
|
"peerDependencies": {
|
|
115
|
-
"rolldown": "^1.
|
|
115
|
+
"rolldown": "^1.2.0",
|
|
116
116
|
"vitest": "4.1.10"
|
|
117
117
|
},
|
|
118
118
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_unknown.cjs","names":[],"sources":["../../../../../src/vitest-extended/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be\n * modified. Any manual changes will be overwritten during the next\n * generation.\n *\n * @author chlbri (bri_lvi@icloud.com)\n * @generated\n * @readonly\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,YAAe,UAAoB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_unknown.js","names":[],"sources":["../../../../../src/vitest-extended/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be\n * modified. Any manual changes will be overwritten during the next\n * generation.\n *\n * @author chlbri (bri_lvi@icloud.com)\n * @generated\n * @readonly\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,YAAe,UAAoB"}
|
|
File without changes
|