@bemedev/dev-utils 1.0.1 → 1.1.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.
Files changed (125) hide show
  1. package/README.md +59 -11
  2. package/lib/build-tests/addTarball.d.ts +1 -1
  3. package/lib/build-tests/buildPackageJson.d.ts +3 -3
  4. package/lib/build-tests/cleanup.d.ts +1 -1
  5. package/lib/build-tests/cli/cli.d.ts +51 -1
  6. package/lib/build-tests/cli/index.d.ts +1 -0
  7. package/lib/build-tests/cli/post.d.ts +5 -1
  8. package/lib/build-tests/cli/pre.d.ts +5 -1
  9. package/lib/build-tests/cli/test.d.ts +15 -1
  10. package/lib/build-tests/constants.d.ts +1 -1
  11. package/lib/build-tests/getRelativePath.d.ts +1 -1
  12. package/lib/build-tests/getTypescriptOutdir.d.ts +1 -1
  13. package/lib/build-tests/import.d.ts +2 -2
  14. package/lib/build-tests/imports/create.d.ts +3 -3
  15. package/lib/build-tests/imports/helper.cjs.map +1 -1
  16. package/lib/build-tests/imports/helper.d.ts +7 -3
  17. package/lib/build-tests/imports/helper.js.map +1 -1
  18. package/lib/build-tests/imports/index.d.ts +1 -1
  19. package/lib/build-tests/index.d.ts +5 -5
  20. package/lib/build-tests/pack.d.ts +1 -1
  21. package/lib/rolldown-config/config.cjs +23 -2
  22. package/lib/rolldown-config/config.cjs.map +1 -1
  23. package/lib/rolldown-config/config.d.ts +1 -1
  24. package/lib/rolldown-config/config.js +23 -2
  25. package/lib/rolldown-config/config.js.map +1 -1
  26. package/lib/rolldown-config/constants.d.ts +5 -5
  27. package/lib/rolldown-config/helpers.d.ts +2 -2
  28. package/lib/rolldown-config/index.d.ts +3 -3
  29. package/lib/rolldown-config/input.d.ts +1 -1
  30. package/lib/rolldown-config/output.cjs +4 -2
  31. package/lib/rolldown-config/output.cjs.map +1 -1
  32. package/lib/rolldown-config/output.d.ts +15 -1
  33. package/lib/rolldown-config/output.js +4 -2
  34. package/lib/rolldown-config/output.js.map +1 -1
  35. package/lib/rolldown-config/plugins/circulars.d.ts +9 -9
  36. package/lib/rolldown-config/plugins/clean.cjs +4 -2
  37. package/lib/rolldown-config/plugins/clean.cjs.map +1 -1
  38. package/lib/rolldown-config/plugins/clean.d.ts +13 -4
  39. package/lib/rolldown-config/plugins/clean.js +4 -2
  40. package/lib/rolldown-config/plugins/clean.js.map +1 -1
  41. package/lib/rolldown-config/plugins/externals.d.ts +7 -7
  42. package/lib/rolldown-config/plugins/index.cjs +8 -8
  43. package/lib/rolldown-config/plugins/index.cjs.map +1 -1
  44. package/lib/rolldown-config/plugins/index.d.ts +31 -2
  45. package/lib/rolldown-config/plugins/index.js +6 -7
  46. package/lib/rolldown-config/plugins/index.js.map +1 -1
  47. package/lib/rolldown-config/plugins/typescript.cjs +29 -41
  48. package/lib/rolldown-config/plugins/typescript.cjs.map +1 -1
  49. package/lib/rolldown-config/plugins/typescript.config.cjs +51 -39
  50. package/lib/rolldown-config/plugins/typescript.config.cjs.map +1 -1
  51. package/lib/rolldown-config/plugins/typescript.config.d.ts +3 -4
  52. package/lib/rolldown-config/plugins/typescript.config.js +51 -41
  53. package/lib/rolldown-config/plugins/typescript.config.js.map +1 -1
  54. package/lib/rolldown-config/plugins/typescript.d.ts +6 -6
  55. package/lib/rolldown-config/plugins/typescript.fast.cjs +80 -0
  56. package/lib/rolldown-config/plugins/typescript.fast.cjs.map +1 -0
  57. package/lib/rolldown-config/plugins/typescript.fast.d.ts +9 -0
  58. package/lib/rolldown-config/plugins/typescript.fast.js +77 -0
  59. package/lib/rolldown-config/plugins/typescript.fast.js.map +1 -0
  60. package/lib/rolldown-config/plugins/typescript.js +29 -43
  61. package/lib/rolldown-config/plugins/typescript.js.map +1 -1
  62. package/lib/rolldown-config/types.d.ts +14 -13
  63. package/lib/utils/array.d.ts +1 -1
  64. package/lib/utils/bemedev/globals/types.d.ts +4 -0
  65. package/lib/{vitest-extended → utils}/bemedev/globals/utils/_unknown.cjs +1 -1
  66. package/lib/utils/bemedev/globals/utils/_unknown.cjs.map +1 -0
  67. package/lib/utils/bemedev/globals/utils/_unknown.d.ts +12 -0
  68. package/lib/{vitest-extended → utils}/bemedev/globals/utils/_unknown.js +1 -1
  69. package/lib/utils/bemedev/globals/utils/_unknown.js.map +1 -0
  70. package/lib/utils/bemedev/globals/utils/expandFn.cjs +11 -0
  71. package/lib/utils/bemedev/globals/utils/expandFn.cjs.map +1 -0
  72. package/lib/utils/bemedev/globals/utils/expandFn.d.ts +2 -0
  73. package/lib/utils/bemedev/globals/utils/expandFn.js +10 -0
  74. package/lib/utils/bemedev/globals/utils/expandFn.js.map +1 -0
  75. package/lib/utils/identity.d.ts +1 -1
  76. package/lib/utils/index.cjs +2 -0
  77. package/lib/utils/index.d.ts +5 -4
  78. package/lib/utils/index.js +2 -1
  79. package/lib/utils/sleep.d.ts +1 -1
  80. package/lib/utils/types.d.ts +1 -4
  81. package/lib/vitest-exclude/index.d.ts +1 -1
  82. package/lib/vitest-exclude/types.d.ts +11 -8
  83. package/lib/vitest-exclude/vitest.cjs +0 -2
  84. package/lib/vitest-exclude/vitest.cjs.map +1 -1
  85. package/lib/vitest-exclude/vitest.d.ts +27 -15
  86. package/lib/vitest-exclude/vitest.js +0 -2
  87. package/lib/vitest-exclude/vitest.js.map +1 -1
  88. package/lib/vitest-exclude/vitest.utils.d.ts +2 -2
  89. package/lib/vitest-extended/acceptation.cjs.map +1 -1
  90. package/lib/vitest-extended/acceptation.d.ts +3 -2
  91. package/lib/vitest-extended/acceptation.js.map +1 -1
  92. package/lib/vitest-extended/createTests.cjs.map +1 -1
  93. package/lib/vitest-extended/createTests.d.ts +55 -34
  94. package/lib/vitest-extended/createTests.js.map +1 -1
  95. package/lib/vitest-extended/createTests.types.d.ts +6 -10
  96. package/lib/vitest-extended/done.d.ts +14 -8
  97. package/lib/vitest-extended/each/error.d.ts +1 -1
  98. package/lib/vitest-extended/each/error.types.d.ts +4 -10
  99. package/lib/vitest-extended/each/index.d.ts +2 -2
  100. package/lib/vitest-extended/each/pass.d.ts +26 -26
  101. package/lib/vitest-extended/each/pass.types.d.ts +6 -18
  102. package/lib/vitest-extended/fakeWaiter.d.ts +3 -3
  103. package/lib/vitest-extended/identity.d.ts +2 -2
  104. package/lib/vitest-extended/index.cjs +2 -0
  105. package/lib/vitest-extended/index.d.ts +7 -6
  106. package/lib/vitest-extended/index.js +2 -1
  107. package/lib/vitest-extended/isDefined.cjs.map +1 -1
  108. package/lib/vitest-extended/isDefined.d.ts +1 -1
  109. package/lib/vitest-extended/isDefined.js.map +1 -1
  110. package/lib/vitest-extended/isFunction.d.ts +1 -1
  111. package/lib/vitest-extended/project.cjs +23 -0
  112. package/lib/vitest-extended/project.cjs.map +1 -0
  113. package/lib/vitest-extended/project.d.ts +2 -0
  114. package/lib/vitest-extended/project.js +22 -0
  115. package/lib/vitest-extended/project.js.map +1 -0
  116. package/lib/vitest-extended/toArray.d.ts +1 -1
  117. package/lib/vitest-extended/toStringFlat.cjs.map +1 -1
  118. package/lib/vitest-extended/toStringFlat.d.ts +1 -1
  119. package/lib/vitest-extended/toStringFlat.js.map +1 -1
  120. package/lib/vitest-extended/types.d.ts +38 -40
  121. package/package.json +4 -8
  122. package/lib/vitest-extended/bemedev/globals/types.d.ts +0 -6
  123. package/lib/vitest-extended/bemedev/globals/utils/_unknown.cjs.map +0 -1
  124. package/lib/vitest-extended/bemedev/globals/utils/_unknown.d.ts +0 -12
  125. package/lib/vitest-extended/bemedev/globals/utils/_unknown.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.config.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { createRequire } from 'node:module';\nimport { dirname, join, resolve } from 'node:path';\n\nfunction stripComments(jsonString: string): string {\n return jsonString.replace(\n /\\\\\"|\"(?:\\\\\"|[^\"])*\"|(\\/\\/.*|\\/\\*[\\s\\S]*?\\*\\/)/g,\n (m, g) => (g ? '' : m),\n );\n}\n\nexport function findConfigFile(\n searchPath: string,\n configName: string = 'tsconfig.json',\n): string | undefined {\n let dir = searchPath;\n while (true) {\n const filePath = join(dir, configName);\n if (existsSync(filePath)) {\n return filePath;\n }\n const parentDir = dirname(dir);\n if (parentDir === dir) {\n break;\n }\n dir = parentDir;\n }\n return undefined;\n}\n\nexport const readTsConfig = (path: string): { compilerOptions: any } => {\n if (!existsSync(path)) {\n throw new Error(`tsconfig.json not found at ${path}`);\n }\n const content = readFileSync(path, 'utf-8');\n const cleanJson = stripComments(content);\n let config: any;\n try {\n config = JSON.parse(cleanJson);\n } catch (e: any) {\n throw new Error(\n `Failed to parse tsconfig.json at ${path}: ${e.message}`,\n { cause: e },\n );\n }\n\n let compilerOptions = config.compilerOptions || {};\n const configDir = dirname(path);\n\n const extendsPaths = Array.isArray(config.extends)\n ? config.extends\n : config.extends\n ? [config.extends]\n : [];\n\n for (const extPath of extendsPaths) {\n let baseConfigPath: string | undefined;\n if (extPath.startsWith('.')) {\n baseConfigPath = resolve(configDir, extPath);\n } else {\n baseConfigPath = findConfigFile(\n join(configDir, 'node_modules'),\n extPath,\n );\n if (!baseConfigPath) {\n baseConfigPath = createRequire(import.meta.url).resolve(extPath, {\n paths: [configDir],\n });\n }\n }\n\n if (baseConfigPath && existsSync(baseConfigPath)) {\n const baseConfig = readTsConfig(baseConfigPath);\n compilerOptions = {\n ...baseConfig.compilerOptions,\n ...compilerOptions,\n };\n }\n }\n\n if (compilerOptions.rootDir) {\n compilerOptions.rootDir = resolve(configDir, compilerOptions.rootDir);\n }\n\n if (compilerOptions.outDir) {\n compilerOptions.outDir = resolve(configDir, compilerOptions.outDir);\n }\n\n return { compilerOptions };\n};\n"],"mappings":";;;;AAIA,SAAS,cAAc,YAA4B;CACjD,OAAO,WAAW,QAChB,mDACC,GAAG,MAAO,IAAI,KAAK,CACtB;AACF;AAEA,SAAgB,eACd,YACA,aAAqB,iBACD;CACpB,IAAI,MAAM;CACV,OAAO,MAAM;EACX,M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olldown-config/plugins/typescript.config.ts"],"sourcesContent":["import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\n\nimport ts from '@typescript/typescript6';\n\nconst _readFile = (filePath: string): string | undefined => {\n try {\n return readFileSync(filePath, 'utf-8');\n } catch {\n return undefined;\n }\n};\n\nconst _readDirectory: ts.ParseConfigHost['readDirectory'] = (\n rootDir,\n extensions,\n _,\n __,\n depth,\n): string[] => {\n const results: string[] = [];\n\n const walk = (dir: string, currentDepth: number) => {\n if (depth !== undefined && currentDepth > depth) return;\n\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n\n for (const entry of entries) {\n const fullPath = join(dir, entry);\n let stat;\n try {\n stat = statSync(fullPath);\n } catch {\n continue;\n }\n\n if (stat.isDirectory()) {\n walk(fullPath, currentDepth + 1);\n } else if (\n !extensions ||\n extensions.some(ext => entry.endsWith(ext))\n ) {\n results.push(fullPath);\n }\n }\n };\n\n walk(rootDir, 0);\n return results;\n};\n\nconst _host: ts.ParseConfigHost = {\n useCaseSensitiveFileNames: true,\n readDirectory: _readDirectory,\n fileExists: existsSync,\n readFile: _readFile,\n};\n\nexport function getConfig(\n searchPath: string,\n configName: string = 'tsconfig.json',\n) {\n const tsconfigPath = ts.findConfigFile(\n searchPath,\n existsSync,\n configName,\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n return configFile;\n}\n\nexport const readTsConfig = (path: string) => {\n const configFile = ts.readConfigFile(path, _readFile);\n\n if (configFile.error) {\n throw new Error(\n ts.formatDiagnostic(configFile.error, {\n getCanonicalFileName: f => f,\n getCurrentDirectory: () => process.cwd(),\n getNewLine: () => '\\n',\n }),\n );\n }\n\n const parsedConfig = ts.parseJsonConfigFileContent(\n configFile.config,\n _host,\n dirname(path),\n );\n\n return parsedConfig;\n};\n"],"mappings":";;;;AAKA,MAAM,aAAa,aAAyC;CAC1D,IAAI;EACF,OAAO,aAAa,UAAU,OAAO;CACvC,QAAQ;EACN;CACF;AACF;AAEA,MAAM,kBACJ,SACA,YACA,GACA,IACA,UACa;CACb,MAAM,UAAoB,CAAC;CAE3B,MAAM,QAAQ,KAAa,iBAAyB;EAClD,IAAI,UAAU,KAAA,KAAa,eAAe,OAAO;EAEjD,IAAI;EACJ,IAAI;GACF,UAAU,YAAY,GAAG;EAC3B,QAAQ;GACN;EACF;EAEA,KAAK,MAAM,SAAS,SAAS;GAC3B,MAAM,WAAW,KAAK,KAAK,KAAK;GAChC,IAAI;GACJ,IAAI;IACF,OAAO,SAAS,QAAQ;GAC1B,QAAQ;IACN;GACF;GAEA,IAAI,KAAK,YAAY,GACnB,KAAK,UAAU,eAAe,CAAC;QAC1B,IACL,CAAC,cACD,WAAW,MAAK,QAAO,MAAM,SAAS,GAAG,CAAC,GAE1C,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,KAAK,SAAS,CAAC;CACf,OAAO;AACT;AAEA,MAAM,QAA4B;CAChC,2BAA2B;CAC3B,eAAe;CACf,YAAY;CACZ,UAAU;AACZ;AAEA,SAAgB,UACd,YACA,aAAqB,iBACrB;CACA,MAAM,eAAe,GAAG,eACtB,YACA,YACA,UACF;CAGA,OADmB,aAAa,YAChB;AAClB;AAEA,MAAa,gBAAgB,SAAiB;CAC5C,MAAM,aAAa,GAAG,eAAe,MAAM,SAAS;CAEpD,IAAI,WAAW,OACb,MAAM,IAAI,MACR,GAAG,iBAAiB,WAAW,OAAO;EACpC,uBAAsB,MAAK;EAC3B,2BAA2B,QAAQ,IAAI;EACvC,kBAAkB;CACpB,CAAC,CACH;CASF,OANqB,GAAG,2BACtB,WAAW,QACX,OACA,QAAQ,IAAI,CAGI;AACpB"}
@@ -1,9 +1,9 @@
1
- import type { RolldownPluginOption } from "rolldown";
1
+ import type { RolldownPluginOption } from 'rolldown';
2
2
  type Props = {
3
- exclude?: string | string[];
4
- include?: Record<string, string>;
5
- declarationMap?: boolean;
6
- dir?: string;
3
+ exclude?: string | string[];
4
+ include?: Record<string, string>;
5
+ declarationMap?: boolean;
6
+ dir?: string;
7
7
  };
8
- export declare const typescript: ({ exclude, include, declarationMap, dir }?: Props) => RolldownPluginOption;
8
+ export declare const typescript: ({ exclude, include, declarationMap, dir, }?: Props) => RolldownPluginOption;
9
9
  export {};
@@ -0,0 +1,80 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
3
+ const require_utils_array = require("../../utils/array.cjs");
4
+ require("../constants.cjs");
5
+ const require_rolldown_config_plugins_typescript_config = require("./typescript.config.cjs");
6
+ let fs = require("fs");
7
+ let path = require("path");
8
+ let glob = require("glob");
9
+ let _typescript_typescript6 = require("@typescript/typescript6");
10
+ _typescript_typescript6 = require_runtime.__toESM(_typescript_typescript6, 1);
11
+ let tsc_alias = require("tsc-alias");
12
+ let oxc_transform = require("oxc-transform");
13
+ //#region src/rolldown-config/plugins/typescript.fast.ts
14
+ const typescriptFast = ({ exclude, include, declarationMap, dir } = {}) => {
15
+ let done = false;
16
+ return {
17
+ name: "bemedev-fast-dts",
18
+ options(opts) {
19
+ opts.external = [...require_utils_array.toArray(opts.external).filter((v) => typeof v === "string" || v instanceof RegExp), "source-map-support"];
20
+ return opts;
21
+ },
22
+ closeBundle: {
23
+ order: "pre",
24
+ async handler() {
25
+ if (done) return;
26
+ const cwd = process.cwd();
27
+ const tsconfigPath = _typescript_typescript6.default.findConfigFile(cwd, fs.existsSync, "tsconfig.json");
28
+ const configFile = require_rolldown_config_plugins_typescript_config.readTsConfig(tsconfigPath);
29
+ const outDir = configFile.options.outDir ?? dir ?? "lib";
30
+ const rootDir = configFile.options.rootDir ?? (0, path.join)(cwd, "src");
31
+ let files;
32
+ if (include && Object.keys(include).length > 0) files = Object.values(include);
33
+ else files = (0, glob.globSync)((0, path.join)(rootDir, "**/*.{ts,tsx,cts,mts}"), { ignore: require_utils_array.toArray(exclude) });
34
+ files = files.filter((file) => !file.endsWith(".d.ts") && !file.endsWith(".d.cts") && !file.endsWith(".d.mts"));
35
+ const errors = [];
36
+ for (const file of files) try {
37
+ const result = (0, oxc_transform.transformSync)(file, (0, fs.readFileSync)(file, "utf-8"), {
38
+ sourcemap: !!declarationMap,
39
+ typescript: { declaration: { sourcemap: !!declarationMap } }
40
+ });
41
+ if (result.errors && result.errors.length > 0) errors.push(...result.errors);
42
+ const relativePath = (0, path.relative)(rootDir, file);
43
+ let dtsName = relativePath;
44
+ if (relativePath.endsWith(".tsx")) dtsName = relativePath.slice(0, -4) + ".d.ts";
45
+ else if (relativePath.endsWith(".ts")) dtsName = relativePath.slice(0, -3) + ".d.ts";
46
+ else if (relativePath.endsWith(".cts")) dtsName = relativePath.slice(0, -4) + ".d.cts";
47
+ else if (relativePath.endsWith(".mts")) dtsName = relativePath.slice(0, -4) + ".d.mts";
48
+ const outPath = (0, path.join)(outDir, dtsName);
49
+ const outMapPath = outPath + ".map";
50
+ (0, fs.mkdirSync)((0, path.dirname)(outPath), { recursive: true });
51
+ let dtsCode = result.declaration ?? "";
52
+ if (declarationMap && result.declarationMap) {
53
+ dtsCode += `\n//# sourceMappingURL=${(0, path.basename)(dtsName)}.map\n`;
54
+ (0, fs.writeFileSync)(outMapPath, JSON.stringify(result.declarationMap), "utf-8");
55
+ }
56
+ (0, fs.writeFileSync)(outPath, dtsCode, "utf-8");
57
+ } catch (err) {
58
+ console.error(`[bemedev-dts] Failed to process ${file}:`, err);
59
+ }
60
+ if (errors.length > 0) {
61
+ console.error(`[bemedev-dts] Generation completed with errors:`);
62
+ for (const err of errors) {
63
+ console.error(`Error in ${err.filename || "unknown file"}: ${err.message}`);
64
+ if (err.codeframe) console.error(err.codeframe);
65
+ }
66
+ }
67
+ await (0, tsc_alias.replaceTscAliasPaths)({
68
+ configFile: tsconfigPath,
69
+ outDir
70
+ });
71
+ done = true;
72
+ console.log("DTS generation complete");
73
+ }
74
+ }
75
+ };
76
+ };
77
+ //#endregion
78
+ exports.typescriptFast = typescriptFast;
79
+
80
+ //# sourceMappingURL=typescript.fast.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.fast.cjs","names":["toArray","ts","existsSync","readTsConfig"],"sources":["../../../src/rolldown-config/plugins/typescript.fast.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n} from 'node:fs';\nimport { basename, dirname, join, relative } from 'node:path';\n\nimport ts from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport { transformSync } from 'oxc-transform';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescriptFast = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-fast-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n const rootDir = configFile.options.rootDir ?? join(cwd, 'src');\n\n let files: string[];\n if (include && Object.keys(include).length > 0) {\n files = Object.values(include);\n } else {\n files = globSync(join(rootDir, '**/*.{ts,tsx,cts,mts}'), {\n ignore: toArray(exclude),\n });\n }\n\n files = files.filter(\n file =>\n !file.endsWith('.d.ts') &&\n !file.endsWith('.d.cts') &&\n !file.endsWith('.d.mts'),\n );\n\n const errors: any[] = [];\n\n for (const file of files) {\n try {\n const content = readFileSync(file, 'utf-8');\n const result = transformSync(file, content, {\n sourcemap: !!declarationMap,\n typescript: { declaration: { sourcemap: !!declarationMap } },\n });\n\n if (result.errors && result.errors.length > 0) {\n errors.push(...result.errors);\n }\n\n // Compute output path relative to rootDir\n const relativePath = relative(rootDir, file);\n let dtsName = relativePath;\n if (relativePath.endsWith('.tsx')) {\n dtsName = relativePath.slice(0, -4) + '.d.ts';\n } else if (relativePath.endsWith('.ts')) {\n dtsName = relativePath.slice(0, -3) + '.d.ts';\n } else if (relativePath.endsWith('.cts')) {\n dtsName = relativePath.slice(0, -4) + '.d.cts';\n } else if (relativePath.endsWith('.mts')) {\n dtsName = relativePath.slice(0, -4) + '.d.mts';\n }\n\n const outPath = join(outDir, dtsName);\n const outMapPath = outPath + '.map';\n\n // Ensure output directory exists\n mkdirSync(dirname(outPath), { recursive: true });\n\n let dtsCode = result.declaration ?? '';\n if (declarationMap && result.declarationMap) {\n dtsCode += `\\n//# sourceMappingURL=${basename(dtsName)}.map\\n`;\n writeFileSync(\n outMapPath,\n JSON.stringify(result.declarationMap),\n 'utf-8',\n );\n }\n\n writeFileSync(outPath, dtsCode, 'utf-8');\n } catch (err: any) {\n console.error(`[bemedev-dts] Failed to process ${file}:`, err);\n }\n }\n\n if (errors.length > 0) {\n console.error(`[bemedev-dts] Generation completed with errors:`);\n for (const err of errors) {\n console.error(\n `Error in ${err.filename || 'unknown file'}: ${err.message}`,\n );\n if (err.codeframe) {\n console.error(err.codeframe);\n }\n }\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;;AA0BA,MAAa,kBAAkB,EAC7B,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHAA,oBAAAA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,MAEl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,EAAE,IAAI;UACjC,IAAI,aAAa,SAAS,MAAM,GACrC,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;UACjC,IAAI,aAAa,SAAS,MAAM,GACrC,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI;KAGxC,MAAM,WAAA,GAAA,KAAA,KAAA,CAAe,QAAQ,OAAO;KACpC,MAAM,aAAa,UAAU;KAG7B,CAAA,GAAA,GAAA,UAAA,EAAA,GAAA,KAAA,QAAA,CAAkB,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;KAE/C,IAAI,UAAU,OAAO,eAAe;KACpC,IAAI,kBAAkB,OAAO,gBAAgB;MAC3C,WAAW,2BAAA,GAAA,KAAA,SAAA,CAAmC,OAAO,EAAE;MACvD,CAAA,GAAA,GAAA,cAAA,CACE,YACA,KAAK,UAAU,OAAO,cAAc,GACpC,OACF;KACF;KAEA,CAAA,GAAA,GAAA,cAAA,CAAc,SAAS,SAAS,OAAO;IACzC,SAAS,KAAU;KACjB,QAAQ,MAAM,mCAAmC,KAAK,IAAI,GAAG;IAC/D;IAGF,IAAI,OAAO,SAAS,GAAG;KACrB,QAAQ,MAAM,iDAAiD;KAC/D,KAAK,MAAM,OAAO,QAAQ;MACxB,QAAQ,MACN,YAAY,IAAI,YAAY,eAAe,IAAI,IAAI,SACrD;MACA,IAAI,IAAI,WACN,QAAQ,MAAM,IAAI,SAAS;KAE/B;IACF;IAEA,OAAA,GAAA,UAAA,qBAAA,CAA2B;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
@@ -0,0 +1,9 @@
1
+ import type { RolldownPluginOption } from 'rolldown';
2
+ type Props = {
3
+ exclude?: string | string[];
4
+ include?: Record<string, string>;
5
+ declarationMap?: boolean;
6
+ dir?: string;
7
+ };
8
+ export declare const typescriptFast: ({ exclude, include, declarationMap, dir, }?: Props) => RolldownPluginOption;
9
+ export {};
@@ -0,0 +1,77 @@
1
+ import { toArray } from "../../utils/array.js";
2
+ import "../constants.js";
3
+ import { readTsConfig } from "./typescript.config.js";
4
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
5
+ import { basename, dirname, join, relative } from "path";
6
+ import { globSync } from "glob";
7
+ import ts from "@typescript/typescript6";
8
+ import { replaceTscAliasPaths } from "tsc-alias";
9
+ import { transformSync } from "oxc-transform";
10
+ //#region src/rolldown-config/plugins/typescript.fast.ts
11
+ const typescriptFast = ({ exclude, include, declarationMap, dir } = {}) => {
12
+ let done = false;
13
+ return {
14
+ name: "bemedev-fast-dts",
15
+ options(opts) {
16
+ opts.external = [...toArray(opts.external).filter((v) => typeof v === "string" || v instanceof RegExp), "source-map-support"];
17
+ return opts;
18
+ },
19
+ closeBundle: {
20
+ order: "pre",
21
+ async handler() {
22
+ if (done) return;
23
+ const cwd = process.cwd();
24
+ const tsconfigPath = ts.findConfigFile(cwd, existsSync, "tsconfig.json");
25
+ const configFile = readTsConfig(tsconfigPath);
26
+ const outDir = configFile.options.outDir ?? dir ?? "lib";
27
+ const rootDir = configFile.options.rootDir ?? join(cwd, "src");
28
+ let files;
29
+ if (include && Object.keys(include).length > 0) files = Object.values(include);
30
+ else files = globSync(join(rootDir, "**/*.{ts,tsx,cts,mts}"), { ignore: toArray(exclude) });
31
+ files = files.filter((file) => !file.endsWith(".d.ts") && !file.endsWith(".d.cts") && !file.endsWith(".d.mts"));
32
+ const errors = [];
33
+ for (const file of files) try {
34
+ const result = transformSync(file, readFileSync(file, "utf-8"), {
35
+ sourcemap: !!declarationMap,
36
+ typescript: { declaration: { sourcemap: !!declarationMap } }
37
+ });
38
+ if (result.errors && result.errors.length > 0) errors.push(...result.errors);
39
+ const relativePath = relative(rootDir, file);
40
+ let dtsName = relativePath;
41
+ if (relativePath.endsWith(".tsx")) dtsName = relativePath.slice(0, -4) + ".d.ts";
42
+ else if (relativePath.endsWith(".ts")) dtsName = relativePath.slice(0, -3) + ".d.ts";
43
+ else if (relativePath.endsWith(".cts")) dtsName = relativePath.slice(0, -4) + ".d.cts";
44
+ else if (relativePath.endsWith(".mts")) dtsName = relativePath.slice(0, -4) + ".d.mts";
45
+ const outPath = join(outDir, dtsName);
46
+ const outMapPath = outPath + ".map";
47
+ mkdirSync(dirname(outPath), { recursive: true });
48
+ let dtsCode = result.declaration ?? "";
49
+ if (declarationMap && result.declarationMap) {
50
+ dtsCode += `\n//# sourceMappingURL=${basename(dtsName)}.map\n`;
51
+ writeFileSync(outMapPath, JSON.stringify(result.declarationMap), "utf-8");
52
+ }
53
+ writeFileSync(outPath, dtsCode, "utf-8");
54
+ } catch (err) {
55
+ console.error(`[bemedev-dts] Failed to process ${file}:`, err);
56
+ }
57
+ if (errors.length > 0) {
58
+ console.error(`[bemedev-dts] Generation completed with errors:`);
59
+ for (const err of errors) {
60
+ console.error(`Error in ${err.filename || "unknown file"}: ${err.message}`);
61
+ if (err.codeframe) console.error(err.codeframe);
62
+ }
63
+ }
64
+ await replaceTscAliasPaths({
65
+ configFile: tsconfigPath,
66
+ outDir
67
+ });
68
+ done = true;
69
+ console.log("DTS generation complete");
70
+ }
71
+ }
72
+ };
73
+ };
74
+ //#endregion
75
+ export { typescriptFast };
76
+
77
+ //# sourceMappingURL=typescript.fast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript.fast.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.fast.ts"],"sourcesContent":["import {\n existsSync,\n mkdirSync,\n readFileSync,\n writeFileSync,\n} from 'node:fs';\nimport { basename, dirname, join, relative } from 'node:path';\n\nimport ts from '@typescript/typescript6';\nimport { globSync } from 'glob';\nimport { transformSync } from 'oxc-transform';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescriptFast = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-fast-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n const rootDir = configFile.options.rootDir ?? join(cwd, 'src');\n\n let files: string[];\n if (include && Object.keys(include).length > 0) {\n files = Object.values(include);\n } else {\n files = globSync(join(rootDir, '**/*.{ts,tsx,cts,mts}'), {\n ignore: toArray(exclude),\n });\n }\n\n files = files.filter(\n file =>\n !file.endsWith('.d.ts') &&\n !file.endsWith('.d.cts') &&\n !file.endsWith('.d.mts'),\n );\n\n const errors: any[] = [];\n\n for (const file of files) {\n try {\n const content = readFileSync(file, 'utf-8');\n const result = transformSync(file, content, {\n sourcemap: !!declarationMap,\n typescript: { declaration: { sourcemap: !!declarationMap } },\n });\n\n if (result.errors && result.errors.length > 0) {\n errors.push(...result.errors);\n }\n\n // Compute output path relative to rootDir\n const relativePath = relative(rootDir, file);\n let dtsName = relativePath;\n if (relativePath.endsWith('.tsx')) {\n dtsName = relativePath.slice(0, -4) + '.d.ts';\n } else if (relativePath.endsWith('.ts')) {\n dtsName = relativePath.slice(0, -3) + '.d.ts';\n } else if (relativePath.endsWith('.cts')) {\n dtsName = relativePath.slice(0, -4) + '.d.cts';\n } else if (relativePath.endsWith('.mts')) {\n dtsName = relativePath.slice(0, -4) + '.d.mts';\n }\n\n const outPath = join(outDir, dtsName);\n const outMapPath = outPath + '.map';\n\n // Ensure output directory exists\n mkdirSync(dirname(outPath), { recursive: true });\n\n let dtsCode = result.declaration ?? '';\n if (declarationMap && result.declarationMap) {\n dtsCode += `\\n//# sourceMappingURL=${basename(dtsName)}.map\\n`;\n writeFileSync(\n outMapPath,\n JSON.stringify(result.declarationMap),\n 'utf-8',\n );\n }\n\n writeFileSync(outPath, dtsCode, 'utf-8');\n } catch (err: any) {\n console.error(`[bemedev-dts] Failed to process ${file}:`, err);\n }\n }\n\n if (errors.length > 0) {\n console.error(`[bemedev-dts] Generation completed with errors:`);\n for (const err of errors) {\n console.error(\n `Error in ${err.filename || 'unknown file'}: ${err.message}`,\n );\n if (err.codeframe) {\n console.error(err.codeframe);\n }\n }\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;;AA0BA,MAAa,kBAAkB,EAC7B,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,MAElB,GAAG,oBAAoB;GAClD,OAAO;EACT;EACA,aAAa;GACX,OAAO;GACP,MAAM,UAAU;IACd,IAAI,MAAM;IACV,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAe,GAAG,eACtB,KACA,YACA,eACF;IAEA,MAAM,aAAa,aAAa,YAAY;IAC5C,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAC5C,MAAM,UAAU,WAAW,QAAQ,WAAW,KAAK,KAAK,KAAK;IAE7D,IAAI;IACJ,IAAI,WAAW,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,GAC3C,QAAQ,OAAO,OAAO,OAAO;SAE7B,QAAQ,SAAS,KAAK,SAAS,uBAAuB,GAAG,EACvD,QAAQ,QAAQ,OAAO,EACzB,CAAC;IAGH,QAAQ,MAAM,QACZ,SACE,CA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AY,eAAe,IAAI,IAAI,SACrD;MACA,IAAI,IAAI,WACN,QAAQ,MAAM,IAAI,SAAS;KAE/B;IACF;IAEA,MAAM,qBAAqB;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
@@ -1,10 +1,8 @@
1
1
  import { toArray } from "../../utils/array.js";
2
2
  import "../constants.js";
3
- import { findConfigFile, readTsConfig } from "./typescript.config.js";
4
- import { mkdirSync, readFileSync, writeFileSync } from "fs";
5
- import { basename, dirname, join, relative } from "path";
6
- import { globSync } from "glob";
7
- import { transformSync } from "oxc-transform";
3
+ import { readTsConfig } from "./typescript.config.js";
4
+ import { existsSync } from "fs";
5
+ import ts from "@typescript/typescript6";
8
6
  import { replaceTscAliasPaths } from "tsc-alias";
9
7
  //#region src/rolldown-config/plugins/typescript.ts
10
8
  const typescript = ({ exclude, include, declarationMap, dir } = {}) => {
@@ -20,46 +18,34 @@ const typescript = ({ exclude, include, declarationMap, dir } = {}) => {
20
18
  async handler() {
21
19
  if (done) return;
22
20
  const cwd = process.cwd();
23
- const tsconfigPath = findConfigFile(cwd, "tsconfig.json");
21
+ const tsconfigPath = ts.findConfigFile(cwd, existsSync, "tsconfig.json");
24
22
  const configFile = readTsConfig(tsconfigPath);
25
- const outDir = configFile.compilerOptions.outDir ?? dir ?? "lib";
26
- const rootDir = configFile.compilerOptions.rootDir ?? join(cwd, "src");
27
- let files;
28
- if (include && Object.keys(include).length > 0) files = Object.values(include);
29
- else files = globSync(join(rootDir, "**/*.{ts,tsx,cts,mts}"), { ignore: toArray(exclude) });
30
- files = files.filter((file) => !file.endsWith(".d.ts") && !file.endsWith(".d.cts") && !file.endsWith(".d.mts"));
31
- const errors = [];
32
- for (const file of files) try {
33
- const result = transformSync(file, readFileSync(file, "utf-8"), {
34
- typescript: { declaration: { sourcemap: !!declarationMap } },
35
- sourcemap: !!declarationMap
36
- });
37
- if (result.errors && result.errors.length > 0) errors.push(...result.errors);
38
- const relativePath = relative(rootDir, file);
39
- let dtsName = relativePath;
40
- if (relativePath.endsWith(".tsx")) dtsName = relativePath.slice(0, -4) + ".d.ts";
41
- else if (relativePath.endsWith(".ts")) dtsName = relativePath.slice(0, -3) + ".d.ts";
42
- else if (relativePath.endsWith(".cts")) dtsName = relativePath.slice(0, -4) + ".d.cts";
43
- else if (relativePath.endsWith(".mts")) dtsName = relativePath.slice(0, -4) + ".d.mts";
44
- const outPath = join(outDir, dtsName);
45
- const outMapPath = outPath + ".map";
46
- mkdirSync(dirname(outPath), { recursive: true });
47
- let dtsCode = result.declaration ?? "";
48
- if (declarationMap && result.declarationMap) {
49
- dtsCode += `\n//# sourceMappingURL=${basename(dtsName)}.map\n`;
50
- writeFileSync(outMapPath, JSON.stringify(result.declarationMap), "utf-8");
23
+ const host = ts.createCompilerHost(configFile.options);
24
+ const outDir = configFile.options.outDir ?? dir ?? "lib";
25
+ const parsed = ts.parseJsonConfigFileContent({
26
+ ...configFile,
27
+ include,
28
+ exclude: [...toArray(exclude), "*.ts"],
29
+ compilerOptions: {
30
+ ...configFile.options,
31
+ outDir,
32
+ noEmit: false,
33
+ emitDeclarationOnly: true,
34
+ declaration: true,
35
+ declarationMap
51
36
  }
52
- writeFileSync(outPath, dtsCode, "utf-8");
53
- } catch (err) {
54
- console.error(`[bemedev-dts] Failed to process ${file}:`, err);
55
- }
56
- if (errors.length > 0) {
57
- console.error(`[bemedev-dts] Generation completed with errors:`);
58
- for (const err of errors) {
59
- console.error(`Error in ${err.filename || "unknown file"}: ${err.message}`);
60
- if (err.codeframe) console.error(err.codeframe);
61
- }
62
- }
37
+ }, ts.sys, cwd);
38
+ const program = ts.createProgram(parsed.fileNames, {
39
+ ...configFile.options,
40
+ outDir,
41
+ noEmit: false,
42
+ emitDeclarationOnly: true,
43
+ declaration: true,
44
+ declarationMap
45
+ }, host);
46
+ const emitResult = program.emit();
47
+ const errors = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics).filter((d) => d.category === ts.DiagnosticCategory.Error);
48
+ if (errors.length > 0) console.error(ts.formatDiagnosticsWithColorAndContext(errors, host));
63
49
  await replaceTscAliasPaths({
64
50
  configFile: tsconfigPath,
65
51
  outDir
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { basename, dirname, join, relative } from 'node:path';\n\nimport { globSync } from 'glob';\nimport { transformSync } from 'oxc-transform';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\nimport { findConfigFile, readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = findConfigFile(cwd, 'tsconfig.json')!;\n\n const configFile = readTsConfig(tsconfigPath);\n const outDir =\n configFile.compilerOptions.outDir ?? dir ?? DEFAULT_DIR;\n const rootDir =\n configFile.compilerOptions.rootDir ?? join(cwd, 'src');\n\n let files: string[];\n if (include && Object.keys(include).length > 0) {\n files = Object.values(include);\n } else {\n files = globSync(join(rootDir, '**/*.{ts,tsx,cts,mts}'), {\n ignore: toArray(exclude),\n });\n }\n\n files = files.filter(\n file =>\n !file.endsWith('.d.ts') &&\n !file.endsWith('.d.cts') &&\n !file.endsWith('.d.mts'),\n );\n\n const errors: any[] = [];\n\n for (const file of files) {\n try {\n const content = readFileSync(file, 'utf-8');\n const result = transformSync(file, content, {\n typescript: { declaration: { sourcemap: !!declarationMap } },\n sourcemap: !!declarationMap,\n });\n\n if (result.errors && result.errors.length > 0) {\n errors.push(...result.errors);\n }\n\n // Compute output path relative to rootDir\n const relativePath = relative(rootDir, file);\n let dtsName = relativePath;\n if (relativePath.endsWith('.tsx')) {\n dtsName = relativePath.slice(0, -4) + '.d.ts';\n } else if (relativePath.endsWith('.ts')) {\n dtsName = relativePath.slice(0, -3) + '.d.ts';\n } else if (relativePath.endsWith('.cts')) {\n dtsName = relativePath.slice(0, -4) + '.d.cts';\n } else if (relativePath.endsWith('.mts')) {\n dtsName = relativePath.slice(0, -4) + '.d.mts';\n }\n\n const outPath = join(outDir, dtsName);\n const outMapPath = outPath + '.map';\n\n // Ensure output directory exists\n mkdirSync(dirname(outPath), { recursive: true });\n\n let dtsCode = result.declaration ?? '';\n if (declarationMap && result.declarationMap) {\n dtsCode += `\\n//# sourceMappingURL=${basename(dtsName)}.map\\n`;\n writeFileSync(\n outMapPath,\n JSON.stringify(result.declarationMap),\n 'utf-8',\n );\n }\n\n writeFileSync(outPath, dtsCode, 'utf-8');\n } catch (err: any) {\n console.error(`[bemedev-dts] Failed to process ${file}:`, err);\n }\n }\n\n if (errors.length > 0) {\n console.error(`[bemedev-dts] Generation completed with errors:`);\n for (const err of errors) {\n console.error(\n `Error in ${err.filename || 'unknown file'}: ${err.message}`,\n );\n if (err.codeframe) {\n console.error(err.codeframe);\n }\n }\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;;;AAoBA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,M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AM,GAAG,EAAE,IAAI;KAGxC,MAAM,UAAU,KAAK,QAAQ,OAAO;KACpC,MAAM,aAAa,UAAU;KAG7B,UAAU,QAAQ,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;KAE/C,IAAI,UAAU,OAAO,eAAe;KACpC,IAAI,kBAAkB,OAAO,gBAAgB;MAC3C,WAAW,0BAA0B,SAAS,OAAO,EAAE;MACvD,cACE,YACA,KAAK,UAAU,OAAO,cAAc,GACpC,OACF;KACF;KAEA,cAAc,SAAS,SAAS,OAAO;IACzC,SAAS,KAAU;KACjB,QAAQ,MAAM,mCAAmC,KAAK,IAAI,GAAG;IAC/D;IAGF,IAAI,OAAO,SAAS,GAAG;KACrB,QAAQ,MAAM,iDAAiD;KAC/D,KAAK,MAAM,OAAO,QAAQ;MACxB,QAAQ,MACN,YAAY,IAAI,YAAY,eAAe,IAAI,IAAI,SACrD;MACA,IAAI,IAAI,WACN,QAAQ,MAAM,IAAI,SAAS;KAE/B;IACF;IAEA,MAAM,qBAAqB;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
1
+ {"version":3,"file":"typescript.js","names":[],"sources":["../../../src/rolldown-config/plugins/typescript.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\n\nimport ts from '@typescript/typescript6';\nimport type { RolldownPluginOption } from 'rolldown';\nimport { replaceTscAliasPaths } from 'tsc-alias';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_DIR } from '../constants';\nimport { readTsConfig } from './typescript.config';\n\ntype Props = {\n exclude?: string | string[];\n include?: Record<string, string>;\n declarationMap?: boolean;\n dir?: string;\n};\n\nexport const typescript = ({\n exclude,\n include,\n declarationMap,\n dir,\n}: Props = {}): RolldownPluginOption => {\n let done = false;\n\n return {\n name: 'bemedev-dts',\n options(opts) {\n const existing = toArray(opts.external).filter(\n v => typeof v === 'string' || v instanceof RegExp,\n );\n opts.external = [...existing, 'source-map-support'];\n return opts;\n },\n closeBundle: {\n order: 'pre',\n async handler() {\n if (done) return;\n const cwd = process.cwd();\n\n const tsconfigPath = ts.findConfigFile(\n cwd,\n existsSync,\n 'tsconfig.json',\n )!;\n\n const configFile = readTsConfig(tsconfigPath);\n const host = ts.createCompilerHost(configFile.options);\n const outDir = configFile.options.outDir ?? dir ?? DEFAULT_DIR;\n\n const parsed = ts.parseJsonConfigFileContent(\n {\n ...configFile,\n include,\n exclude: [...toArray(exclude), '*.ts'],\n compilerOptions: {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n },\n ts.sys,\n cwd,\n );\n\n const program = ts.createProgram(\n parsed.fileNames,\n {\n ...configFile.options,\n outDir,\n noEmit: false,\n emitDeclarationOnly: true,\n declaration: true,\n declarationMap,\n },\n host,\n );\n\n const emitResult = program.emit();\n\n const errors = ts\n .getPreEmitDiagnostics(program)\n .concat(emitResult.diagnostics)\n .filter(d => d.category === ts.DiagnosticCategory.Error);\n\n if (errors.length > 0) {\n console.error(\n ts.formatDiagnosticsWithColorAndContext(errors, host),\n );\n }\n\n await replaceTscAliasPaths({ configFile: tsconfigPath, outDir });\n\n done = true;\n console.log('DTS generation complete');\n },\n },\n };\n};\n"],"mappings":";;;;;;;AAkBA,MAAa,cAAc,EACzB,SACA,SACA,gBACA,QACS,CAAC,MAA4B;CACtC,IAAI,OAAO;CAEX,OAAO;EACL,MAAM;EACN,QAAQ,MAAM;GAIZ,KAAK,WAAW,CAAC,GAHA,QAAQ,KAAK,QAAQ,CAAC,CAAC,QACtC,MAAK,OAAO,MAAM,YAAY,aAAa,MAElB,GAAG,oBAAoB;GAClD,OAAO;EACT;EACA,aAAa;GACX,OAAO;GACP,MAAM,UAAU;IACd,IAAI,MAAM;IACV,MAAM,MAAM,QAAQ,IAAI;IAExB,MAAM,eAAe,GAAG,eACtB,KACA,YACA,eACF;IAEA,MAAM,aAAa,aAAa,YAAY;IAC5C,MAAM,OAAO,GAAG,mBAAmB,WAAW,OAAO;IACrD,MAAM,SAAS,WAAW,QAAQ,UAAU,OAAA;IAE5C,MAAM,SAAS,GAAG,2BAChB;KACE,GAAG;KACH;KACA,SAAS,CAAC,GAAG,QAAQ,OAAO,GAAG,MAAM;KACrC,iBAAiB;MACf,GAAG,WAAW;MACd;MACA,QAAQ;MACR,qBAAqB;MACrB,aAAa;MACb;KACF;IACF,GACA,GAAG,KACH,GACF;IAEA,MAAM,UAAU,GAAG,cACjB,OAAO,WACP;KACE,GAAG,WAAW;KACd;KACA,QAAQ;KACR,qBAAqB;KACrB,aAAa;KACb;IACF,GACA,IACF;IAEA,MAAM,aAAa,QAAQ,KAAK;IAEhC,MAAM,SAAS,GACZ,sBAAsB,OAAO,CAAC,CAC9B,OAAO,WAAW,WAAW,CAAC,CAC9B,QAAO,MAAK,EAAE,aAAa,GAAG,mBAAmB,KAAK;IAEzD,IAAI,OAAO,SAAS,GAClB,QAAQ,MACN,GAAG,qCAAqC,QAAQ,IAAI,CACtD;IAGF,MAAM,qBAAqB;KAAE,YAAY;KAAc;IAAO,CAAC;IAE/D,OAAO;IACP,QAAQ,IAAI,yBAAyB;GACvC;EACF;CACF;AACF"}
@@ -1,20 +1,21 @@
1
- import type { RolldownPluginOption, RolldownOptions } from "rolldown";
1
+ import type { RolldownPluginOption, RolldownOptions } from 'rolldown';
2
2
  export type { RolldownOptions };
3
- import type { PLUGIN_BUILDERS } from "./plugins";
3
+ import type { PLUGIN_BUILDERS } from './plugins';
4
4
  export type ToArray_F = <T>(value?: T | T[]) => T[];
5
5
  export type Params = {
6
- circularDeps?: string | string[];
7
- excludesTS?: string | string[];
8
- ignoresJS?: string | string[];
9
- externals?: string | string[];
10
- dir?: string;
11
- sourcemap?: boolean;
12
- declarationMap?: boolean;
13
- plugins?: (RolldownPluginOption | keyof typeof PLUGIN_BUILDERS)[];
6
+ circularDeps?: string | string[];
7
+ excludesTS?: string | string[];
8
+ ignoresJS?: string | string[];
9
+ externals?: string | string[];
10
+ dir?: string;
11
+ sourcemap?: boolean;
12
+ declarationMap?: boolean;
13
+ plugins?: (RolldownPluginOption | keyof typeof PLUGIN_BUILDERS)[];
14
14
  };
15
15
  export type BuildInput_F = (...ignores: string[]) => Record<string, string>;
16
16
  export type Config_F = {
17
- (additionals?: Params): RolldownOptions;
18
- bemedev: (additionals?: Params) => RolldownOptions;
19
- default: (additionals?: Params) => RolldownOptions;
17
+ (additionals?: Params): RolldownOptions;
18
+ bemedev: (additionals?: Params) => RolldownOptions;
19
+ fast: (additionals?: Omit<Params, 'plugins'>) => RolldownOptions;
20
+ default: (additionals?: Params) => RolldownOptions;
20
21
  };
@@ -1,2 +1,2 @@
1
- import type { ToArray_F } from "./types";
1
+ import type { ToArray_F } from './types';
2
2
  export declare const toArray: ToArray_F;
@@ -0,0 +1,4 @@
1
+ export type Fn<Args extends any[] = any[], R = any> = (...args: Args) => R;
2
+ export type FnBasic<Main extends Fn, Tr extends object> = Tr & Main;
3
+ export type RuA = readonly unknown[];
4
+ export type Undefiny<T> = T | undefined | null;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/vitest-extended/bemedev/globals/utils/_unknown.ts
2
+ //#region src/utils/bemedev/globals/utils/_unknown.ts
3
3
  /**
4
4
  * _unknown variable - Auto-generated expression
5
5
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_unknown.cjs","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be\n * modified. Any manual changes will be overwritten during the next\n * generation.\n *\n * @author chlbri (bri_lvi@icloud.com)\n * @generated\n * @readonly\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAa,YAAe,UAAoB"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * _unknown variable - Auto-generated expression
3
+ *
4
+ * ⚠️ WARNING: This expression is auto-generated and should not be
5
+ * modified. Any manual changes will be overwritten during the next
6
+ * generation.
7
+ *
8
+ * @author chlbri (bri_lvi@icloud.com)
9
+ * @generated
10
+ * @readonly
11
+ */
12
+ export declare const _unknown: <T>(value?: unknown) => T;
@@ -1,4 +1,4 @@
1
- //#region src/vitest-extended/bemedev/globals/utils/_unknown.ts
1
+ //#region src/utils/bemedev/globals/utils/_unknown.ts
2
2
  /**
3
3
  * _unknown variable - Auto-generated expression
4
4
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_unknown.js","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/_unknown.ts"],"sourcesContent":["/**\n * _unknown variable - Auto-generated expression\n *\n * ⚠️ WARNING: This expression is auto-generated and should not be\n * modified. Any manual changes will be overwritten during the next\n * generation.\n *\n * @author chlbri (bri_lvi@icloud.com)\n * @generated\n * @readonly\n */\nexport const _unknown = <T>(value?: unknown) => value as T;\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,YAAe,UAAoB"}
@@ -0,0 +1,11 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/utils/bemedev/globals/utils/expandFn.ts
3
+ const expandFn = (main, extensions) => {
4
+ const out = main;
5
+ if (extensions) Object.assign(out, extensions);
6
+ return out;
7
+ };
8
+ //#endregion
9
+ exports.expandFn = expandFn;
10
+
11
+ //# sourceMappingURL=expandFn.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expandFn.cjs","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from '../types';\n\nexport const expandFn = <\n Main extends Fn,\n const Tr extends object = object,\n>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n if (extensions) {\n Object.assign(out, extensions);\n }\n\n return out;\n};\n"],"mappings":";;AAEA,MAAa,YAIX,MACA,eACsB;CACtB,MAAM,MAAW;CAEjB,IAAI,YACF,OAAO,OAAO,KAAK,UAAU;CAG/B,OAAO;AACT"}
@@ -0,0 +1,2 @@
1
+ import type { Fn, FnBasic } from '../types';
2
+ export declare const expandFn: <Main extends Fn, const Tr extends object = object>(main: Main, extensions?: Tr) => FnBasic<Main, Tr>;
@@ -0,0 +1,10 @@
1
+ //#region src/utils/bemedev/globals/utils/expandFn.ts
2
+ const expandFn = (main, extensions) => {
3
+ const out = main;
4
+ if (extensions) Object.assign(out, extensions);
5
+ return out;
6
+ };
7
+ //#endregion
8
+ export { expandFn };
9
+
10
+ //# sourceMappingURL=expandFn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"expandFn.js","names":[],"sources":["../../../../../src/utils/bemedev/globals/utils/expandFn.ts"],"sourcesContent":["import type { Fn, FnBasic } from '../types';\n\nexport const expandFn = <\n Main extends Fn,\n const Tr extends object = object,\n>(\n main: Main,\n extensions?: Tr,\n): FnBasic<Main, Tr> => {\n const out: any = main;\n\n if (extensions) {\n Object.assign(out, extensions);\n }\n\n return out;\n};\n"],"mappings":";AAEA,MAAa,YAIX,MACA,eACsB;CACtB,MAAM,MAAW;CAEjB,IAAI,YACF,OAAO,OAAO,KAAK,UAAU;CAG/B,OAAO;AACT"}
@@ -1 +1 @@
1
- export declare const identity: unknown;
1
+ export declare const identity: <T>(x: T) => T;
@@ -2,6 +2,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_utils_sleep = require("./sleep.cjs");
3
3
  const require_utils_identity = require("./identity.cjs");
4
4
  const require_utils_array = require("./array.cjs");
5
+ const require_utils_bemedev_globals_utils__unknown = require("./bemedev/globals/utils/_unknown.cjs");
6
+ exports._unknown = require_utils_bemedev_globals_utils__unknown._unknown;
5
7
  exports.identity = require_utils_identity.identity;
6
8
  exports.sleep = require_utils_sleep.sleep;
7
9
  exports.toArray = require_utils_array.toArray;
@@ -1,4 +1,5 @@
1
- export * from "./identity";
2
- export * from "./sleep";
3
- export * from "./types";
4
- export * from "./array";
1
+ export * from './identity';
2
+ export * from './sleep';
3
+ export * from './types';
4
+ export * from './array';
5
+ export * from './bemedev/globals/utils/_unknown';
@@ -1,4 +1,5 @@
1
1
  import { sleep } from "./sleep.js";
2
2
  import { identity } from "./identity.js";
3
3
  import { toArray } from "./array.js";
4
- export { identity, sleep, toArray };
4
+ import { _unknown } from "./bemedev/globals/utils/_unknown.js";
5
+ export { _unknown, identity, sleep, toArray };
@@ -1 +1 @@
1
- export declare const sleep: unknown;
1
+ export declare const sleep: (ms: number) => Promise<unknown>;
@@ -1,5 +1,2 @@
1
- export type Fn<
2
- Args extends unknown[],
3
- Return = void
4
- > = (...args: Args) => Return;
1
+ export * from './bemedev/globals/types';
5
2
  export type ToArray_F = <T>(value?: T | T[]) => T[];
@@ -1 +1 @@
1
- export * from "./vitest";
1
+ export * from './vitest';
@@ -1,10 +1,13 @@
1
- import type { Plugin } from "vitest/config";
1
+ import type { Plugin } from 'vitest/config';
2
2
  export type Define<T> = Exclude<T, undefined>;
3
- export type Args = [{
4
- patternTest: string | string[];
5
- patternCov: string | string[];
6
- }, {
7
- ignoreTestFiles?: string[];
8
- ignoreCoverageFiles?: string[];
9
- }];
3
+ export type Args = [
4
+ {
5
+ patternTest: string | string[];
6
+ patternCov: string | string[];
7
+ },
8
+ {
9
+ ignoreTestFiles?: string[];
10
+ ignoreCoverageFiles?: string[];
11
+ }
12
+ ];
10
13
  export type WithPattern = (...args: Args) => Plugin;
@@ -32,7 +32,6 @@ create.withPattern = async ({ patternTest, patternCov } = {}, { ignoreTestFiles,
32
32
  function exclude(args = {}) {
33
33
  return {
34
34
  name: require_vitest_exclude_constants.name,
35
- enforce: "pre",
36
35
  config: async (options) => {
37
36
  const root = options?.root ?? process.cwd();
38
37
  const testConfig = options?.test;
@@ -71,7 +70,6 @@ function exclude(args = {}) {
71
70
  exclude.withPattern = (({ patternTest, patternCov }, { ignoreCoverageFiles, ignoreTestFiles }) => {
72
71
  return {
73
72
  name: require_vitest_exclude_constants.name,
74
- enforce: "pre",
75
73
  config: async (options) => {
76
74
  const root = options?.root ?? process.cwd();
77
75
  const testConfig = options?.test;