@bemedev/dev-utils 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/lib/_virtual/_rolldown/runtime.cjs +1 -1
- package/lib/build-tests/addTarball.cjs +5 -1
- package/lib/build-tests/addTarball.cjs.map +1 -1
- package/lib/build-tests/addTarball.d.ts +3 -0
- package/lib/build-tests/addTarball.js +5 -1
- package/lib/build-tests/addTarball.js.map +1 -1
- package/lib/build-tests/buildPackageJson.cjs +17 -9
- package/lib/build-tests/buildPackageJson.cjs.map +1 -1
- package/lib/build-tests/buildPackageJson.d.ts +5 -0
- package/lib/build-tests/buildPackageJson.js +17 -9
- package/lib/build-tests/buildPackageJson.js.map +1 -1
- package/lib/build-tests/cleanup.cjs +3 -0
- package/lib/build-tests/cleanup.cjs.map +1 -1
- package/lib/build-tests/cleanup.d.ts +3 -0
- package/lib/build-tests/cleanup.js +3 -0
- package/lib/build-tests/cleanup.js.map +1 -1
- package/lib/build-tests/cli/cli.cjs +6 -0
- package/lib/build-tests/cli/cli.cjs.map +1 -1
- package/lib/build-tests/cli/cli.d.ts +6 -0
- package/lib/build-tests/cli/cli.js +6 -0
- package/lib/build-tests/cli/cli.js.map +1 -1
- package/lib/build-tests/cli/index.cjs.map +1 -1
- package/lib/build-tests/cli/post.cjs +3 -0
- package/lib/build-tests/cli/post.cjs.map +1 -1
- package/lib/build-tests/cli/post.d.ts +3 -0
- package/lib/build-tests/cli/post.js +3 -0
- package/lib/build-tests/cli/post.js.map +1 -1
- package/lib/build-tests/cli/pre.cjs +3 -0
- package/lib/build-tests/cli/pre.cjs.map +1 -1
- package/lib/build-tests/cli/pre.d.ts +3 -0
- package/lib/build-tests/cli/pre.js +3 -0
- package/lib/build-tests/cli/pre.js.map +1 -1
- package/lib/build-tests/cli/test.cjs +3 -0
- package/lib/build-tests/cli/test.cjs.map +1 -1
- package/lib/build-tests/cli/test.d.ts +3 -0
- package/lib/build-tests/cli/test.js +3 -0
- package/lib/build-tests/cli/test.js.map +1 -1
- package/lib/build-tests/constants.cjs +42 -0
- package/lib/build-tests/constants.cjs.map +1 -1
- package/lib/build-tests/constants.d.ts +42 -0
- package/lib/build-tests/constants.js +42 -0
- package/lib/build-tests/constants.js.map +1 -1
- package/lib/build-tests/getRelativePath.cjs +7 -0
- package/lib/build-tests/getRelativePath.cjs.map +1 -1
- package/lib/build-tests/getRelativePath.d.ts +7 -0
- package/lib/build-tests/getRelativePath.js +7 -0
- package/lib/build-tests/getRelativePath.js.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.cjs +5 -0
- package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.d.ts +5 -0
- package/lib/build-tests/getTypescriptOutdir.js +5 -0
- package/lib/build-tests/getTypescriptOutdir.js.map +1 -1
- package/lib/build-tests/import.cjs +9 -0
- package/lib/build-tests/import.cjs.map +1 -1
- package/lib/build-tests/import.d.ts +9 -0
- package/lib/build-tests/import.js +9 -0
- package/lib/build-tests/import.js.map +1 -1
- package/lib/build-tests/imports/create.cjs +7 -0
- package/lib/build-tests/imports/create.cjs.map +1 -1
- package/lib/build-tests/imports/create.d.ts +13 -0
- package/lib/build-tests/imports/create.js +7 -0
- package/lib/build-tests/imports/create.js.map +1 -1
- package/lib/build-tests/imports/helper.cjs +9 -0
- package/lib/build-tests/imports/helper.cjs.map +1 -1
- package/lib/build-tests/imports/helper.d.ts +12 -0
- package/lib/build-tests/imports/helper.js +9 -0
- package/lib/build-tests/imports/helper.js.map +1 -1
- package/lib/build-tests/pack.cjs +7 -1
- package/lib/build-tests/pack.cjs.map +1 -1
- package/lib/build-tests/pack.d.ts +5 -0
- package/lib/build-tests/pack.js +7 -1
- package/lib/build-tests/pack.js.map +1 -1
- package/lib/plugins/index.cjs +3 -0
- package/lib/plugins/index.d.ts +1 -0
- package/lib/plugins/index.js +2 -0
- package/lib/plugins/suppressWarnings.cjs +37 -0
- package/lib/plugins/suppressWarnings.cjs.map +1 -0
- package/lib/plugins/suppressWarnings.d.ts +12 -0
- package/lib/plugins/suppressWarnings.js +36 -0
- package/lib/plugins/suppressWarnings.js.map +1 -0
- package/lib/rolldown-config/config.cjs +13 -5
- package/lib/rolldown-config/config.cjs.map +1 -1
- package/lib/rolldown-config/config.d.ts +7 -0
- package/lib/rolldown-config/config.js +13 -5
- package/lib/rolldown-config/config.js.map +1 -1
- package/lib/rolldown-config/constants.cjs +15 -0
- package/lib/rolldown-config/constants.cjs.map +1 -1
- package/lib/rolldown-config/constants.d.ts +15 -0
- package/lib/rolldown-config/constants.js +15 -0
- package/lib/rolldown-config/constants.js.map +1 -1
- package/lib/rolldown-config/helpers.cjs +16 -1
- package/lib/rolldown-config/helpers.cjs.map +1 -1
- package/lib/rolldown-config/helpers.d.ts +14 -0
- package/lib/rolldown-config/helpers.js +16 -1
- package/lib/rolldown-config/helpers.js.map +1 -1
- package/lib/rolldown-config/input.cjs +8 -0
- package/lib/rolldown-config/input.cjs.map +1 -1
- package/lib/rolldown-config/input.d.ts +8 -0
- package/lib/rolldown-config/input.js +8 -0
- package/lib/rolldown-config/input.js.map +1 -1
- package/lib/rolldown-config/output.cjs +8 -0
- package/lib/rolldown-config/output.cjs.map +1 -1
- package/lib/rolldown-config/output.d.ts +8 -0
- package/lib/rolldown-config/output.js +8 -0
- package/lib/rolldown-config/output.js.map +1 -1
- package/lib/rolldown-config/plugins/circulars.cjs +4 -4
- package/lib/rolldown-config/plugins/circulars.cjs.map +1 -1
- package/lib/rolldown-config/plugins/circulars.d.ts +7 -4
- package/lib/rolldown-config/plugins/circulars.js +4 -4
- package/lib/rolldown-config/plugins/circulars.js.map +1 -1
- package/lib/rolldown-config/plugins/clean.cjs +10 -1
- package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
- package/lib/rolldown-config/plugins/clean.d.ts +10 -0
- package/lib/rolldown-config/plugins/clean.js +10 -1
- package/lib/rolldown-config/plugins/clean.js.map +1 -1
- package/lib/rolldown-config/plugins/externals.cjs +4 -3
- package/lib/rolldown-config/plugins/externals.cjs.map +1 -1
- package/lib/rolldown-config/plugins/externals.d.ts +7 -3
- package/lib/rolldown-config/plugins/externals.js +4 -3
- package/lib/rolldown-config/plugins/externals.js.map +1 -1
- package/lib/rolldown-config/plugins/index.cjs +6 -0
- package/lib/rolldown-config/plugins/index.cjs.map +1 -1
- package/lib/rolldown-config/plugins/index.d.ts +6 -0
- package/lib/rolldown-config/plugins/index.js +6 -0
- package/lib/rolldown-config/plugins/index.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.cjs +7 -0
- package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.cjs +15 -0
- package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.d.ts +15 -0
- package/lib/rolldown-config/plugins/typescript.config.js +15 -0
- package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.d.ts +10 -0
- package/lib/rolldown-config/plugins/typescript.fast.cjs +9 -1
- package/lib/rolldown-config/plugins/typescript.fast.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.fast.d.ts +10 -0
- package/lib/rolldown-config/plugins/typescript.fast.js +9 -1
- package/lib/rolldown-config/plugins/typescript.fast.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.js +7 -0
- package/lib/rolldown-config/plugins/typescript.js.map +1 -1
- package/lib/rolldown-config/types.d.ts +18 -0
- package/lib/utils/array.cjs +7 -0
- package/lib/utils/array.cjs.map +1 -1
- package/lib/utils/array.d.ts +8 -0
- package/lib/utils/array.js +7 -0
- package/lib/utils/array.js.map +1 -1
- package/lib/utils/bemedev/globals/types.d.ts +20 -0
- package/lib/utils/bemedev/globals/utils/expandFn.cjs +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.cjs.map +1 -1
- package/lib/utils/bemedev/globals/utils/expandFn.d.ts +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.js +11 -0
- package/lib/utils/bemedev/globals/utils/expandFn.js.map +1 -1
- package/lib/utils/identity.cjs +9 -0
- package/lib/utils/identity.cjs.map +1 -1
- package/lib/utils/identity.d.ts +9 -0
- package/lib/utils/identity.js +9 -0
- package/lib/utils/identity.js.map +1 -1
- package/lib/utils/sleep.cjs +7 -0
- package/lib/utils/sleep.cjs.map +1 -1
- package/lib/utils/sleep.d.ts +7 -0
- package/lib/utils/sleep.js +7 -0
- package/lib/utils/sleep.js.map +1 -1
- package/lib/utils/types.d.ts +9 -0
- package/lib/vitest-exclude/constants.cjs +3 -0
- package/lib/vitest-exclude/constants.cjs.map +1 -1
- package/lib/vitest-exclude/constants.d.ts +3 -0
- package/lib/vitest-exclude/constants.js +3 -0
- package/lib/vitest-exclude/constants.js.map +1 -1
- package/lib/vitest-exclude/types.d.ts +11 -0
- package/lib/vitest-exclude/vitest.cjs +25 -12
- package/lib/vitest-exclude/vitest.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.d.ts +9 -8
- package/lib/vitest-exclude/vitest.js +25 -12
- package/lib/vitest-exclude/vitest.js.map +1 -1
- package/lib/vitest-exclude/vitest.utils.cjs +30 -0
- package/lib/vitest-exclude/vitest.utils.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.utils.d.ts +30 -0
- package/lib/vitest-exclude/vitest.utils.js +30 -0
- package/lib/vitest-exclude/vitest.utils.js.map +1 -1
- package/lib/vitest-extended/acceptation.cjs +11 -2
- package/lib/vitest-extended/acceptation.cjs.map +1 -1
- package/lib/vitest-extended/acceptation.d.ts +9 -1
- package/lib/vitest-extended/acceptation.js +11 -2
- package/lib/vitest-extended/acceptation.js.map +1 -1
- package/lib/vitest-extended/createTests.cjs +34 -27
- package/lib/vitest-extended/createTests.cjs.map +1 -1
- package/lib/vitest-extended/createTests.d.ts +20 -37
- package/lib/vitest-extended/createTests.js +34 -27
- package/lib/vitest-extended/createTests.js.map +1 -1
- package/lib/vitest-extended/createTests.types.d.ts +13 -2
- package/lib/vitest-extended/done.cjs +18 -15
- package/lib/vitest-extended/done.cjs.map +1 -1
- package/lib/vitest-extended/done.d.ts +6 -5
- package/lib/vitest-extended/done.js +18 -15
- package/lib/vitest-extended/done.js.map +1 -1
- package/lib/vitest-extended/each/error.cjs +12 -0
- package/lib/vitest-extended/each/error.cjs.map +1 -1
- package/lib/vitest-extended/each/error.d.ts +12 -0
- package/lib/vitest-extended/each/error.js +12 -0
- package/lib/vitest-extended/each/error.js.map +1 -1
- package/lib/vitest-extended/each/error.types.d.ts +17 -0
- package/lib/vitest-extended/each/pass.cjs +9 -20
- package/lib/vitest-extended/each/pass.cjs.map +1 -1
- package/lib/vitest-extended/each/pass.d.ts +9 -20
- package/lib/vitest-extended/each/pass.js +9 -20
- package/lib/vitest-extended/each/pass.js.map +1 -1
- package/lib/vitest-extended/each/pass.types.d.ts +24 -0
- package/lib/vitest-extended/fakeWaiter.cjs +7 -0
- package/lib/vitest-extended/fakeWaiter.cjs.map +1 -1
- package/lib/vitest-extended/fakeWaiter.d.ts +32 -0
- package/lib/vitest-extended/fakeWaiter.js +7 -0
- package/lib/vitest-extended/fakeWaiter.js.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.cjs +11 -0
- package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.js +11 -0
- package/lib/vitest-extended/fixtures/coverage.js.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.cjs +9 -4
- package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.js +9 -4
- package/lib/vitest-extended/fixtures/partialCall.js.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.cjs +18 -0
- package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.js +18 -0
- package/lib/vitest-extended/fixtures/toUpper.js.map +1 -1
- package/lib/vitest-extended/fixtures/vitest.cjs +3 -0
- package/lib/vitest-extended/fixtures/vitest.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/vitest.js +3 -0
- package/lib/vitest-extended/fixtures/vitest.js.map +1 -1
- package/lib/vitest-extended/fixtures/zod.cjs +22 -0
- package/lib/vitest-extended/fixtures/zod.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/zod.js +22 -0
- package/lib/vitest-extended/fixtures/zod.js.map +1 -1
- package/lib/vitest-extended/identity.cjs +18 -0
- package/lib/vitest-extended/identity.cjs.map +1 -1
- package/lib/vitest-extended/identity.d.ts +18 -0
- package/lib/vitest-extended/identity.js +18 -0
- package/lib/vitest-extended/identity.js.map +1 -1
- package/lib/vitest-extended/isDefined.cjs +9 -0
- package/lib/vitest-extended/isDefined.cjs.map +1 -1
- package/lib/vitest-extended/isDefined.d.ts +9 -0
- package/lib/vitest-extended/isDefined.js +9 -0
- package/lib/vitest-extended/isDefined.js.map +1 -1
- package/lib/vitest-extended/isFunction.cjs +7 -0
- package/lib/vitest-extended/isFunction.cjs.map +1 -1
- package/lib/vitest-extended/isFunction.d.ts +7 -0
- package/lib/vitest-extended/isFunction.js +7 -0
- package/lib/vitest-extended/isFunction.js.map +1 -1
- package/lib/vitest-extended/project.cjs +7 -0
- package/lib/vitest-extended/project.cjs.map +1 -1
- package/lib/vitest-extended/project.d.ts +7 -0
- package/lib/vitest-extended/project.js +7 -0
- package/lib/vitest-extended/project.js.map +1 -1
- package/lib/vitest-extended/toArray.cjs +6 -0
- package/lib/vitest-extended/toArray.cjs.map +1 -1
- package/lib/vitest-extended/toArray.d.ts +6 -0
- package/lib/vitest-extended/toArray.js +6 -0
- package/lib/vitest-extended/toArray.js.map +1 -1
- package/lib/vitest-extended/toStringFlat.cjs +8 -0
- package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
- package/lib/vitest-extended/toStringFlat.d.ts +8 -0
- package/lib/vitest-extended/toStringFlat.js +8 -0
- package/lib/vitest-extended/toStringFlat.js.map +1 -1
- package/lib/vitest-extended/types.d.ts +64 -0
- package/package.json +14 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\n\nimport ts from '@typescript/typescript6';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n const outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\n\nimport ts from '@typescript/typescript6';\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 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 * Rolldown plugin using `@typescript/typescript6` 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 typescript = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n const outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AA4BA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,MAElB,GAAG,oBAAoB;GAClD,OAAO;EACT;EACA,aAAa;GACX,OAAO;GACP,MAAM,UAAU;IACd,IAAI,MAAM;IACV,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAe,GAAG,eACtB,KACA,YACA,eACF;IAEA,MAAM,aAAa,aAAa,YAAY;IAC5C,MAAM,OAAO,GAAG,mBAAmB,WAAW,OAAO;IACrD,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAE5C,MAAM,SAAS,GAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAG,QAAQ,OAAO,GAAG,MAAM;KACrC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;KACF;IACF,GACA,GAAG,KACH,GACF;IAEA,MAAM,UAAU,GAAG,cACjB,OAAO,WACP;KACE,GAAG,WAAW;KACd;KACA,QAAQ;KACR,qBAAqB;KACrB,aAAa;KACb;IACF,GACA,IACF;IAEA,MAAM,aAAa,QAAQ,KAAK;IAEhC,MAAM,SAAS,GACZ,sBAAsB,OAAO,CAAC,CAC9B,OAAO,WAAW,WAAW,CAAC,CAC9B,QAAO,MAAK,EAAE,aAAa,GAAG,mBAAmB,KAAK;IAEzD,IAAI,OAAO,SAAS,GAClB,QAAQ,MACN,GAAG,qCAAqC,QAAQ,IAAI,CACtD;IAGF,MAAM,qBAAqB;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import type { RolldownPluginOption, RolldownOptions } from 'rolldown';
|
|
2
2
|
export type { RolldownOptions };
|
|
3
3
|
import type { PLUGIN_BUILDERS } from './plugins';
|
|
4
|
+
/**
|
|
5
|
+
* Normalizes a single value, array, null, or undefined into an array.
|
|
6
|
+
*
|
|
7
|
+
* @template `T` - Item type.
|
|
8
|
+
*
|
|
9
|
+
* @param value - Optional single value or array.
|
|
10
|
+
*
|
|
11
|
+
* @returns Array containing the value(s).
|
|
12
|
+
*/
|
|
4
13
|
export type ToArray_F = <T>(value?: T | T[]) => T[];
|
|
14
|
+
/**
|
|
15
|
+
* Configuration parameters for Rolldown bundle generation.
|
|
16
|
+
*/
|
|
5
17
|
export type Params = {
|
|
6
18
|
circularDeps?: string | string[];
|
|
7
19
|
excludesTS?: string | string[];
|
|
@@ -12,7 +24,13 @@ export type Params = {
|
|
|
12
24
|
declarationMap?: boolean;
|
|
13
25
|
plugins?: (RolldownPluginOption | keyof typeof PLUGIN_BUILDERS)[];
|
|
14
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Function type building the input entry points record from glob patterns.
|
|
29
|
+
*/
|
|
15
30
|
export type BuildInput_F = (...ignores: string[]) => Record<string, string>;
|
|
31
|
+
/**
|
|
32
|
+
* Rolldown configuration generator with predefined presets (`bemedev`, `fast`, `default`).
|
|
33
|
+
*/
|
|
16
34
|
export type Config_F = {
|
|
17
35
|
(additionals?: Params): RolldownOptions;
|
|
18
36
|
bemedev: (additionals?: Params) => RolldownOptions;
|
package/lib/utils/array.cjs
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/utils/array.ts
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes a single value, array, null, or undefined into an array.
|
|
5
|
+
*
|
|
6
|
+
* @param value - Value to normalize.
|
|
7
|
+
*
|
|
8
|
+
* @returns Array containing the value, or empty array if null/undefined.
|
|
9
|
+
*/
|
|
3
10
|
const toArray = (value) => {
|
|
4
11
|
if (value === void 0 || value === null) return [];
|
|
5
12
|
if (Array.isArray(value)) return value;
|
package/lib/utils/array.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.cjs","names":[],"sources":["../../src/utils/array.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"array.cjs","names":[],"sources":["../../src/utils/array.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\n/**\n * Normalizes a single value, array, null, or undefined into an array.\n *\n * @param value - Value to normalize.\n *\n * @returns Array containing the value, or empty array if null/undefined.\n */\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n\nexport { type ToArray_F };\n"],"mappings":";;;;;;;;;AASA,MAAa,WAAqB,UAAS;CAGzC,IAFe,UAAU,KAAA,KAAa,UAAU,MAEpC,OAAO,CAAC;CACpB,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;CAEjC,OAAO,CAAC,KAAK;AACf"}
|
package/lib/utils/array.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { ToArray_F } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a single value, array, null, or undefined into an array.
|
|
4
|
+
*
|
|
5
|
+
* @param value - Value to normalize.
|
|
6
|
+
*
|
|
7
|
+
* @returns Array containing the value, or empty array if null/undefined.
|
|
8
|
+
*/
|
|
2
9
|
export declare const toArray: ToArray_F;
|
|
10
|
+
export { type ToArray_F };
|
package/lib/utils/array.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
//#region src/utils/array.ts
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a single value, array, null, or undefined into an array.
|
|
4
|
+
*
|
|
5
|
+
* @param value - Value to normalize.
|
|
6
|
+
*
|
|
7
|
+
* @returns Array containing the value, or empty array if null/undefined.
|
|
8
|
+
*/
|
|
2
9
|
const toArray = (value) => {
|
|
3
10
|
if (value === void 0 || value === null) return [];
|
|
4
11
|
if (Array.isArray(value)) return value;
|
package/lib/utils/array.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"array.js","names":[],"sources":["../../src/utils/array.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"array.js","names":[],"sources":["../../src/utils/array.ts"],"sourcesContent":["import type { ToArray_F } from './types';\n\n/**\n * Normalizes a single value, array, null, or undefined into an array.\n *\n * @param value - Value to normalize.\n *\n * @returns Array containing the value, or empty array if null/undefined.\n */\nexport const toArray: ToArray_F = value => {\n const check1 = value === undefined || value === null;\n\n if (check1) return [];\n if (Array.isArray(value)) return value;\n\n return [value];\n};\n\nexport { type ToArray_F };\n"],"mappings":";;;;;;;;AASA,MAAa,WAAqB,UAAS;CAGzC,IAFe,UAAU,KAAA,KAAa,UAAU,MAEpC,OAAO,CAAC;CACpB,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;CAEjC,OAAO,CAAC,KAAK;AACf"}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic function type signature.
|
|
3
|
+
*
|
|
4
|
+
* @template | {@linkcode any[]} `Args` - Function arguments tuple type.
|
|
5
|
+
* @template `R` - Return type.
|
|
6
|
+
*/
|
|
1
7
|
export type Fn<Args extends any[] = any[], R = any> = (...args: Args) => R;
|
|
8
|
+
/**
|
|
9
|
+
* Composite function type combined with additional properties.
|
|
10
|
+
*
|
|
11
|
+
* @template | {@linkcode Fn} `Main` - Base function type.
|
|
12
|
+
* @template | {@linkcode object} `Tr` - Extension properties object type.
|
|
13
|
+
*/
|
|
2
14
|
export type FnBasic<Main extends Fn, Tr extends object> = Tr & Main;
|
|
15
|
+
/**
|
|
16
|
+
* Readonly unknown array alias.
|
|
17
|
+
*/
|
|
3
18
|
export type RuA = readonly unknown[];
|
|
19
|
+
/**
|
|
20
|
+
* Nullable or undefinable type wrapper.
|
|
21
|
+
*
|
|
22
|
+
* @template `T` - Inner type.
|
|
23
|
+
*/
|
|
4
24
|
export type Undefiny<T> = T | undefined | null;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/utils/bemedev/globals/utils/expandFn.ts
|
|
3
|
+
/**
|
|
4
|
+
* Augments a function with additional object properties.
|
|
5
|
+
*
|
|
6
|
+
* @template | {@linkcode Fn} `Main` - Base function type.
|
|
7
|
+
* @template | {@linkcode object} `Tr` - Extension properties shape.
|
|
8
|
+
*
|
|
9
|
+
* @param main - Base function to extend of type {@linkcode Fn}.
|
|
10
|
+
* @param extensions - Optional extension properties object.
|
|
11
|
+
*
|
|
12
|
+
* @returns Extended function of type {@linkcode FnBasic}.
|
|
13
|
+
*/
|
|
3
14
|
const expandFn = (main, extensions) => {
|
|
4
15
|
const out = main;
|
|
5
16
|
if (extensions) Object.assign(out, extensions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandFn.cjs","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from '../types';\n\nexport const expandFn = <\n Main extends Fn,\n const Tr extends object = object,\n>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n if (extensions) {\n Object.assign(out, extensions);\n }\n\n return out;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"expandFn.cjs","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from '../types';\n\n/**\n * Augments a function with additional object properties.\n *\n * @template | {@linkcode Fn} `Main` - Base function type.\n * @template | {@linkcode object} `Tr` - Extension properties shape.\n *\n * @param main - Base function to extend of type {@linkcode Fn}.\n * @param extensions - Optional extension properties object.\n *\n * @returns Extended function of type {@linkcode FnBasic}.\n */\nexport const expandFn = <\n Main extends Fn,\n const Tr extends object = object,\n>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n if (extensions) {\n Object.assign(out, extensions);\n }\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,YAIX,MACA,eACsB;CACtB,MAAM,MAAW;CAEjB,IAAI,YACF,OAAO,OAAO,KAAK,UAAU;CAG/B,OAAO;AACT"}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { Fn, FnBasic } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Augments a function with additional object properties.
|
|
4
|
+
*
|
|
5
|
+
* @template | {@linkcode Fn} `Main` - Base function type.
|
|
6
|
+
* @template | {@linkcode object} `Tr` - Extension properties shape.
|
|
7
|
+
*
|
|
8
|
+
* @param main - Base function to extend of type {@linkcode Fn}.
|
|
9
|
+
* @param extensions - Optional extension properties object.
|
|
10
|
+
*
|
|
11
|
+
* @returns Extended function of type {@linkcode FnBasic}.
|
|
12
|
+
*/
|
|
2
13
|
export declare const expandFn: <Main extends Fn, const Tr extends object = object>(main: Main, extensions?: Tr) => FnBasic<Main, Tr>;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
//#region src/utils/bemedev/globals/utils/expandFn.ts
|
|
2
|
+
/**
|
|
3
|
+
* Augments a function with additional object properties.
|
|
4
|
+
*
|
|
5
|
+
* @template | {@linkcode Fn} `Main` - Base function type.
|
|
6
|
+
* @template | {@linkcode object} `Tr` - Extension properties shape.
|
|
7
|
+
*
|
|
8
|
+
* @param main - Base function to extend of type {@linkcode Fn}.
|
|
9
|
+
* @param extensions - Optional extension properties object.
|
|
10
|
+
*
|
|
11
|
+
* @returns Extended function of type {@linkcode FnBasic}.
|
|
12
|
+
*/
|
|
2
13
|
const expandFn = (main, extensions) => {
|
|
3
14
|
const out = main;
|
|
4
15
|
if (extensions) Object.assign(out, extensions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandFn.js","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from '../types';\n\nexport const expandFn = <\n Main extends Fn,\n const Tr extends object = object,\n>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n if (extensions) {\n Object.assign(out, extensions);\n }\n\n return out;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"expandFn.js","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from '../types';\n\n/**\n * Augments a function with additional object properties.\n *\n * @template | {@linkcode Fn} `Main` - Base function type.\n * @template | {@linkcode object} `Tr` - Extension properties shape.\n *\n * @param main - Base function to extend of type {@linkcode Fn}.\n * @param extensions - Optional extension properties object.\n *\n * @returns Extended function of type {@linkcode FnBasic}.\n */\nexport const expandFn = <\n Main extends Fn,\n const Tr extends object = object,\n>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n if (extensions) {\n Object.assign(out, extensions);\n }\n\n return out;\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,YAIX,MACA,eACsB;CACtB,MAAM,MAAW;CAEjB,IAAI,YACF,OAAO,OAAO,KAAK,UAAU;CAG/B,OAAO;AACT"}
|
package/lib/utils/identity.cjs
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/utils/identity.ts
|
|
3
|
+
/**
|
|
4
|
+
* Identity function returning the input value unchanged.
|
|
5
|
+
*
|
|
6
|
+
* @template `T` - Type of the input value.
|
|
7
|
+
*
|
|
8
|
+
* @param x - Input value.
|
|
9
|
+
*
|
|
10
|
+
* @returns The input value `x`.
|
|
11
|
+
*/
|
|
3
12
|
const identity = (x) => x;
|
|
4
13
|
//#endregion
|
|
5
14
|
exports.identity = identity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.cjs","names":[],"sources":["../../src/utils/identity.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"identity.cjs","names":[],"sources":["../../src/utils/identity.ts"],"sourcesContent":["/**\n * Identity function returning the input value unchanged.\n *\n * @template `T` - Type of the input value.\n *\n * @param x - Input value.\n *\n * @returns The input value `x`.\n */\nexport const identity = <T>(x: T) => x;\n"],"mappings":";;;;;;;;;;;AASA,MAAa,YAAe,MAAS"}
|
package/lib/utils/identity.d.ts
CHANGED
package/lib/utils/identity.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
//#region src/utils/identity.ts
|
|
2
|
+
/**
|
|
3
|
+
* Identity function returning the input value unchanged.
|
|
4
|
+
*
|
|
5
|
+
* @template `T` - Type of the input value.
|
|
6
|
+
*
|
|
7
|
+
* @param x - Input value.
|
|
8
|
+
*
|
|
9
|
+
* @returns The input value `x`.
|
|
10
|
+
*/
|
|
2
11
|
const identity = (x) => x;
|
|
3
12
|
//#endregion
|
|
4
13
|
export { identity };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","names":[],"sources":["../../src/utils/identity.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"identity.js","names":[],"sources":["../../src/utils/identity.ts"],"sourcesContent":["/**\n * Identity function returning the input value unchanged.\n *\n * @template `T` - Type of the input value.\n *\n * @param x - Input value.\n *\n * @returns The input value `x`.\n */\nexport const identity = <T>(x: T) => x;\n"],"mappings":";;;;;;;;;;AASA,MAAa,YAAe,MAAS"}
|
package/lib/utils/sleep.cjs
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/utils/sleep.ts
|
|
3
|
+
/**
|
|
4
|
+
* Asynchronously pauses execution for a given number of milliseconds.
|
|
5
|
+
*
|
|
6
|
+
* @param ms - Delay duration in milliseconds.
|
|
7
|
+
*
|
|
8
|
+
* @returns A promise that resolves after the specified delay.
|
|
9
|
+
*/
|
|
3
10
|
const sleep = (ms) => {
|
|
4
11
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
12
|
};
|
package/lib/utils/sleep.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.cjs","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"sleep.cjs","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["/**\n * Asynchronously pauses execution for a given number of milliseconds.\n *\n * @param ms - Delay duration in milliseconds.\n *\n * @returns A promise that resolves after the specified delay.\n */\nexport const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";;;;;;;;;AAOA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,EAAE,CAAC;AACvD"}
|
package/lib/utils/sleep.d.ts
CHANGED
package/lib/utils/sleep.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
//#region src/utils/sleep.ts
|
|
2
|
+
/**
|
|
3
|
+
* Asynchronously pauses execution for a given number of milliseconds.
|
|
4
|
+
*
|
|
5
|
+
* @param ms - Delay duration in milliseconds.
|
|
6
|
+
*
|
|
7
|
+
* @returns A promise that resolves after the specified delay.
|
|
8
|
+
*/
|
|
2
9
|
const sleep = (ms) => {
|
|
3
10
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
4
11
|
};
|
package/lib/utils/sleep.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.js","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"sleep.js","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["/**\n * Asynchronously pauses execution for a given number of milliseconds.\n *\n * @param ms - Delay duration in milliseconds.\n *\n * @returns A promise that resolves after the specified delay.\n */\nexport const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";;;;;;;;AAOA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,EAAE,CAAC;AACvD"}
|
package/lib/utils/types.d.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
export * from './bemedev/globals/types';
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a single value, array, null, or undefined into an array.
|
|
4
|
+
*
|
|
5
|
+
* @template `T` - Item type.
|
|
6
|
+
*
|
|
7
|
+
* @param value - Optional single value or array.
|
|
8
|
+
*
|
|
9
|
+
* @returns Array containing the value(s).
|
|
10
|
+
*/
|
|
2
11
|
export type ToArray_F = <T>(value?: T | T[]) => T[];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
//#region src/vitest-exclude/constants.ts
|
|
3
|
+
/**
|
|
4
|
+
* Package name identifier for the exclude-coverage plugin.
|
|
5
|
+
*/
|
|
3
6
|
const name = "@bemedev/exclude-coverage";
|
|
4
7
|
//#endregion
|
|
5
8
|
exports.name = name;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","names":[],"sources":["../../src/vitest-exclude/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":[],"sources":["../../src/vitest-exclude/constants.ts"],"sourcesContent":["/**\n * Package name identifier for the exclude-coverage plugin.\n */\nexport const name = '@bemedev/exclude-coverage';\n"],"mappings":";;;;;AAGA,MAAa,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":[],"sources":["../../src/vitest-exclude/constants.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../src/vitest-exclude/constants.ts"],"sourcesContent":["/**\n * Package name identifier for the exclude-coverage plugin.\n */\nexport const name = '@bemedev/exclude-coverage';\n"],"mappings":";;;;AAGA,MAAa,OAAO"}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { Plugin } from 'vitest/config';
|
|
2
|
+
/**
|
|
3
|
+
* Type helper to exclude undefined from a type.
|
|
4
|
+
*
|
|
5
|
+
* @template `T` - Base type.
|
|
6
|
+
*/
|
|
2
7
|
export type Define<T> = Exclude<T, undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* Argument tuple for glob pattern configuration and exclusions.
|
|
10
|
+
*/
|
|
3
11
|
export type Args = [
|
|
4
12
|
{
|
|
5
13
|
patternTest: string | string[];
|
|
@@ -10,4 +18,7 @@ export type Args = [
|
|
|
10
18
|
ignoreCoverageFiles?: string[];
|
|
11
19
|
}
|
|
12
20
|
];
|
|
21
|
+
/**
|
|
22
|
+
* Function type creating a Vitest plugin with explicit patterns.
|
|
23
|
+
*/
|
|
13
24
|
export type WithPattern = (...args: Args) => Plugin;
|
|
@@ -3,10 +3,12 @@ const require_vitest_exclude_vitest_utils = require("./vitest.utils.cjs");
|
|
|
3
3
|
const require_vitest_exclude_constants = require("./constants.cjs");
|
|
4
4
|
//#region src/vitest-exclude/vitest.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Creates include arrays for test and coverage files from glob patterns.
|
|
7
7
|
*
|
|
8
|
-
* @param args
|
|
9
|
-
* @
|
|
8
|
+
* @param args - Glob patterns to ignore for test and coverage files.
|
|
9
|
+
* @param root - Optional root directory path.
|
|
10
|
+
*
|
|
11
|
+
* @returns An object with resolved `files` and `coverage` string arrays.
|
|
10
12
|
*/
|
|
11
13
|
async function create(args = {}, root) {
|
|
12
14
|
const firsts = {
|
|
@@ -15,6 +17,17 @@ async function create(args = {}, root) {
|
|
|
15
17
|
};
|
|
16
18
|
return create.withPattern(firsts, args, root);
|
|
17
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates include arrays using custom test and coverage glob patterns.
|
|
22
|
+
*
|
|
23
|
+
* @param patterns - Custom test and coverage pattern object.
|
|
24
|
+
* @param patterns.patternTest - Glob pattern for test files.
|
|
25
|
+
* @param patterns.patternCov - Glob pattern for coverage files.
|
|
26
|
+
* @param args - Ignore options for tests and coverage.
|
|
27
|
+
* @param root - Optional root directory path.
|
|
28
|
+
*
|
|
29
|
+
* @returns An object with resolved `files` and `coverage` string arrays.
|
|
30
|
+
*/
|
|
18
31
|
create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles, ignoreCoverageFiles } = {}, root) => {
|
|
19
32
|
return {
|
|
20
33
|
files: await require_vitest_exclude_vitest_utils.buildInclude(patternTest ?? require_vitest_exclude_vitest_utils.testPattern(root), ignoreTestFiles, root),
|
|
@@ -22,12 +35,11 @@ create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles,
|
|
|
22
35
|
};
|
|
23
36
|
};
|
|
24
37
|
/**
|
|
25
|
-
*
|
|
38
|
+
* Vitest plugin to configure test and coverage file inclusion via glob patterns.
|
|
39
|
+
*
|
|
40
|
+
* @param args - Globs to ignore for test and coverage files.
|
|
26
41
|
*
|
|
27
|
-
* @
|
|
28
|
-
* @param ignore Globs to exclude inside
|
|
29
|
-
* @returns A vitest config
|
|
30
|
-
* @see {@link exclude.withPattern}
|
|
42
|
+
* @returns Vitest plugin of type {@linkcode Plugin}.
|
|
31
43
|
*/
|
|
32
44
|
function exclude(args = {}) {
|
|
33
45
|
return {
|
|
@@ -61,11 +73,12 @@ function exclude(args = {}) {
|
|
|
61
73
|
};
|
|
62
74
|
}
|
|
63
75
|
/**
|
|
64
|
-
*
|
|
76
|
+
* Vitest plugin to configure test and coverage file inclusion with custom search patterns.
|
|
77
|
+
*
|
|
78
|
+
* @param patterns - Custom test and coverage glob patterns.
|
|
79
|
+
* @param ignore - Globs to exclude.
|
|
65
80
|
*
|
|
66
|
-
* @
|
|
67
|
-
* @param ignore Globs to exclude inside
|
|
68
|
-
* @returns A vitest config
|
|
81
|
+
* @returns Vitest plugin of type {@linkcode Plugin}.
|
|
69
82
|
*/
|
|
70
83
|
exclude.withPattern = (({ patternTest, patternCov }, { ignoreCoverageFiles, ignoreTestFiles }) => {
|
|
71
84
|
return {
|
|
@@ -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 {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n *
|
|
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 {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} 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":";;;;;;;;;;;;AAkBA,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;EACL,MAAA,iCAAA;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,aAAaA,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;EACL,MAAA,iCAAA;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,10 +1,12 @@
|
|
|
1
1
|
import type { Plugin } from 'vitest/config';
|
|
2
2
|
import type { Args, WithPattern } from './types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Creates include arrays for test and coverage files from glob patterns.
|
|
5
5
|
*
|
|
6
|
-
* @param args
|
|
7
|
-
* @
|
|
6
|
+
* @param args - Glob patterns to ignore for test and coverage files.
|
|
7
|
+
* @param root - Optional root directory path.
|
|
8
|
+
*
|
|
9
|
+
* @returns An object with resolved `files` and `coverage` string arrays.
|
|
8
10
|
*/
|
|
9
11
|
export declare function create(args?: Args[1], root?: string): Promise<{
|
|
10
12
|
files: string[];
|
|
@@ -17,12 +19,11 @@ export declare namespace create {
|
|
|
17
19
|
}>;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* Vitest plugin to configure test and coverage file inclusion via glob patterns.
|
|
23
|
+
*
|
|
24
|
+
* @param args - Globs to ignore for test and coverage files.
|
|
21
25
|
*
|
|
22
|
-
* @
|
|
23
|
-
* @param ignore Globs to exclude inside
|
|
24
|
-
* @returns A vitest config
|
|
25
|
-
* @see {@link exclude.withPattern}
|
|
26
|
+
* @returns Vitest plugin of type {@linkcode Plugin}.
|
|
26
27
|
*/
|
|
27
28
|
export declare function exclude(args?: Args[1]): Plugin;
|
|
28
29
|
export declare namespace exclude {
|
|
@@ -2,10 +2,12 @@ import { buildInclude, defaultCovPattern, testPattern } from "./vitest.utils.js"
|
|
|
2
2
|
import { name } from "./constants.js";
|
|
3
3
|
//#region src/vitest-exclude/vitest.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Creates include arrays for test and coverage files from glob patterns.
|
|
6
6
|
*
|
|
7
|
-
* @param args
|
|
8
|
-
* @
|
|
7
|
+
* @param args - Glob patterns to ignore for test and coverage files.
|
|
8
|
+
* @param root - Optional root directory path.
|
|
9
|
+
*
|
|
10
|
+
* @returns An object with resolved `files` and `coverage` string arrays.
|
|
9
11
|
*/
|
|
10
12
|
async function create(args = {}, root) {
|
|
11
13
|
const firsts = {
|
|
@@ -14,6 +16,17 @@ async function create(args = {}, root) {
|
|
|
14
16
|
};
|
|
15
17
|
return create.withPattern(firsts, args, root);
|
|
16
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates include arrays using custom test and coverage glob patterns.
|
|
21
|
+
*
|
|
22
|
+
* @param patterns - Custom test and coverage pattern object.
|
|
23
|
+
* @param patterns.patternTest - Glob pattern for test files.
|
|
24
|
+
* @param patterns.patternCov - Glob pattern for coverage files.
|
|
25
|
+
* @param args - Ignore options for tests and coverage.
|
|
26
|
+
* @param root - Optional root directory path.
|
|
27
|
+
*
|
|
28
|
+
* @returns An object with resolved `files` and `coverage` string arrays.
|
|
29
|
+
*/
|
|
17
30
|
create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles, ignoreCoverageFiles } = {}, root) => {
|
|
18
31
|
return {
|
|
19
32
|
files: await buildInclude(patternTest ?? testPattern(root), ignoreTestFiles, root),
|
|
@@ -21,12 +34,11 @@ create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles,
|
|
|
21
34
|
};
|
|
22
35
|
};
|
|
23
36
|
/**
|
|
24
|
-
*
|
|
37
|
+
* Vitest plugin to configure test and coverage file inclusion via glob patterns.
|
|
38
|
+
*
|
|
39
|
+
* @param args - Globs to ignore for test and coverage files.
|
|
25
40
|
*
|
|
26
|
-
* @
|
|
27
|
-
* @param ignore Globs to exclude inside
|
|
28
|
-
* @returns A vitest config
|
|
29
|
-
* @see {@link exclude.withPattern}
|
|
41
|
+
* @returns Vitest plugin of type {@linkcode Plugin}.
|
|
30
42
|
*/
|
|
31
43
|
function exclude(args = {}) {
|
|
32
44
|
return {
|
|
@@ -60,11 +72,12 @@ function exclude(args = {}) {
|
|
|
60
72
|
};
|
|
61
73
|
}
|
|
62
74
|
/**
|
|
63
|
-
*
|
|
75
|
+
* Vitest plugin to configure test and coverage file inclusion with custom search patterns.
|
|
76
|
+
*
|
|
77
|
+
* @param patterns - Custom test and coverage glob patterns.
|
|
78
|
+
* @param ignore - Globs to exclude.
|
|
64
79
|
*
|
|
65
|
-
* @
|
|
66
|
-
* @param ignore Globs to exclude inside
|
|
67
|
-
* @returns A vitest config
|
|
80
|
+
* @returns Vitest plugin of type {@linkcode Plugin}.
|
|
68
81
|
*/
|
|
69
82
|
exclude.withPattern = (({ patternTest, patternCov }, { ignoreCoverageFiles, ignoreTestFiles }) => {
|
|
70
83
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.js","names":[],"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 {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"vitest.js","names":[],"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 {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} 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":";;;;;;;;;;;AAkBA,eAAsB,OAAO,OAAgB,CAAC,GAAG,MAAe;CAC9D,MAAM,SAAS;EACb,aAAa,YAAY,IAAI;EAC7B,YAAY,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,MAVW,aAClB,eAAe,YAAY,IAAI,GAC/B,iBACA,IACF;EAMgB,UAAA,MALO,aACrB,cAAc,kBAAkB,IAAI,GACpC,qBACA,IACF;CACyB;AAC3B;;;;;;;;AASA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,OAAO;EACL;EACA,QAAQ,OAAM,YAAW;GACvB,MAAM,OAAO,SAAS,QAAQ,QAAQ,IAAI;GAC1C,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,aAAa,kBAAkB,IAAI;GACzC,MAAM,cAAc,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;EACL;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"}
|