@bemedev/dev-utils 1.5.2 → 1.5.4
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 +22 -0
- package/lib/build-tests/addTarball.cjs.map +1 -1
- package/lib/build-tests/buildPackageJson.cjs.map +1 -1
- package/lib/build-tests/cleanup.cjs.map +1 -1
- package/lib/build-tests/cli/cli.cjs.map +1 -1
- package/lib/build-tests/cli/test.cjs.map +1 -1
- package/lib/build-tests/imports/create.cjs.map +1 -1
- package/lib/build-tests/imports/helper.cjs.map +1 -1
- package/lib/build-tests/pack.cjs.map +1 -1
- package/lib/pack/config.cjs +10 -1
- package/lib/pack/config.cjs.map +1 -1
- package/lib/pack/config.js +10 -1
- package/lib/pack/config.js.map +1 -1
- package/lib/pack/plugins/circulars.cjs +0 -1
- package/lib/pack/plugins/circulars.cjs.map +1 -1
- package/lib/pack/plugins/circulars.js +0 -1
- package/lib/pack/plugins/circulars.js.map +1 -1
- package/lib/pack/plugins/index.cjs +5 -2
- package/lib/pack/plugins/index.cjs.map +1 -1
- package/lib/pack/plugins/index.d.ts +10 -0
- package/lib/pack/plugins/index.js +3 -1
- package/lib/pack/plugins/index.js.map +1 -1
- package/lib/pack/plugins/sourcemaps.cjs +34 -0
- package/lib/pack/plugins/sourcemaps.cjs.map +1 -0
- package/lib/pack/plugins/sourcemaps.d.ts +10 -0
- package/lib/pack/plugins/sourcemaps.js +31 -0
- package/lib/pack/plugins/sourcemaps.js.map +1 -0
- package/lib/rolldown-config/helpers.cjs.map +1 -1
- package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
- package/lib/rolldown-config/plugins/clean.js.map +1 -1
- package/lib/rolldown-config/plugins/index.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.fast.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.cjs.map +1 -1
- package/lib/vitest-extended/acceptation.cjs.map +1 -1
- package/lib/vitest-extended/createTests.cjs.map +1 -1
- package/lib/vitest-extended/createTests.d.ts +1 -2
- package/lib/vitest-extended/createTests.js.map +1 -1
- package/lib/vitest-extended/done.cjs.map +1 -1
- package/lib/vitest-extended/each/error.cjs.map +1 -1
- package/lib/vitest-extended/each/pass.cjs.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -246,6 +246,22 @@ const { acceptation, success } = createTests.withImplementation(myFn, {
|
|
|
246
246
|
| `transform` | `NextFn<F> \| undefined` | Optional return-value transformer |
|
|
247
247
|
| `toError` | `ToError_F<F> \| undefined` | Optional error deriver |
|
|
248
248
|
|
|
249
|
+
#### Typing wrappers
|
|
250
|
+
|
|
251
|
+
`createTests` and `createTests.withImplementation` return a `ReturnR<F>` object.
|
|
252
|
+
`ReturnR` is exported so you can annotate reusable wrappers explicitly, which keeps
|
|
253
|
+
declaration emit portable (avoids TS2883):
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
import type { ReturnR } from '@bemedev/dev-utils/vitest-extended';
|
|
257
|
+
|
|
258
|
+
export const createValibotTests: ReturnR<typeof validate> =
|
|
259
|
+
createTests.withImplementation(validate, {
|
|
260
|
+
name: 'valibot',
|
|
261
|
+
instanciation: async () => realValidate,
|
|
262
|
+
});
|
|
263
|
+
```
|
|
264
|
+
|
|
249
265
|
---
|
|
250
266
|
|
|
251
267
|
### `doneTest(invite, fn, options?)`
|
|
@@ -542,6 +558,12 @@ Produces a Vite+ Pack configuration with the default plugin pipeline:
|
|
|
542
558
|
|
|
543
559
|
1. **circulars** — suppresses warnings for known circular type files
|
|
544
560
|
2. **clean** — removes stale JS outputs for type-only entries
|
|
561
|
+
3. **sourcemaps** — composes chained source maps into a single map
|
|
562
|
+
|
|
563
|
+
The `sourcemaps` plugin runs after the bundle is written. When sourcemaps are
|
|
564
|
+
enabled, it uses `@ampproject/remapping` to compose the maps of the generated `.js`
|
|
565
|
+
files with the maps of their sources, flattening the chain into a single map. It is
|
|
566
|
+
also available through `DEFAULT_PLUGINS` for custom pipelines.
|
|
545
567
|
|
|
546
568
|
```typescript
|
|
547
569
|
import { defineConfig } from '@bemedev/dev-utils/pack';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addTarball.cjs","names":["pack","FILE_ORIGIN","THIS1","editJsonFile","PACKAGE_PATH","sortKeys","devKey"],"sources":["../../src/build-tests/addTarball.ts"],"sourcesContent":["import editJsonFile from 'edit-json-file';\nimport sh from 'shelljs';\nimport sortKeys from 'sort-keys';\n\nimport { devKey, FILE_ORIGIN, PACKAGE_PATH, THIS1 } from './constants';\nimport { pack } from './pack';\n\n/**\n * Builds and installs a local tarball package as a temporary dev dependency\n * for testing.\n *\n * Packs the current package through {@linkcode pack}, registers the resulting\n * tarball in `devDependencies` and re-sorts the dependency keys.\n *\n * @returns Promise resolving once the temporary dependency is installed.\n */\nexport const addTarball = async () => {\n // #region Install the tarball\n const _packed = await pack();\n const packed = `${FILE_ORIGIN}:${_packed}`;\n sh.exec(`pnpm add -D ${THIS1}@${packed}`);\n // #endregion\n\n const file = editJsonFile(PACKAGE_PATH);\n const devDeps = sortKeys(file.get(devKey));\n file.set(devKey, devDeps);\n file.save();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,aAAa,YAAY;CAEpC,MAAM,UAAU,MAAMA,yBAAAA,KAAK;CAC3B,MAAM,SAAS,GAAGC,8BAAAA,YAAY,GAAG;
|
|
1
|
+
{"version":3,"file":"addTarball.cjs","names":["pack","FILE_ORIGIN","sh","THIS1","editJsonFile","PACKAGE_PATH","sortKeys","devKey"],"sources":["../../src/build-tests/addTarball.ts"],"sourcesContent":["import editJsonFile from 'edit-json-file';\nimport sh from 'shelljs';\nimport sortKeys from 'sort-keys';\n\nimport { devKey, FILE_ORIGIN, PACKAGE_PATH, THIS1 } from './constants';\nimport { pack } from './pack';\n\n/**\n * Builds and installs a local tarball package as a temporary dev dependency\n * for testing.\n *\n * Packs the current package through {@linkcode pack}, registers the resulting\n * tarball in `devDependencies` and re-sorts the dependency keys.\n *\n * @returns Promise resolving once the temporary dependency is installed.\n */\nexport const addTarball = async () => {\n // #region Install the tarball\n const _packed = await pack();\n const packed = `${FILE_ORIGIN}:${_packed}`;\n sh.exec(`pnpm add -D ${THIS1}@${packed}`);\n // #endregion\n\n const file = editJsonFile(PACKAGE_PATH);\n const devDeps = sortKeys(file.get(devKey));\n file.set(devKey, devDeps);\n file.save();\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,aAAa,YAAY;CAEpC,MAAM,UAAU,MAAMA,yBAAAA,KAAK;CAC3B,MAAM,SAAS,GAAGC,8BAAAA,YAAY,GAAG;CACjCC,QAAAA,QAAG,KAAK,eAAeC,8BAAAA,MAAM,GAAG,QAAQ;CAGxC,MAAM,QAAA,GAAOC,eAAAA,QAAAA,CAAaC,8BAAAA,YAAY;CACtC,MAAM,WAAA,GAAUC,UAAAA,QAAAA,CAAS,KAAK,IAAIC,8BAAAA,MAAM,CAAC;CACzC,KAAK,IAAIA,8BAAAA,QAAQ,OAAO;CACxB,KAAK,KAAK;AACZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildPackageJson.cjs","names":["editJsonFile","getTypescriptOutdir","EXPORT_KEY","sortKeys"],"sources":["../../src/build-tests/buildPackageJson.ts"],"sourcesContent":["import editJsonFile from 'edit-json-file';\nimport sortKeys from 'sort-keys';\n\nimport type { Fn } from '#utils';\n\nimport { BIN_KEY, EXPORT_KEY, EXPORT_KEYS } from './constants';\nimport { getTypescriptOutdir } from './getTypescriptOutdir';\n\n/**\n * Function type building the distribution `package.json` and resolving the\n * TypeScript output directory.\n *\n * @see -- type {@linkcode Fn}\n */\ntype BuldPackageJson_F = Fn<[], { packageJson: object; outDir: string }>;\n\n/**\n * Transforms `package.json` for packed distribution by adjusting paths and\n * removing internal fields.\n *\n * Rewrites the {@linkcode EXPORT_KEYS} entries, the `exports` map and the\n * `bin` field so that they point to the packed output, then removes\n * `files`, `scripts` and `devDependencies`.\n *\n * @returns Object containing the modified `packageJson` and the `outDir`\n * resolved by {@linkcode getTypescriptOutdir}.\n */\nexport const buildPackageJson: BuldPackageJson_F = () => {\n const file = editJsonFile('./package.json');\n const outDir = getTypescriptOutdir();\n const lib = `${outDir}/`;\n const replaceLib = (str: string) => str.replace(lib, '');\n\n // #region Set export values\n EXPORT_KEYS.forEach(key => {\n const value = file.get(key);\n if (value) {\n const transformed = replaceLib(value);\n file.set(key, transformed);\n }\n });\n // #endregion\n\n // #region Set Export key\n const valueExports = file.get(EXPORT_KEY);\n\n if (valueExports) {\n const transformedExports = Object.entries(valueExports).reduce(\n (acc, [key, value]) => {\n const entries = Object.entries(value as any);\n const _value = entries.reduce((acc, [key, value]) => {\n acc[key] = replaceLib(value as any);\n return acc;\n }, {} as any);\n acc[key] = key.includes('package.json') ? value : _value;\n return acc;\n },\n {} as any,\n );\n\n file.set(EXPORT_KEY, transformedExports);\n }\n // #endregion\n\n // #region Set bin\n const bin1 = file.get(BIN_KEY) as Record<string, string> | undefined | string;\n\n if (bin1) {\n if (typeof bin1 === 'string') {\n const bin2 = replaceLib(bin1);\n file.set(BIN_KEY, bin2);\n } else {\n const bin2 = Object.entries(bin1).reduce((acc, [key, value]) => {\n acc[key] = replaceLib(value);\n return acc;\n }, {} as any);\n\n const bin3 = sortKeys(bin2);\n file.set(BIN_KEY, bin3);\n }\n }\n // #endregion\n\n // #region Unset some props\n file.unset('files');\n file.unset('scripts');\n file.unset('devDependencies');\n // #endregion\n\n const packageJson = file.get();\n return { packageJson, outDir };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,yBAA4C;CACvD,MAAM,QAAA,GAAOA,eAAAA,QAAAA,CAAa,gBAAgB;CAC1C,MAAM,SAASC,wCAAAA,oBAAoB;CACnC,MAAM,MAAM,GAAG,OAAO;CACtB,MAAM,cAAc,QAAgB,IAAI,QAAQ,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"buildPackageJson.cjs","names":["editJsonFile","getTypescriptOutdir","EXPORT_KEYS","EXPORT_KEY","sortKeys"],"sources":["../../src/build-tests/buildPackageJson.ts"],"sourcesContent":["import editJsonFile from 'edit-json-file';\nimport sortKeys from 'sort-keys';\n\nimport type { Fn } from '#utils';\n\nimport { BIN_KEY, EXPORT_KEY, EXPORT_KEYS } from './constants';\nimport { getTypescriptOutdir } from './getTypescriptOutdir';\n\n/**\n * Function type building the distribution `package.json` and resolving the\n * TypeScript output directory.\n *\n * @see -- type {@linkcode Fn}\n */\ntype BuldPackageJson_F = Fn<[], { packageJson: object; outDir: string }>;\n\n/**\n * Transforms `package.json` for packed distribution by adjusting paths and\n * removing internal fields.\n *\n * Rewrites the {@linkcode EXPORT_KEYS} entries, the `exports` map and the\n * `bin` field so that they point to the packed output, then removes\n * `files`, `scripts` and `devDependencies`.\n *\n * @returns Object containing the modified `packageJson` and the `outDir`\n * resolved by {@linkcode getTypescriptOutdir}.\n */\nexport const buildPackageJson: BuldPackageJson_F = () => {\n const file = editJsonFile('./package.json');\n const outDir = getTypescriptOutdir();\n const lib = `${outDir}/`;\n const replaceLib = (str: string) => str.replace(lib, '');\n\n // #region Set export values\n EXPORT_KEYS.forEach(key => {\n const value = file.get(key);\n if (value) {\n const transformed = replaceLib(value);\n file.set(key, transformed);\n }\n });\n // #endregion\n\n // #region Set Export key\n const valueExports = file.get(EXPORT_KEY);\n\n if (valueExports) {\n const transformedExports = Object.entries(valueExports).reduce(\n (acc, [key, value]) => {\n const entries = Object.entries(value as any);\n const _value = entries.reduce((acc, [key, value]) => {\n acc[key] = replaceLib(value as any);\n return acc;\n }, {} as any);\n acc[key] = key.includes('package.json') ? value : _value;\n return acc;\n },\n {} as any,\n );\n\n file.set(EXPORT_KEY, transformedExports);\n }\n // #endregion\n\n // #region Set bin\n const bin1 = file.get(BIN_KEY) as Record<string, string> | undefined | string;\n\n if (bin1) {\n if (typeof bin1 === 'string') {\n const bin2 = replaceLib(bin1);\n file.set(BIN_KEY, bin2);\n } else {\n const bin2 = Object.entries(bin1).reduce((acc, [key, value]) => {\n acc[key] = replaceLib(value);\n return acc;\n }, {} as any);\n\n const bin3 = sortKeys(bin2);\n file.set(BIN_KEY, bin3);\n }\n }\n // #endregion\n\n // #region Unset some props\n file.unset('files');\n file.unset('scripts');\n file.unset('devDependencies');\n // #endregion\n\n const packageJson = file.get();\n return { packageJson, outDir };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,yBAA4C;CACvD,MAAM,QAAA,GAAOA,eAAAA,QAAAA,CAAa,gBAAgB;CAC1C,MAAM,SAASC,wCAAAA,oBAAoB;CACnC,MAAM,MAAM,GAAG,OAAO;CACtB,MAAM,cAAc,QAAgB,IAAI,QAAQ,KAAK,EAAE;CAGvDC,8BAAAA,YAAY,SAAQ,QAAO;EACzB,MAAM,QAAQ,KAAK,IAAI,GAAG;EAC1B,IAAI,OAAO;GACT,MAAM,cAAc,WAAW,KAAK;GACpC,KAAK,IAAI,KAAK,WAAW;EAC3B;CACF,CAAC;CAID,MAAM,eAAe,KAAK,IAAIC,8BAAAA,UAAU;CAExC,IAAI,cAAc;EAChB,MAAM,qBAAqB,OAAO,QAAQ,YAAY,CAAC,CAAC,QACrD,KAAK,CAAC,KAAK,WAAW;GAErB,MAAM,SADU,OAAO,QAAQ,KACV,CAAC,CAAC,QAAQ,KAAK,CAAC,KAAK,WAAW;IACnD,IAAI,OAAO,WAAW,KAAY;IAClC,OAAO;GACT,GAAG,CAAC,CAAQ;GACZ,IAAI,OAAO,IAAI,SAAS,cAAc,IAAI,QAAQ;GAClD,OAAO;EACT,GACA,CAAC,CACH;EAEA,KAAK,IAAIA,8BAAAA,YAAY,kBAAkB;CACzC;CAIA,MAAM,OAAO,KAAK,IAAA,KAAW;CAE7B,IAAI,MAAM;EACR,IAAI,OAAO,SAAS,UAAU;GAC5B,MAAM,OAAO,WAAW,IAAI;GAC5B,KAAK,IAAA,OAAa,IAAI;EACxB,OAAO;GACL,MAAM,OAAO,OAAO,QAAQ,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,KAAK,WAAW;IAC9D,IAAI,OAAO,WAAW,KAAK;IAC3B,OAAO;GACT,GAAG,CAAC,CAAQ;GAEZ,MAAM,QAAA,GAAOC,UAAAA,QAAAA,CAAS,IAAI;GAC1B,KAAK,IAAA,OAAa,IAAI;EACxB;CACF;CAIA,KAAK,MAAM,OAAO;CAClB,KAAK,MAAM,SAAS;CACpB,KAAK,MAAM,iBAAiB;CAI5B,OAAO;EAAE,aADW,KAAK,IACN;EAAG;CAAO;AAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup.cjs","names":["TEARDOWN_COMMAND"],"sources":["../../src/build-tests/cleanup.ts"],"sourcesContent":["import sh from 'shelljs';\n\nimport { TEARDOWN_COMMAND } from './constants';\n\n/**\n * Removes the temporary packed directory and uninstalls temporary\n * dependencies declared through {@linkcode TEARDOWN_COMMAND}.\n *\n * @returns Nothing.\n */\nexport const cleanup = () => {\n sh.rm('-Rf', '.pack');\n sh.exec(TEARDOWN_COMMAND);\n console.log('Cleanup done');\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,gBAAgB;
|
|
1
|
+
{"version":3,"file":"cleanup.cjs","names":["sh","TEARDOWN_COMMAND"],"sources":["../../src/build-tests/cleanup.ts"],"sourcesContent":["import sh from 'shelljs';\n\nimport { TEARDOWN_COMMAND } from './constants';\n\n/**\n * Removes the temporary packed directory and uninstalls temporary\n * dependencies declared through {@linkcode TEARDOWN_COMMAND}.\n *\n * @returns Nothing.\n */\nexport const cleanup = () => {\n sh.rm('-Rf', '.pack');\n sh.exec(TEARDOWN_COMMAND);\n console.log('Cleanup done');\n};\n"],"mappings":";;;;;;;;;;;;AAUA,MAAa,gBAAgB;CAC3BA,QAAAA,QAAG,GAAG,OAAO,OAAO;CACpBA,QAAAA,QAAG,KAAKC,8BAAAA,gBAAgB;CACxB,QAAQ,IAAI,cAAc;AAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","names":["subcommands"],"sources":["../../../src/build-tests/cli/cli.ts"],"sourcesContent":["import { subcommands } from 'cmd-ts';\n\nimport { posttest } from './post';\nimport { pretest } from './pre';\nimport { test } from './test';\n\n/**\n * Binary command name for build tests.\n */\nexport const BIN = 'build-tests';\n\n/**\n * CLI definition for package building and test execution.\n *\n * Combines the {@linkcode posttest}, {@linkcode pretest} and\n * {@linkcode test} subcommands under the {@linkcode BIN} binary name.\n */\nexport const cli = subcommands({\n name: BIN,\n cmds: { posttest, pretest, test },\n description: 'Use it to build your package and testing the results',\n version: '0.1.0',\n});\n"],"mappings":";;;;;;;;;AASA,MAAa,MAAM;;;;;;;AAQnB,MAAa,OAAA,GAAMA,OAAAA,YAAAA,CAAY;CAC7B,MAAM;CACN,MAAM;
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["subcommands","posttest","pretest","test"],"sources":["../../../src/build-tests/cli/cli.ts"],"sourcesContent":["import { subcommands } from 'cmd-ts';\n\nimport { posttest } from './post';\nimport { pretest } from './pre';\nimport { test } from './test';\n\n/**\n * Binary command name for build tests.\n */\nexport const BIN = 'build-tests';\n\n/**\n * CLI definition for package building and test execution.\n *\n * Combines the {@linkcode posttest}, {@linkcode pretest} and\n * {@linkcode test} subcommands under the {@linkcode BIN} binary name.\n */\nexport const cli = subcommands({\n name: BIN,\n cmds: { posttest, pretest, test },\n description: 'Use it to build your package and testing the results',\n version: '0.1.0',\n});\n"],"mappings":";;;;;;;;;AASA,MAAa,MAAM;;;;;;;AAQnB,MAAa,OAAA,GAAMA,OAAAA,YAAAA,CAAY;CAC7B,MAAM;CACN,MAAM;EAAEC,UAAAA,6BAAAA;EAAUC,SAAAA,4BAAAA;EAASC,MAAAA,6BAAAA;CAAK;CAChC,aAAa;CACb,SAAS;AACX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.cjs","names":["command","flag","addTarball","sh"],"sources":["../../../src/build-tests/cli/test.ts"],"sourcesContent":["import { command, flag } from 'cmd-ts';\nimport sh from 'shelljs';\n\nimport { addTarball } from '../addTarball';\nimport { cleanup } from '../cleanup';\n\n/**\n * CLI command to execute tests with optional lifecycle hooks (pre/post).\n *\n * The hooks delegate to {@linkcode addTarball} for preparation and\n * {@linkcode cleanup} for teardown.\n */\nexport const test = command({\n name: 'test',\n\n args: {\n pretest: flag({ description: 'The hook pretest', short: 'b', long: 'pretest' }),\n\n posttest: flag({\n description: 'The hook posttest',\n short: 'a',\n long: 'posttest',\n }),\n\n pre: flag({ description: 'The hook pretest', long: 'pre' }),\n\n post: flag({ description: 'The hook posttest', long: 'post' }),\n },\n\n // Ignores coverage because of recursivity\n /* v8 ignore next 11 */\n handler: async ({ pretest, posttest, pre, post }) => {\n if (pretest || pre) await addTarball();\n\n // #region Test\n const { stderr } = sh.exec('pnpm run test');\n if (!!stderr && stderr.trim() !== '') console.warn(stderr);\n // #endregion\n\n if (posttest || post) cleanup();\n },\n});\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,QAAA,GAAOA,OAAAA,QAAAA,CAAQ;CAC1B,MAAM;CAEN,MAAM;EACJ,UAAA,GAASC,OAAAA,KAAAA,CAAK;GAAE,aAAa;GAAoB,OAAO;GAAK,MAAM;EAAU,CAAC;EAE9E,WAAA,GAAUA,OAAAA,KAAAA,CAAK;GACb,aAAa;GACb,OAAO;GACP,MAAM;EACR,CAAC;EAED,MAAA,GAAKA,OAAAA,KAAAA,CAAK;GAAE,aAAa;GAAoB,MAAM;EAAM,CAAC;EAE1D,OAAA,GAAMA,OAAAA,KAAAA,CAAK;GAAE,aAAa;GAAqB,MAAM;EAAO,CAAC;CAC/D;;CAIA,SAAS,OAAO,EAAE,SAAS,UAAU,KAAK,WAAW;EACnD,IAAI,WAAW,KAAK,MAAMC,+BAAAA,WAAW;EAGrC,MAAM,EAAE,WAAWC,QAAAA,QAAG,KAAK,eAAe;EAC1C,IAAI,CAAC,CAAC,UAAU,OAAO,KAAK,MAAM,IAAI,QAAQ,KAAK,MAAM;EAGzD,IAAI,YAAY,
|
|
1
|
+
{"version":3,"file":"test.cjs","names":["command","flag","addTarball","sh","cleanup"],"sources":["../../../src/build-tests/cli/test.ts"],"sourcesContent":["import { command, flag } from 'cmd-ts';\nimport sh from 'shelljs';\n\nimport { addTarball } from '../addTarball';\nimport { cleanup } from '../cleanup';\n\n/**\n * CLI command to execute tests with optional lifecycle hooks (pre/post).\n *\n * The hooks delegate to {@linkcode addTarball} for preparation and\n * {@linkcode cleanup} for teardown.\n */\nexport const test = command({\n name: 'test',\n\n args: {\n pretest: flag({ description: 'The hook pretest', short: 'b', long: 'pretest' }),\n\n posttest: flag({\n description: 'The hook posttest',\n short: 'a',\n long: 'posttest',\n }),\n\n pre: flag({ description: 'The hook pretest', long: 'pre' }),\n\n post: flag({ description: 'The hook posttest', long: 'post' }),\n },\n\n // Ignores coverage because of recursivity\n /* v8 ignore next 11 */\n handler: async ({ pretest, posttest, pre, post }) => {\n if (pretest || pre) await addTarball();\n\n // #region Test\n const { stderr } = sh.exec('pnpm run test');\n if (!!stderr && stderr.trim() !== '') console.warn(stderr);\n // #endregion\n\n if (posttest || post) cleanup();\n },\n});\n"],"mappings":";;;;;;;;;;;;;;AAYA,MAAa,QAAA,GAAOA,OAAAA,QAAAA,CAAQ;CAC1B,MAAM;CAEN,MAAM;EACJ,UAAA,GAASC,OAAAA,KAAAA,CAAK;GAAE,aAAa;GAAoB,OAAO;GAAK,MAAM;EAAU,CAAC;EAE9E,WAAA,GAAUA,OAAAA,KAAAA,CAAK;GACb,aAAa;GACb,OAAO;GACP,MAAM;EACR,CAAC;EAED,MAAA,GAAKA,OAAAA,KAAAA,CAAK;GAAE,aAAa;GAAoB,MAAM;EAAM,CAAC;EAE1D,OAAA,GAAMA,OAAAA,KAAAA,CAAK;GAAE,aAAa;GAAqB,MAAM;EAAO,CAAC;CAC/D;;CAIA,SAAS,OAAO,EAAE,SAAS,UAAU,KAAK,WAAW;EACnD,IAAI,WAAW,KAAK,MAAMC,+BAAAA,WAAW;EAGrC,MAAM,EAAE,WAAWC,QAAAA,QAAG,KAAK,eAAe;EAC1C,IAAI,CAAC,CAAC,UAAU,OAAO,KAAK,MAAM,IAAI,QAAQ,KAAK,MAAM;EAGzD,IAAI,YAAY,MAAMC,4BAAAA,QAAQ;CAChC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.cjs","names":["helperFn","toStringFlat"],"sources":["../../../src/build-tests/imports/create.ts"],"sourcesContent":["import { describe, test } from 'vitest';\n\nimport { toStringFlat } from '../../vitest-extended/toStringFlat';\nimport { helperFn } from './helper';\n\n/**\n * Options defining expected exported and non-exported symbols.\n */\nexport type ImportArgs = { path?: string; FAILS?: string[]; SUCCESS: string[] };\n\n/**\n * Function type creating import test suites.\n */\nexport type CreateImportTest_F = (args: ImportArgs) => readonly [string, () => void];\n\n/**\n * Creates Vitest test suites verifying that symbols are properly exported from a module.\n *\n * @param args - Import test arguments of type {@linkcode ImportArgs}.\n *\n * @returns Tuple of test description and test runner function.\n */\nexport const createImportFnTests: CreateImportTest_F = args => {\n const path = args.path;\n const invite = `Importing from ${path ?? 'index'}`;\n const testFn = (fn: string) => helperFn({ path, fn });\n\n const fn = () => {\n describe.skipIf(args.SUCCESS.length < 1)(\n '#01 => Functions are inside the module',\n () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.SUCCESS.length);\n };\n\n args.SUCCESS.forEach((fn, index) => {\n test(`#${_index(index)} => should succeed with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n },\n );\n\n if (!args.FAILS || args.FAILS.length < 1) return;\n\n describe('#02 => Functions are not inside the module', () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.FAILS!.length);\n };\n\n args.FAILS!.forEach((fn, index) => {\n test.fails(`#${_index(index)} => should fail with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n });\n };\n\n return [invite, fn] as const;\n};\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAa,uBAA0C,SAAQ;CAC7D,MAAM,OAAO,KAAK;CAClB,MAAM,SAAS,kBAAkB,QAAQ;CACzC,MAAM,UAAU,OAAeA,mCAAAA,SAAS;EAAE;EAAM;CAAG,CAAC;CAEpD,MAAM,WAAW;
|
|
1
|
+
{"version":3,"file":"create.cjs","names":["helperFn","describe","toStringFlat","test"],"sources":["../../../src/build-tests/imports/create.ts"],"sourcesContent":["import { describe, test } from 'vitest';\n\nimport { toStringFlat } from '../../vitest-extended/toStringFlat';\nimport { helperFn } from './helper';\n\n/**\n * Options defining expected exported and non-exported symbols.\n */\nexport type ImportArgs = { path?: string; FAILS?: string[]; SUCCESS: string[] };\n\n/**\n * Function type creating import test suites.\n */\nexport type CreateImportTest_F = (args: ImportArgs) => readonly [string, () => void];\n\n/**\n * Creates Vitest test suites verifying that symbols are properly exported from a module.\n *\n * @param args - Import test arguments of type {@linkcode ImportArgs}.\n *\n * @returns Tuple of test description and test runner function.\n */\nexport const createImportFnTests: CreateImportTest_F = args => {\n const path = args.path;\n const invite = `Importing from ${path ?? 'index'}`;\n const testFn = (fn: string) => helperFn({ path, fn });\n\n const fn = () => {\n describe.skipIf(args.SUCCESS.length < 1)(\n '#01 => Functions are inside the module',\n () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.SUCCESS.length);\n };\n\n args.SUCCESS.forEach((fn, index) => {\n test(`#${_index(index)} => should succeed with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n },\n );\n\n if (!args.FAILS || args.FAILS.length < 1) return;\n\n describe('#02 => Functions are not inside the module', () => {\n const _index = (index: number) => {\n return toStringFlat(index + 1, args.FAILS!.length);\n };\n\n args.FAILS!.forEach((fn, index) => {\n test.fails(`#${_index(index)} => should fail with function ${fn}`, () => {\n return testFn(fn);\n });\n });\n });\n };\n\n return [invite, fn] as const;\n};\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAa,uBAA0C,SAAQ;CAC7D,MAAM,OAAO,KAAK;CAClB,MAAM,SAAS,kBAAkB,QAAQ;CACzC,MAAM,UAAU,OAAeA,mCAAAA,SAAS;EAAE;EAAM;CAAG,CAAC;CAEpD,MAAM,WAAW;EACfC,OAAAA,SAAS,OAAO,KAAK,QAAQ,SAAS,CAAC,CAAC,CACtC,gDACM;GACJ,MAAM,UAAU,UAAkB;IAChC,OAAOC,qCAAAA,aAAa,QAAQ,GAAG,KAAK,QAAQ,MAAM;GACpD;GAEA,KAAK,QAAQ,SAAS,IAAI,UAAU;IAClCC,CAAAA,GAAAA,OAAAA,KAAAA,CAAK,IAAI,OAAO,KAAK,EAAE,mCAAmC,YAAY;KACpE,OAAO,OAAO,EAAE;IAClB,CAAC;GACH,CAAC;EACH,CACF;EAEA,IAAI,CAAC,KAAK,SAAS,KAAK,MAAM,SAAS,GAAG;EAE1CF,CAAAA,GAAAA,OAAAA,SAAAA,CAAS,oDAAoD;GAC3D,MAAM,UAAU,UAAkB;IAChC,OAAOC,qCAAAA,aAAa,QAAQ,GAAG,KAAK,MAAO,MAAM;GACnD;GAEA,KAAK,MAAO,SAAS,IAAI,UAAU;IACjCC,OAAAA,KAAK,MAAM,IAAI,OAAO,KAAK,EAAE,gCAAgC,YAAY;KACvE,OAAO,OAAO,EAAE;IAClB,CAAC;GACH,CAAC;EACH,CAAC;CACH;CAEA,OAAO,CAAC,QAAQ,EAAE;AACpB"}
|
|
@@ -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 '../../utils/bemedev/globals/types';\nimport { customImport } from '../import';\n\n/**\n * Helper function type for verifying exported functions.\n */\nexport type Helper_F = (args: { path?: string; fn: string }) => Promise<void>;\n\n/**\n * Asserts that a specified function is defined and exported from a module.\n *\n * @template | {@linkcode Fn} `T` - Expected function type.\n *\n * @param args - Options object.\n * @param args.path - Submodule path to import from.\n * @param args.fn - Named export function name.\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":";;;;;;;;;;;;;AAmBA,MAAa,WAAW,OAA0B,EAChD,MACA,SAII;CACJ,MAAM,MAAM,MAAMA,2BAAAA,aAAgB;EAAE;EAAM,KAAI,MAAK,EAAE;CAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"helper.cjs","names":["customImport","expect"],"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\n/**\n * Helper function type for verifying exported functions.\n */\nexport type Helper_F = (args: { path?: string; fn: string }) => Promise<void>;\n\n/**\n * Asserts that a specified function is defined and exported from a module.\n *\n * @template | {@linkcode Fn} `T` - Expected function type.\n *\n * @param args - Options object.\n * @param args.path - Submodule path to import from.\n * @param args.fn - Named export function name.\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":";;;;;;;;;;;;;AAmBA,MAAa,WAAW,OAA0B,EAChD,MACA,SAII;CACJ,MAAM,MAAM,MAAMA,2BAAAA,aAAgB;EAAE;EAAM,KAAI,MAAK,EAAE;CAAI,CAAC;CAC1DC,CAAAA,GAAAA,OAAAA,OAAAA,CAAO,GAAG,CAAC,CAAC,YAAY;CACxBA,CAAAA,GAAAA,OAAAA,OAAAA,CAAO,GAAG,CAAC,CAAC,WAAW,UAAU;AACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.cjs","names":["buildPackageJson","join","PACKAGE_PATH","writeFile","TARBALL_FOLDER","sh","getRelativePath0"],"sources":["../../src/build-tests/pack.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport sh from 'shelljs';\n\nimport type { Fn } from '#utils/types';\n\nimport { buildPackageJson } from './buildPackageJson';\nimport { DOT, PACKAGE_PATH, TARBALL_FOLDER } from './constants';\nimport { getRelativePath0 } from './getRelativePath';\n\ntype Pack_F = Fn<[], Promise<string>>;\n\n/**\n * Creates distribution package.json and generates a packed `.tgz` tarball using `pnpm pack`.\n *\n * @returns Promise resolving to the relative path of the created tarball.\n */\nexport const pack: Pack_F = async () => {\n const { packageJson, outDir } = buildPackageJson();\n\n const fileToWrite = `${DOT}${join(outDir, PACKAGE_PATH)}`;\n\n await writeFile(fileToWrite, JSON.stringify(packageJson, null, 2));\n const folderTocreate = `${DOT}${TARBALL_FOLDER}`;\n sh.rm('-Rf', [folderTocreate]);\n sh.mkdir(folderTocreate);\n\n sh.cd(`${DOT}${outDir}`);\n\n const out1 = sh\n .exec(`pnpm pack --pack-destination ../${TARBALL_FOLDER}`)\n .toString();\n\n sh.cd('..');\n const out2 = getRelativePath0(out1);\n return out2;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,OAAe,YAAY;CACtC,MAAM,EAAE,aAAa,WAAWA,qCAAAA,iBAAiB;CAEjD,MAAM,cAAc,MAAA,GAASC,KAAAA,KAAAA,CAAK,QAAQC,8BAAAA,YAAY;CAEtD,OAAA,GAAMC,YAAAA,UAAAA,CAAU,aAAa,KAAK,UAAU,aAAa,MAAM,CAAC,CAAC;CACjE,MAAM,iBAAiB,KAASC,8BAAAA;
|
|
1
|
+
{"version":3,"file":"pack.cjs","names":["buildPackageJson","join","PACKAGE_PATH","writeFile","TARBALL_FOLDER","sh","getRelativePath0"],"sources":["../../src/build-tests/pack.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nimport sh from 'shelljs';\n\nimport type { Fn } from '#utils/types';\n\nimport { buildPackageJson } from './buildPackageJson';\nimport { DOT, PACKAGE_PATH, TARBALL_FOLDER } from './constants';\nimport { getRelativePath0 } from './getRelativePath';\n\ntype Pack_F = Fn<[], Promise<string>>;\n\n/**\n * Creates distribution package.json and generates a packed `.tgz` tarball using `pnpm pack`.\n *\n * @returns Promise resolving to the relative path of the created tarball.\n */\nexport const pack: Pack_F = async () => {\n const { packageJson, outDir } = buildPackageJson();\n\n const fileToWrite = `${DOT}${join(outDir, PACKAGE_PATH)}`;\n\n await writeFile(fileToWrite, JSON.stringify(packageJson, null, 2));\n const folderTocreate = `${DOT}${TARBALL_FOLDER}`;\n sh.rm('-Rf', [folderTocreate]);\n sh.mkdir(folderTocreate);\n\n sh.cd(`${DOT}${outDir}`);\n\n const out1 = sh\n .exec(`pnpm pack --pack-destination ../${TARBALL_FOLDER}`)\n .toString();\n\n sh.cd('..');\n const out2 = getRelativePath0(out1);\n return out2;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,OAAe,YAAY;CACtC,MAAM,EAAE,aAAa,WAAWA,qCAAAA,iBAAiB;CAEjD,MAAM,cAAc,MAAA,GAASC,KAAAA,KAAAA,CAAK,QAAQC,8BAAAA,YAAY;CAEtD,OAAA,GAAMC,YAAAA,UAAAA,CAAU,aAAa,KAAK,UAAU,aAAa,MAAM,CAAC,CAAC;CACjE,MAAM,iBAAiB,KAASC,8BAAAA;CAChCC,QAAAA,QAAG,GAAG,OAAO,CAAC,cAAc,CAAC;CAC7BA,QAAAA,QAAG,MAAM,cAAc;CAEvBA,QAAAA,QAAG,GAAG,KAAS,QAAQ;CAEvB,MAAM,OAAOA,QAAAA,QACV,KAAK,mCAAmCD,8BAAAA,gBAAgB,CAAC,CACzD,SAAS;CAEZC,QAAAA,QAAG,GAAG,IAAI;CAEV,OADaC,oCAAAA,iBAAiB,IACpB;AACZ"}
|
package/lib/pack/config.cjs
CHANGED
|
@@ -35,12 +35,21 @@ const producePlugins = ({ circularDeps, plugins, ignoresJS, sourcemap, dir } = {
|
|
|
35
35
|
ignoresJS,
|
|
36
36
|
sourcemap,
|
|
37
37
|
dir
|
|
38
|
+
}),
|
|
39
|
+
sourcemaps: () => require_pack_plugins_index.DEFAULT_PLUGINS.sourcemaps({
|
|
40
|
+
dir,
|
|
41
|
+
sourcemap
|
|
38
42
|
})
|
|
39
43
|
};
|
|
44
|
+
const ORDERED = [
|
|
45
|
+
unordered.circulars(),
|
|
46
|
+
unordered.clean(),
|
|
47
|
+
unordered.sourcemaps()
|
|
48
|
+
];
|
|
40
49
|
return plugins ? plugins.map((p) => {
|
|
41
50
|
if (typeof p === "string") return unordered[p]();
|
|
42
51
|
return p;
|
|
43
|
-
}).filter((p) => !!p) :
|
|
52
|
+
}).filter((p) => !!p) : ORDERED;
|
|
44
53
|
};
|
|
45
54
|
defineConfig.default = ({ dir, sourcemap: _sourcemap = false, excludesTS, ignoresJS, externals, dts, circularDeps, plugins: _plugins, ...rest } = {}) => {
|
|
46
55
|
const config = require_rolldown_config_plugins_typescript_config.getConfig(process.cwd());
|
package/lib/pack/config.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","names":["DEFAULT_PLUGINS","getConfig","buildEntry","toArray","buildOutput","DEFAULT_CIRCULAR_DEPS","DEFAULT_EXCLUDE"],"sources":["../../src/pack/config.ts"],"sourcesContent":["import { toArray } from '#utils';\n\nimport { getConfig } from '../rolldown-config/plugins/typescript.config';\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildEntry } from './input';\nimport { buildOutput } from './output';\nimport { DEFAULT_PLUGINS } from './plugins';\nimport type { Config_F, DtsOptions, Params } from './types';\n\n/**\n * Generates a Vite+ Pack configuration using default or customized options.\n *\n * The returned object is meant to be used as the `pack` field of a Vite+\n * configuration:\n *\n * @example\n * ```ts\n * import { defineConfig } from '@bemedev/dev-utils/pack';\n * import { defineConfig as defineViteConfig } from 'vite-plus';\n *\n * export default defineViteConfig({\n * pack: defineConfig.bemedev(),\n * });\n * ```\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n plugins,\n ignoresJS,\n sourcemap,\n dir,\n}: Params = {}) => {\n const unordered = {\n circulars: () => DEFAULT_PLUGINS.circulars({ exclude: circularDeps }),\n clean: () => DEFAULT_PLUGINS.clean({ ignoresJS, sourcemap, dir }),\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 :
|
|
1
|
+
{"version":3,"file":"config.cjs","names":["DEFAULT_PLUGINS","getConfig","buildEntry","toArray","buildOutput","DEFAULT_CIRCULAR_DEPS","DEFAULT_EXCLUDE"],"sources":["../../src/pack/config.ts"],"sourcesContent":["import { toArray } from '#utils';\n\nimport { getConfig } from '../rolldown-config/plugins/typescript.config';\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildEntry } from './input';\nimport { buildOutput } from './output';\nimport { DEFAULT_PLUGINS } from './plugins';\nimport type { Config_F, DtsOptions, Params } from './types';\n\n/**\n * Generates a Vite+ Pack configuration using default or customized options.\n *\n * The returned object is meant to be used as the `pack` field of a Vite+\n * configuration:\n *\n * @example\n * ```ts\n * import { defineConfig } from '@bemedev/dev-utils/pack';\n * import { defineConfig as defineViteConfig } from 'vite-plus';\n *\n * export default defineViteConfig({\n * pack: defineConfig.bemedev(),\n * });\n * ```\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n plugins,\n ignoresJS,\n sourcemap,\n dir,\n}: Params = {}) => {\n const unordered = {\n circulars: () => DEFAULT_PLUGINS.circulars({ exclude: circularDeps }),\n clean: () => DEFAULT_PLUGINS.clean({ ignoresJS, sourcemap, dir }),\n sourcemaps: () => DEFAULT_PLUGINS.sourcemaps({ dir, sourcemap }),\n };\n\n const ORDERED = [unordered.circulars(), unordered.clean(), unordered.sourcemaps()];\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 : ORDERED;\n};\n\ndefineConfig.default = ({\n dir,\n sourcemap: _sourcemap = false,\n excludesTS,\n ignoresJS,\n externals,\n dts,\n circularDeps,\n plugins: _plugins,\n ...rest\n} = {}) => {\n const config = getConfig(process.cwd());\n const entry = buildEntry(...toArray(excludesTS));\n const declarationMap = !_sourcemap ? config.options.declarationMap : _sourcemap;\n const sourcemap = !_sourcemap ? config.options.sourceMap : _sourcemap;\n const output = buildOutput(config.options.outDir ?? dir, sourcemap);\n const neverBundle = toArray(externals);\n\n const _defaultDts: DtsOptions = { generator: 'tsc', sourcemap: declarationMap };\n\n const __dts: DtsOptions = !dts\n ? config.options.declaration === true\n ? _defaultDts\n : false\n : dts === true\n ? _defaultDts\n : typeof dts === 'string'\n ? dts\n : { ...dts, sourcemap: declarationMap };\n\n const plugins = producePlugins({\n circularDeps,\n plugins: _plugins,\n ignoresJS,\n sourcemap,\n dir,\n });\n\n return {\n ...rest,\n ...output,\n entry,\n platform: 'node',\n dts: __dts,\n deps: { ...rest.deps, neverBundle },\n plugins,\n };\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({ ...rest, dts: { generator: 'oxc', eager: true } });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n\n const excludesTS = DEFAULT_EXCLUDE.concat(toArray(additionals?.excludesTS));\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 sourcemap,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,gBAAyB,gBAAe;CACnD,OAAO,aAAa,QAAQ,WAAW;AACzC;AAEA,MAAM,kBAAkB,EACtB,cACA,SACA,WACA,WACA,QACU,CAAC,MAAM;CACjB,MAAM,YAAY;EAChB,iBAAiBA,2BAAAA,gBAAgB,UAAU,EAAE,SAAS,aAAa,CAAC;EACpE,aAAaA,2BAAAA,gBAAgB,MAAM;GAAE;GAAW;GAAW;EAAI,CAAC;EAChE,kBAAkBA,2BAAAA,gBAAgB,WAAW;GAAE;GAAK;EAAU,CAAC;CACjE;CAEA,MAAM,UAAU;EAAC,UAAU,UAAU;EAAG,UAAU,MAAM;EAAG,UAAU,WAAW;CAAC;CAEjF,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;AACN;AAEA,aAAa,WAAW,EACtB,KACA,WAAW,aAAa,OACxB,YACA,WACA,WACA,KACA,cACA,SAAS,UACT,GAAG,SACD,CAAC,MAAM;CACT,MAAM,SAASC,kDAAAA,UAAU,QAAQ,IAAI,CAAC;CACtC,MAAM,QAAQC,mBAAAA,WAAW,GAAGC,oBAAAA,QAAQ,UAAU,CAAC;CAC/C,MAAM,iBAAiB,CAAC,aAAa,OAAO,QAAQ,iBAAiB;CACrE,MAAM,YAAY,CAAC,aAAa,OAAO,QAAQ,YAAY;CAC3D,MAAM,SAASC,oBAAAA,YAAY,OAAO,QAAQ,UAAU,KAAK,SAAS;CAClE,MAAM,cAAcD,oBAAAA,QAAQ,SAAS;CAErC,MAAM,cAA0B;EAAE,WAAW;EAAO,WAAW;CAAe;CAE9E,MAAM,QAAoB,CAAC,MACvB,OAAO,QAAQ,gBAAgB,OAC7B,cACA,QACF,QAAQ,OACN,cACA,OAAO,QAAQ,WACb,MACA;EAAE,GAAG;EAAK,WAAW;CAAe;CAE5C,MAAM,UAAU,eAAe;EAC7B;EACA,SAAS;EACT;EACA;EACA;CACF,CAAC;CAED,OAAO;EACL,GAAG;EACH,GAAG;EACH;EACA,UAAU;EACV,KAAK;EACL,MAAM;GAAE,GAAG,KAAK;GAAM;EAAY;EAClC;CACF;AACF;AAEA,aAAa,QAAO,SAAQ;CAC1B,OAAO,aAAa,QAAQ;EAAE,GAAG;EAAM,KAAK;GAAE,WAAW;GAAO,OAAO;EAAK;CAAE,CAAC;AACjF;AAEA,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAeE,uBAAAA,sBAAsB,OACzCF,oBAAAA,QAAQ,aAAa,YAAY,CACnC;CAEA,MAAM,aAAaG,uBAAAA,gBAAgB,OAAOH,oBAAAA,QAAQ,aAAa,UAAU,CAAC;CAC1E,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;CACF,CAAC;AACH"}
|
package/lib/pack/config.js
CHANGED
|
@@ -34,12 +34,21 @@ const producePlugins = ({ circularDeps, plugins, ignoresJS, sourcemap, dir } = {
|
|
|
34
34
|
ignoresJS,
|
|
35
35
|
sourcemap,
|
|
36
36
|
dir
|
|
37
|
+
}),
|
|
38
|
+
sourcemaps: () => DEFAULT_PLUGINS.sourcemaps({
|
|
39
|
+
dir,
|
|
40
|
+
sourcemap
|
|
37
41
|
})
|
|
38
42
|
};
|
|
43
|
+
const ORDERED = [
|
|
44
|
+
unordered.circulars(),
|
|
45
|
+
unordered.clean(),
|
|
46
|
+
unordered.sourcemaps()
|
|
47
|
+
];
|
|
39
48
|
return plugins ? plugins.map((p) => {
|
|
40
49
|
if (typeof p === "string") return unordered[p]();
|
|
41
50
|
return p;
|
|
42
|
-
}).filter((p) => !!p) :
|
|
51
|
+
}).filter((p) => !!p) : ORDERED;
|
|
43
52
|
};
|
|
44
53
|
defineConfig.default = ({ dir, sourcemap: _sourcemap = false, excludesTS, ignoresJS, externals, dts, circularDeps, plugins: _plugins, ...rest } = {}) => {
|
|
45
54
|
const config = getConfig(process.cwd());
|
package/lib/pack/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":[],"sources":["../../src/pack/config.ts"],"sourcesContent":["import { toArray } from '#utils';\n\nimport { getConfig } from '../rolldown-config/plugins/typescript.config';\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildEntry } from './input';\nimport { buildOutput } from './output';\nimport { DEFAULT_PLUGINS } from './plugins';\nimport type { Config_F, DtsOptions, Params } from './types';\n\n/**\n * Generates a Vite+ Pack configuration using default or customized options.\n *\n * The returned object is meant to be used as the `pack` field of a Vite+\n * configuration:\n *\n * @example\n * ```ts\n * import { defineConfig } from '@bemedev/dev-utils/pack';\n * import { defineConfig as defineViteConfig } from 'vite-plus';\n *\n * export default defineViteConfig({\n * pack: defineConfig.bemedev(),\n * });\n * ```\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n plugins,\n ignoresJS,\n sourcemap,\n dir,\n}: Params = {}) => {\n const unordered = {\n circulars: () => DEFAULT_PLUGINS.circulars({ exclude: circularDeps }),\n clean: () => DEFAULT_PLUGINS.clean({ ignoresJS, sourcemap, dir }),\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 :
|
|
1
|
+
{"version":3,"file":"config.js","names":[],"sources":["../../src/pack/config.ts"],"sourcesContent":["import { toArray } from '#utils';\n\nimport { getConfig } from '../rolldown-config/plugins/typescript.config';\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildEntry } from './input';\nimport { buildOutput } from './output';\nimport { DEFAULT_PLUGINS } from './plugins';\nimport type { Config_F, DtsOptions, Params } from './types';\n\n/**\n * Generates a Vite+ Pack configuration using default or customized options.\n *\n * The returned object is meant to be used as the `pack` field of a Vite+\n * configuration:\n *\n * @example\n * ```ts\n * import { defineConfig } from '@bemedev/dev-utils/pack';\n * import { defineConfig as defineViteConfig } from 'vite-plus';\n *\n * export default defineViteConfig({\n * pack: defineConfig.bemedev(),\n * });\n * ```\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n plugins,\n ignoresJS,\n sourcemap,\n dir,\n}: Params = {}) => {\n const unordered = {\n circulars: () => DEFAULT_PLUGINS.circulars({ exclude: circularDeps }),\n clean: () => DEFAULT_PLUGINS.clean({ ignoresJS, sourcemap, dir }),\n sourcemaps: () => DEFAULT_PLUGINS.sourcemaps({ dir, sourcemap }),\n };\n\n const ORDERED = [unordered.circulars(), unordered.clean(), unordered.sourcemaps()];\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 : ORDERED;\n};\n\ndefineConfig.default = ({\n dir,\n sourcemap: _sourcemap = false,\n excludesTS,\n ignoresJS,\n externals,\n dts,\n circularDeps,\n plugins: _plugins,\n ...rest\n} = {}) => {\n const config = getConfig(process.cwd());\n const entry = buildEntry(...toArray(excludesTS));\n const declarationMap = !_sourcemap ? config.options.declarationMap : _sourcemap;\n const sourcemap = !_sourcemap ? config.options.sourceMap : _sourcemap;\n const output = buildOutput(config.options.outDir ?? dir, sourcemap);\n const neverBundle = toArray(externals);\n\n const _defaultDts: DtsOptions = { generator: 'tsc', sourcemap: declarationMap };\n\n const __dts: DtsOptions = !dts\n ? config.options.declaration === true\n ? _defaultDts\n : false\n : dts === true\n ? _defaultDts\n : typeof dts === 'string'\n ? dts\n : { ...dts, sourcemap: declarationMap };\n\n const plugins = producePlugins({\n circularDeps,\n plugins: _plugins,\n ignoresJS,\n sourcemap,\n dir,\n });\n\n return {\n ...rest,\n ...output,\n entry,\n platform: 'node',\n dts: __dts,\n deps: { ...rest.deps, neverBundle },\n plugins,\n };\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({ ...rest, dts: { generator: 'oxc', eager: true } });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n\n const excludesTS = DEFAULT_EXCLUDE.concat(toArray(additionals?.excludesTS));\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 sourcemap,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,gBAAyB,gBAAe;CACnD,OAAO,aAAa,QAAQ,WAAW;AACzC;AAEA,MAAM,kBAAkB,EACtB,cACA,SACA,WACA,WACA,QACU,CAAC,MAAM;CACjB,MAAM,YAAY;EAChB,iBAAiB,gBAAgB,UAAU,EAAE,SAAS,aAAa,CAAC;EACpE,aAAa,gBAAgB,MAAM;GAAE;GAAW;GAAW;EAAI,CAAC;EAChE,kBAAkB,gBAAgB,WAAW;GAAE;GAAK;EAAU,CAAC;CACjE;CAEA,MAAM,UAAU;EAAC,UAAU,UAAU;EAAG,UAAU,MAAM;EAAG,UAAU,WAAW;CAAC;CAEjF,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;AACN;AAEA,aAAa,WAAW,EACtB,KACA,WAAW,aAAa,OACxB,YACA,WACA,WACA,KACA,cACA,SAAS,UACT,GAAG,SACD,CAAC,MAAM;CACT,MAAM,SAAS,UAAU,QAAQ,IAAI,CAAC;CACtC,MAAM,QAAQ,WAAW,GAAG,QAAQ,UAAU,CAAC;CAC/C,MAAM,iBAAiB,CAAC,aAAa,OAAO,QAAQ,iBAAiB;CACrE,MAAM,YAAY,CAAC,aAAa,OAAO,QAAQ,YAAY;CAC3D,MAAM,SAAS,YAAY,OAAO,QAAQ,UAAU,KAAK,SAAS;CAClE,MAAM,cAAc,QAAQ,SAAS;CAErC,MAAM,cAA0B;EAAE,WAAW;EAAO,WAAW;CAAe;CAE9E,MAAM,QAAoB,CAAC,MACvB,OAAO,QAAQ,gBAAgB,OAC7B,cACA,QACF,QAAQ,OACN,cACA,OAAO,QAAQ,WACb,MACA;EAAE,GAAG;EAAK,WAAW;CAAe;CAE5C,MAAM,UAAU,eAAe;EAC7B;EACA,SAAS;EACT;EACA;EACA;CACF,CAAC;CAED,OAAO;EACL,GAAG;EACH,GAAG;EACH;EACA,UAAU;EACV,KAAK;EACL,MAAM;GAAE,GAAG,KAAK;GAAM;EAAY;EAClC;CACF;AACF;AAEA,aAAa,QAAO,SAAQ;CAC1B,OAAO,aAAa,QAAQ;EAAE,GAAG;EAAM,KAAK;GAAE,WAAW;GAAO,OAAO;EAAK;CAAE,CAAC;AACjF;AAEA,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAe,sBAAsB,OACzC,QAAQ,aAAa,YAAY,CACnC;CAEA,MAAM,aAAa,gBAAgB,OAAO,QAAQ,aAAa,UAAU,CAAC;CAC1E,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;CACF,CAAC;AACH"}
|
|
@@ -5,7 +5,6 @@ const require_pack_constants = require("../constants.cjs");
|
|
|
5
5
|
let path = require("path");
|
|
6
6
|
let glob = require("glob");
|
|
7
7
|
let rollup_plugin_circular_dependencies = require("rollup-plugin-circular-dependencies");
|
|
8
|
-
require("vite-plus/pack");
|
|
9
8
|
// src/pack/plugins/circulars.ts
|
|
10
9
|
/**
|
|
11
10
|
* Creates a configured circular dependencies plugin instance with suppression
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circulars.cjs","names":["circularDependencies","toArray","globSync","withoutExtension","relative","WARNING_CODES"],"sources":["../../../src/pack/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport type { TsdownPluginOption } from 'vite-plus/pack';\
|
|
1
|
+
{"version":3,"file":"circulars.cjs","names":["circularDependencies","toArray","globSync","withoutExtension","relative","WARNING_CODES"],"sources":["../../../src/pack/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport type { TsdownPluginOption } from 'vite-plus/pack';\n\nimport { toArray, type SoA } from '#utils';\n\nimport { withoutExtension } from '../../rolldown-config/helpers';\nimport { WARNING_CODES } from '../constants';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Omit<\n Parameters<typeof circularDependencies>[0],\n 'exclude'\n> & { exclude?: SoA<string> };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression\n * for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode TsdownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): TsdownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .filter(Boolean)\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[bemedev] Skipping circular dependency warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2BA,SAAgB,UACd,UAAuC,CAAC,GACpB;CACpB,MAAM,OAAA,GAAMA,oCAAAA,qBAAAA,CAAqB,OAAO;CAGxC,MAAM,kBAFUC,oBAAAA,QAAQ,QAAQ,OAEF,CAAC,CAC5B,OAAO,OAAO,CAAC,CACf,KAAI,OAAA,GAAKC,KAAAA,SAAAA,CAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAQC,KAAAA,SAAAA,CAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAASC,uBAAAA,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,sDAAsD;IAClE,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
|
|
@@ -4,7 +4,6 @@ import { WARNING_CODES } from "../constants.js";
|
|
|
4
4
|
import { relative } from "path";
|
|
5
5
|
import { globSync } from "glob";
|
|
6
6
|
import { circularDependencies } from "rollup-plugin-circular-dependencies";
|
|
7
|
-
import "vite-plus/pack";
|
|
8
7
|
// src/pack/plugins/circulars.ts
|
|
9
8
|
/**
|
|
10
9
|
* Creates a configured circular dependencies plugin instance with suppression
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circulars.js","names":[],"sources":["../../../src/pack/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport type { TsdownPluginOption } from 'vite-plus/pack';\
|
|
1
|
+
{"version":3,"file":"circulars.js","names":[],"sources":["../../../src/pack/plugins/circulars.ts"],"sourcesContent":["import { relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport type { TsdownPluginOption } from 'vite-plus/pack';\n\nimport { toArray, type SoA } from '#utils';\n\nimport { withoutExtension } from '../../rolldown-config/helpers';\nimport { WARNING_CODES } from '../constants';\n\n/**\n * Options for the circular dependencies plugin.\n */\nexport type CircularDependenciesOptions = Omit<\n Parameters<typeof circularDependencies>[0],\n 'exclude'\n> & { exclude?: SoA<string> };\n\n/**\n * Creates a configured circular dependencies plugin instance with suppression\n * for known patterns.\n *\n * @param options - Configuration options of type {@linkcode CircularDependenciesOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode TsdownPluginOption}.\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): TsdownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\n .filter(Boolean)\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n return {\n ...all,\n name: 'better circular-dependencies',\n onLog: {\n handler: (_, { code, names }) => {\n if (\n code === WARNING_CODES.CIRCULAR_DEPENDENCY &&\n names?.every(name => CIRCULAR_CHUNKS.includes(name))\n ) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[bemedev] Skipping circular dependency warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n console.log();\n return false;\n }\n\n return;\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AA2BA,SAAgB,UACd,UAAuC,CAAC,GACpB;CACpB,MAAM,MAAM,qBAAqB,OAAO;CAGxC,MAAM,kBAFU,QAAQ,QAAQ,OAEF,CAAC,CAC5B,OAAO,OAAO,CAAC,CACf,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAAS,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,sDAAsD;IAClE,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_config_plugins_clean = require("../../rolldown-config/plugins/clean.cjs");
|
|
3
|
+
const require_pack_plugins_circulars = require("./circulars.cjs");
|
|
4
|
+
const require_pack_plugins_sourcemaps = require("./sourcemaps.cjs");
|
|
3
5
|
// src/pack/plugins/index.ts
|
|
4
6
|
/**
|
|
5
7
|
* Registry mapping plugin keys to their factory functions.
|
|
@@ -9,8 +11,9 @@ const require_rolldown_config_plugins_clean = require("../../rolldown-config/plu
|
|
|
9
11
|
* circular dependencies plugin is exposed here.
|
|
10
12
|
*/
|
|
11
13
|
const DEFAULT_PLUGINS = {
|
|
12
|
-
circulars:
|
|
13
|
-
clean: require_rolldown_config_plugins_clean.clean
|
|
14
|
+
circulars: require_pack_plugins_circulars.circulars,
|
|
15
|
+
clean: require_rolldown_config_plugins_clean.clean,
|
|
16
|
+
sourcemaps: require_pack_plugins_sourcemaps.sourcemaps
|
|
14
17
|
};
|
|
15
18
|
/**
|
|
16
19
|
* Default ordering sequence for Vite+ Pack plugins.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/pack/plugins/index.ts"],"sourcesContent":["import { clean } from '../../rolldown-config/plugins/clean';\nimport { circulars } from './circulars';\n\n/**\n * Registry mapping plugin keys to their factory functions.\n *\n * Vite+ Pack natively handles declaration generation (`dts`), output\n * cleaning (`clean`) and dependency externals (`external`), so only the\n * circular dependencies plugin is exposed here.\n */\nexport const DEFAULT_PLUGINS = { circulars, clean } as const;\n\n/**\n * Default ordering sequence for Vite+ Pack plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n DEFAULT_PLUGINS,\n) as (keyof typeof DEFAULT_PLUGINS)[];\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["circulars","clean","sourcemaps"],"sources":["../../../src/pack/plugins/index.ts"],"sourcesContent":["import { clean } from '../../rolldown-config/plugins/clean';\nimport { circulars } from './circulars';\nimport { sourcemaps } from './sourcemaps';\n\n/**\n * Registry mapping plugin keys to their factory functions.\n *\n * Vite+ Pack natively handles declaration generation (`dts`), output\n * cleaning (`clean`) and dependency externals (`external`), so only the\n * circular dependencies plugin is exposed here.\n */\nexport const DEFAULT_PLUGINS = { circulars, clean, sourcemaps } as const;\n\n/**\n * Default ordering sequence for Vite+ Pack plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n DEFAULT_PLUGINS,\n) as (keyof typeof DEFAULT_PLUGINS)[];\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,kBAAkB;CAAEA,WAAAA,+BAAAA;CAAWC,OAAAA,sCAAAA;CAAOC,YAAAA,gCAAAA;AAAW;;;;AAK9D,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
|
|
@@ -18,6 +18,16 @@ export declare const DEFAULT_PLUGINS: {
|
|
|
18
18
|
handler: () => void;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
+
readonly sourcemaps: ({ dir, sourcemap }?: {
|
|
22
|
+
dir?: string | undefined;
|
|
23
|
+
sourcemap?: boolean | undefined;
|
|
24
|
+
}) => {
|
|
25
|
+
name: string;
|
|
26
|
+
closeBundle: {
|
|
27
|
+
order: "post";
|
|
28
|
+
handler: () => void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
21
31
|
};
|
|
22
32
|
/**
|
|
23
33
|
* Default ordering sequence for Vite+ Pack plugins.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { clean } from "../../rolldown-config/plugins/clean.js";
|
|
2
2
|
import { circulars } from "./circulars.js";
|
|
3
|
+
import { sourcemaps } from "./sourcemaps.js";
|
|
3
4
|
// src/pack/plugins/index.ts
|
|
4
5
|
/**
|
|
5
6
|
* Registry mapping plugin keys to their factory functions.
|
|
@@ -10,7 +11,8 @@ import { circulars } from "./circulars.js";
|
|
|
10
11
|
*/
|
|
11
12
|
const DEFAULT_PLUGINS = {
|
|
12
13
|
circulars,
|
|
13
|
-
clean
|
|
14
|
+
clean,
|
|
15
|
+
sourcemaps
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
18
|
* Default ordering sequence for Vite+ Pack plugins.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/pack/plugins/index.ts"],"sourcesContent":["import { clean } from '../../rolldown-config/plugins/clean';\nimport { circulars } from './circulars';\n\n/**\n * Registry mapping plugin keys to their factory functions.\n *\n * Vite+ Pack natively handles declaration generation (`dts`), output\n * cleaning (`clean`) and dependency externals (`external`), so only the\n * circular dependencies plugin is exposed here.\n */\nexport const DEFAULT_PLUGINS = { circulars, clean } as const;\n\n/**\n * Default ordering sequence for Vite+ Pack plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n DEFAULT_PLUGINS,\n) as (keyof typeof DEFAULT_PLUGINS)[];\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/pack/plugins/index.ts"],"sourcesContent":["import { clean } from '../../rolldown-config/plugins/clean';\nimport { circulars } from './circulars';\nimport { sourcemaps } from './sourcemaps';\n\n/**\n * Registry mapping plugin keys to their factory functions.\n *\n * Vite+ Pack natively handles declaration generation (`dts`), output\n * cleaning (`clean`) and dependency externals (`external`), so only the\n * circular dependencies plugin is exposed here.\n */\nexport const DEFAULT_PLUGINS = { circulars, clean, sourcemaps } as const;\n\n/**\n * Default ordering sequence for Vite+ Pack plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n DEFAULT_PLUGINS,\n) as (keyof typeof DEFAULT_PLUGINS)[];\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,kBAAkB;CAAE;CAAW;CAAO;AAAW;;;;AAK9D,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let fs = require("fs");
|
|
4
|
+
let path = require("path");
|
|
5
|
+
let glob = require("glob");
|
|
6
|
+
let _ampproject_remapping = require("@ampproject/remapping");
|
|
7
|
+
_ampproject_remapping = require_runtime.__toESM(_ampproject_remapping, 1);
|
|
8
|
+
// src/pack/plugins/sourcemaps.ts
|
|
9
|
+
const JS = /\.(c|m)?js$/;
|
|
10
|
+
const sourcemaps = ({ dir = "lib", sourcemap = true } = {}) => ({
|
|
11
|
+
name: "bemedev-chain-sourcemaps",
|
|
12
|
+
closeBundle: {
|
|
13
|
+
order: "post",
|
|
14
|
+
handler: () => {
|
|
15
|
+
if (!sourcemap) return;
|
|
16
|
+
const outDir = (0, path.resolve)(process.cwd(), dir);
|
|
17
|
+
for (const mapFile of (0, glob.globSync)(`${outDir}/**/*.map`, { nodir: true })) {
|
|
18
|
+
const base = (0, path.dirname)(mapFile);
|
|
19
|
+
const input = JSON.parse((0, fs.readFileSync)(mapFile, "utf8"));
|
|
20
|
+
if (!(input.sources ?? []).some((s) => JS.test(s))) continue;
|
|
21
|
+
const composed = (0, _ampproject_remapping.default)(input, (source) => {
|
|
22
|
+
if (!JS.test(source)) return null;
|
|
23
|
+
const file = `${(0, path.resolve)(base, source)}.map`;
|
|
24
|
+
return (0, fs.existsSync)(file) ? JSON.parse((0, fs.readFileSync)(file, "utf8")) : null;
|
|
25
|
+
});
|
|
26
|
+
composed.sources = composed.sources.filter((s) => s !== null).map((s) => s.startsWith("/") ? (0, path.relative)(base, s) : s);
|
|
27
|
+
(0, fs.writeFileSync)(mapFile, JSON.stringify(composed));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
exports.sourcemaps = sourcemaps;
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=sourcemaps.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourcemaps.cjs","names":["resolve","globSync","dirname","readFileSync","remapping","existsSync","relative","writeFileSync"],"sources":["../../../src/pack/plugins/sourcemaps.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { dirname, relative, resolve } from 'path';\n\nimport remapping from '@ampproject/remapping';\nimport { globSync } from 'glob';\n\nconst JS = /\\.(c|m)?js$/;\n\nexport const sourcemaps = ({ dir = 'lib', sourcemap = true } = {}) => ({\n name: 'bemedev-chain-sourcemaps',\n closeBundle: {\n order: 'post' as const,\n handler: () => {\n if (!sourcemap) return;\n const outDir = resolve(process.cwd(), dir);\n\n for (const mapFile of globSync(`${outDir}/**/*.map`, { nodir: true })) {\n const base = dirname(mapFile);\n const input = JSON.parse(readFileSync(mapFile, 'utf8'));\n const sources: string[] = input.sources ?? [];\n if (!sources.some(s => JS.test(s))) continue;\n\n const composed = remapping(input, source => {\n if (!JS.test(source)) return null;\n const file = `${resolve(base, source)}.map`;\n return existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : null;\n });\n\n composed.sources = composed.sources\n .filter(s => s !== null)\n .map(s => (s.startsWith('/') ? relative(base, s) : s));\n\n writeFileSync(mapFile, JSON.stringify(composed));\n }\n },\n },\n});\n"],"mappings":";;;;;;;;AAMA,MAAM,KAAK;AAEX,MAAa,cAAc,EAAE,MAAM,OAAO,YAAY,SAAS,CAAC,OAAO;CACrE,MAAM;CACN,aAAa;EACX,OAAO;EACP,eAAe;GACb,IAAI,CAAC,WAAW;GAChB,MAAM,UAAA,GAASA,KAAAA,QAAAA,CAAQ,QAAQ,IAAI,GAAG,GAAG;GAEzC,KAAK,MAAM,YAAA,GAAWC,KAAAA,SAAAA,CAAS,GAAG,OAAO,YAAY,EAAE,OAAO,KAAK,CAAC,GAAG;IACrE,MAAM,QAAA,GAAOC,KAAAA,QAAAA,CAAQ,OAAO;IAC5B,MAAM,QAAQ,KAAK,OAAA,GAAMC,GAAAA,aAAAA,CAAa,SAAS,MAAM,CAAC;IAEtD,IAAI,EADsB,MAAM,WAAW,CAAC,EAAA,CAC/B,MAAK,MAAK,GAAG,KAAK,CAAC,CAAC,GAAG;IAEpC,MAAM,YAAA,GAAWC,sBAAAA,QAAAA,CAAU,QAAO,WAAU;KAC1C,IAAI,CAAC,GAAG,KAAK,MAAM,GAAG,OAAO;KAC7B,MAAM,OAAO,IAAA,GAAGJ,KAAAA,QAAAA,CAAQ,MAAM,MAAM,EAAE;KACtC,QAAA,GAAOK,GAAAA,WAAAA,CAAW,IAAI,IAAI,KAAK,OAAA,GAAMF,GAAAA,aAAAA,CAAa,MAAM,MAAM,CAAC,IAAI;IACrE,CAAC;IAED,SAAS,UAAU,SAAS,QACzB,QAAO,MAAK,MAAM,IAAI,CAAC,CACvB,KAAI,MAAM,EAAE,WAAW,GAAG,KAAA,GAAIG,KAAAA,SAAAA,CAAS,MAAM,CAAC,IAAI,CAAE;IAEvDC,CAAAA,GAAAA,GAAAA,cAAAA,CAAc,SAAS,KAAK,UAAU,QAAQ,CAAC;GACjD;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
2
|
+
import { dirname, relative, resolve } from "path";
|
|
3
|
+
import { globSync } from "glob";
|
|
4
|
+
import remapping from "@ampproject/remapping";
|
|
5
|
+
// src/pack/plugins/sourcemaps.ts
|
|
6
|
+
const JS = /\.(c|m)?js$/;
|
|
7
|
+
const sourcemaps = ({ dir = "lib", sourcemap = true } = {}) => ({
|
|
8
|
+
name: "bemedev-chain-sourcemaps",
|
|
9
|
+
closeBundle: {
|
|
10
|
+
order: "post",
|
|
11
|
+
handler: () => {
|
|
12
|
+
if (!sourcemap) return;
|
|
13
|
+
const outDir = resolve(process.cwd(), dir);
|
|
14
|
+
for (const mapFile of globSync(`${outDir}/**/*.map`, { nodir: true })) {
|
|
15
|
+
const base = dirname(mapFile);
|
|
16
|
+
const input = JSON.parse(readFileSync(mapFile, "utf8"));
|
|
17
|
+
if (!(input.sources ?? []).some((s) => JS.test(s))) continue;
|
|
18
|
+
const composed = remapping(input, (source) => {
|
|
19
|
+
if (!JS.test(source)) return null;
|
|
20
|
+
const file = `${resolve(base, source)}.map`;
|
|
21
|
+
return existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : null;
|
|
22
|
+
});
|
|
23
|
+
composed.sources = composed.sources.filter((s) => s !== null).map((s) => s.startsWith("/") ? relative(base, s) : s);
|
|
24
|
+
writeFileSync(mapFile, JSON.stringify(composed));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export { sourcemaps };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=sourcemaps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sourcemaps.js","names":[],"sources":["../../../src/pack/plugins/sourcemaps.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { dirname, relative, resolve } from 'path';\n\nimport remapping from '@ampproject/remapping';\nimport { globSync } from 'glob';\n\nconst JS = /\\.(c|m)?js$/;\n\nexport const sourcemaps = ({ dir = 'lib', sourcemap = true } = {}) => ({\n name: 'bemedev-chain-sourcemaps',\n closeBundle: {\n order: 'post' as const,\n handler: () => {\n if (!sourcemap) return;\n const outDir = resolve(process.cwd(), dir);\n\n for (const mapFile of globSync(`${outDir}/**/*.map`, { nodir: true })) {\n const base = dirname(mapFile);\n const input = JSON.parse(readFileSync(mapFile, 'utf8'));\n const sources: string[] = input.sources ?? [];\n if (!sources.some(s => JS.test(s))) continue;\n\n const composed = remapping(input, source => {\n if (!JS.test(source)) return null;\n const file = `${resolve(base, source)}.map`;\n return existsSync(file) ? JSON.parse(readFileSync(file, 'utf8')) : null;\n });\n\n composed.sources = composed.sources\n .filter(s => s !== null)\n .map(s => (s.startsWith('/') ? relative(base, s) : s));\n\n writeFileSync(mapFile, JSON.stringify(composed));\n }\n },\n },\n});\n"],"mappings":";;;;;AAMA,MAAM,KAAK;AAEX,MAAa,cAAc,EAAE,MAAM,OAAO,YAAY,SAAS,CAAC,OAAO;CACrE,MAAM;CACN,aAAa;EACX,OAAO;EACP,eAAe;GACb,IAAI,CAAC,WAAW;GAChB,MAAM,SAAS,QAAQ,QAAQ,IAAI,GAAG,GAAG;GAEzC,KAAK,MAAM,WAAW,SAAS,GAAG,OAAO,YAAY,EAAE,OAAO,KAAK,CAAC,GAAG;IACrE,MAAM,OAAO,QAAQ,OAAO;IAC5B,MAAM,QAAQ,KAAK,MAAM,aAAa,SAAS,MAAM,CAAC;IAEtD,IAAI,EADsB,MAAM,WAAW,CAAC,EAAA,CAC/B,MAAK,MAAK,GAAG,KAAK,CAAC,CAAC,GAAG;IAEpC,MAAM,WAAW,UAAU,QAAO,WAAU;KAC1C,IAAI,CAAC,GAAG,KAAK,MAAM,GAAG,OAAO;KAC7B,MAAM,OAAO,GAAG,QAAQ,MAAM,MAAM,EAAE;KACtC,OAAO,WAAW,IAAI,IAAI,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC,IAAI;IACrE,CAAC;IAED,SAAS,UAAU,SAAS,QACzB,QAAO,MAAK,MAAM,IAAI,CAAC,CACvB,KAAI,MAAM,EAAE,WAAW,GAAG,IAAI,SAAS,MAAM,CAAC,IAAI,CAAE;IAEvD,cAAc,SAAS,KAAK,UAAU,QAAQ,CAAC;GACjD;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs","names":["extname","relative","resolve"],"sources":["../../src/rolldown-config/helpers.ts"],"sourcesContent":["import { rmSync } from 'node:fs';\nimport { extname, relative, resolve } from 'node:path';\n\n/**\n * Strips the extension from a file path.\n *\n * @param file - File path string.\n *\n * @returns File path without file extension.\n */\nexport const withoutExtension = (file: string) => {\n return file.slice(0, file.length - extname(file).length);\n};\n\n/**\n * Removes compiled JavaScript and sourcemap files for specified sources.\n *\n * @param files - Set of source file paths.\n * @param dir - Target output directory.\n * @param sourcemap - Whether sourcemap files should also be deleted.\n */\nexport const cleanupJS = (files: Set<string>, dir: string, sourcemap: boolean) => {\n for (const file of files) {\n const withoutExt = withoutExtension(file);\n const rel = relative('src', withoutExt);\n const baseOut = resolve(process.cwd(), dir, rel);\n\n // #region JS outputs\n console.warn(`Cleaning up ${baseOut}`);\n\n rmSync(`${baseOut}.js`, { force: true });\n rmSync(`${baseOut}.cjs`, { force: true });\n if (sourcemap) {\n rmSync(`${baseOut}.js.map`, { force: true });\n rmSync(`${baseOut}.cjs.map`, { force: true });\n }\n\n const REMOVEDS = ['js', 'cjs', 'js.map', 'cjs.map'].map(\n ext => `${baseOut}.${ext}`,\n );\n\n const endMessage = JSON.stringify(REMOVEDS, null, 2);\n\n console.warn('removeds ::');\n console.log('***********');\n console.warn(endMessage);\n console.log('***********');\n // #endregion\n }\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,oBAAoB,SAAiB;CAChD,OAAO,KAAK,MAAM,GAAG,KAAK,UAAA,GAASA,KAAAA,QAAAA,CAAQ,IAAI,CAAC,CAAC,MAAM;AACzD;;;;;;;;AASA,MAAa,aAAa,OAAoB,KAAa,cAAuB;CAChF,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,aAAa,iBAAiB,IAAI;EACxC,MAAM,OAAA,GAAMC,KAAAA,SAAAA,CAAS,OAAO,UAAU;EACtC,MAAM,WAAA,GAAUC,KAAAA,QAAAA,CAAQ,QAAQ,IAAI,GAAG,KAAK,GAAG;EAG/C,QAAQ,KAAK,eAAe,SAAS;
|
|
1
|
+
{"version":3,"file":"helpers.cjs","names":["extname","relative","resolve","rmSync"],"sources":["../../src/rolldown-config/helpers.ts"],"sourcesContent":["import { rmSync } from 'node:fs';\nimport { extname, relative, resolve } from 'node:path';\n\n/**\n * Strips the extension from a file path.\n *\n * @param file - File path string.\n *\n * @returns File path without file extension.\n */\nexport const withoutExtension = (file: string) => {\n return file.slice(0, file.length - extname(file).length);\n};\n\n/**\n * Removes compiled JavaScript and sourcemap files for specified sources.\n *\n * @param files - Set of source file paths.\n * @param dir - Target output directory.\n * @param sourcemap - Whether sourcemap files should also be deleted.\n */\nexport const cleanupJS = (files: Set<string>, dir: string, sourcemap: boolean) => {\n for (const file of files) {\n const withoutExt = withoutExtension(file);\n const rel = relative('src', withoutExt);\n const baseOut = resolve(process.cwd(), dir, rel);\n\n // #region JS outputs\n console.warn(`Cleaning up ${baseOut}`);\n\n rmSync(`${baseOut}.js`, { force: true });\n rmSync(`${baseOut}.cjs`, { force: true });\n if (sourcemap) {\n rmSync(`${baseOut}.js.map`, { force: true });\n rmSync(`${baseOut}.cjs.map`, { force: true });\n }\n\n const REMOVEDS = ['js', 'cjs', 'js.map', 'cjs.map'].map(\n ext => `${baseOut}.${ext}`,\n );\n\n const endMessage = JSON.stringify(REMOVEDS, null, 2);\n\n console.warn('removeds ::');\n console.log('***********');\n console.warn(endMessage);\n console.log('***********');\n // #endregion\n }\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,oBAAoB,SAAiB;CAChD,OAAO,KAAK,MAAM,GAAG,KAAK,UAAA,GAASA,KAAAA,QAAAA,CAAQ,IAAI,CAAC,CAAC,MAAM;AACzD;;;;;;;;AASA,MAAa,aAAa,OAAoB,KAAa,cAAuB;CAChF,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,aAAa,iBAAiB,IAAI;EACxC,MAAM,OAAA,GAAMC,KAAAA,SAAAA,CAAS,OAAO,UAAU;EACtC,MAAM,WAAA,GAAUC,KAAAA,QAAAA,CAAQ,QAAQ,IAAI,GAAG,KAAK,GAAG;EAG/C,QAAQ,KAAK,eAAe,SAAS;EAErCC,CAAAA,GAAAA,GAAAA,OAAAA,CAAO,GAAG,QAAQ,MAAM,EAAE,OAAO,KAAK,CAAC;EACvCA,CAAAA,GAAAA,GAAAA,OAAAA,CAAO,GAAG,QAAQ,OAAO,EAAE,OAAO,KAAK,CAAC;EACxC,IAAI,WAAW;GACbA,CAAAA,GAAAA,GAAAA,OAAAA,CAAO,GAAG,QAAQ,UAAU,EAAE,OAAO,KAAK,CAAC;GAC3CA,CAAAA,GAAAA,GAAAA,OAAAA,CAAO,GAAG,QAAQ,WAAW,EAAE,OAAO,KAAK,CAAC;EAC9C;EAEA,MAAM,WAAW;GAAC;GAAM;GAAO;GAAU;EAAS,CAAC,CAAC,KAClD,QAAO,GAAG,QAAQ,GAAG,KACvB;EAEA,MAAM,aAAa,KAAK,UAAU,UAAU,MAAM,CAAC;EAEnD,QAAQ,KAAK,aAAa;EAC1B,QAAQ,IAAI,aAAa;EACzB,QAAQ,KAAK,UAAU;EACvB,QAAQ,IAAI,aAAa;CAE3B;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.cjs","names":["toArray","globSync","withoutExtension","relative","WARNING_CODES","findConfigFile","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { relative } from 'node:path';\n\nimport { findConfigFile } from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR, WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { readTsConfig } from './typescript.config';\n\n/**\n * Options for the post-bundle cleanup plugin.\n */\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\n\n/**\n * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.\n *\n * @param options - Configuration options of type {@linkcode EndPluginOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport const clean = (options: EndPluginOptions) => {\n const { ignoresJS, sourcemap = false, dir } = options;\n\n const _ignoresJS = toArray(ignoresJS);\n\n const out = {\n name: 'end-bemedev',\n\n onLog: {\n handler: (_, { code, names }) => {\n const EMPTY_CHUNKS = _ignoresJS\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n const check =\n code === WARNING_CODES.EMPTY_BUNDLE &&\n names?.every(name => EMPTY_CHUNKS.includes(name));\n\n if (check) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[end-bemedev] Skipping empty chunk warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n return false;\n }\n\n return;\n },\n },\n\n closeBundle: {\n order: 'post',\n handler: () => {\n const cwd = process.cwd();\n\n const tsconfigPath = findConfigFile(cwd, existsSync, 'tsconfig.json')!;\n const _outDir = readTsConfig(tsconfigPath).options.outDir;\n const outDir = _outDir ?? dir ?? DEFAULT_DIR;\n if (_ignoresJS.length > 0) {\n try {\n const files = new Set<string>();\n _ignoresJS.forEach(pat => {\n const globs = globSync(pat, { nodir: true });\n globs.forEach(file => files.add(file));\n });\n cleanupJS(files, outDir, sourcemap);\n console.log('Build finished');\n /* v8 ignore next 3 */\n } catch (err) {\n console.error('[end-bemedev] cleanup failed:', err);\n }\n }\n },\n },\n } satisfies RolldownPluginOption;\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAa,SAAS,YAA8B;CAClD,MAAM,EAAE,WAAW,YAAY,OAAO,QAAQ;CAE9C,MAAM,aAAaA,oBAAAA,QAAQ,SAAS;CAwDpC,OAAO;EArDL,MAAM;EAEN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,MAAM,eAAe,WAClB,KAAI,OAAA,GAAKC,KAAAA,SAAAA,CAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAQC,KAAAA,SAAAA,CAAS,OAAO,IAAI,CAAC;GAMpC,IAHE,SAASC,kCAAAA,cAAc,gBACvB,OAAO,OAAM,SAAQ,aAAa,SAAS,IAAI,CAAC,GAEvC;IACT,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,kDAAkD;IAC9D,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,OAAO;GACT;EAGF,EACF;EAEA,aAAa;GACX,OAAO;GACP,eAAe;IACb,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,gBAAA,GAAeC,wBAAAA,eAAAA,CAAe,KAAKC,GAAAA,YAAY,eAAe;IAEpE,MAAM,SADUC,kDAAAA,aAAa,YAAY,CAAC,CAAC,QAAQ,UACzB,OAAA;IAC1B,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;MAExB,CAAA,GADcN,KAAAA,SAAAA,CAAS,KAAK,EAAE,OAAO,KAAK,CACtC,CAAC,CAAC,SAAQ,SAAQ,MAAM,IAAI,IAAI,CAAC;KACvC,CAAC;
|
|
1
|
+
{"version":3,"file":"clean.cjs","names":["toArray","globSync","withoutExtension","relative","WARNING_CODES","findConfigFile","existsSync","readTsConfig","cleanupJS"],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { relative } from 'node:path';\n\nimport { findConfigFile } from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR, WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { readTsConfig } from './typescript.config';\n\n/**\n * Options for the post-bundle cleanup plugin.\n */\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\n\n/**\n * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.\n *\n * @param options - Configuration options of type {@linkcode EndPluginOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport const clean = (options: EndPluginOptions) => {\n const { ignoresJS, sourcemap = false, dir } = options;\n\n const _ignoresJS = toArray(ignoresJS);\n\n const out = {\n name: 'end-bemedev',\n\n onLog: {\n handler: (_, { code, names }) => {\n const EMPTY_CHUNKS = _ignoresJS\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n const check =\n code === WARNING_CODES.EMPTY_BUNDLE &&\n names?.every(name => EMPTY_CHUNKS.includes(name));\n\n if (check) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[end-bemedev] Skipping empty chunk warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n return false;\n }\n\n return;\n },\n },\n\n closeBundle: {\n order: 'post',\n handler: () => {\n const cwd = process.cwd();\n\n const tsconfigPath = findConfigFile(cwd, existsSync, 'tsconfig.json')!;\n const _outDir = readTsConfig(tsconfigPath).options.outDir;\n const outDir = _outDir ?? dir ?? DEFAULT_DIR;\n if (_ignoresJS.length > 0) {\n try {\n const files = new Set<string>();\n _ignoresJS.forEach(pat => {\n const globs = globSync(pat, { nodir: true });\n globs.forEach(file => files.add(file));\n });\n cleanupJS(files, outDir, sourcemap);\n console.log('Build finished');\n /* v8 ignore next 3 */\n } catch (err) {\n console.error('[end-bemedev] cleanup failed:', err);\n }\n }\n },\n },\n } satisfies RolldownPluginOption;\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAa,SAAS,YAA8B;CAClD,MAAM,EAAE,WAAW,YAAY,OAAO,QAAQ;CAE9C,MAAM,aAAaA,oBAAAA,QAAQ,SAAS;CAwDpC,OAAO;EArDL,MAAM;EAEN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,MAAM,eAAe,WAClB,KAAI,OAAA,GAAKC,KAAAA,SAAAA,CAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAQC,KAAAA,SAAAA,CAAS,OAAO,IAAI,CAAC;GAMpC,IAHE,SAASC,kCAAAA,cAAc,gBACvB,OAAO,OAAM,SAAQ,aAAa,SAAS,IAAI,CAAC,GAEvC;IACT,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,kDAAkD;IAC9D,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,OAAO;GACT;EAGF,EACF;EAEA,aAAa;GACX,OAAO;GACP,eAAe;IACb,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,gBAAA,GAAeC,wBAAAA,eAAAA,CAAe,KAAKC,GAAAA,YAAY,eAAe;IAEpE,MAAM,SADUC,kDAAAA,aAAa,YAAY,CAAC,CAAC,QAAQ,UACzB,OAAA;IAC1B,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;MAExB,CAAA,GADcN,KAAAA,SAAAA,CAAS,KAAK,EAAE,OAAO,KAAK,CACtC,CAAC,CAAC,SAAQ,SAAQ,MAAM,IAAI,IAAI,CAAC;KACvC,CAAC;KACDO,gCAAAA,UAAU,OAAO,QAAQ,SAAS;KAClC,QAAQ,IAAI,gBAAgB;IAE9B,SAAS,KAAK;KACZ,QAAQ,MAAM,iCAAiC,GAAG;IACpD;GAEJ;EACF;CAGO;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.js","names":[],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { relative } from 'node:path';\n\nimport { findConfigFile } from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR, WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { readTsConfig } from './typescript.config';\n\n/**\n * Options for the post-bundle cleanup plugin.\n */\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\n\n/**\n * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.\n *\n * @param options - Configuration options of type {@linkcode EndPluginOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport const clean = (options: EndPluginOptions) => {\n const { ignoresJS, sourcemap = false, dir } = options;\n\n const _ignoresJS = toArray(ignoresJS);\n\n const out = {\n name: 'end-bemedev',\n\n onLog: {\n handler: (_, { code, names }) => {\n const EMPTY_CHUNKS = _ignoresJS\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n const check =\n code === WARNING_CODES.EMPTY_BUNDLE &&\n names?.every(name => EMPTY_CHUNKS.includes(name));\n\n if (check) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[end-bemedev] Skipping empty chunk warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n return false;\n }\n\n return;\n },\n },\n\n closeBundle: {\n order: 'post',\n handler: () => {\n const cwd = process.cwd();\n\n const tsconfigPath = findConfigFile(cwd, existsSync, 'tsconfig.json')!;\n const _outDir = readTsConfig(tsconfigPath).options.outDir;\n const outDir = _outDir ?? dir ?? DEFAULT_DIR;\n if (_ignoresJS.length > 0) {\n try {\n const files = new Set<string>();\n _ignoresJS.forEach(pat => {\n const globs = globSync(pat, { nodir: true });\n globs.forEach(file => files.add(file));\n });\n cleanupJS(files, outDir, sourcemap);\n console.log('Build finished');\n /* v8 ignore next 3 */\n } catch (err) {\n console.error('[end-bemedev] cleanup failed:', err);\n }\n }\n },\n },\n } satisfies RolldownPluginOption;\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA6BA,MAAa,SAAS,YAA8B;CAClD,MAAM,EAAE,WAAW,YAAY,OAAO,QAAQ;CAE9C,MAAM,aAAa,QAAQ,SAAS;CAwDpC,OAAO;EArDL,MAAM;EAEN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,MAAM,eAAe,WAClB,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;GAMpC,IAHE,SAAS,cAAc,gBACvB,OAAO,OAAM,SAAQ,aAAa,SAAS,IAAI,CAAC,GAEvC;IACT,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,kDAAkD;IAC9D,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,OAAO;GACT;EAGF,EACF;EAEA,aAAa;GACX,OAAO;GACP,eAAe;IACb,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAe,eAAe,KAAK,YAAY,eAAe;IAEpE,MAAM,SADU,aAAa,YAAY,CAAC,CAAC,QAAQ,UACzB,OAAA;IAC1B,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;
|
|
1
|
+
{"version":3,"file":"clean.js","names":[],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { relative } from 'node:path';\n\nimport { findConfigFile } from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport type { RolldownPluginOption } from 'rolldown';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR, WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { readTsConfig } from './typescript.config';\n\n/**\n * Options for the post-bundle cleanup plugin.\n */\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\n\n/**\n * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.\n *\n * @param options - Configuration options of type {@linkcode EndPluginOptions}.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\n */\nexport const clean = (options: EndPluginOptions) => {\n const { ignoresJS, sourcemap = false, dir } = options;\n\n const _ignoresJS = toArray(ignoresJS);\n\n const out = {\n name: 'end-bemedev',\n\n onLog: {\n handler: (_, { code, names }) => {\n const EMPTY_CHUNKS = _ignoresJS\n .map(f => globSync(f, { nodir: true }))\n .flat()\n .map(withoutExtension)\n .map(file => relative('src', file));\n\n const check =\n code === WARNING_CODES.EMPTY_BUNDLE &&\n names?.every(name => EMPTY_CHUNKS.includes(name));\n\n if (check) {\n const STARS = '*'.repeat(20);\n console.log(STARS);\n console.log('[end-bemedev] Skipping empty chunk warnings for:');\n names?.forEach(name => console.log(` -> 📄 ${name}`));\n console.log(STARS);\n return false;\n }\n\n return;\n },\n },\n\n closeBundle: {\n order: 'post',\n handler: () => {\n const cwd = process.cwd();\n\n const tsconfigPath = findConfigFile(cwd, existsSync, 'tsconfig.json')!;\n const _outDir = readTsConfig(tsconfigPath).options.outDir;\n const outDir = _outDir ?? dir ?? DEFAULT_DIR;\n if (_ignoresJS.length > 0) {\n try {\n const files = new Set<string>();\n _ignoresJS.forEach(pat => {\n const globs = globSync(pat, { nodir: true });\n globs.forEach(file => files.add(file));\n });\n cleanupJS(files, outDir, sourcemap);\n console.log('Build finished');\n /* v8 ignore next 3 */\n } catch (err) {\n console.error('[end-bemedev] cleanup failed:', err);\n }\n }\n },\n },\n } satisfies RolldownPluginOption;\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AA6BA,MAAa,SAAS,YAA8B;CAClD,MAAM,EAAE,WAAW,YAAY,OAAO,QAAQ;CAE9C,MAAM,aAAa,QAAQ,SAAS;CAwDpC,OAAO;EArDL,MAAM;EAEN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,MAAM,eAAe,WAClB,KAAI,MAAK,SAAS,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAI,gBAAgB,CAAC,CACrB,KAAI,SAAQ,SAAS,OAAO,IAAI,CAAC;GAMpC,IAHE,SAAS,cAAc,gBACvB,OAAO,OAAM,SAAQ,aAAa,SAAS,IAAI,CAAC,GAEvC;IACT,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI,kDAAkD;IAC9D,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,OAAO;GACT;EAGF,EACF;EAEA,aAAa;GACX,OAAO;GACP,eAAe;IACb,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAe,eAAe,KAAK,YAAY,eAAe;IAEpE,MAAM,SADU,aAAa,YAAY,CAAC,CAAC,QAAQ,UACzB,OAAA;IAC1B,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;MACV,SAAS,KAAK,EAAE,OAAO,KAAK,CACtC,CAAC,CAAC,SAAQ,SAAQ,MAAM,IAAI,IAAI,CAAC;KACvC,CAAC;KACD,UAAU,OAAO,QAAQ,SAAS;KAClC,QAAQ,IAAI,gBAAgB;IAE9B,SAAS,KAAK;KACZ,QAAQ,MAAM,iCAAiC,GAAG;IACpD;GAEJ;EACF;CAGO;AACX"}
|
|
@@ -1 +1 @@
|
|
|
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\n/**\n * Registry mapping plugin keys to their factory functions.\n */\nexport const PLUGIN_BUILDERS = {\n typescript,\n circulars,\n externals,\n clean,\n fast: typescriptFast,\n esm: esmExternalRequirePlugin,\n};\n\n/**\n * Default ordering sequence for Rolldown build plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n PLUGIN_BUILDERS,\n) as (keyof typeof PLUGIN_BUILDERS)[];\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["typescript","circulars","externals","clean","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\n/**\n * Registry mapping plugin keys to their factory functions.\n */\nexport const PLUGIN_BUILDERS = {\n typescript,\n circulars,\n externals,\n clean,\n fast: typescriptFast,\n esm: esmExternalRequirePlugin,\n};\n\n/**\n * Default ordering sequence for Rolldown build plugins.\n */\nexport const DEFAULT_PLUGINS_ORDER = Object.keys(\n PLUGIN_BUILDERS,\n) as (keyof typeof PLUGIN_BUILDERS)[];\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,kBAAkB;CAC7BA,YAAAA,2CAAAA;CACAC,WAAAA,0CAAAA;CACAC,WAAAA,0CAAAA;CACAC,OAAAA,sCAAAA;CACA,MAAMC,gDAAAA;CACN,KAAKC,iBAAAA;AACP;;;;AAKA,MAAa,wBAAwB,OAAO,KAC1C,eACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.config.cjs","names":["readFileSync","readdirSync","join","statSync","existsSync","ts","path","dirname"],"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 (!extensions || extensions.some(ext => entry.endsWith(ext))) {\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\n/**\n * Loads and parses the closest `tsconfig.json` from the search path.\n *\n * @param searchPath - Directory path from which to locate the tsconfig.\n * @param configName - Name of the configuration file, defaults to `'tsconfig.json'`.\n *\n * @returns Parsed TypeScript configuration object.\n */\nexport function getConfig(searchPath: string, configName: string = 'tsconfig.json') {\n const tsconfigPath = ts.findConfigFile(searchPath, existsSync, configName)!;\n\n const configFile = readTsConfig(tsconfigPath);\n return configFile;\n}\n\n/**\n * Reads and parses the specified `tsconfig.json` file path.\n *\n * @param path - Absolute or relative path to the tsconfig file.\n *\n * @returns Parsed TypeScript configuration object.\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,GAAOA,GAAAA,aAAAA,CAAa,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,GAAUC,GAAAA,YAAAA,CAAY,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,YAAA,GAAWC,KAAAA,KAAAA,CAAK,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,QAAA,GAAOC,GAAAA,SAAAA,CAAS,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IAAI,CAAC,cAAc,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAClE,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAYC,GAAAA;CACZ,UAAU;AACZ;;;;;;;;;AAUA,SAAgB,UAAU,YAAoB,aAAqB,iBAAiB;CAClF,MAAM,eAAeC,wBAAAA,QAAG,eAAe,YAAYD,GAAAA,YAAY,UAAU;CAGzE,OADmB,aAAa,YAChB;AAClB;;;;;;;;AASA,MAAa,
|
|
1
|
+
{"version":3,"file":"typescript.config.cjs","names":["readFileSync","readdirSync","join","statSync","existsSync","ts","path","dirname"],"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 (!extensions || extensions.some(ext => entry.endsWith(ext))) {\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\n/**\n * Loads and parses the closest `tsconfig.json` from the search path.\n *\n * @param searchPath - Directory path from which to locate the tsconfig.\n * @param configName - Name of the configuration file, defaults to `'tsconfig.json'`.\n *\n * @returns Parsed TypeScript configuration object.\n */\nexport function getConfig(searchPath: string, configName: string = 'tsconfig.json') {\n const tsconfigPath = ts.findConfigFile(searchPath, existsSync, configName)!;\n\n const configFile = readTsConfig(tsconfigPath);\n return configFile;\n}\n\n/**\n * Reads and parses the specified `tsconfig.json` file path.\n *\n * @param path - Absolute or relative path to the tsconfig file.\n *\n * @returns Parsed TypeScript configuration object.\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,GAAOA,GAAAA,aAAAA,CAAa,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,GAAUC,GAAAA,YAAAA,CAAY,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,YAAA,GAAWC,KAAAA,KAAAA,CAAK,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,QAAA,GAAOC,GAAAA,SAAAA,CAAS,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IAAI,CAAC,cAAc,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAClE,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAYC,GAAAA;CACZ,UAAU;AACZ;;;;;;;;;AAUA,SAAgB,UAAU,YAAoB,aAAqB,iBAAiB;CAClF,MAAM,eAAeC,wBAAAA,QAAG,eAAe,YAAYD,GAAAA,YAAY,UAAU;CAGzE,OADmB,aAAa,YAChB;AAClB;;;;;;;;AASA,MAAa,gBAAgBE,WAAiB;CAC5C,MAAM,aAAaD,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,GACAE,KAAAA,QAAAA,CAAQD,MAAI,CAGI;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.fast.cjs","names":["toArray","ts","existsSync","readTsConfig","join","globSync","readFileSync","transformSync","relative","dirname","basename","replaceTscAliasPaths"],"sources":["../../../src/rolldown-config/plugins/typescript.fast.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } 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\n/**\n * Options for the fast TypeScript DTS generation plugin.\n */\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\n/**\n * Fast Rolldown plugin using `oxc-transform` for generating TypeScript declaration files (`.d.ts`).\n *\n * @param props - Configuration options.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\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(cwd, existsSync, 'tsconfig.json')!;\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":";;;;;;;;;;;;;;;;;;;;AA+BA,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,eAAe,KAAKC,GAAAA,YAAY,eAAe;IAEvE,MAAM,aAAaC,kDAAAA,aAAa,YAAY;IAC5C,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAC5C,MAAM,UAAU,WAAW,QAAQ,YAAA,GAAWC,KAAAA,KAAAA,CAAK,KAAK,KAAK;IAE7D,IAAI;IACJ,IAAI,WAAW,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,GAC3C,QAAQ,OAAO,OAAO,OAAO;SAE7B,SAAA,GAAQC,KAAAA,SAAAA,EAAAA,GAASD,KAAAA,KAAAA,CAAK,SAAS,uBAAuB,GAAG,EACvD,QAAQJ,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;KACF,MAAM,WAAA,GAAUM,GAAAA,aAAAA,CAAa,MAAM,OAAO;KAC1C,MAAM,UAAA,GAASC,cAAAA,cAAAA,CAAc,MAAM,SAAS;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,GAAeC,KAAAA,SAAAA,CAAS,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,GAAUJ,KAAAA,KAAAA,CAAK,QAAQ,OAAO;KACpC,MAAM,aAAa,UAAU;
|
|
1
|
+
{"version":3,"file":"typescript.fast.cjs","names":["toArray","ts","existsSync","readTsConfig","join","globSync","readFileSync","transformSync","relative","mkdirSync","dirname","basename","writeFileSync","replaceTscAliasPaths"],"sources":["../../../src/rolldown-config/plugins/typescript.fast.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } 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\n/**\n * Options for the fast TypeScript DTS generation plugin.\n */\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\n/**\n * Fast Rolldown plugin using `oxc-transform` for generating TypeScript declaration files (`.d.ts`).\n *\n * @param props - Configuration options.\n *\n * @returns Rolldown plugin option of type {@linkcode RolldownPluginOption}.\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(cwd, existsSync, 'tsconfig.json')!;\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":";;;;;;;;;;;;;;;;;;;;AA+BA,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,eAAe,KAAKC,GAAAA,YAAY,eAAe;IAEvE,MAAM,aAAaC,kDAAAA,aAAa,YAAY;IAC5C,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAC5C,MAAM,UAAU,WAAW,QAAQ,YAAA,GAAWC,KAAAA,KAAAA,CAAK,KAAK,KAAK;IAE7D,IAAI;IACJ,IAAI,WAAW,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,GAC3C,QAAQ,OAAO,OAAO,OAAO;SAE7B,SAAA,GAAQC,KAAAA,SAAAA,EAAAA,GAASD,KAAAA,KAAAA,CAAK,SAAS,uBAAuB,GAAG,EACvD,QAAQJ,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;KACF,MAAM,WAAA,GAAUM,GAAAA,aAAAA,CAAa,MAAM,OAAO;KAC1C,MAAM,UAAA,GAASC,cAAAA,cAAAA,CAAc,MAAM,SAAS;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,GAAeC,KAAAA,SAAAA,CAAS,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,GAAUJ,KAAAA,KAAAA,CAAK,QAAQ,OAAO;KACpC,MAAM,aAAa,UAAU;KAG7BK,CAAAA,GAAAA,GAAAA,UAAAA,EAAAA,GAAUC,KAAAA,QAAAA,CAAQ,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;KAE/C,IAAI,UAAU,OAAO,eAAe;KACpC,IAAI,kBAAkB,OAAO,gBAAgB;MAC3C,WAAW,2BAAA,GAA0BC,KAAAA,SAAAA,CAAS,OAAO,EAAE;MACvDC,CAAAA,GAAAA,GAAAA,cAAAA,CACE,YACA,KAAK,UAAU,OAAO,cAAc,GACpC,OACF;KACF;KAEAA,CAAAA,GAAAA,GAAAA,cAAAA,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,GAAMC,UAAAA,qBAAAA,CAAqB;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.cjs","names":["testPattern","defaultCovPattern","buildInclude"],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config';\n\nimport { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport { buildInclude, defaultCovPattern, testPattern } from './vitest.utils';\n\n/**\n * Creates include arrays for test and coverage files from glob patterns.\n *\n * @param args - Glob patterns to ignore for test and coverage files.\n * @param root - Optional root directory path.\n *\n * @returns An object with resolved `files` and `coverage` string arrays.\n */\nexport async function create(args: Args[1] = {}, root?: string) {\n const firsts = {\n patternTest: testPattern(root),\n patternCov: defaultCovPattern(root),\n };\n\n return create.withPattern(firsts, args, root);\n}\n\n/**\n * Creates include arrays using custom test and coverage glob patterns.\n *\n * @param patterns - Custom test and coverage pattern object.\n * @param patterns.patternTest - Glob pattern for test files.\n * @param patterns.patternCov - Glob pattern for coverage files.\n * @param args - Ignore options for tests and coverage.\n * @param root - Optional root directory path.\n *\n * @returns An object with resolved `files` and `coverage` string arrays.\n */\ncreate.withPattern = async (\n { patternTest, patternCov }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n root?: string,\n) => {\n const files = await buildInclude(\n patternTest ?? testPattern(root),\n ignoreTestFiles,\n root,\n );\n const coverage = await buildInclude(\n patternCov ?? defaultCovPattern(root),\n ignoreCoverageFiles,\n root,\n );\n return { files, coverage };\n};\n\n/**\n * Vitest plugin to configure test and coverage file inclusion via glob patterns.\n *\n * @param args - Globs to ignore for test and coverage files.\n *\n * @returns Vitest plugin of type {@linkcode Plugin}.\n */\nexport function exclude(args: Args[1] = {}) {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const patternCov = defaultCovPattern(root);\n const patternTest = testPattern(root);\n\n const { ignoreCoverageFiles, ignoreTestFiles } = args;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n } as Plugin;\n}\n\n/**\n * Vitest plugin to configure test and coverage file inclusion with custom search patterns.\n *\n * @param patterns - Custom test and coverage glob patterns.\n * @param ignore - Globs to exclude.\n *\n * @returns Vitest plugin of type {@linkcode Plugin}.\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;;;;AAcA,eAAsB,OAAO,OAAgB,CAAC,GAAG,MAAe;CAC9D,MAAM,SAAS;EACb,aAAaA,oCAAAA,YAAY,IAAI;EAC7B,YAAYC,oCAAAA,kBAAkB,IAAI;CACpC;CAEA,OAAO,OAAO,YAAY,QAAQ,MAAM,IAAI;AAC9C;;;;;;;;;;;;AAaA,OAAO,cAAc,OACnB,EAAE,aAAa,eAAiC,CAAC,GACjD,EAAE,iBAAiB,wBAAiC,CAAC,GACrD,SACG;CAWH,OAAO;EAAE,OAAA,MAVWC,oCAAAA,aAClB,eAAeF,oCAAAA,YAAY,IAAI,GAC/B,iBACA,IACF;EAMgB,UAAA,MALOE,oCAAAA,aACrB,cAAcD,oCAAAA,kBAAkB,IAAI,GACpC,qBACA,IACF;CACyB;AAC3B;;;;;;;;AASA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,OAAO;
|
|
1
|
+
{"version":3,"file":"vitest.cjs","names":["testPattern","defaultCovPattern","buildInclude","name"],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import type { Plugin } from 'vitest/config';\n\nimport { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport { buildInclude, defaultCovPattern, testPattern } from './vitest.utils';\n\n/**\n * Creates include arrays for test and coverage files from glob patterns.\n *\n * @param args - Glob patterns to ignore for test and coverage files.\n * @param root - Optional root directory path.\n *\n * @returns An object with resolved `files` and `coverage` string arrays.\n */\nexport async function create(args: Args[1] = {}, root?: string) {\n const firsts = {\n patternTest: testPattern(root),\n patternCov: defaultCovPattern(root),\n };\n\n return create.withPattern(firsts, args, root);\n}\n\n/**\n * Creates include arrays using custom test and coverage glob patterns.\n *\n * @param patterns - Custom test and coverage pattern object.\n * @param patterns.patternTest - Glob pattern for test files.\n * @param patterns.patternCov - Glob pattern for coverage files.\n * @param args - Ignore options for tests and coverage.\n * @param root - Optional root directory path.\n *\n * @returns An object with resolved `files` and `coverage` string arrays.\n */\ncreate.withPattern = async (\n { patternTest, patternCov }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n root?: string,\n) => {\n const files = await buildInclude(\n patternTest ?? testPattern(root),\n ignoreTestFiles,\n root,\n );\n const coverage = await buildInclude(\n patternCov ?? defaultCovPattern(root),\n ignoreCoverageFiles,\n root,\n );\n return { files, coverage };\n};\n\n/**\n * Vitest plugin to configure test and coverage file inclusion via glob patterns.\n *\n * @param args - Globs to ignore for test and coverage files.\n *\n * @returns Vitest plugin of type {@linkcode Plugin}.\n */\nexport function exclude(args: Args[1] = {}) {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const patternCov = defaultCovPattern(root);\n const patternTest = testPattern(root);\n\n const { ignoreCoverageFiles, ignoreTestFiles } = args;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n } as Plugin;\n}\n\n/**\n * Vitest plugin to configure test and coverage file inclusion with custom search patterns.\n *\n * @param patterns - Custom test and coverage glob patterns.\n * @param ignore - Globs to exclude.\n *\n * @returns Vitest plugin of type {@linkcode Plugin}.\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n config: async options => {\n const root = options?.root ?? process.cwd();\n const testConfig = options?.test;\n const coverage = options?.test?.coverage;\n\n const all = await create.withPattern(\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n root,\n );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: { ...coverage, include: all.coverage },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;;;;AAcA,eAAsB,OAAO,OAAgB,CAAC,GAAG,MAAe;CAC9D,MAAM,SAAS;EACb,aAAaA,oCAAAA,YAAY,IAAI;EAC7B,YAAYC,oCAAAA,kBAAkB,IAAI;CACpC;CAEA,OAAO,OAAO,YAAY,QAAQ,MAAM,IAAI;AAC9C;;;;;;;;;;;;AAaA,OAAO,cAAc,OACnB,EAAE,aAAa,eAAiC,CAAC,GACjD,EAAE,iBAAiB,wBAAiC,CAAC,GACrD,SACG;CAWH,OAAO;EAAE,OAAA,MAVWC,oCAAAA,aAClB,eAAeF,oCAAAA,YAAY,IAAI,GAC/B,iBACA,IACF;EAMgB,UAAA,MALOE,oCAAAA,aACrB,cAAcD,oCAAAA,kBAAkB,IAAI,GACpC,qBACA,IACF;CACyB;AAC3B;;;;;;;;AASA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,OAAO;EACLE,MAAAA,iCAAAA;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,aAAaF,oCAAAA,kBAAkB,IAAI;GACzC,MAAM,cAAcD,oCAAAA,YAAY,IAAI;GAEpC,MAAM,EAAE,qBAAqB,oBAAoB;GAEjD,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF;;;;;;;;;AAUA,QAAQ,gBACN,EAAE,aAAa,cACf,EAAE,qBAAqB,sBACpB;CACH,OAAO;EACLG,MAAAA,iCAAAA;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,GACvC,IACF;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MAAE,GAAG;MAAU,SAAS,IAAI;KAAS;IACjD;GACF;EACF;CACF;AACF"}
|
|
@@ -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 '../utils/bemedev/globals/types';\nimport { isFunction } from './isFunction';\n\n/**\n * Creates baseline definition and function type tests for a given function.\n *\n * @param f - Target function to test of type {@linkcode Fn}.\n * @param _name - Optional custom name for test assertions.\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/**\n * Alias for {@linkcode useTestFunctionAcceptation}.\n */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":";;;;;;;;;;AAWA,MAAa,8BAA8B,GAAO,UAAmB;CACnE,MAAM,OAAO,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"acceptation.cjs","names":["test","expect","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\n/**\n * Creates baseline definition and function type tests for a given function.\n *\n * @param f - Target function to test of type {@linkcode Fn}.\n * @param _name - Optional custom name for test assertions.\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/**\n * Alias for {@linkcode useTestFunctionAcceptation}.\n */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":";;;;;;;;;;AAWA,MAAa,8BAA8B,GAAO,UAAmB;CACnE,MAAM,OAAO,SAAS,EAAE;CAExBA,CAAAA,GAAAA,OAAAA,KAAAA,CAAK,UAAU,KAAK,oBAAoB;EACtCC,CAAAA,GAAAA,OAAAA,OAAAA,CAAO,CAAC,CAAC,CAAC,YAAY;CACxB,CAAC;CACDD,CAAAA,GAAAA,OAAAA,KAAAA,CAAK,UAAU,KAAK,uBAAuB;EACzC,MAAM,QAAQE,mCAAAA,WAAW,CAAC;EAC1BD,CAAAA,GAAAA,OAAAA,OAAAA,CAAO,KAAK,CAAC,CAAC,KAAK,IAAI;CACzB,CAAC;AACH;;;;AAKA,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 type { Fn } from '../utils/bemedev/globals/types';\nimport { useTFA } from './acceptation';\nimport type { _CreateTests_F } from './createTests.types';\nimport { useErrorAsyncEach } from './each/error';\nimport { useEachAsync } from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type
|
|
1
|
+
{"version":3,"file":"createTests.cjs","names":["useTFA","useErrorAsyncEach","toStringFlat","useEachAsync","vi","beforeAll"],"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 { useEachAsync } from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type * from './createTests.types';\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(func, transform as any, toError);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func 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 structured test suites with acceptation, success, and failure runners.\n *\n * @template `F0` - Function parameters array type.\n * @template `F1` - Function return value type.\n * @template `F2` - Transformed return value type, defaults to `F1`.\n *\n * @param func - Function under test of type {@linkcode Fn}.\n * @param args - Configuration options.\n * @param args.transform - Optional output transformer of type {@linkcode Fn}.\n * @param args.toError - Optional error mapping function of type {@linkcode Fn}.\n *\n * @returns Test suite object with acceptation, success, and fails methods.\n *\n * @example\n * ```ts\n * const useTests = createTests(add);\n * useTests.success({\n * invite: 'For : 1,2,3',\n * parameters: [[1, 2, 3]],\n * expected: 6,\n * })();\n * ```\n */\nexport const createTests = <F0 extends any[], F1, F2 = F1>(\n func: Fn<F0, F1>,\n args?: { transform?: Fn<[Awaited<F1>], F2>; toError?: Fn<F0, string | undefined> },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\n/**\n * Creates structured test suites with an async instantiation or mock implementation.\n *\n * @template `F0` - Function parameters array type.\n * @template `F1` - Function return value type.\n * @template `F2` - Transformed return value type, defaults to `F1`.\n *\n * @param f - Fallback or default function of type {@linkcode Fn}.\n * @param options - Configuration options for instantiation and formatting.\n * @param options.instanciation - Async function returning the target implementation.\n * @param options.name - Name identifier for test descriptions.\n * @param options.transform - Optional output transformer.\n * @param options.toError - Optional error mapping function.\n *\n * @returns Test suite object with acceptation, success, and fails methods.\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":";;;;;;;AAUA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;CAClE,OAAO;EACL,mBAAmBA,oCAAAA,OAAO,MAAM,IAAI;EAEpC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;GAErB,aAAa;IAWX,OAViBC,mCAAAA,kBAAkB,MAAM,WAAkB,OAU7C,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;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,eACX,MACA,SACG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,CAAC;CACxC,OAAO,QAAQ,MAAM,WAAW,OAAO;AACzC;;;;;;;;;;;;;;;;;AAkBA,YAAY,sBACV,GACA,EACE,eACA,MACA,WACA,cAOC;CACH,MAAM,OAAOE,OAAAA,GAAG,GAAG,CAAC;CAEpB,IAAI,eACFC,CAAAA,GAAAA,OAAAA,UAAAA,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,6 +1,5 @@
|
|
|
1
1
|
import type { Fn } from '../utils/bemedev/globals/types';
|
|
2
|
-
|
|
3
|
-
export type { _CreateTests_F };
|
|
2
|
+
export type * from './createTests.types';
|
|
4
3
|
/**
|
|
5
4
|
* Creates structured test suites with acceptation, success, and failure runners.
|
|
6
5
|
*
|
|
@@ -1 +1 @@
|
|
|
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 { useEachAsync } from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type
|
|
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 { useEachAsync } from './each/pass';\nimport { toStringFlat } from './toStringFlat';\n\nexport type * from './createTests.types';\nconst _create: _CreateTests_F = (func, transform, toError, name) => {\n return {\n acceptation: () => useTFA(func, name),\n\n fails: (...cases) => {\n const length = cases.length;\n\n return () => {\n const useTests = useErrorAsyncEach(func, transform as any, toError);\n\n const _cases: any = cases.map(\n ({ invite: _invite, parameters, error }, index) => {\n const invite = `#${toStringFlat(index + 1, length)} => ${_invite}`;\n const out = { invite, parameters, error };\n return out;\n },\n );\n\n return useTests(..._cases);\n };\n },\n\n success: (...cases) => {\n const length = cases.length;\n return () => {\n const useTests = useEachAsync(func 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 structured test suites with acceptation, success, and failure runners.\n *\n * @template `F0` - Function parameters array type.\n * @template `F1` - Function return value type.\n * @template `F2` - Transformed return value type, defaults to `F1`.\n *\n * @param func - Function under test of type {@linkcode Fn}.\n * @param args - Configuration options.\n * @param args.transform - Optional output transformer of type {@linkcode Fn}.\n * @param args.toError - Optional error mapping function of type {@linkcode Fn}.\n *\n * @returns Test suite object with acceptation, success, and fails methods.\n *\n * @example\n * ```ts\n * const useTests = createTests(add);\n * useTests.success({\n * invite: 'For : 1,2,3',\n * parameters: [[1, 2, 3]],\n * expected: 6,\n * })();\n * ```\n */\nexport const createTests = <F0 extends any[], F1, F2 = F1>(\n func: Fn<F0, F1>,\n args?: { transform?: Fn<[Awaited<F1>], F2>; toError?: Fn<F0, string | undefined> },\n) => {\n const { transform, toError } = args || {};\n return _create(func, transform, toError);\n};\n\n/**\n * Creates structured test suites with an async instantiation or mock implementation.\n *\n * @template `F0` - Function parameters array type.\n * @template `F1` - Function return value type.\n * @template `F2` - Transformed return value type, defaults to `F1`.\n *\n * @param f - Fallback or default function of type {@linkcode Fn}.\n * @param options - Configuration options for instantiation and formatting.\n * @param options.instanciation - Async function returning the target implementation.\n * @param options.name - Name identifier for test descriptions.\n * @param options.transform - Optional output transformer.\n * @param options.toError - Optional error mapping function.\n *\n * @returns Test suite object with acceptation, success, and fails methods.\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":";;;;;;AAUA,MAAM,WAA2B,MAAM,WAAW,SAAS,SAAS;CAClE,OAAO;EACL,mBAAmB,OAAO,MAAM,IAAI;EAEpC,QAAQ,GAAG,UAAU;GACnB,MAAM,SAAS,MAAM;GAErB,aAAa;IAWX,OAViB,kBAAkB,MAAM,WAAkB,OAU7C,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;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,eACX,MACA,SACG;CACH,MAAM,EAAE,WAAW,YAAY,QAAQ,CAAC;CACxC,OAAO,QAAQ,MAAM,WAAW,OAAO;AACzC;;;;;;;;;;;;;;;;;AAkBA,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"done.cjs","names":["sleep","test"],"sources":["../../src/vitest-extended/done.ts"],"sourcesContent":["import { expect, test, type TestOptions } from 'vitest';\n\nimport { sleep } from '#utils/sleep';\n\nimport type { TestDoneFunction } from './types';\n\nconst useDone = (ms = 0) => {\n let executed = false;\n const done = () => (executed = true);\n\n const testDone = async () => {\n await sleep(ms);\n expect(executed).toBe(true);\n };\n\n return { done, testDone };\n};\n\nconst min100 = (ms = 0) => Math.max(100, ms);\n\n// #region Preparation\nconst getTimeout = (options?: TestOptions | number) => {\n if (typeof options === 'number') return min100(options);\n return min100(options?.timeout);\n};\n\nconst objectify = (options?: TestOptions | number): [TestOptions, number] => {\n const _timeout = getTimeout(options);\n const timeout = _timeout + 100;\n\n let _options = { timeout };\n if (!(typeof options === 'number')) {\n _options = { ...options, timeout };\n }\n\n return [_options, _timeout];\n};\n// #endregion\n\n/**\n * Build a test with a done callback function and a timeout.\n *\n * @param invite - The description of the test.\n * @param fn - Test callback function of type {@linkcode TestDoneFunction}.\n * @param options - Timeout in milliseconds or test options of type {@linkcode TestOptions}.\n *\n * @returns A Vitest test execution result.\n */\nexport const doneTest = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a test expected to fail with a done callback function and a timeout.\n *\n * @param invite - The description of the test.\n * @param fn - Test callback function of type {@linkcode TestDoneFunction}.\n * @param options - Timeout in milliseconds or test options of type {@linkcode TestOptions}.\n *\n * @returns A Vitest test execution result.\n */\ndoneTest.fails = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.fails(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a concurrent test with a done callback function and a timeout.\n *\n * @param invite - The description of the test.\n * @param fn - Test callback function of type {@linkcode TestDoneFunction}.\n * @param options - Timeout in milliseconds or test options of type {@linkcode TestOptions}.\n *\n * @returns A Vitest test execution result.\n */\ndoneTest.concurrent = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.concurrent(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n"],"mappings":";;;;AAMA,MAAM,WAAW,KAAK,MAAM;CAC1B,IAAI,WAAW;CACf,MAAM,aAAc,WAAW;CAE/B,MAAM,WAAW,YAAY;EAC3B,MAAMA,oBAAAA,MAAM,EAAE;
|
|
1
|
+
{"version":3,"file":"done.cjs","names":["sleep","expect","test"],"sources":["../../src/vitest-extended/done.ts"],"sourcesContent":["import { expect, test, type TestOptions } from 'vitest';\n\nimport { sleep } from '#utils/sleep';\n\nimport type { TestDoneFunction } from './types';\n\nconst useDone = (ms = 0) => {\n let executed = false;\n const done = () => (executed = true);\n\n const testDone = async () => {\n await sleep(ms);\n expect(executed).toBe(true);\n };\n\n return { done, testDone };\n};\n\nconst min100 = (ms = 0) => Math.max(100, ms);\n\n// #region Preparation\nconst getTimeout = (options?: TestOptions | number) => {\n if (typeof options === 'number') return min100(options);\n return min100(options?.timeout);\n};\n\nconst objectify = (options?: TestOptions | number): [TestOptions, number] => {\n const _timeout = getTimeout(options);\n const timeout = _timeout + 100;\n\n let _options = { timeout };\n if (!(typeof options === 'number')) {\n _options = { ...options, timeout };\n }\n\n return [_options, _timeout];\n};\n// #endregion\n\n/**\n * Build a test with a done callback function and a timeout.\n *\n * @param invite - The description of the test.\n * @param fn - Test callback function of type {@linkcode TestDoneFunction}.\n * @param options - Timeout in milliseconds or test options of type {@linkcode TestOptions}.\n *\n * @returns A Vitest test execution result.\n */\nexport const doneTest = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a test expected to fail with a done callback function and a timeout.\n *\n * @param invite - The description of the test.\n * @param fn - Test callback function of type {@linkcode TestDoneFunction}.\n * @param options - Timeout in milliseconds or test options of type {@linkcode TestOptions}.\n *\n * @returns A Vitest test execution result.\n */\ndoneTest.fails = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.fails(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n\n/**\n * Build a concurrent test with a done callback function and a timeout.\n *\n * @param invite - The description of the test.\n * @param fn - Test callback function of type {@linkcode TestDoneFunction}.\n * @param options - Timeout in milliseconds or test options of type {@linkcode TestOptions}.\n *\n * @returns A Vitest test execution result.\n */\ndoneTest.concurrent = (\n invite: string,\n fn: TestDoneFunction,\n options: number | TestOptions = 100,\n) => {\n const [_options, ms] = objectify(options);\n\n return test.concurrent(invite, _options, () => {\n const { done, testDone } = useDone(ms);\n fn(done);\n return testDone();\n });\n};\n"],"mappings":";;;;AAMA,MAAM,WAAW,KAAK,MAAM;CAC1B,IAAI,WAAW;CACf,MAAM,aAAc,WAAW;CAE/B,MAAM,WAAW,YAAY;EAC3B,MAAMA,oBAAAA,MAAM,EAAE;EACdC,CAAAA,GAAAA,OAAAA,OAAAA,CAAO,QAAQ,CAAC,CAAC,KAAK,IAAI;CAC5B;CAEA,OAAO;EAAE;EAAM;CAAS;AAC1B;AAEA,MAAM,UAAU,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE;AAG3C,MAAM,cAAc,YAAmC;CACrD,IAAI,OAAO,YAAY,UAAU,OAAO,OAAO,OAAO;CACtD,OAAO,OAAO,SAAS,OAAO;AAChC;AAEA,MAAM,aAAa,YAA0D;CAC3E,MAAM,WAAW,WAAW,OAAO;CACnC,MAAM,UAAU,WAAW;CAE3B,IAAI,WAAW,EAAE,QAAQ;CACzB,IAAI,EAAE,OAAO,YAAY,WACvB,WAAW;EAAE,GAAG;EAAS;CAAQ;CAGnC,OAAO,CAAC,UAAU,QAAQ;AAC5B;;;;;;;;;;AAYA,MAAa,YACX,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,OAAO;CAExC,QAAA,GAAOC,OAAAA,KAAAA,CAAK,QAAQ,gBAAgB;EAClC,MAAM,EAAE,MAAM,aAAa,QAAQ,EAAE;EACrC,GAAG,IAAI;EACP,OAAO,SAAS;CAClB,CAAC;AACH;;;;;;;;;;AAWA,SAAS,SACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,OAAO;CAExC,OAAOA,OAAAA,KAAK,MAAM,QAAQ,gBAAgB;EACxC,MAAM,EAAE,MAAM,aAAa,QAAQ,EAAE;EACrC,GAAG,IAAI;EACP,OAAO,SAAS;CAClB,CAAC;AACH;;;;;;;;;;AAWA,SAAS,cACP,QACA,IACA,UAAgC,QAC7B;CACH,MAAM,CAAC,UAAU,MAAM,UAAU,OAAO;CAExC,OAAOA,OAAAA,KAAK,WAAW,QAAQ,gBAAgB;EAC7C,MAAM,EAAE,MAAM,aAAa,QAAQ,EAAE;EACrC,GAAG,IAAI;EACP,OAAO,SAAS;CAClB,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.cjs","names":["identity","toArrayVitest","expect"],"sources":["../../../src/vitest-extended/each/error.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport { identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type { _UseErrorEach_F, UseErrorEach_F } from './error.types';\n\n/**\n * Runs error assertions for asynchronous test cases concurrently.\n */\nexport const useErrorAsyncEachCases: _UseErrorEach_F = (\n f,\n transform = identity as any,\n toError = () => undefined,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest.error(cases))('%s', async (_, args, _error) => {\n const actual = async () => {\n const out = await f(...args);\n return transform(out);\n };\n const check = _error === undefined;\n const error = check ? toError(...args) : _error;\n\n await expect(actual).rejects.toThrowError(error);\n });\n};\n\n/**\n * Higher-order function returning a test runner for asynchronous error assertions.\n *\n * @param f - Function to test.\n * @param transform - Optional transformer applied to the resolved return value.\n * @param toError - Optional function computing expected error message from arguments.\n *\n * @returns Function accepting error test cases to execute.\n */\nexport const useErrorAsyncEach: UseErrorEach_F = (f, transform, toError) => {\n return (...cases) => useErrorAsyncEachCases(f, transform, toError, ...cases);\n};\n"],"mappings":";;;;;;;;AASA,MAAa,0BACX,GACA,YAAYA,iCAAAA,UACZ,gBAAgB,KAAA,GAChB,GAAG,UACA;
|
|
1
|
+
{"version":3,"file":"error.cjs","names":["identity","test","toArrayVitest","expect"],"sources":["../../../src/vitest-extended/each/error.ts"],"sourcesContent":["import { expect, test } from 'vitest';\n\nimport { identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type { _UseErrorEach_F, UseErrorEach_F } from './error.types';\n\n/**\n * Runs error assertions for asynchronous test cases concurrently.\n */\nexport const useErrorAsyncEachCases: _UseErrorEach_F = (\n f,\n transform = identity as any,\n toError = () => undefined,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest.error(cases))('%s', async (_, args, _error) => {\n const actual = async () => {\n const out = await f(...args);\n return transform(out);\n };\n const check = _error === undefined;\n const error = check ? toError(...args) : _error;\n\n await expect(actual).rejects.toThrowError(error);\n });\n};\n\n/**\n * Higher-order function returning a test runner for asynchronous error assertions.\n *\n * @param f - Function to test.\n * @param transform - Optional transformer applied to the resolved return value.\n * @param toError - Optional function computing expected error message from arguments.\n *\n * @returns Function accepting error test cases to execute.\n */\nexport const useErrorAsyncEach: UseErrorEach_F = (f, transform, toError) => {\n return (...cases) => useErrorAsyncEachCases(f, transform, toError, ...cases);\n};\n"],"mappings":";;;;;;;;AASA,MAAa,0BACX,GACA,YAAYA,iCAAAA,UACZ,gBAAgB,KAAA,GAChB,GAAG,UACA;CACHC,OAAAA,KAAK,WAAW,KAAKC,gCAAAA,cAAc,MAAM,KAAK,CAAC,CAAC,CAAC,MAAM,OAAO,GAAG,MAAM,WAAW;EAChF,MAAM,SAAS,YAAY;GAEzB,OAAO,UAAU,MADC,EAAE,GAAG,IAAI,CACP;EACtB;EAEA,MAAM,QADQ,WAAW,KAAA,IACH,QAAQ,GAAG,IAAI,IAAI;EAEzC,OAAA,GAAMC,OAAAA,OAAAA,CAAO,MAAM,CAAC,CAAC,QAAQ,aAAa,KAAK;CACjD,CAAC;AACH;;;;;;;;;;AAWA,MAAa,qBAAqC,GAAG,WAAW,YAAY;CAC1E,QAAQ,GAAG,UAAU,uBAAuB,GAAG,WAAW,SAAS,GAAG,KAAK;AAC7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pass.cjs","names":["identity","toArrayVitest","defaultEquality"],"sources":["../../../src/vitest-extended/each/pass.ts"],"sourcesContent":["import { test } from 'vitest';\n\nimport { defaultEquality, identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type {\n _UseAsyncEach_F,\n _UseEach_F,\n UseAsyncEach_F,\n UseEach_F,\n} from './pass.types';\n\n// #region Sync\nconst useEachCases: _UseEach_F = (func, transform = identity as any, ...cases) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n (_, args, expected, test = defaultEquality) => {\n const value = transform(func(...args));\n return test(value, expected);\n },\n );\n};\n\n/**\n * Runs parameterized tests with strict equality checks across multiple cases.\n *\n * @param func - Function to test.\n * @param transform - Optional transformer applied to the return value.\n *\n * @returns Function accepting test cases to execute.\n */\nexport const useEach: UseEach_F = (func, transform) => {\n return (...cases) => useEachCases(func, transform, ...cases);\n};\n// #endregion\n\n// #region Async\nconst useEachAsyncCases: _UseAsyncEach_F = (\n f,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n async (_, args, expected, test = defaultEquality) => {\n const _value = await f(...args);\n const value = await transform(_value);\n return test(value, expected);\n },\n );\n};\n\n/**\n * Runs asynchronous parameterized tests with strict equality checks across multiple cases.\n *\n * @param func - Async function to test.\n * @param transform - Optional transformer applied to the resolved return value.\n *\n * @returns Function accepting test cases to execute.\n */\nexport const useEachAsync: UseAsyncEach_F = (func, transform) => {\n return (...cases) => useEachAsyncCases(func, transform, ...cases);\n};\n\n// #endregion\n"],"mappings":";;;;;AAYA,MAAM,gBAA4B,MAAM,YAAYA,iCAAAA,UAAiB,GAAG,UAAU;
|
|
1
|
+
{"version":3,"file":"pass.cjs","names":["identity","test","toArrayVitest","defaultEquality"],"sources":["../../../src/vitest-extended/each/pass.ts"],"sourcesContent":["import { test } from 'vitest';\n\nimport { defaultEquality, identity } from '../identity';\nimport { toArrayVitest } from '../toArray';\nimport type {\n _UseAsyncEach_F,\n _UseEach_F,\n UseAsyncEach_F,\n UseEach_F,\n} from './pass.types';\n\n// #region Sync\nconst useEachCases: _UseEach_F = (func, transform = identity as any, ...cases) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n (_, args, expected, test = defaultEquality) => {\n const value = transform(func(...args));\n return test(value, expected);\n },\n );\n};\n\n/**\n * Runs parameterized tests with strict equality checks across multiple cases.\n *\n * @param func - Function to test.\n * @param transform - Optional transformer applied to the return value.\n *\n * @returns Function accepting test cases to execute.\n */\nexport const useEach: UseEach_F = (func, transform) => {\n return (...cases) => useEachCases(func, transform, ...cases);\n};\n// #endregion\n\n// #region Async\nconst useEachAsyncCases: _UseAsyncEach_F = (\n f,\n transform = identity as any,\n ...cases\n) => {\n test.concurrent.each(toArrayVitest(cases))(\n '%s',\n async (_, args, expected, test = defaultEquality) => {\n const _value = await f(...args);\n const value = await transform(_value);\n return test(value, expected);\n },\n );\n};\n\n/**\n * Runs asynchronous parameterized tests with strict equality checks across multiple cases.\n *\n * @param func - Async function to test.\n * @param transform - Optional transformer applied to the resolved return value.\n *\n * @returns Function accepting test cases to execute.\n */\nexport const useEachAsync: UseAsyncEach_F = (func, transform) => {\n return (...cases) => useEachAsyncCases(func, transform, ...cases);\n};\n\n// #endregion\n"],"mappings":";;;;;AAYA,MAAM,gBAA4B,MAAM,YAAYA,iCAAAA,UAAiB,GAAG,UAAU;CAChFC,OAAAA,KAAK,WAAW,KAAKC,gCAAAA,cAAc,KAAK,CAAC,CAAC,CACxC,OACC,GAAG,MAAM,UAAU,OAAOC,iCAAAA,oBAAoB;EAE7C,OAAO,KADO,UAAU,KAAK,GAAG,IAAI,CACpB,GAAG,QAAQ;CAC7B,CACF;AACF;;;;;;;;;AAUA,MAAa,WAAsB,MAAM,cAAc;CACrD,QAAQ,GAAG,UAAU,aAAa,MAAM,WAAW,GAAG,KAAK;AAC7D;AAIA,MAAM,qBACJ,GACA,YAAYH,iCAAAA,UACZ,GAAG,UACA;CACHC,OAAAA,KAAK,WAAW,KAAKC,gCAAAA,cAAc,KAAK,CAAC,CAAC,CACxC,MACA,OAAO,GAAG,MAAM,UAAU,OAAOC,iCAAAA,oBAAoB;EAGnD,OAAO,KAAK,MADQ,UAAU,MADT,EAAE,GAAG,IAAI,CACM,GACjB,QAAQ;CAC7B,CACF;AACF;;;;;;;;;AAUA,MAAa,gBAAgC,MAAM,cAAc;CAC/D,QAAQ,GAAG,UAAU,kBAAkB,MAAM,WAAW,GAAG,KAAK;AAClE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemedev/dev-utils",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.4",
|
|
4
4
|
"description": "A collection of utilities for Node.js development, including build tools, testing utilities, and configuration management.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"build-tools",
|
|
@@ -83,11 +83,12 @@
|
|
|
83
83
|
"./package.json": "./package.json"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
+
"@ampproject/remapping": "^2.3.0",
|
|
86
87
|
"@typescript/typescript6": "^6.0.2",
|
|
87
88
|
"cmd-ts": "^0.15.0",
|
|
88
89
|
"edit-json-file": "^1.8.1",
|
|
89
|
-
"glob": "^14.0.
|
|
90
|
-
"oxc-transform": "^0.
|
|
90
|
+
"glob": "^14.0.6",
|
|
91
|
+
"oxc-transform": "^0.159.0",
|
|
91
92
|
"rollup-plugin-circular-dependencies": "^2.0.1",
|
|
92
93
|
"rollup-plugin-node-externals": "^9.0.1",
|
|
93
94
|
"shelljs": "^0.10.0",
|
|
@@ -102,19 +103,18 @@
|
|
|
102
103
|
"@types/node": "^26.6.6",
|
|
103
104
|
"@types/shelljs": "^0.10.0",
|
|
104
105
|
"@vitest/ui": "5.1.0",
|
|
105
|
-
"rolldown": "^1.3.
|
|
106
|
+
"rolldown": "^1.3.2",
|
|
106
107
|
"unplugin-dts": "^1.1.2",
|
|
107
|
-
"vite-plus": "^1.5.0",
|
|
108
108
|
"vitest": "5.1.0",
|
|
109
109
|
"zod": "^4.6.7",
|
|
110
110
|
"zx": "^8.8.5"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|
|
113
|
-
"rolldown": "^1.3.
|
|
113
|
+
"rolldown": "^1.3.2",
|
|
114
114
|
"vitest": "5.1.0"
|
|
115
115
|
},
|
|
116
116
|
"optionalDependencies": {
|
|
117
|
-
"vite-plus": "^1.
|
|
117
|
+
"vite-plus": "^1.7.0"
|
|
118
118
|
},
|
|
119
119
|
"size-limit": [
|
|
120
120
|
{
|