@reliverse/dler 1.7.117 → 1.7.119
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/bin/app/build/binary-flow.d.ts +6 -0
- package/bin/app/build/binary-flow.js +153 -0
- package/bin/app/build/build-library.d.ts +0 -1
- package/bin/app/build/build-library.js +0 -5
- package/bin/app/build/build-regular.d.ts +2 -2
- package/bin/app/build/build-regular.js +3 -8
- package/bin/app/build/impl.js +2 -0
- package/bin/app/build/regular-flow.js +0 -4
- package/bin/app/config/comments.js +2 -2
- package/bin/app/config/constants.d.ts +1 -1
- package/bin/app/config/constants.js +1 -1
- package/bin/app/config/prepare.js +31 -0
- package/bin/app/providers/better-t-stack/types.d.ts +5 -5
- package/bin/app/providers/reliverse-stack/rs-impl.d.ts +2 -2
- package/bin/app/schema/gen.js +110 -2
- package/bin/app/schema/mod.d.ts +105 -0
- package/bin/app/schema/mod.js +16 -2
- package/bin/app/toolbox/toolbox-impl.d.ts +0 -2
- package/bin/app/toolbox/toolbox-impl.js +1 -50
- package/bin/app/utils/common.d.ts +8 -2
- package/bin/app/utils/common.js +14 -5
- package/bin/app/utils/schemaMemory.d.ts +2 -2
- package/bin/app/utils/startEndPrompts.d.ts +1 -1
- package/bin/app/utils/startEndPrompts.js +2 -2
- package/bin/mod.d.ts +1 -1
- package/bin/mod.js +1 -2
- package/package.json +8 -8
- package/bin/app/build/binary/cmd.d.ts +0 -113
- package/bin/app/build/binary/cmd.js +0 -226
- package/bin/app/build/cmd.d.ts +0 -25
- package/bin/app/build/cmd.js +0 -59
- package/bin/app/pub/cmd.d.ts +0 -17
- package/bin/app/pub/cmd.js +0 -42
- package/bin/app/toolbox/cmd.d.ts +0 -7
- package/bin/app/toolbox/cmd.js +0 -37
- package/bin/dler.d.ts +0 -1
- package/bin/dler.js +0 -2
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { join } from "@reliverse/pathkit";
|
|
2
|
-
import { existsSync, mkdir } from "@reliverse/relifso";
|
|
3
|
-
import { relinka } from "@reliverse/relinka";
|
|
4
|
-
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
5
|
-
import {
|
|
6
|
-
buildForTarget,
|
|
7
|
-
cleanOutputDir,
|
|
8
|
-
getOutputFileName,
|
|
9
|
-
listAvailableTargets,
|
|
10
|
-
parseTargets,
|
|
11
|
-
validateInputFile
|
|
12
|
-
} from "../providers/bun/single-file.js";
|
|
13
|
-
function getTargetPrefix(inputFile) {
|
|
14
|
-
const filename = inputFile.split("/").pop()?.split("\\").pop() || "";
|
|
15
|
-
const nameWithoutExt = filename.replace(/\.[^/.]+$/, "");
|
|
16
|
-
return nameWithoutExt;
|
|
17
|
-
}
|
|
18
|
-
function generateDefaultTargets(prefix) {
|
|
19
|
-
const platforms = ["linux", "windows", "darwin"];
|
|
20
|
-
const architectures = ["x64", "arm64"];
|
|
21
|
-
const targets = platforms.flatMap(
|
|
22
|
-
(platform) => architectures.map((arch) => `${prefix}-${platform}-${arch}`)
|
|
23
|
-
);
|
|
24
|
-
return targets.join(",");
|
|
25
|
-
}
|
|
26
|
-
export default defineCommand({
|
|
27
|
-
meta: {
|
|
28
|
-
name: "bundler",
|
|
29
|
-
description: "Bundle your project into standalone executables for different platforms"
|
|
30
|
-
},
|
|
31
|
-
args: defineArgs({
|
|
32
|
-
input: {
|
|
33
|
-
type: "string",
|
|
34
|
-
description: "Input TypeScript file to bundle",
|
|
35
|
-
// default: "src-ts/dler.ts",
|
|
36
|
-
required: true
|
|
37
|
-
},
|
|
38
|
-
targets: {
|
|
39
|
-
type: "string",
|
|
40
|
-
description: "Comma-separated list of targets to build for (use 'all' for all targets, 'list' to show available targets)",
|
|
41
|
-
default: "all"
|
|
42
|
-
// Will be dynamically generated based on input filename
|
|
43
|
-
// Note: Target format is {prefix}-{platform}-{arch} where prefix is extracted from input filename
|
|
44
|
-
// Platforms: linux, windows, darwin (macOS)
|
|
45
|
-
// Architectures: x64, arm64
|
|
46
|
-
// Examples: dler-linux-x64, dler-windows-arm64, dler-darwin-x64
|
|
47
|
-
},
|
|
48
|
-
outdir: {
|
|
49
|
-
type: "string",
|
|
50
|
-
description: "Output directory for built executables",
|
|
51
|
-
default: "dist"
|
|
52
|
-
},
|
|
53
|
-
minify: {
|
|
54
|
-
type: "boolean",
|
|
55
|
-
description: "Minify the output",
|
|
56
|
-
default: true
|
|
57
|
-
},
|
|
58
|
-
sourcemap: {
|
|
59
|
-
type: "boolean",
|
|
60
|
-
description: "Generate source maps",
|
|
61
|
-
default: true
|
|
62
|
-
},
|
|
63
|
-
bytecode: {
|
|
64
|
-
type: "boolean",
|
|
65
|
-
description: "Enable bytecode compilation for faster startup",
|
|
66
|
-
default: false
|
|
67
|
-
},
|
|
68
|
-
clean: {
|
|
69
|
-
type: "boolean",
|
|
70
|
-
description: "Clean output directory before building",
|
|
71
|
-
default: true
|
|
72
|
-
},
|
|
73
|
-
"windows-icon": {
|
|
74
|
-
type: "string",
|
|
75
|
-
description: "Path to Windows .ico file for executable icon"
|
|
76
|
-
},
|
|
77
|
-
"windows-hide-console": {
|
|
78
|
-
type: "boolean",
|
|
79
|
-
description: "Hide console window on Windows",
|
|
80
|
-
default: false
|
|
81
|
-
},
|
|
82
|
-
"asset-naming": {
|
|
83
|
-
type: "string",
|
|
84
|
-
description: "Asset naming pattern",
|
|
85
|
-
default: "[name]-[hash].[ext]"
|
|
86
|
-
},
|
|
87
|
-
parallel: {
|
|
88
|
-
type: "boolean",
|
|
89
|
-
description: "Build targets in parallel",
|
|
90
|
-
default: true
|
|
91
|
-
},
|
|
92
|
-
external: {
|
|
93
|
-
type: "array",
|
|
94
|
-
description: "External dependencies to exclude from bundle",
|
|
95
|
-
default: ["c12", "terminal-kit"]
|
|
96
|
-
},
|
|
97
|
-
"no-compile": {
|
|
98
|
-
type: "boolean",
|
|
99
|
-
description: "Create a bundled script instead of standalone executable (for debugging terminal issues)",
|
|
100
|
-
default: false
|
|
101
|
-
}
|
|
102
|
-
}),
|
|
103
|
-
async run({ args }) {
|
|
104
|
-
try {
|
|
105
|
-
if (args.targets === "list") {
|
|
106
|
-
listAvailableTargets();
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
validateInputFile(args.input);
|
|
110
|
-
let targetsArg = args.targets;
|
|
111
|
-
if (targetsArg === "all" || !targetsArg) {
|
|
112
|
-
const prefix = getTargetPrefix(args.input);
|
|
113
|
-
targetsArg = generateDefaultTargets(prefix);
|
|
114
|
-
relinka("info", `Generated targets for '${prefix}': ${targetsArg}`);
|
|
115
|
-
}
|
|
116
|
-
const targets = parseTargets(targetsArg);
|
|
117
|
-
if (targets.length === 0) {
|
|
118
|
-
relinka("error", "No valid targets specified");
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
const options = {
|
|
122
|
-
minify: args.minify,
|
|
123
|
-
sourcemap: args.sourcemap,
|
|
124
|
-
bytecode: args.bytecode,
|
|
125
|
-
outdir: args.outdir,
|
|
126
|
-
clean: args.clean,
|
|
127
|
-
windowsIcon: args["windows-icon"],
|
|
128
|
-
windowsHideConsole: args["windows-hide-console"],
|
|
129
|
-
assetNaming: args["asset-naming"],
|
|
130
|
-
external: args.external,
|
|
131
|
-
compile: !args["no-compile"]
|
|
132
|
-
};
|
|
133
|
-
if (options.clean) {
|
|
134
|
-
await cleanOutputDir(options.outdir);
|
|
135
|
-
} else if (!existsSync(options.outdir)) {
|
|
136
|
-
await mkdir(options.outdir, { recursive: true });
|
|
137
|
-
}
|
|
138
|
-
const buildType = options.compile ? "executable(s)" : "bundled script(s)";
|
|
139
|
-
relinka("info", `Building ${targets.length} ${buildType} from ${args.input}`);
|
|
140
|
-
if (!options.compile) {
|
|
141
|
-
relinka("info", "Running in script bundle mode (--no-compile)");
|
|
142
|
-
}
|
|
143
|
-
if (options.external && options.external.length > 0) {
|
|
144
|
-
relinka(
|
|
145
|
-
"info",
|
|
146
|
-
`External dependencies (excluded from bundle): ${options.external.join(", ")}`
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
if (options.bytecode && options.compile) {
|
|
150
|
-
relinka("warn", "Bytecode compilation is experimental (Bun v1.1.30+)");
|
|
151
|
-
} else if (options.bytecode && !options.compile) {
|
|
152
|
-
relinka("warn", "Bytecode compilation is only available with --compile flag");
|
|
153
|
-
}
|
|
154
|
-
if (args.parallel && targets.length > 1) {
|
|
155
|
-
relinka("info", "Building targets in parallel...");
|
|
156
|
-
const buildPromises = targets.map((target) => buildForTarget(target, args.input, options));
|
|
157
|
-
const results = await Promise.allSettled(buildPromises);
|
|
158
|
-
let successCount = 0;
|
|
159
|
-
let failureCount = 0;
|
|
160
|
-
for (const result of results) {
|
|
161
|
-
if (result.status === "fulfilled") {
|
|
162
|
-
successCount++;
|
|
163
|
-
} else {
|
|
164
|
-
failureCount++;
|
|
165
|
-
relinka("error", `Build failed: ${result.reason}`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
relinka("info", `Build completed: ${successCount} succeeded, ${failureCount} failed`);
|
|
169
|
-
if (failureCount > 0) {
|
|
170
|
-
if (successCount === 0) {
|
|
171
|
-
relinka("error", `\u274C All builds failed! No executables were generated.`);
|
|
172
|
-
} else {
|
|
173
|
-
relinka(
|
|
174
|
-
"warn",
|
|
175
|
-
`\u26A0\uFE0F Build completed with ${failureCount} failure(s). ${successCount} executable(s) available in: ${options.outdir}`
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
} else {
|
|
179
|
-
relinka("success", `\u{1F389} Build completed! All executables available in: ${options.outdir}`);
|
|
180
|
-
}
|
|
181
|
-
} else {
|
|
182
|
-
relinka("info", "Building targets sequentially...");
|
|
183
|
-
let sequentialSuccessCount = 0;
|
|
184
|
-
let sequentialFailureCount = 0;
|
|
185
|
-
for (const target of targets) {
|
|
186
|
-
try {
|
|
187
|
-
await buildForTarget(target, args.input, options);
|
|
188
|
-
sequentialSuccessCount++;
|
|
189
|
-
} catch (error) {
|
|
190
|
-
sequentialFailureCount++;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
if (sequentialFailureCount > 0) {
|
|
194
|
-
if (sequentialSuccessCount === 0) {
|
|
195
|
-
relinka("error", `\u274C All builds failed! No executables were generated.`);
|
|
196
|
-
} else {
|
|
197
|
-
relinka(
|
|
198
|
-
"warn",
|
|
199
|
-
`\u26A0\uFE0F Build completed with ${sequentialFailureCount} failure(s). ${sequentialSuccessCount} executable(s) available in: ${options.outdir}`
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
relinka("success", `\u{1F389} Build completed! All executables available in: ${options.outdir}`);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (existsSync(options.outdir)) {
|
|
207
|
-
const fileType = options.compile ? "executables" : "bundled scripts";
|
|
208
|
-
relinka("info", `Generated ${fileType}:`);
|
|
209
|
-
for (const target of targets) {
|
|
210
|
-
const filePath = join(options.outdir, getOutputFileName(target, "dler", options.compile));
|
|
211
|
-
if (existsSync(filePath)) {
|
|
212
|
-
const stat = await Bun.file(filePath).size;
|
|
213
|
-
const sizeMB = (stat / (1024 * 1024)).toFixed(2);
|
|
214
|
-
relinka(
|
|
215
|
-
"info",
|
|
216
|
-
` ${getOutputFileName(target, "dler", options.compile)} (${sizeMB} MB)`
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
} catch (error) {
|
|
222
|
-
relinka("error", `Build failed: ${error}`);
|
|
223
|
-
process.exit(1);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
});
|
package/bin/app/build/cmd.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
-
ci: {
|
|
3
|
-
type: "boolean";
|
|
4
|
-
description: string;
|
|
5
|
-
default: boolean;
|
|
6
|
-
};
|
|
7
|
-
dev: {
|
|
8
|
-
type: "boolean";
|
|
9
|
-
description: string;
|
|
10
|
-
};
|
|
11
|
-
cwd: {
|
|
12
|
-
type: "string";
|
|
13
|
-
description: string;
|
|
14
|
-
default: string;
|
|
15
|
-
};
|
|
16
|
-
debugOnlyCopyNonBuildFiles: {
|
|
17
|
-
type: "boolean";
|
|
18
|
-
description: string;
|
|
19
|
-
};
|
|
20
|
-
debugDontCopyNonBuildFiles: {
|
|
21
|
-
type: "boolean";
|
|
22
|
-
description: string;
|
|
23
|
-
};
|
|
24
|
-
}>;
|
|
25
|
-
export default _default;
|
package/bin/app/build/cmd.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
-
import { getConfigDler } from "../config/load.js";
|
|
3
|
-
import { commonEndActions, commonStartActions } from "../utils/common.js";
|
|
4
|
-
import { finalizeBuild } from "../utils/finalize.js";
|
|
5
|
-
import { getCurrentWorkingDirectory } from "../utils/terminalHelpers.js";
|
|
6
|
-
import { createPerfTimer } from "../utils/utils-perf.js";
|
|
7
|
-
import { dlerBuild } from "./impl.js";
|
|
8
|
-
export default defineCommand({
|
|
9
|
-
meta: {
|
|
10
|
-
name: "build",
|
|
11
|
-
description: ""
|
|
12
|
-
},
|
|
13
|
-
args: defineArgs({
|
|
14
|
-
// Common args
|
|
15
|
-
ci: {
|
|
16
|
-
type: "boolean",
|
|
17
|
-
description: "ci",
|
|
18
|
-
default: !process.stdout.isTTY || !!process.env["CI"]
|
|
19
|
-
},
|
|
20
|
-
dev: {
|
|
21
|
-
type: "boolean",
|
|
22
|
-
description: "dev"
|
|
23
|
-
},
|
|
24
|
-
cwd: {
|
|
25
|
-
type: "string",
|
|
26
|
-
description: "cwd",
|
|
27
|
-
default: getCurrentWorkingDirectory()
|
|
28
|
-
},
|
|
29
|
-
// Command specific args
|
|
30
|
-
debugOnlyCopyNonBuildFiles: {
|
|
31
|
-
type: "boolean",
|
|
32
|
-
description: "Only copy non-build files to dist directories"
|
|
33
|
-
},
|
|
34
|
-
debugDontCopyNonBuildFiles: {
|
|
35
|
-
type: "boolean",
|
|
36
|
-
description: "Don't copy non-build files to dist directories, only build buildPreExtensions files"
|
|
37
|
-
}
|
|
38
|
-
}),
|
|
39
|
-
run: async ({ args }) => {
|
|
40
|
-
const { ci, cwd, dev, debugOnlyCopyNonBuildFiles, debugDontCopyNonBuildFiles } = args;
|
|
41
|
-
const isCI = Boolean(ci);
|
|
42
|
-
const isDev = Boolean(dev);
|
|
43
|
-
const strCwd = String(cwd);
|
|
44
|
-
const isDebugOnlyCopyNonBuildFiles = Boolean(debugOnlyCopyNonBuildFiles);
|
|
45
|
-
const isDebugDontCopyNonBuildFiles = Boolean(debugDontCopyNonBuildFiles);
|
|
46
|
-
await commonStartActions({ isCI, isDev, strCwd });
|
|
47
|
-
const timer = createPerfTimer();
|
|
48
|
-
const config = await getConfigDler();
|
|
49
|
-
await dlerBuild(
|
|
50
|
-
timer,
|
|
51
|
-
isDev,
|
|
52
|
-
config,
|
|
53
|
-
isDebugOnlyCopyNonBuildFiles,
|
|
54
|
-
isDebugDontCopyNonBuildFiles
|
|
55
|
-
);
|
|
56
|
-
await finalizeBuild(timer, false, "build");
|
|
57
|
-
await commonEndActions();
|
|
58
|
-
}
|
|
59
|
-
});
|
package/bin/app/pub/cmd.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare const _default: import("@reliverse/rempts").Command<{
|
|
2
|
-
ci: {
|
|
3
|
-
type: "boolean";
|
|
4
|
-
description: string;
|
|
5
|
-
default: boolean;
|
|
6
|
-
};
|
|
7
|
-
cwd: {
|
|
8
|
-
type: "string";
|
|
9
|
-
description: string;
|
|
10
|
-
default: string;
|
|
11
|
-
};
|
|
12
|
-
dev: {
|
|
13
|
-
type: "boolean";
|
|
14
|
-
description: string;
|
|
15
|
-
};
|
|
16
|
-
}>;
|
|
17
|
-
export default _default;
|
package/bin/app/pub/cmd.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { defineArgs, defineCommand } from "@reliverse/rempts";
|
|
2
|
-
import { getConfigDler } from "../config/load.js";
|
|
3
|
-
import { commonEndActions, commonStartActions } from "../utils/common.js";
|
|
4
|
-
import { getCurrentWorkingDirectory } from "../utils/terminalHelpers.js";
|
|
5
|
-
import { createPerfTimer } from "../utils/utils-perf.js";
|
|
6
|
-
import { dlerPub } from "./impl.js";
|
|
7
|
-
export default defineCommand({
|
|
8
|
-
meta: {
|
|
9
|
-
name: "publish",
|
|
10
|
-
description: ""
|
|
11
|
-
},
|
|
12
|
-
args: defineArgs({
|
|
13
|
-
// Common args
|
|
14
|
-
ci: {
|
|
15
|
-
type: "boolean",
|
|
16
|
-
description: "ci",
|
|
17
|
-
default: !process.stdout.isTTY || !!process.env["CI"]
|
|
18
|
-
},
|
|
19
|
-
cwd: {
|
|
20
|
-
type: "string",
|
|
21
|
-
description: "cwd",
|
|
22
|
-
default: getCurrentWorkingDirectory()
|
|
23
|
-
},
|
|
24
|
-
dev: {
|
|
25
|
-
type: "boolean",
|
|
26
|
-
description: "dev"
|
|
27
|
-
}
|
|
28
|
-
// Command specific args
|
|
29
|
-
// ...
|
|
30
|
-
}),
|
|
31
|
-
run: async ({ args }) => {
|
|
32
|
-
const { ci, cwd, dev } = args;
|
|
33
|
-
const isCI = Boolean(ci);
|
|
34
|
-
const isDev = Boolean(dev);
|
|
35
|
-
const strCwd = String(cwd);
|
|
36
|
-
await commonStartActions({ isCI, isDev, strCwd });
|
|
37
|
-
const timer = createPerfTimer();
|
|
38
|
-
const config = await getConfigDler();
|
|
39
|
-
await dlerPub(timer, isDev, config);
|
|
40
|
-
await commonEndActions();
|
|
41
|
-
}
|
|
42
|
-
});
|
package/bin/app/toolbox/cmd.d.ts
DELETED
package/bin/app/toolbox/cmd.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { defineCommand } from "@reliverse/rempts";
|
|
2
|
-
import { getOrCreateReliverseConfig } from "../config/core-cfg.js";
|
|
3
|
-
import { showDevToolsMenu } from "./toolbox-impl.js";
|
|
4
|
-
import { getOrCreateReliverseMemory } from "../utils/reliverseMemory.js";
|
|
5
|
-
import { getCurrentWorkingDirectory } from "../utils/terminalHelpers.js";
|
|
6
|
-
export default defineCommand({
|
|
7
|
-
meta: {
|
|
8
|
-
name: "studio",
|
|
9
|
-
description: "Provides information on how to open rseo",
|
|
10
|
-
hidden: true
|
|
11
|
-
},
|
|
12
|
-
args: {
|
|
13
|
-
dev: {
|
|
14
|
-
type: "boolean",
|
|
15
|
-
default: false
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
run: async ({ args }) => {
|
|
19
|
-
const isDev = args.dev;
|
|
20
|
-
const cwd = getCurrentWorkingDirectory();
|
|
21
|
-
const { config } = await getOrCreateReliverseConfig({
|
|
22
|
-
projectPath: cwd,
|
|
23
|
-
isDev,
|
|
24
|
-
overrides: {}
|
|
25
|
-
});
|
|
26
|
-
const memory = await getOrCreateReliverseMemory();
|
|
27
|
-
await showDevToolsMenu({
|
|
28
|
-
projectName: "",
|
|
29
|
-
cwd,
|
|
30
|
-
isDev,
|
|
31
|
-
config,
|
|
32
|
-
memory,
|
|
33
|
-
skipPrompts: false
|
|
34
|
-
});
|
|
35
|
-
process.exit(0);
|
|
36
|
-
}
|
|
37
|
-
});
|
package/bin/dler.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/bin/dler.js
DELETED