@reliverse/dler 1.7.73 → 1.7.74
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.
- package/README.md +2 -2
- package/bin/app/agg/cmd.d.ts +40 -0
- package/bin/app/agg/cmd.js +833 -27
- package/bin/app/build/postbuild.js +1 -0
- package/bin/app/cmds.d.ts +230 -4
- package/bin/app/cmds.js +36 -19
- package/bin/app/config/cmd.d.ts +18 -0
- package/bin/app/config/cmd.js +43 -0
- package/bin/app/config/impl/typebox.d.ts +8 -0
- package/bin/app/config/impl/typebox.js +82 -0
- package/bin/app/mkdist/cmd.js +1 -1
- package/bin/app/pub/cmd.js +1 -1
- package/bin/app/rempts/cmd.js +146 -8
- package/bin/cli.js +14 -20
- package/bin/libs/cfg/cfg-impl/{cfg-types.d.ts → cfg-dler.d.ts} +76 -0
- package/bin/libs/cfg/cfg-mod.d.ts +2 -2
- package/bin/libs/cfg/cfg-mod.js +1 -1
- package/bin/libs/get/get-impl/get-core.d.ts +3 -0
- package/bin/libs/get/get-impl/get-core.js +450 -0
- package/bin/libs/get/get-mod.d.ts +0 -6
- package/bin/libs/get/get-mod.js +38 -459
- package/bin/libs/sdk/sdk-impl/build/providers/bun/single-file.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/config/core.d.ts +8 -0
- package/bin/libs/sdk/sdk-impl/config/core.js +231 -0
- package/bin/libs/sdk/sdk-impl/config/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/config/{init.js → prepare.js} +3 -1
- package/bin/libs/sdk/sdk-impl/magic/magic-spells.js +2 -1
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-meta.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/pm/pm-meta.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.d.ts +1 -3
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.js +432 -9
- package/bin/libs/sdk/sdk-mod.d.ts +7 -4
- package/bin/libs/sdk/sdk-mod.js +18 -7
- package/bin/mod.js +4 -1
- package/package.json +5 -5
- package/bin/app/agg/impl.d.ts +0 -39
- package/bin/app/agg/impl.js +0 -341
- package/bin/app/agg/run.d.ts +0 -1
- package/bin/app/agg/run.js +0 -136
- package/bin/libs/cfg/cfg-impl/cfg-consts.d.ts +0 -77
- package/bin/libs/cfg/cfg-impl/cfg-types.js +0 -0
- /package/bin/libs/cfg/cfg-impl/{cfg-consts.js → cfg-dler.js} +0 -0
- /package/bin/libs/sdk/sdk-impl/config/{init.d.ts → prepare.d.ts} +0 -0
package/bin/app/agg/impl.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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, fileExtensions, separateTypesFile, typesOutFile, }: {
|
|
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
|
-
fileExtensions?: string[];
|
|
33
|
-
separateTypesFile?: boolean;
|
|
34
|
-
typesOutFile?: string;
|
|
35
|
-
}): Promise<void>;
|
|
36
|
-
/**
|
|
37
|
-
* Prints usage examples based on whether dev mode or not.
|
|
38
|
-
*/
|
|
39
|
-
export declare function printUsage(isDev?: boolean): void;
|
package/bin/app/agg/impl.js
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import path from "@reliverse/pathkit";
|
|
2
|
-
import fs from "@reliverse/relifso";
|
|
3
|
-
import { relinka } from "@reliverse/relinka";
|
|
4
|
-
const AGGREGATOR_START = "// AUTO-GENERATED AGGREGATOR START (via `dler agg`)";
|
|
5
|
-
const AGGREGATOR_END = "// AUTO-GENERATED AGGREGATOR END";
|
|
6
|
-
export async function useAggregator({
|
|
7
|
-
inputDir,
|
|
8
|
-
isRecursive,
|
|
9
|
-
outFile,
|
|
10
|
-
stripPrefix,
|
|
11
|
-
useImport,
|
|
12
|
-
useNamed,
|
|
13
|
-
ignoreDirs = ["node_modules", ".git"],
|
|
14
|
-
sortLines = false,
|
|
15
|
-
headerComment = "",
|
|
16
|
-
verbose = false,
|
|
17
|
-
includeInternal = false,
|
|
18
|
-
internalMarker = "#",
|
|
19
|
-
overrideFile = false,
|
|
20
|
-
fileExtensions = [".ts", ".js", ".mts", ".cts", ".mjs", ".cjs"],
|
|
21
|
-
separateTypesFile = false,
|
|
22
|
-
typesOutFile
|
|
23
|
-
}) {
|
|
24
|
-
try {
|
|
25
|
-
const st = await fs.stat(inputDir).catch(() => null);
|
|
26
|
-
if (!st?.isDirectory()) {
|
|
27
|
-
relinka("error", `Error: --input is not a valid directory: ${inputDir}`);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
const outDir = path.dirname(outFile);
|
|
31
|
-
try {
|
|
32
|
-
await fs.ensureDir(outDir);
|
|
33
|
-
} catch (error) {
|
|
34
|
-
relinka("error", `Error: Cannot create output directory: ${outDir}
|
|
35
|
-
${error}`);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}
|
|
38
|
-
if (separateTypesFile && typesOutFile) {
|
|
39
|
-
const typesOutDir = path.dirname(typesOutFile);
|
|
40
|
-
try {
|
|
41
|
-
await fs.ensureDir(typesOutDir);
|
|
42
|
-
} catch (error) {
|
|
43
|
-
relinka("error", `Error: Cannot create types output directory: ${typesOutDir}
|
|
44
|
-
${error}`);
|
|
45
|
-
process.exit(1);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
const outExt = path.extname(outFile).toLowerCase();
|
|
49
|
-
if (!fileExtensions.includes(outExt)) {
|
|
50
|
-
relinka(
|
|
51
|
-
"warn",
|
|
52
|
-
`Warning: Output file extension (${outExt}) doesn't match any of the input extensions: ${fileExtensions.join(", ")}`
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
if (stripPrefix) {
|
|
56
|
-
const stripSt = await fs.stat(stripPrefix).catch(() => null);
|
|
57
|
-
if (!stripSt?.isDirectory()) {
|
|
58
|
-
relinka("error", `Error: --strip is not a valid directory: ${stripPrefix}`);
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (verbose)
|
|
63
|
-
relinka(
|
|
64
|
-
"log",
|
|
65
|
-
`Scanning directory ${inputDir} for files with extensions: ${fileExtensions.join(", ")}`
|
|
66
|
-
);
|
|
67
|
-
const filePaths = await collectFiles(
|
|
68
|
-
inputDir,
|
|
69
|
-
fileExtensions,
|
|
70
|
-
isRecursive,
|
|
71
|
-
ignoreDirs,
|
|
72
|
-
verbose,
|
|
73
|
-
includeInternal,
|
|
74
|
-
internalMarker,
|
|
75
|
-
outFile
|
|
76
|
-
);
|
|
77
|
-
if (!filePaths.length) {
|
|
78
|
-
relinka(
|
|
79
|
-
"warn",
|
|
80
|
-
`No matching files found in ${inputDir} with extensions: ${fileExtensions.join(", ")}`
|
|
81
|
-
);
|
|
82
|
-
if (!overrideFile) {
|
|
83
|
-
relinka("warn", "No changes will be made to the output file.");
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const usedIdentifiers = /* @__PURE__ */ new Set();
|
|
88
|
-
const aggregatorLinesArrays = await Promise.all(
|
|
89
|
-
filePaths.map(
|
|
90
|
-
(fp) => generateAggregatorLines(
|
|
91
|
-
fp,
|
|
92
|
-
inputDir,
|
|
93
|
-
stripPrefix,
|
|
94
|
-
useImport,
|
|
95
|
-
useNamed,
|
|
96
|
-
usedIdentifiers
|
|
97
|
-
).catch((error) => {
|
|
98
|
-
relinka("error", `Error processing file ${fp}: ${error}`);
|
|
99
|
-
return [];
|
|
100
|
-
})
|
|
101
|
-
)
|
|
102
|
-
);
|
|
103
|
-
const allLines = aggregatorLinesArrays.flat();
|
|
104
|
-
const typeLines = [];
|
|
105
|
-
const valueLines = [];
|
|
106
|
-
for (const line of allLines) {
|
|
107
|
-
if (line.includes("type {")) {
|
|
108
|
-
typeLines.push(line);
|
|
109
|
-
} else {
|
|
110
|
-
valueLines.push(line);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (sortLines) {
|
|
114
|
-
typeLines.sort();
|
|
115
|
-
valueLines.sort();
|
|
116
|
-
if (verbose) relinka("log", "Sorted aggregator lines alphabetically.");
|
|
117
|
-
}
|
|
118
|
-
const buildAggregatorBlock = (lines) => `${headerComment ? `${headerComment}
|
|
119
|
-
` : ""}${AGGREGATOR_START}
|
|
120
|
-
${lines.join("\n")}
|
|
121
|
-
${AGGREGATOR_END}
|
|
122
|
-
`;
|
|
123
|
-
if (separateTypesFile && typesOutFile) {
|
|
124
|
-
const typeBlock = buildAggregatorBlock(typeLines);
|
|
125
|
-
await fs.ensureFile(typesOutFile);
|
|
126
|
-
await fs.writeFile(typesOutFile, typeBlock, "utf8");
|
|
127
|
-
const valueBlock = buildAggregatorBlock([
|
|
128
|
-
...valueLines,
|
|
129
|
-
`export * from "${path.relative(path.dirname(outFile), typesOutFile).replace(/\\/g, "/")}";`
|
|
130
|
-
]);
|
|
131
|
-
await fs.ensureFile(outFile);
|
|
132
|
-
await fs.writeFile(outFile, valueBlock, "utf8");
|
|
133
|
-
relinka(
|
|
134
|
-
"success",
|
|
135
|
-
`Aggregator done: processed ${typeLines.length} type lines in: ${typesOutFile} and ${valueLines.length} value lines in: ${outFile}`
|
|
136
|
-
);
|
|
137
|
-
} else {
|
|
138
|
-
const aggregatorBlock = buildAggregatorBlock(allLines);
|
|
139
|
-
await fs.ensureFile(outFile);
|
|
140
|
-
await fs.writeFile(outFile, aggregatorBlock, "utf8");
|
|
141
|
-
relinka("success", `Aggregator done: processed ${allLines.length} lines in: ${outFile}`);
|
|
142
|
-
}
|
|
143
|
-
} catch (error) {
|
|
144
|
-
relinka("error", `Aggregator failed: ${error}`);
|
|
145
|
-
process.exit(1);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function buildPathRelative(filePath, inputDir, stripPrefix) {
|
|
149
|
-
let resolved = path.resolve(filePath);
|
|
150
|
-
const resolvedStrip = stripPrefix ? path.resolve(stripPrefix) : "";
|
|
151
|
-
if (resolvedStrip && resolved.startsWith(resolvedStrip)) {
|
|
152
|
-
resolved = resolved.slice(resolvedStrip.length);
|
|
153
|
-
} else {
|
|
154
|
-
resolved = path.relative(path.resolve(inputDir), resolved);
|
|
155
|
-
}
|
|
156
|
-
while (resolved.startsWith(path.sep)) {
|
|
157
|
-
resolved = resolved.slice(1);
|
|
158
|
-
}
|
|
159
|
-
resolved = resolved.replace(/\\/g, "/");
|
|
160
|
-
if (resolved.toLowerCase().endsWith(".ts")) {
|
|
161
|
-
resolved = `${resolved.slice(0, -3)}.js`;
|
|
162
|
-
}
|
|
163
|
-
if (!resolved.startsWith("./") && !resolved.startsWith("../")) {
|
|
164
|
-
resolved = `./${resolved}`;
|
|
165
|
-
}
|
|
166
|
-
resolved = resolved.replace(/\/+/g, "/");
|
|
167
|
-
return resolved;
|
|
168
|
-
}
|
|
169
|
-
async function collectFiles(dir, exts, recursive, ignoreDirs, verbose, includeInternal, internalMarker, outFile) {
|
|
170
|
-
const found = [];
|
|
171
|
-
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
172
|
-
for (const entry of entries) {
|
|
173
|
-
const fullPath = path.join(dir, entry.name);
|
|
174
|
-
if (outFile && path.resolve(fullPath) === path.resolve(outFile)) {
|
|
175
|
-
if (verbose) {
|
|
176
|
-
relinka("log", `Skipping output file: ${fullPath}`);
|
|
177
|
-
}
|
|
178
|
-
continue;
|
|
179
|
-
}
|
|
180
|
-
if (entry.isDirectory()) {
|
|
181
|
-
if (ignoreDirs.includes(entry.name)) {
|
|
182
|
-
if (verbose) {
|
|
183
|
-
relinka("log", `Skipping ignored directory: ${fullPath}`);
|
|
184
|
-
}
|
|
185
|
-
continue;
|
|
186
|
-
}
|
|
187
|
-
if (recursive) {
|
|
188
|
-
const sub = await collectFiles(
|
|
189
|
-
fullPath,
|
|
190
|
-
exts,
|
|
191
|
-
recursive,
|
|
192
|
-
ignoreDirs,
|
|
193
|
-
verbose,
|
|
194
|
-
includeInternal,
|
|
195
|
-
internalMarker,
|
|
196
|
-
outFile
|
|
197
|
-
);
|
|
198
|
-
found.push(...sub);
|
|
199
|
-
}
|
|
200
|
-
} else if (entry.isFile()) {
|
|
201
|
-
if (!includeInternal && path.basename(fullPath).startsWith(internalMarker)) {
|
|
202
|
-
if (verbose) {
|
|
203
|
-
relinka("log", `Skipping internal file: ${fullPath}`);
|
|
204
|
-
}
|
|
205
|
-
continue;
|
|
206
|
-
}
|
|
207
|
-
if (exts.some((ext) => entry.name.toLowerCase().endsWith(ext))) {
|
|
208
|
-
if (verbose) {
|
|
209
|
-
relinka("log", `Found file: ${fullPath}`);
|
|
210
|
-
}
|
|
211
|
-
found.push(fullPath);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
return found;
|
|
216
|
-
}
|
|
217
|
-
async function generateAggregatorLines(filePath, inputDir, stripPrefix, useImport, useNamed, usedIdentifiers) {
|
|
218
|
-
const importPath = buildPathRelative(filePath, inputDir, stripPrefix);
|
|
219
|
-
if (!useNamed) {
|
|
220
|
-
if (useImport) {
|
|
221
|
-
let ident = guessStarImportIdentifier(filePath);
|
|
222
|
-
if (usedIdentifiers) {
|
|
223
|
-
let uniqueIdent = ident;
|
|
224
|
-
let counter = 1;
|
|
225
|
-
while (usedIdentifiers.has(uniqueIdent)) {
|
|
226
|
-
uniqueIdent = `${ident}_${counter}`;
|
|
227
|
-
counter++;
|
|
228
|
-
}
|
|
229
|
-
usedIdentifiers.add(uniqueIdent);
|
|
230
|
-
ident = uniqueIdent;
|
|
231
|
-
}
|
|
232
|
-
return [`import * as ${ident} from "${importPath}";`];
|
|
233
|
-
}
|
|
234
|
-
return [`export * from "${importPath}";`];
|
|
235
|
-
}
|
|
236
|
-
const { typeNames, valueNames } = await getNamedExports(filePath);
|
|
237
|
-
if (!typeNames.length && !valueNames.length) {
|
|
238
|
-
return [];
|
|
239
|
-
}
|
|
240
|
-
if (useImport) {
|
|
241
|
-
const lines2 = [];
|
|
242
|
-
if (typeNames.length > 0) {
|
|
243
|
-
lines2.push(`import type { ${typeNames.join(", ")} } from "${importPath}";`);
|
|
244
|
-
}
|
|
245
|
-
if (valueNames.length > 0) {
|
|
246
|
-
lines2.push(`import { ${valueNames.join(", ")} } from "${importPath}";`);
|
|
247
|
-
}
|
|
248
|
-
return lines2;
|
|
249
|
-
}
|
|
250
|
-
const lines = [];
|
|
251
|
-
if (typeNames.length > 0) {
|
|
252
|
-
lines.push(`export type { ${typeNames.join(", ")} } from "${importPath}";`);
|
|
253
|
-
}
|
|
254
|
-
if (valueNames.length > 0) {
|
|
255
|
-
lines.push(`export { ${valueNames.join(", ")} } from "${importPath}";`);
|
|
256
|
-
}
|
|
257
|
-
return lines;
|
|
258
|
-
}
|
|
259
|
-
async function getNamedExports(filePath) {
|
|
260
|
-
try {
|
|
261
|
-
const code = await fs.readFile(filePath, "utf8");
|
|
262
|
-
const typeNamesSet = /* @__PURE__ */ new Set();
|
|
263
|
-
const valueNamesSet = /* @__PURE__ */ new Set();
|
|
264
|
-
const patterns = [
|
|
265
|
-
// Regular exports and default exports
|
|
266
|
-
/^export\s+(?:default\s+)?(?:async\s+)?(function|const|class|let|var|type|interface|enum)\s+([A-Za-z0-9_$]+)/gm,
|
|
267
|
-
// Named exports and re-exports
|
|
268
|
-
/^export\s*{([^}]+)}(?:\s+from\s+['"][^'"]+['"])?/gm,
|
|
269
|
-
// Export assignments
|
|
270
|
-
/^export\s*=\s*([A-Za-z0-9_$]+)/gm
|
|
271
|
-
];
|
|
272
|
-
for (const pattern of patterns) {
|
|
273
|
-
let match;
|
|
274
|
-
while (true) {
|
|
275
|
-
match = pattern.exec(code);
|
|
276
|
-
if (!match) break;
|
|
277
|
-
const matchGroups = match;
|
|
278
|
-
if (pattern.source.includes("{([^}]+)}") && matchGroups[1]) {
|
|
279
|
-
const exports = (matchGroups[1] ?? "").split(",").map(
|
|
280
|
-
(e) => e?.trim()?.split(/\s+as\s+/)?.[0]?.trim() ?? ""
|
|
281
|
-
);
|
|
282
|
-
for (const exp of exports) {
|
|
283
|
-
const name = exp.replace(/^type\s+/, "");
|
|
284
|
-
if (exp.startsWith("type ")) {
|
|
285
|
-
typeNamesSet.add(name);
|
|
286
|
-
} else {
|
|
287
|
-
valueNamesSet.add(name);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
} else if (pattern.source.includes("=\\s*([A-Za-z0-9_$]+)") && matchGroups[1]) {
|
|
291
|
-
valueNamesSet.add(matchGroups[1]);
|
|
292
|
-
} else {
|
|
293
|
-
const keyword = matchGroups[1];
|
|
294
|
-
const name = matchGroups[2];
|
|
295
|
-
if (keyword && name) {
|
|
296
|
-
if (keyword === "type" || keyword === "interface" || keyword === "enum") {
|
|
297
|
-
typeNamesSet.add(name);
|
|
298
|
-
} else {
|
|
299
|
-
valueNamesSet.add(name);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
return {
|
|
306
|
-
typeNames: Array.from(typeNamesSet),
|
|
307
|
-
valueNames: Array.from(valueNamesSet)
|
|
308
|
-
};
|
|
309
|
-
} catch (error) {
|
|
310
|
-
relinka("error", `Error reading file ${filePath}: ${error}`);
|
|
311
|
-
return { typeNames: [], valueNames: [] };
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
function guessStarImportIdentifier(filePath) {
|
|
315
|
-
const base = path.basename(filePath, path.extname(filePath));
|
|
316
|
-
let identifier = base.replace(/[^a-zA-Z0-9_$]/g, "_");
|
|
317
|
-
if (/^\d/.test(identifier)) {
|
|
318
|
-
identifier = `_${identifier}`;
|
|
319
|
-
}
|
|
320
|
-
return identifier || "file";
|
|
321
|
-
}
|
|
322
|
-
export function printUsage(isDev) {
|
|
323
|
-
relinka("log", "====================");
|
|
324
|
-
relinka("log", "TOOLS USAGE EXAMPLES");
|
|
325
|
-
relinka("log", "====================");
|
|
326
|
-
relinka(
|
|
327
|
-
"log",
|
|
328
|
-
`${isDev ? "bun dev:agg" : "dler tools"} --tool agg --input <dir> --out <file> [options]`
|
|
329
|
-
);
|
|
330
|
-
if (isDev) {
|
|
331
|
-
relinka(
|
|
332
|
-
"log",
|
|
333
|
-
"bun dev:tools agg --input src/libs/sdk/sdk-impl --out src/libs/sdk/sdk-mod.ts --recursive --named --strip src/libs/sdk"
|
|
334
|
-
);
|
|
335
|
-
} else {
|
|
336
|
-
relinka(
|
|
337
|
-
"log",
|
|
338
|
-
"dler tools --tool agg --input src/libs --out aggregator.ts --recursive --named"
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
}
|
package/bin/app/agg/run.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function promptAggCommand(): Promise<void>;
|
package/bin/app/agg/run.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import path from "@reliverse/pathkit";
|
|
2
|
-
import fs from "@reliverse/relifso";
|
|
3
|
-
import { selectPrompt, runCmd, confirmPrompt, inputPrompt } from "@reliverse/rempts";
|
|
4
|
-
import { getAggCmd } from "../cmds.js";
|
|
5
|
-
import { getConfigDler } from "../../libs/sdk/sdk-impl/config/load.js";
|
|
6
|
-
async function fileExists(filePath) {
|
|
7
|
-
return await fs.pathExists(filePath);
|
|
8
|
-
}
|
|
9
|
-
async function findMainEntryFile(config) {
|
|
10
|
-
const { coreEntryFile, coreEntrySrcDir } = config;
|
|
11
|
-
if (coreEntryFile && coreEntrySrcDir) {
|
|
12
|
-
const configuredPath = path.join(coreEntrySrcDir, coreEntryFile);
|
|
13
|
-
if (await fileExists(configuredPath)) {
|
|
14
|
-
return configuredPath;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
const fallbackPatterns = [
|
|
18
|
-
path.join(coreEntrySrcDir || "src", "mod.ts"),
|
|
19
|
-
path.join(coreEntrySrcDir || "src", "index.ts"),
|
|
20
|
-
path.join(coreEntrySrcDir || "src", "mod.js"),
|
|
21
|
-
path.join(coreEntrySrcDir || "src", "index.js")
|
|
22
|
-
];
|
|
23
|
-
for (const pattern of fallbackPatterns) {
|
|
24
|
-
if (await fileExists(pattern)) {
|
|
25
|
-
return pattern;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
export async function promptAggCommand() {
|
|
31
|
-
const config = await getConfigDler();
|
|
32
|
-
let selectedLibName = null;
|
|
33
|
-
const mainEntryFile = await findMainEntryFile(config);
|
|
34
|
-
if (config?.libsList && Object.keys(config.libsList).length > 0) {
|
|
35
|
-
const libs = Object.entries(config.libsList).map(([name, lib]) => ({
|
|
36
|
-
value: name,
|
|
37
|
-
label: name,
|
|
38
|
-
hint: `${config.libsDirSrc}/${lib.libDirName}/${lib.libDirName}-impl`
|
|
39
|
-
}));
|
|
40
|
-
if (mainEntryFile) {
|
|
41
|
-
libs.unshift({
|
|
42
|
-
value: "main",
|
|
43
|
-
label: "Main package",
|
|
44
|
-
hint: mainEntryFile
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
libs.push({ value: "", label: "Skip selection", hint: "" });
|
|
48
|
-
selectedLibName = await selectPrompt({
|
|
49
|
-
title: "Select a package to aggregate or skip",
|
|
50
|
-
options: libs
|
|
51
|
-
});
|
|
52
|
-
} else if (mainEntryFile) {
|
|
53
|
-
const shouldUseMain = await confirmPrompt({
|
|
54
|
-
title: "Use main package for aggregation?",
|
|
55
|
-
content: `Found: ${mainEntryFile}`,
|
|
56
|
-
defaultValue: true
|
|
57
|
-
});
|
|
58
|
-
if (shouldUseMain) {
|
|
59
|
-
selectedLibName = "main";
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
let imports = false;
|
|
63
|
-
let input = "";
|
|
64
|
-
let named = true;
|
|
65
|
-
let out = "";
|
|
66
|
-
let recursive = true;
|
|
67
|
-
let strip = "";
|
|
68
|
-
let separateTypesFile = false;
|
|
69
|
-
let typesOut = "";
|
|
70
|
-
if (selectedLibName && selectedLibName !== "") {
|
|
71
|
-
if (selectedLibName === "main" && mainEntryFile) {
|
|
72
|
-
const entryDir = path.dirname(mainEntryFile);
|
|
73
|
-
input = entryDir;
|
|
74
|
-
out = mainEntryFile;
|
|
75
|
-
strip = entryDir;
|
|
76
|
-
} else {
|
|
77
|
-
const libConfig = config?.libsList?.[selectedLibName];
|
|
78
|
-
if (config && libConfig) {
|
|
79
|
-
input = `${config.libsDirSrc}/${libConfig.libDirName}/${libConfig.libDirName}-impl`;
|
|
80
|
-
out = `${config.libsDirSrc}/${libConfig.libMainFile}`;
|
|
81
|
-
strip = `${config.libsDirSrc}/${libConfig.libDirName}`;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
if (!selectedLibName || !input) {
|
|
86
|
-
input = await inputPrompt({
|
|
87
|
-
title: "Enter the input directory",
|
|
88
|
-
defaultValue: input
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
imports = await confirmPrompt({
|
|
92
|
-
title: "Do you want to generate imports instead of exports?",
|
|
93
|
-
content: "(N generates exports)",
|
|
94
|
-
defaultValue: imports
|
|
95
|
-
});
|
|
96
|
-
named = await confirmPrompt({
|
|
97
|
-
title: imports ? "Do you want to generate named imports?" : "Do you want to generate named exports?",
|
|
98
|
-
defaultValue: named
|
|
99
|
-
});
|
|
100
|
-
if (!selectedLibName || !out) {
|
|
101
|
-
out = await inputPrompt({
|
|
102
|
-
title: "Enter the output file",
|
|
103
|
-
defaultValue: out
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
recursive = await confirmPrompt({
|
|
107
|
-
title: "Do you want to recursively scan subdirectories?",
|
|
108
|
-
defaultValue: recursive
|
|
109
|
-
});
|
|
110
|
-
if (!selectedLibName || !strip) {
|
|
111
|
-
strip = await inputPrompt({
|
|
112
|
-
title: "Enter the path to strip from the final imports/exports",
|
|
113
|
-
defaultValue: strip
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
separateTypesFile = await confirmPrompt({
|
|
117
|
-
title: "Do you want to create a separate file for type exports?",
|
|
118
|
-
defaultValue: separateTypesFile
|
|
119
|
-
});
|
|
120
|
-
if (separateTypesFile) {
|
|
121
|
-
typesOut = await inputPrompt({
|
|
122
|
-
title: "Enter the output file for types",
|
|
123
|
-
defaultValue: out.replace(/\.(ts|js)$/, ".types.$1")
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
await runCmd(await getAggCmd(), [
|
|
127
|
-
`--imports=${imports}`,
|
|
128
|
-
`--input=${input}`,
|
|
129
|
-
`--named=${named}`,
|
|
130
|
-
`--out=${out}`,
|
|
131
|
-
`--recursive=${recursive}`,
|
|
132
|
-
`--strip=${strip}`,
|
|
133
|
-
`--separateTypesFile=${separateTypesFile}`,
|
|
134
|
-
...separateTypesFile ? [`--typesOut=${typesOut}`] : []
|
|
135
|
-
]);
|
|
136
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { DlerConfig } from "./cfg-types";
|
|
2
|
-
/**
|
|
3
|
-
* Default configuration for the build and publish logic.
|
|
4
|
-
*/
|
|
5
|
-
export declare const DEFAULT_CONFIG_DLER: DlerConfig;
|
|
6
|
-
export declare const defineConfig: (userConfig?: Partial<DlerConfig>) => {
|
|
7
|
-
bumpDisable: boolean;
|
|
8
|
-
bumpFilter: string[];
|
|
9
|
-
bumpMode: import("./cfg-types").BumpMode;
|
|
10
|
-
bumpSet: string;
|
|
11
|
-
commonPubPause: boolean;
|
|
12
|
-
commonPubRegistry: "jsr" | "npm" | "npm-jsr";
|
|
13
|
-
commonVerbose: boolean;
|
|
14
|
-
coreDeclarations: boolean;
|
|
15
|
-
coreEntryFile: string;
|
|
16
|
-
coreEntrySrcDir: string;
|
|
17
|
-
coreBuildOutDir: string;
|
|
18
|
-
coreIsCLI: {
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
scripts: Record<string, string>;
|
|
21
|
-
};
|
|
22
|
-
coreDescription: string;
|
|
23
|
-
distJsrAllowDirty: boolean;
|
|
24
|
-
distJsrBuilder: import("./cfg-types").BundlerName;
|
|
25
|
-
distJsrDirName: string;
|
|
26
|
-
distJsrDryRun: boolean;
|
|
27
|
-
distJsrFailOnWarn: boolean;
|
|
28
|
-
distJsrGenTsconfig: boolean;
|
|
29
|
-
distJsrOutFilesExt: import("./cfg-types").NpmOutExt;
|
|
30
|
-
distJsrSlowTypes: boolean;
|
|
31
|
-
distNpmBuilder: import("./cfg-types").BundlerName;
|
|
32
|
-
distNpmDirName: string;
|
|
33
|
-
distNpmOutFilesExt: import("./cfg-types").NpmOutExt;
|
|
34
|
-
libsActMode: "libs-only" | "main-and-libs" | "main-project-only";
|
|
35
|
-
libsDirDist: string;
|
|
36
|
-
libsDirSrc: string;
|
|
37
|
-
libsList: Record<string, import("./cfg-types").LibConfig>;
|
|
38
|
-
logsFileName: string;
|
|
39
|
-
logsFreshFile: boolean;
|
|
40
|
-
filterDepsPatterns: {
|
|
41
|
-
global: string[];
|
|
42
|
-
"dist-npm": string[];
|
|
43
|
-
"dist-jsr": string[];
|
|
44
|
-
"dist-libs": Record<string, {
|
|
45
|
-
npm: string[];
|
|
46
|
-
jsr: string[];
|
|
47
|
-
}>;
|
|
48
|
-
};
|
|
49
|
-
runBeforeBuild: ("tsc" | "eslint" | "biome" | "knip" | "dler-check")[];
|
|
50
|
-
runAfterBuild: "dler-check"[];
|
|
51
|
-
hooksBeforeBuild: (() => Promise<void>)[];
|
|
52
|
-
hooksAfterBuild: (() => Promise<void>)[];
|
|
53
|
-
postBuildSettings: {
|
|
54
|
-
deleteDistTmpAfterBuild: boolean;
|
|
55
|
-
};
|
|
56
|
-
transpileFailOnWarn: boolean;
|
|
57
|
-
transpileEsbuild: import("./cfg-types").Esbuild;
|
|
58
|
-
transpileFormat: import("./cfg-types").transpileFormat;
|
|
59
|
-
transpileMinify: boolean;
|
|
60
|
-
transpilePublicPath: string;
|
|
61
|
-
transpileSourcemap: import("./cfg-types").Sourcemap;
|
|
62
|
-
transpileSplitting: boolean;
|
|
63
|
-
transpileStub: boolean;
|
|
64
|
-
transpileTarget: import("./cfg-types").transpileTarget;
|
|
65
|
-
transpileWatch: boolean;
|
|
66
|
-
publishArtifacts?: {
|
|
67
|
-
global: string[];
|
|
68
|
-
"dist-jsr": string[];
|
|
69
|
-
"dist-npm": string[];
|
|
70
|
-
"dist-libs": Record<string, {
|
|
71
|
-
jsr: string[];
|
|
72
|
-
npm: string[];
|
|
73
|
-
}>;
|
|
74
|
-
};
|
|
75
|
-
buildPreExtensions: string[];
|
|
76
|
-
buildTemplatesDir: string;
|
|
77
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|