@reliverse/dler 1.7.15 → 1.7.17

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 (167) hide show
  1. package/README.md +164 -191
  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 +17 -17
  12. package/bin/app/merge/cmd.js +70 -310
  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/pub/pub-library.js +7 -0
  105. package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +4 -8
  106. package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +2 -1
  107. package/bin/libs/sdk/sdk-impl/rules/reliverse/dler-config-health/dler-config-health.js +2 -2
  108. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-types.d.ts +6 -6
  109. package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/filesystem.js +1 -1
  110. package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js +1 -1
  111. package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.js +2 -2
  112. package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.d.ts +38 -0
  113. package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.js +474 -0
  114. package/bin/libs/sdk/sdk-impl/spell/spells.d.ts +31 -0
  115. package/bin/libs/sdk/sdk-impl/spell/spells.js +85 -0
  116. package/bin/libs/sdk/sdk-impl/utils/binary.js +1 -1
  117. package/bin/libs/sdk/sdk-impl/utils/comments.d.ts +6 -0
  118. package/bin/libs/sdk/sdk-impl/utils/comments.js +41 -0
  119. package/bin/libs/sdk/sdk-impl/utils/finalize.d.ts +2 -1
  120. package/bin/libs/sdk/sdk-impl/utils/finalize.js +1 -0
  121. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.d.ts +6 -0
  122. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.js +7 -0
  123. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.d.ts +5 -0
  124. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.js +40 -0
  125. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.d.ts +24 -0
  126. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.js +0 -0
  127. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.d.ts +17 -0
  128. package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.js +46 -0
  129. package/bin/libs/sdk/sdk-impl/utils/replacements.d.ts +0 -0
  130. package/bin/libs/sdk/sdk-impl/utils/replacements.js +0 -0
  131. package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.d.ts +3 -0
  132. package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.js +194 -0
  133. package/bin/libs/sdk/sdk-impl/utils/utils-build.d.ts +1 -2
  134. package/bin/libs/sdk/sdk-impl/utils/utils-clean.d.ts +1 -1
  135. package/bin/libs/sdk/sdk-impl/utils/utils-deps.d.ts +1 -1
  136. package/bin/libs/sdk/sdk-impl/utils/utils-determine.d.ts +1 -1
  137. package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.d.ts +4 -0
  138. package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.js +1 -0
  139. package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.d.ts +1 -1
  140. package/bin/libs/sdk/sdk-impl/utils/utils-package-json-libraries.d.ts +1 -1
  141. package/bin/libs/sdk/sdk-impl/utils/utils-package-json-regular.d.ts +1 -1
  142. package/bin/libs/sdk/sdk-impl/utils/utils-security.d.ts +1 -3
  143. package/bin/libs/sdk/sdk-impl/utils/utils-security.js +11 -10
  144. package/bin/libs/sdk/sdk-mod.d.ts +1 -6
  145. package/bin/libs/sdk/sdk-mod.js +0 -31
  146. package/bin/libs/sdk/sdk-types.d.ts +39 -582
  147. package/bin/mod.d.ts +1 -1
  148. package/bin/mod.js +1 -1
  149. package/package.json +11 -4
  150. package/bin/app/mock/cmd.js +0 -284
  151. package/bin/app/mock/mock.d.ts +0 -11
  152. package/bin/app/mock/mock.js +0 -97
  153. package/bin/libs/sdk/sdk-impl/cfg/default.d.ts +0 -5
  154. package/bin/libs/sdk/sdk-impl/cfg/define.d.ts +0 -2
  155. package/bin/libs/sdk/sdk-impl/cfg/define.js +0 -4
  156. package/bin/libs/sdk/sdk-impl/spell/spell-executors.d.ts +0 -10
  157. package/bin/libs/sdk/sdk-impl/spell/spell-executors.js +0 -307
  158. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.d.ts +0 -7
  159. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.js +0 -74
  160. package/bin/libs/sdk/sdk-impl/spell/spell-mod.d.ts +0 -4
  161. package/bin/libs/sdk/sdk-impl/spell/spell-mod.js +0 -87
  162. package/bin/libs/sdk/sdk-impl/spell/spell-parser.d.ts +0 -4
  163. package/bin/libs/sdk/sdk-impl/spell/spell-parser.js +0 -58
  164. package/bin/libs/sdk/sdk-impl/spell/spell-types.d.ts +0 -60
  165. /package/bin/{libs/sdk/sdk-impl/spell/spell-types.js → app/spell/old.d.ts} +0 -0
  166. /package/bin/libs/sdk/sdk-impl/{cfg → config}/info.d.ts +0 -0
  167. /package/bin/libs/sdk/sdk-impl/{cfg → config}/init.d.ts +0 -0
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  - 🎯 optimized for speed and modern workflows
16
16
  - ✨ packed with powerful features under the hood
17
17
  - 🛠️ converts typescript aliases to relative paths
18
- - 🔌 16 built-in helper [dler commands](#-commands) included
18
+ - 🔌 18 built-in helper [dler commands](#-commands) included
19
19
  - 📝 highly configurable flow via a configuration file
20
20
  - 🔜 `libraries` plugin —> dler monorepo implementation
21
21
  - 🧼 cleans up your internal logs from the build dist
@@ -119,7 +119,7 @@ bun dev # bun src/cli.ts --dev
119
119
 
120
120
  ## 🔌 commands
121
121
 
122
- dler ships with a flexible command system (prev. plugins) and **16 built-in commands** (from [reliverse addons](https://reliverse.org/addons) collection).
122
+ dler ships with a flexible command system (prev. plugins) and **18 built-in commands** (from [reliverse addons](https://reliverse.org/addons) collection).
123
123
 
124
124
  feel free to create your own commands. commands can be implemented as built-in directly in `src/app/<command>/impl/*` and then imported from `src/app/<command>/cmd.ts`; or implemented in your own library and then imported from `src/app/<command>/cmd.ts`.
125
125
 
@@ -127,7 +127,7 @@ if you run just `dler` — it will display a list of commands which you can laun
127
127
 
128
128
  ## **available commands**
129
129
 
130
- [agg](#1-agg) [build](#2-build) [check](#3-check) [conv](#4-conv) [copy](#5-copy) [init](#6-init) [inject](#7-inject) [libs](#8-libs) [merge](#9-merge) [mock](#10-mock) [migrate](#11-migrate) [pub](#12-pub) [rempts](#13-rempts) [rename](#14-rename) [spell](#15-spell) [split](#16-split)
130
+ [agg](#1-agg) [build](#2-build) [check](#3-check) [conv](#4-conv) [copy](#6-copy) [init](#7-init) [inject](#8-inject) [libs](#9-libs) [merge](#10-merge) [migrate](#11-migrate) [pub](#12-pub) [rempts](#13-rempts) [rename](#14-rename) [spell](#15-spell) [split](#16-split) [pack](#17-pack) [unpack](#18-unpack)
131
131
 
132
132
  ### 1. `agg`
133
133
 
@@ -284,7 +284,7 @@ deep imports like `dep/some/file` or `@org/dep/some/thing` are always resolved t
284
284
  - **Dev-only Dependencies**: Packages that are only in `devDependencies` but imported in production code
285
285
  - **Duplicate Dependencies**: Packages listed in both `dependencies` and `devDependencies`
286
286
 
287
- ### 5. `copy`
287
+ ### 6. `copy`
288
288
 
289
289
  ```bash
290
290
  # simple example:
@@ -294,15 +294,15 @@ bun dler copy --s "src/**/*.ts" --d "dist"
294
294
  bun dler copy --s ".temp/packages/*/lib/**/*" --d "src/libs/sdk/sdk-impl/rules/external"
295
295
  ```
296
296
 
297
- ### 6. `init`
297
+ ### 7. `init`
298
298
 
299
299
  not yet documented.
300
300
 
301
- ### 7. `inject`
301
+ ### 8. `inject`
302
302
 
303
303
  not yet documented.
304
304
 
305
- ### 8. `libs`
305
+ ### 9. `libs`
306
306
 
307
307
  builds and publishes specific subdirectories of your main project as standalone packages.
308
308
 
@@ -338,7 +338,7 @@ libslist: {
338
338
 
339
339
  - more magic commands coming soon...
340
340
 
341
- ### 9. `merge`
341
+ ### 10. `merge`
342
342
 
343
343
  merges multiple files into a single file. The command is built for both CI and interactive use, with support for glob patterns and advanced options.
344
344
 
@@ -349,13 +349,15 @@ merges multiple files into a single file. The command is built for both CI and i
349
349
  - supports both glob patterns and simple paths
350
350
  - preserves directory structure when merging to a directory
351
351
  - generates source maps for merged output
352
- - creates and updates templates for mock project structures
353
352
  - handles file deduplication
354
353
  - supports custom separators and comment styles
355
354
  - provides interactive mode with prompts
356
355
  - includes backup functionality
357
356
  - validates file permissions and sizes
358
357
  - enforces output path conflict detection
358
+ - handles both single file and directory output modes
359
+ - implements interactive prompts via `@reliverse/rempts`
360
+ - provides reporting with logging via `@reliverse/relinka`
359
361
 
360
362
  **usage examples:**
361
363
 
@@ -365,13 +367,35 @@ bun dler merge --s "src/**/*.ts" --d "dist/merged.ts"
365
367
 
366
368
  # advanced example:
367
369
  bun dler merge --s ".temp1/packages/*/lib/**/*" --d ".temp2/merged.ts" --sort "mtime" --header "// Header" --footer "// Footer" --dedupe
370
+ ```
368
371
 
369
- # generate mock template:
370
- bun dler merge --s "src/templates" --d "templates/my-template.ts" --as-template
372
+ **arguments:**
371
373
 
372
- # update mock template:
373
- bun dler merge --s "src/templates" --d "templates/my-template.ts" --as-template --update-template REACT_DLER_TEMPLATE
374
- ```
374
+ - `--s`: Input glob patterns (array)
375
+ - `--d`: Output file path or directory
376
+ - `--ignore`: Extra ignore patterns (array)
377
+ - `--format`: Fallback extension when output path is omitted (default: "txt")
378
+ - `--stdout`: Print to stdout
379
+ - `--noPath`: Don't inject relative path below each file
380
+ - `--pathAbove`: Print file path above each file's content (default: true)
381
+ - `--separator`: Custom separator (default: "\n\n")
382
+ - `--comment`: Custom comment prefix (e.g. '# ')
383
+ - `--forceComment`: Force custom comment prefix for all file types
384
+ - `--batch`: Disable interactive prompts (CI/non-interactive mode)
385
+ - `--recursive`: Recursively process all files in subdirectories (default: true)
386
+ - `--preserveStructure`: Preserve source directory structure in output (default: true)
387
+ - `--increment`: Attach an incrementing index to each output filename
388
+ - `--concurrency`: Number of concurrent file operations (default: 8)
389
+ - `--sort`: Sort files by: name, path, mtime, none (default: path)
390
+ - `--dryRun`: Show what would be done, but don't write files
391
+ - `--backup`: Backup output files before overwriting
392
+ - `--dedupe`: Remove duplicate file contents in merge
393
+ - `--header`: Header text to add at the start of merged output
394
+ - `--footer`: Footer text to add at the end of merged output
395
+ - `--select-files`: Prompt for file selection before merging
396
+ - `--interactive`: Enable interactive mode with prompts
397
+ - `--depth`: Depth level to start processing from (default: 0)
398
+ - `--sourcemap`: Generate source map for the merged output
375
399
 
376
400
  **implementation details:**
377
401
 
@@ -380,182 +404,10 @@ bun dler merge --s "src/templates" --d "templates/my-template.ts" --as-template
380
404
  - implements concurrent file operations with `p-map`
381
405
  - provides file type detection and appropriate comment styles
382
406
  - includes safety checks for file sizes and permissions
383
- - supports template generation with TypeScript type definitions
384
407
  - handles both single file and directory output modes
385
408
  - implements interactive prompts via `@reliverse/rempts`
386
409
  - provides reporting with logging via `@reliverse/relinka`
387
410
 
388
- ### 10. `mock`
389
-
390
- bootstraps file structure based on the specified mock template. The command is designed to create project structures from predefined or custom templates, with built-in safety checks and cleanup capabilities.
391
-
392
- **key features:**
393
-
394
- - creates project structures from predefined templates (basic, api, react)
395
- - supports custom template files
396
- - handles path conflicts with force option
397
- - provides cleanup functionality
398
- - includes dry run mode for previewing changes
399
- - validates file types and content
400
- - enforces rate limiting for file operations
401
- - supports custom whitelabel prefixes
402
- - preserves directory structure
403
- - handles both text and binary files
404
-
405
- **usage examples:**
406
-
407
- ```bash
408
- # use default react template:
409
- bun dler mock --template react
410
-
411
- # use custom template file:
412
- bun dler mock --template-file templates/my-template.ts
413
-
414
- # preview changes without applying:
415
- bun dler mock --template react --dry-run
416
-
417
- # clean up existing mock structure:
418
- bun dler mock --template react --cleanup
419
- ```
420
-
421
- **integration with merge command:**
422
- The mock command works seamlessly with the merge command to create and update templates:
423
-
424
- 1. **create template from existing files:**
425
-
426
- ```bash
427
- # create a template from your project structure
428
- bun dler merge --s "src/templates" --d "templates/my-template.ts" --as-template
429
- ```
430
-
431
- 2. **use the template with mock:**
432
-
433
- ```bash
434
- # use the generated template
435
- bun dler mock --template-file templates/my-template.ts
436
- ```
437
-
438
- 3. **update existing template:**
439
-
440
- ```bash
441
- # update a specific template in the file
442
- bun dler merge --s "src/templates" --d "templates/my-template.ts" --update-template REACT_DLER_TEMPLATE
443
- ```
444
-
445
- **implementation details:**
446
-
447
- - uses `jiti` for dynamic template file loading
448
- - implements template validation and type checking
449
- - provides detailed error handling and reporting
450
- - supports multiple template constants in a single file
451
- - handles file system operations safely with permissions checks
452
- - includes cleanup of empty directories
453
- - provides verbose logging option
454
- - enforces output path conflict detection
455
-
456
- **programmatic usage:**
457
- Both merge and mock commands can be used programmatically through the `@reliverse/dler-sdk` package:
458
-
459
- ```typescript
460
- import { merge, mock } from "@reliverse/dler-sdk";
461
-
462
- // Merge files programmatically
463
- await merge({
464
- source: ["src/**/*.ts"],
465
- destination: "dist/merged.ts",
466
- options: {
467
- sort: "mtime",
468
- header: "// Header",
469
- footer: "// Footer",
470
- dedupe: true,
471
- sourcemap: true
472
- }
473
- });
474
-
475
- // Create mock structure programmatically
476
- await mock({
477
- template: "react",
478
- options: {
479
- templateFile: "templates/my-template.ts",
480
- cleanup: false,
481
- dryRun: false,
482
- verbose: true,
483
- whitelabel: "MYAPP",
484
- force: true
485
- }
486
- });
487
-
488
- // Create and use custom template
489
- const template = await merge({
490
- source: ["src/templates"],
491
- destination: "templates/my-template.ts",
492
- options: {
493
- asTemplate: true,
494
- whitelabel: "MYAPP"
495
- }
496
- });
497
-
498
- await mock({
499
- template: "custom",
500
- options: {
501
- templateFile: "templates/my-template.ts"
502
- }
503
- });
504
- ```
505
-
506
- **sdk types:**
507
-
508
- ```typescript
509
- // Merge command options
510
- interface MergeOptions {
511
- source: string[];
512
- destination?: string;
513
- options?: {
514
- ignore?: string[];
515
- format?: string;
516
- stdout?: boolean;
517
- noPath?: boolean;
518
- pathAbove?: boolean;
519
- separator?: string;
520
- comment?: string;
521
- forceComment?: boolean;
522
- batch?: boolean;
523
- recursive?: boolean;
524
- preserveStructure?: boolean;
525
- increment?: boolean;
526
- concurrency?: number;
527
- sort?: "name" | "path" | "mtime" | "none";
528
- dryRun?: boolean;
529
- backup?: boolean;
530
- dedupe?: boolean;
531
- header?: string;
532
- footer?: string;
533
- selectFiles?: boolean;
534
- interactive?: boolean;
535
- asTemplate?: boolean;
536
- ctn?: string;
537
- whitelabel?: string;
538
- sourcemap?: boolean;
539
- updateTemplate?: string;
540
- dev?: boolean;
541
- };
542
- }
543
-
544
- // Mock command options
545
- interface MockOptions {
546
- template: string;
547
- options?: {
548
- templateFile?: string;
549
- templateConsts?: string;
550
- cleanup?: boolean;
551
- dryRun?: boolean;
552
- verbose?: boolean;
553
- whitelabel?: string;
554
- force?: boolean;
555
- };
556
- }
557
- ```
558
-
559
411
  ### 11. `migrate`
560
412
 
561
413
  helps migrate between different libraries and module resolution strategies. currently supports:
@@ -655,7 +507,7 @@ dler migrate --lib nodenext-bundler --target nodenext --dryRun
655
507
  - handles both relative and alias imports
656
508
  - supports both .ts and .tsx files
657
509
 
658
- #### `console-relinka`
510
+ **`console-relinka`**:
659
511
 
660
512
  [@reliverse/relinka](https://github.com/reliverse/relinka)'s best friend. Converts between different logging formats (console, consola method/object, and relinka's function/method/object styles).
661
513
 
@@ -677,7 +529,7 @@ dler relinka --input src/app.ts --from relinkaMethod --to relinkaObject
677
529
  dler relinka --input src/app.ts --from relinkaFunction --to consolaObject
678
530
  ```
679
531
 
680
- **Supported formats:**
532
+ **Supported formats**:
681
533
 
682
534
  - `console`: Standard console logging (`console.log(message, ...args)`)
683
535
  - `consolaMethod`: Consola method style (`consola.log(message, ...args)`)
@@ -686,7 +538,7 @@ dler relinka --input src/app.ts --from relinkaFunction --to consolaObject
686
538
  - `relinkaMethod`: Relinka method style (`relinka.level(message, ...args)`)
687
539
  - `relinkaObject`: Relinka object style (`relinka({ level, message, title?, args? })`)
688
540
 
689
- **Special features:**
541
+ **Special features**:
690
542
 
691
543
  - Preserves additional arguments in all formats
692
544
  - Handles special box format with title and message
@@ -694,7 +546,7 @@ dler relinka --input src/app.ts --from relinkaFunction --to consolaObject
694
546
  - Supports conversion between any combination of formats
695
547
  - Supports both consola method and object styles
696
548
 
697
- #### next steps after migration
549
+ **next steps after migration**:
698
550
 
699
551
  - for path-pathkit:
700
552
  1. run 'bun install' to install @reliverse/pathkit
@@ -751,6 +603,8 @@ bun dler rename ...
751
603
 
752
604
  ### 15. `spell`
753
605
 
606
+ > Contributors: Please check the [docs/cmds/SPELLS.md](./docs/cmds/SPELLS.md) file for more technical details.
607
+
754
608
  **available spell types:**
755
609
 
756
610
  - `replace-line` — injects contents from one file into another
@@ -826,7 +680,118 @@ splits your code/text file into multiple files.
826
680
  bun dler split ...
827
681
  ```
828
682
 
829
- ## api (for advanced users)
683
+ ### 17. `pack`
684
+
685
+ packs a directory of templates into TypeScript modules. This command is useful for creating reusable template packages that can be distributed and used by other projects.
686
+
687
+ **key features:**
688
+
689
+ - Converts directory structure into TypeScript modules
690
+ - Handles binary files with automatic hashing and storage
691
+ - Preserves JSON comments and formatting
692
+ - Supports custom whitelabeling
693
+ - Generates type-safe template definitions
694
+ - Creates an aggregator module for easy imports
695
+ - Tracks file metadata (update time and content hash)
696
+ - Supports selective file updates
697
+ - Handles file conflicts gracefully
698
+ - Preserves JSON type information for package.json and tsconfig.json
699
+
700
+ **usage examples:**
701
+
702
+ ```bash
703
+ # Basic usage
704
+ dler pack --dir ./templates --output ./dist-templates
705
+
706
+ # With custom whitelabel
707
+ dler pack --dir ./templates --output ./dist-templates --whitelabel MYAPP
708
+
709
+ # Update specific files only
710
+ dler pack --dir ./templates --output ./dist-templates --files "src/index.ts,src/config.ts"
711
+
712
+ # Force overwrite existing files
713
+ dler pack --dir ./templates --output ./dist-templates --force
714
+
715
+ # Update mode (default: true)
716
+ dler pack --dir ./templates --output ./dist-templates --update
717
+ ```
718
+
719
+ **arguments:**
720
+
721
+ - `--dir`: Directory containing templates to process (required)
722
+ - `--output`: Output directory for generated modules (default: "my-templates")
723
+ - `--whitelabel`: Custom prefix to use instead of 'DLER' (default: "DLER")
724
+ - `--cdn`: Remote CDN for binary assets upload (not yet implemented)
725
+ - `--force`: Force overwrite existing files (default: false)
726
+ - `--update`: Update existing templates and add new ones (default: true)
727
+ - `--files`: Comma-separated list of specific files to update
728
+ - `--lastUpdate`: Override lastUpdate timestamp
729
+
730
+ **output structure:**
731
+
732
+ ```bash
733
+ output/
734
+ ├── impl/
735
+ │ ├── binaries/ # binary files stored with hash-based names (dler reads/writes this dir when --cdn is not used)
736
+ │ │ └── [hashed-files]
737
+ │ ├── template1.ts
738
+ │ └── template2.ts
739
+ ├── types.ts
740
+ └── mod.ts
741
+ ```
742
+
743
+ ### 18. `unpack`
744
+
745
+ creates file structure from packed templates. This command is the counterpart to `pack` and is used to extract and restore template files from a packed template package.
746
+
747
+ **key features:**
748
+
749
+ - Restores complete directory structure from packed templates
750
+ - Handles binary files with automatic lookup
751
+ - Preserves JSON comments and formatting
752
+ - Supports custom output locations
753
+ - Maintains file permissions and structure
754
+ - Validates template integrity
755
+ - Supports cleanup of existing template files
756
+ - Provides dry-run mode for previewing changes
757
+ - Handles empty directory cleanup
758
+
759
+ **usage examples:**
760
+
761
+ ```bash
762
+ # Basic usage
763
+ dler unpack ./dist-templates --output ./my-project
764
+
765
+ # With custom output directory
766
+ dler unpack ./dist-templates --output ./custom-location
767
+
768
+ # Preview changes without applying
769
+ dler unpack ./dist-templates --output ./my-project --dry-run
770
+
771
+ # Clean up existing template files before unpacking
772
+ dler unpack ./dist-templates --output ./my-project --cleanup
773
+ ```
774
+
775
+ **arguments:**
776
+
777
+ - `templatesDir`: Directory containing mod.ts (required)
778
+ - `--output`: Where to write files (default: "unpacked")
779
+ - `--cdn`: Remote CDN base for binary assets download (not yet implemented)
780
+ - `--cleanup`: Clean up template files before unpacking (default: false)
781
+ - `--dry-run`: Preview changes without applying them (default: false)
782
+
783
+ **implementation details:**
784
+
785
+ - Uses `jiti` for dynamic template file loading
786
+ - Implements template validation and type checking
787
+ - Provides detailed error handling and reporting
788
+ - Handles file system operations safely
789
+ - Preserves JSON comments and formatting
790
+ - Supports binary file restoration
791
+ - Cleans up empty directories after unpacking
792
+ - Validates template structure before unpacking
793
+
794
+ ## api (for advanced usage)
830
795
 
831
796
  the sdk lets you build custom dler cli plugins or even extend your own cli tools.
832
797
 
@@ -853,6 +818,14 @@ special thanks to the project that inspired `@reliverse/dler`:
853
818
 
854
819
  - [unjs/unbuild](https://github.com/unjs/unbuild#readme)
855
820
 
821
+ ## contributors
822
+
823
+ ### scripts
824
+
825
+ - `libs:pack`: Creates two templates, `cfg` and `sdk`, based on dist-libs directory structure (using **dler pack** command).
826
+ - `libs:unpack`: Creates a project structure using all templates from the `cfg` and `sdk` templates (using **dler unpack** command).
827
+ - `libs:example`: Since `libs:unpack`'s serves as a dist-libs mock, then `libs:example` helps easily test dler's features like `resolveAllCrossLibs()`.
828
+
856
829
  ## support
857
830
 
858
831
  - if dler saves you time and effort, please consider supporting its development: [github sponsors](https://github.com/sponsors/blefnk);
@@ -1,14 +1,8 @@
1
1
  import { selectPrompt, runCmd, confirmPrompt, inputPrompt } from "@reliverse/rempts";
2
- import { existsSync } from "node:fs";
3
- import { resolve } from "node:path";
4
2
  import { getAggCmd } from "../cmds.js";
5
- async function loadConfig() {
6
- const configPath = resolve(".config/dler.ts");
7
- if (!existsSync(configPath)) return null;
8
- return (await import(configPath)).default;
9
- }
3
+ import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
10
4
  export async function promptAggCommand() {
11
- const config = await loadConfig();
5
+ const config = await getConfigDler();
12
6
  let selectedLibName = null;
13
7
  if (config?.libsList && Object.keys(config.libsList).length > 0) {
14
8
  const libs = Object.entries(config.libsList).map(([name, lib]) => ({
@@ -1,7 +1,7 @@
1
1
  import { defineArgs, defineCommand } from "@reliverse/rempts";
2
- import { dlerPub } from "./impl.js";
3
- import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/cfg/init.js";
4
- import { loadConfig } from "../../libs/sdk/sdk-impl/cfg/load.js";
2
+ import { dlerPub } from "../pub/impl.js";
3
+ import { ensureDlerConfig } from "../../libs/sdk/sdk-impl/config/init.js";
4
+ import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
5
5
  import { removeDistFolders } from "../../libs/sdk/sdk-mod.js";
6
6
  export default defineCommand({
7
7
  meta: {
@@ -16,7 +16,7 @@ export default defineCommand({
16
16
  }),
17
17
  async run({ args }) {
18
18
  await ensureDlerConfig(args.dev);
19
- const config = await loadConfig();
19
+ const config = await getConfigDler();
20
20
  await removeDistFolders(
21
21
  config.distNpmDirName,
22
22
  config.distJsrDirName,
@@ -1,11 +1,7 @@
1
- import type { DlerConfig } from "../../libs/sdk/sdk-types.js";
1
+ import type { DlerConfig } from "../../libs/sdk/sdk-impl/config/types.js";
2
2
  /**
3
3
  * Main entry point for the dler build and publish process.
4
4
  * Handles building and publishing for both main project and libraries.
5
+ * @see `src/app/pub/impl.ts` for pub main function implementation.
5
6
  */
6
7
  export declare function dlerBuild(isDev: boolean, config?: DlerConfig): Promise<void>;
7
- /**
8
- * Main entry point for the dler build and publish process.
9
- * Handles building and publishing for both main project and libraries.
10
- */
11
- export declare function dlerPub(isDev: boolean, config?: DlerConfig): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import { bumpHandler, isBumpDisabled, setBumpDisabledValueTo } from "@reliverse/bleump";
2
2
  import path from "@reliverse/pathkit";
3
3
  import fs from "@reliverse/relifso";
4
- import { loadConfig } from "../../libs/sdk/sdk-impl/cfg/load.js";
4
+ import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
5
5
  import { processLibraryFlow } from "../../libs/sdk/sdk-impl/library-flow.js";
6
6
  import { processRegularFlow } from "../../libs/sdk/sdk-impl/regular-flow.js";
7
7
  import { finalizeBuildPub } from "../../libs/sdk/sdk-impl/utils/finalize.js";
@@ -14,7 +14,7 @@ export async function dlerBuild(isDev, config) {
14
14
  let effectiveConfig = config;
15
15
  try {
16
16
  if (!effectiveConfig) {
17
- effectiveConfig = await loadConfig();
17
+ effectiveConfig = await getConfigDler();
18
18
  }
19
19
  if (effectiveConfig.logsFreshFile) {
20
20
  await fs.remove(path.join(PROJECT_ROOT, effectiveConfig.logsFileName));
@@ -53,47 +53,3 @@ export async function dlerBuild(isDev, config) {
53
53
  handleDlerError(error);
54
54
  }
55
55
  }
56
- export async function dlerPub(isDev, config) {
57
- const timer = createPerfTimer();
58
- let effectiveConfig = config;
59
- try {
60
- if (!effectiveConfig) {
61
- effectiveConfig = await loadConfig();
62
- }
63
- if (effectiveConfig.logsFreshFile) {
64
- await fs.remove(path.join(PROJECT_ROOT, effectiveConfig.logsFileName));
65
- }
66
- await removeDistFolders(
67
- effectiveConfig.distNpmDirName,
68
- effectiveConfig.distJsrDirName,
69
- effectiveConfig.libsDirDist,
70
- effectiveConfig.libsList
71
- );
72
- const bumpIsDisabled = await isBumpDisabled();
73
- if (!bumpIsDisabled && !effectiveConfig.commonPubPause) {
74
- try {
75
- await bumpHandler(
76
- effectiveConfig.bumpMode,
77
- false,
78
- effectiveConfig.bumpFilter,
79
- effectiveConfig.bumpSet
80
- );
81
- await setBumpDisabledValueTo(true);
82
- } catch {
83
- throw new Error("[.config/dler.ts] Failed to set bumpDisable to true");
84
- }
85
- }
86
- await processRegularFlow(timer, isDev, effectiveConfig);
87
- await processLibraryFlow(timer, isDev, effectiveConfig);
88
- await finalizeBuildPub(
89
- timer,
90
- effectiveConfig.commonPubPause,
91
- effectiveConfig.libsList,
92
- effectiveConfig.distNpmDirName,
93
- effectiveConfig.distJsrDirName,
94
- effectiveConfig.libsDirDist
95
- );
96
- } catch (error) {
97
- handleDlerError(error);
98
- }
99
- }
@@ -1,33 +1,8 @@
1
- declare const _default: import("@reliverse/rempts").Command<{
2
- type: {
3
- type: "string";
4
- required: true;
5
- description: string;
6
- };
7
- input: {
8
- type: "string";
9
- required: true;
10
- description: string;
11
- };
12
- output: {
13
- type: "string";
14
- description: string;
15
- };
16
- pattern: {
17
- type: "string";
18
- description: string;
19
- };
20
- replacement: {
21
- type: "string";
22
- description: string;
23
- };
24
- line: {
25
- type: "number";
26
- description: string;
27
- };
28
- transform: {
29
- type: "string";
30
- description: string;
31
- };
32
- }>;
33
- export default _default;
1
+ /**
2
+ * Recursively inlines (or rewrites) aliased import / re-export statements for all libraries.
3
+ *
4
+ * @param alias Prefix used in module specifiers (default: "~")
5
+ * @param subFolders Ordered sub-folder candidates to look for when chasing other libs
6
+ * @returns Absolute paths of files that were modified
7
+ */
8
+ export declare function resolveCrossLibs(alias?: string, subFolders?: ("npm" | "jsr")[]): Promise<string[]>;