@reliverse/dler 1.7.16 → 1.7.18
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 +134 -206
- package/bin/app/agg/run.js +2 -8
- package/bin/app/build/cmd.js +4 -4
- package/bin/app/build/impl.d.ts +2 -6
- package/bin/app/build/impl.js +2 -46
- package/bin/app/conv/cmd.d.ts +8 -33
- package/bin/app/conv/cmd.js +185 -163
- package/bin/app/copy/cmd.js +1 -1
- package/bin/app/init/init-impl.js +3 -3
- package/bin/app/init/init-types.d.ts +8 -8
- package/bin/app/merge/cmd.d.ts +10 -24
- package/bin/app/merge/cmd.js +47 -464
- package/bin/app/migrate/codemods/anything-bun.js +1 -1
- package/bin/app/migrate/codemods/fs-relifso.d.ts +2 -2
- package/bin/app/migrate/codemods/fs-relifso.js +1 -1
- package/bin/app/migrate/codemods/nodenext-bundler.d.ts +2 -2
- package/bin/app/migrate/codemods/nodenext-bundler.js +1 -1
- package/bin/app/migrate/codemods/path-pathkit.d.ts +2 -2
- package/bin/app/migrate/codemods/path-pathkit.js +1 -1
- package/bin/app/migrate/codemods/readdir-glob.d.ts +2 -2
- package/bin/app/migrate/codemods/readdir-glob.js +1 -1
- package/bin/app/mkdist/cmd.js +4 -2
- package/bin/app/pack/cmd.d.ts +44 -0
- package/bin/app/pack/cmd.js +313 -0
- package/bin/app/pub/cmd.js +4 -4
- package/bin/app/pub/impl.d.ts +7 -0
- package/bin/app/pub/impl.js +97 -0
- package/bin/app/rename/cmd.js +1 -1
- package/bin/app/spell/cmd.d.ts +14 -5
- package/bin/app/spell/cmd.js +33 -33
- package/bin/app/spell/old.js +0 -0
- package/bin/app/{mock → unpack}/cmd.d.ts +10 -14
- package/bin/app/unpack/cmd.js +200 -0
- package/bin/cli.js +2 -2
- package/bin/libs/cfg/cfg-mod.d.ts +69 -0
- package/bin/libs/cfg/cfg-mod.js +61 -0
- package/bin/libs/cfg/rse/rse-impl/rse-biome.d.ts +2 -0
- package/bin/libs/cfg/rse/rse-impl/rse-biome.js +34 -0
- package/bin/libs/cfg/rse/rse-impl/rse-consts.d.ts +35 -0
- package/bin/libs/cfg/rse/rse-impl/rse-consts.js +37 -0
- package/bin/libs/cfg/rse/rse-impl/rse-content.d.ts +14 -0
- package/bin/libs/cfg/rse/rse-impl/rse-content.js +15 -0
- package/bin/libs/cfg/rse/rse-impl/rse-core.d.ts +14 -0
- package/bin/libs/cfg/rse/rse-impl/rse-core.js +63 -0
- package/bin/libs/cfg/rse/rse-impl/rse-create.d.ts +36 -0
- package/bin/libs/cfg/rse/rse-impl/rse-create.js +254 -0
- package/bin/libs/cfg/rse/rse-impl/rse-def-utils.d.ts +6 -0
- package/bin/libs/cfg/rse/rse-impl/rse-def-utils.js +225 -0
- package/bin/libs/cfg/rse/rse-impl/rse-default.d.ts +3 -0
- package/bin/libs/cfg/rse/rse-impl/rse-default.js +155 -0
- package/bin/libs/cfg/rse/rse-impl/rse-define.d.ts +125 -0
- package/bin/libs/cfg/rse/rse-impl/rse-define.js +4 -0
- package/bin/libs/cfg/rse/rse-impl/rse-detect.d.ts +23 -0
- package/bin/libs/cfg/rse/rse-impl/rse-detect.js +347 -0
- package/bin/libs/cfg/rse/rse-impl/rse-gen-cfg.d.ts +3 -0
- package/bin/libs/cfg/rse/rse-impl/rse-gen-cfg.js +186 -0
- package/bin/libs/cfg/rse/rse-impl/rse-inject.d.ts +1 -0
- package/bin/libs/cfg/rse/rse-impl/rse-inject.js +57 -0
- package/bin/libs/cfg/rse/rse-impl/rse-migrate.d.ts +5 -0
- package/bin/libs/cfg/rse/rse-impl/rse-migrate.js +56 -0
- package/bin/libs/cfg/rse/rse-impl/rse-path.d.ts +11 -0
- package/bin/libs/cfg/rse/rse-impl/rse-path.js +33 -0
- package/bin/libs/cfg/rse/rse-impl/rse-prompts.d.ts +5 -0
- package/bin/libs/cfg/rse/rse-impl/rse-prompts.js +12 -0
- package/bin/libs/cfg/rse/rse-impl/rse-read.d.ts +11 -0
- package/bin/libs/cfg/rse/rse-impl/rse-read.js +84 -0
- package/bin/libs/cfg/rse/rse-impl/rse-repair.d.ts +16 -0
- package/bin/libs/cfg/rse/rse-impl/rse-repair.js +137 -0
- package/bin/libs/cfg/rse/rse-impl/rse-schema.d.ts +130 -0
- package/bin/libs/cfg/rse/rse-impl/rse-schema.js +444 -0
- package/bin/libs/cfg/rse/rse-impl/rse-types.d.ts +75 -0
- package/bin/libs/cfg/rse/rse-impl/rse-types.js +0 -0
- package/bin/libs/cfg/rse/rse-impl/rse-unstable.d.ts +11 -0
- package/bin/libs/cfg/rse/rse-impl/rse-unstable.js +41 -0
- package/bin/libs/cfg/rse/rse-impl/rse-update.d.ts +10 -0
- package/bin/libs/cfg/rse/rse-impl/rse-update.js +152 -0
- package/bin/libs/cfg/rse/rse-impl/rse-utils.d.ts +17 -0
- package/bin/libs/cfg/rse/rse-impl/rse-utils.js +86 -0
- package/bin/libs/cfg/rse/rse-mod.d.ts +20 -0
- package/bin/libs/cfg/rse/rse-mod.js +20 -0
- package/bin/libs/cfg/types.d.ts +533 -0
- package/bin/libs/cfg/types.js +0 -0
- package/bin/libs/sdk/sdk-impl/build/build-library.d.ts +5 -5
- package/bin/libs/sdk/sdk-impl/build/build-library.js +1 -174
- package/bin/libs/sdk/sdk-impl/build/build-regular.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/build.js +287 -240
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/loaders/vue.d.ts +4 -4
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.d.ts +8 -5
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/make.js +199 -119
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/spinner.d.ts +99 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-impl/utils/spinner.js +206 -0
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/mkdist/mkdist-mod.js +92 -46
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/rollup/plugins/raw.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/build/bundlers/unified/utils.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/config/default.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/{cfg → config}/default.js +8 -18
- package/bin/libs/sdk/sdk-impl/{cfg → config}/info.js +1 -1
- package/bin/libs/sdk/sdk-impl/{cfg → config}/init.js +53 -43
- package/bin/libs/sdk/sdk-impl/{cfg → config}/load.d.ts +2 -2
- package/bin/libs/sdk/sdk-impl/{cfg → config}/load.js +6 -6
- package/bin/libs/sdk/sdk-impl/config/types.d.ts +533 -0
- package/bin/libs/sdk/sdk-impl/config/types.js +0 -0
- package/bin/libs/sdk/sdk-impl/library-flow.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/regular-flow.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/dler-config-health/dler-config-health.js +2 -2
- package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/deps-types.d.ts +6 -6
- package/bin/libs/sdk/sdk-impl/rules/reliverse/missing-deps/filesystem.js +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/no-index-files/no-index-files.js +1 -1
- package/bin/libs/sdk/sdk-impl/rules/reliverse/self-include/self-include.js +2 -2
- package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.d.ts +38 -0
- package/bin/libs/sdk/sdk-impl/spell/applyMagicSpells.js +474 -0
- package/bin/libs/sdk/sdk-impl/spell/spells.d.ts +31 -0
- package/bin/libs/sdk/sdk-impl/spell/spells.js +85 -0
- package/bin/libs/sdk/sdk-impl/utils/binary.js +1 -1
- package/bin/libs/sdk/sdk-impl/utils/comments.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/utils/comments.js +41 -0
- package/bin/libs/sdk/sdk-impl/utils/finalize.d.ts +2 -1
- package/bin/libs/sdk/sdk-impl/utils/finalize.js +1 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.d.ts +6 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-constants.js +7 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.d.ts +5 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-file-utils.js +40 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.d.ts +24 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pu-types.js +0 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.d.ts +17 -0
- package/bin/libs/sdk/sdk-impl/utils/pack-unpack/pub-json-utils.js +46 -0
- package/bin/libs/sdk/sdk-impl/utils/replacements.d.ts +0 -0
- package/bin/libs/sdk/sdk-impl/utils/replacements.js +0 -0
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.d.ts +3 -0
- package/bin/libs/sdk/sdk-impl/utils/resolve-cross-libs.js +194 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-build.d.ts +1 -2
- package/bin/libs/sdk/sdk-impl/utils/utils-clean.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-deps.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-determine.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.d.ts +4 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-error-cwd.js +1 -0
- package/bin/libs/sdk/sdk-impl/utils/utils-jsr-json.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-package-json-libraries.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-package-json-regular.d.ts +1 -1
- package/bin/libs/sdk/sdk-impl/utils/utils-security.d.ts +1 -3
- package/bin/libs/sdk/sdk-impl/utils/utils-security.js +11 -10
- package/bin/libs/sdk/sdk-mod.d.ts +1 -6
- package/bin/libs/sdk/sdk-mod.js +0 -31
- package/bin/libs/sdk/sdk-types.d.ts +39 -582
- package/bin/mod.d.ts +1 -1
- package/bin/mod.js +1 -1
- package/package.json +12 -4
- package/bin/app/mock/cmd.js +0 -284
- package/bin/app/mock/mock.d.ts +0 -11
- package/bin/app/mock/mock.js +0 -97
- package/bin/libs/sdk/sdk-impl/cfg/default.d.ts +0 -5
- package/bin/libs/sdk/sdk-impl/cfg/define.d.ts +0 -2
- package/bin/libs/sdk/sdk-impl/cfg/define.js +0 -4
- package/bin/libs/sdk/sdk-impl/spell/spell-executors.d.ts +0 -10
- package/bin/libs/sdk/sdk-impl/spell/spell-executors.js +0 -307
- package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.d.ts +0 -7
- package/bin/libs/sdk/sdk-impl/spell/spell-filesystem.js +0 -74
- package/bin/libs/sdk/sdk-impl/spell/spell-mod.d.ts +0 -4
- package/bin/libs/sdk/sdk-impl/spell/spell-mod.js +0 -87
- package/bin/libs/sdk/sdk-impl/spell/spell-parser.d.ts +0 -4
- package/bin/libs/sdk/sdk-impl/spell/spell-parser.js +0 -58
- package/bin/libs/sdk/sdk-impl/spell/spell-types.d.ts +0 -60
- /package/bin/{libs/sdk/sdk-impl/spell/spell-types.js → app/spell/old.d.ts} +0 -0
- /package/bin/libs/sdk/sdk-impl/{cfg → config}/info.d.ts +0 -0
- /package/bin/libs/sdk/sdk-impl/{cfg → config}/init.d.ts +0 -0
|
@@ -2,60 +2,106 @@ import { relative, dirname as pathDirname } from "@reliverse/pathkit";
|
|
|
2
2
|
import { relinka } from "@reliverse/relinka";
|
|
3
3
|
import { rmdir, symlink, warn } from "../utils.js";
|
|
4
4
|
import { mkdist } from "./mkdist-impl/make.js";
|
|
5
|
+
import { useSpinner } from "./mkdist-impl/utils/spinner.js";
|
|
5
6
|
export async function mkdistBuild(ctx) {
|
|
6
7
|
const entries = ctx.options.entries.filter((e) => e.builder === "mkdist");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
await
|
|
13
|
-
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
if (entries.length === 0) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
await useSpinner.promise(
|
|
12
|
+
async (mainSpinner) => {
|
|
13
|
+
await ctx.hooks.callHook("mkdist:entries", ctx, entries);
|
|
14
|
+
let processedEntries = 0;
|
|
15
|
+
let totalWrittenFiles = 0;
|
|
16
|
+
let totalErrors = 0;
|
|
17
|
+
for (const entry of entries) {
|
|
18
|
+
processedEntries++;
|
|
19
|
+
mainSpinner.setProgress({
|
|
20
|
+
current: processedEntries,
|
|
21
|
+
total: entries.length
|
|
22
|
+
});
|
|
23
|
+
mainSpinner.setText(
|
|
24
|
+
`Processing entry ${processedEntries}/${entries.length}: ${entry.input}`
|
|
25
|
+
);
|
|
26
|
+
const distDir = entry.outDir || entry.input;
|
|
27
|
+
if (ctx.options.transpileStub) {
|
|
28
|
+
await rmdir(distDir);
|
|
29
|
+
await symlink(entry.input, distDir);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
let srcDir;
|
|
33
|
+
if (typeof entry.input === "string" && !entry.input.endsWith("/")) {
|
|
34
|
+
srcDir = ctx.options.isLib ? pathDirname(entry.input) : entry.input;
|
|
35
|
+
relinka(
|
|
36
|
+
"verbose",
|
|
37
|
+
`[mkdist] Using directory from file path: ${srcDir} (from: ${entry.input})`
|
|
38
|
+
);
|
|
39
|
+
} else {
|
|
40
|
+
srcDir = entry.input;
|
|
41
|
+
relinka("verbose", `[mkdist] Using directory directly: ${srcDir}`);
|
|
42
|
+
}
|
|
43
|
+
const mkdistOptions = {
|
|
44
|
+
cleanDist: false,
|
|
45
|
+
distDir,
|
|
46
|
+
rootDir: ctx.options.rootDir,
|
|
47
|
+
srcDir,
|
|
48
|
+
format: "esm",
|
|
49
|
+
ext: entry.ext || "js",
|
|
50
|
+
...entry
|
|
51
|
+
};
|
|
17
52
|
relinka(
|
|
18
|
-
"
|
|
19
|
-
`[mkdist]
|
|
53
|
+
"info",
|
|
54
|
+
`[mkdist] Building with options: srcDir=${mkdistOptions.srcDir}, distDir=${mkdistOptions.distDir}, rootDir=${mkdistOptions.rootDir}`
|
|
20
55
|
);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
});
|
|
45
|
-
await ctx.hooks.callHook("mkdist:entry:build", ctx, entry, output);
|
|
46
|
-
if (output.errors) {
|
|
47
|
-
for (const error of output.errors) {
|
|
56
|
+
await ctx.hooks.callHook("mkdist:entry:options", ctx, entry, mkdistOptions);
|
|
57
|
+
try {
|
|
58
|
+
const { result: output, duration } = await mkdist(mkdistOptions);
|
|
59
|
+
relinka("verbose", `[mkdist] Entry ${processedEntries} completed in ${duration}ms`);
|
|
60
|
+
totalWrittenFiles += output.writtenFiles.length;
|
|
61
|
+
ctx.buildEntries.push({
|
|
62
|
+
chunks: output.writtenFiles.map((p) => relative(ctx.options.outDir, p)),
|
|
63
|
+
path: distDir,
|
|
64
|
+
isLib: ctx.options.isLib
|
|
65
|
+
});
|
|
66
|
+
await ctx.hooks.callHook("mkdist:entry:build", ctx, entry, output);
|
|
67
|
+
if (output.errors && output.errors.length > 0) {
|
|
68
|
+
totalErrors += output.errors.length;
|
|
69
|
+
for (const error of output.errors) {
|
|
70
|
+
warn(
|
|
71
|
+
ctx,
|
|
72
|
+
`mkdist build failed for \`${relative(ctx.options.rootDir, error.filename)}\`:
|
|
73
|
+
${error.errors.map((e) => ` - ${e}`).join("\n")}`
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} catch (error) {
|
|
78
|
+
totalErrors++;
|
|
48
79
|
warn(
|
|
49
80
|
ctx,
|
|
50
|
-
`mkdist build failed for
|
|
51
|
-
${error.errors.map((e) => ` - ${e}`).join("\n")}`
|
|
81
|
+
`mkdist build failed for entry ${entry.input}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
52
82
|
);
|
|
53
83
|
}
|
|
54
84
|
}
|
|
85
|
+
await ctx.hooks.callHook("mkdist:done", ctx);
|
|
86
|
+
if (entries.length > 0 && ctx.options.transpileWatch) {
|
|
87
|
+
relinka("warn", "`mkdist` builder does not support transpileWatch mode yet.");
|
|
88
|
+
}
|
|
89
|
+
if (totalErrors > 0) {
|
|
90
|
+
mainSpinner.warn(
|
|
91
|
+
`Processed ${entries.length} entries with ${totalErrors} errors. ${totalWrittenFiles} files written.`
|
|
92
|
+
);
|
|
93
|
+
} else {
|
|
94
|
+
mainSpinner.setText(
|
|
95
|
+
`Successfully processed ${entries.length} entries. ${totalWrittenFiles} files written.`
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
text: entries.length === 1 ? "Processing mkdist entry..." : `Processing ${entries.length} mkdist entries...`,
|
|
101
|
+
color: "blue",
|
|
102
|
+
successText: entries.length === 1 ? "mkdist entry completed!" : `All ${entries.length} mkdist entries completed!`,
|
|
103
|
+
failText: "mkdist build failed!",
|
|
104
|
+
prefixText: "[mkdist]"
|
|
55
105
|
}
|
|
56
|
-
|
|
57
|
-
await ctx.hooks.callHook("mkdist:done", ctx);
|
|
58
|
-
if (entries.length > 0 && ctx.options.transpileWatch) {
|
|
59
|
-
relinka("warn", "`mkdist` builder does not support transpileWatch mode yet.");
|
|
60
|
-
}
|
|
106
|
+
);
|
|
61
107
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FilterPattern } from "@rollup/pluginutils";
|
|
2
2
|
import type { Plugin } from "rollup";
|
|
3
|
-
|
|
3
|
+
interface RawLoaderOptions {
|
|
4
4
|
exclude?: FilterPattern;
|
|
5
5
|
include?: FilterPattern;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
export declare function rawPlugin(opts?: RawLoaderOptions): Plugin;
|
|
8
8
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { PackageJson } from "pkg-types";
|
|
2
2
|
import type { BuildContext, BuildPreset, UnifiedBuildConfig } from "../../../../sdk-types.js";
|
|
3
|
-
|
|
3
|
+
interface OutputDescriptor {
|
|
4
4
|
file: string;
|
|
5
5
|
type?: "cjs" | "esm";
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
export declare function arrayIncludes(arr: (RegExp | string)[], searchElement: string): boolean;
|
|
8
8
|
export declare function dumpObject(obj: Record<string, any>): string;
|
|
9
9
|
export declare function extractExportFilenames(exports: PackageJson["exports"], conditions?: string[]): OutputDescriptor[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const DEFAULT_CONFIG_DLER = {
|
|
2
2
|
bumpDisable: false,
|
|
3
3
|
bumpFilter: ["package.json", ".config/rse.ts"],
|
|
4
4
|
bumpMode: "patch",
|
|
@@ -11,10 +11,7 @@ export const DEFAULT_CONFIG = {
|
|
|
11
11
|
coreEntryFile: "mod.ts",
|
|
12
12
|
coreEntrySrcDir: "src",
|
|
13
13
|
coreBuildOutDir: "bin",
|
|
14
|
-
coreIsCLI: {
|
|
15
|
-
enabled: false,
|
|
16
|
-
scripts: {}
|
|
17
|
-
},
|
|
14
|
+
coreIsCLI: { enabled: false, scripts: {} },
|
|
18
15
|
distJsrAllowDirty: true,
|
|
19
16
|
distJsrBuilder: "jsr",
|
|
20
17
|
distJsrDirName: "dist-jsr",
|
|
@@ -37,12 +34,7 @@ export const DEFAULT_CONFIG = {
|
|
|
37
34
|
global: ["@types", "biome", "eslint", "knip", "prettier", "typescript", "@reliverse/dler"],
|
|
38
35
|
"dist-npm": [],
|
|
39
36
|
"dist-jsr": [],
|
|
40
|
-
"dist-libs": {
|
|
41
|
-
"@reliverse/dler-sdk": {
|
|
42
|
-
npm: [],
|
|
43
|
-
jsr: []
|
|
44
|
-
}
|
|
45
|
-
}
|
|
37
|
+
"dist-libs": {}
|
|
46
38
|
},
|
|
47
39
|
// Build setup
|
|
48
40
|
transpileFailOnWarn: false,
|
|
@@ -58,13 +50,11 @@ export const DEFAULT_CONFIG = {
|
|
|
58
50
|
// Publish artifacts configuration
|
|
59
51
|
publishArtifacts: {
|
|
60
52
|
global: ["package.json", "README.md", "LICENSE"],
|
|
61
|
-
"dist-jsr": [
|
|
53
|
+
"dist-jsr": [],
|
|
62
54
|
"dist-npm": [],
|
|
63
|
-
"dist-libs": {
|
|
64
|
-
"@reliverse/dler-sdk": {
|
|
65
|
-
jsr: ["jsr.json"],
|
|
66
|
-
npm: []
|
|
67
|
-
}
|
|
68
|
-
}
|
|
55
|
+
"dist-libs": {}
|
|
69
56
|
}
|
|
70
57
|
};
|
|
58
|
+
export const defineConfigDler = (userConfig = {}) => {
|
|
59
|
+
return { ...DEFAULT_CONFIG_DLER, ...userConfig };
|
|
60
|
+
};
|
|
@@ -2,7 +2,7 @@ import path from "@reliverse/pathkit";
|
|
|
2
2
|
import fs from "@reliverse/relifso";
|
|
3
3
|
import { relinka } from "@reliverse/relinka";
|
|
4
4
|
import { readPackageJSON } from "pkg-types";
|
|
5
|
-
import {
|
|
5
|
+
import { DEFAULT_CONFIG_DLER } from "./default.js";
|
|
6
6
|
const CONFIG_FILENAME = ".config/dler.ts";
|
|
7
7
|
export async function ensureDlerConfig(isDev) {
|
|
8
8
|
const configPath = path.resolve(process.cwd(), CONFIG_FILENAME);
|
|
@@ -49,7 +49,7 @@ function getBumpFilter(isDev) {
|
|
|
49
49
|
return isDev ? `[
|
|
50
50
|
"package.json",
|
|
51
51
|
".config/rse.ts",
|
|
52
|
-
"src/libs/sdk/sdk-impl/
|
|
52
|
+
"src/libs/sdk/sdk-impl/config/info.ts",
|
|
53
53
|
]` : `["package.json", ".config/rse.ts"]`;
|
|
54
54
|
}
|
|
55
55
|
function getPublishArtifacts(isDev) {
|
|
@@ -112,17 +112,17 @@ function getFilterDepsPatterns(isDev) {
|
|
|
112
112
|
}`;
|
|
113
113
|
}
|
|
114
114
|
function generateConfig(isDev, pkgDescription) {
|
|
115
|
-
const
|
|
116
|
-
const verboseValue = getValue(isDev, true,
|
|
115
|
+
const importDefineConfigDlerStatement = isDev ? `import { defineConfigDler } from "../../../../mod.js";` : `import { defineConfigDler } from "@reliverse/cfg";`;
|
|
116
|
+
const verboseValue = getValue(isDev, true, DEFAULT_CONFIG_DLER.commonVerbose);
|
|
117
117
|
const coreIsCLI = getCoreIsCLI(isDev);
|
|
118
|
-
const registryValue = getValue(isDev, "npm-jsr",
|
|
119
|
-
const pausePublishValue = getValue(isDev, false,
|
|
118
|
+
const registryValue = getValue(isDev, "npm-jsr", DEFAULT_CONFIG_DLER.commonPubRegistry);
|
|
119
|
+
const pausePublishValue = getValue(isDev, false, DEFAULT_CONFIG_DLER.commonPubPause);
|
|
120
120
|
const coreDescriptionValue = getValue(
|
|
121
121
|
isDev,
|
|
122
122
|
"dler (prev. relidler) is a flexible, unified, and fully automated bundler for TypeScript and JavaScript projects, as well as an NPM and JSR publishing tool.",
|
|
123
|
-
pkgDescription ||
|
|
123
|
+
pkgDescription || DEFAULT_CONFIG_DLER.coreDescription
|
|
124
124
|
);
|
|
125
|
-
const libsActModeValue = getValue(isDev, "main-and-libs",
|
|
125
|
+
const libsActModeValue = getValue(isDev, "main-and-libs", DEFAULT_CONFIG_DLER.libsActMode);
|
|
126
126
|
const libsObject = isDev ? `{
|
|
127
127
|
"@reliverse/dler-sdk": {
|
|
128
128
|
libDeclarations: true,
|
|
@@ -134,31 +134,41 @@ function generateConfig(isDev, pkgDescription) {
|
|
|
134
134
|
libPubPause: false,
|
|
135
135
|
libPubRegistry: "npm-jsr",
|
|
136
136
|
},
|
|
137
|
+
"@reliverse/cfg": {
|
|
138
|
+
libDeclarations: true,
|
|
139
|
+
libDescription: "shared config for @reliverse/dler (defineConfigDler) and @reliverse/rse (defineConfigRse)",
|
|
140
|
+
libDirName: "cfg",
|
|
141
|
+
libMainFile: "cfg/cfg-mod.ts",
|
|
142
|
+
libPkgKeepDeps: true,
|
|
143
|
+
libTranspileMinify: true,
|
|
144
|
+
libPubPause: false,
|
|
145
|
+
libPubRegistry: "npm-jsr",
|
|
146
|
+
},
|
|
137
147
|
}` : `{
|
|
138
148
|
// "@acme/cli-libName": {
|
|
139
149
|
// libDeclarations: true,
|
|
140
|
-
// libDescription: "@acme/cli
|
|
150
|
+
// libDescription: "@acme/cli defineConfigAcme",
|
|
141
151
|
// libDirName: "libName",
|
|
142
152
|
// libMainFile: "libName/libName-mod.ts",
|
|
143
153
|
// libPkgKeepDeps: true,
|
|
144
154
|
// libTranspileMinify: true,
|
|
145
155
|
// libPubPause: false,
|
|
146
|
-
// libPubRegistry: "npm
|
|
156
|
+
// libPubRegistry: "npm",
|
|
147
157
|
// },
|
|
148
158
|
}`;
|
|
149
159
|
const configTemplate = [
|
|
150
|
-
|
|
160
|
+
importDefineConfigDlerStatement,
|
|
151
161
|
"",
|
|
152
162
|
"/**",
|
|
153
163
|
" * Reliverse Bundler Configuration",
|
|
154
164
|
" * Hover over a field to see more details",
|
|
155
165
|
" * @see https://github.com/reliverse/dler",
|
|
156
166
|
" */",
|
|
157
|
-
"export default
|
|
167
|
+
"export default defineConfigDler({",
|
|
158
168
|
" // Bump configuration",
|
|
159
|
-
" bumpDisable: " +
|
|
169
|
+
" bumpDisable: " + DEFAULT_CONFIG_DLER.bumpDisable + ",",
|
|
160
170
|
" bumpFilter: " + getBumpFilter(isDev) + ",",
|
|
161
|
-
' bumpMode: "' +
|
|
171
|
+
' bumpMode: "' + DEFAULT_CONFIG_DLER.bumpMode + '",',
|
|
162
172
|
"",
|
|
163
173
|
" // Common configuration",
|
|
164
174
|
" commonPubPause: " + pausePublishValue + ",",
|
|
@@ -166,40 +176,40 @@ function generateConfig(isDev, pkgDescription) {
|
|
|
166
176
|
" commonVerbose: " + verboseValue + ",",
|
|
167
177
|
"",
|
|
168
178
|
" // Core configuration",
|
|
169
|
-
' coreBuildOutDir: "' +
|
|
170
|
-
" coreDeclarations: " +
|
|
179
|
+
' coreBuildOutDir: "' + DEFAULT_CONFIG_DLER.coreBuildOutDir + '",',
|
|
180
|
+
" coreDeclarations: " + DEFAULT_CONFIG_DLER.coreDeclarations + ",",
|
|
171
181
|
" coreDescription: " + JSON.stringify(coreDescriptionValue) + ",",
|
|
172
|
-
' coreEntryFile: "' +
|
|
173
|
-
' coreEntrySrcDir: "' +
|
|
182
|
+
' coreEntryFile: "' + DEFAULT_CONFIG_DLER.coreEntryFile + '",',
|
|
183
|
+
' coreEntrySrcDir: "' + DEFAULT_CONFIG_DLER.coreEntrySrcDir + '",',
|
|
174
184
|
" " + coreIsCLI,
|
|
175
185
|
"",
|
|
176
186
|
" // JSR-only config",
|
|
177
|
-
" distJsrAllowDirty: " +
|
|
178
|
-
' distJsrBuilder: "' +
|
|
179
|
-
' distJsrDirName: "' +
|
|
180
|
-
" distJsrDryRun: " +
|
|
181
|
-
" distJsrFailOnWarn: " +
|
|
182
|
-
" distJsrGenTsconfig: " +
|
|
183
|
-
' distJsrOutFilesExt: "' +
|
|
184
|
-
" distJsrSlowTypes: " +
|
|
187
|
+
" distJsrAllowDirty: " + DEFAULT_CONFIG_DLER.distJsrAllowDirty + ",",
|
|
188
|
+
' distJsrBuilder: "' + DEFAULT_CONFIG_DLER.distJsrBuilder + '",',
|
|
189
|
+
' distJsrDirName: "' + DEFAULT_CONFIG_DLER.distJsrDirName + '",',
|
|
190
|
+
" distJsrDryRun: " + DEFAULT_CONFIG_DLER.distJsrDryRun + ",",
|
|
191
|
+
" distJsrFailOnWarn: " + DEFAULT_CONFIG_DLER.distJsrFailOnWarn + ",",
|
|
192
|
+
" distJsrGenTsconfig: " + DEFAULT_CONFIG_DLER.distJsrGenTsconfig + ",",
|
|
193
|
+
' distJsrOutFilesExt: "' + DEFAULT_CONFIG_DLER.distJsrOutFilesExt + '",',
|
|
194
|
+
" distJsrSlowTypes: " + DEFAULT_CONFIG_DLER.distJsrSlowTypes + ",",
|
|
185
195
|
"",
|
|
186
196
|
" // NPM-only config",
|
|
187
|
-
' distNpmBuilder: "' +
|
|
188
|
-
' distNpmDirName: "' +
|
|
189
|
-
' distNpmOutFilesExt: "' +
|
|
197
|
+
' distNpmBuilder: "' + DEFAULT_CONFIG_DLER.distNpmBuilder + '",',
|
|
198
|
+
' distNpmDirName: "' + DEFAULT_CONFIG_DLER.distNpmDirName + '",',
|
|
199
|
+
' distNpmOutFilesExt: "' + DEFAULT_CONFIG_DLER.distNpmOutFilesExt + '",',
|
|
190
200
|
"",
|
|
191
201
|
" // Libraries Dler Plugin",
|
|
192
202
|
" // Publish specific dirs as separate packages",
|
|
193
203
|
" // This feature is experimental at the moment",
|
|
194
204
|
" // Please commit your changes before using it",
|
|
195
205
|
' libsActMode: "' + libsActModeValue + '",',
|
|
196
|
-
' libsDirDist: "' +
|
|
197
|
-
' libsDirSrc: "' +
|
|
206
|
+
' libsDirDist: "' + DEFAULT_CONFIG_DLER.libsDirDist + '",',
|
|
207
|
+
' libsDirSrc: "' + DEFAULT_CONFIG_DLER.libsDirSrc + '",',
|
|
198
208
|
" libsList: " + libsObject + ",",
|
|
199
209
|
"",
|
|
200
210
|
" // @reliverse/relinka logger setup",
|
|
201
|
-
' logsFileName: "' +
|
|
202
|
-
" logsFreshFile: " +
|
|
211
|
+
' logsFileName: "' + DEFAULT_CONFIG_DLER.logsFileName + '",',
|
|
212
|
+
" logsFreshFile: " + DEFAULT_CONFIG_DLER.logsFreshFile + ",",
|
|
203
213
|
"",
|
|
204
214
|
" // Specifies what resources to send to npm and jsr registries.",
|
|
205
215
|
' // coreBuildOutDir (e.g. "bin") dir is automatically included.',
|
|
@@ -216,13 +226,13 @@ function generateConfig(isDev, pkgDescription) {
|
|
|
216
226
|
" // transpileAlias: {},",
|
|
217
227
|
" // transpileClean: true,",
|
|
218
228
|
" // transpileEntries: [],",
|
|
219
|
-
' transpileEsbuild: "' +
|
|
229
|
+
' transpileEsbuild: "' + DEFAULT_CONFIG_DLER.transpileEsbuild + '",',
|
|
220
230
|
" // transpileExternals: [],",
|
|
221
|
-
" transpileFailOnWarn: " +
|
|
222
|
-
' transpileFormat: "' +
|
|
223
|
-
" transpileMinify: " +
|
|
231
|
+
" transpileFailOnWarn: " + DEFAULT_CONFIG_DLER.transpileFailOnWarn + ",",
|
|
232
|
+
' transpileFormat: "' + DEFAULT_CONFIG_DLER.transpileFormat + '",',
|
|
233
|
+
" transpileMinify: " + DEFAULT_CONFIG_DLER.transpileMinify + ",",
|
|
224
234
|
" // transpileParallel: false,",
|
|
225
|
-
' transpilePublicPath: "' +
|
|
235
|
+
' transpilePublicPath: "' + DEFAULT_CONFIG_DLER.transpilePublicPath + '",',
|
|
226
236
|
" // transpileReplace: {},",
|
|
227
237
|
" // transpileRollup: {",
|
|
228
238
|
" // alias: {},",
|
|
@@ -234,12 +244,12 @@ function generateConfig(isDev, pkgDescription) {
|
|
|
234
244
|
" // resolve: {},",
|
|
235
245
|
" // },",
|
|
236
246
|
" // transpileShowOutLog: false,",
|
|
237
|
-
' transpileSourcemap: "' +
|
|
238
|
-
" transpileSplitting: " +
|
|
239
|
-
" transpileStub: " +
|
|
247
|
+
' transpileSourcemap: "' + DEFAULT_CONFIG_DLER.transpileSourcemap + '",',
|
|
248
|
+
" transpileSplitting: " + DEFAULT_CONFIG_DLER.transpileSplitting + ",",
|
|
249
|
+
" transpileStub: " + DEFAULT_CONFIG_DLER.transpileStub + ",",
|
|
240
250
|
" // transpileStubOptions: { jiti: {} },",
|
|
241
|
-
' transpileTarget: "' +
|
|
242
|
-
" transpileWatch: " +
|
|
251
|
+
' transpileTarget: "' + DEFAULT_CONFIG_DLER.transpileTarget + '",',
|
|
252
|
+
" transpileWatch: " + DEFAULT_CONFIG_DLER.transpileWatch + ",",
|
|
243
253
|
" // transpileWatchOptions: undefined,",
|
|
244
254
|
"});"
|
|
245
255
|
].join("\n");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { DlerConfig } from "
|
|
1
|
+
import type { DlerConfig } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Searches for and loads the configuration file `.config/dler.ts`.
|
|
4
4
|
* Falls back to default configuration if the file is not found.
|
|
5
5
|
* Uses jiti for seamless TypeScript and ESM support.
|
|
6
6
|
*/
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function getConfigDler(): Promise<DlerConfig>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { resolve } from "@reliverse/pathkit";
|
|
1
2
|
import fs from "@reliverse/relifso";
|
|
2
3
|
import { relinka } from "@reliverse/relinka";
|
|
3
4
|
import { createJiti } from "jiti";
|
|
4
|
-
import {
|
|
5
|
-
import { defineConfig } from "./define.js";
|
|
5
|
+
import { defineConfigDler } from "./default.js";
|
|
6
6
|
const CONFIG_FILENAME = ".config/dler.ts";
|
|
7
|
-
export async function
|
|
7
|
+
export async function getConfigDler() {
|
|
8
8
|
const cwd = process.cwd();
|
|
9
9
|
const configPath = resolve(cwd, CONFIG_FILENAME);
|
|
10
10
|
if (await fs.pathExists(configPath)) {
|
|
@@ -18,10 +18,10 @@ export async function loadConfig() {
|
|
|
18
18
|
if (typeof config === "function") {
|
|
19
19
|
const result = config();
|
|
20
20
|
if (result && typeof result === "object") {
|
|
21
|
-
return
|
|
21
|
+
return defineConfigDler(result);
|
|
22
22
|
}
|
|
23
23
|
} else if (config && typeof config === "object") {
|
|
24
|
-
return
|
|
24
|
+
return defineConfigDler(config);
|
|
25
25
|
}
|
|
26
26
|
throw new Error("Invalid config format");
|
|
27
27
|
} catch (error) {
|
|
@@ -29,5 +29,5 @@ export async function loadConfig() {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
relinka("log", `Config file not found at ${configPath}. Using default configuration.`);
|
|
32
|
-
return
|
|
32
|
+
return defineConfigDler();
|
|
33
33
|
}
|