@reliverse/dler 1.3.6 → 1.4.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.
- package/README.md +1 -0
- package/bin/app/agg/cmd.d.ts +34 -0
- package/bin/app/agg/cmd.js +44 -3
- package/bin/app/agg/impl.d.ts +2 -1
- package/bin/app/agg/impl.js +94 -33
- package/bin/app/cmds.d.ts +34 -0
- package/bin/app/deps/cmd.js +1 -1
- package/bin/app/deps/impl/analyzer.d.ts +1 -1
- package/bin/app/deps/impl/filesystem.d.ts +1 -1
- package/bin/app/deps/impl/filesystem.js +1 -1
- package/bin/app/deps/impl/formatter.d.ts +1 -1
- package/bin/app/deps/impl/formatter.js +0 -1
- package/bin/app/deps/impl/parser.d.ts +1 -1
- package/bin/app/inject/expect/impl.js +2 -2
- package/bin/app/merge/cmd.d.ts +44 -0
- package/bin/app/merge/{cmd.txt → cmd.js} +79 -141
- package/bin/app/relifso/cmd.js +1 -1
- package/bin/app/relifso/init/cmd.js +3 -3
- package/bin/app/relifso/init/{impl/mod.d.ts → init-impl.d.ts} +6 -1
- package/bin/app/relifso/init/{impl/mod.js → init-impl.js} +6 -4
- package/bin/app/relifso/init/{impl/types.d.ts → init-types.d.ts} +1 -1
- package/bin/app/relifso/init/{impl/templates → templates}/t-license.js +0 -4
- package/bin/app/relifso/init/{impl/templates → templates}/t-readme.js +0 -18
- package/bin/app/rempts/init/cmd/cmd.js +2 -4
- package/bin/app/rempts/init/cmds/cmd.js +2 -2
- package/bin/app/rempts/migrate/cmd.js +1 -1
- package/bin/app/rempts/migrate/impl/commander.js +0 -1
- package/bin/app/split/cmd.d.ts +21 -3
- package/bin/app/split/cmd.js +41 -0
- package/bin/app/split/impl.d.ts +0 -7
- package/bin/app/split/impl.js +2 -23
- package/bin/default.d.ts +1 -1
- package/bin/default.js +2 -1
- package/bin/impl.js +12 -6
- package/bin/init.js +2 -11
- package/bin/libs/sdk/sdk-impl/build/build-library.js +38 -22
- package/bin/libs/sdk/sdk-impl/build/build-regular.js +40 -25
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/auto.js +4 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +1 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/copy.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/copy.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/build.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/config.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/config.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/cjs.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/cjs.js +0 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/esbuild.d.ts +1 -11
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/esbuild.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/shebang.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/stub.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/stub.js +7 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/utils.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/watch.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/index.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/index.js +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.d.ts +1 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.js +3 -5
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/validate.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/validate.js +1 -1
- package/bin/libs/sdk/sdk-impl/library-flow.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/library-flow.js +8 -6
- package/bin/libs/sdk/sdk-impl/pub/pub-regular.js +1 -1
- package/bin/libs/sdk/sdk-impl/spell/spell-executors.js +1 -1
- package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/tools/tools-agg.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-build.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-bump.d.ts +83 -3
- package/bin/libs/sdk/sdk-impl/utils/utils-bump.js +382 -213
- package/bin/libs/sdk/sdk-impl/utils/utils-clean.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-clean.js +34 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-consts.js +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-deps.js +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-fs.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-misc.d.ts +7 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-misc.js +7 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-libs.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-pkg-json-reg.js +2 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-tsconfig.js +2 -2
- package/bin/libs/sdk/sdk-mod.d.ts +3 -10
- package/bin/libs/sdk/sdk-mod.js +1 -11
- package/bin/libs/sdk/sdk-types.d.ts +329 -13
- package/bin/load.js +1 -1
- package/bin/mod.d.ts +2 -48
- package/package.json +14 -15
- package/bin/app/relifso/init/impl/utils.d.ts +0 -5
- package/bin/app/relifso/init/impl/utils.js +0 -3
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/copy/types.d.ts +0 -9
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/types.d.ts +0 -15
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/types.d.ts +0 -95
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/types.js +0 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/types.d.ts +0 -176
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/types.js +0 -6
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/types.d.ts +0 -23
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/untyped/types.js +0 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-paths.d.ts +0 -55
- package/bin/libs/sdk/sdk-impl/utils/utils-paths.js +0 -667
- package/bin/types.d.ts +0 -475
- package/bin/types.js +0 -0
- /package/bin/app/deps/impl/{types.d.ts → deps-types.d.ts} +0 -0
- /package/bin/app/deps/impl/{types.js → deps-types.js} +0 -0
- /package/bin/app/{relifso/init/impl/types.js → migrate/cmd.d.ts} +0 -0
- /package/bin/{libs/sdk/sdk-impl/build/bundlers/unified/copy/types.js → app/migrate/cmd.js} +0 -0
- /package/bin/app/relifso/init/{impl/const.d.ts → init-const.d.ts} +0 -0
- /package/bin/app/relifso/init/{impl/const.js → init-const.js} +0 -0
- /package/bin/{libs/sdk/sdk-impl/build/bundlers/unified/mkdist/types.js → app/relifso/init/init-types.js} +0 -0
- /package/bin/app/relifso/init/{impl/templates → templates}/t-gitignore.d.ts +0 -0
- /package/bin/app/relifso/init/{impl/templates → templates}/t-gitignore.js +0 -0
- /package/bin/app/relifso/init/{impl/templates → templates}/t-license.d.ts +0 -0
- /package/bin/app/relifso/init/{impl/templates → templates}/t-readme.d.ts +0 -0
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
- 🔌 plugin system with two built-in plugins included
|
|
19
19
|
- 📝 highly configurable flow via a configuration file
|
|
20
20
|
- 🔜 `libraries` plugin —> dler monorepo implementation
|
|
21
|
+
- 🧼 cleans up your internal logs from the build dist
|
|
21
22
|
- 🪄 magic spells (built-in plugin)
|
|
22
23
|
|
|
23
24
|
### supported bundlers
|
package/bin/app/agg/cmd.d.ts
CHANGED
|
@@ -31,5 +31,39 @@ declare const _default: import("@reliverse/rempts").Command<{
|
|
|
31
31
|
description: string;
|
|
32
32
|
type: "string";
|
|
33
33
|
};
|
|
34
|
+
sort: {
|
|
35
|
+
description: string;
|
|
36
|
+
type: "boolean";
|
|
37
|
+
default: false;
|
|
38
|
+
};
|
|
39
|
+
header: {
|
|
40
|
+
description: string;
|
|
41
|
+
type: "string";
|
|
42
|
+
};
|
|
43
|
+
verbose: {
|
|
44
|
+
description: string;
|
|
45
|
+
type: "boolean";
|
|
46
|
+
default: false;
|
|
47
|
+
};
|
|
48
|
+
includeInternal: {
|
|
49
|
+
description: string;
|
|
50
|
+
type: "boolean";
|
|
51
|
+
default: false;
|
|
52
|
+
};
|
|
53
|
+
internalMarker: {
|
|
54
|
+
description: string;
|
|
55
|
+
type: "string";
|
|
56
|
+
default: string;
|
|
57
|
+
};
|
|
58
|
+
override: {
|
|
59
|
+
description: string;
|
|
60
|
+
type: "boolean";
|
|
61
|
+
default: false;
|
|
62
|
+
};
|
|
63
|
+
extensions: {
|
|
64
|
+
description: string;
|
|
65
|
+
type: "string";
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
34
68
|
}>;
|
|
35
69
|
export default _default;
|
package/bin/app/agg/cmd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
1
2
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
-
import path from "pathe";
|
|
3
3
|
import { useAggregator } from "./impl.js";
|
|
4
4
|
export default defineCommand({
|
|
5
5
|
args: defineArgs({
|
|
@@ -27,13 +27,47 @@ export default defineCommand({
|
|
|
27
27
|
required: true
|
|
28
28
|
},
|
|
29
29
|
recursive: {
|
|
30
|
-
description: "Recursively scan subdirectories (default false)",
|
|
30
|
+
description: "Recursively scan subdirectories (default true) (false means only scan the files in the current directory and not subdirectories)",
|
|
31
31
|
type: "boolean",
|
|
32
32
|
default: true
|
|
33
33
|
},
|
|
34
34
|
strip: {
|
|
35
35
|
description: "Remove specified path prefix from final imports/exports",
|
|
36
36
|
type: "string"
|
|
37
|
+
},
|
|
38
|
+
sort: {
|
|
39
|
+
description: "Sort aggregated lines alphabetically",
|
|
40
|
+
type: "boolean",
|
|
41
|
+
default: false
|
|
42
|
+
},
|
|
43
|
+
header: {
|
|
44
|
+
description: "Add a header comment to the aggregator output",
|
|
45
|
+
type: "string"
|
|
46
|
+
},
|
|
47
|
+
verbose: {
|
|
48
|
+
description: "Enable verbose logging",
|
|
49
|
+
type: "boolean",
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
includeInternal: {
|
|
53
|
+
description: "Include files marked as internal (starting with #)",
|
|
54
|
+
type: "boolean",
|
|
55
|
+
default: false
|
|
56
|
+
},
|
|
57
|
+
internalMarker: {
|
|
58
|
+
description: "Marker for internal files (default: #)",
|
|
59
|
+
type: "string",
|
|
60
|
+
default: "#"
|
|
61
|
+
},
|
|
62
|
+
override: {
|
|
63
|
+
description: "Override entire file instead of updating only the aggregator block",
|
|
64
|
+
type: "boolean",
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
extensions: {
|
|
68
|
+
description: "Comma-separated list of file extensions to process (default: .ts,.js,.mts,.cts,.mjs,.cjs)",
|
|
69
|
+
type: "string",
|
|
70
|
+
default: ".ts,.js,.mts,.cts,.mjs,.cjs"
|
|
37
71
|
}
|
|
38
72
|
}),
|
|
39
73
|
async run({ args }) {
|
|
@@ -43,7 +77,14 @@ export default defineCommand({
|
|
|
43
77
|
outFile: path.resolve(args.out),
|
|
44
78
|
stripPrefix: args.strip ? path.resolve(args.strip) : "",
|
|
45
79
|
useImport: !!args.imports,
|
|
46
|
-
useNamed: !!args.named
|
|
80
|
+
useNamed: !!args.named,
|
|
81
|
+
sortLines: !!args.sort,
|
|
82
|
+
headerComment: args.header || "",
|
|
83
|
+
verbose: !!args.verbose,
|
|
84
|
+
includeInternal: !!args.includeInternal,
|
|
85
|
+
internalMarker: args.internalMarker,
|
|
86
|
+
overrideFile: !!args.override,
|
|
87
|
+
fileExtensions: args.extensions.split(",").map((ext) => ext.trim())
|
|
47
88
|
});
|
|
48
89
|
}
|
|
49
90
|
});
|
package/bin/app/agg/impl.d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - By default, updates only the auto-generated block in the aggregator file,
|
|
16
16
|
* leaving any other content intact. Pass `overrideFile: true` to rewrite the entire file.
|
|
17
17
|
*/
|
|
18
|
-
export declare function useAggregator({ inputDir, isRecursive, outFile, stripPrefix, useImport, useNamed, ignoreDirs, sortLines, headerComment, verbose, includeInternal, internalMarker, overrideFile, }: {
|
|
18
|
+
export declare function useAggregator({ inputDir, isRecursive, outFile, stripPrefix, useImport, useNamed, ignoreDirs, sortLines, headerComment, verbose, includeInternal, internalMarker, overrideFile, fileExtensions, }: {
|
|
19
19
|
inputDir: string;
|
|
20
20
|
isRecursive: boolean;
|
|
21
21
|
outFile: string;
|
|
@@ -29,6 +29,7 @@ export declare function useAggregator({ inputDir, isRecursive, outFile, stripPre
|
|
|
29
29
|
includeInternal?: boolean;
|
|
30
30
|
internalMarker?: string;
|
|
31
31
|
overrideFile?: boolean;
|
|
32
|
+
fileExtensions?: string[];
|
|
32
33
|
}): Promise<void>;
|
|
33
34
|
/**
|
|
34
35
|
* Prints usage examples based on whether dev mode or not.
|
package/bin/app/agg/impl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
1
3
|
import { relinka } from "@reliverse/relinka";
|
|
2
|
-
import fs from "fs-extra";
|
|
3
4
|
import MagicString from "magic-string";
|
|
4
|
-
import path from "pathe";
|
|
5
5
|
const AGGREGATOR_START = "// AUTO-GENERATED AGGREGATOR START";
|
|
6
6
|
const AGGREGATOR_END = "// AUTO-GENERATED AGGREGATOR END";
|
|
7
7
|
export async function useAggregator({
|
|
@@ -17,7 +17,8 @@ export async function useAggregator({
|
|
|
17
17
|
verbose = false,
|
|
18
18
|
includeInternal = false,
|
|
19
19
|
internalMarker = "#",
|
|
20
|
-
overrideFile = false
|
|
20
|
+
overrideFile = false,
|
|
21
|
+
fileExtensions = [".ts", ".js", ".mts", ".cts", ".mjs", ".cjs"]
|
|
21
22
|
}) {
|
|
22
23
|
try {
|
|
23
24
|
const st = await fs.stat(inputDir).catch(() => null);
|
|
@@ -25,25 +26,60 @@ export async function useAggregator({
|
|
|
25
26
|
relinka("error", `Error: --input is not a valid directory: ${inputDir}`);
|
|
26
27
|
process.exit(1);
|
|
27
28
|
}
|
|
28
|
-
const
|
|
29
|
+
const outDir = path.dirname(outFile);
|
|
30
|
+
try {
|
|
31
|
+
await fs.ensureDir(outDir);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
relinka(
|
|
34
|
+
"error",
|
|
35
|
+
`Error: Cannot create output directory: ${outDir}
|
|
36
|
+
${error}`
|
|
37
|
+
);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
const outExt = path.extname(outFile).toLowerCase();
|
|
41
|
+
if (!fileExtensions.includes(outExt)) {
|
|
42
|
+
relinka(
|
|
43
|
+
"warn",
|
|
44
|
+
`Warning: Output file extension (${outExt}) doesn't match any of the input extensions: ${fileExtensions.join(", ")}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
if (stripPrefix) {
|
|
48
|
+
const stripSt = await fs.stat(stripPrefix).catch(() => null);
|
|
49
|
+
if (!stripSt?.isDirectory()) {
|
|
50
|
+
relinka(
|
|
51
|
+
"error",
|
|
52
|
+
`Error: --strip is not a valid directory: ${stripPrefix}`
|
|
53
|
+
);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
29
57
|
if (verbose)
|
|
30
58
|
relinka(
|
|
31
59
|
"log",
|
|
32
|
-
`Scanning directory ${inputDir} for files with extensions: ${
|
|
60
|
+
`Scanning directory ${inputDir} for files with extensions: ${fileExtensions.join(
|
|
33
61
|
", "
|
|
34
62
|
)}`
|
|
35
63
|
);
|
|
36
64
|
const filePaths = await collectFiles(
|
|
37
65
|
inputDir,
|
|
38
|
-
|
|
66
|
+
fileExtensions,
|
|
39
67
|
isRecursive,
|
|
40
68
|
ignoreDirs,
|
|
41
69
|
verbose,
|
|
42
70
|
includeInternal,
|
|
43
|
-
internalMarker
|
|
71
|
+
internalMarker,
|
|
72
|
+
outFile
|
|
44
73
|
);
|
|
45
74
|
if (!filePaths.length) {
|
|
46
|
-
relinka(
|
|
75
|
+
relinka(
|
|
76
|
+
"warn",
|
|
77
|
+
`No matching files found in ${inputDir} with extensions: ${fileExtensions.join(", ")}`
|
|
78
|
+
);
|
|
79
|
+
if (!overrideFile) {
|
|
80
|
+
relinka("warn", "No changes will be made to the output file.");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
47
83
|
}
|
|
48
84
|
const usedIdentifiers = /* @__PURE__ */ new Set();
|
|
49
85
|
const aggregatorLinesArrays = await Promise.all(
|
|
@@ -55,7 +91,10 @@ export async function useAggregator({
|
|
|
55
91
|
useImport,
|
|
56
92
|
useNamed,
|
|
57
93
|
usedIdentifiers
|
|
58
|
-
)
|
|
94
|
+
).catch((error) => {
|
|
95
|
+
relinka("error", `Error processing file ${fp}: ${error}`);
|
|
96
|
+
return [];
|
|
97
|
+
})
|
|
59
98
|
)
|
|
60
99
|
);
|
|
61
100
|
const allLines = aggregatorLinesArrays.flat();
|
|
@@ -63,16 +102,6 @@ export async function useAggregator({
|
|
|
63
102
|
allLines.sort();
|
|
64
103
|
if (verbose) relinka("log", "Sorted aggregator lines alphabetically.");
|
|
65
104
|
}
|
|
66
|
-
if (outFile.startsWith(inputDir)) {
|
|
67
|
-
relinka(
|
|
68
|
-
"warn",
|
|
69
|
-
`Warning: The output file is inside (or overlaps with) the input directory.
|
|
70
|
-
Might re-import (or re-export) itself.
|
|
71
|
-
input: ${inputDir}
|
|
72
|
-
out: ${outFile}
|
|
73
|
-
`
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
105
|
const aggregatorContent = allLines.join("\n");
|
|
77
106
|
const aggregatorBlock = `${headerComment ? `${headerComment}
|
|
78
107
|
` : ""}${AGGREGATOR_START}
|
|
@@ -113,7 +142,6 @@ ${AGGREGATOR_END}
|
|
|
113
142
|
"No aggregator block found. Appending auto-generated section."
|
|
114
143
|
);
|
|
115
144
|
finalText = `${existingContent.trim()}
|
|
116
|
-
|
|
117
145
|
${aggregatorBlock}`;
|
|
118
146
|
} else {
|
|
119
147
|
finalText = aggregatorBlock;
|
|
@@ -151,11 +179,17 @@ function buildPathRelative(filePath, inputDir, stripPrefix) {
|
|
|
151
179
|
}
|
|
152
180
|
return resolved;
|
|
153
181
|
}
|
|
154
|
-
async function collectFiles(dir, exts, recursive, ignoreDirs, verbose, includeInternal, internalMarker) {
|
|
182
|
+
async function collectFiles(dir, exts, recursive, ignoreDirs, verbose, includeInternal, internalMarker, outFile) {
|
|
155
183
|
const found = [];
|
|
156
184
|
const entries = await fs.readdir(dir, { withFileTypes: true });
|
|
157
185
|
for (const entry of entries) {
|
|
158
186
|
const fullPath = path.join(dir, entry.name);
|
|
187
|
+
if (outFile && path.resolve(fullPath) === path.resolve(outFile)) {
|
|
188
|
+
if (verbose) {
|
|
189
|
+
relinka("log", `Skipping output file: ${fullPath}`);
|
|
190
|
+
}
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
159
193
|
if (entry.isDirectory()) {
|
|
160
194
|
if (ignoreDirs.includes(entry.name)) {
|
|
161
195
|
if (verbose) {
|
|
@@ -171,7 +205,8 @@ async function collectFiles(dir, exts, recursive, ignoreDirs, verbose, includeIn
|
|
|
171
205
|
ignoreDirs,
|
|
172
206
|
verbose,
|
|
173
207
|
includeInternal,
|
|
174
|
-
internalMarker
|
|
208
|
+
internalMarker,
|
|
209
|
+
outFile
|
|
175
210
|
);
|
|
176
211
|
found.push(...sub);
|
|
177
212
|
}
|
|
@@ -239,20 +274,46 @@ async function generateAggregatorLines(filePath, inputDir, stripPrefix, useImpor
|
|
|
239
274
|
async function getNamedExports(filePath) {
|
|
240
275
|
try {
|
|
241
276
|
const code = await fs.readFile(filePath, "utf-8");
|
|
242
|
-
const pattern = /^export\s+(?:async\s+)?(function|const|class|let|type|interface)\s+([A-Za-z0-9_$]+)/gm;
|
|
243
277
|
const typeNamesSet = /* @__PURE__ */ new Set();
|
|
244
278
|
const valueNamesSet = /* @__PURE__ */ new Set();
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
279
|
+
const patterns = [
|
|
280
|
+
// Regular exports and default exports
|
|
281
|
+
/^export\s+(?:default\s+)?(?:async\s+)?(function|const|class|let|var|type|interface|enum)\s+([A-Za-z0-9_$]+)/gm,
|
|
282
|
+
// Named exports and re-exports
|
|
283
|
+
/^export\s*{([^}]+)}(?:\s+from\s+['"][^'"]+['"])?/gm,
|
|
284
|
+
// Export assignments
|
|
285
|
+
/^export\s*=\s*([A-Za-z0-9_$]+)/gm
|
|
286
|
+
];
|
|
287
|
+
for (const pattern of patterns) {
|
|
288
|
+
let match;
|
|
289
|
+
while (true) {
|
|
290
|
+
match = pattern.exec(code);
|
|
291
|
+
if (!match) break;
|
|
292
|
+
const matchGroups = match;
|
|
293
|
+
if (pattern.source.includes("{([^}]+)}") && matchGroups[1]) {
|
|
294
|
+
const exports = (matchGroups[1] ?? "").split(",").map(
|
|
295
|
+
(e) => e?.trim()?.split(/\s+as\s+/)?.[0]?.trim() ?? ""
|
|
296
|
+
);
|
|
297
|
+
for (const exp of exports) {
|
|
298
|
+
const name = exp.replace(/^type\s+/, "");
|
|
299
|
+
if (exp.startsWith("type ")) {
|
|
300
|
+
typeNamesSet.add(name);
|
|
301
|
+
} else {
|
|
302
|
+
valueNamesSet.add(name);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
} else if (pattern.source.includes("=\\s*([A-Za-z0-9_$]+)") && matchGroups[1]) {
|
|
306
|
+
valueNamesSet.add(matchGroups[1]);
|
|
254
307
|
} else {
|
|
255
|
-
|
|
308
|
+
const keyword = matchGroups[1];
|
|
309
|
+
const name = matchGroups[2];
|
|
310
|
+
if (keyword && name) {
|
|
311
|
+
if (keyword === "type" || keyword === "interface" || keyword === "enum") {
|
|
312
|
+
typeNamesSet.add(name);
|
|
313
|
+
} else {
|
|
314
|
+
valueNamesSet.add(name);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
256
317
|
}
|
|
257
318
|
}
|
|
258
319
|
}
|
package/bin/app/cmds.d.ts
CHANGED
|
@@ -85,6 +85,40 @@ export declare function cmdAgg(): Promise<import("@reliverse/rempts").Command<{
|
|
|
85
85
|
description: string;
|
|
86
86
|
type: "string";
|
|
87
87
|
};
|
|
88
|
+
sort: {
|
|
89
|
+
description: string;
|
|
90
|
+
type: "boolean";
|
|
91
|
+
default: false;
|
|
92
|
+
};
|
|
93
|
+
header: {
|
|
94
|
+
description: string;
|
|
95
|
+
type: "string";
|
|
96
|
+
};
|
|
97
|
+
verbose: {
|
|
98
|
+
description: string;
|
|
99
|
+
type: "boolean";
|
|
100
|
+
default: false;
|
|
101
|
+
};
|
|
102
|
+
includeInternal: {
|
|
103
|
+
description: string;
|
|
104
|
+
type: "boolean";
|
|
105
|
+
default: false;
|
|
106
|
+
};
|
|
107
|
+
internalMarker: {
|
|
108
|
+
description: string;
|
|
109
|
+
type: "string";
|
|
110
|
+
default: string;
|
|
111
|
+
};
|
|
112
|
+
override: {
|
|
113
|
+
description: string;
|
|
114
|
+
type: "boolean";
|
|
115
|
+
default: false;
|
|
116
|
+
};
|
|
117
|
+
extensions: {
|
|
118
|
+
description: string;
|
|
119
|
+
type: "string";
|
|
120
|
+
default: string;
|
|
121
|
+
};
|
|
88
122
|
}>>;
|
|
89
123
|
export declare function cmdBuild(): Promise<import("@reliverse/rempts").Command<{
|
|
90
124
|
dev: {
|
package/bin/app/deps/cmd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
1
2
|
import { re } from "@reliverse/relico";
|
|
2
3
|
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
3
|
-
import path from "pathe";
|
|
4
4
|
import { analyzeDependencies } from "./impl/analyzer.js";
|
|
5
5
|
import { formatOutput } from "./impl/formatter.js";
|
|
6
6
|
export default defineCommand({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DependencyResult, FinderOptions } from "./types.js";
|
|
1
|
+
import type { DependencyResult, FinderOptions } from "./deps-types.js";
|
|
2
2
|
export declare const analyzeDependencies: (options: FinderOptions) => Promise<DependencyResult>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PackageJson } from "./types.js";
|
|
1
|
+
import type { PackageJson } from "./deps-types.js";
|
|
2
2
|
export declare const findSourceFiles: (directory: string, ignorePatterns: string[]) => Promise<string[]>;
|
|
3
3
|
export declare const readFile: (filePath: string) => Promise<string>;
|
|
4
4
|
export declare const readPackageJson: (directory: string) => Promise<PackageJson>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { DependencyResult, FinderOptions } from "./types.js";
|
|
1
|
+
import type { DependencyResult, FinderOptions } from "./deps-types.js";
|
|
2
2
|
export declare const formatOutput: (result: DependencyResult, options: FinderOptions) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PackageJson } from "./types.js";
|
|
1
|
+
import type { PackageJson } from "./deps-types.js";
|
|
2
2
|
export declare const extractPackageNames: (fileContent: string) => Set<string>;
|
|
3
3
|
export declare const normalizePackageName: (importPath: string) => string | null;
|
|
4
4
|
export declare const getListedDependencies: (packageJson: PackageJson) => Set<string>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import path from "@reliverse/pathkit";
|
|
2
|
+
import fs from "@reliverse/relifso";
|
|
1
3
|
import { relinka } from "@reliverse/relinka";
|
|
2
4
|
import { execa } from "execa";
|
|
3
|
-
import fs from "fs-extra";
|
|
4
|
-
import path from "pathe";
|
|
5
5
|
function parseCommand(command) {
|
|
6
6
|
const regex = /"([^"]+)"|'([^']+)'|(\S+)/g;
|
|
7
7
|
const args = [];
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
+
in: {
|
|
3
|
+
type: "array";
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
ignore: {
|
|
7
|
+
type: "array";
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
out: {
|
|
11
|
+
type: "string";
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
format: {
|
|
15
|
+
type: "string";
|
|
16
|
+
default: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
stdout: {
|
|
20
|
+
type: "boolean";
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
noPath: {
|
|
24
|
+
type: "boolean";
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
separator: {
|
|
28
|
+
type: "string";
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
comment: {
|
|
32
|
+
type: "string";
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
forceComment: {
|
|
36
|
+
type: "boolean";
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
batch: {
|
|
40
|
+
type: "boolean";
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
export default _default;
|