@bemedev/dev-utils 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/README.md +89 -20
  2. package/lib/_virtual/_rolldown/runtime.cjs +1 -2
  3. package/lib/build-tests/addTarball.cjs +8 -3
  4. package/lib/build-tests/addTarball.cjs.map +1 -1
  5. package/lib/build-tests/addTarball.d.ts +7 -1
  6. package/lib/build-tests/addTarball.js +8 -3
  7. package/lib/build-tests/addTarball.js.map +1 -1
  8. package/lib/build-tests/buildPackageJson.cjs +9 -4
  9. package/lib/build-tests/buildPackageJson.cjs.map +1 -1
  10. package/lib/build-tests/buildPackageJson.d.ts +14 -2
  11. package/lib/build-tests/buildPackageJson.js +9 -4
  12. package/lib/build-tests/buildPackageJson.js.map +1 -1
  13. package/lib/build-tests/cleanup.cjs +5 -3
  14. package/lib/build-tests/cleanup.cjs.map +1 -1
  15. package/lib/build-tests/cleanup.d.ts +4 -1
  16. package/lib/build-tests/cleanup.js +5 -3
  17. package/lib/build-tests/cleanup.js.map +1 -1
  18. package/lib/build-tests/cli/cli.cjs +6 -4
  19. package/lib/build-tests/cli/cli.cjs.map +1 -1
  20. package/lib/build-tests/cli/cli.d.ts +3 -0
  21. package/lib/build-tests/cli/cli.js +6 -4
  22. package/lib/build-tests/cli/cli.js.map +1 -1
  23. package/lib/build-tests/cli/index.cjs +1 -2
  24. package/lib/build-tests/cli/index.cjs.map +1 -1
  25. package/lib/build-tests/cli/index.js +1 -2
  26. package/lib/build-tests/cli/post.cjs +5 -3
  27. package/lib/build-tests/cli/post.cjs.map +1 -1
  28. package/lib/build-tests/cli/post.d.ts +4 -1
  29. package/lib/build-tests/cli/post.js +5 -3
  30. package/lib/build-tests/cli/post.js.map +1 -1
  31. package/lib/build-tests/cli/pre.cjs +5 -3
  32. package/lib/build-tests/cli/pre.cjs.map +1 -1
  33. package/lib/build-tests/cli/pre.d.ts +4 -1
  34. package/lib/build-tests/cli/pre.js +5 -3
  35. package/lib/build-tests/cli/pre.js.map +1 -1
  36. package/lib/build-tests/cli/test.cjs +4 -2
  37. package/lib/build-tests/cli/test.cjs.map +1 -1
  38. package/lib/build-tests/cli/test.d.ts +3 -0
  39. package/lib/build-tests/cli/test.js +4 -2
  40. package/lib/build-tests/cli/test.js.map +1 -1
  41. package/lib/build-tests/constants.cjs +1 -2
  42. package/lib/build-tests/constants.js +1 -2
  43. package/lib/build-tests/getRelativePath.cjs +1 -2
  44. package/lib/build-tests/getRelativePath.d.ts +1 -1
  45. package/lib/build-tests/getRelativePath.js +1 -2
  46. package/lib/build-tests/getTypescriptOutdir.cjs +1 -2
  47. package/lib/build-tests/getTypescriptOutdir.d.ts +1 -1
  48. package/lib/build-tests/getTypescriptOutdir.js +1 -2
  49. package/lib/build-tests/import.cjs +1 -2
  50. package/lib/build-tests/import.js +1 -2
  51. package/lib/build-tests/imports/create.cjs +1 -2
  52. package/lib/build-tests/imports/create.js +1 -2
  53. package/lib/build-tests/imports/helper.cjs +1 -2
  54. package/lib/build-tests/imports/helper.js +1 -2
  55. package/lib/build-tests/imports/index.js +1 -2
  56. package/lib/build-tests/index.cjs +1 -1
  57. package/lib/build-tests/index.js +1 -1
  58. package/lib/build-tests/pack.cjs +2 -3
  59. package/lib/build-tests/pack.d.ts +1 -1
  60. package/lib/build-tests/pack.js +2 -3
  61. package/lib/pack/config.cjs +103 -0
  62. package/lib/pack/config.cjs.map +1 -0
  63. package/lib/pack/config.d.ts +21 -0
  64. package/lib/pack/config.js +102 -0
  65. package/lib/pack/config.js.map +1 -0
  66. package/lib/pack/constants.cjs +45 -0
  67. package/lib/pack/constants.cjs.map +1 -0
  68. package/lib/pack/constants.d.ts +23 -0
  69. package/lib/pack/constants.js +40 -0
  70. package/lib/pack/constants.js.map +1 -0
  71. package/lib/pack/index.cjs +17 -0
  72. package/lib/pack/index.d.ts +6 -0
  73. package/lib/pack/index.js +6 -0
  74. package/lib/pack/input.cjs +19 -0
  75. package/lib/pack/input.cjs.map +1 -0
  76. package/lib/pack/input.d.ts +10 -0
  77. package/lib/pack/input.js +18 -0
  78. package/lib/pack/input.js.map +1 -0
  79. package/lib/pack/output.cjs +26 -0
  80. package/lib/pack/output.cjs.map +1 -0
  81. package/lib/pack/output.d.ts +13 -0
  82. package/lib/pack/output.js +25 -0
  83. package/lib/pack/output.js.map +1 -0
  84. package/lib/pack/plugins/circulars.cjs +39 -0
  85. package/lib/pack/plugins/circulars.cjs.map +1 -0
  86. package/lib/pack/plugins/circulars.d.ts +18 -0
  87. package/lib/pack/plugins/circulars.js +38 -0
  88. package/lib/pack/plugins/circulars.js.map +1 -0
  89. package/lib/pack/plugins/index.cjs +22 -0
  90. package/lib/pack/plugins/index.cjs.map +1 -0
  91. package/lib/pack/plugins/index.d.ts +25 -0
  92. package/lib/pack/plugins/index.js +21 -0
  93. package/lib/pack/plugins/index.js.map +1 -0
  94. package/lib/pack/project.cjs +32 -0
  95. package/lib/pack/project.cjs.map +1 -0
  96. package/lib/pack/project.d.ts +9 -0
  97. package/lib/pack/project.js +31 -0
  98. package/lib/pack/project.js.map +1 -0
  99. package/lib/pack/types.d.ts +46 -0
  100. package/lib/plugins/hmr.cjs +19 -5
  101. package/lib/plugins/hmr.cjs.map +1 -1
  102. package/lib/plugins/hmr.d.ts +14 -1
  103. package/lib/plugins/hmr.js +18 -4
  104. package/lib/plugins/hmr.js.map +1 -1
  105. package/lib/plugins/suppressWarnings.cjs +1 -2
  106. package/lib/plugins/suppressWarnings.js +1 -2
  107. package/lib/rolldown-config/config.cjs +3 -4
  108. package/lib/rolldown-config/config.cjs.map +1 -1
  109. package/lib/rolldown-config/config.js +3 -4
  110. package/lib/rolldown-config/config.js.map +1 -1
  111. package/lib/rolldown-config/constants.cjs +1 -2
  112. package/lib/rolldown-config/constants.js +1 -2
  113. package/lib/rolldown-config/helpers.cjs +1 -2
  114. package/lib/rolldown-config/helpers.js +1 -2
  115. package/lib/rolldown-config/index.cjs +1 -1
  116. package/lib/rolldown-config/index.js +1 -1
  117. package/lib/rolldown-config/input.cjs +1 -2
  118. package/lib/rolldown-config/input.js +1 -2
  119. package/lib/rolldown-config/output.cjs +1 -2
  120. package/lib/rolldown-config/output.js +1 -2
  121. package/lib/rolldown-config/plugins/circulars.cjs +1 -2
  122. package/lib/rolldown-config/plugins/circulars.js +1 -2
  123. package/lib/rolldown-config/plugins/clean.cjs +2 -3
  124. package/lib/rolldown-config/plugins/clean.js +2 -3
  125. package/lib/rolldown-config/plugins/externals.cjs +1 -2
  126. package/lib/rolldown-config/plugins/externals.js +1 -2
  127. package/lib/rolldown-config/plugins/index.cjs +1 -2
  128. package/lib/rolldown-config/plugins/index.js +1 -2
  129. package/lib/rolldown-config/plugins/typescript.cjs +1 -2
  130. package/lib/rolldown-config/plugins/typescript.config.cjs +1 -2
  131. package/lib/rolldown-config/plugins/typescript.config.js +1 -2
  132. package/lib/rolldown-config/plugins/typescript.fast.cjs +1 -2
  133. package/lib/rolldown-config/plugins/typescript.fast.js +1 -2
  134. package/lib/rolldown-config/plugins/typescript.js +1 -2
  135. package/lib/utils/array.cjs +1 -2
  136. package/lib/utils/array.js +1 -2
  137. package/lib/utils/bemedev/globals/types.d.ts +1 -0
  138. package/lib/utils/bemedev/globals/utils/_unknown.cjs +1 -2
  139. package/lib/utils/bemedev/globals/utils/_unknown.js +1 -2
  140. package/lib/utils/bemedev/globals/utils/expandFn.cjs +1 -2
  141. package/lib/utils/bemedev/globals/utils/expandFn.js +1 -2
  142. package/lib/utils/clamp.cjs +1 -2
  143. package/lib/utils/clamp.js +1 -2
  144. package/lib/utils/identity.cjs +1 -2
  145. package/lib/utils/identity.js +1 -2
  146. package/lib/utils/index.cjs +1 -1
  147. package/lib/utils/index.d.ts +1 -1
  148. package/lib/utils/index.js +1 -1
  149. package/lib/utils/sleep.cjs +1 -2
  150. package/lib/utils/sleep.js +1 -2
  151. package/lib/utils/types.d.ts +1 -1
  152. package/lib/vitest-exclude/constants.cjs +1 -2
  153. package/lib/vitest-exclude/constants.js +1 -2
  154. package/lib/vitest-exclude/index.js +1 -2
  155. package/lib/vitest-exclude/vitest.cjs +2 -3
  156. package/lib/vitest-exclude/vitest.js +2 -3
  157. package/lib/vitest-exclude/vitest.utils.cjs +1 -2
  158. package/lib/vitest-exclude/vitest.utils.js +1 -2
  159. package/lib/vitest-extended/acceptation.cjs +1 -2
  160. package/lib/vitest-extended/acceptation.js +1 -2
  161. package/lib/vitest-extended/createTests.cjs +2 -3
  162. package/lib/vitest-extended/createTests.js +2 -3
  163. package/lib/vitest-extended/done.cjs +1 -2
  164. package/lib/vitest-extended/done.js +1 -2
  165. package/lib/vitest-extended/each/error.cjs +2 -3
  166. package/lib/vitest-extended/each/error.js +2 -3
  167. package/lib/vitest-extended/each/pass.cjs +2 -3
  168. package/lib/vitest-extended/each/pass.js +2 -3
  169. package/lib/vitest-extended/fakeWaiter.cjs +1 -2
  170. package/lib/vitest-extended/fakeWaiter.js +1 -2
  171. package/lib/vitest-extended/fixtures/coverage.cjs +1 -2
  172. package/lib/vitest-extended/fixtures/coverage.js +1 -2
  173. package/lib/vitest-extended/fixtures/partialCall.cjs +1 -2
  174. package/lib/vitest-extended/fixtures/partialCall.js +1 -2
  175. package/lib/vitest-extended/fixtures/toUpper.cjs +1 -2
  176. package/lib/vitest-extended/fixtures/toUpper.js +1 -2
  177. package/lib/vitest-extended/fixtures/vitest.cjs +1 -2
  178. package/lib/vitest-extended/fixtures/vitest.js +1 -2
  179. package/lib/vitest-extended/fixtures/zod.cjs +1 -2
  180. package/lib/vitest-extended/fixtures/zod.js +1 -2
  181. package/lib/vitest-extended/identity.cjs +1 -2
  182. package/lib/vitest-extended/identity.js +1 -2
  183. package/lib/vitest-extended/index.cjs +2 -2
  184. package/lib/vitest-extended/index.js +2 -2
  185. package/lib/vitest-extended/isDefined.cjs +1 -2
  186. package/lib/vitest-extended/isDefined.js +1 -2
  187. package/lib/vitest-extended/isFunction.cjs +1 -2
  188. package/lib/vitest-extended/isFunction.js +1 -2
  189. package/lib/vitest-extended/project.cjs +9 -7
  190. package/lib/vitest-extended/project.cjs.map +1 -1
  191. package/lib/vitest-extended/project.d.ts +2 -2
  192. package/lib/vitest-extended/project.js +10 -8
  193. package/lib/vitest-extended/project.js.map +1 -1
  194. package/lib/vitest-extended/toArray.cjs +1 -2
  195. package/lib/vitest-extended/toArray.js +1 -2
  196. package/lib/vitest-extended/toStringFlat.cjs +1 -2
  197. package/lib/vitest-extended/toStringFlat.js +1 -2
  198. package/package.json +68 -59
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.cjs","names":["project"],"sources":["../../src/pack/project.ts"],"sourcesContent":["import { defineProject as project, type UserWorkspaceConfig } from 'vite-plus';\n\n/**\n * Helper function to define a Vitest project configuration with defaults.\n *\n * @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.\n *\n * @returns Configured Vitest project configuration.\n */\nexport const defineProject = (conf: UserWorkspaceConfig) => {\n const _env = conf.test?.env ?? {};\n\n return project({\n ...conf,\n resolve: { ...conf.resolve, tsconfigPaths: true },\n\n test: {\n ...conf.test,\n globals: true,\n logHeapUsage: false,\n env: { NODE_ENV: 'test', ..._env },\n },\n });\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,iBAAiB,SAA8B;CAC1D,MAAM,OAAO,KAAK,MAAM,OAAO,CAAC;CAEhC,QAAA,GAAOA,UAAAA,cAAAA,CAAQ;EACb,GAAG;EACH,SAAS;GAAE,GAAG,KAAK;GAAS,eAAe;EAAK;EAEhD,MAAM;GACJ,GAAG,KAAK;GACR,SAAS;GACT,cAAc;GACd,KAAK;IAAE,UAAU;IAAQ,GAAG;GAAK;EACnC;CACF,CAAC;AACH"}
@@ -0,0 +1,9 @@
1
+ import { type UserWorkspaceConfig } from 'vite-plus';
2
+ /**
3
+ * Helper function to define a Vitest project configuration with defaults.
4
+ *
5
+ * @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.
6
+ *
7
+ * @returns Configured Vitest project configuration.
8
+ */
9
+ export declare const defineProject: (conf: UserWorkspaceConfig) => UserWorkspaceConfig;
@@ -0,0 +1,31 @@
1
+ import { defineProject as defineProject$1 } from "vite-plus";
2
+ // src/pack/project.ts
3
+ /**
4
+ * Helper function to define a Vitest project configuration with defaults.
5
+ *
6
+ * @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.
7
+ *
8
+ * @returns Configured Vitest project configuration.
9
+ */
10
+ const defineProject = (conf) => {
11
+ const _env = conf.test?.env ?? {};
12
+ return defineProject$1({
13
+ ...conf,
14
+ resolve: {
15
+ ...conf.resolve,
16
+ tsconfigPaths: true
17
+ },
18
+ test: {
19
+ ...conf.test,
20
+ globals: true,
21
+ logHeapUsage: false,
22
+ env: {
23
+ NODE_ENV: "test",
24
+ ..._env
25
+ }
26
+ }
27
+ });
28
+ };
29
+ export { defineProject };
30
+
31
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","names":["project"],"sources":["../../src/pack/project.ts"],"sourcesContent":["import { defineProject as project, type UserWorkspaceConfig } from 'vite-plus';\n\n/**\n * Helper function to define a Vitest project configuration with defaults.\n *\n * @param conf - Vitest user workspace configuration of type {@linkcode UserWorkspaceConfig}.\n *\n * @returns Configured Vitest project configuration.\n */\nexport const defineProject = (conf: UserWorkspaceConfig) => {\n const _env = conf.test?.env ?? {};\n\n return project({\n ...conf,\n resolve: { ...conf.resolve, tsconfigPaths: true },\n\n test: {\n ...conf.test,\n globals: true,\n logHeapUsage: false,\n env: { NODE_ENV: 'test', ..._env },\n },\n });\n};\n"],"mappings":";;;;;;;;;AASA,MAAa,iBAAiB,SAA8B;CAC1D,MAAM,OAAO,KAAK,MAAM,OAAO,CAAC;CAEhC,OAAOA,gBAAQ;EACb,GAAG;EACH,SAAS;GAAE,GAAG,KAAK;GAAS,eAAe;EAAK;EAEhD,MAAM;GACJ,GAAG,KAAK;GACR,SAAS;GACT,cAAc;GACd,KAAK;IAAE,UAAU;IAAQ,GAAG;GAAK;EACnC;CACF,CAAC;AACH"}
@@ -0,0 +1,46 @@
1
+ import type { PackUserConfig, TsdownPluginOption } from 'vite-plus/pack';
2
+ import type { NOmit } from '../utils/types.js';
3
+ import type { DEFAULT_PLUGINS } from './plugins';
4
+ /**
5
+ * Output formats supported by Vite+ Pack.
6
+ */
7
+ export type PackFormat = 'esm' | 'cjs' | 'iife' | 'umd';
8
+ /**
9
+ * Declaration file generators supported by Vite+ Pack.
10
+ */
11
+ export type DtsGenerator = 'tsc' | 'oxc' | 'tsgo';
12
+ /**
13
+ * Declaration file options of Vite+ Pack.
14
+ */
15
+ export type DtsOptions = PackUserConfig['dts'];
16
+ /**
17
+ * Configuration parameters for Vite+ Pack configuration generation.
18
+ */
19
+ export type Params = {
20
+ circularDeps?: string | string[];
21
+ excludesTS?: string | string[];
22
+ externals?: string | string[];
23
+ ignoresJS?: string | string[];
24
+ dir?: string;
25
+ sourcemap?: boolean;
26
+ dts?: DtsOptions;
27
+ plugins?: (TsdownPluginOption | keyof typeof DEFAULT_PLUGINS)[];
28
+ } & NOmit<PackUserConfig, keyof PackOutput | 'entry' | 'platform' | 'dts' | 'external' | 'plugins' | 'sourcemap'>;
29
+ /**
30
+ * Function type building the entry points record from glob patterns.
31
+ */
32
+ export type BuildEntry_F = (...ignores: string[]) => Record<string, string>;
33
+ /**
34
+ * Output options shared by every bundle generated by Vite+ Pack.
35
+ */
36
+ export type PackOutput = Pick<PackUserConfig, 'outDir' | 'format' | 'unbundle' | 'fixedExtension' | 'sourcemap'>;
37
+ /**
38
+ * Vite+ Pack configuration generator with predefined presets
39
+ * (`bemedev`, `fast`, `default`).
40
+ */
41
+ export type Config_F = {
42
+ (additionals?: Params): PackUserConfig;
43
+ bemedev: (additionals?: Params) => PackUserConfig;
44
+ fast: (additionals?: Omit<Params, 'plugins' | 'dts'>) => PackUserConfig;
45
+ default: (additionals?: Params) => PackUserConfig;
46
+ };
@@ -1,10 +1,25 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_utils_clamp = require("../utils/clamp.cjs");
3
2
  const require_utils_array = require("../utils/array.cjs");
3
+ const require_utils_clamp = require("../utils/clamp.cjs");
4
4
  let path = require("path");
5
5
  let child_process = require("child_process");
6
- //#region src/plugins/hmr.ts
7
- const normalizePath = (path$1) => path$1.replace(/\\/g, "/");
6
+ // src/plugins/hmr.ts
7
+ /**
8
+ * Normalizes backslashes in a file path to forward slashes.
9
+ *
10
+ * @param path - File path to normalize.
11
+ *
12
+ * @returns Normalized path string.
13
+ */
14
+ const normalizePath = (path) => path.replace(/\\/g, "/");
15
+ /**
16
+ * Vite plugin providing Hot Module Reloading (HMR) capabilities for external
17
+ * file paths by watching files and executing mapped build scripts on changes.
18
+ *
19
+ * @param props - Configuration properties of type {@linkcode HmrPluginProps}.
20
+ *
21
+ * @returns A Vite plugin object of type {@linkcode Plugin}.
22
+ */
8
23
  const hmr = (props) => {
9
24
  let isBuilding = false;
10
25
  const debounce = require_utils_clamp.clamp(props?.debounce ?? 500, 500, 1e4);
@@ -33,7 +48,7 @@ const hmr = (props) => {
33
48
  if (isBuilding) return ctx.modules;
34
49
  const normalizedFile = normalizePath(ctx.file);
35
50
  const matchingScripts = /* @__PURE__ */ new Set();
36
- for (const [watchedPath, scripts] of pathMap.entries()) if (normalizedFile.includes(watchedPath)) scripts.forEach(matchingScripts.add);
51
+ for (const [watchedPath, scripts] of pathMap.entries()) if (normalizedFile.includes(watchedPath)) scripts.forEach((d) => matchingScripts.add(d));
37
52
  if (matchingScripts.size > 0) {
38
53
  console.log(`\n⚡ External file modified: ${ctx.file}. Starting build...`);
39
54
  try {
@@ -54,7 +69,6 @@ const hmr = (props) => {
54
69
  }
55
70
  };
56
71
  };
57
- //#endregion
58
72
  exports.hmr = hmr;
59
73
 
60
74
  //# sourceMappingURL=hmr.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hmr.cjs","names":["path","clamp","isAbsolute","resolve","toArray","execSync"],"sources":["../../src/plugins/hmr.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport { isAbsolute, resolve } from 'path';\n\nimport { type Plugin } from 'vitest/config';\n\nimport { toArray } from '#utils/array';\nimport { clamp } from '#utils/clamp';\nimport type { SoA } from '#utils/types';\n\nexport type HmrPluginProps = {\n /**\n * Map of watched file/directory paths to one or many shell commands to execute\n * when changes are detected.\n */\n paths?: Record<string, SoA<string>>;\n\n /** Optional interval in milliseconds to wait before allowing another build. */\n debounce?: number;\n};\n\nconst normalizePath = (path: string) => path.replace(/\\\\/g, '/');\n\nexport const hmr = (props?: HmrPluginProps): Plugin => {\n // Lock variable to prevent infinite build loops\n let isBuilding = false;\n const debounce = clamp(props?.debounce ?? 500, 500, 10_000);\n const pathMap = new Map<string, string[]>();\n let isDev = false;\n\n return {\n name: 'hmr-add-on',\n\n configResolved(config) {\n isDev = !config.isProduction;\n if (!isDev) return;\n\n pathMap.clear();\n const rawPaths = props?.paths ?? {};\n\n Object.entries(rawPaths).forEach(([pathKey, rawScripts]) => {\n const resolved = isAbsolute(pathKey)\n ? pathKey\n : resolve(config.root, pathKey);\n\n const normalized = normalizePath(resolved);\n const scripts = toArray(rawScripts);\n pathMap.set(normalized, scripts);\n });\n },\n\n configureServer(server) {\n if (!isDev) return;\n\n server.watcher.add(Array.from(pathMap.keys()));\n },\n\n handleHotUpdate(ctx) {\n if (!isDev) return;\n\n // 1. If a build is already in progress, ignore ALL changes (prevents loops)\n if (isBuilding) return ctx.modules;\n const normalizedFile = normalizePath(ctx.file);\n\n // Find all matching path entries for the changed file\n const matchingScripts = new Set<string>();\n for (const [watchedPath, scripts] of pathMap.entries()) {\n if (normalizedFile.includes(watchedPath)) {\n scripts.forEach(matchingScripts.add);\n }\n }\n\n if (matchingScripts.size > 0) {\n console.log(`\\n⚡ External file modified: ${ctx.file}. Starting build...`);\n\n try {\n // 2. Acquire lock before starting the build\n isBuilding = true;\n\n // Invalidate module graph so Vite reads fresh built files from disk\n ctx.server.moduleGraph.invalidateAll();\n matchingScripts.forEach(script => execSync(script, { stdio: 'inherit' }));\n ctx.server.ws.send({ type: 'full-reload' });\n } catch (error) {\n console.error('❌ Command execution failed during HMR:', error);\n } finally {\n // 3. Once build is complete, wait for the debounce period to allow\n // Vite to ignore generated build files, then release the lock.\n setTimeout(() => {\n isBuilding = false;\n console.log('✅ Build completed. Ready for subsequent changes.');\n }, debounce);\n }\n }\n\n return ctx.modules;\n },\n };\n};\n"],"mappings":";;;;;;AAoBA,MAAM,iBAAiB,WAAiBA,OAAK,QAAQ,OAAO,GAAG;AAE/D,MAAa,OAAO,UAAmC;CAErD,IAAI,aAAa;CACjB,MAAM,WAAWC,oBAAAA,MAAM,OAAO,YAAY,KAAK,KAAK,GAAM;CAC1D,MAAM,0BAAU,IAAI,IAAsB;CAC1C,IAAI,QAAQ;CAEZ,OAAO;EACL,MAAM;EAEN,eAAe,QAAQ;GACrB,QAAQ,CAAC,OAAO;GAChB,IAAI,CAAC,OAAO;GAEZ,QAAQ,MAAM;GACd,MAAM,WAAW,OAAO,SAAS,CAAC;GAElC,OAAO,QAAQ,QAAQ,CAAC,CAAC,SAAS,CAAC,SAAS,gBAAgB;IAC1D,MAAM,YAAA,GAAWC,KAAAA,WAAAA,CAAW,OAAO,IAC/B,WAAA,GACAC,KAAAA,QAAAA,CAAQ,OAAO,MAAM,OAAO;IAEhC,MAAM,aAAa,cAAc,QAAQ;IACzC,MAAM,UAAUC,oBAAAA,QAAQ,UAAU;IAClC,QAAQ,IAAI,YAAY,OAAO;GACjC,CAAC;EACH;EAEA,gBAAgB,QAAQ;GACtB,IAAI,CAAC,OAAO;GAEZ,OAAO,QAAQ,IAAI,MAAM,KAAK,QAAQ,KAAK,CAAC,CAAC;EAC/C;EAEA,gBAAgB,KAAK;GACnB,IAAI,CAAC,OAAO;GAGZ,IAAI,YAAY,OAAO,IAAI;GAC3B,MAAM,iBAAiB,cAAc,IAAI,IAAI;GAG7C,MAAM,kCAAkB,IAAI,IAAY;GACxC,KAAK,MAAM,CAAC,aAAa,YAAY,QAAQ,QAAQ,GACnD,IAAI,eAAe,SAAS,WAAW,GACrC,QAAQ,QAAQ,gBAAgB,GAAG;GAIvC,IAAI,gBAAgB,OAAO,GAAG;IAC5B,QAAQ,IAAI,+BAA+B,IAAI,KAAK,oBAAoB;IAExE,IAAI;KAEF,aAAa;KAGb,IAAI,OAAO,YAAY,cAAc;KACrC,gBAAgB,SAAQ,YAAA,GAAUC,cAAAA,SAAAA,CAAS,QAAQ,EAAE,OAAO,UAAU,CAAC,CAAC;KACxE,IAAI,OAAO,GAAG,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5C,SAAS,OAAO;KACd,QAAQ,MAAM,0CAA0C,KAAK;IAC/D,UAAU;KAGR,iBAAiB;MACf,aAAa;MACb,QAAQ,IAAI,kDAAkD;KAChE,GAAG,QAAQ;IACb;GACF;GAEA,OAAO,IAAI;EACb;CACF;AACF"}
1
+ {"version":3,"file":"hmr.cjs","names":["clamp","isAbsolute","resolve","toArray","execSync"],"sources":["../../src/plugins/hmr.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport { isAbsolute, resolve } from 'path';\n\nimport { type Plugin } from 'vitest/config';\n\nimport { toArray } from '#utils/array';\nimport { clamp } from '#utils/clamp';\nimport type { SoA } from '#utils/types';\n\n/**\n * Configuration options for the HMR add-on plugin.\n */\nexport type HmrPluginProps = {\n /**\n * Map of watched file/directory paths to one or many shell commands to execute\n * when changes are detected.\n * Map of watched file or directory paths to one or many shell commands of\n * type {@linkcode SoA} to execute when changes are detected.\n */\n paths?: Record<string, SoA<string>>;\n\n /** Optional interval in milliseconds to wait before allowing another build. */\n debounce?: number;\n};\n\n/**\n * Normalizes backslashes in a file path to forward slashes.\n *\n * @param path - File path to normalize.\n *\n * @returns Normalized path string.\n */\nconst normalizePath = (path: string) => path.replace(/\\\\/g, '/');\n\n/**\n * Vite plugin providing Hot Module Reloading (HMR) capabilities for external\n * file paths by watching files and executing mapped build scripts on changes.\n *\n * @param props - Configuration properties of type {@linkcode HmrPluginProps}.\n *\n * @returns A Vite plugin object of type {@linkcode Plugin}.\n */\nexport const hmr = (props?: HmrPluginProps): Plugin => {\n // Lock variable to prevent infinite build loops\n let isBuilding = false;\n const debounce = clamp(props?.debounce ?? 500, 500, 10_000);\n const pathMap = new Map<string, string[]>();\n let isDev = false;\n\n return {\n name: 'hmr-add-on',\n\n configResolved(config) {\n isDev = !config.isProduction;\n if (!isDev) return;\n\n pathMap.clear();\n const rawPaths = props?.paths ?? {};\n\n Object.entries(rawPaths).forEach(([pathKey, rawScripts]) => {\n const resolved = isAbsolute(pathKey)\n ? pathKey\n : resolve(config.root, pathKey);\n\n const normalized = normalizePath(resolved);\n const scripts = toArray(rawScripts);\n pathMap.set(normalized, scripts);\n });\n },\n\n configureServer(server) {\n if (!isDev) return;\n\n server.watcher.add(Array.from(pathMap.keys()));\n },\n\n handleHotUpdate(ctx) {\n if (!isDev) return;\n\n // 1. If a build is already in progress, ignore ALL changes (prevents loops)\n if (isBuilding) return ctx.modules;\n const normalizedFile = normalizePath(ctx.file);\n\n // Find all matching path entries for the changed file\n const matchingScripts = new Set<string>();\n for (const [watchedPath, scripts] of pathMap.entries()) {\n if (normalizedFile.includes(watchedPath)) {\n scripts.forEach(d => matchingScripts.add(d));\n }\n }\n\n if (matchingScripts.size > 0) {\n console.log(`\\n⚡ External file modified: ${ctx.file}. Starting build...`);\n\n try {\n // 2. Acquire lock before starting the build\n isBuilding = true;\n\n // Invalidate module graph so Vite reads fresh built files from disk\n ctx.server.moduleGraph.invalidateAll();\n matchingScripts.forEach(script => execSync(script, { stdio: 'inherit' }));\n ctx.server.ws.send({ type: 'full-reload' });\n } catch (error) {\n console.error('❌ Command execution failed during HMR:', error);\n } finally {\n // 3. Once build is complete, wait for the debounce period to allow\n // Vite to ignore generated build files, then release the lock.\n setTimeout(() => {\n isBuilding = false;\n console.log('✅ Build completed. Ready for subsequent changes.');\n }, debounce);\n }\n }\n\n return ctx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,OAAO,YAAY,cAAc;KACrC,gBAAgB,SAAQ,YAAA,GAAUC,cAAAA,SAAAA,CAAS,QAAQ,EAAE,OAAO,UAAU,CAAC,CAAC;KACxE,IAAI,OAAO,GAAG,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5C,SAAS,OAAO;KACd,QAAQ,MAAM,0CAA0C,KAAK;IAC/D,UAAU;KAGR,iBAAiB;MACf,aAAa;MACb,QAAQ,IAAI,kDAAkD;KAChE,GAAG,QAAQ;IACb;GACF;GAEA,OAAO,IAAI;EACb;CACF;AACF"}
@@ -1,12 +1,25 @@
1
1
  import { type Plugin } from 'vitest/config';
2
- import type { SoA } from '../utils/types';
2
+ import type { SoA } from '../utils/types.js';
3
+ /**
4
+ * Configuration options for the HMR add-on plugin.
5
+ */
3
6
  export type HmrPluginProps = {
4
7
  /**
5
8
  * Map of watched file/directory paths to one or many shell commands to execute
6
9
  * when changes are detected.
10
+ * Map of watched file or directory paths to one or many shell commands of
11
+ * type {@linkcode SoA} to execute when changes are detected.
7
12
  */
8
13
  paths?: Record<string, SoA<string>>;
9
14
  /** Optional interval in milliseconds to wait before allowing another build. */
10
15
  debounce?: number;
11
16
  };
17
+ /**
18
+ * Vite plugin providing Hot Module Reloading (HMR) capabilities for external
19
+ * file paths by watching files and executing mapped build scripts on changes.
20
+ *
21
+ * @param props - Configuration properties of type {@linkcode HmrPluginProps}.
22
+ *
23
+ * @returns A Vite plugin object of type {@linkcode Plugin}.
24
+ */
12
25
  export declare const hmr: (props?: HmrPluginProps) => Plugin;
@@ -1,9 +1,24 @@
1
- import { clamp } from "../utils/clamp.js";
2
1
  import { toArray } from "../utils/array.js";
2
+ import { clamp } from "../utils/clamp.js";
3
3
  import { isAbsolute, resolve } from "path";
4
4
  import { execSync } from "child_process";
5
- //#region src/plugins/hmr.ts
5
+ // src/plugins/hmr.ts
6
+ /**
7
+ * Normalizes backslashes in a file path to forward slashes.
8
+ *
9
+ * @param path - File path to normalize.
10
+ *
11
+ * @returns Normalized path string.
12
+ */
6
13
  const normalizePath = (path) => path.replace(/\\/g, "/");
14
+ /**
15
+ * Vite plugin providing Hot Module Reloading (HMR) capabilities for external
16
+ * file paths by watching files and executing mapped build scripts on changes.
17
+ *
18
+ * @param props - Configuration properties of type {@linkcode HmrPluginProps}.
19
+ *
20
+ * @returns A Vite plugin object of type {@linkcode Plugin}.
21
+ */
7
22
  const hmr = (props) => {
8
23
  let isBuilding = false;
9
24
  const debounce = clamp(props?.debounce ?? 500, 500, 1e4);
@@ -32,7 +47,7 @@ const hmr = (props) => {
32
47
  if (isBuilding) return ctx.modules;
33
48
  const normalizedFile = normalizePath(ctx.file);
34
49
  const matchingScripts = /* @__PURE__ */ new Set();
35
- for (const [watchedPath, scripts] of pathMap.entries()) if (normalizedFile.includes(watchedPath)) scripts.forEach(matchingScripts.add);
50
+ for (const [watchedPath, scripts] of pathMap.entries()) if (normalizedFile.includes(watchedPath)) scripts.forEach((d) => matchingScripts.add(d));
36
51
  if (matchingScripts.size > 0) {
37
52
  console.log(`\n⚡ External file modified: ${ctx.file}. Starting build...`);
38
53
  try {
@@ -53,7 +68,6 @@ const hmr = (props) => {
53
68
  }
54
69
  };
55
70
  };
56
- //#endregion
57
71
  export { hmr };
58
72
 
59
73
  //# sourceMappingURL=hmr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hmr.js","names":[],"sources":["../../src/plugins/hmr.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport { isAbsolute, resolve } from 'path';\n\nimport { type Plugin } from 'vitest/config';\n\nimport { toArray } from '#utils/array';\nimport { clamp } from '#utils/clamp';\nimport type { SoA } from '#utils/types';\n\nexport type HmrPluginProps = {\n /**\n * Map of watched file/directory paths to one or many shell commands to execute\n * when changes are detected.\n */\n paths?: Record<string, SoA<string>>;\n\n /** Optional interval in milliseconds to wait before allowing another build. */\n debounce?: number;\n};\n\nconst normalizePath = (path: string) => path.replace(/\\\\/g, '/');\n\nexport const hmr = (props?: HmrPluginProps): Plugin => {\n // Lock variable to prevent infinite build loops\n let isBuilding = false;\n const debounce = clamp(props?.debounce ?? 500, 500, 10_000);\n const pathMap = new Map<string, string[]>();\n let isDev = false;\n\n return {\n name: 'hmr-add-on',\n\n configResolved(config) {\n isDev = !config.isProduction;\n if (!isDev) return;\n\n pathMap.clear();\n const rawPaths = props?.paths ?? {};\n\n Object.entries(rawPaths).forEach(([pathKey, rawScripts]) => {\n const resolved = isAbsolute(pathKey)\n ? pathKey\n : resolve(config.root, pathKey);\n\n const normalized = normalizePath(resolved);\n const scripts = toArray(rawScripts);\n pathMap.set(normalized, scripts);\n });\n },\n\n configureServer(server) {\n if (!isDev) return;\n\n server.watcher.add(Array.from(pathMap.keys()));\n },\n\n handleHotUpdate(ctx) {\n if (!isDev) return;\n\n // 1. If a build is already in progress, ignore ALL changes (prevents loops)\n if (isBuilding) return ctx.modules;\n const normalizedFile = normalizePath(ctx.file);\n\n // Find all matching path entries for the changed file\n const matchingScripts = new Set<string>();\n for (const [watchedPath, scripts] of pathMap.entries()) {\n if (normalizedFile.includes(watchedPath)) {\n scripts.forEach(matchingScripts.add);\n }\n }\n\n if (matchingScripts.size > 0) {\n console.log(`\\n⚡ External file modified: ${ctx.file}. Starting build...`);\n\n try {\n // 2. Acquire lock before starting the build\n isBuilding = true;\n\n // Invalidate module graph so Vite reads fresh built files from disk\n ctx.server.moduleGraph.invalidateAll();\n matchingScripts.forEach(script => execSync(script, { stdio: 'inherit' }));\n ctx.server.ws.send({ type: 'full-reload' });\n } catch (error) {\n console.error('❌ Command execution failed during HMR:', error);\n } finally {\n // 3. Once build is complete, wait for the debounce period to allow\n // Vite to ignore generated build files, then release the lock.\n setTimeout(() => {\n isBuilding = false;\n console.log('✅ Build completed. Ready for subsequent changes.');\n }, debounce);\n }\n }\n\n return ctx.modules;\n },\n };\n};\n"],"mappings":";;;;;AAoBA,MAAM,iBAAiB,SAAiB,KAAK,QAAQ,OAAO,GAAG;AAE/D,MAAa,OAAO,UAAmC;CAErD,IAAI,a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f,aAAa;MACb,QAAQ,IAAI,kDAAkD;KAChE,GAAG,QAAQ;IACb;GACF;GAEA,OAAO,IAAI;EACb;CACF;AACF"}
1
+ {"version":3,"file":"hmr.js","names":[],"sources":["../../src/plugins/hmr.ts"],"sourcesContent":["import { execSync } from 'child_process';\nimport { isAbsolute, resolve } from 'path';\n\nimport { type Plugin } from 'vitest/config';\n\nimport { toArray } from '#utils/array';\nimport { clamp } from '#utils/clamp';\nimport type { SoA } from '#utils/types';\n\n/**\n * Configuration options for the HMR add-on plugin.\n */\nexport type HmrPluginProps = {\n /**\n * Map of watched file/directory paths to one or many shell commands to execute\n * when changes are detected.\n * Map of watched file or directory paths to one or many shell commands of\n * type {@linkcode SoA} to execute when changes are detected.\n */\n paths?: Record<string, SoA<string>>;\n\n /** Optional interval in milliseconds to wait before allowing another build. */\n debounce?: number;\n};\n\n/**\n * Normalizes backslashes in a file path to forward slashes.\n *\n * @param path - File path to normalize.\n *\n * @returns Normalized path string.\n */\nconst normalizePath = (path: string) => path.replace(/\\\\/g, '/');\n\n/**\n * Vite plugin providing Hot Module Reloading (HMR) capabilities for external\n * file paths by watching files and executing mapped build scripts on changes.\n *\n * @param props - Configuration properties of type {@linkcode HmrPluginProps}.\n *\n * @returns A Vite plugin object of type {@linkcode Plugin}.\n */\nexport const hmr = (props?: HmrPluginProps): Plugin => {\n // Lock variable to prevent infinite build loops\n let isBuilding = false;\n const debounce = clamp(props?.debounce ?? 500, 500, 10_000);\n const pathMap = new Map<string, string[]>();\n let isDev = false;\n\n return {\n name: 'hmr-add-on',\n\n configResolved(config) {\n isDev = !config.isProduction;\n if (!isDev) return;\n\n pathMap.clear();\n const rawPaths = props?.paths ?? {};\n\n Object.entries(rawPaths).forEach(([pathKey, rawScripts]) => {\n const resolved = isAbsolute(pathKey)\n ? pathKey\n : resolve(config.root, pathKey);\n\n const normalized = normalizePath(resolved);\n const scripts = toArray(rawScripts);\n pathMap.set(normalized, scripts);\n });\n },\n\n configureServer(server) {\n if (!isDev) return;\n\n server.watcher.add(Array.from(pathMap.keys()));\n },\n\n handleHotUpdate(ctx) {\n if (!isDev) return;\n\n // 1. If a build is already in progress, ignore ALL changes (prevents loops)\n if (isBuilding) return ctx.modules;\n const normalizedFile = normalizePath(ctx.file);\n\n // Find all matching path entries for the changed file\n const matchingScripts = new Set<string>();\n for (const [watchedPath, scripts] of pathMap.entries()) {\n if (normalizedFile.includes(watchedPath)) {\n scripts.forEach(d => matchingScripts.add(d));\n }\n }\n\n if (matchingScripts.size > 0) {\n console.log(`\\n⚡ External file modified: ${ctx.file}. Starting build...`);\n\n try {\n // 2. Acquire lock before starting the build\n isBuilding = true;\n\n // Invalidate module graph so Vite reads fresh built files from disk\n ctx.server.moduleGraph.invalidateAll();\n matchingScripts.forEach(script => execSync(script, { stdio: 'inherit' }));\n ctx.server.ws.send({ type: 'full-reload' });\n } catch (error) {\n console.error('❌ Command execution failed during HMR:', error);\n } finally {\n // 3. Once build is complete, wait for the debounce period to allow\n // Vite to ignore generated build files, then release the lock.\n setTimeout(() => {\n isBuilding = false;\n console.log('✅ Build completed. Ready for subsequent changes.');\n }, debounce);\n }\n }\n\n return ctx.modules;\n },\n };\n};\n"],"mappings":";;;;;;;;;;;;AAgCA,MAAM,iBAAiB,SAAiB,KAAK,QAAQ,OAAO,GAAG;;;;;;;;;AAU/D,MAAa,OAAO,UAAmC;CAErD,IAAI,aAAa;CACjB,MAAM,WAAW,MAAM,OAAO,YAAY,KAAK,KAAK,GAAM;CAC1D,MAAM,0BAAU,IAAI,IAAsB;CAC1C,IAAI,QAAQ;CAEZ,OAAO;EACL,MAAM;EAEN,eAAe,QAAQ;GACrB,QAAQ,CAAC,OAAO;GAChB,IAAI,CAAC,OAAO;GAEZ,QAAQ,MAAM;GACd,MAAM,WAAW,OAAO,SAAS,CAAC;GAElC,OAAO,QAAQ,QAAQ,CAAC,CAAC,SAAS,CAAC,SAAS,gBAAgB;IAC1D,MAAM,WAAW,WAAW,OAAO,IAC/B,UACA,QAAQ,OAAO,MAAM,OAAO;IAEhC,MAAM,aAAa,cAAc,QAAQ;IACzC,MAAM,UAAU,QAAQ,UAAU;IAClC,QAAQ,IAAI,YAAY,OAAO;GACjC,CAAC;EACH;EAEA,gBAAgB,QAAQ;GACtB,IAAI,CAAC,OAAO;GAEZ,OAAO,QAAQ,IAAI,MAAM,KAAK,QAAQ,KAAK,CAAC,CAAC;EAC/C;EAEA,gBAAgB,KAAK;GACnB,IAAI,CAAC,OAAO;GAGZ,IAAI,YAAY,OAAO,IAAI;GAC3B,MAAM,iBAAiB,cAAc,IAAI,IAAI;GAG7C,MAAM,kCAAkB,IAAI,IAAY;GACxC,KAAK,MAAM,CAAC,aAAa,YAAY,QAAQ,QAAQ,GACnD,IAAI,eAAe,SAAS,WAAW,GACrC,QAAQ,SAAQ,MAAK,gBAAgB,IAAI,CAAC,CAAC;GAI/C,IAAI,gBAAgB,OAAO,GAAG;IAC5B,QAAQ,IAAI,+BAA+B,IAAI,KAAK,oBAAoB;IAExE,IAAI;KAEF,aAAa;KAGb,IAAI,OAAO,YAAY,cAAc;KACrC,gBAAgB,SAAQ,WAAU,SAAS,QAAQ,EAAE,OAAO,UAAU,CAAC,CAAC;KACxE,IAAI,OAAO,GAAG,KAAK,EAAE,MAAM,cAAc,CAAC;IAC5C,SAAS,OAAO;KACd,QAAQ,MAAM,0CAA0C,KAAK;IAC/D,UAAU;KAGR,iBAAiB;MACf,aAAa;MACb,QAAQ,IAAI,kDAAkD;KAChE,GAAG,QAAQ;IACb;GACF;GAEA,OAAO,IAAI;EACb;CACF;AACF"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/plugins/suppressWarnings.ts
2
+ // src/plugins/suppressWarnings.ts
3
3
  /**
4
4
  * Vite plugin to filter out noisy terminal stdout/stderr warnings emitted
5
5
  * by Nitro, SSR workers, or third-party dependencies during dev.
@@ -31,7 +31,6 @@ function suppressWarnings(...patterns) {
31
31
  apply: "serve"
32
32
  };
33
33
  }
34
- //#endregion
35
34
  exports.suppressWarnings = suppressWarnings;
36
35
 
37
36
  //# sourceMappingURL=suppressWarnings.cjs.map
@@ -1,4 +1,4 @@
1
- //#region src/plugins/suppressWarnings.ts
1
+ // src/plugins/suppressWarnings.ts
2
2
  /**
3
3
  * Vite plugin to filter out noisy terminal stdout/stderr warnings emitted
4
4
  * by Nitro, SSR workers, or third-party dependencies during dev.
@@ -30,7 +30,6 @@ function suppressWarnings(...patterns) {
30
30
  apply: "serve"
31
31
  };
32
32
  }
33
- //#endregion
34
33
  export { suppressWarnings };
35
34
 
36
35
  //# sourceMappingURL=suppressWarnings.js.map
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_utils_array = require("../utils/array.cjs");
3
3
  const require_rolldown_config_constants = require("./constants.cjs");
4
- const require_rolldown_config_output = require("./output.cjs");
5
4
  const require_rolldown_config_input = require("./input.cjs");
5
+ const require_rolldown_config_output = require("./output.cjs");
6
6
  const require_rolldown_config_plugins_index = require("./plugins/index.cjs");
7
7
  let rolldown = require("rolldown");
8
8
  let rolldown_plugins = require("rolldown/plugins");
9
- //#region src/rolldown-config/config.ts
9
+ // src/rolldown-config/config.ts
10
10
  /**
11
11
  * Generates Rolldown configuration using default or customized options.
12
12
  *
@@ -29,7 +29,7 @@ const producePlugins = ({ circularDeps, ignoresJS, dir, sourcemap = false, exclu
29
29
  }),
30
30
  circulars: () => require_rolldown_config_plugins_index.PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),
31
31
  externals: () => require_rolldown_config_plugins_index.PLUGIN_BUILDERS.externals({
32
- optDeps: false,
32
+ optDeps: true,
33
33
  builtinsPrefix: "strip",
34
34
  include: excludesTS
35
35
  }),
@@ -103,7 +103,6 @@ defineConfig.bemedev = (additionals) => {
103
103
  sourcemap
104
104
  });
105
105
  };
106
- //#endregion
107
106
  exports.defineConfig = defineConfig;
108
107
 
109
108
  //# sourceMappingURL=config.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.cjs","names":["buildInput","toArray","DEFAULT_EXCLUDE","PLUGIN_BUILDERS","esmExternalRequirePlugin","buildOutput","_defineConfig","DEFAULT_CIRCULAR_DEPS"],"sources":["../../src/rolldown-config/config.ts"],"sourcesContent":["import { defineConfig as _defineConfig } from 'rolldown';\nimport { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\n\n/**\n * Generates Rolldown configuration using default or customized options.\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n * @returns Configured Rolldown options of type {@linkcode RolldownOptions}.\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n dir,\n sourcemap = false,\n excludesTS,\n declarationMap,\n plugins,\n}: Params = {}) => {\n const include = buildInput(...toArray(excludesTS));\n const exclude = DEFAULT_EXCLUDE.concat(toArray(excludesTS));\n const unordered = {\n typescript: () =>\n PLUGIN_BUILDERS.typescript({ include, exclude, declarationMap, dir }),\n circulars: () => PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n clean: () => PLUGIN_BUILDERS.clean({ ignoresJS, sourcemap, dir }),\n fast: () => {\n return PLUGIN_BUILDERS.fast({ include, exclude, declarationMap, dir });\n },\n esm: esmExternalRequirePlugin,\n };\n\n const defaultOrdered = () => [\n unordered.circulars(),\n unordered.externals(),\n unordered.esm(),\n unordered.typescript(),\n unordered.clean(),\n ];\n\n return plugins\n ? plugins\n .map(p => {\n if (typeof p === 'string') return unordered[p]();\n return p;\n })\n .filter(p => !!p)\n : defaultOrdered();\n};\n\ndefineConfig.default = ({ dir, sourcemap = false, ...rest } = {}) => {\n const input = buildInput();\n const external = rest.externals;\n const output = buildOutput(dir, sourcemap);\n\n const plugins = producePlugins({ dir, sourcemap, ...rest });\n\n return _defineConfig({ input, plugins, external, output, platform: 'node' });\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({\n ...rest,\n plugins: ['circulars', 'externals', 'esm', 'fast', 'clean'],\n });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n const ignoresJS = toArray(additionals?.ignoresJS).concat(DEFAULT_CIRCULAR_DEPS);\n\n const excludesTS = DEFAULT_EXCLUDE.concat(toArray(additionals?.excludesTS));\n const _sourcemap = additionals?.sourcemap;\n const sourcemap = _sourcemap === undefined || _sourcemap === true;\n // #endregion\n\n return defineConfig.default({\n ...additionals,\n circularDeps,\n excludesTS,\n ignoresJS,\n sourcemap,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAa,gBAAyB,gBAAe;CACnD,OAAO,aAAa,QAAQ,WAAW;AACzC;AAEA,MAAM,kBAAkB,EACtB,cACA,WACA,KACA,YAAY,OACZ,YACA,gBACA,YACU,CAAC,MAAM;CACjB,MAAM,UAAUA,8BAAAA,WAAW,GAAGC,oBAAAA,QAAQ,UAAU,CAAC;CACjD,MAAM,UAAUC,kCAAAA,gBAAgB,OAAOD,oBAAAA,QAAQ,UAAU,CAAC;CAC1D,MAAM,YAAY;EAChB,kBACEE,sCAAAA,gBAAgB,WAAW;GAAE;GAAS;GAAS;GAAgB;EAAI,CAAC;EACtE,iBAAiBA,sCAAAA,gBAAgB,UAAU,EAAE,SAAS,aAAa,CAAC;EACpE,iBACEA,sCAAAA,gBAAgB,UAAU;GAExB,SAAS;GACT,gBAAgB;GAChB,SAAS;EACX,CAAC;EACH,aAAaA,sCAAAA,gB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e;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;EACA;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"config.cjs","names":["buildInput","toArray","DEFAULT_EXCLUDE","PLUGIN_BUILDERS","esmExternalRequirePlugin","buildOutput","_defineConfig","DEFAULT_CIRCULAR_DEPS"],"sources":["../../src/rolldown-config/config.ts"],"sourcesContent":["import { defineConfig as _defineConfig } from 'rolldown';\nimport { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\n\n/**\n * Generates Rolldown configuration using default or customized options.\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n * @returns Configured Rolldown options of type {@linkcode RolldownOptions}.\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n dir,\n sourcemap = false,\n excludesTS,\n declarationMap,\n plugins,\n}: Params = {}) => {\n const include = buildInput(...toArray(excludesTS));\n const exclude = DEFAULT_EXCLUDE.concat(toArray(excludesTS));\n const unordered = {\n typescript: () =>\n PLUGIN_BUILDERS.typescript({ include, exclude, declarationMap, dir }),\n circulars: () => PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // Externalize dependencies, peer dependencies and optional dependencies\n optDeps: true,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n clean: () => PLUGIN_BUILDERS.clean({ ignoresJS, sourcemap, dir }),\n fast: () => {\n return PLUGIN_BUILDERS.fast({ include, exclude, declarationMap, dir });\n },\n esm: esmExternalRequirePlugin,\n };\n\n const defaultOrdered = () => [\n unordered.circulars(),\n unordered.externals(),\n unordered.esm(),\n unordered.typescript(),\n unordered.clean(),\n ];\n\n return plugins\n ? plugins\n .map(p => {\n if (typeof p === 'string') return unordered[p]();\n return p;\n })\n .filter(p => !!p)\n : defaultOrdered();\n};\n\ndefineConfig.default = ({ dir, sourcemap = false, ...rest } = {}) => {\n const input = buildInput();\n const external = rest.externals;\n const output = buildOutput(dir, sourcemap);\n\n const plugins = producePlugins({ dir, sourcemap, ...rest });\n\n return _defineConfig({ input, plugins, external, output, platform: 'node' });\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({\n ...rest,\n plugins: ['circulars', 'externals', 'esm', 'fast', 'clean'],\n });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n const ignoresJS = toArray(additionals?.ignoresJS).concat(DEFAULT_CIRCULAR_DEPS);\n\n const excludesTS = DEFAULT_EXCLUDE.concat(toArray(additionals?.excludesTS));\n const _sourcemap = additionals?.sourcemap;\n const sourcemap = _sourcemap === undefined || _sourcemap === true;\n // #endregion\n\n return defineConfig.default({\n ...additionals,\n circularDeps,\n excludesTS,\n ignoresJS,\n sourcemap,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAa,gBAAyB,gBAAe;CACnD,OAAO,aAAa,QAAQ,WAAW;AACzC;AAEA,MAAM,kBAAkB,EACtB,cACA,WACA,KACA,YAAY,OACZ,YACA,gBACA,YACU,CAAC,MAAM;CACjB,MAAM,UAAUA,8BAAAA,WAAW,GAAGC,oBAAAA,QAAQ,UAAU,CAAC;CACjD,MAAM,UAAUC,kCAAAA,gBAAgB,OAAOD,oBAAAA,QAAQ,UAAU,CAAC;CAC1D,MAAM,YAAY;EAChB,kBACEE,sCAAAA,gBAAgB,WAAW;GAAE;GAAS;GAAS;GAAgB;EAAI,CAAC;EACtE,iBAAiBA,sCAAAA,gBAAgB,UAAU,EAAE,SAAS,aAAa,CAAC;EACpE,iBACEA,sCAAAA,gBAAgB,UAAU;GAExB,SA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C1E,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;EACA;CACF,CAAC;AACH"}
@@ -1,11 +1,11 @@
1
1
  import { toArray } from "../utils/array.js";
2
2
  import { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from "./constants.js";
3
- import { buildOutput } from "./output.js";
4
3
  import { buildInput } from "./input.js";
4
+ import { buildOutput } from "./output.js";
5
5
  import { PLUGIN_BUILDERS } from "./plugins/index.js";
6
6
  import { defineConfig as defineConfig$1 } from "rolldown";
7
7
  import { esmExternalRequirePlugin } from "rolldown/plugins";
8
- //#region src/rolldown-config/config.ts
8
+ // src/rolldown-config/config.ts
9
9
  /**
10
10
  * Generates Rolldown configuration using default or customized options.
11
11
  *
@@ -28,7 +28,7 @@ const producePlugins = ({ circularDeps, ignoresJS, dir, sourcemap = false, exclu
28
28
  }),
29
29
  circulars: () => PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),
30
30
  externals: () => PLUGIN_BUILDERS.externals({
31
- optDeps: false,
31
+ optDeps: true,
32
32
  builtinsPrefix: "strip",
33
33
  include: excludesTS
34
34
  }),
@@ -102,7 +102,6 @@ defineConfig.bemedev = (additionals) => {
102
102
  sourcemap
103
103
  });
104
104
  };
105
- //#endregion
106
105
  export { defineConfig };
107
106
 
108
107
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":["_defineConfig"],"sources":["../../src/rolldown-config/config.ts"],"sourcesContent":["import { defineConfig as _defineConfig } from 'rolldown';\nimport { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\n\n/**\n * Generates Rolldown configuration using default or customized options.\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n * @returns Configured Rolldown options of type {@linkcode RolldownOptions}.\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n dir,\n sourcemap = false,\n excludesTS,\n declarationMap,\n plugins,\n}: Params = {}) => {\n const include = buildInput(...toArray(excludesTS));\n const exclude = DEFAULT_EXCLUDE.concat(toArray(excludesTS));\n const unordered = {\n typescript: () =>\n PLUGIN_BUILDERS.typescript({ include, exclude, declarationMap, dir }),\n circulars: () => PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // exclude peerDependencies and dependencies\n optDeps: false,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n clean: () => PLUGIN_BUILDERS.clean({ ignoresJS, sourcemap, dir }),\n fast: () => {\n return PLUGIN_BUILDERS.fast({ include, exclude, declarationMap, dir });\n },\n esm: esmExternalRequirePlugin,\n };\n\n const defaultOrdered = () => [\n unordered.circulars(),\n unordered.externals(),\n unordered.esm(),\n unordered.typescript(),\n unordered.clean(),\n ];\n\n return plugins\n ? plugins\n .map(p => {\n if (typeof p === 'string') return unordered[p]();\n return p;\n })\n .filter(p => !!p)\n : defaultOrdered();\n};\n\ndefineConfig.default = ({ dir, sourcemap = false, ...rest } = {}) => {\n const input = buildInput();\n const external = rest.externals;\n const output = buildOutput(dir, sourcemap);\n\n const plugins = producePlugins({ dir, sourcemap, ...rest });\n\n return _defineConfig({ input, plugins, external, output, platform: 'node' });\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({\n ...rest,\n plugins: ['circulars', 'externals', 'esm', 'fast', 'clean'],\n });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n const ignoresJS = toArray(additionals?.ignoresJS).concat(DEFAULT_CIRCULAR_DEPS);\n\n const excludesTS = DEFAULT_EXCLUDE.concat(toArray(additionals?.excludesTS));\n const _sourcemap = additionals?.sourcemap;\n const sourcemap = _sourcemap === undefined || _sourcemap === true;\n // #endregion\n\n return defineConfig.default({\n ...additionals,\n circularDeps,\n excludesTS,\n ignoresJS,\n sourcemap,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,gBAAyB,gBAAe;CACnD,OAAO,aAAa,QAAQ,WAAW;AACzC;AAEA,MAAM,kBAAkB,EACtB,cACA,WACA,KACA,YAAY,OACZ,YACA,gBACA,YACU,CAAC,MAAM;CACjB,MAAM,UAAU,WAAW,GAAG,QAAQ,UAAU,CAAC;CACjD,MAAM,UAAU,gBAAgB,OAAO,QAAQ,UAAU,CAAC;CAC1D,MAAM,YAAY;EAChB,kBACE,gBAAgB,WAAW;GAAE;GAAS;GAAS;GAAgB;EAAI,CAAC;EACtE,iBAAiB,gBAAgB,UAAU,EAAE,SAAS,aAAa,CAAC;EACpE,iBACE,gBAAgB,UAAU;GAExB,SAAS;GACT,gBAAgB;GAChB,SAAS;EACX,CAAC;EACH,aAAa,gBAAgB,MAAM;GAAE;GAAW;GAAW;EAAI,CAAC;EAChE,YAAY;GACV,OAAO,gBAAgB,KAAK;IAAE;IAAS;IAAS;IAAgB;GAAI,CAAC;EACvE;EACA,KAAK;CACP;CAEA,MAAM,uBAAuB;EAC3B,UAAU,UAAU;EACpB,UAAU,UAAU;EACpB,UAAU,IAAI;EACd,UAAU,WAAW;EACrB,UAAU,MAAM;CAClB;CAEA,OAAO,UACH,QACG,KAAI,MAAK;EACR,IAAI,OAAO,MAAM,UAAU,OAAO,UAAU,EAAE,CAAC;EAC/C,OAAO;CACT,CAAC,CAAC,CACD,QAAO,MAAK,CAAC,CAAC,CAAC,IAClB,eAAe;AACrB;AAEA,aAAa,WAAW,EAAE,KAAK,YAAY,OAAO,GAAG,SAAS,CAAC,MAAM;CACnE,MAAM,QAAQ,WAAW;CACzB,MAAM,WAAW,KAAK;CACtB,MAAM,SAAS,YAAY,KAAK,SAAS;CAEzC,MAAM,UAAU,eAAe;EAAE;EAAK;EAAW,GAAG;CAAK,CAAC;CAE1D,OAAOA,eAAc;EAAE;EAAO;EAAS;EAAU;EAAQ,UAAU;CAAO,CAAC;AAC7E;AAEA,aAAa,QAAO,SAAQ;CAC1B,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH,SAAS;GAAC;GAAa;GAAa;GAAO;GAAQ;EAAO;CAC5D,CAAC;AACH;AAEA,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAe,sBAAsB,OACzC,QAAQ,aAAa,YAAY,CACnC;CACA,MAAM,YAAY,QAAQ,aAAa,SAAS,CAAC,CAAC,OAAO,qBAAqB;CAE9E,MAAM,aAAa,gBAAgB,OAAO,QAAQ,aAAa,UAAU,CAAC;CAC1E,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;EACA;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"config.js","names":["_defineConfig"],"sources":["../../src/rolldown-config/config.ts"],"sourcesContent":["import { defineConfig as _defineConfig } from 'rolldown';\nimport { esmExternalRequirePlugin } from 'rolldown/plugins';\n\nimport { toArray } from '#utils';\n\nimport { DEFAULT_CIRCULAR_DEPS, DEFAULT_EXCLUDE } from './constants';\nimport { buildInput } from './input';\nimport { buildOutput } from './output';\nimport { PLUGIN_BUILDERS } from './plugins';\nimport type { Config_F, Params } from './types';\n\n/**\n * Generates Rolldown configuration using default or customized options.\n *\n * @param additionals - Optional build configuration parameters of type {@linkcode Params}.\n *\n * @returns Configured Rolldown options of type {@linkcode RolldownOptions}.\n */\nexport const defineConfig: Config_F = additionals => {\n return defineConfig.default(additionals);\n};\n\nconst producePlugins = ({\n circularDeps,\n ignoresJS,\n dir,\n sourcemap = false,\n excludesTS,\n declarationMap,\n plugins,\n}: Params = {}) => {\n const include = buildInput(...toArray(excludesTS));\n const exclude = DEFAULT_EXCLUDE.concat(toArray(excludesTS));\n const unordered = {\n typescript: () =>\n PLUGIN_BUILDERS.typescript({ include, exclude, declarationMap, dir }),\n circulars: () => PLUGIN_BUILDERS.circulars({ exclude: circularDeps }),\n externals: () =>\n PLUGIN_BUILDERS.externals({\n // Externalize dependencies, peer dependencies and optional dependencies\n optDeps: true,\n builtinsPrefix: 'strip',\n include: excludesTS,\n }),\n clean: () => PLUGIN_BUILDERS.clean({ ignoresJS, sourcemap, dir }),\n fast: () => {\n return PLUGIN_BUILDERS.fast({ include, exclude, declarationMap, dir });\n },\n esm: esmExternalRequirePlugin,\n };\n\n const defaultOrdered = () => [\n unordered.circulars(),\n unordered.externals(),\n unordered.esm(),\n unordered.typescript(),\n unordered.clean(),\n ];\n\n return plugins\n ? plugins\n .map(p => {\n if (typeof p === 'string') return unordered[p]();\n return p;\n })\n .filter(p => !!p)\n : defaultOrdered();\n};\n\ndefineConfig.default = ({ dir, sourcemap = false, ...rest } = {}) => {\n const input = buildInput();\n const external = rest.externals;\n const output = buildOutput(dir, sourcemap);\n\n const plugins = producePlugins({ dir, sourcemap, ...rest });\n\n return _defineConfig({ input, plugins, external, output, platform: 'node' });\n};\n\ndefineConfig.fast = rest => {\n return defineConfig.default({\n ...rest,\n plugins: ['circulars', 'externals', 'esm', 'fast', 'clean'],\n });\n};\n\ndefineConfig.bemedev = additionals => {\n // #region constants\n const circularDeps = DEFAULT_CIRCULAR_DEPS.concat(\n toArray(additionals?.circularDeps),\n );\n const ignoresJS = toArray(additionals?.ignoresJS).concat(DEFAULT_CIRCULAR_DEPS);\n\n const excludesTS = DEFAULT_EXCLUDE.concat(toArray(additionals?.excludesTS));\n const _sourcemap = additionals?.sourcemap;\n const sourcemap = _sourcemap === undefined || _sourcemap === true;\n // #endregion\n\n return defineConfig.default({\n ...additionals,\n circularDeps,\n excludesTS,\n ignoresJS,\n sourcemap,\n });\n};\n"],"mappings":";;;;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OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH,SAAS;GAAC;GAAa;GAAa;GAAO;GAAQ;EAAO;CAC5D,CAAC;AACH;AAEA,aAAa,WAAU,gBAAe;CAEpC,MAAM,eAAe,sBAAsB,OACzC,QAAQ,aAAa,YAAY,CACnC;CACA,MAAM,YAAY,QAAQ,aAAa,SAAS,CAAC,CAAC,OAAO,qBAAqB;CAE9E,MAAM,aAAa,gBAAgB,OAAO,QAAQ,aAAa,UAAU,CAAC;CAC1E,MAAM,aAAa,aAAa;CAChC,MAAM,YAAY,eAAe,KAAA,KAAa,eAAe;CAG7D,OAAO,aAAa,QAAQ;EAC1B,GAAG;EACH;EACA;EACA;EACA;CACF,CAAC;AACH"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/rolldown-config/constants.ts
2
+ // src/rolldown-config/constants.ts
3
3
  /**
4
4
  * Default exclude glob patterns for bundling and type generation.
5
5
  */
@@ -36,7 +36,6 @@ const WARNING_CODES = {
36
36
  EMPTY_BUNDLE: "EMPTY_BUNDLE",
37
37
  CIRCULAR_DEPENDENCY: "CIRCULAR_DEPENDENCY"
38
38
  };
39
- //#endregion
40
39
  exports.DEFAULT_CIRCULAR_DEPS = DEFAULT_CIRCULAR_DEPS;
41
40
  exports.DEFAULT_DIR = DEFAULT_DIR;
42
41
  exports.DEFAULT_EXCLUDE = DEFAULT_EXCLUDE;
@@ -1,4 +1,4 @@
1
- //#region src/rolldown-config/constants.ts
1
+ // src/rolldown-config/constants.ts
2
2
  /**
3
3
  * Default exclude glob patterns for bundling and type generation.
4
4
  */
@@ -35,7 +35,6 @@ const WARNING_CODES = {
35
35
  EMPTY_BUNDLE: "EMPTY_BUNDLE",
36
36
  CIRCULAR_DEPENDENCY: "CIRCULAR_DEPENDENCY"
37
37
  };
38
- //#endregion
39
38
  export { DEFAULT_CIRCULAR_DEPS, DEFAULT_DIR, DEFAULT_EXCLUDE, IGNORE, WARNING_CODES };
40
39
 
41
40
  //# sourceMappingURL=constants.js.map
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let fs = require("fs");
3
3
  let path = require("path");
4
- //#region src/rolldown-config/helpers.ts
4
+ // src/rolldown-config/helpers.ts
5
5
  /**
6
6
  * Strips the extension from a file path.
7
7
  *
@@ -44,7 +44,6 @@ const cleanupJS = (files, dir, sourcemap) => {
44
44
  console.log("***********");
45
45
  }
46
46
  };
47
- //#endregion
48
47
  exports.cleanupJS = cleanupJS;
49
48
  exports.withoutExtension = withoutExtension;
50
49
 
@@ -1,6 +1,6 @@
1
1
  import { rmSync } from "fs";
2
2
  import { extname, relative, resolve } from "path";
3
- //#region src/rolldown-config/helpers.ts
3
+ // src/rolldown-config/helpers.ts
4
4
  /**
5
5
  * Strips the extension from a file path.
6
6
  *
@@ -43,7 +43,6 @@ const cleanupJS = (files, dir, sourcemap) => {
43
43
  console.log("***********");
44
44
  }
45
45
  };
46
- //#endregion
47
46
  export { cleanupJS, withoutExtension };
48
47
 
49
48
  //# sourceMappingURL=helpers.js.map
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_rolldown_config_plugins_index = require("./plugins/index.cjs");
3
2
  const require_rolldown_config_config = require("./config.cjs");
3
+ const require_rolldown_config_plugins_index = require("./plugins/index.cjs");
4
4
  exports.DEFAULT_PLUGINS_ORDER = require_rolldown_config_plugins_index.DEFAULT_PLUGINS_ORDER;
5
5
  exports.PLUGIN_BUILDERS = require_rolldown_config_plugins_index.PLUGIN_BUILDERS;
6
6
  exports.defineConfig = require_rolldown_config_config.defineConfig;
@@ -1,3 +1,3 @@
1
- import { DEFAULT_PLUGINS_ORDER, PLUGIN_BUILDERS } from "./plugins/index.js";
2
1
  import { defineConfig } from "./config.js";
2
+ import { DEFAULT_PLUGINS_ORDER, PLUGIN_BUILDERS } from "./plugins/index.js";
3
3
  export { DEFAULT_PLUGINS_ORDER, PLUGIN_BUILDERS, defineConfig };
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_rolldown_config_constants = require("./constants.cjs");
3
3
  let path = require("path");
4
4
  let glob = require("glob");
5
- //#region src/rolldown-config/input.ts
5
+ // src/rolldown-config/input.ts
6
6
  /**
7
7
  * Builds entry points record for Rolldown from all
8
8
  * `src/[**]/*.ts]` files.
@@ -14,7 +14,6 @@ let glob = require("glob");
14
14
  const buildInput = (...ignores) => Object.fromEntries((0, glob.globSync)("src/**/*.ts", { ignore: require_rolldown_config_constants.DEFAULT_EXCLUDE.concat(ignores) }).map((file) => {
15
15
  return [(0, path.relative)("src", file.slice(0, file.length - (0, path.extname)(file).length)), `${process.cwd()}/${file}`];
16
16
  }));
17
- //#endregion
18
17
  exports.buildInput = buildInput;
19
18
 
20
19
  //# sourceMappingURL=input.cjs.map
@@ -1,7 +1,7 @@
1
1
  import { DEFAULT_EXCLUDE } from "./constants.js";
2
2
  import { extname, relative } from "path";
3
3
  import { globSync } from "glob";
4
- //#region src/rolldown-config/input.ts
4
+ // src/rolldown-config/input.ts
5
5
  /**
6
6
  * Builds entry points record for Rolldown from all
7
7
  * `src/[**]/*.ts]` files.
@@ -13,7 +13,6 @@ import { globSync } from "glob";
13
13
  const buildInput = (...ignores) => Object.fromEntries(globSync("src/**/*.ts", { ignore: DEFAULT_EXCLUDE.concat(ignores) }).map((file) => {
14
14
  return [relative("src", file.slice(0, file.length - extname(file).length)), `${process.cwd()}/${file}`];
15
15
  }));
16
- //#endregion
17
16
  export { buildInput };
18
17
 
19
18
  //# sourceMappingURL=input.js.map
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./constants.cjs");
3
3
  const require_rolldown_config_plugins_typescript_config = require("./plugins/typescript.config.cjs");
4
- //#region src/rolldown-config/output.ts
4
+ // src/rolldown-config/output.ts
5
5
  /**
6
6
  * Builds ES and CJS output configurations for Rolldown.
7
7
  *
@@ -28,7 +28,6 @@ const buildOutput = (dir = "lib", sourcemap) => {
28
28
  entryFileNames: "[name].cjs"
29
29
  }];
30
30
  };
31
- //#endregion
32
31
  exports.buildOutput = buildOutput;
33
32
 
34
33
  //# sourceMappingURL=output.cjs.map
@@ -1,6 +1,6 @@
1
1
  import "./constants.js";
2
2
  import { getConfig } from "./plugins/typescript.config.js";
3
- //#region src/rolldown-config/output.ts
3
+ // src/rolldown-config/output.ts
4
4
  /**
5
5
  * Builds ES and CJS output configurations for Rolldown.
6
6
  *
@@ -27,7 +27,6 @@ const buildOutput = (dir = "lib", sourcemap) => {
27
27
  entryFileNames: "[name].cjs"
28
28
  }];
29
29
  };
30
- //#endregion
31
30
  export { buildOutput };
32
31
 
33
32
  //# sourceMappingURL=output.js.map
@@ -5,7 +5,7 @@ const require_rolldown_config_helpers = require("../helpers.cjs");
5
5
  let path = require("path");
6
6
  let glob = require("glob");
7
7
  let rollup_plugin_circular_dependencies = require("rollup-plugin-circular-dependencies");
8
- //#region src/rolldown-config/plugins/circulars.ts
8
+ // src/rolldown-config/plugins/circulars.ts
9
9
  /**
10
10
  * Creates a configured circular dependencies plugin instance with suppression for known patterns.
11
11
  *
@@ -32,7 +32,6 @@ function circulars(options = {}) {
32
32
  } }
33
33
  };
34
34
  }
35
- //#endregion
36
35
  exports.circulars = circulars;
37
36
 
38
37
  //# sourceMappingURL=circulars.cjs.map
@@ -4,7 +4,7 @@ import { withoutExtension } from "../helpers.js";
4
4
  import { relative } from "path";
5
5
  import { globSync } from "glob";
6
6
  import { circularDependencies } from "rollup-plugin-circular-dependencies";
7
- //#region src/rolldown-config/plugins/circulars.ts
7
+ // src/rolldown-config/plugins/circulars.ts
8
8
  /**
9
9
  * Creates a configured circular dependencies plugin instance with suppression for known patterns.
10
10
  *
@@ -31,7 +31,6 @@ function circulars(options = {}) {
31
31
  } }
32
32
  };
33
33
  }
34
- //#endregion
35
34
  export { circulars };
36
35
 
37
36
  //# sourceMappingURL=circulars.js.map
@@ -1,13 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_utils_array = require("../../utils/array.cjs");
3
3
  const require_rolldown_config_constants = require("../constants.cjs");
4
- const require_rolldown_config_plugins_typescript_config = require("./typescript.config.cjs");
5
4
  const require_rolldown_config_helpers = require("../helpers.cjs");
5
+ const require_rolldown_config_plugins_typescript_config = require("./typescript.config.cjs");
6
6
  let fs = require("fs");
7
7
  let path = require("path");
8
8
  let glob = require("glob");
9
9
  let _typescript_typescript6 = require("@typescript/typescript6");
10
- //#region src/rolldown-config/plugins/clean.ts
10
+ // src/rolldown-config/plugins/clean.ts
11
11
  /**
12
12
  * Plugin to clean up intermediate JavaScript and sourcemap files for type-only entries.
13
13
  *
@@ -51,7 +51,6 @@ const clean = (options) => {
51
51
  }
52
52
  };
53
53
  };
54
- //#endregion
55
54
  exports.clean = clean;
56
55
 
57
56
  //# sourceMappingURL=clean.cjs.map