@absolutejs/absolute 0.20.0-beta.71 → 0.20.0-beta.72
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/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/cli/{add-jy0b6kdf.js → add-kt4qx8sh.js} +5 -5
- package/dist/cli/{compile-4mkh7bst.js → compile-bra4g79g.js} +1 -1
- package/dist/cli/{doctor-gzhf7nr9.js → doctor-a8afwvf9.js} +1 -1
- package/dist/cli/{generate-j3y5qt2d.js → generate-zy3d9bce.js} +4 -4
- package/dist/cli/{htmx-nmpbk3wn.js → htmx-63kt9qj1.js} +2 -2
- package/dist/cli/{index-jg7m4zpy.js → index-1wgc9e0v.js} +1 -1
- package/dist/cli/{index-6sv0rf9w.js → index-6tnpbjc7.js} +4 -0
- package/dist/cli/{index-2j5d7vt5.js → index-mxmg15c5.js} +2 -2
- package/dist/cli/{index-ybq18wst.js → index-pa3hmzj7.js} +1 -1
- package/dist/cli/index-v1k46q3x.js +11 -0
- package/dist/cli/{index-g5rwcntp.js → index-wspj2mq3.js} +2 -2
- package/dist/cli/index.js +10 -10
- package/dist/cli/{mobile-g6xn9270.js → mobile-a0myydjp.js} +1 -1
- package/dist/cli/{remove-paz2qmx4.js → remove-pwfv4wsd.js} +4 -4
- package/dist/cli/{start-cwy0b5z2.js → start-3nqytx1c.js} +1 -1
- package/dist/cli/typecheck-1yj1wfhw.js +1134 -0
- package/package.json +7 -7
- package/dist/cli/index-fr9x2c4m.js +0 -5
- package/dist/cli/typecheck-j0ytazsm.js +0 -302
package/package.json
CHANGED
|
@@ -300,12 +300,12 @@
|
|
|
300
300
|
"main": "./dist/index.js",
|
|
301
301
|
"name": "@absolutejs/absolute",
|
|
302
302
|
"optionalDependencies": {
|
|
303
|
-
"@absolutejs/native-darwin-arm64": "0.20.0-beta.
|
|
304
|
-
"@absolutejs/native-darwin-x64": "0.20.0-beta.
|
|
305
|
-
"@absolutejs/native-linux-arm64": "0.20.0-beta.
|
|
306
|
-
"@absolutejs/native-linux-x64": "0.20.0-beta.
|
|
307
|
-
"@absolutejs/native-windows-arm64": "0.20.0-beta.
|
|
308
|
-
"@absolutejs/native-windows-x64": "0.20.0-beta.
|
|
303
|
+
"@absolutejs/native-darwin-arm64": "0.20.0-beta.72",
|
|
304
|
+
"@absolutejs/native-darwin-x64": "0.20.0-beta.72",
|
|
305
|
+
"@absolutejs/native-linux-arm64": "0.20.0-beta.72",
|
|
306
|
+
"@absolutejs/native-linux-x64": "0.20.0-beta.72",
|
|
307
|
+
"@absolutejs/native-windows-arm64": "0.20.0-beta.72",
|
|
308
|
+
"@absolutejs/native-windows-x64": "0.20.0-beta.72"
|
|
309
309
|
},
|
|
310
310
|
"overrides": {
|
|
311
311
|
"@sinclair/typebox": "0.34.52",
|
|
@@ -525,7 +525,7 @@
|
|
|
525
525
|
]
|
|
526
526
|
}
|
|
527
527
|
},
|
|
528
|
-
"version": "0.20.0-beta.
|
|
528
|
+
"version": "0.20.0-beta.72",
|
|
529
529
|
"workspaces": [
|
|
530
530
|
"tests/fixtures/*",
|
|
531
531
|
"tests/fixtures/_packages/*"
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
getWorkspaceServices,
|
|
4
|
-
isWorkspaceConfig,
|
|
5
|
-
loadConfig,
|
|
6
|
-
loadRawConfig
|
|
7
|
-
} from "./index-06cmrcdq.js";
|
|
8
|
-
import {
|
|
9
|
-
ANSI_ESCAPE_CODE
|
|
10
|
-
} from "./index-czwrxgdj.js";
|
|
11
|
-
import"./index-mywsk201.js";
|
|
12
|
-
|
|
13
|
-
// src/cli/scripts/typecheck.ts
|
|
14
|
-
import { resolve, join } from "path";
|
|
15
|
-
import { existsSync, readFileSync } from "fs";
|
|
16
|
-
import { mkdir, writeFile } from "fs/promises";
|
|
17
|
-
var isCommandService = (service) => service.kind === "command" || Array.isArray(service.command);
|
|
18
|
-
var resolveConfigPath = (configPath) => resolve(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
19
|
-
var getTypecheckTargets = async (configPath) => {
|
|
20
|
-
if (!existsSync(resolveConfigPath(configPath))) {
|
|
21
|
-
const defaultService = {};
|
|
22
|
-
return [defaultService];
|
|
23
|
-
}
|
|
24
|
-
const rawConfig = await loadRawConfig(configPath);
|
|
25
|
-
if (!isWorkspaceConfig(rawConfig)) {
|
|
26
|
-
return [await loadConfig(configPath)];
|
|
27
|
-
}
|
|
28
|
-
return Object.values(getWorkspaceServices(rawConfig)).filter((service) => !isCommandService(service));
|
|
29
|
-
};
|
|
30
|
-
var STACK_OVERFLOW = "Maximum call stack size exceeded";
|
|
31
|
-
var DEEP_STACK_KB = 4000;
|
|
32
|
-
var spawnChecker = async (name, command) => {
|
|
33
|
-
const proc = Bun.spawn(command, {
|
|
34
|
-
stderr: "pipe",
|
|
35
|
-
stdout: "pipe"
|
|
36
|
-
});
|
|
37
|
-
const [stdout, stderr] = await Promise.all([
|
|
38
|
-
new Response(proc.stdout).text(),
|
|
39
|
-
new Response(proc.stderr).text()
|
|
40
|
-
]);
|
|
41
|
-
const exitCode = await proc.exited;
|
|
42
|
-
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
43
|
-
};
|
|
44
|
-
var run = async (name, command) => {
|
|
45
|
-
const first = await spawnChecker(name, command);
|
|
46
|
-
if (!first.output.includes(STACK_OVERFLOW))
|
|
47
|
-
return first;
|
|
48
|
-
const [bin, ...args] = command;
|
|
49
|
-
if (bin === undefined)
|
|
50
|
-
return first;
|
|
51
|
-
const deep = await spawnChecker(name, [
|
|
52
|
-
"node",
|
|
53
|
-
`--stack-size=${DEEP_STACK_KB}`,
|
|
54
|
-
bin,
|
|
55
|
-
...args
|
|
56
|
-
]).catch(() => first);
|
|
57
|
-
return deep.output.includes(STACK_OVERFLOW) ? first : deep;
|
|
58
|
-
};
|
|
59
|
-
var shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
60
|
-
var runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]);
|
|
61
|
-
var findBin = (name) => {
|
|
62
|
-
const local = resolve("node_modules", ".bin", name);
|
|
63
|
-
return existsSync(local) ? local : null;
|
|
64
|
-
};
|
|
65
|
-
var ANSI_COLOR_REGEX = new RegExp(`${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[[0-9;]*m`, "g");
|
|
66
|
-
var ANSI_PURPLE_REGEX = `${String.fromCharCode(ANSI_ESCAPE_CODE)}[35m`;
|
|
67
|
-
var ANSI_CYAN_REGEX = new RegExp(`^${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[36m|\\t`);
|
|
68
|
-
var ANSI_TOKEN_END_REGEX = new RegExp(`${String.fromCharCode(ANSI_ESCAPE_CODE)}\\[3[69]m`);
|
|
69
|
-
var stripAnsi = (str) => str.replace(ANSI_COLOR_REGEX, "");
|
|
70
|
-
var formatSvelteOutput = (output) => {
|
|
71
|
-
const cwd = `${process.cwd()}/`;
|
|
72
|
-
const summaryMatch = stripAnsi(output).match(/svelte-check found (\d+) error/);
|
|
73
|
-
const errorCount = summaryMatch ? parseInt(summaryMatch[1] ?? "0", 10) : 0;
|
|
74
|
-
const formatted = output.split(`
|
|
75
|
-
`).filter((line) => {
|
|
76
|
-
const plain = stripAnsi(line);
|
|
77
|
-
return !plain.startsWith("Loading svelte-check") && !plain.startsWith("Getting Svelte") && !plain.startsWith("====") && !plain.startsWith("svelte-check found") && !/^\d+ (START|COMPLETED)/.test(plain) && plain.trim() !== "";
|
|
78
|
-
}).flatMap((line) => {
|
|
79
|
-
const result = line.replaceAll(cwd, "");
|
|
80
|
-
const plain = stripAnsi(result);
|
|
81
|
-
const pathMatch = plain.match(/^(\S+\.svelte):(\d+:\d+)$/);
|
|
82
|
-
if (pathMatch) {
|
|
83
|
-
return [
|
|
84
|
-
`\x1B[96m${pathMatch[1]}\x1B[0m:\x1B[93m${pathMatch[2]}\x1B[0m`
|
|
85
|
-
];
|
|
86
|
-
}
|
|
87
|
-
if (result.includes(ANSI_PURPLE_REGEX)) {
|
|
88
|
-
const plainLine = stripAnsi(result);
|
|
89
|
-
const before = stripAnsi(result.split(ANSI_PURPLE_REGEX)[0] ?? "");
|
|
90
|
-
const token = stripAnsi((result.split(ANSI_PURPLE_REGEX)[1] ?? "").split(ANSI_TOKEN_END_REGEX)[0] ?? "");
|
|
91
|
-
if (!token)
|
|
92
|
-
return [result];
|
|
93
|
-
const expanded = before.replace(/\t/g, " ");
|
|
94
|
-
const expandedLine = plainLine.replace(/\t/g, " ");
|
|
95
|
-
const underline = "~".repeat(token.length);
|
|
96
|
-
return [
|
|
97
|
-
`\x1B[0m${expandedLine}`,
|
|
98
|
-
`${" ".repeat(expanded.length)}\x1B[91m${underline}\x1B[0m`
|
|
99
|
-
];
|
|
100
|
-
}
|
|
101
|
-
if (ANSI_CYAN_REGEX.test(result) && !result.includes("Error") && !result.includes(ANSI_PURPLE_REGEX)) {
|
|
102
|
-
return [];
|
|
103
|
-
}
|
|
104
|
-
return [result];
|
|
105
|
-
}).join(`
|
|
106
|
-
`);
|
|
107
|
-
if (errorCount > 0) {
|
|
108
|
-
const suffix = errorCount === 1 ? "" : "s";
|
|
109
|
-
return `${formatted}
|
|
110
|
-
|
|
111
|
-
Found ${errorCount} error${suffix}.`;
|
|
112
|
-
}
|
|
113
|
-
return formatted;
|
|
114
|
-
};
|
|
115
|
-
var ABSOLUTE_INTERNAL_EXCLUDES = [
|
|
116
|
-
".absolutejs/**/*",
|
|
117
|
-
"**/build/**/*",
|
|
118
|
-
"**/generated/**/*"
|
|
119
|
-
];
|
|
120
|
-
var resolveAbsoluteTypeFile = (fileName) => {
|
|
121
|
-
const candidates = [
|
|
122
|
-
resolve("node_modules/@absolutejs/absolute/dist/types", fileName),
|
|
123
|
-
resolve(import.meta.dir, "../types", fileName),
|
|
124
|
-
resolve(import.meta.dir, "../../types", fileName),
|
|
125
|
-
resolve(import.meta.dir, "../../../types", fileName)
|
|
126
|
-
];
|
|
127
|
-
return candidates.find((candidate) => existsSync(candidate)) ?? candidates[0];
|
|
128
|
-
};
|
|
129
|
-
var ABSOLUTE_TYPECHECK_FILES = [
|
|
130
|
-
resolveAbsoluteTypeFile("style-module-shim.d.ts")
|
|
131
|
-
];
|
|
132
|
-
var readProjectTsconfig = () => {
|
|
133
|
-
try {
|
|
134
|
-
return JSON.parse(readFileSync(resolve("tsconfig.json"), "utf-8"));
|
|
135
|
-
} catch {
|
|
136
|
-
return {};
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
var toGeneratedConfigPath = (path) => path.startsWith("/") ? path : `../${path}`;
|
|
140
|
-
var getProjectTypecheckIncludes = () => {
|
|
141
|
-
const config = readProjectTsconfig();
|
|
142
|
-
const includes = Array.isArray(config.include) && config.include.length > 0 ? config.include : ["**/*"];
|
|
143
|
-
const files = Array.isArray(config.files) ? config.files : [];
|
|
144
|
-
return [
|
|
145
|
-
...includes.map(toGeneratedConfigPath),
|
|
146
|
-
...files.map(toGeneratedConfigPath),
|
|
147
|
-
...ABSOLUTE_TYPECHECK_FILES
|
|
148
|
-
];
|
|
149
|
-
};
|
|
150
|
-
var getProjectTypecheckExcludes = () => {
|
|
151
|
-
const config = readProjectTsconfig();
|
|
152
|
-
const excludes = Array.isArray(config.exclude) ? config.exclude : [];
|
|
153
|
-
return [
|
|
154
|
-
...new Set([
|
|
155
|
-
...ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
|
|
156
|
-
...excludes.map(toGeneratedConfigPath)
|
|
157
|
-
])
|
|
158
|
-
];
|
|
159
|
-
};
|
|
160
|
-
var buildVueTscCheck = async (cacheDir) => {
|
|
161
|
-
const vueTscBin = findBin("vue-tsc");
|
|
162
|
-
if (!vueTscBin) {
|
|
163
|
-
console.error("\x1B[31m\u2717\x1B[0m vue-tsc is required for Vue type checking. Install it: bun add -d vue-tsc");
|
|
164
|
-
process.exit(1);
|
|
165
|
-
}
|
|
166
|
-
const vueTsconfigPath = join(cacheDir, "tsconfig.vue-check.json");
|
|
167
|
-
await writeFile(vueTsconfigPath, JSON.stringify({
|
|
168
|
-
compilerOptions: {
|
|
169
|
-
rootDir: ".."
|
|
170
|
-
},
|
|
171
|
-
exclude: getProjectTypecheckExcludes(),
|
|
172
|
-
extends: resolve("tsconfig.json"),
|
|
173
|
-
include: getProjectTypecheckIncludes()
|
|
174
|
-
}, null, "\t"));
|
|
175
|
-
const base = [
|
|
176
|
-
vueTscBin,
|
|
177
|
-
"--noEmit",
|
|
178
|
-
"--project",
|
|
179
|
-
resolve(vueTsconfigPath),
|
|
180
|
-
"--pretty"
|
|
181
|
-
];
|
|
182
|
-
const cached = await run("vue-tsc", [
|
|
183
|
-
...base,
|
|
184
|
-
"--incremental",
|
|
185
|
-
"--tsBuildInfoFile",
|
|
186
|
-
join(cacheDir, "vue-tsc.tsbuildinfo")
|
|
187
|
-
]);
|
|
188
|
-
if (cached.exitCode === 0 || cached.output.length > 0)
|
|
189
|
-
return cached;
|
|
190
|
-
return run("vue-tsc", base);
|
|
191
|
-
};
|
|
192
|
-
var buildAngularCheck = async (cacheDir, angularDir) => {
|
|
193
|
-
const ngcBin = findBin("ngc");
|
|
194
|
-
if (!ngcBin) {
|
|
195
|
-
console.error("\x1B[31m\u2717\x1B[0m @angular/compiler-cli is required for Angular type checking. Install it: bun add -d @angular/compiler-cli");
|
|
196
|
-
process.exit(1);
|
|
197
|
-
}
|
|
198
|
-
const angularTsconfigPath = join(cacheDir, "tsconfig.angular-check.json");
|
|
199
|
-
await writeFile(angularTsconfigPath, JSON.stringify({
|
|
200
|
-
angularCompilerOptions: {
|
|
201
|
-
strictTemplates: true
|
|
202
|
-
},
|
|
203
|
-
compilerOptions: {
|
|
204
|
-
noEmit: true,
|
|
205
|
-
rootDir: ".."
|
|
206
|
-
},
|
|
207
|
-
exclude: ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
|
|
208
|
-
extends: resolve("tsconfig.json"),
|
|
209
|
-
include: [`../${angularDir}/**/*`]
|
|
210
|
-
}, null, "\t"));
|
|
211
|
-
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve(angularTsconfigPath))}`);
|
|
212
|
-
};
|
|
213
|
-
var buildTscCheck = (cacheDir) => {
|
|
214
|
-
const tscBin = findBin("tsc");
|
|
215
|
-
if (!tscBin) {
|
|
216
|
-
console.error("\x1B[31m\u2717\x1B[0m typescript is required for type checking. Install it: bun add -d typescript");
|
|
217
|
-
process.exit(1);
|
|
218
|
-
}
|
|
219
|
-
const tscConfigPath = join(cacheDir, "tsconfig.typecheck.json");
|
|
220
|
-
return writeFile(tscConfigPath, JSON.stringify({
|
|
221
|
-
compilerOptions: {
|
|
222
|
-
rootDir: ".."
|
|
223
|
-
},
|
|
224
|
-
exclude: getProjectTypecheckExcludes(),
|
|
225
|
-
extends: resolve("tsconfig.json"),
|
|
226
|
-
include: getProjectTypecheckIncludes()
|
|
227
|
-
}, null, "\t")).then(() => run("tsc", [
|
|
228
|
-
tscBin,
|
|
229
|
-
"--noEmit",
|
|
230
|
-
"--project",
|
|
231
|
-
resolve(tscConfigPath),
|
|
232
|
-
"--incremental",
|
|
233
|
-
"--tsBuildInfoFile",
|
|
234
|
-
join(cacheDir, "tsc.tsbuildinfo"),
|
|
235
|
-
"--pretty"
|
|
236
|
-
]));
|
|
237
|
-
};
|
|
238
|
-
var buildSvelteCheck = async (cacheDir, svelteDir) => {
|
|
239
|
-
const svelteBin = findBin("svelte-check");
|
|
240
|
-
if (!svelteBin) {
|
|
241
|
-
console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
|
|
242
|
-
process.exit(1);
|
|
243
|
-
}
|
|
244
|
-
const svelteTsconfigPath = join(cacheDir, "tsconfig.svelte-check.json");
|
|
245
|
-
await writeFile(svelteTsconfigPath, JSON.stringify({
|
|
246
|
-
extends: resolve("tsconfig.json"),
|
|
247
|
-
files: ABSOLUTE_TYPECHECK_FILES,
|
|
248
|
-
include: [`../${svelteDir}/**/*`]
|
|
249
|
-
}, null, "\t"));
|
|
250
|
-
return run("svelte-check", [
|
|
251
|
-
svelteBin,
|
|
252
|
-
"--tsconfig",
|
|
253
|
-
resolve(svelteTsconfigPath),
|
|
254
|
-
"--threshold",
|
|
255
|
-
"error",
|
|
256
|
-
"--compiler-warnings",
|
|
257
|
-
"css-unused-selector:ignore",
|
|
258
|
-
"--output",
|
|
259
|
-
"human-verbose",
|
|
260
|
-
"--color"
|
|
261
|
-
]);
|
|
262
|
-
};
|
|
263
|
-
var typecheck = async (configPath) => {
|
|
264
|
-
const targets = await getTypecheckTargets(configPath);
|
|
265
|
-
const hasAngular = targets.some((config) => Boolean(config.angularDirectory));
|
|
266
|
-
const hasSvelte = targets.some((config) => Boolean(config.svelteDirectory));
|
|
267
|
-
const hasVue = targets.some((config) => Boolean(config.vueDirectory));
|
|
268
|
-
const svelteDirs = [
|
|
269
|
-
...new Set(targets.map((config) => config.svelteDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
|
|
270
|
-
];
|
|
271
|
-
const angularDirs = [
|
|
272
|
-
...new Set(targets.map((config) => config.angularDirectory).filter((dir) => typeof dir === "string" && dir.length > 0))
|
|
273
|
-
];
|
|
274
|
-
const cacheDir = ".absolutejs";
|
|
275
|
-
await mkdir(cacheDir, { recursive: true });
|
|
276
|
-
const checks = [];
|
|
277
|
-
checks.push(hasVue ? buildVueTscCheck(cacheDir) : buildTscCheck(cacheDir));
|
|
278
|
-
for (const svelteDir of hasSvelte ? svelteDirs : []) {
|
|
279
|
-
checks.push(buildSvelteCheck(cacheDir, svelteDir));
|
|
280
|
-
}
|
|
281
|
-
for (const angularDir of hasAngular ? angularDirs : []) {
|
|
282
|
-
checks.push(buildAngularCheck(cacheDir, angularDir));
|
|
283
|
-
}
|
|
284
|
-
const results = await Promise.all(checks);
|
|
285
|
-
const failed = results.filter((res) => res.exitCode !== 0);
|
|
286
|
-
if (failed.length === 0) {
|
|
287
|
-
console.log("\x1B[32m\u2713\x1B[0m Typecheck passed");
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
for (const result of failed) {
|
|
291
|
-
console.error(`
|
|
292
|
-
\x1B[31m[${result.name}]\x1B[0m`);
|
|
293
|
-
const output = result.name === "svelte-check" ? formatSvelteOutput(result.output) : result.output;
|
|
294
|
-
console.error(output);
|
|
295
|
-
}
|
|
296
|
-
console.error(`
|
|
297
|
-
\x1B[31m\u2717\x1B[0m Typecheck failed: ${failed.map((res) => res.name).join(", ")}`);
|
|
298
|
-
process.exit(1);
|
|
299
|
-
};
|
|
300
|
-
export {
|
|
301
|
-
typecheck
|
|
302
|
-
};
|