@reliverse/dler 1.7.16 → 1.7.18

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 (165) hide show
  1. package/README.md +134 -206
  2. package/bin/app/agg/run.js +2 -8
  3. package/bin/app/build/cmd.js +4 -4
  4. package/bin/app/build/impl.d.ts +2 -6
  5. package/bin/app/build/impl.js +2 -46
  6. package/bin/app/conv/cmd.d.ts +8 -33
  7. package/bin/app/conv/cmd.js +185 -163
  8. package/bin/app/copy/cmd.js +1 -1
  9. package/bin/app/init/init-impl.js +3 -3
  10. package/bin/app/init/init-types.d.ts +8 -8
  11. package/bin/app/merge/cmd.d.ts +10 -24
  12. package/bin/app/merge/cmd.js +47 -464
  13. package/bin/app/migrate/codemods/anything-bun.js +1 -1
  14. package/bin/app/migrate/codemods/fs-relifso.d.ts +2 -2
  15. package/bin/app/migrate/codemods/fs-relifso.js +1 -1
  16. package/bin/app/migrate/codemods/nodenext-bundler.d.ts +2 -2
  17. package/bin/app/migrate/codemods/nodenext-bundler.js +1 -1
  18. package/bin/app/migrate/codemods/path-pathkit.d.ts +2 -2
  19. package/bin/app/migrate/codemods/path-pathkit.js +1 -1
  20. package/bin/app/migrate/codemods/readdir-glob.d.ts +2 -2
  21. package/bin/app/migrate/codemods/readdir-glob.js +1 -1
  22. package/bin/app/mkdist/cmd.js +4 -2
  23. package/bin/app/pack/cmd.d.ts +44 -0
  24. package/bin/app/pack/cmd.js +313 -0
  25. package/bin/app/pub/cmd.js +4 -4
  26. package/bin/app/pub/impl.d.ts +7 -0
  27. package/bin/app/pub/impl.js +97 -0
  28. package/bin/app/rename/cmd.js +1 -1
  29. package/bin/app/spell/cmd.d.ts +14 -5
  30. package/bin/app/spell/cmd.js +33 -33
  31. package/bin/app/spell/old.js +0 -0
  32. package/bin/app/{mock → unpack}/cmd.d.ts +10 -14
  33. package/bin/app/unpack/cmd.js +200 -0
  34. package/bin/cli.js +2 -2
  35. package/bin/libs/cfg/cfg-mod.d.ts +69 -0
  36. package/bin/libs/cfg/cfg-mod.js +61 -0
  37. package/bin/libs/cfg/rse/rse-impl/rse-biome.d.ts +2 -0
  38. package/bin/libs/cfg/rse/rse-impl/rse-biome.js +34 -0
  39. package/bin/libs/cfg/rse/rse-impl/rse-consts.d.ts +35 -0
  40. package/bin/libs/cfg/rse/rse-impl/rse-consts.js +37 -0
  41. package/bin/libs/cfg/rse/rse-impl/rse-content.d.ts +14 -0
  42. package/bin/libs/cfg/rse/rse-impl/rse-content.js +15 -0
  43. package/bin/libs/cfg/rse/rse-impl/rse-core.d.ts +14 -0
  44. package/bin/libs/cfg/rse/rse-impl/rse-core.js +63 -0
  45. package/bin/libs/cfg/rse/rse-impl/rse-create.d.ts +36 -0
  46. package/bin/libs/cfg/rse/rse-impl/rse-create.js +254 -0
  47. package/bin/libs/cfg/rse/rse-impl/rse-def-utils.d.ts +6 -0
  48. package/bin/libs/cfg/rse/rse-impl/rse-def-utils.js +225 -0
  49. package/bin/libs/cfg/rse/rse-impl/rse-default.d.ts +3 -0
  50. package/bin/libs/cfg/rse/rse-impl/rse-default.js +155 -0
  51. package/bin/libs/cfg/rse/rse-impl/rse-define.d.ts +125 -0
  52. package/bin/libs/cfg/rse/rse-impl/rse-define.js +4 -0
  53. package/bin/libs/cfg/rse/rse-impl/rse-detect.d.ts +23 -0
  54. package/bin/libs/cfg/rse/rse-impl/rse-detect.js +347 -0
  55. package/bin/libs/cfg/rse/rse-impl/rse-gen-cfg.d.ts +3 -0
  56. package/bin/libs/cfg/rse/rse-impl/rse-gen-cfg.js +186 -0
  57. package/bin/libs/cfg/rse/rse-impl/rse-inject.d.ts +1 -0
  58. package/bin/libs/cfg/rse/rse-impl/rse-inject.js +57 -0
  59. package/bin/libs/cfg/rse/rse-impl/rse-migrate.d.ts +5 -0
  60. package/bin/libs/cfg/rse/rse-impl/rse-migrate.js +56 -0
  61. package/bin/libs/cfg/rse/rse-impl/rse-path.d.ts +11 -0
  62. package/bin/libs/cfg/rse/rse-impl/rse-path.js +33 -0
  63. package/bin/libs/cfg/rse/rse-impl/rse-prompts.d.ts +5 -0
  64. package/bin/libs/cfg/rse/rse-impl/rse-prompts.js +12 -0
  65. package/bin/libs/cfg/rse/rse-impl/rse-read.d.ts +11 -0
  66. package/bin/libs/cfg/rse/rse-impl/rse-read.js +84 -0
  67. package/bin/libs/cfg/rse/rse-impl/rse-repair.d.ts +16 -0
  68. package/bin/libs/cfg/rse/rse-impl/rse-repair.js +137 -0
  69. package/bin/libs/cfg/rse/rse-impl/rse-schema.d.ts +130 -0
  70. package/bin/libs/cfg/rse/rse-impl/rse-schema.js +444 -0
  71. package/bin/libs/cfg/rse/rse-impl/rse-types.d.ts +75 -0
  72. package/bin/libs/cfg/rse/rse-impl/rse-types.js +0 -0
  73. package/bin/libs/cfg/rse/rse-impl/rse-unstable.d.ts +11 -0
  74. package/bin/libs/cfg/rse/rse-impl/rse-unstable.js +41 -0
  75. package/bin/libs/cfg/rse/rse-impl/rse-update.d.ts +10 -0
  76. package/bin/libs/cfg/rse/rse-impl/rse-update.js +152 -0
  77. package/bin/libs/cfg/rse/rse-impl/rse-utils.d.ts +17 -0
  78. package/bin/libs/cfg/rse/rse-impl/rse-utils.js +86 -0
  79. package/bin/libs/cfg/rse/rse-mod.d.ts +20 -0
  80. package/bin/libs/cfg/rse/rse-mod.js +20 -0
  81. package/bin/libs/cfg/types.d.ts +533 -0
  82. package/bin/libs/cfg/types.js +0 -0
  83. package/bin/libs/sdk/sdk-impl/build/build-library.d.ts +5 -5
  84. package/bin/libs/sdk/sdk-impl/build/build-library.js +1 -174
  85. package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +2 -1
  86. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +287 -240
  87. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/vue.d.ts +4 -4
  88. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.d.ts +8 -5
  89. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.js +199 -119
  90. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/spinner.d.ts +99 -0
  91. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/spinner.js +206 -0
  92. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-mod.js +92 -46
  93. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/raw.d.ts +2 -2
  94. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.d.ts +2 -2
  95. package/bin/libs/sdk/sdk-impl/config/default.d.ts +6 -0
  96. package/bin/libs/sdk/sdk-impl/{cfg → config}/default.js +8 -18
  97. package/bin/libs/sdk/sdk-impl/{cfg → config}/info.js +1 -1
  98. package/bin/libs/sdk/sdk-impl/{cfg → config}/init.js +53 -43
  99. package/bin/libs/sdk/sdk-impl/{cfg → config}/load.d.ts +2 -2
  100. package/bin/libs/sdk/sdk-impl/{cfg → config}/load.js +6 -6
  101. package/bin/libs/sdk/sdk-impl/config/types.d.ts +533 -0
  102. package/bin/libs/sdk/sdk-impl/config/types.js +0 -0
  103. package/bin/libs/sdk/sdk-impl/library-flow.d.ts +2 -1
  104. package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +2 -1
  105. package/bin/libs/sdk/sdk-impl/rules/reliverse/dler-config-health/dler-config-health.js +2 -2
  106. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-types.d.ts +6 -6
  107. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/filesystem.js +1 -1
  108. package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js +1 -1
  109. package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.js +2 -2
  110. package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.d.ts +38 -0
  111. package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.js +474 -0
  112. package/bin/libs/sdk/sdk-impl/spell/spells.d.ts +31 -0
  113. package/bin/libs/sdk/sdk-impl/spell/spells.js +85 -0
  114. package/bin/libs/sdk/sdk-impl/utils/binary.js +1 -1
  115. package/bin/libs/sdk/sdk-impl/utils/comments.d.ts +6 -0
  116. package/bin/libs/sdk/sdk-impl/utils/comments.js +41 -0
  117. package/bin/libs/sdk/sdk-impl/utils/finalize.d.ts +2 -1
  118. package/bin/libs/sdk/sdk-impl/utils/finalize.js +1 -0
  119. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.d.ts +6 -0
  120. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.js +7 -0
  121. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.d.ts +5 -0
  122. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.js +40 -0
  123. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.d.ts +24 -0
  124. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.js +0 -0
  125. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.d.ts +17 -0
  126. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.js +46 -0
  127. package/bin/libs/sdk/sdk-impl/utils/replacements.d.ts +0 -0
  128. package/bin/libs/sdk/sdk-impl/utils/replacements.js +0 -0
  129. package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.d.ts +3 -0
  130. package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.js +194 -0
  131. package/bin/libs/sdk/sdk-impl/utils/utils-build.d.ts +1 -2
  132. package/bin/libs/sdk/sdk-impl/utils/utils-clean.d.ts +1 -1
  133. package/bin/libs/sdk/sdk-impl/utils/utils-deps.d.ts +1 -1
  134. package/bin/libs/sdk/sdk-impl/utils/utils-determine.d.ts +1 -1
  135. package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.d.ts +4 -0
  136. package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.js +1 -0
  137. package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.d.ts +1 -1
  138. package/bin/libs/sdk/sdk-impl/utils/utils-package-json-libraries.d.ts +1 -1
  139. package/bin/libs/sdk/sdk-impl/utils/utils-package-json-regular.d.ts +1 -1
  140. package/bin/libs/sdk/sdk-impl/utils/utils-security.d.ts +1 -3
  141. package/bin/libs/sdk/sdk-impl/utils/utils-security.js +11 -10
  142. package/bin/libs/sdk/sdk-mod.d.ts +1 -6
  143. package/bin/libs/sdk/sdk-mod.js +0 -31
  144. package/bin/libs/sdk/sdk-types.d.ts +39 -582
  145. package/bin/mod.d.ts +1 -1
  146. package/bin/mod.js +1 -1
  147. package/package.json +12 -4
  148. package/bin/app/mock/cmd.js +0 -284
  149. package/bin/app/mock/mock.d.ts +0 -11
  150. package/bin/app/mock/mock.js +0 -97
  151. package/bin/libs/sdk/sdk-impl/cfg/default.d.ts +0 -5
  152. package/bin/libs/sdk/sdk-impl/cfg/define.d.ts +0 -2
  153. package/bin/libs/sdk/sdk-impl/cfg/define.js +0 -4
  154. package/bin/libs/sdk/sdk-impl/spell/spell-executors.d.ts +0 -10
  155. package/bin/libs/sdk/sdk-impl/spell/spell-executors.js +0 -307
  156. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.d.ts +0 -7
  157. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.js +0 -74
  158. package/bin/libs/sdk/sdk-impl/spell/spell-mod.d.ts +0 -4
  159. package/bin/libs/sdk/sdk-impl/spell/spell-mod.js +0 -87
  160. package/bin/libs/sdk/sdk-impl/spell/spell-parser.d.ts +0 -4
  161. package/bin/libs/sdk/sdk-impl/spell/spell-parser.js +0 -58
  162. package/bin/libs/sdk/sdk-impl/spell/spell-types.d.ts +0 -60
  163. /package/bin/{libs/sdk/sdk-impl/spell/spell-types.js → app/spell/old.d.ts} +0 -0
  164. /package/bin/libs/sdk/sdk-impl/{cfg → config}/info.d.ts +0 -0
  165. /package/bin/libs/sdk/sdk-impl/{cfg → config}/init.d.ts +0 -0
@@ -0,0 +1,533 @@
1
+ /**
2
+ * Defines the configuration for building and publishing packages. This includes: versioning,
3
+ * build settings, publishing options, libraries-dler-plugin built-in plugin, and more.
4
+ * It customizes the build and publish pipeline for both NPM and JSR registries.
5
+ */
6
+ export interface DlerConfig {
7
+ /**
8
+ * When `true`, disables version bumping.
9
+ * Useful when retrying a failed publish with an already bumped version.
10
+ *
11
+ * @default false
12
+ */
13
+ bumpDisable: boolean;
14
+ /**
15
+ * Controls which files will have their version numbers updated during version bumping.
16
+ *
17
+ * Accepts:
18
+ * - Standard file types like "package.json"
19
+ * - Relative paths like "src/constants.ts"
20
+ * - [Globbing patterns](https://github.com/mrmlnc/fast-glob#pattern-syntax)
21
+ *
22
+ * When empty, falls back to only updating "package.json".
23
+ * Respects: .gitignore patterns, hidden files, .git & node_modules.
24
+ *
25
+ * @default ["package.json", ".config/rse.ts"]
26
+ */
27
+ bumpFilter: string[];
28
+ /**
29
+ * Specifies how the version number should be incremented:
30
+ * - `patch`: Increments the patch version for backwards-compatible bug fixes (1.2.3 → 1.2.4)
31
+ * - `minor`: Increments the minor version for new backwards-compatible features (1.2.3 → 1.3.0)
32
+ * - `major`: Increments the major version for breaking changes (1.2.3 → 2.0.0)
33
+ * - `auto`: Automatically determine the appropriate bump type
34
+ * - `manual`: Set a specific version (requires bumpSet to be set)
35
+ *
36
+ * Please note: `dler` infers the version from the `package.json` file.
37
+ *
38
+ * @default "patch"
39
+ */
40
+ bumpMode: BumpMode;
41
+ /**
42
+ * Custom version to set when bumpMode is "manual".
43
+ * Must be a valid semver version (e.g., "1.2.3").
44
+ *
45
+ * @default ""
46
+ */
47
+ bumpSet: string;
48
+ /**
49
+ * When `true`, stops after building and retains distribution folders.
50
+ * Useful for development or inspecting the build output.
51
+ *
52
+ * @default true
53
+ */
54
+ commonPubPause: boolean;
55
+ /**
56
+ * Specifies which package registries to publish to:
57
+ * - `npm`: Publish only to the NPM commonPubRegistry.
58
+ * - `jsr`: Publish only to the JSR commonPubRegistry.
59
+ * - `npm-jsr`: Publish to both NPM and JSR registries.
60
+ *
61
+ * @default "npm"
62
+ */
63
+ commonPubRegistry: "jsr" | "npm" | "npm-jsr";
64
+ /**
65
+ * When `true`, enables detailed logs during the build and publish process.
66
+ * Useful for debugging or understanding the build flow.
67
+ *
68
+ * @default false
69
+ */
70
+ commonVerbose: boolean;
71
+ /**
72
+ * When `true`, generates TypeScript declaration files (.d.ts) for NPM packages.
73
+ * Essential for providing type intranspileFormation to TypeScript users.
74
+ *
75
+ * To reduce bundle size you can set this to `false` if your main project
76
+ * is planned to be used only as a global CLI tool (e.g. `bunx dler`).
77
+ *
78
+ * @default true
79
+ */
80
+ coreDeclarations: boolean;
81
+ /**
82
+ * Path to the project's main entry file.
83
+ * Used as the entry point for the NPM package.
84
+ *
85
+ * @default "mod.ts"
86
+ */
87
+ coreEntryFile: string;
88
+ /**
89
+ * Base directory containing the source entry files.
90
+ * All paths are resolved relative to this directory.
91
+ * Set to `"."` if entry files are in the project root.
92
+ *
93
+ * @default "src"
94
+ */
95
+ coreEntrySrcDir: string;
96
+ /**
97
+ * Directory where built files will be placed within the distribution directory.
98
+ * For example, if set to "bin", CLI scripts will be placed in "dist-npm/bin" or "dist-jsr/bin".
99
+ *
100
+ * @default "bin"
101
+ */
102
+ coreBuildOutDir: string;
103
+ /**
104
+ * Configuration for CLI functionality:
105
+ * - enabled: When `true`, indicates that the package has CLI capabilities
106
+ * - scripts: Map of CLI script names to their entry file paths
107
+ * The key will be used as the command name in package.json's bin field
108
+ * The value should be the path to the executable script (e.g. "cli.ts")
109
+ *
110
+ * **The source scripts should be in your "coreEntrySrcDir" directory (by default "src")**
111
+ *
112
+ * @example
113
+ * {
114
+ * enabled: true,
115
+ * scripts: {
116
+ * "mycli": "cli.ts",
117
+ * "othercmd": "other-cmd.ts"
118
+ * }
119
+ * }
120
+ *
121
+ * @default { enabled: false, scripts: {} }
122
+ */
123
+ coreIsCLI: {
124
+ enabled: boolean;
125
+ scripts: Record<string, string>;
126
+ };
127
+ /**
128
+ * Optional description that overrides the description from package.json.
129
+ * When provided, this description will be used in the dist's package.json.
130
+ * If not provided, the description from the original package.json will be used.
131
+ *
132
+ * @default `package.json`'s "description"
133
+ */
134
+ coreDescription: string;
135
+ /**
136
+ * When `true`, allows JSR publishing even with uncommitted changes.
137
+ * Use with caution, as it may lead to inconsistent published versions.
138
+ *
139
+ * It is `true` by default to make it easier for new `dler` users to publish their projects.
140
+ *
141
+ * @default true
142
+ */
143
+ distJsrAllowDirty: boolean;
144
+ /**
145
+ * The bundler to use for creating JSR-compatible packages.
146
+ * JSR's native bundler is recommended for best compatibility.
147
+ *
148
+ * @default "jsr"
149
+ */
150
+ distJsrBuilder: BundlerName;
151
+ /**
152
+ * Directory where JSR build artifacts are generated.
153
+ * This directory will contain the package ready for JSR publishing.
154
+ *
155
+ * @default "dist-jsr"
156
+ */
157
+ distJsrDirName: string;
158
+ /**
159
+ * When `true`, simulates the publishing process without actually publishing.
160
+ * Useful for testing the build and publish pipeline without side effects.
161
+ *
162
+ * @default false
163
+ */
164
+ distJsrDryRun: boolean;
165
+ /**
166
+ * When `true`, fails the build if warnings are detected.
167
+ * Use with caution, as it may lead to inconsistent published versions.
168
+ *
169
+ * @default false
170
+ */
171
+ distJsrFailOnWarn: boolean;
172
+ /**
173
+ * When `true`, generates a `jsconfig.json` file for JSR's dist.
174
+ *
175
+ * @default false
176
+ */
177
+ distJsrGenTsconfig: boolean;
178
+ /**
179
+ * The file extension for output files in JSR packages.
180
+ *
181
+ * @default "ts"
182
+ */
183
+ distJsrOutFilesExt: NpmOutExt;
184
+ /**
185
+ * When `true`, enables JSR to process complex types, which may impact performance.
186
+ * Enable this only if you cannot simplify or explicitly define exported types.
187
+ *
188
+ * JSR requires exported functions, classes, variables, and type aliases to have
189
+ * explicitly written or easily inferred types. Otherwise, it may be unable to
190
+ * generate documentation, type declarations for npm compatibility, or efficient
191
+ * type checking for consumers.
192
+ *
193
+ * If "slow types" are present, type checking performance may degrade, and some
194
+ * features may not work as expected.
195
+ *
196
+ * It is `true` by default to make it easier for new `dler` users to publish their projects.
197
+ *
198
+ * @see https://jsr.io/docs/about-slow-types
199
+ * @default true
200
+ */
201
+ distJsrSlowTypes: boolean;
202
+ /**
203
+ * The bundler to use for creating NPM-compatible packages.
204
+ *
205
+ * @default "mkdist"
206
+ */
207
+ distNpmBuilder: BundlerName;
208
+ /**
209
+ * Directory where NPM build artifacts are generated.
210
+ * This directory will contain the package ready for NPM publishing.
211
+ *
212
+ * @default "dist-npm"
213
+ */
214
+ distNpmDirName: string;
215
+ /**
216
+ * Specifies the file extension for output files in NPM packages.
217
+ * Determines the extension of compiled files in the NPM distribution.
218
+ * We strongly recommend using `"js"` with the `"esm"` transpileFormat.
219
+ *
220
+ * @default "js"
221
+ */
222
+ distNpmOutFilesExt: NpmOutExt;
223
+ /**
224
+ * !! EXPERIMENTAL !!
225
+ * Controls which parts of the project are built and published:
226
+ * - `main-project-only`: Builds/publishes only the main package.
227
+ * - `main-and-libs`: Builds/publishes both the main package and libraries.
228
+ * - `libs-only`: Builds/publishes only the libraries.
229
+ *
230
+ * @default "main-project-only"
231
+ */
232
+ libsActMode: "libs-only" | "main-and-libs" | "main-project-only";
233
+ /**
234
+ * The directory where built libraries are stored before publishing.
235
+ *
236
+ * @default "dist-libs"
237
+ */
238
+ libsDirDist: string;
239
+ /**
240
+ * The directory containing library source files.
241
+ *
242
+ * @default "src/libs"
243
+ */
244
+ libsDirSrc: string;
245
+ /**
246
+ * !! EXPERIMENTAL !!
247
+ * Configuration for building and publishing multiple libraries.
248
+ * Each key represents a package name, and its value contains the configuration.
249
+ *
250
+ * @example
251
+ * {
252
+ * "@myorg/ml1": { main: "my-lib-1/mod.ts" },
253
+ * "@myorg/ml2": { main: "my-lib-2/ml2-mod.ts" },
254
+ * "@myorg/ml3": { main: "src/libs/my-lib-3/index.js" }
255
+ * }
256
+ */
257
+ libsList: Record<string, LibConfig>;
258
+ /**
259
+ * The name of the log file. dler uses `@reliverse/relinka` for logging.
260
+ *
261
+ * @default ".logs/relinka.log"
262
+ */
263
+ logsFileName: string;
264
+ /**
265
+ * When `true`, cleans up the log file from previous runs.
266
+ *
267
+ * @default false
268
+ */
269
+ logsFreshFile: boolean;
270
+ /**
271
+ * Configuration for dependency removal/injection patterns.
272
+ * Controls which dependencies are excluded from (or injected into) the final package.
273
+ *
274
+ * Pattern types:
275
+ * - Regular patterns: Exclude deps that match the pattern
276
+ * - Negation patterns (starting with !): Don't exclude deps that match the pattern
277
+ * - Add patterns (starting with +): Inject deps into specific dists even if original package.json doesn't have them
278
+ *
279
+ * Structure (dist-specific patterns are merged with global):
280
+ * - `global`: Patterns that are always applied to all builds
281
+ * - `dist-npm`: NPM-specific patterns
282
+ * - `dist-jsr`: JSR-specific patterns
283
+ * - `dist-libs`: Library-specific patterns
284
+ * Each library can have separate NPM and JSR patterns
285
+ *
286
+ * @example
287
+ * {
288
+ * global: ["@types", "eslint"],
289
+ * "dist-npm": ["npm-specific"],
290
+ * "dist-jsr": ["+bun"], // Explicitly include 'bun' in JSR builds
291
+ * "dist-libs": {
292
+ * "@myorg/lib1": {
293
+ * npm: ["lib1-npm-specific"],
294
+ * jsr: ["+bun"] // Explicitly include 'bun' in this lib's JSR build
295
+ * }
296
+ * }
297
+ * }
298
+ */
299
+ filterDepsPatterns: {
300
+ global: string[];
301
+ "dist-npm": string[];
302
+ "dist-jsr": string[];
303
+ "dist-libs": Record<string, {
304
+ npm: string[];
305
+ jsr: string[];
306
+ }>;
307
+ };
308
+ /**
309
+ * When `true`, fails the build if warnings are detected.
310
+ * Use with caution, as it may lead to inconsistent published versions.
311
+ *
312
+ * @default false
313
+ */
314
+ transpileFailOnWarn: boolean;
315
+ /**
316
+ * The transpileTarget runtime environment for the built package.
317
+ *
318
+ * @default "es2023"
319
+ */
320
+ transpileEsbuild: Esbuild;
321
+ /**
322
+ * Output module transpileFormat for built files:
323
+ * - `esm`: ECMAScript modules (import/export)
324
+ * - `cjs`: CommonJS modules (require/exports)
325
+ * - `iife`: Immediately Invoked Function Expression (for browsers)
326
+ *
327
+ * @default "esm"
328
+ */
329
+ transpileFormat: transpileFormat;
330
+ /**
331
+ * When `true`, minifies the output to reduce bundle size.
332
+ * Recommended for production builds but may increase build time.
333
+ *
334
+ * @default true
335
+ */
336
+ transpileMinify: boolean;
337
+ /**
338
+ * The base URL for loading assets in the built package.
339
+ * Important for packages that include assets like images or fonts.
340
+ *
341
+ * @default "/"
342
+ */
343
+ transpilePublicPath: string;
344
+ /**
345
+ * Controls source map generation for debugging (experimental):
346
+ * - `true/false`: Enable/disable source maps.
347
+ * - `"inline"`: Include source maps within output files.
348
+ * - `"none"`: Do not generate source maps.
349
+ * - `"linked"`: Generate separate source map files with links.
350
+ * - `"external"`: Generate separate source map files.
351
+ *
352
+ * @default false
353
+ */
354
+ transpileSourcemap: Sourcemap;
355
+ /**
356
+ * When `true`, enables code transpileSplitting for improved load-time performance.
357
+ * Useful for large applications but may not be needed for small projects.
358
+ *
359
+ * @default false
360
+ */
361
+ transpileSplitting: boolean;
362
+ /**
363
+ * Stub the package for JIT compilation.
364
+ *
365
+ * @default false
366
+ */
367
+ transpileStub: boolean;
368
+ /**
369
+ * Defines the transpileTarget runtime environment:
370
+ * - `node`: Optimized for Node.js.
371
+ * - `bun`: Optimized for Bun.
372
+ * - `browser`: Optimized for web browsers.
373
+ *
374
+ * @default "node"
375
+ */
376
+ transpileTarget: transpileTarget;
377
+ /**
378
+ * Watch the src dir and rebuild on change (experimental).
379
+ *
380
+ * @default false
381
+ */
382
+ transpileWatch: boolean;
383
+ /**
384
+ * Specifies what resources to send to npm and jsr registries.
385
+ * coreBuildOutDir (e.g. "bin") dir is automatically included.
386
+ * The following is also included if publishArtifacts is {}:
387
+ * - global: ["package.json", "README.md", "LICENSE"]
388
+ * - dist-jsr,dist-libs/jsr: ["jsr.json"]
389
+ *
390
+ * Structure:
391
+ * - `global`: Files to include in all distributions
392
+ * - `dist-jsr`: Files specific to JSR distribution
393
+ * - `dist-npm`: Files specific to NPM distribution
394
+ * - `dist-libs`: Library-specific files for each distribution type
395
+ *
396
+ * Useful for including additional files like configuration or documentation.
397
+ * Pro tip: set jsr.jsonc to generate jsr.jsonc instead of jsr.json config.
398
+ *
399
+ * @default
400
+ * {
401
+ * global: ["bin", "package.json", "README.md", "LICENSE"],
402
+ * "dist-jsr": ["jsr.json"],
403
+ * "dist-npm": [],
404
+ * "dist-libs": {
405
+ * "@myorg/lib1": {
406
+ * jsr: ["jsr.json"],
407
+ * npm: []
408
+ * }
409
+ * }
410
+ * }
411
+ */
412
+ publishArtifacts?: {
413
+ global: string[];
414
+ "dist-jsr": string[];
415
+ "dist-npm": string[];
416
+ "dist-libs": Record<string, {
417
+ jsr: string[];
418
+ npm: string[];
419
+ }>;
420
+ };
421
+ }
422
+ export type BumpMode = "patch" | "minor" | "major" | "auto" | "manual";
423
+ /**
424
+ * Supported bundler names for building packages:
425
+ * - bun: Bun's built-in bundler for fast builds
426
+ * - copy: A simple file copy without bundling
427
+ * - jsr: Similar to copy but optimized for the JSR commonPubRegistry
428
+ * - mkdist: A lightweight bundler focused on TypeScript/ESM
429
+ * - rollup: A traditional bundler with an extensive plugin ecosystem
430
+ * - untyped: Types and markdown generation from a config object
431
+ */
432
+ export type BundlerName = "bun" | "copy" | "jsr" | "mkdist" | "rollup" | "untyped";
433
+ export type NpmOutExt = "cjs" | "cts" | "js" | "mjs" | "mts" | "ts";
434
+ /**
435
+ * Configuration for a library to be built and published as a separate package.
436
+ * Used when publishing multiple packages from a single repository.
437
+ */
438
+ export interface LibConfig {
439
+ /**
440
+ * When `true`, generates TypeScript declaration files (.d.ts) for NPM packages.
441
+ */
442
+ libDeclarations: boolean;
443
+ /**
444
+ * An optional description of the library, included in the dist's package.json.
445
+ * Provides users with an overview of the library's purpose.
446
+ *
447
+ * @example "Utility functions for data manipulation"
448
+ * @example "Core configuration module for the framework"
449
+ *
450
+ * @default `package.json`'s "description"
451
+ */
452
+ libDescription: string;
453
+ /**
454
+ * The directory where the library's dist files are stored.
455
+ *
456
+ * @default name is derived from the library's name after slash
457
+ */
458
+ libDirName: string;
459
+ /**
460
+ * The path to the library's main entry file.
461
+ * This file serves as the primary entry point for imports.
462
+ * The path should be relative to the project root.
463
+ * The full path to the library's main file is derived by joining `libsDirDist` with `main`.
464
+ *
465
+ * @example "my-lib-1/mod.ts"
466
+ * @example "my-lib-2/ml2-mod.ts"
467
+ * @example "src/libs/my-lib-3/index.js"
468
+ */
469
+ libMainFile: string;
470
+ /**
471
+ * Dependencies to include in the dist's package.json.
472
+ * The final output may vary based on `filterDepsPatterns`.
473
+ * Defines how dependencies are handled during publishing:
474
+ * - `string[]`: Includes only the specified dependencies.
475
+ * - `true`: Includes all dependencies from the main package.json.
476
+ * - `false` or `undefined`: Automatically determines dependencies based on imports.
477
+ *
478
+ * @example ["@reliverse/pathkit", "@reliverse/relifso"] - Only will include these specific dependencies.
479
+ * @example true - Include all `dependencies` from the main package.json.
480
+ */
481
+ libPkgKeepDeps: boolean | string[];
482
+ /**
483
+ * When `true`, minifies the output to reduce bundle size.
484
+ * Recommended for production builds but may increase build time.
485
+ *
486
+ * @default true
487
+ */
488
+ libTranspileMinify: boolean;
489
+ /**
490
+ * When true, pauses publishing for this specific library (overridden by commonPubPause).
491
+ * If true, this library will be built but not published, even if other libs are published.
492
+ *
493
+ * @default false
494
+ */
495
+ libPubPause?: boolean;
496
+ /**
497
+ * The registry to publish the library to.
498
+ *
499
+ * @default "npm"
500
+ */
501
+ libPubRegistry?: "jsr" | "npm" | "npm-jsr";
502
+ /**
503
+ * Optional version override for the library.
504
+ * If not provided, falls back to the version from the main package.json.
505
+ *
506
+ * @default `package.json`'s "version"
507
+ */
508
+ version?: string;
509
+ }
510
+ export type Esbuild = "es2019" | "es2020" | "es2021" | "es2022" | "es2023";
511
+ /**
512
+ * Supported output module transpileFormats for built packages.
513
+ * - esm: ECMAScript modules (import/export)
514
+ * - cjs: CommonJS modules (require/exports)
515
+ * - iife: Immediately Invoked Function Expression (for browsers)
516
+ */
517
+ export type transpileFormat = "cjs" | "esm" | "iife";
518
+ /**
519
+ * Supported source map options for built packages.
520
+ * - boolean: Enable/disable source maps.
521
+ * - "inline": Include source maps within output files.
522
+ * - "none": Do not generate source maps.
523
+ * - "linked": Generate separate source map files with links.
524
+ * - "external": Generate separate source map files.
525
+ */
526
+ export type Sourcemap = "external" | "inline" | "linked" | "none" | boolean;
527
+ /**
528
+ * Supported transpileTarget runtime environments for built packages.
529
+ * - node: Optimized for Node.js.
530
+ * - bun: Optimized for Bun.
531
+ * - browser: Optimized for web browsers.
532
+ */
533
+ export type transpileTarget = "browser" | "bun" | "node";
File without changes
@@ -1,4 +1,5 @@
1
- import type { BundlerName, Esbuild, LibConfig, NpmOutExt, Sourcemap, transpileFormat, transpileTarget, DlerConfig, PerfTimer } from "../sdk-types.js";
1
+ import type { BundlerName, Esbuild, LibConfig, NpmOutExt, Sourcemap, transpileFormat, transpileTarget, DlerConfig } from "./config/types.js";
2
+ import { type PerfTimer } from "../sdk-mod.js";
2
3
  /**
3
4
  * Processes libraries based on build mode.
4
5
  */
@@ -1,4 +1,5 @@
1
- import type { DlerConfig, PerfTimer } from "../sdk-types.js";
1
+ import type { DlerConfig } from "./config/types.js";
2
+ import type { PerfTimer } from "../sdk-types.js";
2
3
  /**
3
4
  * Processes the main project based on build mode and commonPubRegistry.
4
5
  */
@@ -1,9 +1,9 @@
1
- import { loadConfig } from "../../../cfg/load.js";
1
+ import { getConfigDler } from "../../../config/load.js";
2
2
  export async function checkDlerConfigHealth() {
3
3
  const startTime = Date.now();
4
4
  const issues = [];
5
5
  try {
6
- const config = await loadConfig();
6
+ const config = await getConfigDler();
7
7
  const libsList = config.libsList || {};
8
8
  for (const [, libConfig] of Object.entries(libsList)) {
9
9
  const typedConfig = libConfig;
@@ -1,12 +1,12 @@
1
1
  export type FileType = ".js" | ".jsx" | ".ts" | ".tsx";
2
- export type PackageJson = {
2
+ export interface PackageJson {
3
3
  name?: string;
4
4
  dependencies?: Record<string, string>;
5
5
  devDependencies?: Record<string, string>;
6
6
  peerDependencies?: Record<string, string>;
7
7
  optionalDependencies?: Record<string, string>;
8
- };
9
- export type FinderOptions = {
8
+ }
9
+ export interface FinderOptions {
10
10
  directory: string;
11
11
  showAll: boolean;
12
12
  ignorePatterns: string[];
@@ -17,12 +17,12 @@ export type FinderOptions = {
17
17
  optional: boolean;
18
18
  fix: boolean;
19
19
  depth: number;
20
- };
21
- export type DependencyResult = {
20
+ }
21
+ export interface DependencyResult {
22
22
  missingDependencies: string[];
23
23
  allDependencies: string[];
24
24
  listedDependencies: string[];
25
25
  builtinModules: string[];
26
26
  devOnlyDependencies: string[];
27
27
  duplicateDependencies: string[];
28
- };
28
+ }
@@ -1,5 +1,5 @@
1
+ import path from "@reliverse/pathkit";
1
2
  import fs from "@reliverse/relifso";
2
- import path from "node:path";
3
3
  import { glob } from "tinyglobby";
4
4
  export const findSourceFiles = async (directory, ignorePatterns) => {
5
5
  const pattern = `${directory}/**/*.{js,jsx,ts,tsx}`;
@@ -1,4 +1,4 @@
1
- import path from "node:path";
1
+ import path from "@reliverse/pathkit";
2
2
  import { glob } from "tinyglobby";
3
3
  export async function checkNoIndexFiles(options) {
4
4
  const { directory } = options;
@@ -1,7 +1,7 @@
1
1
  import { getFileImportsExports, extname } from "@reliverse/pathkit";
2
2
  import fs from "@reliverse/relifso";
3
3
  import { relinka } from "@reliverse/relinka";
4
- import { loadConfig } from "../../../cfg/load.js";
4
+ import { getConfigDler } from "../../../config/load.js";
5
5
  import { getAllFiles, getLineNumber } from "../../rules-utils.js";
6
6
  export async function checkSelfInclude(options) {
7
7
  const startTime = Date.now();
@@ -11,7 +11,7 @@ export async function checkSelfInclude(options) {
11
11
  try {
12
12
  const packageJson = JSON.parse(await fs.readFile("package.json", "utf8"));
13
13
  const packageName = packageJson.name;
14
- const config = await loadConfig();
14
+ const config = await getConfigDler();
15
15
  const libsList = config.libsList || {};
16
16
  let forbiddenImports = [];
17
17
  if (dirPath === "dist-npm" || dirPath === "dist-jsr" || dirPath === "src") {
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Spell runner – walks a directory tree, finds
3
+ * magic-comment directives and executes them.
4
+ *
5
+ * Usage example:
6
+ * await applyMagicSpells(["dist-jsr"]);
7
+ * await applyMagicSpells(["dist-libs/sdk"]);
8
+ * await applyMagicSpells(["dist-npm", "dist-jsr", "dist-libs"]);
9
+ */
10
+ export interface ApplyMagicSpellsOptions {
11
+ /** Absolute or cwd-relative root directory to process */
12
+ dir: string;
13
+ /** Number of files to process in parallel */
14
+ concurrency?: number;
15
+ /** Number of files to process in each batch */
16
+ batchSize?: number;
17
+ /** Whether to stop on first error */
18
+ stopOnError?: boolean;
19
+ /** Whether to copy files from src before processing */
20
+ copyFileWithDirectivesFromSrcBeforeProcessing?: boolean;
21
+ }
22
+ export interface ApplyMagicSpellsResult {
23
+ /** All processed files */
24
+ processedFiles: string[];
25
+ }
26
+ /**
27
+ * Processes files in specified distribution directories by applying magic directives
28
+ * First scans src directory for files with magic directives, then processes corresponding dist files
29
+ * @param targets Array of distribution targets in format "dist-npm", "dist-jsr", "dist-libs" or "dist-libs/lib-name"
30
+ * @param options Configuration options for processing
31
+ * @returns Object containing arrays of processed files and processed .d.ts files
32
+ */
33
+ export declare function applyMagicSpells(targets: string[], options?: Partial<ApplyMagicSpellsOptions>): Promise<ApplyMagicSpellsResult>;
34
+ /**
35
+ * Gets all available registries across all libraries
36
+ * @returns Array of unique registry names found across all libraries
37
+ */
38
+ export declare function getAllAvailableRegistries(): Promise<string[]>;