@absolutejs/absolute 0.19.0-beta.201 → 0.19.0-beta.202
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/cli/index.js
CHANGED
|
@@ -978,6 +978,72 @@ var init_compile = __esm(() => {
|
|
|
978
978
|
];
|
|
979
979
|
});
|
|
980
980
|
|
|
981
|
+
// src/cli/scripts/typecheck.ts
|
|
982
|
+
var exports_typecheck = {};
|
|
983
|
+
__export(exports_typecheck, {
|
|
984
|
+
typecheck: () => typecheck
|
|
985
|
+
});
|
|
986
|
+
import { resolve as resolve7, join as join7 } from "path";
|
|
987
|
+
import { existsSync as existsSync9 } from "fs";
|
|
988
|
+
var run = async (name, command) => {
|
|
989
|
+
const proc = Bun.spawn(command, {
|
|
990
|
+
stderr: "inherit",
|
|
991
|
+
stdout: "inherit"
|
|
992
|
+
});
|
|
993
|
+
const exitCode = await proc.exited;
|
|
994
|
+
return { exitCode, name };
|
|
995
|
+
}, findBin = (name) => {
|
|
996
|
+
const local = resolve7("node_modules", ".bin", name);
|
|
997
|
+
return existsSync9(local) ? local : name;
|
|
998
|
+
}, typecheck = async (configPath2) => {
|
|
999
|
+
const config = await loadConfig(configPath2);
|
|
1000
|
+
const hasSvelte = Boolean(config.svelteDirectory);
|
|
1001
|
+
const hasVue = Boolean(config.vueDirectory);
|
|
1002
|
+
const cacheDir = ".absolutejs";
|
|
1003
|
+
const checks = [];
|
|
1004
|
+
if (hasVue) {
|
|
1005
|
+
checks.push(run("vue-tsc", [
|
|
1006
|
+
findBin("vue-tsc"),
|
|
1007
|
+
"--noEmit",
|
|
1008
|
+
"--incremental",
|
|
1009
|
+
"--tsBuildInfoFile",
|
|
1010
|
+
join7(cacheDir, "vue-tsc.tsbuildinfo"),
|
|
1011
|
+
"--pretty"
|
|
1012
|
+
]));
|
|
1013
|
+
} else {
|
|
1014
|
+
checks.push(run("tsc", [
|
|
1015
|
+
findBin("tsc"),
|
|
1016
|
+
"--noEmit",
|
|
1017
|
+
"--incremental",
|
|
1018
|
+
"--tsBuildInfoFile",
|
|
1019
|
+
join7(cacheDir, "tsc.tsbuildinfo"),
|
|
1020
|
+
"--pretty"
|
|
1021
|
+
]));
|
|
1022
|
+
}
|
|
1023
|
+
if (hasSvelte) {
|
|
1024
|
+
checks.push(run("svelte-check", [
|
|
1025
|
+
findBin("svelte-check"),
|
|
1026
|
+
"--tsconfig",
|
|
1027
|
+
"./tsconfig.json",
|
|
1028
|
+
"--threshold",
|
|
1029
|
+
"error",
|
|
1030
|
+
"--compiler-warnings",
|
|
1031
|
+
"css-unused-selector:ignore"
|
|
1032
|
+
]));
|
|
1033
|
+
}
|
|
1034
|
+
const results = await Promise.all(checks);
|
|
1035
|
+
const failed = results.filter((r) => r.exitCode !== 0);
|
|
1036
|
+
if (failed.length > 0) {
|
|
1037
|
+
console.error(`
|
|
1038
|
+
\x1B[31m\u2717\x1B[0m Typecheck failed: ${failed.map((r) => r.name).join(", ")}`);
|
|
1039
|
+
process.exit(1);
|
|
1040
|
+
}
|
|
1041
|
+
console.log("\x1B[32m\u2713\x1B[0m Typecheck passed");
|
|
1042
|
+
};
|
|
1043
|
+
var init_typecheck = __esm(() => {
|
|
1044
|
+
init_loadConfig();
|
|
1045
|
+
});
|
|
1046
|
+
|
|
981
1047
|
// src/cli/scripts/dev.ts
|
|
982
1048
|
init_constants();
|
|
983
1049
|
init_startupBanner();
|
|
@@ -2149,6 +2215,11 @@ if (command === "dev") {
|
|
|
2149
2215
|
const serverEntry = positionalArgs[0] ?? DEFAULT_SERVER_ENTRY;
|
|
2150
2216
|
const { compile: compile2 } = await Promise.resolve().then(() => (init_compile(), exports_compile));
|
|
2151
2217
|
await compile2(serverEntry, outdir, outfile, configPath2);
|
|
2218
|
+
} else if (command === "typecheck") {
|
|
2219
|
+
sendTelemetryEvent("cli:command", { command });
|
|
2220
|
+
const configPath2 = parseNamedArg("--config");
|
|
2221
|
+
const { typecheck: typecheck2 } = await Promise.resolve().then(() => (init_typecheck(), exports_typecheck));
|
|
2222
|
+
await typecheck2(configPath2);
|
|
2152
2223
|
} else if (command === "mkcert") {
|
|
2153
2224
|
sendTelemetryEvent("cli:command", { command });
|
|
2154
2225
|
const { setupMkcert: setupMkcert2 } = await Promise.resolve().then(() => (init_devCert(), exports_devCert));
|
|
@@ -2164,6 +2235,7 @@ if (command === "dev") {
|
|
|
2164
2235
|
console.error(" eslint Run ESLint (cached)");
|
|
2165
2236
|
console.error(" info Print system info for bug reports");
|
|
2166
2237
|
console.error(" prettier Run Prettier check (cached)");
|
|
2238
|
+
console.error(" typecheck Run type checkers for all frameworks");
|
|
2167
2239
|
console.error(" telemetry Manage anonymous telemetry");
|
|
2168
2240
|
process.exit(1);
|
|
2169
2241
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const typecheck: (configPath?: string) => Promise<void>;
|
package/package.json
CHANGED