@actiondock/builder 2.0.11 → 2.0.12
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/dist/archive.d.ts +26 -0
- package/dist/build.d.ts +41 -0
- package/dist/compiler.d.ts +22 -0
- package/dist/errors.d.ts +41 -0
- package/dist/exporter.d.ts +59 -0
- package/{src/index.ts → dist/index.d.ts} +1 -0
- package/dist/index.js +1875 -0
- package/dist/planner.d.ts +26 -0
- package/dist/types.d.ts +311 -0
- package/package.json +13 -14
- package/src/archive.ts +0 -248
- package/src/build.ts +0 -106
- package/src/compiler.ts +0 -303
- package/src/errors.ts +0 -67
- package/src/exporter.ts +0 -680
- package/src/planner.ts +0 -731
- package/src/types.ts +0 -337
package/src/build.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
import { generateStandaloneEntrypoint, getPackageSlug } from "@actiondock/core";
|
|
4
|
-
import { BunCompiler } from "./compiler";
|
|
5
|
-
import { BuilderError } from "./errors";
|
|
6
|
-
import { BuildPlanner } from "./planner";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 独立二进制可执行文件构建选项。
|
|
10
|
-
*/
|
|
11
|
-
export interface BuildOptions {
|
|
12
|
-
/** 目标项目根目录 */
|
|
13
|
-
projectRoot: string;
|
|
14
|
-
/** 目标架构(如 "bun-linux-x64", "bun-darwin-arm64", "bun-windows-x64" 等) */
|
|
15
|
-
target?: string;
|
|
16
|
-
/** 输出可执行文件的目标路径(默认输出到 dist/ 目录) */
|
|
17
|
-
outfile?: string;
|
|
18
|
-
/** 是否开启代码压缩混淆(默认 true) */
|
|
19
|
-
minify?: boolean;
|
|
20
|
-
/** 是否编译为 V8/JavaScriptCore 字节码(默认 true) */
|
|
21
|
-
bytecode?: boolean;
|
|
22
|
-
/** 显式挑选打包的 Action ID 清单(用于按需子集打包) */
|
|
23
|
-
actions?: string[];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* 独立二进制构建完成后的元数据结果对象。
|
|
28
|
-
*/
|
|
29
|
-
export interface BuildResult {
|
|
30
|
-
/** 所属 Package ID */
|
|
31
|
-
packageId: string;
|
|
32
|
-
/** 打包的项目版本号 */
|
|
33
|
-
version: string;
|
|
34
|
-
/** 编译的目标平台架构 */
|
|
35
|
-
target: string;
|
|
36
|
-
/** 生成的独立二进制可执行文件绝对路径 */
|
|
37
|
-
executablePath: string;
|
|
38
|
-
/** 生成的 sidecar 元数据 JSON 文件绝对路径 */
|
|
39
|
-
metadataPath: string;
|
|
40
|
-
/** 打包内置的 Action ID 列表 */
|
|
41
|
-
actions: string[];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* 调用 Bun 原生编译引擎(Bun.build --compile)将 Action Package 打包为零外部依赖的独立二进制可执行文件。
|
|
46
|
-
*
|
|
47
|
-
* @param options 构建参数
|
|
48
|
-
* @returns 构建产物结果元数据
|
|
49
|
-
*/
|
|
50
|
-
export async function buildProject(options: BuildOptions): Promise<BuildResult> {
|
|
51
|
-
const root = resolve(options.projectRoot);
|
|
52
|
-
const plan = BuildPlanner.plan({
|
|
53
|
-
projectRoot: root,
|
|
54
|
-
actions: options.actions,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
if (plan.actions.length === 0) {
|
|
58
|
-
throw new BuilderError("No actions resolved for standalone compilation");
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const buildDir = join(root, ".actiondock", ".build");
|
|
62
|
-
mkdirSync(buildDir, { recursive: true });
|
|
63
|
-
|
|
64
|
-
const entryCode = generateStandaloneEntrypoint(
|
|
65
|
-
plan.packageId,
|
|
66
|
-
plan.version,
|
|
67
|
-
plan.description,
|
|
68
|
-
plan.actions.map((a) => ({ id: a.id, filePath: a.resolvedPath })),
|
|
69
|
-
plan.configDefs
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const entryFileName = `entry-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.ts`;
|
|
73
|
-
const entryPath = join(buildDir, entryFileName);
|
|
74
|
-
writeFileSync(entryPath, entryCode, "utf-8");
|
|
75
|
-
|
|
76
|
-
const binaryName = getPackageSlug(plan.packageId);
|
|
77
|
-
const defaultOutfile = join(root, "dist", binaryName);
|
|
78
|
-
const outfile = resolve(options.outfile || defaultOutfile);
|
|
79
|
-
|
|
80
|
-
try {
|
|
81
|
-
const result = await BunCompiler.compile({
|
|
82
|
-
entrypoint: entryPath,
|
|
83
|
-
outfile,
|
|
84
|
-
target: options.target,
|
|
85
|
-
minify: options.minify,
|
|
86
|
-
bytecode: options.bytecode,
|
|
87
|
-
cwd: root,
|
|
88
|
-
packageId: plan.packageId,
|
|
89
|
-
version: plan.version,
|
|
90
|
-
actions: plan.actions.map((a) => a.id),
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
packageId: result.packageId || plan.packageId,
|
|
95
|
-
version: result.version || plan.version,
|
|
96
|
-
target: result.target,
|
|
97
|
-
executablePath: result.executablePath,
|
|
98
|
-
metadataPath: result.metadataPath || "",
|
|
99
|
-
actions: plan.actions.map((a) => a.id),
|
|
100
|
-
};
|
|
101
|
-
} finally {
|
|
102
|
-
if (existsSync(entryPath)) {
|
|
103
|
-
rmSync(entryPath, { force: true });
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
package/src/compiler.ts
DELETED
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { createHash } from "node:crypto";
|
|
3
|
-
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { basename, dirname, resolve } from "node:path";
|
|
5
|
-
import { CompilerError, CompilerValidationError } from "./errors";
|
|
6
|
-
import type { BunCompilerOptions, BunCompilerResult } from "./types";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 官方支持的 Bun 独立二进制编译目标列表。
|
|
10
|
-
*/
|
|
11
|
-
const SUPPORTED_TARGETS = new Set<string>([
|
|
12
|
-
"bun",
|
|
13
|
-
"host",
|
|
14
|
-
"bun-linux-x64",
|
|
15
|
-
"linux-x64",
|
|
16
|
-
"bun-linux-arm64",
|
|
17
|
-
"linux-arm64",
|
|
18
|
-
"bun-darwin-x64",
|
|
19
|
-
"darwin-x64",
|
|
20
|
-
"bun-darwin-arm64",
|
|
21
|
-
"darwin-arm64",
|
|
22
|
-
"bun-windows-x64",
|
|
23
|
-
"windows-x64",
|
|
24
|
-
"bun-linux-x64-baseline",
|
|
25
|
-
"linux-x64-baseline",
|
|
26
|
-
"bun-linux-x64-modern",
|
|
27
|
-
"linux-x64-modern",
|
|
28
|
-
]);
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 校验目标架构并规范化。
|
|
32
|
-
*/
|
|
33
|
-
function normalizeAndValidateTarget(target?: string): string {
|
|
34
|
-
if (!target || target === "host" || target === "bun") {
|
|
35
|
-
return "bun";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const cleanTarget = target.trim();
|
|
39
|
-
if (!SUPPORTED_TARGETS.has(cleanTarget)) {
|
|
40
|
-
throw new CompilerValidationError(
|
|
41
|
-
`Unsupported compilation target: '${target}'. Standalone compilation only supports Bun targets (e.g. linux-x64, linux-arm64, darwin-x64, darwin-arm64, windows-x64).`,
|
|
42
|
-
{ code: "UNSUPPORTED_TARGET", target }
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return cleanTarget.startsWith("bun-") ? cleanTarget : `bun-${cleanTarget}`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 规范化编译器错误输出。
|
|
51
|
-
*/
|
|
52
|
-
function normalizeCompilerError(rawStderr: string, rawStdout: string, exitCode: number, target?: string): CompilerError {
|
|
53
|
-
const combined = `${rawStderr}\n${rawStdout}`.trim();
|
|
54
|
-
const lines = combined
|
|
55
|
-
.split(/\r?\n/)
|
|
56
|
-
.map((l) => l.trim())
|
|
57
|
-
.filter((l) => l.length > 0);
|
|
58
|
-
|
|
59
|
-
let code = "COMPILATION_FAILED";
|
|
60
|
-
if (combined.includes("Unsupported target")) {
|
|
61
|
-
code = "UNSUPPORTED_TARGET";
|
|
62
|
-
} else if (
|
|
63
|
-
combined.includes("Cannot find package") ||
|
|
64
|
-
combined.includes("Cannot find module") ||
|
|
65
|
-
combined.includes("Could not resolve")
|
|
66
|
-
) {
|
|
67
|
-
code = "MODULE_NOT_FOUND";
|
|
68
|
-
} else if (
|
|
69
|
-
combined.includes("SyntaxError") ||
|
|
70
|
-
combined.includes("Parse error") ||
|
|
71
|
-
combined.includes("Expected") ||
|
|
72
|
-
combined.includes("Unexpected")
|
|
73
|
-
) {
|
|
74
|
-
code = "SYNTAX_ERROR";
|
|
75
|
-
} else if (combined.includes("EACCES") || combined.includes("Permission denied")) {
|
|
76
|
-
code = "PERMISSION_DENIED";
|
|
77
|
-
} else if (combined.includes("ENOSPC") || combined.includes("no space left")) {
|
|
78
|
-
code = "NO_SPACE";
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const summaryLine = lines.find((l) => l.startsWith("error:")) || lines[0] || "Bun compilation failed";
|
|
82
|
-
|
|
83
|
-
return new CompilerError(
|
|
84
|
-
`Bun compilation failed with exit code ${exitCode} (${code}): ${summaryLine}`,
|
|
85
|
-
{
|
|
86
|
-
code,
|
|
87
|
-
exitCode,
|
|
88
|
-
rawError: combined,
|
|
89
|
-
details: lines,
|
|
90
|
-
target,
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Bun 独立二进制编译器。
|
|
97
|
-
* 封装 bun build --compile 调用,提前校验选项组合,收集构建产物与元数据。
|
|
98
|
-
*/
|
|
99
|
-
export class BunCompiler {
|
|
100
|
-
/**
|
|
101
|
-
* 执行独立二进制编译。
|
|
102
|
-
*
|
|
103
|
-
* @param options 编译参数
|
|
104
|
-
* @returns 编译产物元数据结果
|
|
105
|
-
*/
|
|
106
|
-
public async compile(options: BunCompilerOptions): Promise<BunCompilerResult> {
|
|
107
|
-
const startTime = Date.now();
|
|
108
|
-
|
|
109
|
-
// 1. 入口点存在性校验
|
|
110
|
-
if (!options.entrypoint) {
|
|
111
|
-
throw new CompilerValidationError("Entrypoint must be specified for standalone compilation", {
|
|
112
|
-
code: "INVALID_ENTRYPOINT",
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const resolvedEntry = resolve(options.entrypoint);
|
|
117
|
-
if (!existsSync(resolvedEntry)) {
|
|
118
|
-
throw new CompilerValidationError(
|
|
119
|
-
`Entrypoint file not found: ${options.entrypoint}`,
|
|
120
|
-
{ code: "ENTRYPOINT_NOT_FOUND" }
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// 2. 输出路径校验
|
|
125
|
-
if (!options.outfile) {
|
|
126
|
-
throw new CompilerValidationError("Outfile path must be specified for standalone compilation", {
|
|
127
|
-
code: "INVALID_OUTFILE",
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const resolvedOutfile = resolve(options.outfile);
|
|
132
|
-
const outDir = dirname(resolvedOutfile);
|
|
133
|
-
mkdirSync(outDir, { recursive: true });
|
|
134
|
-
|
|
135
|
-
// 3. 目标平台与选项校验
|
|
136
|
-
const normalizedTarget = normalizeAndValidateTarget(options.target);
|
|
137
|
-
const isWindowsTarget =
|
|
138
|
-
normalizedTarget.includes("windows") ||
|
|
139
|
-
(!options.target && process.platform === "win32");
|
|
140
|
-
|
|
141
|
-
// 校验布尔选项
|
|
142
|
-
if (options.minify !== undefined && typeof options.minify !== "boolean") {
|
|
143
|
-
throw new CompilerValidationError("Option 'minify' must be a boolean", {
|
|
144
|
-
code: "INVALID_MINIFY_OPTION",
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
if (options.bytecode !== undefined && typeof options.bytecode !== "boolean") {
|
|
148
|
-
throw new CompilerValidationError("Option 'bytecode' must be a boolean", {
|
|
149
|
-
code: "INVALID_BYTECODE_OPTION",
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// 4. 组装 Bun build 命令参数
|
|
154
|
-
const args = [
|
|
155
|
-
"bun",
|
|
156
|
-
"build",
|
|
157
|
-
resolvedEntry,
|
|
158
|
-
"--compile",
|
|
159
|
-
"--outfile",
|
|
160
|
-
resolvedOutfile,
|
|
161
|
-
];
|
|
162
|
-
|
|
163
|
-
const bytecode = options.bytecode !== false;
|
|
164
|
-
if (bytecode) {
|
|
165
|
-
args.push("--bytecode");
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const minify = options.minify !== false;
|
|
169
|
-
if (minify) {
|
|
170
|
-
args.push("--minify");
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (normalizedTarget !== "bun") {
|
|
174
|
-
args.push(`--target=${normalizedTarget}`);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// 5. 执行外部编译器进程
|
|
178
|
-
const cwd = options.cwd ? resolve(options.cwd) : dirname(resolvedEntry);
|
|
179
|
-
const proc = spawnSync(args[0], args.slice(1), {
|
|
180
|
-
cwd,
|
|
181
|
-
stdio: "pipe",
|
|
182
|
-
env: {
|
|
183
|
-
...process.env,
|
|
184
|
-
...options.env,
|
|
185
|
-
},
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
if (proc.error) {
|
|
189
|
-
if ((proc.error as any).code === "ENOENT") {
|
|
190
|
-
throw new CompilerError(
|
|
191
|
-
"Bun binary not found in PATH. Standalone compilation requires Bun to be installed (e.g. via 'curl -fsSL https://bun.sh/install | bash' or 'npm install -g bun').",
|
|
192
|
-
{
|
|
193
|
-
code: "BUN_NOT_FOUND",
|
|
194
|
-
exitCode: 1,
|
|
195
|
-
rawError: proc.error.message,
|
|
196
|
-
target: options.target,
|
|
197
|
-
}
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
throw new CompilerError(`Failed to spawn Bun compiler: ${proc.error.message}`, {
|
|
201
|
-
code: "SPAWN_FAILED",
|
|
202
|
-
exitCode: 1,
|
|
203
|
-
rawError: proc.error.message,
|
|
204
|
-
target: options.target,
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (proc.status !== 0) {
|
|
209
|
-
const rawStderr = proc.stderr?.toString("utf-8") || "";
|
|
210
|
-
const rawStdout = proc.stdout?.toString("utf-8") || "";
|
|
211
|
-
throw normalizeCompilerError(rawStderr, rawStdout, proc.status ?? 1, options.target);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// 6. 解析生成的可执行二进制物理路径(适配 Windows .exe 后缀特性)
|
|
215
|
-
let actualExecutablePath = resolvedOutfile;
|
|
216
|
-
if (!existsSync(actualExecutablePath) && isWindowsTarget) {
|
|
217
|
-
const withExe = `${resolvedOutfile}.exe`;
|
|
218
|
-
if (existsSync(withExe)) {
|
|
219
|
-
actualExecutablePath = withExe;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (!existsSync(actualExecutablePath)) {
|
|
224
|
-
throw new CompilerError(
|
|
225
|
-
`Compiler completed with exit code 0 but output executable not found at ${resolvedOutfile}`,
|
|
226
|
-
{
|
|
227
|
-
code: "OUTPUT_NOT_FOUND",
|
|
228
|
-
exitCode: 0,
|
|
229
|
-
rawError: "Output executable file not found on disk",
|
|
230
|
-
target: options.target,
|
|
231
|
-
}
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// 7. 计算二进制大小与校验和
|
|
236
|
-
const binaryBuffer = readFileSync(actualExecutablePath);
|
|
237
|
-
const sizeBytes = statSync(actualExecutablePath).size;
|
|
238
|
-
const sha256 = createHash("sha256").update(binaryBuffer).digest("hex");
|
|
239
|
-
const durationMs = Date.now() - startTime;
|
|
240
|
-
const compiledAt = new Date().toISOString();
|
|
241
|
-
|
|
242
|
-
// 8. 写入 metadata 产物文件
|
|
243
|
-
let metadataPath: string | undefined;
|
|
244
|
-
if (options.emitMetadata !== false) {
|
|
245
|
-
metadataPath = resolve(outDir, "artifact.json");
|
|
246
|
-
const bunVersion =
|
|
247
|
-
(typeof (globalThis as any).Bun !== "undefined" && (globalThis as any).Bun.version) ||
|
|
248
|
-
(() => {
|
|
249
|
-
try {
|
|
250
|
-
const vProc = spawnSync("bun", ["--version"], { stdio: "pipe" });
|
|
251
|
-
if (vProc.status === 0) {
|
|
252
|
-
return vProc.stdout.toString().trim();
|
|
253
|
-
}
|
|
254
|
-
} catch {}
|
|
255
|
-
return "unknown";
|
|
256
|
-
})();
|
|
257
|
-
|
|
258
|
-
const metadata = {
|
|
259
|
-
packageId: options.packageId,
|
|
260
|
-
version: options.version,
|
|
261
|
-
target: options.target || "host",
|
|
262
|
-
executable: basename(actualExecutablePath),
|
|
263
|
-
sizeBytes,
|
|
264
|
-
sha256,
|
|
265
|
-
bunVersion,
|
|
266
|
-
minify,
|
|
267
|
-
bytecode,
|
|
268
|
-
actions: options.actions || [],
|
|
269
|
-
compiledAt,
|
|
270
|
-
};
|
|
271
|
-
writeFileSync(metadataPath, JSON.stringify(metadata, null, 2) + "\n", "utf-8");
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return {
|
|
275
|
-
packageId: options.packageId,
|
|
276
|
-
version: options.version,
|
|
277
|
-
target: options.target || "host",
|
|
278
|
-
executablePath: actualExecutablePath,
|
|
279
|
-
sizeBytes,
|
|
280
|
-
sha256,
|
|
281
|
-
metadataPath,
|
|
282
|
-
minify,
|
|
283
|
-
bytecode,
|
|
284
|
-
durationMs,
|
|
285
|
-
compiledAt,
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* 静态辅助调用方法。
|
|
291
|
-
*/
|
|
292
|
-
public static async compile(options: BunCompilerOptions): Promise<BunCompilerResult> {
|
|
293
|
-
const compiler = new BunCompiler();
|
|
294
|
-
return compiler.compile(options);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* 快捷独立二进制编译函数。
|
|
300
|
-
*/
|
|
301
|
-
export async function compileBinary(options: BunCompilerOptions): Promise<BunCompilerResult> {
|
|
302
|
-
return BunCompiler.compile(options);
|
|
303
|
-
}
|
package/src/errors.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builder 模块基础错误类。
|
|
3
|
-
*/
|
|
4
|
-
export class BuilderError extends Error {
|
|
5
|
-
constructor(message: string) {
|
|
6
|
-
super(message);
|
|
7
|
-
this.name = "BuilderError";
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* 构建规划阶段抛出的错误。
|
|
13
|
-
*/
|
|
14
|
-
export class PlannerError extends BuilderError {
|
|
15
|
-
public readonly code: string;
|
|
16
|
-
|
|
17
|
-
constructor(message: string, code = "PLANNER_ERROR") {
|
|
18
|
-
super(message);
|
|
19
|
-
this.name = "PlannerError";
|
|
20
|
-
this.code = code;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 编译器参数与目标平台校验错误。
|
|
26
|
-
*/
|
|
27
|
-
export class CompilerValidationError extends BuilderError {
|
|
28
|
-
public readonly code: string;
|
|
29
|
-
public readonly target?: string;
|
|
30
|
-
|
|
31
|
-
constructor(message: string, options: { code?: string; target?: string } = {}) {
|
|
32
|
-
super(message);
|
|
33
|
-
this.name = "CompilerValidationError";
|
|
34
|
-
this.code = options.code || "COMPILER_VALIDATION_ERROR";
|
|
35
|
-
this.target = options.target;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* 编译器调用执行失败错误。包含标准化错误码与详情。
|
|
41
|
-
*/
|
|
42
|
-
export class CompilerError extends BuilderError {
|
|
43
|
-
public readonly code: string;
|
|
44
|
-
public readonly exitCode: number;
|
|
45
|
-
public readonly rawError: string;
|
|
46
|
-
public readonly details: string[];
|
|
47
|
-
public readonly target?: string;
|
|
48
|
-
|
|
49
|
-
constructor(
|
|
50
|
-
message: string,
|
|
51
|
-
options: {
|
|
52
|
-
code: string;
|
|
53
|
-
exitCode: number;
|
|
54
|
-
rawError: string;
|
|
55
|
-
details?: string[];
|
|
56
|
-
target?: string;
|
|
57
|
-
}
|
|
58
|
-
) {
|
|
59
|
-
super(message);
|
|
60
|
-
this.name = "CompilerError";
|
|
61
|
-
this.code = options.code;
|
|
62
|
-
this.exitCode = options.exitCode;
|
|
63
|
-
this.rawError = options.rawError;
|
|
64
|
-
this.details = options.details || [];
|
|
65
|
-
this.target = options.target;
|
|
66
|
-
}
|
|
67
|
-
}
|