sandlot 0.2.0 → 0.2.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/dist/browser/index.js +44 -46
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/types.d.ts +9 -1
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/core/sandbox.d.ts.map +1 -1
- package/dist/core/typechecker.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -46
- package/dist/node/index.js +44 -46
- package/dist/types.d.ts +10 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/commands/index.ts +18 -40
- package/src/commands/types.ts +36 -0
- package/src/core/sandbox.ts +3 -0
- package/src/core/typechecker.ts +4 -2
- package/src/index.ts +2 -0
- package/src/types.ts +11 -7
package/dist/browser/index.js
CHANGED
|
@@ -232,8 +232,9 @@ function parseTsConfig(fs, configPath) {
|
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
const parsed = ts.parseJsonConfigFileContent(config, parseHost, "/", undefined, configPath);
|
|
235
|
-
|
|
236
|
-
|
|
235
|
+
const relevantErrors = parsed.errors.filter((e) => e.code !== 18003);
|
|
236
|
+
if (relevantErrors.length > 0) {
|
|
237
|
+
console.warn("[typechecker] tsconfig parse errors:", relevantErrors.map((e) => e.messageText));
|
|
237
238
|
}
|
|
238
239
|
return {
|
|
239
240
|
...parsed.options,
|
|
@@ -1606,6 +1607,37 @@ ${padding}^`;
|
|
|
1606
1607
|
|
|
1607
1608
|
`);
|
|
1608
1609
|
}
|
|
1610
|
+
function formatBuildFailure(failure, prefix = "Build failed") {
|
|
1611
|
+
switch (failure.phase) {
|
|
1612
|
+
case "entry":
|
|
1613
|
+
return `${prefix}: ${failure.message}
|
|
1614
|
+
`;
|
|
1615
|
+
case "typecheck":
|
|
1616
|
+
if (failure.diagnostics && failure.diagnostics.length > 0) {
|
|
1617
|
+
const errors = failure.diagnostics.filter((d) => d.severity === "error");
|
|
1618
|
+
if (errors.length > 0) {
|
|
1619
|
+
return `${prefix}: Type check errors
|
|
1620
|
+
|
|
1621
|
+
${formatDiagnostics(errors)}
|
|
1622
|
+
`;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
return `${prefix}: Type check errors
|
|
1626
|
+
`;
|
|
1627
|
+
case "bundle":
|
|
1628
|
+
if (failure.bundleErrors && failure.bundleErrors.length > 0) {
|
|
1629
|
+
return `${prefix}: Bundle errors
|
|
1630
|
+
|
|
1631
|
+
${formatBundleErrors(failure.bundleErrors)}
|
|
1632
|
+
`;
|
|
1633
|
+
}
|
|
1634
|
+
return `${prefix}: Bundle error
|
|
1635
|
+
`;
|
|
1636
|
+
default:
|
|
1637
|
+
return `${prefix}: Unknown error
|
|
1638
|
+
`;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1609
1641
|
// src/commands/index.ts
|
|
1610
1642
|
function createSandlotCommand(sandboxRef) {
|
|
1611
1643
|
return defineCommand("sandlot", async (args, ctx) => {
|
|
@@ -1716,42 +1748,9 @@ Examples:
|
|
|
1716
1748
|
format
|
|
1717
1749
|
});
|
|
1718
1750
|
if (!result.success) {
|
|
1719
|
-
let stderr = `Build failed`;
|
|
1720
|
-
switch (result.phase) {
|
|
1721
|
-
case "entry":
|
|
1722
|
-
stderr = `Build failed: ${result.message}
|
|
1723
|
-
`;
|
|
1724
|
-
break;
|
|
1725
|
-
case "typecheck":
|
|
1726
|
-
if (result.diagnostics) {
|
|
1727
|
-
const errors = result.diagnostics.filter((d) => d.severity === "error");
|
|
1728
|
-
stderr = `Build failed: Type check errors
|
|
1729
|
-
|
|
1730
|
-
${formatDiagnostics(errors)}
|
|
1731
|
-
`;
|
|
1732
|
-
} else {
|
|
1733
|
-
stderr = `Build failed: Type check errors
|
|
1734
|
-
`;
|
|
1735
|
-
}
|
|
1736
|
-
break;
|
|
1737
|
-
case "bundle":
|
|
1738
|
-
if (result.bundleErrors && result.bundleErrors.length > 0) {
|
|
1739
|
-
stderr = `Build failed: Bundle errors
|
|
1740
|
-
|
|
1741
|
-
${formatBundleErrors(result.bundleErrors)}
|
|
1742
|
-
`;
|
|
1743
|
-
} else {
|
|
1744
|
-
stderr = `Build failed: Bundle error
|
|
1745
|
-
`;
|
|
1746
|
-
}
|
|
1747
|
-
break;
|
|
1748
|
-
default:
|
|
1749
|
-
stderr = `Build failed: Unknown error
|
|
1750
|
-
`;
|
|
1751
|
-
}
|
|
1752
1751
|
return {
|
|
1753
1752
|
stdout: "",
|
|
1754
|
-
stderr,
|
|
1753
|
+
stderr: formatBuildFailure(result),
|
|
1755
1754
|
exitCode: 1
|
|
1756
1755
|
};
|
|
1757
1756
|
}
|
|
@@ -1815,18 +1814,20 @@ Examples:
|
|
|
1815
1814
|
const formatted = formatDiagnostics(errors);
|
|
1816
1815
|
return {
|
|
1817
1816
|
stdout: "",
|
|
1818
|
-
stderr: `Type check failed
|
|
1817
|
+
stderr: `Type check failed
|
|
1818
|
+
|
|
1819
1819
|
${formatted}
|
|
1820
1820
|
`,
|
|
1821
1821
|
exitCode: 1
|
|
1822
1822
|
};
|
|
1823
1823
|
}
|
|
1824
1824
|
const warnings = result.diagnostics.filter((d) => d.severity === "warning");
|
|
1825
|
-
let output = `Type check passed
|
|
1825
|
+
let output = `Type check passed
|
|
1826
1826
|
`;
|
|
1827
1827
|
if (warnings.length > 0) {
|
|
1828
1828
|
output += `
|
|
1829
1829
|
Warnings:
|
|
1830
|
+
|
|
1830
1831
|
${formatDiagnostics(warnings)}
|
|
1831
1832
|
`;
|
|
1832
1833
|
}
|
|
@@ -2001,13 +2002,7 @@ Examples:
|
|
|
2001
2002
|
if (!result.success) {
|
|
2002
2003
|
let stderr = "";
|
|
2003
2004
|
if (result.buildFailure) {
|
|
2004
|
-
stderr =
|
|
2005
|
-
if (result.buildFailure.message) {
|
|
2006
|
-
stderr += `
|
|
2007
|
-
${result.buildFailure.message}`;
|
|
2008
|
-
}
|
|
2009
|
-
stderr += `
|
|
2010
|
-
`;
|
|
2005
|
+
stderr = formatBuildFailure(result.buildFailure, "Run failed");
|
|
2011
2006
|
} else {
|
|
2012
2007
|
stderr = `Run failed: ${result.error ?? "Unknown error"}
|
|
2013
2008
|
`;
|
|
@@ -2354,7 +2349,10 @@ async function createSandboxImpl(fs, options, context) {
|
|
|
2354
2349
|
error: buildResult.message ?? `Build failed in ${buildResult.phase} phase`,
|
|
2355
2350
|
buildFailure: {
|
|
2356
2351
|
phase: buildResult.phase,
|
|
2357
|
-
message: buildResult.message
|
|
2352
|
+
message: buildResult.message,
|
|
2353
|
+
diagnostics: buildResult.diagnostics,
|
|
2354
|
+
bundleErrors: buildResult.bundleErrors,
|
|
2355
|
+
bundleWarnings: buildResult.bundleWarnings
|
|
2358
2356
|
}
|
|
2359
2357
|
};
|
|
2360
2358
|
}
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { SandboxRef } from "./types";
|
|
12
12
|
export type { SandboxRef } from "./types";
|
|
13
|
-
export { formatSize, formatDiagnostics, formatBundleErrors } from "./types";
|
|
13
|
+
export { formatSize, formatDiagnostics, formatBundleErrors, formatBuildFailure, } from "./types";
|
|
14
14
|
/**
|
|
15
15
|
* Create the main `sandlot` command with all subcommands.
|
|
16
16
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,uCAuC1D;AAubD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,yCAE3D"}
|
package/dist/commands/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Commands wrap the sandbox's direct methods to provide a shell interface.
|
|
5
5
|
* This ensures consistency between `sandbox.build()` and `sandbox.exec('sandlot build')`.
|
|
6
6
|
*/
|
|
7
|
-
import type { Filesystem, InstallResult, UninstallResult, BuildResult, TypecheckResult, SandboxBuildOptions, SandboxTypecheckOptions, RunOptions, RunResult, BundleError, Diagnostic } from "../types";
|
|
7
|
+
import type { Filesystem, InstallResult, UninstallResult, BuildResult, BuildFailureDetails, TypecheckResult, SandboxBuildOptions, SandboxTypecheckOptions, RunOptions, RunResult, BundleError, Diagnostic } from "../types";
|
|
8
8
|
/**
|
|
9
9
|
* Reference to sandbox methods that commands can call.
|
|
10
10
|
*
|
|
@@ -37,4 +37,12 @@ export declare function formatDiagnostics(diagnostics: Diagnostic[]): string;
|
|
|
37
37
|
* Format bundle errors for shell output
|
|
38
38
|
*/
|
|
39
39
|
export declare function formatBundleErrors(errors: BundleError[]): string;
|
|
40
|
+
/**
|
|
41
|
+
* Format a build failure for shell output.
|
|
42
|
+
* Used by both build and run commands for consistent error formatting.
|
|
43
|
+
*
|
|
44
|
+
* @param failure - The build failure details
|
|
45
|
+
* @param prefix - Optional prefix for the error message (default: "Build failed")
|
|
46
|
+
*/
|
|
47
|
+
export declare function formatBuildFailure(failure: BuildFailureDetails, prefix?: string): string;
|
|
40
48
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,UAAU,EACV,SAAS,EACT,WAAW,EACX,UAAU,EACX,MAAM,UAAU,CAAC;AAElB;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;IAExB,wBAAwB;IACxB,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAErD,0BAA0B;IAC1B,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEzD,wBAAwB;IACxB,KAAK,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE3D,6BAA6B;IAC7B,SAAS,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEvE,iCAAiC;IACjC,GAAG,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CAC/C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAanE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CA8BhE"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,WAAW,EAC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EACrB,SAAS,EACT,OAAO,EACP,cAAc,EAYf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAA6B,MAAM,MAAM,CAAC;AA2J7D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,QAAQ,CAAC;IAClB,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,oBAAoB,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,UAAU,EACd,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/core/sandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,SAAS,EACT,OAAO,EACP,cAAc,EAYf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,UAAU,EAA6B,MAAM,MAAM,CAAC;AA2J7D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,QAAQ,CAAC;IAClB,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,oBAAoB,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACnD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,UAAU,EACd,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,OAAO,CAAC,CA2ZlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typechecker.d.ts","sourceRoot":"","sources":["../../src/core/typechecker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EAEhB,MAAM,UAAU,CAAC;AAsBlB,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"typechecker.d.ts","sourceRoot":"","sources":["../../src/core/typechecker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,EAEhB,MAAM,UAAU,CAAC;AAsBlB,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAwbD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,WAAY,YAAW,YAAY;IAC9C,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,WAAW,CAA8B;gBAErC,OAAO,GAAE,kBAAuB;IAI5C;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAcnB,SAAS;IAWvB;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;CA8CrE;AAMD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,YAAY,CAEd"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ export { createSandlot } from "./core/sandlot";
|
|
|
2
2
|
export { Filesystem, createFilesystem, wrapFilesystemForJustBash, } from "./core/fs";
|
|
3
3
|
export type { FilesystemOptions } from "./core/fs";
|
|
4
4
|
export { SharedModuleRegistry, createSharedModuleRegistry, } from "./core/shared-module-registry";
|
|
5
|
-
export { createSandlotCommand, createDefaultCommands, formatSize, formatDiagnostics, formatBundleErrors, } from "./commands";
|
|
5
|
+
export { createSandlotCommand, createDefaultCommands, formatSize, formatDiagnostics, formatBundleErrors, formatBuildFailure, } from "./commands";
|
|
6
6
|
export type { SandboxRef } from "./commands";
|
|
7
7
|
export { Typechecker, createTypechecker } from "./core/typechecker";
|
|
8
8
|
export type { TypecheckerOptions } from "./core/typechecker";
|
|
9
9
|
export { EsmTypesResolver, InMemoryTypesCache, } from "./core/esm-types-resolver";
|
|
10
10
|
export type { EsmTypesResolverOptions, ResolvedTypes, ITypesCache, } from "./core/esm-types-resolver";
|
|
11
|
-
export type { IBundler, ITypechecker, ITypesResolver, ISharedModuleRegistry, IExecutor, Sandlot, SandlotOptions, Sandbox, SandboxOptions, SandboxState, BuildPhase, BuildResult, BuildSuccess, BuildFailure, SandboxBuildOptions, InstallResult, UninstallResult, SandboxTypecheckOptions, RunOptions, RunResult, ExecuteOptions, ExecuteResult, BundleOptions, BundleResult, BundleSuccess, BundleFailure, BundleWarning, BundleError, BundleLocation, TypecheckOptions, TypecheckResult, Diagnostic, ExecResult, IFileSystem, FsEntry, FsStat, } from "./types";
|
|
11
|
+
export type { IBundler, ITypechecker, ITypesResolver, ISharedModuleRegistry, IExecutor, Sandlot, SandlotOptions, Sandbox, SandboxOptions, SandboxState, BuildPhase, BuildResult, BuildSuccess, BuildFailure, BuildFailureDetails, SandboxBuildOptions, InstallResult, UninstallResult, SandboxTypecheckOptions, RunOptions, RunResult, ExecuteOptions, ExecuteResult, BundleOptions, BundleResult, BundleSuccess, BundleFailure, BundleWarning, BundleError, BundleLocation, TypecheckOptions, TypecheckResult, Diagnostic, ExecResult, IFileSystem, FsEntry, FsStat, } from "./types";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"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+
function formatBuildFailure(failure, prefix = "Build failed") {
|
|
711
|
+
switch (failure.phase) {
|
|
712
|
+
case "entry":
|
|
713
|
+
return `${prefix}: ${failure.message}
|
|
714
|
+
`;
|
|
715
|
+
case "typecheck":
|
|
716
|
+
if (failure.diagnostics && failure.diagnostics.length > 0) {
|
|
717
|
+
const errors = failure.diagnostics.filter((d) => d.severity === "error");
|
|
718
|
+
if (errors.length > 0) {
|
|
719
|
+
return `${prefix}: Type check errors
|
|
720
|
+
|
|
721
|
+
${formatDiagnostics(errors)}
|
|
722
|
+
`;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
return `${prefix}: Type check errors
|
|
726
|
+
`;
|
|
727
|
+
case "bundle":
|
|
728
|
+
if (failure.bundleErrors && failure.bundleErrors.length > 0) {
|
|
729
|
+
return `${prefix}: Bundle errors
|
|
730
|
+
|
|
731
|
+
${formatBundleErrors(failure.bundleErrors)}
|
|
732
|
+
`;
|
|
733
|
+
}
|
|
734
|
+
return `${prefix}: Bundle error
|
|
735
|
+
`;
|
|
736
|
+
default:
|
|
737
|
+
return `${prefix}: Unknown error
|
|
738
|
+
`;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
710
741
|
// src/commands/index.ts
|
|
711
742
|
function createSandlotCommand(sandboxRef) {
|
|
712
743
|
return defineCommand("sandlot", async (args, ctx) => {
|
|
@@ -817,42 +848,9 @@ Examples:
|
|
|
817
848
|
format
|
|
818
849
|
});
|
|
819
850
|
if (!result.success) {
|
|
820
|
-
let stderr = `Build failed`;
|
|
821
|
-
switch (result.phase) {
|
|
822
|
-
case "entry":
|
|
823
|
-
stderr = `Build failed: ${result.message}
|
|
824
|
-
`;
|
|
825
|
-
break;
|
|
826
|
-
case "typecheck":
|
|
827
|
-
if (result.diagnostics) {
|
|
828
|
-
const errors = result.diagnostics.filter((d) => d.severity === "error");
|
|
829
|
-
stderr = `Build failed: Type check errors
|
|
830
|
-
|
|
831
|
-
${formatDiagnostics(errors)}
|
|
832
|
-
`;
|
|
833
|
-
} else {
|
|
834
|
-
stderr = `Build failed: Type check errors
|
|
835
|
-
`;
|
|
836
|
-
}
|
|
837
|
-
break;
|
|
838
|
-
case "bundle":
|
|
839
|
-
if (result.bundleErrors && result.bundleErrors.length > 0) {
|
|
840
|
-
stderr = `Build failed: Bundle errors
|
|
841
|
-
|
|
842
|
-
${formatBundleErrors(result.bundleErrors)}
|
|
843
|
-
`;
|
|
844
|
-
} else {
|
|
845
|
-
stderr = `Build failed: Bundle error
|
|
846
|
-
`;
|
|
847
|
-
}
|
|
848
|
-
break;
|
|
849
|
-
default:
|
|
850
|
-
stderr = `Build failed: Unknown error
|
|
851
|
-
`;
|
|
852
|
-
}
|
|
853
851
|
return {
|
|
854
852
|
stdout: "",
|
|
855
|
-
stderr,
|
|
853
|
+
stderr: formatBuildFailure(result),
|
|
856
854
|
exitCode: 1
|
|
857
855
|
};
|
|
858
856
|
}
|
|
@@ -916,18 +914,20 @@ Examples:
|
|
|
916
914
|
const formatted = formatDiagnostics(errors);
|
|
917
915
|
return {
|
|
918
916
|
stdout: "",
|
|
919
|
-
stderr: `Type check failed
|
|
917
|
+
stderr: `Type check failed
|
|
918
|
+
|
|
920
919
|
${formatted}
|
|
921
920
|
`,
|
|
922
921
|
exitCode: 1
|
|
923
922
|
};
|
|
924
923
|
}
|
|
925
924
|
const warnings = result.diagnostics.filter((d) => d.severity === "warning");
|
|
926
|
-
let output = `Type check passed
|
|
925
|
+
let output = `Type check passed
|
|
927
926
|
`;
|
|
928
927
|
if (warnings.length > 0) {
|
|
929
928
|
output += `
|
|
930
929
|
Warnings:
|
|
930
|
+
|
|
931
931
|
${formatDiagnostics(warnings)}
|
|
932
932
|
`;
|
|
933
933
|
}
|
|
@@ -1102,13 +1102,7 @@ Examples:
|
|
|
1102
1102
|
if (!result.success) {
|
|
1103
1103
|
let stderr = "";
|
|
1104
1104
|
if (result.buildFailure) {
|
|
1105
|
-
stderr =
|
|
1106
|
-
if (result.buildFailure.message) {
|
|
1107
|
-
stderr += `
|
|
1108
|
-
${result.buildFailure.message}`;
|
|
1109
|
-
}
|
|
1110
|
-
stderr += `
|
|
1111
|
-
`;
|
|
1105
|
+
stderr = formatBuildFailure(result.buildFailure, "Run failed");
|
|
1112
1106
|
} else {
|
|
1113
1107
|
stderr = `Run failed: ${result.error ?? "Unknown error"}
|
|
1114
1108
|
`;
|
|
@@ -1455,7 +1449,10 @@ async function createSandboxImpl(fs, options, context) {
|
|
|
1455
1449
|
error: buildResult.message ?? `Build failed in ${buildResult.phase} phase`,
|
|
1456
1450
|
buildFailure: {
|
|
1457
1451
|
phase: buildResult.phase,
|
|
1458
|
-
message: buildResult.message
|
|
1452
|
+
message: buildResult.message,
|
|
1453
|
+
diagnostics: buildResult.diagnostics,
|
|
1454
|
+
bundleErrors: buildResult.bundleErrors,
|
|
1455
|
+
bundleWarnings: buildResult.bundleWarnings
|
|
1459
1456
|
}
|
|
1460
1457
|
};
|
|
1461
1458
|
}
|
|
@@ -1782,8 +1779,9 @@ function parseTsConfig(fs, configPath) {
|
|
|
1782
1779
|
}
|
|
1783
1780
|
};
|
|
1784
1781
|
const parsed = ts.parseJsonConfigFileContent(config, parseHost, "/", undefined, configPath);
|
|
1785
|
-
|
|
1786
|
-
|
|
1782
|
+
const relevantErrors = parsed.errors.filter((e) => e.code !== 18003);
|
|
1783
|
+
if (relevantErrors.length > 0) {
|
|
1784
|
+
console.warn("[typechecker] tsconfig parse errors:", relevantErrors.map((e) => e.messageText));
|
|
1787
1785
|
}
|
|
1788
1786
|
return {
|
|
1789
1787
|
...parsed.options,
|
|
@@ -2075,6 +2073,7 @@ export {
|
|
|
2075
2073
|
formatSize,
|
|
2076
2074
|
formatDiagnostics,
|
|
2077
2075
|
formatBundleErrors,
|
|
2076
|
+
formatBuildFailure,
|
|
2078
2077
|
createTypechecker,
|
|
2079
2078
|
createSharedModuleRegistry,
|
|
2080
2079
|
createSandlotCommand,
|
package/dist/node/index.js
CHANGED
|
@@ -645,8 +645,9 @@ function parseTsConfig(fs, configPath) {
|
|
|
645
645
|
}
|
|
646
646
|
};
|
|
647
647
|
const parsed = ts.parseJsonConfigFileContent(config, parseHost, "/", undefined, configPath);
|
|
648
|
-
|
|
649
|
-
|
|
648
|
+
const relevantErrors = parsed.errors.filter((e) => e.code !== 18003);
|
|
649
|
+
if (relevantErrors.length > 0) {
|
|
650
|
+
console.warn("[typechecker] tsconfig parse errors:", relevantErrors.map((e) => e.messageText));
|
|
650
651
|
}
|
|
651
652
|
return {
|
|
652
653
|
...parsed.options,
|
|
@@ -1571,6 +1572,37 @@ ${padding}^`;
|
|
|
1571
1572
|
|
|
1572
1573
|
`);
|
|
1573
1574
|
}
|
|
1575
|
+
function formatBuildFailure(failure, prefix = "Build failed") {
|
|
1576
|
+
switch (failure.phase) {
|
|
1577
|
+
case "entry":
|
|
1578
|
+
return `${prefix}: ${failure.message}
|
|
1579
|
+
`;
|
|
1580
|
+
case "typecheck":
|
|
1581
|
+
if (failure.diagnostics && failure.diagnostics.length > 0) {
|
|
1582
|
+
const errors = failure.diagnostics.filter((d) => d.severity === "error");
|
|
1583
|
+
if (errors.length > 0) {
|
|
1584
|
+
return `${prefix}: Type check errors
|
|
1585
|
+
|
|
1586
|
+
${formatDiagnostics(errors)}
|
|
1587
|
+
`;
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
return `${prefix}: Type check errors
|
|
1591
|
+
`;
|
|
1592
|
+
case "bundle":
|
|
1593
|
+
if (failure.bundleErrors && failure.bundleErrors.length > 0) {
|
|
1594
|
+
return `${prefix}: Bundle errors
|
|
1595
|
+
|
|
1596
|
+
${formatBundleErrors(failure.bundleErrors)}
|
|
1597
|
+
`;
|
|
1598
|
+
}
|
|
1599
|
+
return `${prefix}: Bundle error
|
|
1600
|
+
`;
|
|
1601
|
+
default:
|
|
1602
|
+
return `${prefix}: Unknown error
|
|
1603
|
+
`;
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1574
1606
|
// src/commands/index.ts
|
|
1575
1607
|
function createSandlotCommand(sandboxRef) {
|
|
1576
1608
|
return defineCommand("sandlot", async (args, ctx) => {
|
|
@@ -1681,42 +1713,9 @@ Examples:
|
|
|
1681
1713
|
format
|
|
1682
1714
|
});
|
|
1683
1715
|
if (!result.success) {
|
|
1684
|
-
let stderr = `Build failed`;
|
|
1685
|
-
switch (result.phase) {
|
|
1686
|
-
case "entry":
|
|
1687
|
-
stderr = `Build failed: ${result.message}
|
|
1688
|
-
`;
|
|
1689
|
-
break;
|
|
1690
|
-
case "typecheck":
|
|
1691
|
-
if (result.diagnostics) {
|
|
1692
|
-
const errors = result.diagnostics.filter((d) => d.severity === "error");
|
|
1693
|
-
stderr = `Build failed: Type check errors
|
|
1694
|
-
|
|
1695
|
-
${formatDiagnostics(errors)}
|
|
1696
|
-
`;
|
|
1697
|
-
} else {
|
|
1698
|
-
stderr = `Build failed: Type check errors
|
|
1699
|
-
`;
|
|
1700
|
-
}
|
|
1701
|
-
break;
|
|
1702
|
-
case "bundle":
|
|
1703
|
-
if (result.bundleErrors && result.bundleErrors.length > 0) {
|
|
1704
|
-
stderr = `Build failed: Bundle errors
|
|
1705
|
-
|
|
1706
|
-
${formatBundleErrors(result.bundleErrors)}
|
|
1707
|
-
`;
|
|
1708
|
-
} else {
|
|
1709
|
-
stderr = `Build failed: Bundle error
|
|
1710
|
-
`;
|
|
1711
|
-
}
|
|
1712
|
-
break;
|
|
1713
|
-
default:
|
|
1714
|
-
stderr = `Build failed: Unknown error
|
|
1715
|
-
`;
|
|
1716
|
-
}
|
|
1717
1716
|
return {
|
|
1718
1717
|
stdout: "",
|
|
1719
|
-
stderr,
|
|
1718
|
+
stderr: formatBuildFailure(result),
|
|
1720
1719
|
exitCode: 1
|
|
1721
1720
|
};
|
|
1722
1721
|
}
|
|
@@ -1780,18 +1779,20 @@ Examples:
|
|
|
1780
1779
|
const formatted = formatDiagnostics(errors);
|
|
1781
1780
|
return {
|
|
1782
1781
|
stdout: "",
|
|
1783
|
-
stderr: `Type check failed
|
|
1782
|
+
stderr: `Type check failed
|
|
1783
|
+
|
|
1784
1784
|
${formatted}
|
|
1785
1785
|
`,
|
|
1786
1786
|
exitCode: 1
|
|
1787
1787
|
};
|
|
1788
1788
|
}
|
|
1789
1789
|
const warnings = result.diagnostics.filter((d) => d.severity === "warning");
|
|
1790
|
-
let output = `Type check passed
|
|
1790
|
+
let output = `Type check passed
|
|
1791
1791
|
`;
|
|
1792
1792
|
if (warnings.length > 0) {
|
|
1793
1793
|
output += `
|
|
1794
1794
|
Warnings:
|
|
1795
|
+
|
|
1795
1796
|
${formatDiagnostics(warnings)}
|
|
1796
1797
|
`;
|
|
1797
1798
|
}
|
|
@@ -1966,13 +1967,7 @@ Examples:
|
|
|
1966
1967
|
if (!result.success) {
|
|
1967
1968
|
let stderr = "";
|
|
1968
1969
|
if (result.buildFailure) {
|
|
1969
|
-
stderr =
|
|
1970
|
-
if (result.buildFailure.message) {
|
|
1971
|
-
stderr += `
|
|
1972
|
-
${result.buildFailure.message}`;
|
|
1973
|
-
}
|
|
1974
|
-
stderr += `
|
|
1975
|
-
`;
|
|
1970
|
+
stderr = formatBuildFailure(result.buildFailure, "Run failed");
|
|
1976
1971
|
} else {
|
|
1977
1972
|
stderr = `Run failed: ${result.error ?? "Unknown error"}
|
|
1978
1973
|
`;
|
|
@@ -2319,7 +2314,10 @@ async function createSandboxImpl(fs, options, context) {
|
|
|
2319
2314
|
error: buildResult.message ?? `Build failed in ${buildResult.phase} phase`,
|
|
2320
2315
|
buildFailure: {
|
|
2321
2316
|
phase: buildResult.phase,
|
|
2322
|
-
message: buildResult.message
|
|
2317
|
+
message: buildResult.message,
|
|
2318
|
+
diagnostics: buildResult.diagnostics,
|
|
2319
|
+
bundleErrors: buildResult.bundleErrors,
|
|
2320
|
+
bundleWarnings: buildResult.bundleWarnings
|
|
2323
2321
|
}
|
|
2324
2322
|
};
|
|
2325
2323
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -284,8 +284,11 @@ export interface BuildSuccess {
|
|
|
284
284
|
/** Any warnings from the bundler */
|
|
285
285
|
warnings: BundleWarning[];
|
|
286
286
|
}
|
|
287
|
-
|
|
288
|
-
|
|
287
|
+
/**
|
|
288
|
+
* Details about why a build failed.
|
|
289
|
+
* Used by both BuildResult and RunResult.
|
|
290
|
+
*/
|
|
291
|
+
export interface BuildFailureDetails {
|
|
289
292
|
/** Which phase of the build failed */
|
|
290
293
|
phase: BuildPhase;
|
|
291
294
|
/** Error message (for entry failures) */
|
|
@@ -297,6 +300,9 @@ export interface BuildFailure {
|
|
|
297
300
|
/** Bundle warnings (may be present even on failure) */
|
|
298
301
|
bundleWarnings?: BundleWarning[];
|
|
299
302
|
}
|
|
303
|
+
export interface BuildFailure extends BuildFailureDetails {
|
|
304
|
+
success: false;
|
|
305
|
+
}
|
|
300
306
|
export interface InstallResult {
|
|
301
307
|
/** Package name */
|
|
302
308
|
name: string;
|
|
@@ -388,11 +394,8 @@ export interface RunOptions {
|
|
|
388
394
|
* If `buildFailure` is present, the build failed before execution.
|
|
389
395
|
*/
|
|
390
396
|
export interface RunResult extends ExecuteResult {
|
|
391
|
-
/** If build failed, contains failure details */
|
|
392
|
-
buildFailure?:
|
|
393
|
-
phase: BuildPhase;
|
|
394
|
-
message?: string;
|
|
395
|
-
};
|
|
397
|
+
/** If build failed, contains failure details (same structure as BuildFailure) */
|
|
398
|
+
buildFailure?: BuildFailureDetails;
|
|
396
399
|
}
|
|
397
400
|
export interface Sandbox {
|
|
398
401
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAM5C,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACtE,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAM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;;;;;;;;;;OAUG;IACH,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAErD;;;;;;OAMG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEzD;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE3D;;;;;;OAMG;IACH,SAAS,CAAC,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,GAAG,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAMD,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1D;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACtD"}
|
package/package.json
CHANGED
package/src/commands/index.ts
CHANGED
|
@@ -12,7 +12,12 @@
|
|
|
12
12
|
import { defineCommand, type CommandContext } from "just-bash/browser";
|
|
13
13
|
import type { SandboxRef } from "./types";
|
|
14
14
|
export type { SandboxRef } from "./types";
|
|
15
|
-
export {
|
|
15
|
+
export {
|
|
16
|
+
formatSize,
|
|
17
|
+
formatDiagnostics,
|
|
18
|
+
formatBundleErrors,
|
|
19
|
+
formatBuildFailure,
|
|
20
|
+
} from "./types";
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* Create the main `sandlot` command with all subcommands.
|
|
@@ -96,7 +101,12 @@ Examples:
|
|
|
96
101
|
// Build
|
|
97
102
|
// =============================================================================
|
|
98
103
|
|
|
99
|
-
import {
|
|
104
|
+
import {
|
|
105
|
+
formatSize,
|
|
106
|
+
formatDiagnostics,
|
|
107
|
+
formatBundleErrors,
|
|
108
|
+
formatBuildFailure,
|
|
109
|
+
} from "./types";
|
|
100
110
|
|
|
101
111
|
async function handleBuild(sandboxRef: SandboxRef, args: (string | undefined)[]) {
|
|
102
112
|
let entryPoint: string | undefined;
|
|
@@ -150,37 +160,9 @@ Examples:
|
|
|
150
160
|
|
|
151
161
|
// Handle build failure
|
|
152
162
|
if (!result.success) {
|
|
153
|
-
let stderr = `Build failed`;
|
|
154
|
-
|
|
155
|
-
switch (result.phase) {
|
|
156
|
-
case "entry":
|
|
157
|
-
stderr = `Build failed: ${result.message}\n`;
|
|
158
|
-
break;
|
|
159
|
-
|
|
160
|
-
case "typecheck":
|
|
161
|
-
if (result.diagnostics) {
|
|
162
|
-
const errors = result.diagnostics.filter((d) => d.severity === "error");
|
|
163
|
-
stderr = `Build failed: Type check errors\n\n${formatDiagnostics(errors)}\n`;
|
|
164
|
-
} else {
|
|
165
|
-
stderr = `Build failed: Type check errors\n`;
|
|
166
|
-
}
|
|
167
|
-
break;
|
|
168
|
-
|
|
169
|
-
case "bundle":
|
|
170
|
-
if (result.bundleErrors && result.bundleErrors.length > 0) {
|
|
171
|
-
stderr = `Build failed: Bundle errors\n\n${formatBundleErrors(result.bundleErrors)}\n`;
|
|
172
|
-
} else {
|
|
173
|
-
stderr = `Build failed: Bundle error\n`;
|
|
174
|
-
}
|
|
175
|
-
break;
|
|
176
|
-
|
|
177
|
-
default:
|
|
178
|
-
stderr = `Build failed: Unknown error\n`;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
163
|
return {
|
|
182
164
|
stdout: "",
|
|
183
|
-
stderr,
|
|
165
|
+
stderr: formatBuildFailure(result),
|
|
184
166
|
exitCode: 1,
|
|
185
167
|
};
|
|
186
168
|
}
|
|
@@ -249,16 +231,16 @@ Examples:
|
|
|
249
231
|
const formatted = formatDiagnostics(errors);
|
|
250
232
|
return {
|
|
251
233
|
stdout: "",
|
|
252
|
-
stderr: `Type check failed
|
|
234
|
+
stderr: `Type check failed\n\n${formatted}\n`,
|
|
253
235
|
exitCode: 1,
|
|
254
236
|
};
|
|
255
237
|
}
|
|
256
238
|
|
|
257
239
|
const warnings = result.diagnostics.filter((d) => d.severity === "warning");
|
|
258
|
-
let output = `Type check passed
|
|
240
|
+
let output = `Type check passed\n`;
|
|
259
241
|
|
|
260
242
|
if (warnings.length > 0) {
|
|
261
|
-
output += `\nWarnings:\n${formatDiagnostics(warnings)}\n`;
|
|
243
|
+
output += `\nWarnings:\n\n${formatDiagnostics(warnings)}\n`;
|
|
262
244
|
}
|
|
263
245
|
|
|
264
246
|
return {
|
|
@@ -458,13 +440,9 @@ Examples:
|
|
|
458
440
|
if (!result.success) {
|
|
459
441
|
let stderr = "";
|
|
460
442
|
|
|
461
|
-
// Build failure
|
|
443
|
+
// Build failure - use the shared formatter
|
|
462
444
|
if (result.buildFailure) {
|
|
463
|
-
stderr =
|
|
464
|
-
if (result.buildFailure.message) {
|
|
465
|
-
stderr += `\n${result.buildFailure.message}`;
|
|
466
|
-
}
|
|
467
|
-
stderr += "\n";
|
|
445
|
+
stderr = formatBuildFailure(result.buildFailure, "Run failed");
|
|
468
446
|
} else {
|
|
469
447
|
// Execution failure
|
|
470
448
|
stderr = `Run failed: ${result.error ?? "Unknown error"}\n`;
|
package/src/commands/types.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
InstallResult,
|
|
11
11
|
UninstallResult,
|
|
12
12
|
BuildResult,
|
|
13
|
+
BuildFailureDetails,
|
|
13
14
|
TypecheckResult,
|
|
14
15
|
SandboxBuildOptions,
|
|
15
16
|
SandboxTypecheckOptions,
|
|
@@ -106,3 +107,38 @@ export function formatBundleErrors(errors: BundleError[]): string {
|
|
|
106
107
|
})
|
|
107
108
|
.join("\n\n");
|
|
108
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Format a build failure for shell output.
|
|
113
|
+
* Used by both build and run commands for consistent error formatting.
|
|
114
|
+
*
|
|
115
|
+
* @param failure - The build failure details
|
|
116
|
+
* @param prefix - Optional prefix for the error message (default: "Build failed")
|
|
117
|
+
*/
|
|
118
|
+
export function formatBuildFailure(
|
|
119
|
+
failure: BuildFailureDetails,
|
|
120
|
+
prefix = "Build failed"
|
|
121
|
+
): string {
|
|
122
|
+
switch (failure.phase) {
|
|
123
|
+
case "entry":
|
|
124
|
+
return `${prefix}: ${failure.message}\n`;
|
|
125
|
+
|
|
126
|
+
case "typecheck":
|
|
127
|
+
if (failure.diagnostics && failure.diagnostics.length > 0) {
|
|
128
|
+
const errors = failure.diagnostics.filter((d) => d.severity === "error");
|
|
129
|
+
if (errors.length > 0) {
|
|
130
|
+
return `${prefix}: Type check errors\n\n${formatDiagnostics(errors)}\n`;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return `${prefix}: Type check errors\n`;
|
|
134
|
+
|
|
135
|
+
case "bundle":
|
|
136
|
+
if (failure.bundleErrors && failure.bundleErrors.length > 0) {
|
|
137
|
+
return `${prefix}: Bundle errors\n\n${formatBundleErrors(failure.bundleErrors)}\n`;
|
|
138
|
+
}
|
|
139
|
+
return `${prefix}: Bundle error\n`;
|
|
140
|
+
|
|
141
|
+
default:
|
|
142
|
+
return `${prefix}: Unknown error\n`;
|
|
143
|
+
}
|
|
144
|
+
}
|
package/src/core/sandbox.ts
CHANGED
|
@@ -513,6 +513,9 @@ export async function createSandboxImpl(
|
|
|
513
513
|
buildFailure: {
|
|
514
514
|
phase: buildResult.phase,
|
|
515
515
|
message: buildResult.message,
|
|
516
|
+
diagnostics: buildResult.diagnostics,
|
|
517
|
+
bundleErrors: buildResult.bundleErrors,
|
|
518
|
+
bundleWarnings: buildResult.bundleWarnings,
|
|
516
519
|
},
|
|
517
520
|
};
|
|
518
521
|
}
|
package/src/core/typechecker.ts
CHANGED
|
@@ -418,10 +418,12 @@ function parseTsConfig(
|
|
|
418
418
|
configPath
|
|
419
419
|
);
|
|
420
420
|
|
|
421
|
-
|
|
421
|
+
// Filter out "no inputs found" error (TS18003) - we pass entry points explicitly
|
|
422
|
+
const relevantErrors = parsed.errors.filter((e) => e.code !== 18003);
|
|
423
|
+
if (relevantErrors.length > 0) {
|
|
422
424
|
console.warn(
|
|
423
425
|
"[typechecker] tsconfig parse errors:",
|
|
424
|
-
|
|
426
|
+
relevantErrors.map((e) => e.messageText)
|
|
425
427
|
);
|
|
426
428
|
}
|
|
427
429
|
|
package/src/index.ts
CHANGED
|
@@ -47,6 +47,7 @@ export {
|
|
|
47
47
|
formatSize,
|
|
48
48
|
formatDiagnostics,
|
|
49
49
|
formatBundleErrors,
|
|
50
|
+
formatBuildFailure,
|
|
50
51
|
} from "./commands";
|
|
51
52
|
export type { SandboxRef } from "./commands";
|
|
52
53
|
|
|
@@ -95,6 +96,7 @@ export type {
|
|
|
95
96
|
BuildResult,
|
|
96
97
|
BuildSuccess,
|
|
97
98
|
BuildFailure,
|
|
99
|
+
BuildFailureDetails,
|
|
98
100
|
SandboxBuildOptions,
|
|
99
101
|
|
|
100
102
|
// Install/Uninstall types
|
package/src/types.ts
CHANGED
|
@@ -366,8 +366,11 @@ export interface BuildSuccess {
|
|
|
366
366
|
warnings: BundleWarning[];
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
/**
|
|
370
|
+
* Details about why a build failed.
|
|
371
|
+
* Used by both BuildResult and RunResult.
|
|
372
|
+
*/
|
|
373
|
+
export interface BuildFailureDetails {
|
|
371
374
|
/** Which phase of the build failed */
|
|
372
375
|
phase: BuildPhase;
|
|
373
376
|
/** Error message (for entry failures) */
|
|
@@ -380,6 +383,10 @@ export interface BuildFailure {
|
|
|
380
383
|
bundleWarnings?: BundleWarning[];
|
|
381
384
|
}
|
|
382
385
|
|
|
386
|
+
export interface BuildFailure extends BuildFailureDetails {
|
|
387
|
+
success: false;
|
|
388
|
+
}
|
|
389
|
+
|
|
383
390
|
|
|
384
391
|
// -----------------------------------------------------------------------------
|
|
385
392
|
// Install/Uninstall Types
|
|
@@ -500,11 +507,8 @@ export interface RunOptions {
|
|
|
500
507
|
* If `buildFailure` is present, the build failed before execution.
|
|
501
508
|
*/
|
|
502
509
|
export interface RunResult extends ExecuteResult {
|
|
503
|
-
/** If build failed, contains failure details */
|
|
504
|
-
buildFailure?:
|
|
505
|
-
phase: BuildPhase;
|
|
506
|
-
message?: string;
|
|
507
|
-
};
|
|
510
|
+
/** If build failed, contains failure details (same structure as BuildFailure) */
|
|
511
|
+
buildFailure?: BuildFailureDetails;
|
|
508
512
|
}
|
|
509
513
|
|
|
510
514
|
// -----------------------------------------------------------------------------
|