@reliverse/dler 1.4.7 → 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 (48) hide show
  1. package/README.md +8 -8
  2. package/bin/{addons.js → app/agg/run.js} +1 -1
  3. package/bin/app/build/cmd.js +2 -2
  4. package/bin/app/build/impl.js +97 -0
  5. package/bin/app/cmds.d.ts +41 -0
  6. package/bin/app/cmds.js +3 -0
  7. package/bin/app/pub/cmd.js +2 -2
  8. package/bin/app/relifso/cmd.js +13 -1
  9. package/bin/app/relifso/rename/cmd.d.ts +27 -0
  10. package/bin/app/relifso/rename/cmd.js +126 -0
  11. package/bin/{dler.js → cli.js} +2 -2
  12. package/bin/{init.js → init/init.js} +22 -4
  13. package/bin/{load.d.ts → init/load.d.ts} +1 -1
  14. package/bin/{load.js → init/load.js} +1 -1
  15. package/bin/{default.d.ts → libs/sdk/default.d.ts} +1 -1
  16. package/bin/{default.js → libs/sdk/default.js} +21 -10
  17. package/bin/libs/sdk/sdk-impl/build/build-library.d.ts +20 -28
  18. package/bin/libs/sdk/sdk-impl/build/build-library.js +12 -21
  19. package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +4 -11
  20. package/bin/libs/sdk/sdk-impl/build/build-regular.js +161 -118
  21. package/bin/libs/sdk/sdk-impl/library-flow.d.ts +11 -4
  22. package/bin/libs/sdk/sdk-impl/library-flow.js +29 -29
  23. package/bin/libs/sdk/sdk-impl/pub/pub-library.d.ts +1 -1
  24. package/bin/libs/sdk/sdk-impl/pub/pub-regular.d.ts +1 -1
  25. package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +2 -9
  26. package/bin/libs/sdk/sdk-impl/regular-flow.js +91 -142
  27. package/bin/libs/sdk/sdk-impl/utils/finalize.d.ts +1 -2
  28. package/bin/libs/sdk/sdk-impl/utils/finalize.js +1 -3
  29. package/bin/libs/sdk/sdk-impl/utils/utils-build.js +8 -5
  30. package/bin/libs/sdk/sdk-impl/utils/utils-deps.d.ts +2 -2
  31. package/bin/libs/sdk/sdk-impl/utils/utils-deps.js +31 -7
  32. package/bin/libs/sdk/sdk-impl/utils/utils-error.d.ts +1 -1
  33. package/bin/libs/sdk/sdk-impl/utils/utils-perf.d.ts +1 -5
  34. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.d.ts +2 -2
  35. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +72 -91
  36. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.d.ts +2 -2
  37. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +19 -44
  38. package/bin/libs/sdk/sdk-mod.d.ts +0 -1
  39. package/bin/libs/sdk/sdk-types.d.ts +41 -20
  40. package/bin/mod.js +1 -1
  41. package/package.json +5 -19
  42. package/bin/impl.js +0 -219
  43. /package/bin/{addons.d.ts → app/agg/run.d.ts} +0 -0
  44. /package/bin/{impl.d.ts → app/build/impl.d.ts} +0 -0
  45. /package/bin/{dler.d.ts → cli.d.ts} +0 -0
  46. /package/bin/{info.d.ts → init/info.d.ts} +0 -0
  47. /package/bin/{info.js → init/info.js} +0 -0
  48. /package/bin/{init.d.ts → init/init.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
- import type { ExcludeMode, NpmOutExt } from "../../sdk-types.js";
1
+ import type { NpmOutExt, BuildPublishConfig } from "../../sdk-types.js";
2
2
  /**
3
3
  * Creates a package.json for the main distribution.
4
4
  */
5
5
  export declare function regular_createPackageJSON(outDirRoot: string, isJsr: boolean, coreIsCLI: {
6
6
  enabled: boolean;
7
7
  scripts: Record<string, string>;
8
- }, unifiedBundlerOutExt: NpmOutExt, rmDepsMode: ExcludeMode, rmDepsPatterns: string[], coreDescription: string, coreBuildOutDir?: string): Promise<void>;
8
+ }, unifiedBundlerOutExt: NpmOutExt, config: BuildPublishConfig, coreDescription: string, coreBuildOutDir?: string): Promise<void>;
@@ -6,7 +6,8 @@ import {
6
6
  readPackageJSON
7
7
  } from "pkg-types";
8
8
  import { cliDomainDocs } from "./utils-consts.js";
9
- export async function regular_createPackageJSON(outDirRoot, isJsr, coreIsCLI, unifiedBundlerOutExt, rmDepsMode, rmDepsPatterns, coreDescription, coreBuildOutDir = "bin") {
9
+ import { filterDeps } from "./utils-deps.js";
10
+ export async function regular_createPackageJSON(outDirRoot, isJsr, coreIsCLI, unifiedBundlerOutExt, config, coreDescription, coreBuildOutDir = "bin") {
10
11
  relinka(
11
12
  "log",
12
13
  `Generating distribution package.json and tsconfig.json (isJsr=${isJsr})...`
@@ -42,16 +43,15 @@ export async function regular_createPackageJSON(outDirRoot, isJsr, coreIsCLI, un
42
43
  dependencies: await regular_getPkgKeepDeps(
43
44
  originalPkg.dependencies,
44
45
  outDirBin,
45
- isJsr,
46
- rmDepsMode,
47
- rmDepsPatterns
46
+ true,
47
+ config
48
48
  ),
49
- devDependencies: await regular_getPkgKeepDeps(
49
+ devDependencies: await filterDeps(
50
50
  originalPkg.devDependencies,
51
+ true,
51
52
  outDirBin,
52
- isJsr,
53
- rmDepsMode,
54
- rmDepsPatterns
53
+ true,
54
+ config
55
55
  ),
56
56
  exports: {
57
57
  ".": `./${coreBuildOutDir}/mod.ts`
@@ -85,16 +85,15 @@ export async function regular_createPackageJSON(outDirRoot, isJsr, coreIsCLI, un
85
85
  dependencies: await regular_getPkgKeepDeps(
86
86
  originalPkg.dependencies,
87
87
  outDirBin,
88
- isJsr,
89
- rmDepsMode,
90
- rmDepsPatterns
88
+ false,
89
+ config
91
90
  ),
92
- devDependencies: await regular_getPkgKeepDeps(
91
+ devDependencies: await filterDeps(
93
92
  originalPkg.devDependencies,
93
+ true,
94
94
  outDirBin,
95
- isJsr,
96
- rmDepsMode,
97
- rmDepsPatterns
95
+ false,
96
+ config
98
97
  ),
99
98
  exports: {
100
99
  ".": `./${coreBuildOutDir}/mod.${outExt}`
@@ -187,33 +186,9 @@ async function regular_createCommonPackageFields(coreIsCLI, coreDescription) {
187
186
  relinka("verbose", "Common package fields generated");
188
187
  return commonPkg;
189
188
  }
190
- async function regular_getPkgKeepDeps(originalDeps, outDirBin, isJsr, rmDepsMode, rmDepsPatterns) {
191
- relinka("verbose", "Getting main package dependencies");
192
- if (!originalDeps) return {};
193
- const originalPkg = await readPackageJSON();
194
- const devDeps = originalDeps === originalPkg.devDependencies;
195
- const result = Object.entries(originalDeps).reduce(
196
- (acc, [k, v]) => {
197
- let shouldExclude = false;
198
- if (rmDepsMode === "patterns-only") {
199
- shouldExclude = rmDepsPatterns.some(
200
- (pattern) => k.toLowerCase().includes(pattern.toLowerCase())
201
- );
202
- } else if (rmDepsMode === "patterns-and-devdeps") {
203
- shouldExclude = devDeps || rmDepsPatterns.some(
204
- (pattern) => k.toLowerCase().includes(pattern.toLowerCase())
205
- );
206
- }
207
- if (!shouldExclude) {
208
- acc[k] = v;
209
- }
210
- return acc;
211
- },
212
- {}
213
- );
214
- relinka(
215
- "verbose",
216
- `Main package dependencies filtered, count: ${Object.keys(result).length}`
217
- );
218
- return result;
189
+ async function regular_getPkgKeepDeps(originalDeps, outDirBin, isJsr, config) {
190
+ if (!originalDeps) {
191
+ return {};
192
+ }
193
+ return filterDeps(originalDeps, false, outDirBin, isJsr, config);
219
194
  }
@@ -40,7 +40,6 @@ export { copyRootFile, getDirectorySize, outDirBinFilesCount, deleteSpecificFile
40
40
  export { finalizeBuildPub } from "./sdk-impl/utils/finalize.js";
41
41
  export { createJsrJSON, renameTsxFiles, } from "./sdk-impl/utils/utils-jsr-json.js";
42
42
  export { extractPackageName } from "./sdk-impl/utils/utils-misc.js";
43
- export type { PerfTimer } from "./sdk-impl/utils/utils-perf.js";
44
43
  export { createPerfTimer, getElapsedPerfTime, pausePerfTimer, resumePerfTimer, } from "./sdk-impl/utils/utils-perf.js";
45
44
  export { library_createPackageJSON } from "./sdk-impl/utils/utils-pkg-json-libs.js";
46
45
  export { regular_createPackageJSON } from "./sdk-impl/utils/utils-pkg-json-reg.js";
@@ -287,22 +287,42 @@ export type BuildPublishConfig = {
287
287
  */
288
288
  logsFreshFile: boolean;
289
289
  /**
290
- * Controls how dependencies are excluded from the final package:
291
- * - `patterns-and-devdeps`: Excludes all `devDependencies` and dependencies matching specified patterns.
292
- * - `patterns-only`: Excludes only dependencies matching `rmDepsPatterns`.
290
+ * Configuration for dependency removal patterns.
291
+ * Controls which dependencies are excluded from the final package.
293
292
  *
294
- * @default "patterns-and-devdeps"
295
- */
296
- rmDepsMode: ExcludeMode;
297
- /**
298
- * A list of dependency name patterns to exclude when filtering `dependencies` and `devDependencies`.
299
- * Any dependency whose name matches or contains any of these patterns will be excluded from the final package.
300
- * Helps prevent known `devDependencies` from being mistakenly included in `dependencies`.
293
+ * Structure:
294
+ * - `global`: Patterns that are always applied to all builds
295
+ * - `dist-npm`: NPM-specific patterns (merged with global)
296
+ * - `dist-jsr`: JSR-specific patterns (merged with global)
297
+ * - `dist-libs`: Library-specific patterns (merged with global)
298
+ * Each library can have separate NPM and JSR patterns
301
299
  *
302
- * @example ["eslint", "prettier", "test"]
303
- * @default ["eslint", "prettier", "biome"]
300
+ * @example
301
+ * {
302
+ * global: ["@types", "eslint"],
303
+ * "dist-npm": ["npm-specific"],
304
+ * "dist-jsr": ["jsr-specific"],
305
+ * "dist-libs": {
306
+ * "@myorg/lib1": {
307
+ * npm: ["lib1-npm-specific"],
308
+ * jsr: ["lib1-jsr-specific"]
309
+ * },
310
+ * "@myorg/lib2": {
311
+ * npm: ["lib2-npm-specific"],
312
+ * jsr: ["lib2-jsr-specific"]
313
+ * }
314
+ * }
315
+ * }
304
316
  */
305
- rmDepsPatterns: string[];
317
+ removeDepsPatterns: {
318
+ global: string[];
319
+ "dist-npm": string[];
320
+ "dist-jsr": string[];
321
+ "dist-libs": Record<string, {
322
+ npm: string[];
323
+ jsr: string[];
324
+ }>;
325
+ };
306
326
  /**
307
327
  * The transpileTarget runtime environment for the built package.
308
328
  *
@@ -383,12 +403,6 @@ export type BuildPublishConfig = {
383
403
  */
384
404
  export type BundlerName = "bun" | "copy" | "jsr" | "mkdist" | "rollup" | "untyped";
385
405
  export type Esbuild = "es2019" | "es2020" | "es2021" | "es2022" | "es2023";
386
- /**
387
- * Supported modes for filtering dependencies.
388
- * - patterns-and-devdeps: Excludes all `devDependencies` and dependencies matching specified patterns.
389
- * - patterns-only: Excludes only dependencies matching `rmDepsPatterns`.
390
- */
391
- export type ExcludeMode = "patterns-and-devdeps" | "patterns-only";
392
406
  /**
393
407
  * Configuration for a library to be built and published as a separate package.
394
408
  * Used when publishing multiple packages from a single repository.
@@ -427,7 +441,7 @@ export type LibConfig = {
427
441
  libMainFile: string;
428
442
  /**
429
443
  * Dependencies to include in the dist's package.json.
430
- * The final output may vary based on `rmDepsMode` and `rmDepsPatterns`.
444
+ * The final output may vary based on `removeDepsPatterns`.
431
445
  * Defines how dependencies are handled during publishing:
432
446
  * - `string[]`: Includes only the specified dependencies.
433
447
  * - `true`: Includes all dependencies from the main package.json.
@@ -788,4 +802,11 @@ export type UnifiedBuildConfig = DeepPartial<Omit<BuildOptions, "entries">> & {
788
802
  type DeepPartial<T> = {
789
803
  [P in keyof T]?: DeepPartial<T[P]>;
790
804
  };
805
+ export type PerfTimer = {
806
+ pausedAt: null | number;
807
+ pausedDuration: number;
808
+ startTime: number;
809
+ };
791
810
  export {};
811
+ /** Options common to both NPM and JSR build targets */
812
+ /** Options specific to the transpilation/bundling process */
package/bin/mod.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DEFAULT_CONFIG } from "./default.js";
1
+ import { DEFAULT_CONFIG } from "./libs/sdk/default.js";
2
2
  export const defineConfig = (userConfig = {}) => {
3
3
  return { ...DEFAULT_CONFIG, ...userConfig };
4
4
  };
package/package.json CHANGED
@@ -13,7 +13,6 @@
13
13
  "@rollup/plugin-node-resolve": "^16.0.1",
14
14
  "@rollup/plugin-replace": "^6.0.2",
15
15
  "@rollup/pluginutils": "^5.1.4",
16
- "bun": "^1.2.14",
17
16
  "chalk": "^5.4.1",
18
17
  "defu": "^6.1.4",
19
18
  "esbuild": "^0.25.4",
@@ -30,10 +29,10 @@
30
29
  "pkg-types": "^2.1.0",
31
30
  "pretty-bytes": "^7.0.0",
32
31
  "pretty-ms": "^9.2.0",
33
- "rollup": "^4.41.0",
32
+ "rollup": "^4.41.1",
34
33
  "rollup-plugin-dts": "^6.2.1",
35
34
  "scule": "^1.3.0",
36
- "tinyglobby": "^0.2.13",
35
+ "tinyglobby": "^0.2.14",
37
36
  "ts-morph": "^26.0.0",
38
37
  "untyped": "^2.0.0"
39
38
  },
@@ -42,7 +41,7 @@
42
41
  "license": "MIT",
43
42
  "name": "@reliverse/dler",
44
43
  "type": "module",
45
- "version": "1.4.7",
44
+ "version": "1.5.1",
46
45
  "keywords": [
47
46
  "reliverse",
48
47
  "cli",
@@ -59,22 +58,9 @@
59
58
  "url": "git+https://github.com/reliverse/dler.git"
60
59
  },
61
60
  "bin": {
62
- "dler": "bin/dler.js"
63
- },
64
- "devDependencies": {
65
- "@biomejs/biome": "^1.9.4",
66
- "@eslint/js": "^9.27.0",
67
- "@stylistic/eslint-plugin": "^4.2.0",
68
- "@total-typescript/ts-reset": "^0.6.1",
69
- "@types/bun": "^1.2.14",
70
- "@types/node": "^22.15.21",
71
- "eslint": "^9.27.0",
72
- "eslint-plugin-no-relative-import-paths": "^1.6.1",
73
- "eslint-plugin-perfectionist": "^4.13.0",
74
- "knip": "^5.57.2",
75
- "typescript": "^5.8.3",
76
- "typescript-eslint": "^8.32.1"
61
+ "dler": "bin/cli.js"
77
62
  },
63
+ "devDependencies": {},
78
64
  "exports": {
79
65
  ".": "./bin/mod.js"
80
66
  },
package/bin/impl.js DELETED
@@ -1,219 +0,0 @@
1
- import {
2
- bumpHandler,
3
- isBumpDisabled,
4
- setBumpDisabledValueTo
5
- } from "@reliverse/bleump";
6
- import path from "@reliverse/pathkit";
7
- import fs from "@reliverse/relifso";
8
- import { processLibraryFlow } from "./libs/sdk/sdk-impl/library-flow.js";
9
- import { processRegularFlow } from "./libs/sdk/sdk-impl/regular-flow.js";
10
- import { finalizeBuildPub } from "./libs/sdk/sdk-impl/utils/finalize.js";
11
- import { removeDistFolders } from "./libs/sdk/sdk-impl/utils/utils-clean.js";
12
- import { PROJECT_ROOT } from "./libs/sdk/sdk-impl/utils/utils-consts.js";
13
- import { handleDlerError } from "./libs/sdk/sdk-impl/utils/utils-error.js";
14
- import { createPerfTimer } from "./libs/sdk/sdk-impl/utils/utils-perf.js";
15
- import { loadConfig } from "./load.js";
16
- export async function dlerBuild(isDev) {
17
- const timer = createPerfTimer();
18
- try {
19
- const config = await loadConfig();
20
- if (config.logsFreshFile) {
21
- await fs.remove(path.join(PROJECT_ROOT, config.logsFileName));
22
- }
23
- await removeDistFolders(
24
- config.distNpmDirName,
25
- config.distJsrDirName,
26
- config.libsDirDist,
27
- config.libsList
28
- );
29
- try {
30
- const bumpIsDisabled = await isBumpDisabled();
31
- if (!bumpIsDisabled && !config.commonPubPause) {
32
- await bumpHandler(
33
- config.bumpMode,
34
- false,
35
- config.bumpFilter,
36
- config.bumpSet
37
- );
38
- await setBumpDisabledValueTo(true);
39
- }
40
- } catch {
41
- throw new Error("[.config/dler.ts] Failed to set bumpDisable to true");
42
- }
43
- await processRegularFlow(
44
- timer,
45
- isDev,
46
- config.coreIsCLI,
47
- config.libsActMode,
48
- config.commonPubRegistry,
49
- config.coreEntrySrcDir,
50
- config.distNpmDirName,
51
- config.distNpmBuilder,
52
- config.coreEntryFile,
53
- config.distJsrDryRun,
54
- config.distJsrFailOnWarn,
55
- config.commonPubPause,
56
- config.distJsrDirName,
57
- config.distJsrBuilder,
58
- config.transpileTarget,
59
- config.transpileFormat,
60
- config.transpileSplitting,
61
- config.transpileMinify,
62
- config.transpileSourcemap,
63
- config.transpilePublicPath,
64
- config.distJsrAllowDirty,
65
- config.distJsrSlowTypes,
66
- config.distNpmOutFilesExt,
67
- config.rmDepsMode,
68
- config.transpileStub,
69
- config.transpileWatch,
70
- config.distJsrGenTsconfig,
71
- config.coreDeclarations,
72
- {
73
- coreDescription: config.coreDescription,
74
- coreBuildOutDir: config.coreBuildOutDir
75
- }
76
- );
77
- await processLibraryFlow(
78
- timer,
79
- isDev,
80
- config.libsActMode,
81
- config.libsList,
82
- config.distJsrDryRun,
83
- config.distJsrFailOnWarn,
84
- config.libsDirDist,
85
- config.libsDirSrc,
86
- config.commonPubPause,
87
- config.commonPubRegistry,
88
- config.distNpmOutFilesExt,
89
- config.distNpmBuilder,
90
- config.coreEntrySrcDir,
91
- config.rmDepsMode,
92
- config.rmDepsPatterns,
93
- config.transpileEsbuild,
94
- config.transpileTarget,
95
- config.transpileFormat,
96
- config.transpileSplitting,
97
- config.transpileSourcemap,
98
- config.transpilePublicPath,
99
- config.distJsrBuilder,
100
- config.transpileStub,
101
- config.transpileWatch,
102
- config.distJsrOutFilesExt,
103
- config.distJsrAllowDirty,
104
- config.distJsrSlowTypes
105
- );
106
- await finalizeBuildPub(
107
- timer,
108
- config.commonPubPause,
109
- config.libsList,
110
- config.distNpmDirName,
111
- config.distJsrDirName,
112
- config.libsDirDist
113
- );
114
- } catch (error) {
115
- handleDlerError(error, timer);
116
- }
117
- }
118
- export async function dlerPub(isDev) {
119
- const timer = createPerfTimer();
120
- try {
121
- const config = await loadConfig();
122
- if (config.logsFreshFile) {
123
- await fs.remove(path.join(PROJECT_ROOT, config.logsFileName));
124
- }
125
- await removeDistFolders(
126
- config.distNpmDirName,
127
- config.distJsrDirName,
128
- config.libsDirDist,
129
- config.libsList
130
- );
131
- const bumpIsDisabled = await isBumpDisabled();
132
- if (!bumpIsDisabled && !config.commonPubPause) {
133
- try {
134
- await bumpHandler(
135
- config.bumpMode,
136
- false,
137
- config.bumpFilter,
138
- config.bumpSet
139
- );
140
- await setBumpDisabledValueTo(true);
141
- } catch {
142
- throw new Error("[.config/dler.ts] Failed to set bumpDisable to true");
143
- }
144
- }
145
- await processRegularFlow(
146
- timer,
147
- isDev,
148
- config.coreIsCLI,
149
- config.libsActMode,
150
- config.commonPubRegistry,
151
- config.coreEntrySrcDir,
152
- config.distNpmDirName,
153
- config.distNpmBuilder,
154
- config.coreEntryFile,
155
- config.distJsrDryRun,
156
- config.distJsrFailOnWarn,
157
- config.commonPubPause,
158
- config.distJsrDirName,
159
- config.distJsrBuilder,
160
- config.transpileTarget,
161
- config.transpileFormat,
162
- config.transpileSplitting,
163
- config.transpileMinify,
164
- config.transpileSourcemap,
165
- config.transpilePublicPath,
166
- config.distJsrAllowDirty,
167
- config.distJsrSlowTypes,
168
- config.distNpmOutFilesExt,
169
- config.rmDepsMode,
170
- config.transpileStub,
171
- config.transpileWatch,
172
- config.distJsrGenTsconfig,
173
- config.coreDeclarations,
174
- {
175
- coreDescription: config.coreDescription,
176
- coreBuildOutDir: config.coreBuildOutDir
177
- }
178
- );
179
- await processLibraryFlow(
180
- timer,
181
- isDev,
182
- config.libsActMode,
183
- config.libsList,
184
- config.distJsrDryRun,
185
- config.distJsrFailOnWarn,
186
- config.libsDirDist,
187
- config.libsDirSrc,
188
- config.commonPubPause,
189
- config.commonPubRegistry,
190
- config.distNpmOutFilesExt,
191
- config.distNpmBuilder,
192
- config.coreEntrySrcDir,
193
- config.rmDepsMode,
194
- config.rmDepsPatterns,
195
- config.transpileEsbuild,
196
- config.transpileTarget,
197
- config.transpileFormat,
198
- config.transpileSplitting,
199
- config.transpileSourcemap,
200
- config.transpilePublicPath,
201
- config.distJsrBuilder,
202
- config.transpileStub,
203
- config.transpileWatch,
204
- config.distJsrOutFilesExt,
205
- config.distJsrAllowDirty,
206
- config.distJsrSlowTypes
207
- );
208
- await finalizeBuildPub(
209
- timer,
210
- config.commonPubPause,
211
- config.libsList,
212
- config.distNpmDirName,
213
- config.distJsrDirName,
214
- config.libsDirDist
215
- );
216
- } catch (error) {
217
- handleDlerError(error, timer);
218
- }
219
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes