@reliverse/dler 1.2.6 → 1.3.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 (148) hide show
  1. package/README.md +43 -36
  2. package/bin/addons.d.ts +1 -0
  3. package/bin/addons.js +83 -0
  4. package/bin/app/agg/cmd.d.ts +35 -0
  5. package/bin/app/agg/cmd.js +49 -0
  6. package/bin/app/agg/impl.d.ts +36 -0
  7. package/bin/app/{tools → agg}/impl.js +1 -2
  8. package/bin/app/build/cmd.d.ts +7 -0
  9. package/bin/app/build/cmd.js +3 -1
  10. package/bin/app/cmds.d.ts +100 -0
  11. package/bin/app/cmds.js +11 -2
  12. package/bin/app/conv/cmd.d.ts +0 -0
  13. package/bin/app/deps/cmd.d.ts +28 -0
  14. package/bin/app/deps/cmd.js +62 -0
  15. package/bin/app/deps/impl/analyzer.d.ts +2 -0
  16. package/bin/app/deps/impl/analyzer.js +1 -1
  17. package/bin/app/deps/impl/filesystem.d.ts +4 -0
  18. package/bin/app/deps/impl/filesystem.js +2 -4
  19. package/bin/app/deps/impl/formatter.d.ts +2 -0
  20. package/bin/app/deps/impl/formatter.js +2 -2
  21. package/bin/app/deps/impl/parser.d.ts +5 -0
  22. package/bin/app/deps/impl/types.d.ts +21 -0
  23. package/bin/app/inject/README.md +3 -12
  24. package/bin/app/inject/cmd.d.ts +12 -0
  25. package/bin/app/inject/cmd.js +2 -2
  26. package/bin/app/inject/expect/cmd.d.ts +20 -0
  27. package/bin/app/inject/expect/impl.d.ts +5 -0
  28. package/bin/app/libs/cmd.d.ts +0 -0
  29. package/bin/app/merge/cmd.txt +1 -1
  30. package/bin/app/mono/cmd.d.ts +0 -0
  31. package/bin/app/pub/cmd.d.ts +7 -0
  32. package/bin/app/pub/cmd.js +3 -1
  33. package/bin/app/relifso/cmd.d.ts +12 -0
  34. package/bin/app/relifso/cmd.js +2 -2
  35. package/bin/app/relifso/init/cmd.d.ts +36 -0
  36. package/bin/app/relifso/init/impl/const.d.ts +34 -0
  37. package/bin/app/relifso/init/impl/const.js +1 -1
  38. package/bin/app/relifso/init/impl/mod.d.ts +17 -0
  39. package/bin/app/relifso/init/impl/templates/t-gitignore.d.ts +1 -0
  40. package/bin/app/relifso/init/impl/templates/t-license.d.ts +1 -0
  41. package/bin/app/relifso/init/impl/templates/t-readme.d.ts +1 -0
  42. package/bin/app/relifso/init/impl/types.d.ts +41 -0
  43. package/bin/app/relifso/init/impl/utils.d.ts +5 -0
  44. package/bin/app/relinka/cmd.d.ts +0 -0
  45. package/bin/app/rempts/init/cmd/cmd.d.ts +14 -0
  46. package/bin/app/rempts/init/cmd/cmd.js +3 -1
  47. package/bin/app/rempts/init/cmds/cmd.d.ts +19 -0
  48. package/bin/app/rempts/migrate/cmd.d.ts +14 -0
  49. package/bin/app/rempts/migrate/impl/commander.d.ts +4 -0
  50. package/bin/app/spell/cmd.d.ts +18 -0
  51. package/bin/app/spell/cmd.js +51 -0
  52. package/bin/app/split/cmd.d.ts +11 -0
  53. package/bin/app/split/impl.d.ts +25 -0
  54. package/bin/default.d.ts +5 -0
  55. package/bin/{libs/cfg/cfg-default.js → default.js} +6 -4
  56. package/bin/dler.d.ts +1 -0
  57. package/bin/dler.js +60 -0
  58. package/bin/impl.d.ts +10 -0
  59. package/bin/{cli.js → impl.js} +15 -27
  60. package/bin/info.d.ts +2 -0
  61. package/bin/info.js +21 -0
  62. package/bin/init.d.ts +1 -0
  63. package/bin/init.js +20 -27
  64. package/bin/libs/sdk/sdk-impl/build/build-library.d.ts +51 -0
  65. package/bin/libs/sdk/sdk-impl/build/build-library.js +45 -66
  66. package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +26 -0
  67. package/bin/libs/sdk/sdk-impl/build/build-regular.js +28 -18
  68. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.d.ts +2 -0
  69. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.js +8 -3
  70. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.d.ts +5 -0
  71. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +12 -7
  72. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/copy.d.ts +2 -0
  73. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/copy.js +2 -1
  74. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/types.d.ts +9 -0
  75. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.d.ts +2 -0
  76. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.js +22 -6
  77. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/types.d.ts +15 -0
  78. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.d.ts +2 -0
  79. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.js +2 -1
  80. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/config.d.ts +2 -0
  81. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/cjs.d.ts +4 -0
  82. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/esbuild.d.ts +13 -0
  83. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/json.d.ts +3 -0
  84. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/raw.d.ts +8 -0
  85. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/shebang.d.ts +5 -0
  86. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/stub.d.ts +2 -0
  87. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/types.d.ts +95 -0
  88. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/utils.d.ts +5 -0
  89. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.d.ts +2 -0
  90. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/types.d.ts +176 -0
  91. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/index.d.ts +2 -0
  92. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/index.js +2 -2
  93. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/types.d.ts +23 -0
  94. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.d.ts +20 -0
  95. package/bin/libs/sdk/sdk-impl/build/bundlers/unified/validate.d.ts +4 -0
  96. package/bin/libs/sdk/sdk-impl/library-flow.d.ts +11 -0
  97. package/bin/libs/sdk/sdk-impl/library-flow.js +6 -1
  98. package/bin/libs/sdk/sdk-impl/pub/pub-library.d.ts +5 -0
  99. package/bin/libs/sdk/sdk-impl/pub/pub-library.js +6 -16
  100. package/bin/libs/sdk/sdk-impl/pub/pub-regular.d.ts +9 -0
  101. package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +12 -10
  102. package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +12 -0
  103. package/bin/libs/sdk/sdk-impl/regular-flow.js +45 -51
  104. package/bin/libs/sdk/sdk-impl/spell/spell-executors.d.ts +10 -0
  105. package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.d.ts +7 -0
  106. package/bin/libs/sdk/sdk-impl/spell/spell-mod.d.ts +4 -0
  107. package/bin/libs/sdk/sdk-impl/spell/spell-parser.d.ts +4 -0
  108. package/bin/libs/sdk/sdk-impl/spell/spell-types.d.ts +34 -0
  109. package/bin/libs/sdk/sdk-impl/utils/tools/tools-agg.d.ts +14 -0
  110. package/bin/libs/sdk/sdk-impl/utils/tools/tools-agg.js +8 -6
  111. package/bin/libs/sdk/sdk-impl/utils/tools/tools-impl.d.ts +4 -0
  112. package/bin/libs/sdk/sdk-impl/utils/utils-build.d.ts +28 -0
  113. package/bin/libs/sdk/sdk-impl/utils/utils-build.js +3 -3
  114. package/bin/libs/sdk/sdk-impl/utils/utils-bump.d.ts +9 -0
  115. package/bin/libs/sdk/sdk-impl/utils/utils-bump.js +5 -7
  116. package/bin/libs/sdk/sdk-impl/utils/utils-clean.d.ts +5 -0
  117. package/bin/libs/sdk/sdk-impl/utils/utils-consts.d.ts +9 -0
  118. package/bin/libs/sdk/sdk-impl/utils/utils-cwd.d.ts +10 -0
  119. package/bin/libs/sdk/sdk-impl/utils/utils-deps.d.ts +5 -0
  120. package/bin/libs/sdk/sdk-impl/utils/utils-determine.d.ts +12 -0
  121. package/bin/libs/sdk/sdk-impl/utils/utils-error.d.ts +5 -0
  122. package/bin/libs/sdk/sdk-impl/utils/utils-fs.d.ts +24 -0
  123. package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +4 -1
  124. package/bin/libs/sdk/sdk-impl/utils/utils-info.d.ts +6 -0
  125. package/bin/libs/sdk/sdk-impl/utils/utils-info.js +7 -14
  126. package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.d.ts +8 -0
  127. package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.js +2 -4
  128. package/bin/libs/sdk/sdk-impl/utils/utils-paths.d.ts +55 -0
  129. package/bin/libs/sdk/sdk-impl/utils/utils-paths.js +33 -24
  130. package/bin/libs/sdk/sdk-impl/utils/utils-perf.d.ts +9 -0
  131. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.d.ts +5 -0
  132. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.d.ts +8 -0
  133. package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +36 -27
  134. package/bin/libs/sdk/sdk-impl/utils/utils-tsconfig.d.ts +4 -0
  135. package/bin/libs/sdk/sdk-mod.d.ts +56 -0
  136. package/bin/libs/sdk/sdk-mod.js +42 -9
  137. package/bin/libs/sdk/sdk-types.d.ts +469 -0
  138. package/bin/libs/sdk/sdk-types.js +0 -1
  139. package/bin/load.d.ts +6 -0
  140. package/bin/load.js +1 -1
  141. package/bin/mod.d.ts +48 -0
  142. package/bin/mod.js +4 -14
  143. package/bin/types.d.ts +469 -0
  144. package/package.json +5 -4
  145. package/bin/app/tools/cmd.js +0 -81
  146. package/bin/app/tools/tools.txt +0 -92
  147. package/bin/libs/cfg/cfg-mod.js +0 -4
  148. package/bin/libs/cfg/cfg-types.js +0 -1
package/README.md CHANGED
@@ -51,7 +51,7 @@ ensure git, node.js, and bun/pnpm/yarn/npm are installed. then:
51
51
  git clone https://github.com/reliverse/dler.git
52
52
  cd dler
53
53
  bun i
54
- bun dev # bun src/mod.ts --dev
54
+ bun dev # bun src/dler.ts --dev
55
55
  ```
56
56
 
57
57
  ### installation
@@ -66,6 +66,14 @@ bun dev # bun src/mod.ts --dev
66
66
  bun update --latest
67
67
  ```
68
68
 
69
+ **and/or install globally**:
70
+
71
+ ```sh
72
+ bun add -g @reliverse/dler
73
+ # or update as needed:
74
+ bun i -g update --latest
75
+ ```
76
+
69
77
  2. **prepare your project**:
70
78
 
71
79
  a. **configure `.gitignore`**:
@@ -75,19 +83,13 @@ bun dev # bun src/mod.ts --dev
75
83
  echo "logs" >> .gitignore
76
84
  ```
77
85
 
78
- b. **install config intellisense**:
79
-
80
- ```sh
81
- bun add -d @reliverse/dler-cfg
82
- ```
83
-
84
- c. **add `".config/**/*.ts"` to `include` in `tsconfig.json`**:
86
+ b. **add `".config/**/*.ts"` to `include` in `tsconfig.json`**:
85
87
 
86
88
  ```json
87
89
  "include": [".config/**/*.ts", ...]
88
90
  ```
89
91
 
90
- d. **package.json**:
92
+ c. **package.json**:
91
93
 
92
94
  ```json
93
95
  "scripts": {
@@ -96,7 +98,7 @@ bun dev # bun src/mod.ts --dev
96
98
  }
97
99
  ```
98
100
 
99
- e. **initialize config**:
101
+ d. **initialize config**:
100
102
 
101
103
  ```sh
102
104
  bun [build|pub] # if installed as dev dep
@@ -114,18 +116,37 @@ bun dev # bun src/mod.ts --dev
114
116
  dler [build|pub] # if installed globally
115
117
  ```
116
118
 
117
- ## 🔌 plugins
119
+ ## 🔌 addons
120
+
121
+ dler ships with a flexible addon system (aka plugins) and **14 built-in addons** (from [@reliverse/addons](https://reliverse.org/addons)).
122
+
123
+ feel free to create your own addons. addons can be implemented as built-in directly in `src/app/<addon>/impl/*` and then imported from `src/app/<addon>/cmd.ts`; or implemented in your own library and then imported from `src/app/<addon>/cmd.ts`.
124
+
125
+ if you run just `dler` — it will display a list of addons which you can launch interactively.
118
126
 
119
- dler ships with a flexible plugin system and **14 built-in plugins** (from [@reliverse/addons](https://reliverse.org/addons)).
127
+ ## **available addons**
120
128
 
121
- feel free to create your own plugins. plugins can be implemented as built-in directly in `src/app/plugin-name/impl/*` and then imported from `src/app/plugin-name/cmd.ts`; or implemented in your own library and then imported from `src/app/plugin-name/cmd.ts`.
129
+ [agg](#1-agg), [build](#2-build), [conv](#3-conv), [deps](#4-deps), [inject](#5-inject), [libs](#6-libs), [merge](#7-merge), [mono](#8-mono), [pub](#9-pub), [relifso](#10-relifso), [relinka](#11-relinka), [rempts](#12-rempts), [spell](#13-spell), [split](#14-split).
122
130
 
123
131
  ### 1. `agg`
124
132
 
125
133
  generates aggregator file with content like `import { getsomething } from "./utils.js"`.
126
134
 
127
135
  ```bash
128
- dler agg ...
136
+ # interactively:
137
+ dler > "agg"
138
+ # non-interactively:
139
+ dler agg --input <dir> --out <file> [options]
140
+ ```
141
+
142
+ **usage example**: if you're exploring the example [playground](#playground), you can try the following:
143
+
144
+ 1. open [src/libs/sdk/sdk-mod.ts](https://github.com/reliverse/dler/blob/main/src/libs/sdk/sdk-mod.ts) in your ide.
145
+ 2. press `ctrl+a`, then `backspace`. run the command below and watch the magic happen:
146
+
147
+ ```bash
148
+ bun tools:agg # shortcut for:
149
+ bun src/dler.ts tools --dev --tool agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-mod.ts --recursive --named --strip src/libs/sdk
129
150
  ```
130
151
 
131
152
  ### 2. `build`
@@ -196,7 +217,7 @@ not yet documented.
196
217
  builds and publishes specific subdirectories of your main project as standalone packages.
197
218
 
198
219
  **usage example**:
199
- using `@reliverse/dler-cfg` to package [src/libs/cfg](https://github.com/reliverse/dler/tree/main/src/libs/cfg):
220
+ using `dler` to package [src/libs/sdk](https://github.com/reliverse/dler/tree/main/src/libs/sdk):
200
221
 
201
222
  ```ts
202
223
  // .config/dler.ts
@@ -204,11 +225,11 @@ libsactmode: "main-and-libs",
204
225
  libsdirdist: "dist-libs",
205
226
  libsdirsrc: "src/libs",
206
227
  libslist: {
207
- "@reliverse/dler-cfg": {
228
+ "@reliverse/dler-sdk": {
208
229
  libdeclarations: true,
209
- libdescription: "@reliverse/dler defineconfig",
210
- libdirname: "cfg",
211
- libmainfile: "cfg/cfg-mod.ts",
230
+ libdescription: "@reliverse/dler without cli",
231
+ libdirname: "sdk",
232
+ libmainfile: "sdk/sdk-mod.ts",
212
233
  libpkgkeepdeps: false,
213
234
  libtranspileminify: true,
214
235
  },
@@ -326,26 +347,12 @@ await dler.spell({ spells: ["rename-file"], files: [] });
326
347
 
327
348
  p.s. [see how rse cli uses hooked=true](https://github.com/reliverse/rse/blob/main/src/postbuild.ts)
328
349
 
329
- ### 14. `tools`
330
-
331
- lets you run standalone dler features directly from the cli:
332
-
333
- ```bash
334
- dler tools --tool <tool> --input <dir> --out <file> [options]
335
- ```
336
-
337
- **available tools**:
338
-
339
- - `agg`: generates aggregator file with content like `export { getsomething } from "./utils.js"`. **note**: currently it replaces the file content, not appends.
340
-
341
- **usage example**: if you're exploring the example [playground](#playground), you can try the following:
350
+ ### 14. `split`
342
351
 
343
- 1. open [src/libs/sdk/sdk-mod.ts](https://github.com/reliverse/dler/blob/main/src/libs/sdk/sdk-mod.ts) in your ide.
344
- 2. press `ctrl+a`, then `backspace`. run the command below and watch the magic happen:
352
+ splits your code/text file into multiple files.
345
353
 
346
354
  ```bash
347
- bun tools:agg # shortcut for:
348
- bun src/mod.ts tools --dev --tool agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-mod.ts --recursive --named --strip src/libs/sdk
355
+ dler split ...
349
356
  ```
350
357
 
351
358
  ## api (for advanced users)
@@ -0,0 +1 @@
1
+ export declare function promptAggCommand(): Promise<void>;
package/bin/addons.js ADDED
@@ -0,0 +1,83 @@
1
+ import {
2
+ selectPrompt,
3
+ runCmd,
4
+ confirmPrompt,
5
+ inputPrompt
6
+ } from "@reliverse/rempts";
7
+ import { existsSync } from "node:fs";
8
+ import { resolve } from "node:path";
9
+ import { cmdAgg } from "./app/cmds.js";
10
+ async function loadConfig() {
11
+ const configPath = resolve(".config/dler.ts");
12
+ if (!existsSync(configPath)) return null;
13
+ return (await import(configPath)).default;
14
+ }
15
+ export async function promptAggCommand() {
16
+ const config = await loadConfig();
17
+ let selectedLibName = null;
18
+ if (config?.libsList && Object.keys(config.libsList).length > 0) {
19
+ const libs = Object.entries(config.libsList).map(([name, lib]) => ({
20
+ value: name,
21
+ label: name,
22
+ hint: `${config.libsDirSrc}/${lib.libDirName}/${lib.libDirName}-impl`
23
+ }));
24
+ libs.push({ value: "", label: "Skip library selection", hint: "" });
25
+ selectedLibName = await selectPrompt({
26
+ title: "Select a library to aggregate or skip",
27
+ options: libs
28
+ });
29
+ }
30
+ let imports = false;
31
+ let input = "";
32
+ let named = true;
33
+ let out = "";
34
+ let recursive = true;
35
+ let strip = "";
36
+ if (selectedLibName && selectedLibName !== "") {
37
+ const libConfig = config?.libsList?.[selectedLibName];
38
+ if (config && libConfig) {
39
+ input = `${config.libsDirSrc}/${libConfig.libDirName}/${libConfig.libDirName}-impl`;
40
+ out = `${config.libsDirSrc}/${libConfig.libMainFile}`;
41
+ strip = `${config.libsDirSrc}/${libConfig.libDirName}`;
42
+ }
43
+ }
44
+ if (!selectedLibName || !input) {
45
+ input = await inputPrompt({
46
+ title: "Enter the input directory",
47
+ defaultValue: input
48
+ });
49
+ }
50
+ imports = await confirmPrompt({
51
+ title: "Do you want to generate imports instead of exports?",
52
+ content: "(N generates exports)",
53
+ defaultValue: imports
54
+ });
55
+ named = await confirmPrompt({
56
+ title: imports ? "Do you want to generate named imports?" : "Do you want to generate named exports?",
57
+ defaultValue: named
58
+ });
59
+ if (!selectedLibName || !out) {
60
+ out = await inputPrompt({
61
+ title: "Enter the output file",
62
+ defaultValue: out
63
+ });
64
+ }
65
+ recursive = await confirmPrompt({
66
+ title: "Do you want to recursively scan subdirectories?",
67
+ defaultValue: recursive
68
+ });
69
+ if (!selectedLibName || !strip) {
70
+ strip = await inputPrompt({
71
+ title: "Enter the path to strip from the final imports/exports",
72
+ defaultValue: strip
73
+ });
74
+ }
75
+ await runCmd(await cmdAgg(), [
76
+ `--imports=${imports}`,
77
+ `--input=${input}`,
78
+ `--named=${named}`,
79
+ `--out=${out}`,
80
+ `--recursive=${recursive}`,
81
+ `--strip=${strip}`
82
+ ]);
83
+ }
@@ -0,0 +1,35 @@
1
+ declare const _default: import("@reliverse/rempts").Command<{
2
+ dev: {
3
+ description: string;
4
+ type: "boolean";
5
+ };
6
+ imports: {
7
+ description: string;
8
+ type: "boolean";
9
+ };
10
+ input: {
11
+ description: string;
12
+ type: "string";
13
+ required: true;
14
+ };
15
+ named: {
16
+ description: string;
17
+ type: "boolean";
18
+ default: true;
19
+ };
20
+ out: {
21
+ description: string;
22
+ type: "string";
23
+ required: true;
24
+ };
25
+ recursive: {
26
+ description: string;
27
+ type: "boolean";
28
+ default: true;
29
+ };
30
+ strip: {
31
+ description: string;
32
+ type: "string";
33
+ };
34
+ }>;
35
+ export default _default;
@@ -0,0 +1,49 @@
1
+ import { defineArgs, defineCommand } from "@reliverse/rempts";
2
+ import path from "pathe";
3
+ import { useAggregator } from "./impl.js";
4
+ export default defineCommand({
5
+ args: defineArgs({
6
+ dev: {
7
+ description: "Run in development mode",
8
+ type: "boolean"
9
+ },
10
+ imports: {
11
+ description: "If true, produce import lines instead of export lines",
12
+ type: "boolean"
13
+ },
14
+ input: {
15
+ description: "Directory containing .ts/.js files (--input <directory>)",
16
+ type: "string",
17
+ required: true
18
+ },
19
+ named: {
20
+ description: "Parse each file for named exports (function/class/const/let)",
21
+ type: "boolean",
22
+ default: true
23
+ },
24
+ out: {
25
+ description: "Output aggregator file path (--out <fileName>)",
26
+ type: "string",
27
+ required: true
28
+ },
29
+ recursive: {
30
+ description: "Recursively scan subdirectories (default false)",
31
+ type: "boolean",
32
+ default: true
33
+ },
34
+ strip: {
35
+ description: "Remove specified path prefix from final imports/exports",
36
+ type: "string"
37
+ }
38
+ }),
39
+ async run({ args }) {
40
+ await useAggregator({
41
+ inputDir: path.resolve(args.input),
42
+ isRecursive: !!args.recursive,
43
+ outFile: path.resolve(args.out),
44
+ stripPrefix: args.strip ? path.resolve(args.strip) : "",
45
+ useImport: !!args.imports,
46
+ useNamed: !!args.named
47
+ });
48
+ }
49
+ });
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Aggregator supporting:
3
+ * - --import or default export,
4
+ * - star or named exports,
5
+ * - separate "type" vs "value" for both import and export.
6
+ *
7
+ * Options:
8
+ * - Option to ignore specific directories (default: node_modules, .git)
9
+ * - Option to sort aggregated lines alphabetically.
10
+ * - Option to add a header comment in the aggregator output.
11
+ * - Option to enable verbose logging.
12
+ * - Deduplicates overloaded export names.
13
+ * - Skips files whose basenames start with an internal marker (default: "#")
14
+ * unless includeInternal is true or an alternative marker is provided.
15
+ * - By default, updates only the auto-generated block in the aggregator file,
16
+ * leaving any other content intact. Pass `overrideFile: true` to rewrite the entire file.
17
+ */
18
+ export declare function useAggregator({ inputDir, isRecursive, outFile, stripPrefix, useImport, useNamed, ignoreDirs, sortLines, headerComment, verbose, includeInternal, internalMarker, overrideFile, }: {
19
+ inputDir: string;
20
+ isRecursive: boolean;
21
+ outFile: string;
22
+ stripPrefix: string;
23
+ useImport: boolean;
24
+ useNamed: boolean;
25
+ ignoreDirs?: string[];
26
+ sortLines?: boolean;
27
+ headerComment?: string;
28
+ verbose?: boolean;
29
+ includeInternal?: boolean;
30
+ internalMarker?: string;
31
+ overrideFile?: boolean;
32
+ }): Promise<void>;
33
+ /**
34
+ * Prints usage examples based on whether dev mode or not.
35
+ */
36
+ export declare function printUsage(isDev?: boolean): void;
@@ -124,8 +124,7 @@ ${aggregatorBlock}`;
124
124
  await fs.writeFile(outFile, finalText, "utf8");
125
125
  relinka(
126
126
  "success",
127
- `Aggregator done: processed ${allLines.length} lines in:
128
- ${outFile}`
127
+ `Aggregator done: processed ${allLines.length} lines in: ${outFile}`
129
128
  );
130
129
  } catch (error) {
131
130
  relinka("error", `Aggregator failed: ${error}`);
@@ -0,0 +1,7 @@
1
+ declare const _default: import("@reliverse/rempts").Command<{
2
+ dev: {
3
+ type: "boolean";
4
+ description: string;
5
+ };
6
+ }>;
7
+ export default _default;
@@ -1,5 +1,6 @@
1
1
  import { defineArgs, defineCommand } from "@reliverse/rempts";
2
- import { dlerBuild } from "../../cli.js";
2
+ import { dlerBuild } from "../../impl.js";
3
+ import { ensureDlerConfig } from "../../init.js";
3
4
  export default defineCommand({
4
5
  meta: {
5
6
  name: "build",
@@ -12,6 +13,7 @@ export default defineCommand({
12
13
  }
13
14
  }),
14
15
  async run({ args }) {
16
+ await ensureDlerConfig(args.dev);
15
17
  await dlerBuild(args.dev);
16
18
  }
17
19
  });
@@ -0,0 +1,100 @@
1
+ export declare function cmdRelifsoInit(): Promise<import("@reliverse/rempts").Command<{
2
+ dev: {
3
+ type: "boolean";
4
+ description: string;
5
+ };
6
+ fileType: {
7
+ type: "string";
8
+ description: string;
9
+ required: false;
10
+ };
11
+ destDir: {
12
+ type: "string";
13
+ description: string;
14
+ default: string;
15
+ required: false;
16
+ };
17
+ multiple: {
18
+ type: "boolean";
19
+ description: string;
20
+ required: false;
21
+ default: false;
22
+ };
23
+ parallel: {
24
+ type: "boolean";
25
+ description: string;
26
+ required: false;
27
+ default: false;
28
+ };
29
+ concurrency: {
30
+ type: "string";
31
+ description: string;
32
+ required: false;
33
+ default: string;
34
+ };
35
+ }>>;
36
+ export declare function cmdInjectExpect(): Promise<import("@reliverse/rempts").Command<{
37
+ dev: {
38
+ type: "boolean";
39
+ description: string;
40
+ };
41
+ files: {
42
+ type: "positional";
43
+ description: string;
44
+ default: string;
45
+ };
46
+ comment: {
47
+ type: "string";
48
+ description: string;
49
+ };
50
+ tscPaths: {
51
+ type: "string";
52
+ description: string;
53
+ };
54
+ }>>;
55
+ export declare function cmdAgg(): Promise<import("@reliverse/rempts").Command<{
56
+ dev: {
57
+ description: string;
58
+ type: "boolean";
59
+ };
60
+ imports: {
61
+ description: string;
62
+ type: "boolean";
63
+ };
64
+ input: {
65
+ description: string;
66
+ type: "string";
67
+ required: true;
68
+ };
69
+ named: {
70
+ description: string;
71
+ type: "boolean";
72
+ default: true;
73
+ };
74
+ out: {
75
+ description: string;
76
+ type: "string";
77
+ required: true;
78
+ };
79
+ recursive: {
80
+ description: string;
81
+ type: "boolean";
82
+ default: true;
83
+ };
84
+ strip: {
85
+ description: string;
86
+ type: "string";
87
+ };
88
+ }>>;
89
+ export declare function cmdBuild(): Promise<import("@reliverse/rempts").Command<{
90
+ dev: {
91
+ type: "boolean";
92
+ description: string;
93
+ };
94
+ }>>;
95
+ export declare function cmdPub(): Promise<import("@reliverse/rempts").Command<{
96
+ dev: {
97
+ type: "boolean";
98
+ description: string;
99
+ };
100
+ }>>;
package/bin/app/cmds.js CHANGED
@@ -1,6 +1,15 @@
1
- export async function getCmdRelifsoInit() {
1
+ export async function cmdRelifsoInit() {
2
2
  return (await import("./relifso/init/cmd.js")).default;
3
3
  }
4
- export async function getCmdInjectTsExpectError() {
4
+ export async function cmdInjectExpect() {
5
5
  return (await import("./inject/expect/cmd.js")).default;
6
6
  }
7
+ export async function cmdAgg() {
8
+ return (await import("./agg/cmd.js")).default;
9
+ }
10
+ export async function cmdBuild() {
11
+ return (await import("./build/cmd.js")).default;
12
+ }
13
+ export async function cmdPub() {
14
+ return (await import("./pub/cmd.js")).default;
15
+ }
File without changes
@@ -0,0 +1,28 @@
1
+ declare const _default: import("@reliverse/rempts").Command<{
2
+ directory: {
3
+ type: "string";
4
+ description: string;
5
+ default: string;
6
+ };
7
+ all: {
8
+ type: "boolean";
9
+ description: string;
10
+ default: false;
11
+ };
12
+ ignore: {
13
+ type: "string";
14
+ description: string;
15
+ default: string;
16
+ };
17
+ json: {
18
+ type: "boolean";
19
+ description: string;
20
+ default: false;
21
+ };
22
+ builtins: {
23
+ type: "boolean";
24
+ description: string;
25
+ default: false;
26
+ };
27
+ }>;
28
+ export default _default;
@@ -0,0 +1,62 @@
1
+ import { re } from "@reliverse/relico";
2
+ import { defineArgs, defineCommand } from "@reliverse/rempts";
3
+ import path from "pathe";
4
+ import { analyzeDependencies } from "./impl/analyzer.js";
5
+ import { formatOutput } from "./impl/formatter.js";
6
+ export default defineCommand({
7
+ meta: {
8
+ name: "deps",
9
+ version: "1.0.0",
10
+ description: "Find dependencies used but not listed in package.json"
11
+ },
12
+ args: defineArgs({
13
+ directory: {
14
+ type: "string",
15
+ description: "directory to scan (defaults to current directory)",
16
+ default: "."
17
+ },
18
+ all: {
19
+ type: "boolean",
20
+ description: "show all dependencies (both listed and not listed)",
21
+ default: false
22
+ },
23
+ ignore: {
24
+ type: "string",
25
+ description: "comma-separated patterns to ignore",
26
+ default: ""
27
+ },
28
+ json: {
29
+ type: "boolean",
30
+ description: "output in JSON format",
31
+ default: false
32
+ },
33
+ builtins: {
34
+ type: "boolean",
35
+ description: "include Node.js built-in modules in the output",
36
+ default: false
37
+ }
38
+ }),
39
+ async run({ args }) {
40
+ try {
41
+ const directory = path.resolve(args.directory);
42
+ const ignorePatterns = args.ignore ? args.ignore.split(",") : [];
43
+ const options = {
44
+ directory,
45
+ showAll: args.all,
46
+ ignorePatterns,
47
+ json: args.json,
48
+ builtins: args.builtins
49
+ };
50
+ console.log(re.gray(`Scanning directory: ${directory}`));
51
+ const result = await analyzeDependencies(options);
52
+ const output = formatOutput(result, options);
53
+ console.log(output);
54
+ if (result.missingDependencies.length > 0) {
55
+ process.exit(1);
56
+ }
57
+ } catch (error) {
58
+ console.error("Error:", error);
59
+ process.exit(1);
60
+ }
61
+ }
62
+ });
@@ -0,0 +1,2 @@
1
+ import type { DependencyResult, FinderOptions } from "./types.js";
2
+ export declare const analyzeDependencies: (options: FinderOptions) => Promise<DependencyResult>;
@@ -25,7 +25,7 @@ export const analyzeDependencies = async (options) => {
25
25
  for (const dependency of allDependencies) {
26
26
  if (!listedDependencies.has(dependency)) {
27
27
  if (builtinModules.has(dependency)) {
28
- if (options.includeBuiltins) {
28
+ if (options.builtins) {
29
29
  builtinModulesList.push(dependency);
30
30
  }
31
31
  } else {
@@ -0,0 +1,4 @@
1
+ import type { PackageJson } from "./types.js";
2
+ export declare const findSourceFiles: (directory: string, ignorePatterns: string[]) => Promise<string[]>;
3
+ export declare const readFile: (filePath: string) => Promise<string>;
4
+ export declare const readPackageJson: (directory: string) => Promise<PackageJson>;
@@ -1,8 +1,6 @@
1
+ import fs from "fs-extra";
1
2
  import { glob } from "glob";
2
- import fs from "node:fs";
3
3
  import path from "node:path";
4
- import util from "node:util";
5
- const readFileAsync = util.promisify(fs.readFile);
6
4
  export const findSourceFiles = async (directory, ignorePatterns) => {
7
5
  const pattern = `${directory}/**/*.{js,jsx,ts,tsx}`;
8
6
  const defaultIgnores = [
@@ -24,7 +22,7 @@ export const findSourceFiles = async (directory, ignorePatterns) => {
24
22
  };
25
23
  export const readFile = async (filePath) => {
26
24
  try {
27
- return await readFileAsync(filePath, "utf8");
25
+ return await fs.readFile(filePath, "utf8");
28
26
  } catch (error) {
29
27
  console.error(`Error reading file ${filePath}:`, error);
30
28
  return "";
@@ -0,0 +1,2 @@
1
+ import type { DependencyResult, FinderOptions } from "./types.js";
2
+ export declare const formatOutput: (result: DependencyResult, options: FinderOptions) => string;
@@ -13,7 +13,7 @@ export const formatOutput = (result, options) => {
13
13
  `;
14
14
  output += `${chalk.gray("\u2022 ")}Missing from package.json: ${result.missingDependencies.length}
15
15
  `;
16
- if (options.includeBuiltins) {
16
+ if (options.builtins) {
17
17
  output += `${chalk.gray("\u2022 ")}Node.js built-in modules: ${result.builtinModules.length}
18
18
  `;
19
19
  }
@@ -34,7 +34,7 @@ export const formatOutput = (result, options) => {
34
34
  } else {
35
35
  output += chalk.bold.green("No missing dependencies found! \u{1F389}\n\n");
36
36
  }
37
- if (options.includeBuiltins && result.builtinModules.length > 0) {
37
+ if (options.builtins && result.builtinModules.length > 0) {
38
38
  output += chalk.bold.blue("Node.js Built-in Modules Used:\n");
39
39
  for (const dep of result.builtinModules) {
40
40
  output += `${chalk.gray("\u2022 ")}${chalk.blue(dep)}
@@ -0,0 +1,5 @@
1
+ import type { PackageJson } from "./types.js";
2
+ export declare const extractPackageNames: (fileContent: string) => Set<string>;
3
+ export declare const normalizePackageName: (importPath: string) => string | null;
4
+ export declare const getListedDependencies: (packageJson: PackageJson) => Set<string>;
5
+ export declare const getBuiltinModules: () => Set<string>;