@bemedev/dev-utils 0.6.11 → 0.8.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 +16 -12
- package/lib/build-tests/addTarball.cjs.map +1 -1
- package/lib/build-tests/addTarball.js.map +1 -1
- package/lib/build-tests/buildPackageJson.cjs.map +1 -1
- package/lib/build-tests/buildPackageJson.js.map +1 -1
- package/lib/build-tests/cleanup.cjs.map +1 -1
- package/lib/build-tests/cleanup.js.map +1 -1
- package/lib/build-tests/cli/cli.cjs +0 -1
- package/lib/build-tests/cli/cli.cjs.map +1 -1
- package/lib/build-tests/cli/cli.js.map +1 -1
- package/lib/build-tests/cli/index.cjs +0 -1
- package/lib/build-tests/cli/index.cjs.map +1 -1
- package/lib/build-tests/cli/index.js +0 -0
- package/lib/build-tests/cli/index.js.map +1 -1
- package/lib/build-tests/cli/post.cjs +0 -1
- package/lib/build-tests/cli/post.cjs.map +1 -1
- package/lib/build-tests/cli/post.js.map +1 -1
- package/lib/build-tests/cli/pre.cjs +0 -1
- package/lib/build-tests/cli/pre.cjs.map +1 -1
- package/lib/build-tests/cli/pre.js.map +1 -1
- package/lib/build-tests/cli/test.cjs.map +1 -1
- package/lib/build-tests/cli/test.js.map +1 -1
- package/lib/build-tests/constants.cjs.map +1 -1
- package/lib/build-tests/constants.js.map +1 -1
- package/lib/build-tests/getRelativePath.cjs +0 -1
- package/lib/build-tests/getRelativePath.cjs.map +1 -1
- package/lib/build-tests/getRelativePath.js.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.cjs.map +1 -1
- package/lib/build-tests/getTypescriptOutdir.js.map +1 -1
- package/lib/build-tests/import.cjs.map +1 -1
- package/lib/build-tests/import.js.map +1 -1
- package/lib/build-tests/imports/create.cjs +0 -1
- package/lib/build-tests/imports/create.cjs.map +1 -1
- package/lib/build-tests/imports/create.js.map +1 -1
- package/lib/build-tests/imports/helper.cjs +0 -1
- package/lib/build-tests/imports/helper.cjs.map +1 -1
- package/lib/build-tests/imports/helper.js.map +1 -1
- package/lib/build-tests/pack.cjs.map +1 -1
- package/lib/build-tests/pack.js.map +1 -1
- package/lib/rolldown-config/config.cjs +0 -1
- package/lib/rolldown-config/config.cjs.map +1 -1
- package/lib/rolldown-config/config.js.map +1 -1
- package/lib/rolldown-config/constants.cjs.map +1 -1
- package/lib/rolldown-config/constants.js.map +1 -1
- package/lib/rolldown-config/helpers.cjs +0 -1
- package/lib/rolldown-config/helpers.cjs.map +1 -1
- package/lib/rolldown-config/helpers.js.map +1 -1
- package/lib/rolldown-config/input.cjs +0 -1
- package/lib/rolldown-config/input.cjs.map +1 -1
- package/lib/rolldown-config/input.js.map +1 -1
- package/lib/rolldown-config/output.cjs.map +1 -1
- package/lib/rolldown-config/output.js.map +1 -1
- package/lib/rolldown-config/plugins/alias.cjs.map +1 -1
- package/lib/rolldown-config/plugins/alias.js.map +1 -1
- package/lib/rolldown-config/plugins/circulars.cjs +0 -1
- package/lib/rolldown-config/plugins/circulars.cjs.map +1 -1
- package/lib/rolldown-config/plugins/circulars.js.map +1 -1
- package/lib/rolldown-config/plugins/clean.cjs +0 -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/externals.cjs +0 -1
- package/lib/rolldown-config/plugins/externals.cjs.map +1 -1
- package/lib/rolldown-config/plugins/externals.js.map +1 -1
- package/lib/rolldown-config/plugins/index.cjs.map +1 -1
- package/lib/rolldown-config/plugins/index.js.map +1 -1
- package/lib/rolldown-config/plugins/tsPaths.cjs.map +1 -1
- package/lib/rolldown-config/plugins/tsPaths.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.cjs +1 -1
- package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
- package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
- package/lib/rolldown-config/plugins/typescript.js +1 -1
- package/lib/rolldown-config/plugins/typescript.js.map +1 -1
- package/lib/rolldown-config/utils.cjs.map +1 -1
- package/lib/rolldown-config/utils.js.map +1 -1
- package/lib/utils/sleep.cjs.map +1 -1
- package/lib/utils/sleep.js.map +1 -1
- package/lib/vitest-alias/vitest.cjs +21 -12
- package/lib/vitest-alias/vitest.cjs.map +1 -1
- package/lib/vitest-alias/vitest.d.ts +3 -8
- package/lib/vitest-alias/vitest.js +20 -12
- package/lib/vitest-alias/vitest.js.map +1 -1
- package/lib/vitest-exclude/vitest.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.js.map +1 -1
- package/lib/vitest-exclude/vitest.utils.cjs +0 -1
- package/lib/vitest-exclude/vitest.utils.cjs.map +1 -1
- package/lib/vitest-exclude/vitest.utils.js.map +1 -1
- package/lib/vitest-extended/acceptation.cjs +0 -1
- package/lib/vitest-extended/acceptation.cjs.map +1 -1
- package/lib/vitest-extended/acceptation.js.map +1 -1
- package/lib/vitest-extended/createTests.cjs +0 -1
- package/lib/vitest-extended/createTests.cjs.map +1 -1
- package/lib/vitest-extended/createTests.js.map +1 -1
- package/lib/vitest-extended/done.cjs +0 -1
- package/lib/vitest-extended/done.cjs.map +1 -1
- package/lib/vitest-extended/done.js.map +1 -1
- package/lib/vitest-extended/each/error.cjs +0 -1
- package/lib/vitest-extended/each/error.cjs.map +1 -1
- package/lib/vitest-extended/each/error.js.map +1 -1
- package/lib/vitest-extended/each/pass.cjs +0 -1
- package/lib/vitest-extended/each/pass.cjs.map +1 -1
- package/lib/vitest-extended/each/pass.js.map +1 -1
- package/lib/vitest-extended/fakeWaiter.cjs.map +1 -1
- package/lib/vitest-extended/fakeWaiter.js.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/coverage.js.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/partialCall.js.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/toUpper.js.map +1 -1
- package/lib/vitest-extended/fixtures/zod.cjs.map +1 -1
- package/lib/vitest-extended/fixtures/zod.js.map +1 -1
- package/lib/vitest-extended/identity.cjs +0 -1
- package/lib/vitest-extended/identity.cjs.map +1 -1
- package/lib/vitest-extended/identity.js.map +1 -1
- package/lib/vitest-extended/index.d.ts +1 -0
- package/lib/vitest-extended/isDefined.cjs.map +1 -1
- package/lib/vitest-extended/isDefined.d.ts +1 -0
- package/lib/vitest-extended/isDefined.js.map +1 -1
- package/lib/vitest-extended/isFunction.cjs.map +1 -1
- package/lib/vitest-extended/isFunction.js.map +1 -1
- package/lib/vitest-extended/toArray.cjs.map +1 -1
- package/lib/vitest-extended/toArray.js.map +1 -1
- package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
- package/lib/vitest-extended/toStringFlat.js.map +1 -1
- package/lib/vitest-extended/types.d.ts +1 -1
- package/package.json +44 -46
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.cjs","names":[],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nexport const buildOutput = (dir: string, sourcemap: boolean) => {\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";;AAEA,MAAa,eAAe,KAAa,cAAuB;CAC9D,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB;EACA,iBAAiB;EACjB,gBAAgB;
|
|
1
|
+
{"version":3,"file":"output.cjs","names":[],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nexport const buildOutput = (dir: string, sourcemap: boolean) => {\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";;AAEA,MAAa,eAAe,KAAa,cAAuB;CAC9D,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB;EACA,iBAAiB;EACjB,gBAAgB;CAClB,GACA;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB;EACA,iBAAiB;EACjB,gBAAgB;CAClB,CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","names":[],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nexport const buildOutput = (dir: string, sourcemap: boolean) => {\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";AAEA,MAAa,eAAe,KAAa,cAAuB;CAC9D,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB;EACA,iBAAiB;EACjB,gBAAgB;
|
|
1
|
+
{"version":3,"file":"output.js","names":[],"sources":["../../src/rolldown-config/output.ts"],"sourcesContent":["import type { OutputOptions } from 'rolldown';\n\nexport const buildOutput = (dir: string, sourcemap: boolean) => {\n return [\n {\n format: 'es',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].js',\n },\n {\n format: 'cjs',\n sourcemap,\n preserveModulesRoot: 'src',\n dir,\n preserveModules: true,\n entryFileNames: '[name].cjs',\n },\n ] as const satisfies OutputOptions[];\n};\n"],"mappings":";AAEA,MAAa,eAAe,KAAa,cAAuB;CAC9D,OAAO,CACL;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB;EACA,iBAAiB;EACjB,gBAAgB;CAClB,GACA;EACE,QAAQ;EACR;EACA,qBAAqB;EACrB;EACA,iBAAiB;EACjB,gBAAgB;CAClB,CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alias.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/alias.ts"],"sourcesContent":["import type { Plugin } from 'rolldown';\n//@ts-expect-error for bundling\nimport tscAlias from 'rollup-plugin-tsc-alias';\n\nexport type AliasOptions = {\n /** path to tsconfig.json (relative to CWD) */\n configFile?: string;\n /** Observe file changes */\n watch?: boolean;\n /** Override outDir (relative path to tsconfig location) */\n outDir?: string;\n /** Override declarationDir (relative path to tsconfig location) */\n declarationDir?: string;\n /** Replace incomplete import paths with fully resolved paths (ESM compat) */\n resolveFullPaths?: boolean;\n /** Deprecated option; kept for compatibility */\n silent?: boolean;\n /** Extra replacer files to load */\n replacers?: string[];\n /** Custom output sink for tsc-alias logs */\n output?: unknown;\n};\n\n/**\n * Creates a configured tsc-alias plugin instance\n * @param options - Configuration options for tsc-alias\n * @returns Rolldown plugin\n */\nexport function alias(options: AliasOptions = {}): Plugin {\n return tscAlias(options);\n}\n"],"mappings":";;;;;;;;;;AA4BA,SAAgB,MAAM,UAAwB,
|
|
1
|
+
{"version":3,"file":"alias.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/alias.ts"],"sourcesContent":["import type { Plugin } from 'rolldown';\n//@ts-expect-error for bundling\nimport tscAlias from 'rollup-plugin-tsc-alias';\n\nexport type AliasOptions = {\n /** path to tsconfig.json (relative to CWD) */\n configFile?: string;\n /** Observe file changes */\n watch?: boolean;\n /** Override outDir (relative path to tsconfig location) */\n outDir?: string;\n /** Override declarationDir (relative path to tsconfig location) */\n declarationDir?: string;\n /** Replace incomplete import paths with fully resolved paths (ESM compat) */\n resolveFullPaths?: boolean;\n /** Deprecated option; kept for compatibility */\n silent?: boolean;\n /** Extra replacer files to load */\n replacers?: string[];\n /** Custom output sink for tsc-alias logs */\n output?: unknown;\n};\n\n/**\n * Creates a configured tsc-alias plugin instance\n * @param options - Configuration options for tsc-alias\n * @returns Rolldown plugin\n */\nexport function alias(options: AliasOptions = {}): Plugin {\n return tscAlias(options);\n}\n"],"mappings":";;;;;;;;;;AA4BA,SAAgB,MAAM,UAAwB,CAAC,GAAW;CACxD,QAAA,GAAA,wBAAA,QAAA,CAAgB,OAAO;AACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alias.js","names":[],"sources":["../../../src/rolldown-config/plugins/alias.ts"],"sourcesContent":["import type { Plugin } from 'rolldown';\n//@ts-expect-error for bundling\nimport tscAlias from 'rollup-plugin-tsc-alias';\n\nexport type AliasOptions = {\n /** path to tsconfig.json (relative to CWD) */\n configFile?: string;\n /** Observe file changes */\n watch?: boolean;\n /** Override outDir (relative path to tsconfig location) */\n outDir?: string;\n /** Override declarationDir (relative path to tsconfig location) */\n declarationDir?: string;\n /** Replace incomplete import paths with fully resolved paths (ESM compat) */\n resolveFullPaths?: boolean;\n /** Deprecated option; kept for compatibility */\n silent?: boolean;\n /** Extra replacer files to load */\n replacers?: string[];\n /** Custom output sink for tsc-alias logs */\n output?: unknown;\n};\n\n/**\n * Creates a configured tsc-alias plugin instance\n * @param options - Configuration options for tsc-alias\n * @returns Rolldown plugin\n */\nexport function alias(options: AliasOptions = {}): Plugin {\n return tscAlias(options);\n}\n"],"mappings":";;;;;;;AA4BA,SAAgB,MAAM,UAAwB,
|
|
1
|
+
{"version":3,"file":"alias.js","names":[],"sources":["../../../src/rolldown-config/plugins/alias.ts"],"sourcesContent":["import type { Plugin } from 'rolldown';\n//@ts-expect-error for bundling\nimport tscAlias from 'rollup-plugin-tsc-alias';\n\nexport type AliasOptions = {\n /** path to tsconfig.json (relative to CWD) */\n configFile?: string;\n /** Observe file changes */\n watch?: boolean;\n /** Override outDir (relative path to tsconfig location) */\n outDir?: string;\n /** Override declarationDir (relative path to tsconfig location) */\n declarationDir?: string;\n /** Replace incomplete import paths with fully resolved paths (ESM compat) */\n resolveFullPaths?: boolean;\n /** Deprecated option; kept for compatibility */\n silent?: boolean;\n /** Extra replacer files to load */\n replacers?: string[];\n /** Custom output sink for tsc-alias logs */\n output?: unknown;\n};\n\n/**\n * Creates a configured tsc-alias plugin instance\n * @param options - Configuration options for tsc-alias\n * @returns Rolldown plugin\n */\nexport function alias(options: AliasOptions = {}): Plugin {\n return tscAlias(options);\n}\n"],"mappings":";;;;;;;AA4BA,SAAgB,MAAM,UAAwB,CAAC,GAAW;CACxD,OAAO,SAAS,OAAO;AACzB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
2
|
const require_rolldown_config_utils = require("../utils.cjs");
|
|
4
3
|
const require_rolldown_config_constants = require("../constants.cjs");
|
|
5
4
|
const require_rolldown_config_helpers = require("../helpers.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circulars.cjs","names":["toArray","withoutExtension","WARNING_CODES"],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { globSync } from 'glob';\nimport { relative } from 'node:path';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\nimport { toArray } from '../utils';\n\nexport type CircularDependenciesOptions = Parameters<\n typeof circularDependencies\n>[0] & {\n exclude?: string | string[];\n};\n\n/**\n * Creates a configured circular dependencies plugin instance\n * @param options - Configuration options for circular dependencies detection\n * @returns Rolldown plugin\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\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(\n '[bemedev] Skipping circular dependency warnings for:',\n );\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":"
|
|
1
|
+
{"version":3,"file":"circulars.cjs","names":["toArray","withoutExtension","WARNING_CODES"],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { globSync } from 'glob';\nimport { relative } from 'node:path';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\nimport { toArray } from '../utils';\n\nexport type CircularDependenciesOptions = Parameters<\n typeof circularDependencies\n>[0] & {\n exclude?: string | string[];\n};\n\n/**\n * Creates a configured circular dependencies plugin instance\n * @param options - Configuration options for circular dependencies detection\n * @returns Rolldown plugin\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\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(\n '[bemedev] Skipping circular dependency warnings for:',\n );\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":";;;;;;;;;;;;;AAmBA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,OAAA,GAAA,oCAAA,qBAAA,CAA2B,OAAO;CAGxC,MAAM,kBAFUA,8BAAAA,QAAQ,QAAQ,OAEF,CAAC,CAC5B,KAAI,OAAA,GAAA,KAAA,SAAA,CAAc,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAA,KAAA,SAAA,CAAiB,OAAO,IAAI,CAAC;CAEpC,OAAO;EACL,GAAG;EACH,MAAM;EACN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,IACE,SAASC,kCAAAA,cAAc,uBACvB,OAAO,OAAM,SAAQ,gBAAgB,SAAS,IAAI,CAAC,GACnD;IACA,MAAM,QAAQ,IAAI,OAAO,EAAE;IAC3B,QAAQ,IAAI,KAAK;IACjB,QAAQ,IACN,sDACF;IACA,OAAO,SAAQ,SAAQ,QAAQ,IAAI,WAAW,MAAM,CAAC;IACrD,QAAQ,IAAI,KAAK;IACjB,QAAQ,IAAI;IACZ,OAAO;GACT;EAGF,EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"circulars.js","names":[],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { globSync } from 'glob';\nimport { relative } from 'node:path';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\nimport { toArray } from '../utils';\n\nexport type CircularDependenciesOptions = Parameters<\n typeof circularDependencies\n>[0] & {\n exclude?: string | string[];\n};\n\n/**\n * Creates a configured circular dependencies plugin instance\n * @param options - Configuration options for circular dependencies detection\n * @returns Rolldown plugin\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\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(\n '[bemedev] Skipping circular dependency warnings for:',\n );\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":";;;;;;;;;;;;AAmBA,SAAgB,UACd,UAAuC,
|
|
1
|
+
{"version":3,"file":"circulars.js","names":[],"sources":["../../../src/rolldown-config/plugins/circulars.ts"],"sourcesContent":["import { globSync } from 'glob';\nimport { relative } from 'node:path';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { circularDependencies } from 'rollup-plugin-circular-dependencies';\nimport { WARNING_CODES } from '../constants';\nimport { withoutExtension } from '../helpers';\nimport { toArray } from '../utils';\n\nexport type CircularDependenciesOptions = Parameters<\n typeof circularDependencies\n>[0] & {\n exclude?: string | string[];\n};\n\n/**\n * Creates a configured circular dependencies plugin instance\n * @param options - Configuration options for circular dependencies detection\n * @returns Rolldown plugin\n */\nexport function circulars(\n options: CircularDependenciesOptions = {},\n): RolldownPluginOption {\n const all = circularDependencies(options);\n const exclude = toArray(options.exclude);\n\n const CIRCULAR_CHUNKS = exclude\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(\n '[bemedev] Skipping circular dependency warnings for:',\n );\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":";;;;;;;;;;;;AAmBA,SAAgB,UACd,UAAuC,CAAC,GAClB;CACtB,MAAM,MAAM,qBAAqB,OAAO;CAGxC,MAAM,kBAFU,QAAQ,QAAQ,OAEF,CAAC,CAC5B,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,IACN,sDACF;IACA,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,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../../_virtual/_rolldown/runtime.cjs");
|
|
3
2
|
const require_rolldown_config_utils = require("../utils.cjs");
|
|
4
3
|
const require_rolldown_config_constants = require("../constants.cjs");
|
|
5
4
|
const require_rolldown_config_helpers = require("../helpers.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.cjs","names":["toArray","withoutExtension","WARNING_CODES"],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { globSync } from 'glob';\nimport { relative } from 'node:path';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { toArray } from '../utils';\n\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\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 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, dir, 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":"
|
|
1
|
+
{"version":3,"file":"clean.cjs","names":["toArray","withoutExtension","WARNING_CODES"],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { globSync } from 'glob';\nimport { relative } from 'node:path';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { toArray } from '../utils';\n\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\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 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, dir, 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":";;;;;;;AAaA,MAAa,SAAS,UAA4B,CAAC,MAAM;CACvD,MAAM,EAAE,WAAW,YAAY,OAAO,MAAM,OAAO;CAEnD,MAAM,aAAaA,8BAAAA,QAAQ,SAAS;CAmDpC,OAAO;EAhDL,MAAM;EAEN,OAAO,EACL,UAAU,GAAG,EAAE,MAAM,YAAY;GAC/B,MAAM,eAAe,WAClB,KAAI,OAAA,GAAA,KAAA,SAAA,CAAc,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CACtC,KAAK,CAAC,CACN,IAAIC,gCAAAA,gBAAgB,CAAC,CACrB,KAAI,UAAA,GAAA,KAAA,SAAA,CAAiB,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,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;MAExB,CAAA,GAAA,KAAA,SAAA,CADuB,KAAK,EAAE,OAAO,KAAK,CACtC,CAAC,CAAC,SAAQ,SAAQ,MAAM,IAAI,IAAI,CAAC;KACvC,CAAC;KACD,gCAAA,UAAU,OAAO,KAAK,SAAS;KAC/B,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 { globSync } from 'glob';\nimport { relative } from 'node:path';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { toArray } from '../utils';\n\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\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 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, dir, 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":";;;;;;AAaA,MAAa,SAAS,UAA4B,
|
|
1
|
+
{"version":3,"file":"clean.js","names":[],"sources":["../../../src/rolldown-config/plugins/clean.ts"],"sourcesContent":["import { globSync } from 'glob';\nimport { relative } from 'node:path';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { WARNING_CODES } from '../constants';\nimport { cleanupJS, withoutExtension } from '../helpers';\nimport { toArray } from '../utils';\n\nexport type EndPluginOptions = {\n ignoresJS?: string | string[];\n sourcemap?: boolean;\n dir?: string;\n};\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 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, dir, 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":";;;;;;AAaA,MAAa,SAAS,UAA4B,CAAC,MAAM;CACvD,MAAM,EAAE,WAAW,YAAY,OAAO,MAAM,OAAO;CAEnD,MAAM,aAAa,QAAQ,SAAS;CAmDpC,OAAO;EAhDL,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,IAAI,WAAW,SAAS,GACtB,IAAI;KACF,MAAM,wBAAQ,IAAI,IAAY;KAC9B,WAAW,SAAQ,QAAO;MAExB,SADuB,KAAK,EAAE,OAAO,KAAK,CACtC,CAAC,CAAC,SAAQ,SAAQ,MAAM,IAAI,IAAI,CAAC;KACvC,CAAC;KACD,UAAU,OAAO,KAAK,SAAS;KAC/B,QAAQ,IAAI,gBAAgB;IAE9B,SAAS,KAAK;KACZ,QAAQ,MAAM,iCAAiC,GAAG;IACpD;GAEJ;EACF;CAGO;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externals.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/externals.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport { nodeExternals } from 'rollup-plugin-node-externals';\n\nexport type NodeExternalsOptions = Parameters<typeof nodeExternals>[0];\n\n/**\n * Creates a configured node externals plugin instance\n * @param options - Configuration options for node externals\n * @returns Rolldown plugin\n */\nexport function externals(\n options: NodeExternalsOptions = {},\n): RolldownPluginOption {\n return nodeExternals(options);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"externals.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/externals.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport { nodeExternals } from 'rollup-plugin-node-externals';\n\nexport type NodeExternalsOptions = Parameters<typeof nodeExternals>[0];\n\n/**\n * Creates a configured node externals plugin instance\n * @param options - Configuration options for node externals\n * @returns Rolldown plugin\n */\nexport function externals(\n options: NodeExternalsOptions = {},\n): RolldownPluginOption {\n return nodeExternals(options);\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,UACd,UAAgC,CAAC,GACX;CACtB,QAAA,GAAA,6BAAA,cAAA,CAAqB,OAAO;AAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"externals.js","names":[],"sources":["../../../src/rolldown-config/plugins/externals.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport { nodeExternals } from 'rollup-plugin-node-externals';\n\nexport type NodeExternalsOptions = Parameters<typeof nodeExternals>[0];\n\n/**\n * Creates a configured node externals plugin instance\n * @param options - Configuration options for node externals\n * @returns Rolldown plugin\n */\nexport function externals(\n options: NodeExternalsOptions = {},\n): RolldownPluginOption {\n return nodeExternals(options);\n}\n"],"mappings":";;;;;;;AAUA,SAAgB,UACd,UAAgC,
|
|
1
|
+
{"version":3,"file":"externals.js","names":[],"sources":["../../../src/rolldown-config/plugins/externals.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport { nodeExternals } from 'rollup-plugin-node-externals';\n\nexport type NodeExternalsOptions = Parameters<typeof nodeExternals>[0];\n\n/**\n * Creates a configured node externals plugin instance\n * @param options - Configuration options for node externals\n * @returns Rolldown plugin\n */\nexport function externals(\n options: NodeExternalsOptions = {},\n): RolldownPluginOption {\n return nodeExternals(options);\n}\n"],"mappings":";;;;;;;AAUA,SAAgB,UACd,UAAgC,CAAC,GACX;CACtB,OAAO,cAAc,OAAO;AAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { alias } from './alias';\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { tsPaths } from './tsPaths';\nimport { typescript } from './typescript';\n\nexport const PLUGIN_BUILDERS = {\n alias,\n typescript,\n tsPaths,\n circulars,\n externals,\n clean,\n};\n\nexport const DEFAULT_PLUGINS_ORDER = [\n 'alias',\n 'typescript',\n 'tsPaths',\n 'circulars',\n 'externals',\n 'clean',\n];\n"],"mappings":";;;;;;;;AAOA,MAAa,kBAAkB;CAC7B,OAAA,sCAAA;CACA,YAAA,2CAAA;CACA,SAAA,wCAAA;CACA,WAAA,0CAAA;CACA,WAAA,0CAAA;CACA,OAAA,sCAAA;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { alias } from './alias';\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { tsPaths } from './tsPaths';\nimport { typescript } from './typescript';\n\nexport const PLUGIN_BUILDERS = {\n alias,\n typescript,\n tsPaths,\n circulars,\n externals,\n clean,\n};\n\nexport const DEFAULT_PLUGINS_ORDER = [\n 'alias',\n 'typescript',\n 'tsPaths',\n 'circulars',\n 'externals',\n 'clean',\n];\n"],"mappings":";;;;;;;;AAOA,MAAa,kBAAkB;CAC7B,OAAA,sCAAA;CACA,YAAA,2CAAA;CACA,SAAA,wCAAA;CACA,WAAA,0CAAA;CACA,WAAA,0CAAA;CACA,OAAA,sCAAA;AACF;AAEA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { alias } from './alias';\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { tsPaths } from './tsPaths';\nimport { typescript } from './typescript';\n\nexport const PLUGIN_BUILDERS = {\n alias,\n typescript,\n tsPaths,\n circulars,\n externals,\n clean,\n};\n\nexport const DEFAULT_PLUGINS_ORDER = [\n 'alias',\n 'typescript',\n 'tsPaths',\n 'circulars',\n 'externals',\n 'clean',\n];\n"],"mappings":";;;;;;;AAOA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/rolldown-config/plugins/index.ts"],"sourcesContent":["import { alias } from './alias';\nimport { circulars } from './circulars';\nimport { clean } from './clean';\nimport { externals } from './externals';\nimport { tsPaths } from './tsPaths';\nimport { typescript } from './typescript';\n\nexport const PLUGIN_BUILDERS = {\n alias,\n typescript,\n tsPaths,\n circulars,\n externals,\n clean,\n};\n\nexport const DEFAULT_PLUGINS_ORDER = [\n 'alias',\n 'typescript',\n 'tsPaths',\n 'circulars',\n 'externals',\n 'clean',\n];\n"],"mappings":";;;;;;;AAOA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsPaths.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/tsPaths.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport tsConfigPaths from 'rollup-plugin-tsconfig-paths';\n\nexport type TsConfigPathsOptions = Parameters<typeof tsConfigPaths>[0];\n/**\n * Creates a configured tsconfig-paths plugin instance\n * @param options - Configuration options for tsconfig-paths\n * @returns Rolldown plugin\n */\nexport function tsPaths(\n options: TsConfigPathsOptions = {},\n): RolldownPluginOption {\n return tsConfigPaths(options);\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,QACd,UAAgC,
|
|
1
|
+
{"version":3,"file":"tsPaths.cjs","names":[],"sources":["../../../src/rolldown-config/plugins/tsPaths.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport tsConfigPaths from 'rollup-plugin-tsconfig-paths';\n\nexport type TsConfigPathsOptions = Parameters<typeof tsConfigPaths>[0];\n/**\n * Creates a configured tsconfig-paths plugin instance\n * @param options - Configuration options for tsconfig-paths\n * @returns Rolldown plugin\n */\nexport function tsPaths(\n options: TsConfigPathsOptions = {},\n): RolldownPluginOption {\n return tsConfigPaths(options);\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,QACd,UAAgC,CAAC,GACX;CACtB,QAAA,GAAA,6BAAA,QAAA,CAAqB,OAAO;AAC9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsPaths.js","names":[],"sources":["../../../src/rolldown-config/plugins/tsPaths.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport tsConfigPaths from 'rollup-plugin-tsconfig-paths';\n\nexport type TsConfigPathsOptions = Parameters<typeof tsConfigPaths>[0];\n/**\n * Creates a configured tsconfig-paths plugin instance\n * @param options - Configuration options for tsconfig-paths\n * @returns Rolldown plugin\n */\nexport function tsPaths(\n options: TsConfigPathsOptions = {},\n): RolldownPluginOption {\n return tsConfigPaths(options);\n}\n"],"mappings":";;;;;;;AASA,SAAgB,QACd,UAAgC,
|
|
1
|
+
{"version":3,"file":"tsPaths.js","names":[],"sources":["../../../src/rolldown-config/plugins/tsPaths.ts"],"sourcesContent":["import type { RolldownPluginOption } from 'rolldown';\nimport tsConfigPaths from 'rollup-plugin-tsconfig-paths';\n\nexport type TsConfigPathsOptions = Parameters<typeof tsConfigPaths>[0];\n/**\n * Creates a configured tsconfig-paths plugin instance\n * @param options - Configuration options for tsconfig-paths\n * @returns Rolldown plugin\n */\nexport function tsPaths(\n options: TsConfigPathsOptions = {},\n): RolldownPluginOption {\n return tsConfigPaths(options);\n}\n"],"mappings":";;;;;;;AASA,SAAgB,QACd,UAAgC,CAAC,GACX;CACtB,OAAO,cAAc,OAAO;AAC9B"}
|
|
@@ -3,9 +3,9 @@ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
|
3
3
|
const require_rolldown_config_utils = require("../utils.cjs");
|
|
4
4
|
const require_rolldown_config_plugins_typescript_config = require("./typescript.config.cjs");
|
|
5
5
|
let fs = require("fs");
|
|
6
|
-
let tsc_alias = require("tsc-alias");
|
|
7
6
|
let typescript = require("typescript");
|
|
8
7
|
typescript = require_runtime.__toESM(typescript, 1);
|
|
8
|
+
let tsc_alias = require("tsc-alias");
|
|
9
9
|
//#region src/rolldown-config/plugins/typescript.ts
|
|
10
10
|
const typescript$1 = ({ exclude, include, declarationMap, dir: outDir } = {}) => {
|
|
11
11
|
let done = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.cjs","names":["typescript","toArray","ts","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir: outDir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({\n configFile: tsconfigPath,\n outDir,\n });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;AAcA,MAAaA,gBAAc,EACzB,SACA,SACA,gBACA,KAAK,WACI,
|
|
1
|
+
{"version":3,"file":"typescript.cjs","names":["typescript","toArray","ts","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir: outDir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({\n configFile: tsconfigPath,\n outDir,\n });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;AAcA,MAAaA,gBAAc,EACzB,SACA,SACA,gBACA,KAAK,WACI,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHAC,8BAAAA,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,WAAAA,QAAG,eACtB,KACAC,GAAAA,YACA,eACF;IAEA,MAAM,aAAaC,kDAAAA,aAAa,YAAY;IAC5C,MAAM,OAAOF,WAAAA,QAAG,mBAAmB,WAAW,OAAO;IAErD,MAAM,SAASA,WAAAA,QAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAGD,8BAAAA,QAAQ,OAAO,GAAG,MAAM;KACrC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;KACF;IACF,GACAC,WAAAA,QAAG,KACH,GACF;IAEA,MAAM,UAAUA,WAAAA,QAAG,cACjB,OAAO,WACP;KACE,GAAG,WAAW;KACd;KACA,QAAQ;KACR,qBAAqB;KACrB,aAAa;KACb;IACF,GACA,IACF;IAEA,MAAM,aAAa,QAAQ,KAAK;IAEhC,MAAM,SAASA,WAAAA,QACZ,sBAAsB,OAAO,CAAC,CAC9B,OAAO,WAAW,WAAW,CAAC,CAC9B,QAAO,MAAK,EAAE,aAAaA,WAAAA,QAAG,mBAAmB,KAAK;IAEzD,IAAI,OAAO,SAAS,GAClB,QAAQ,MACNA,WAAAA,QAAG,qCAAqC,QAAQ,IAAI,CACtD;IAGF,OAAA,GAAA,UAAA,qBAAA,CAA2B;KACzB,YAAY;KACZ;IACF,CAAC;IAED,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.config.cjs","names":["existsSync","ts","path"],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport ts from 'typescript';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;;;;AAIA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,QAAA,GAAA,GAAA,
|
|
1
|
+
{"version":3,"file":"typescript.config.cjs","names":["existsSync","ts","path"],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport ts from 'typescript';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;;;;AAIA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,QAAA,GAAA,GAAA,aAAA,CAAoB,UAAU,OAAO;CACvC,QAAQ;EACN;CACF;AACF;AAEA,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,CAAC;CAE3B,MAAM,QAAQ,KAAa,iBAAyB;EAClD,IAAI,UAAU,KAAA,KAAa,eAAe,OAAO;EAEjD,IAAI;EACJ,IAAI;GACF,WAAA,GAAA,GAAA,YAAA,CAAsB,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,YAAA,GAAA,KAAA,KAAA,CAAgB,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,QAAA,GAAA,GAAA,SAAA,CAAgB,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IACL,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAE1C,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAYA,GAAAA;CACZ,UAAU;AACZ;AAEA,MAAa,gBAAgB,WAAiB;CAC5C,MAAM,aAAaC,WAAAA,QAAG,eAAeC,QAAM,SAAS;CAEpD,IAAI,WAAW,OACb,MAAM,IAAI,MACRD,WAAAA,QAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,IAAI;EACvC,kBAAkB;CACpB,CAAC,CACH;CASF,OANqBA,WAAAA,QAAG,2BACtB,WAAW,QACX,QAAA,GAAA,KAAA,QAAA,CACQC,MAAI,CAGI;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.config.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport ts from 'typescript';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;AAIA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,OAAO,aAAa,UAAU,QAAQ;
|
|
1
|
+
{"version":3,"file":"typescript.config.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport ts from 'typescript';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;AAIA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,OAAO,aAAa,UAAU,OAAO;CACvC,QAAQ;EACN;CACF;AACF;AAEA,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,CAAC;CAE3B,MAAM,QAAQ,KAAa,iBAAyB;EAClD,IAAI,UAAU,KAAA,KAAa,eAAe,OAAO;EAEjD,IAAI;EACJ,IAAI;GACF,UAAU,YAAY,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,WAAW,KAAK,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,OAAO,SAAS,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IACL,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAE1C,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAY;CACZ,UAAU;AACZ;AAEA,MAAa,gBAAgB,SAAiB;CAC5C,MAAM,aAAa,GAAG,eAAe,MAAM,SAAS;CAEpD,IAAI,WAAW,OACb,MAAM,IAAI,MACR,GAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,IAAI;EACvC,kBAAkB;CACpB,CAAC,CACH;CASF,OANqB,GAAG,2BACtB,WAAW,QACX,OACA,QAAQ,IAAI,CAGI;AACpB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { toArray } from "../utils.js";
|
|
2
2
|
import { readTsConfig } from "./typescript.config.js";
|
|
3
3
|
import { existsSync } from "fs";
|
|
4
|
-
import { replaceTscAliasPaths } from "tsc-alias";
|
|
5
4
|
import ts from "typescript";
|
|
5
|
+
import { replaceTscAliasPaths } from "tsc-alias";
|
|
6
6
|
//#region src/rolldown-config/plugins/typescript.ts
|
|
7
7
|
const typescript = ({ exclude, include, declarationMap, dir: outDir } = {}) => {
|
|
8
8
|
let done = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir: outDir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({\n configFile: tsconfigPath,\n outDir,\n });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;AAcA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,KAAK,WACI,
|
|
1
|
+
{"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { toArray } from '../utils';\nimport { existsSync } from 'node:fs';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\nimport ts from 'typescript';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir: outDir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({\n configFile: tsconfigPath,\n outDir,\n });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;AAcA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,KAAK,WACI,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;IAErD,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;KACzB,YAAY;KACZ;IACF,CAAC;IAED,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":[],"sources":["../../src/rolldown-config/utils.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":";;AAEA,MAAa,WAAqB,UAAS;CAGzC,IAFe,UAAU,KAAA,KAAa,UAAU,MAEpC,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":[],"sources":["../../src/rolldown-config/utils.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":";;AAEA,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../src/rolldown-config/utils.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":";AAEA,MAAa,WAAqB,UAAS;CAGzC,IAFe,UAAU,KAAA,KAAa,UAAU,MAEpC,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../src/rolldown-config/utils.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":";AAEA,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/sleep.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.cjs","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["export const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";;AAAA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,
|
|
1
|
+
{"version":3,"file":"sleep.cjs","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["export const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";;AAAA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,EAAE,CAAC;AACvD"}
|
package/lib/utils/sleep.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sleep.js","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["export const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";AAAA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,
|
|
1
|
+
{"version":3,"file":"sleep.js","names":[],"sources":["../../src/utils/sleep.ts"],"sourcesContent":["export const sleep = (ms: number) => {\n return new Promise(resolve => setTimeout(resolve, ms));\n};\n"],"mappings":";AAAA,MAAa,SAAS,OAAe;CACnC,OAAO,IAAI,SAAQ,YAAW,WAAW,SAAS,EAAE,CAAC;AACvD"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let fs = require("fs");
|
|
3
4
|
let path = require("path");
|
|
5
|
+
let typescript = require("typescript");
|
|
6
|
+
typescript = require_runtime.__toESM(typescript, 1);
|
|
4
7
|
//#region src/vitest-alias/vitest.ts
|
|
5
8
|
const configPaths = (arg) => {
|
|
6
9
|
return arg.replace("/*", "");
|
|
@@ -35,25 +38,31 @@ const transformer = (baseUrl) => {
|
|
|
35
38
|
*</code>
|
|
36
39
|
*/
|
|
37
40
|
const createAlias = (tsconfig) => {
|
|
38
|
-
|
|
41
|
+
let paths;
|
|
42
|
+
let baseUrl;
|
|
43
|
+
if (tsconfig && typeof tsconfig === "object") {
|
|
44
|
+
paths = tsconfig.compilerOptions?.paths;
|
|
45
|
+
baseUrl = tsconfig.compilerOptions?.baseUrl;
|
|
46
|
+
} else {
|
|
47
|
+
const tsconfigPath = (0, path.resolve)(process.cwd(), tsconfig ?? "tsconfig.json");
|
|
48
|
+
if ((0, fs.existsSync)(tsconfigPath)) {
|
|
49
|
+
const { config } = typescript.default.readConfigFile(tsconfigPath, typescript.default.sys.readFile);
|
|
50
|
+
const parsed = typescript.default.parseJsonConfigFileContent(config || {}, typescript.default.sys, (0, path.dirname)(tsconfigPath));
|
|
51
|
+
paths = parsed.options.paths;
|
|
52
|
+
baseUrl = parsed.options.baseUrl;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
39
55
|
if (!paths) return {};
|
|
40
|
-
const
|
|
56
|
+
const transformedArray = Object.entries(paths).map(([key, [value]]) => {
|
|
41
57
|
return [key, value];
|
|
42
|
-
});
|
|
43
|
-
const baseUrl = tsconfig?.compilerOptions?.baseUrl;
|
|
44
|
-
const transformedArray = array.map(transformer(baseUrl));
|
|
58
|
+
}).map(transformer(baseUrl));
|
|
45
59
|
return Object.fromEntries(transformedArray);
|
|
46
60
|
};
|
|
47
61
|
/**
|
|
48
62
|
* Plugin to add alias from tsconfig to test.alias
|
|
49
63
|
*
|
|
50
|
-
* @param tsconfig The tsconfig json
|
|
64
|
+
* @param tsconfig The tsconfig json or path to tsconfig file
|
|
51
65
|
* @returns a vitest config
|
|
52
|
-
*
|
|
53
|
-
* @remarks
|
|
54
|
-
* Make sure you add "resolveJsonModule": true
|
|
55
|
-
* inside your tsconfig.json at compilerOPtions
|
|
56
|
-
* or add the json directly
|
|
57
66
|
*/
|
|
58
67
|
const aliasTs = (tsconfig) => ({
|
|
59
68
|
name: "aliasTs",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.cjs","names":[],"sources":["../../src/vitest-alias/vitest.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport type { ViteUserConfig } from 'vitest/config';\n\ntype Entry = [string, string];\n\ntype TsConf = {\n compilerOptions?: {\n paths?: Record<string, string[]>;\n baseUrl?: string;\n };\n};\n\ntype Plugin = Exclude<ViteUserConfig['plugins'], undefined>[number];\n\nconst configPaths = (arg: string) => {\n return arg.replace('/*', '');\n};\n\nconst checkBaseUrl = (url: any): url is string => {\n return url && url !== '.' && url !== './';\n};\n\nconst transformer = (baseUrl?: string) => {\n return ([_key, _value]: Entry) => {\n const key = configPaths(_key);\n const lastPath = configPaths(_value);\n const cwd = process.cwd();\n const base = checkBaseUrl(baseUrl);\n\n const args = base ? [cwd, baseUrl, lastPath] : [cwd, lastPath];\n const value = resolve(...args);\n\n return [key, value] as Entry;\n };\n};\n\n/**\n * Add manually your alias with this function\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @example\n * <code>\n * {\n * test: {\n * alias: createAlias(tsconfig),\n * }\n * }\n *</code>\n */\nexport const createAlias = (tsconfig?: TsConf) => {\n
|
|
1
|
+
{"version":3,"file":"vitest.cjs","names":["ts"],"sources":["../../src/vitest-alias/vitest.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport ts from 'typescript';\nimport type { ViteUserConfig } from 'vitest/config';\n\ntype Entry = [string, string];\n\ntype TsConf = {\n compilerOptions?: {\n paths?: Record<string, string[]>;\n baseUrl?: string;\n };\n};\n\ntype Plugin = Exclude<ViteUserConfig['plugins'], undefined>[number];\n\nconst configPaths = (arg: string) => {\n return arg.replace('/*', '');\n};\n\nconst checkBaseUrl = (url: any): url is string => {\n return url && url !== '.' && url !== './';\n};\n\nconst transformer = (baseUrl?: string) => {\n return ([_key, _value]: Entry) => {\n const key = configPaths(_key);\n const lastPath = configPaths(_value);\n const cwd = process.cwd();\n const base = checkBaseUrl(baseUrl);\n\n const args = base ? [cwd, baseUrl, lastPath] : [cwd, lastPath];\n const value = resolve(...args);\n\n return [key, value] as Entry;\n };\n};\n\n/**\n * Add manually your alias with this function\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @example\n * <code>\n * {\n * test: {\n * alias: createAlias(tsconfig),\n * }\n * }\n *</code>\n */\nexport const createAlias = (tsconfig?: string | TsConf) => {\n let paths: Record<string, string[]> | undefined;\n let baseUrl: string | undefined;\n\n if (tsconfig && typeof tsconfig === 'object') {\n paths = tsconfig.compilerOptions?.paths;\n baseUrl = tsconfig.compilerOptions?.baseUrl;\n } else {\n const tsconfigPath = resolve(\n process.cwd(),\n tsconfig ?? 'tsconfig.json',\n );\n if (existsSync(tsconfigPath)) {\n const { config } = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n const parsed = ts.parseJsonConfigFileContent(\n config || {},\n ts.sys,\n dirname(tsconfigPath),\n );\n paths = parsed.options.paths;\n baseUrl = parsed.options.baseUrl;\n }\n }\n\n if (!paths) return {};\n const entries = Object.entries(paths);\n const array = entries.map(([key, [value]]) => {\n return [key, value];\n }) as Entry[];\n\n const transformedArray = array.map(transformer(baseUrl));\n const object = Object.fromEntries(transformedArray);\n\n return object;\n};\n\n/**\n * Plugin to add alias from tsconfig to test.alias\n *\n * @param tsconfig The tsconfig json or path to tsconfig file\n * @returns a vitest config\n */\nexport const aliasTs = (tsconfig?: string | TsConf): Plugin => ({\n name: 'aliasTs',\n enforce: 'pre',\n config: options => {\n const testConfig = options?.test;\n const alias = createAlias(tsconfig);\n\n return {\n ...options,\n test: {\n ...testConfig,\n alias,\n },\n };\n },\n});\n"],"mappings":";;;;;;;AAgBA,MAAM,eAAe,QAAgB;CACnC,OAAO,IAAI,QAAQ,MAAM,EAAE;AAC7B;AAEA,MAAM,gBAAgB,QAA4B;CAChD,OAAO,OAAO,QAAQ,OAAO,QAAQ;AACvC;AAEA,MAAM,eAAe,YAAqB;CACxC,QAAQ,CAAC,MAAM,YAAmB;EAChC,MAAM,MAAM,YAAY,IAAI;EAC5B,MAAM,WAAW,YAAY,MAAM;EACnC,MAAM,MAAM,QAAQ,IAAI;EAMxB,OAAO,CAAC,MAAA,GAAA,KAAA,QAAA,CAFc,GAHT,aAAa,OAEV,IAAI;GAAC;GAAK;GAAS;EAAQ,IAAI,CAAC,KAAK,QAAQ,CAG5C,CAAC;CACpB;AACF;;;;;;;;;;;;;;;AAgBA,MAAa,eAAe,aAA+B;CACzD,IAAI;CACJ,IAAI;CAEJ,IAAI,YAAY,OAAO,aAAa,UAAU;EAC5C,QAAQ,SAAS,iBAAiB;EAClC,UAAU,SAAS,iBAAiB;CACtC,OAAO;EACL,MAAM,gBAAA,GAAA,KAAA,QAAA,CACJ,QAAQ,IAAI,GACZ,YAAY,eACd;EACA,KAAA,GAAA,GAAA,WAAA,CAAe,YAAY,GAAG;GAC5B,MAAM,EAAE,WAAWA,WAAAA,QAAG,eAAe,cAAcA,WAAAA,QAAG,IAAI,QAAQ;GAClE,MAAM,SAASA,WAAAA,QAAG,2BAChB,UAAU,CAAC,GACXA,WAAAA,QAAG,MAAA,GAAA,KAAA,QAAA,CACK,YAAY,CACtB;GACA,QAAQ,OAAO,QAAQ;GACvB,UAAU,OAAO,QAAQ;EAC3B;CACF;CAEA,IAAI,CAAC,OAAO,OAAO,CAAC;CAMpB,MAAM,mBALU,OAAO,QAAQ,KACX,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;EAC5C,OAAO,CAAC,KAAK,KAAK;CACpB,CAE6B,CAAC,CAAC,IAAI,YAAY,OAAO,CAAC;CAGvD,OAFe,OAAO,YAAY,gBAEtB;AACd;;;;;;;AAQA,MAAa,WAAW,cAAwC;CAC9D,MAAM;CACN,SAAS;CACT,SAAQ,YAAW;EACjB,MAAM,aAAa,SAAS;EAC5B,MAAM,QAAQ,YAAY,QAAQ;EAElC,OAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG;IACH;GACF;EACF;CACF;AACF"}
|
|
@@ -20,19 +20,14 @@ type Plugin = Exclude<ViteUserConfig['plugins'], undefined>[number];
|
|
|
20
20
|
* }
|
|
21
21
|
*</code>
|
|
22
22
|
*/
|
|
23
|
-
export declare const createAlias: (tsconfig?: TsConf) => {
|
|
23
|
+
export declare const createAlias: (tsconfig?: string | TsConf) => {
|
|
24
24
|
[k: string]: string;
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* Plugin to add alias from tsconfig to test.alias
|
|
28
28
|
*
|
|
29
|
-
* @param tsconfig The tsconfig json
|
|
29
|
+
* @param tsconfig The tsconfig json or path to tsconfig file
|
|
30
30
|
* @returns a vitest config
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Make sure you add "resolveJsonModule": true
|
|
34
|
-
* inside your tsconfig.json at compilerOPtions
|
|
35
|
-
* or add the json directly
|
|
36
31
|
*/
|
|
37
|
-
export declare const aliasTs: (tsconfig?: TsConf) => Plugin;
|
|
32
|
+
export declare const aliasTs: (tsconfig?: string | TsConf) => Plugin;
|
|
38
33
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync } from "fs";
|
|
2
|
+
import { dirname, resolve } from "path";
|
|
3
|
+
import ts from "typescript";
|
|
2
4
|
//#region src/vitest-alias/vitest.ts
|
|
3
5
|
const configPaths = (arg) => {
|
|
4
6
|
return arg.replace("/*", "");
|
|
@@ -33,25 +35,31 @@ const transformer = (baseUrl) => {
|
|
|
33
35
|
*</code>
|
|
34
36
|
*/
|
|
35
37
|
const createAlias = (tsconfig) => {
|
|
36
|
-
|
|
38
|
+
let paths;
|
|
39
|
+
let baseUrl;
|
|
40
|
+
if (tsconfig && typeof tsconfig === "object") {
|
|
41
|
+
paths = tsconfig.compilerOptions?.paths;
|
|
42
|
+
baseUrl = tsconfig.compilerOptions?.baseUrl;
|
|
43
|
+
} else {
|
|
44
|
+
const tsconfigPath = resolve(process.cwd(), tsconfig ?? "tsconfig.json");
|
|
45
|
+
if (existsSync(tsconfigPath)) {
|
|
46
|
+
const { config } = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
|
47
|
+
const parsed = ts.parseJsonConfigFileContent(config || {}, ts.sys, dirname(tsconfigPath));
|
|
48
|
+
paths = parsed.options.paths;
|
|
49
|
+
baseUrl = parsed.options.baseUrl;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
37
52
|
if (!paths) return {};
|
|
38
|
-
const
|
|
53
|
+
const transformedArray = Object.entries(paths).map(([key, [value]]) => {
|
|
39
54
|
return [key, value];
|
|
40
|
-
});
|
|
41
|
-
const baseUrl = tsconfig?.compilerOptions?.baseUrl;
|
|
42
|
-
const transformedArray = array.map(transformer(baseUrl));
|
|
55
|
+
}).map(transformer(baseUrl));
|
|
43
56
|
return Object.fromEntries(transformedArray);
|
|
44
57
|
};
|
|
45
58
|
/**
|
|
46
59
|
* Plugin to add alias from tsconfig to test.alias
|
|
47
60
|
*
|
|
48
|
-
* @param tsconfig The tsconfig json
|
|
61
|
+
* @param tsconfig The tsconfig json or path to tsconfig file
|
|
49
62
|
* @returns a vitest config
|
|
50
|
-
*
|
|
51
|
-
* @remarks
|
|
52
|
-
* Make sure you add "resolveJsonModule": true
|
|
53
|
-
* inside your tsconfig.json at compilerOPtions
|
|
54
|
-
* or add the json directly
|
|
55
63
|
*/
|
|
56
64
|
const aliasTs = (tsconfig) => ({
|
|
57
65
|
name: "aliasTs",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.js","names":[],"sources":["../../src/vitest-alias/vitest.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport type { ViteUserConfig } from 'vitest/config';\n\ntype Entry = [string, string];\n\ntype TsConf = {\n compilerOptions?: {\n paths?: Record<string, string[]>;\n baseUrl?: string;\n };\n};\n\ntype Plugin = Exclude<ViteUserConfig['plugins'], undefined>[number];\n\nconst configPaths = (arg: string) => {\n return arg.replace('/*', '');\n};\n\nconst checkBaseUrl = (url: any): url is string => {\n return url && url !== '.' && url !== './';\n};\n\nconst transformer = (baseUrl?: string) => {\n return ([_key, _value]: Entry) => {\n const key = configPaths(_key);\n const lastPath = configPaths(_value);\n const cwd = process.cwd();\n const base = checkBaseUrl(baseUrl);\n\n const args = base ? [cwd, baseUrl, lastPath] : [cwd, lastPath];\n const value = resolve(...args);\n\n return [key, value] as Entry;\n };\n};\n\n/**\n * Add manually your alias with this function\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @example\n * <code>\n * {\n * test: {\n * alias: createAlias(tsconfig),\n * }\n * }\n *</code>\n */\nexport const createAlias = (tsconfig?: TsConf) => {\n
|
|
1
|
+
{"version":3,"file":"vitest.js","names":[],"sources":["../../src/vitest-alias/vitest.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport ts from 'typescript';\nimport type { ViteUserConfig } from 'vitest/config';\n\ntype Entry = [string, string];\n\ntype TsConf = {\n compilerOptions?: {\n paths?: Record<string, string[]>;\n baseUrl?: string;\n };\n};\n\ntype Plugin = Exclude<ViteUserConfig['plugins'], undefined>[number];\n\nconst configPaths = (arg: string) => {\n return arg.replace('/*', '');\n};\n\nconst checkBaseUrl = (url: any): url is string => {\n return url && url !== '.' && url !== './';\n};\n\nconst transformer = (baseUrl?: string) => {\n return ([_key, _value]: Entry) => {\n const key = configPaths(_key);\n const lastPath = configPaths(_value);\n const cwd = process.cwd();\n const base = checkBaseUrl(baseUrl);\n\n const args = base ? [cwd, baseUrl, lastPath] : [cwd, lastPath];\n const value = resolve(...args);\n\n return [key, value] as Entry;\n };\n};\n\n/**\n * Add manually your alias with this function\n * @param tsconfig The tsconfig json\n * @returns a vitest config\n *\n * @example\n * <code>\n * {\n * test: {\n * alias: createAlias(tsconfig),\n * }\n * }\n *</code>\n */\nexport const createAlias = (tsconfig?: string | TsConf) => {\n let paths: Record<string, string[]> | undefined;\n let baseUrl: string | undefined;\n\n if (tsconfig && typeof tsconfig === 'object') {\n paths = tsconfig.compilerOptions?.paths;\n baseUrl = tsconfig.compilerOptions?.baseUrl;\n } else {\n const tsconfigPath = resolve(\n process.cwd(),\n tsconfig ?? 'tsconfig.json',\n );\n if (existsSync(tsconfigPath)) {\n const { config } = ts.readConfigFile(tsconfigPath, ts.sys.readFile);\n const parsed = ts.parseJsonConfigFileContent(\n config || {},\n ts.sys,\n dirname(tsconfigPath),\n );\n paths = parsed.options.paths;\n baseUrl = parsed.options.baseUrl;\n }\n }\n\n if (!paths) return {};\n const entries = Object.entries(paths);\n const array = entries.map(([key, [value]]) => {\n return [key, value];\n }) as Entry[];\n\n const transformedArray = array.map(transformer(baseUrl));\n const object = Object.fromEntries(transformedArray);\n\n return object;\n};\n\n/**\n * Plugin to add alias from tsconfig to test.alias\n *\n * @param tsconfig The tsconfig json or path to tsconfig file\n * @returns a vitest config\n */\nexport const aliasTs = (tsconfig?: string | TsConf): Plugin => ({\n name: 'aliasTs',\n enforce: 'pre',\n config: options => {\n const testConfig = options?.test;\n const alias = createAlias(tsconfig);\n\n return {\n ...options,\n test: {\n ...testConfig,\n alias,\n },\n };\n },\n});\n"],"mappings":";;;;AAgBA,MAAM,eAAe,QAAgB;CACnC,OAAO,IAAI,QAAQ,MAAM,EAAE;AAC7B;AAEA,MAAM,gBAAgB,QAA4B;CAChD,OAAO,OAAO,QAAQ,OAAO,QAAQ;AACvC;AAEA,MAAM,eAAe,YAAqB;CACxC,QAAQ,CAAC,MAAM,YAAmB;EAChC,MAAM,MAAM,YAAY,IAAI;EAC5B,MAAM,WAAW,YAAY,MAAM;EACnC,MAAM,MAAM,QAAQ,IAAI;EAMxB,OAAO,CAAC,KAFM,QAAQ,GAHT,aAAa,OAEV,IAAI;GAAC;GAAK;GAAS;EAAQ,IAAI,CAAC,KAAK,QAAQ,CAG5C,CAAC;CACpB;AACF;;;;;;;;;;;;;;;AAgBA,MAAa,eAAe,aAA+B;CACzD,IAAI;CACJ,IAAI;CAEJ,IAAI,YAAY,OAAO,aAAa,UAAU;EAC5C,QAAQ,SAAS,iBAAiB;EAClC,UAAU,SAAS,iBAAiB;CACtC,OAAO;EACL,MAAM,eAAe,QACnB,QAAQ,IAAI,GACZ,YAAY,eACd;EACA,IAAI,WAAW,YAAY,GAAG;GAC5B,MAAM,EAAE,WAAW,GAAG,eAAe,cAAc,GAAG,IAAI,QAAQ;GAClE,MAAM,SAAS,GAAG,2BAChB,UAAU,CAAC,GACX,GAAG,KACH,QAAQ,YAAY,CACtB;GACA,QAAQ,OAAO,QAAQ;GACvB,UAAU,OAAO,QAAQ;EAC3B;CACF;CAEA,IAAI,CAAC,OAAO,OAAO,CAAC;CAMpB,MAAM,mBALU,OAAO,QAAQ,KACX,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY;EAC5C,OAAO,CAAC,KAAK,KAAK;CACpB,CAE6B,CAAC,CAAC,IAAI,YAAY,OAAO,CAAC;CAGvD,OAFe,OAAO,YAAY,gBAEtB;AACd;;;;;;;AAQA,MAAa,WAAW,cAAwC;CAC9D,MAAM;CACN,SAAS;CACT,SAAQ,YAAW;EACjB,MAAM,aAAa,SAAS;EAC5B,MAAM,QAAQ,YAAY,QAAQ;EAElC,OAAO;GACL,GAAG;GACH,MAAM;IACJ,GAAG;IACH;GACF;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.cjs","names":["testPattern","defaultCovPattern","buildInclude"],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Create includeTest and includeCoverage arrays from glob patterns\n *\n * @param args Globs to ignore for test and coverage files\n * @returns an object with includeTest and includeCoverage string arrays\n */\nexport async function create(args: Args[1] = {}) {\n const firsts = {\n patternTest: testPattern(),\n patternCov: defaultCovPattern(),\n };\n\n return create.withPattern(firsts, args);\n}\n\ncreate.withPattern = async (\n {\n patternTest = testPattern(),\n patternCov = defaultCovPattern(),\n }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n) => {\n const files = await buildInclude(patternTest, ignoreTestFiles);\n const coverage = await buildInclude(patternCov, ignoreCoverageFiles);\n return { files, coverage };\n};\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param ignore globs to exclude inside\n * @returns a vitest config\n *\n * @see {@link exclude.withPattern}\n * @remarks\n * You don't have to use test.exclude.\n * The default search patter is './src/**\\/*.ts'\n */\nexport function exclude(args: Args[1] = {}) {\n const patternCov = defaultCovPattern();\n const patternTest = testPattern();\n return exclude.withPattern({ patternCov, patternTest }, args);\n}\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param pattern The pattern where searching files\n * @param ignore globs to exclude inside\n * @returns a vitest config\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n enforce: 'pre',\n config: async options => {\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 );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: {\n ...coverage,\n include: all.coverage,\n },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;;AAcA,eAAsB,OAAO,OAAgB,
|
|
1
|
+
{"version":3,"file":"vitest.cjs","names":["testPattern","defaultCovPattern","buildInclude"],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Create includeTest and includeCoverage arrays from glob patterns\n *\n * @param args Globs to ignore for test and coverage files\n * @returns an object with includeTest and includeCoverage string arrays\n */\nexport async function create(args: Args[1] = {}) {\n const firsts = {\n patternTest: testPattern(),\n patternCov: defaultCovPattern(),\n };\n\n return create.withPattern(firsts, args);\n}\n\ncreate.withPattern = async (\n {\n patternTest = testPattern(),\n patternCov = defaultCovPattern(),\n }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n) => {\n const files = await buildInclude(patternTest, ignoreTestFiles);\n const coverage = await buildInclude(patternCov, ignoreCoverageFiles);\n return { files, coverage };\n};\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param ignore globs to exclude inside\n * @returns a vitest config\n *\n * @see {@link exclude.withPattern}\n * @remarks\n * You don't have to use test.exclude.\n * The default search patter is './src/**\\/*.ts'\n */\nexport function exclude(args: Args[1] = {}) {\n const patternCov = defaultCovPattern();\n const patternTest = testPattern();\n return exclude.withPattern({ patternCov, patternTest }, args);\n}\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param pattern The pattern where searching files\n * @param ignore globs to exclude inside\n * @returns a vitest config\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n enforce: 'pre',\n config: async options => {\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 );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: {\n ...coverage,\n include: all.coverage,\n },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;;AAcA,eAAsB,OAAO,OAAgB,CAAC,GAAG;CAC/C,MAAM,SAAS;EACb,aAAaA,oCAAAA,YAAY;EACzB,YAAYC,oCAAAA,kBAAkB;CAChC;CAEA,OAAO,OAAO,YAAY,QAAQ,IAAI;AACxC;AAEA,OAAO,cAAc,OACnB,EACE,cAAcD,oCAAAA,YAAY,GAC1B,aAAaC,oCAAAA,kBAAkB,MACX,CAAC,GACvB,EAAE,iBAAiB,wBAAiC,CAAC,MAClD;CAGH,OAAO;EAAE,OAAA,MAFWC,oCAAAA,aAAa,aAAa,eAAe;EAE7C,UAAA,MADOA,oCAAAA,aAAa,YAAY,mBAAmB;CAC1C;AAC3B;;;;;;;;;;;;AAaA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,MAAM,aAAaD,oCAAAA,kBAAkB;CACrC,MAAM,cAAcD,oCAAAA,YAAY;CAChC,OAAO,QAAQ,YAAY;EAAE;EAAY;CAAY,GAAG,IAAI;AAC9D;;;;;;;;AASA,QAAQ,gBACN,EAAE,aAAa,cACf,EAAE,qBAAqB,sBACpB;CACH,OAAO;EACL,MAAA,iCAAA;EACA,SAAS;EACT,QAAQ,OAAM,YAAW;GACvB,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,CACzC;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MACR,GAAG;MACH,SAAS,IAAI;KACf;IACF;GACF;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.js","names":[],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Create includeTest and includeCoverage arrays from glob patterns\n *\n * @param args Globs to ignore for test and coverage files\n * @returns an object with includeTest and includeCoverage string arrays\n */\nexport async function create(args: Args[1] = {}) {\n const firsts = {\n patternTest: testPattern(),\n patternCov: defaultCovPattern(),\n };\n\n return create.withPattern(firsts, args);\n}\n\ncreate.withPattern = async (\n {\n patternTest = testPattern(),\n patternCov = defaultCovPattern(),\n }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n) => {\n const files = await buildInclude(patternTest, ignoreTestFiles);\n const coverage = await buildInclude(patternCov, ignoreCoverageFiles);\n return { files, coverage };\n};\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param ignore globs to exclude inside\n * @returns a vitest config\n *\n * @see {@link exclude.withPattern}\n * @remarks\n * You don't have to use test.exclude.\n * The default search patter is './src/**\\/*.ts'\n */\nexport function exclude(args: Args[1] = {}) {\n const patternCov = defaultCovPattern();\n const patternTest = testPattern();\n return exclude.withPattern({ patternCov, patternTest }, args);\n}\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param pattern The pattern where searching files\n * @param ignore globs to exclude inside\n * @returns a vitest config\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n enforce: 'pre',\n config: async options => {\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 );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: {\n ...coverage,\n include: all.coverage,\n },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;AAcA,eAAsB,OAAO,OAAgB,
|
|
1
|
+
{"version":3,"file":"vitest.js","names":[],"sources":["../../src/vitest-exclude/vitest.ts"],"sourcesContent":["import { name } from './constants';\nimport type { Args, WithPattern } from './types';\nimport {\n buildInclude,\n defaultCovPattern,\n testPattern,\n} from './vitest.utils';\n\n/**\n * Create includeTest and includeCoverage arrays from glob patterns\n *\n * @param args Globs to ignore for test and coverage files\n * @returns an object with includeTest and includeCoverage string arrays\n */\nexport async function create(args: Args[1] = {}) {\n const firsts = {\n patternTest: testPattern(),\n patternCov: defaultCovPattern(),\n };\n\n return create.withPattern(firsts, args);\n}\n\ncreate.withPattern = async (\n {\n patternTest = testPattern(),\n patternCov = defaultCovPattern(),\n }: Partial<Args[0]> = {},\n { ignoreTestFiles, ignoreCoverageFiles }: Args[1] = {},\n) => {\n const files = await buildInclude(patternTest, ignoreTestFiles);\n const coverage = await buildInclude(patternCov, ignoreCoverageFiles);\n return { files, coverage };\n};\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param ignore globs to exclude inside\n * @returns a vitest config\n *\n * @see {@link exclude.withPattern}\n * @remarks\n * You don't have to use test.exclude.\n * The default search patter is './src/**\\/*.ts'\n */\nexport function exclude(args: Args[1] = {}) {\n const patternCov = defaultCovPattern();\n const patternTest = testPattern();\n return exclude.withPattern({ patternCov, patternTest }, args);\n}\n\n/**\n * Plugin to add files with glob patterns to vitest\n *\n * @param pattern The pattern where searching files\n * @param ignore globs to exclude inside\n * @returns a vitest config\n */\nexclude.withPattern = ((\n { patternTest, patternCov },\n { ignoreCoverageFiles, ignoreTestFiles },\n) => {\n return {\n name,\n enforce: 'pre',\n config: async options => {\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 );\n\n return {\n ...options,\n test: {\n ...testConfig,\n include: all.files,\n coverage: {\n ...coverage,\n include: all.coverage,\n },\n },\n };\n },\n };\n}) as WithPattern;\n"],"mappings":";;;;;;;;;AAcA,eAAsB,OAAO,OAAgB,CAAC,GAAG;CAC/C,MAAM,SAAS;EACb,aAAa,YAAY;EACzB,YAAY,kBAAkB;CAChC;CAEA,OAAO,OAAO,YAAY,QAAQ,IAAI;AACxC;AAEA,OAAO,cAAc,OACnB,EACE,cAAc,YAAY,GAC1B,aAAa,kBAAkB,MACX,CAAC,GACvB,EAAE,iBAAiB,wBAAiC,CAAC,MAClD;CAGH,OAAO;EAAE,OAAA,MAFW,aAAa,aAAa,eAAe;EAE7C,UAAA,MADO,aAAa,YAAY,mBAAmB;CAC1C;AAC3B;;;;;;;;;;;;AAaA,SAAgB,QAAQ,OAAgB,CAAC,GAAG;CAC1C,MAAM,aAAa,kBAAkB;CACrC,MAAM,cAAc,YAAY;CAChC,OAAO,QAAQ,YAAY;EAAE;EAAY;CAAY,GAAG,IAAI;AAC9D;;;;;;;;AASA,QAAQ,gBACN,EAAE,aAAa,cACf,EAAE,qBAAqB,sBACpB;CACH,OAAO;EACL;EACA,SAAS;EACT,QAAQ,OAAM,YAAW;GACvB,MAAM,aAAa,SAAS;GAC5B,MAAM,WAAW,SAAS,MAAM;GAEhC,MAAM,MAAM,MAAM,OAAO,YACvB;IAAE;IAAa;GAAW,GAC1B;IAAE;IAAqB;GAAgB,CACzC;GAEA,OAAO;IACL,GAAG;IACH,MAAM;KACJ,GAAG;KACH,SAAS,IAAI;KACb,UAAU;MACR,GAAG;MACH,SAAS,IAAI;KACf;IACF;GACF;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.utils.cjs","names":[],"sources":["../../src/vitest-exclude/vitest.utils.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { glob } from 'glob';\nimport { join } from 'node:path';\n\nexport const hasSrc = () => {\n return existsSync(join(process.cwd(), 'src'));\n};\n\nexport const defaultCovPattern = () => {\n const _src = hasSrc();\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.t{s,sx}`;\n};\n\nconst mapper = (str: string) => str.replace(/\\\\/g, '/');\nexport const buildInclude = async (\n pattern: string | string[],\n ignore?: string[],\n) => {\n const include = await glob(pattern, {\n ignore,\n cwd: process.cwd(),\n });\n\n return include.map(mapper).sort();\n};\n\nexport const testPattern = () => {\n const _src = hasSrc();\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.{test,spec}.{ts,js,tsx,jsx}`;\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"vitest.utils.cjs","names":[],"sources":["../../src/vitest-exclude/vitest.utils.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { glob } from 'glob';\nimport { join } from 'node:path';\n\nexport const hasSrc = () => {\n return existsSync(join(process.cwd(), 'src'));\n};\n\nexport const defaultCovPattern = () => {\n const _src = hasSrc();\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.t{s,sx}`;\n};\n\nconst mapper = (str: string) => str.replace(/\\\\/g, '/');\nexport const buildInclude = async (\n pattern: string | string[],\n ignore?: string[],\n) => {\n const include = await glob(pattern, {\n ignore,\n cwd: process.cwd(),\n });\n\n return include.map(mapper).sort();\n};\n\nexport const testPattern = () => {\n const _src = hasSrc();\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.{test,spec}.{ts,js,tsx,jsx}`;\n};\n"],"mappings":";;;;;AAIA,MAAa,eAAe;CAC1B,QAAA,GAAA,GAAA,WAAA,EAAA,GAAA,KAAA,KAAA,CAAuB,QAAQ,IAAI,GAAG,KAAK,CAAC;AAC9C;AAEA,MAAa,0BAA0B;;CAGrC,OAAO,GAFM,OAEA,IAAI,SAAS,GAAG;AAC/B;AAEA,MAAM,UAAU,QAAgB,IAAI,QAAQ,OAAO,GAAG;AACtD,MAAa,eAAe,OAC1B,SACA,WACG;CAMH,QAAO,OAAA,GAAA,KAAA,KAAA,CALoB,SAAS;EAClC;EACA,KAAK,QAAQ,IAAI;CACnB,CAAC,EAAA,CAEc,IAAI,MAAM,CAAC,CAAC,KAAK;AAClC;AAEA,MAAa,oBAAoB;;CAG/B,OAAO,GAFM,OAEA,IAAI,SAAS,GAAG;AAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.utils.js","names":[],"sources":["../../src/vitest-exclude/vitest.utils.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { glob } from 'glob';\nimport { join } from 'node:path';\n\nexport const hasSrc = () => {\n return existsSync(join(process.cwd(), 'src'));\n};\n\nexport const defaultCovPattern = () => {\n const _src = hasSrc();\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.t{s,sx}`;\n};\n\nconst mapper = (str: string) => str.replace(/\\\\/g, '/');\nexport const buildInclude = async (\n pattern: string | string[],\n ignore?: string[],\n) => {\n const include = await glob(pattern, {\n ignore,\n cwd: process.cwd(),\n });\n\n return include.map(mapper).sort();\n};\n\nexport const testPattern = () => {\n const _src = hasSrc();\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.{test,spec}.{ts,js,tsx,jsx}`;\n};\n"],"mappings":";;;;AAIA,MAAa,eAAe;CAC1B,OAAO,WAAW,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"vitest.utils.js","names":[],"sources":["../../src/vitest-exclude/vitest.utils.ts"],"sourcesContent":["import { existsSync } from 'fs';\nimport { glob } from 'glob';\nimport { join } from 'node:path';\n\nexport const hasSrc = () => {\n return existsSync(join(process.cwd(), 'src'));\n};\n\nexport const defaultCovPattern = () => {\n const _src = hasSrc();\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.t{s,sx}`;\n};\n\nconst mapper = (str: string) => str.replace(/\\\\/g, '/');\nexport const buildInclude = async (\n pattern: string | string[],\n ignore?: string[],\n) => {\n const include = await glob(pattern, {\n ignore,\n cwd: process.cwd(),\n });\n\n return include.map(mapper).sort();\n};\n\nexport const testPattern = () => {\n const _src = hasSrc();\n /* v8 ignore next */\n return `${_src ? 'src/' : ''}**/*.{test,spec}.{ts,js,tsx,jsx}`;\n};\n"],"mappings":";;;;AAIA,MAAa,eAAe;CAC1B,OAAO,WAAW,KAAK,QAAQ,IAAI,GAAG,KAAK,CAAC;AAC9C;AAEA,MAAa,0BAA0B;;CAGrC,OAAO,GAFM,OAEA,IAAI,SAAS,GAAG;AAC/B;AAEA,MAAM,UAAU,QAAgB,IAAI,QAAQ,OAAO,GAAG;AACtD,MAAa,eAAe,OAC1B,SACA,WACG;CAMH,QAAO,MALe,KAAK,SAAS;EAClC;EACA,KAAK,QAAQ,IAAI;CACnB,CAAC,EAAA,CAEc,IAAI,MAAM,CAAC,CAAC,KAAK;AAClC;AAEA,MAAa,oBAAoB;;CAG/B,OAAO,GAFM,OAEA,IAAI,SAAS,GAAG;AAC/B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
2
|
const require_vitest_extended_isFunction = require("./isFunction.cjs");
|
|
4
3
|
let vitest = require("vitest");
|
|
5
4
|
//#region src/vitest-extended/acceptation.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acceptation.cjs","names":["isFunction"],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import type { Fn } from './bemedev/globals/types';\nimport { expect, test } from 'vitest';\nimport { isFunction } from './isFunction';\n\nexport const useTestFunctionAcceptation = (f: Fn, _name?: string) => {\n const name = _name ?? f.name;\n\n test(`#01 => ${name} is defined`, () => {\n expect(f).toBeDefined();\n });\n test(`#02 => ${name} is a function`, () => {\n const check = isFunction(f);\n expect(check).toBe(true);\n });\n};\n\n/**\n * For test only\n * useTestFunctionAcceptation\n */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"acceptation.cjs","names":["isFunction"],"sources":["../../src/vitest-extended/acceptation.ts"],"sourcesContent":["import type { Fn } from './bemedev/globals/types';\nimport { expect, test } from 'vitest';\nimport { isFunction } from './isFunction';\n\nexport const useTestFunctionAcceptation = (f: Fn, _name?: string) => {\n const name = _name ?? f.name;\n\n test(`#01 => ${name} is defined`, () => {\n expect(f).toBeDefined();\n });\n test(`#02 => ${name} is a function`, () => {\n const check = isFunction(f);\n expect(check).toBe(true);\n });\n};\n\n/**\n * For test only\n * useTestFunctionAcceptation\n */\nexport const useTFA = useTestFunctionAcceptation;\n"],"mappings":";;;;AAIA,MAAa,8BAA8B,GAAO,UAAmB;CACnE,MAAM,OAAO,SAAS,EAAE;CAExB,CAAA,GAAA,OAAA,KAAA,CAAK,UAAU,KAAK,oBAAoB;EACtC,CAAA,GAAA,OAAA,OAAA,CAAO,CAAC,CAAC,CAAC,YAAY;CACxB,CAAC;CACD,CAAA,GAAA,OAAA,KAAA,CAAK,UAAU,KAAK,uBAAuB;EAEzC,CAAA,GAAA,OAAA,OAAA,CADcA,mCAAAA,WAAW,CACd,CAAC,CAAC,CAAC,KAAK,IAAI;CACzB,CAAC;AACH;;;;;AAMA,MAAa,SAAS"}
|