@absolutejs/absolute 0.19.0-beta.1040 → 0.19.0-beta.1042
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/index.js +677 -108
- package/dist/index.js +68 -9
- package/dist/index.js.map +6 -5
- package/dist/src/cli/inspectData.d.ts +11 -0
- package/dist/src/cli/inspectTui.d.ts +1 -0
- package/dist/src/cli/scripts/inspect.d.ts +1 -0
- package/dist/src/cli/scripts/islands.d.ts +1 -0
- package/dist/src/core/prepare.d.ts +43 -2
- package/dist/src/dev/requestInspector.d.ts +43 -0
- package/dist/types/cli.d.ts +10 -0
- package/dist/types/globals.d.ts +8 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -169870,6 +169870,10 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
169870
169870
|
}
|
|
169871
169871
|
} });
|
|
169872
169872
|
});
|
|
169873
|
+
|
|
169874
|
+
// src/core/islandManifest.ts
|
|
169875
|
+
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
|
|
169876
|
+
|
|
169873
169877
|
// src/core/islands.ts
|
|
169874
169878
|
var isRecord = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
|
|
169875
169879
|
if (!isIslandComponentDefinition(component))
|
|
@@ -174014,14 +174018,569 @@ var init_routes = __esm(() => {
|
|
|
174014
174018
|
};
|
|
174015
174019
|
});
|
|
174016
174020
|
|
|
174021
|
+
// src/cli/inspectData.ts
|
|
174022
|
+
var SLOW_MS = 100, VERY_SLOW_MS = 500, HTTP_SERVER_ERROR = 500, HTTP_CLIENT_ERROR = 400, HTTP_REDIRECT = 300, P95 = 0.95, TIME_WIDTH = 8, METHOD_WIDTH = 6, STATUS_WIDTH2 = 6, MS_WIDTH = 7, SIZE_WIDTH = 8, MIN_PATH_WIDTH = 12, COLUMN_GAP = " ", COLUMN_COUNT = 6, METHOD_COLOR2, statusColor3 = (status2) => {
|
|
174023
|
+
if (status2 >= HTTP_SERVER_ERROR)
|
|
174024
|
+
return colors.red;
|
|
174025
|
+
if (status2 >= HTTP_CLIENT_ERROR)
|
|
174026
|
+
return colors.yellow;
|
|
174027
|
+
if (status2 >= HTTP_REDIRECT)
|
|
174028
|
+
return colors.cyan;
|
|
174029
|
+
return colors.green;
|
|
174030
|
+
}, durationColor = (durationMs) => {
|
|
174031
|
+
if (durationMs >= VERY_SLOW_MS)
|
|
174032
|
+
return colors.red;
|
|
174033
|
+
if (durationMs >= SLOW_MS)
|
|
174034
|
+
return colors.yellow;
|
|
174035
|
+
return colors.dim;
|
|
174036
|
+
}, isDim = (kind) => kind !== "api" && kind !== "page", pickServer2 = (instances) => {
|
|
174037
|
+
const withUrl = instances.filter((instance) => instance.url !== null);
|
|
174038
|
+
return withUrl.find((instance) => instance.source === "dev") ?? withUrl.find((instance) => instance.source !== "untracked") ?? withUrl[0] ?? null;
|
|
174039
|
+
}, clock = (epochMs) => new Date(epochMs).toLocaleTimeString([], { hour12: false }), tint = (text, color, dim) => `${dim ? colors.dim : color}${text}${colors.reset}`, aggregates = (records) => {
|
|
174040
|
+
const durations = records.filter((record) => !isDim(record.kind)).map((record) => record.durationMs).sort((left, right) => left - right);
|
|
174041
|
+
const total = durations.reduce((sum, value) => sum + value, 0);
|
|
174042
|
+
const avgMs = durations.length ? Math.round(total / durations.length) : 0;
|
|
174043
|
+
const p95Index = Math.min(durations.length - 1, Math.floor(durations.length * P95));
|
|
174044
|
+
const p95Ms = durations.length ? Math.round(durations[p95Index] ?? 0) : 0;
|
|
174045
|
+
return { avgMs, count: records.length, p95Ms };
|
|
174046
|
+
}, fetchRequests = async (url) => {
|
|
174047
|
+
try {
|
|
174048
|
+
const response = await fetch(`${url}__absolute/requests`);
|
|
174049
|
+
if (!response.ok)
|
|
174050
|
+
return null;
|
|
174051
|
+
const data = await response.json();
|
|
174052
|
+
if (!Array.isArray(data))
|
|
174053
|
+
return null;
|
|
174054
|
+
return data.map((entry) => ({
|
|
174055
|
+
at: Number(entry.at) || 0,
|
|
174056
|
+
durationMs: Number(entry.durationMs) || 0,
|
|
174057
|
+
kind: entry.kind,
|
|
174058
|
+
method: String(entry.method ?? ""),
|
|
174059
|
+
path: String(entry.path ?? ""),
|
|
174060
|
+
size: entry.size === null || entry.size === undefined ? null : Number(entry.size),
|
|
174061
|
+
status: Number(entry.status) || 0
|
|
174062
|
+
}));
|
|
174063
|
+
} catch {
|
|
174064
|
+
return null;
|
|
174065
|
+
}
|
|
174066
|
+
}, findServer = async () => pickServer2(await enrichInstances(await discoverInstances())), formatRequestRow = (record, pathWidth) => {
|
|
174067
|
+
const dim = isDim(record.kind);
|
|
174068
|
+
const size = record.size === null ? "\u2014" : formatBytes(record.size);
|
|
174069
|
+
return [
|
|
174070
|
+
tint(padLine(clock(record.at), TIME_WIDTH), colors.dim, true),
|
|
174071
|
+
tint(padLine(record.method, METHOD_WIDTH), METHOD_COLOR2[record.method] ?? colors.reset, dim),
|
|
174072
|
+
tint(padLine(truncateText(record.path, pathWidth), pathWidth), colors.reset, dim),
|
|
174073
|
+
tint(padLine(String(record.status), STATUS_WIDTH2), statusColor3(record.status), dim),
|
|
174074
|
+
tint(padLine(`${Math.round(record.durationMs)}ms`, MS_WIDTH), durationColor(record.durationMs), dim),
|
|
174075
|
+
tint(padLine(size, SIZE_WIDTH), colors.dim, true)
|
|
174076
|
+
].join(COLUMN_GAP);
|
|
174077
|
+
}, pathColumnWidth = (totalWidth) => {
|
|
174078
|
+
const fixed = TIME_WIDTH + METHOD_WIDTH + STATUS_WIDTH2 + MS_WIDTH + SIZE_WIDTH;
|
|
174079
|
+
const gaps = COLUMN_GAP.length * (COLUMN_COUNT - 1);
|
|
174080
|
+
return Math.max(MIN_PATH_WIDTH, totalWidth - fixed - gaps);
|
|
174081
|
+
}, requestHeader = (pathWidth) => `${colors.dim}${[
|
|
174082
|
+
padLine("TIME", TIME_WIDTH),
|
|
174083
|
+
padLine("METHOD", METHOD_WIDTH),
|
|
174084
|
+
padLine("PATH", pathWidth),
|
|
174085
|
+
padLine("STATUS", STATUS_WIDTH2),
|
|
174086
|
+
padLine("TOOK", MS_WIDTH),
|
|
174087
|
+
padLine("SIZE", SIZE_WIDTH)
|
|
174088
|
+
].join(COLUMN_GAP)}${colors.reset}`;
|
|
174089
|
+
var init_inspectData = __esm(() => {
|
|
174090
|
+
init_formatBytes();
|
|
174091
|
+
init_discoverInstances();
|
|
174092
|
+
init_instanceStatus();
|
|
174093
|
+
init_tuiPrimitives();
|
|
174094
|
+
METHOD_COLOR2 = {
|
|
174095
|
+
DELETE: colors.red,
|
|
174096
|
+
GET: colors.green,
|
|
174097
|
+
PATCH: colors.yellow,
|
|
174098
|
+
POST: colors.cyan,
|
|
174099
|
+
PUT: colors.yellow
|
|
174100
|
+
};
|
|
174101
|
+
});
|
|
174102
|
+
|
|
174103
|
+
// src/cli/inspectTui.ts
|
|
174104
|
+
var HEADER_LINES = 3, FOOTER_LINES = 2, driveInspectTui = async (terminal) => {
|
|
174105
|
+
const { promise, resolve: resolveExit } = Promise.withResolvers();
|
|
174106
|
+
let records = [];
|
|
174107
|
+
let serverName = null;
|
|
174108
|
+
let disposed = false;
|
|
174109
|
+
let refreshTimer = null;
|
|
174110
|
+
const divider = (width) => `${colors.dim}${"\u2500".repeat(Math.max(width, 1))}${colors.reset}`;
|
|
174111
|
+
const titleLine = (width) => {
|
|
174112
|
+
const name = serverName ? ` ${colors.bold}${serverName}${colors.reset}` : "";
|
|
174113
|
+
const left = `${colors.cyan}${colors.bold}ABSOLUTEJS${colors.reset} ${colors.dim}request inspector${colors.reset}${name}`;
|
|
174114
|
+
const right = `${colors.dim}${formatTimestamp2()}${colors.reset}`;
|
|
174115
|
+
const gap = Math.max(1, width - visibleLength(left) - visibleLength(right));
|
|
174116
|
+
return `${left}${" ".repeat(gap)}${right}`;
|
|
174117
|
+
};
|
|
174118
|
+
const emptyMessage = () => serverName === null ? ` ${colors.dim}No running dev server \u2014 start one with \`absolute dev\`.${colors.reset}` : ` ${colors.dim}No requests yet \u2014 hit your app to see them here.${colors.reset}`;
|
|
174119
|
+
const render = () => {
|
|
174120
|
+
if (disposed)
|
|
174121
|
+
return;
|
|
174122
|
+
const width = process.stdout.columns ?? LIST_TUI_DEFAULT_WIDTH;
|
|
174123
|
+
const height = process.stdout.rows ?? LIST_TUI_DEFAULT_HEIGHT;
|
|
174124
|
+
const pathWidth = pathColumnWidth(width);
|
|
174125
|
+
const bodyHeight = Math.max(1, height - HEADER_LINES - FOOTER_LINES);
|
|
174126
|
+
const visible = records.slice(-bodyHeight);
|
|
174127
|
+
const rows = [
|
|
174128
|
+
padLine(titleLine(width), width),
|
|
174129
|
+
divider(width),
|
|
174130
|
+
padLine(` ${requestHeader(pathWidth)}`, width)
|
|
174131
|
+
];
|
|
174132
|
+
if (visible.length === 0)
|
|
174133
|
+
rows.push(padLine(emptyMessage(), width));
|
|
174134
|
+
for (const record of visible) {
|
|
174135
|
+
rows.push(padLine(` ${formatRequestRow(record, pathWidth)}`, width));
|
|
174136
|
+
}
|
|
174137
|
+
for (let index = visible.length;index < bodyHeight; index += 1) {
|
|
174138
|
+
rows.push(" ".repeat(width));
|
|
174139
|
+
}
|
|
174140
|
+
rows.push(divider(width));
|
|
174141
|
+
const { avgMs, count, p95Ms } = aggregates(records);
|
|
174142
|
+
rows.push(padLine(`${colors.dim}${count} requests \xB7 ${avgMs}ms avg \xB7 ${p95Ms}ms p95 \xB7 live \xB7 q quit${colors.reset}`, width));
|
|
174143
|
+
const screen = rows.slice(0, height).map((line) => `\x1B[2K${line}`).join(`
|
|
174144
|
+
`);
|
|
174145
|
+
process.stdout.write(`\x1B[H${screen}\x1B[?25l`);
|
|
174146
|
+
};
|
|
174147
|
+
const refresh = async () => {
|
|
174148
|
+
const server2 = await findServer();
|
|
174149
|
+
if (!server2 || server2.url === null) {
|
|
174150
|
+
serverName = null;
|
|
174151
|
+
records = [];
|
|
174152
|
+
render();
|
|
174153
|
+
return;
|
|
174154
|
+
}
|
|
174155
|
+
serverName = server2.name;
|
|
174156
|
+
const fetched = await fetchRequests(server2.url);
|
|
174157
|
+
if (fetched)
|
|
174158
|
+
records = fetched;
|
|
174159
|
+
render();
|
|
174160
|
+
};
|
|
174161
|
+
const dispose = () => {
|
|
174162
|
+
if (disposed)
|
|
174163
|
+
return;
|
|
174164
|
+
disposed = true;
|
|
174165
|
+
if (refreshTimer)
|
|
174166
|
+
clearInterval(refreshTimer);
|
|
174167
|
+
process.stdout.off("resize", render);
|
|
174168
|
+
terminal.off("data", onData);
|
|
174169
|
+
if (terminal.setRawMode)
|
|
174170
|
+
terminal.setRawMode(false);
|
|
174171
|
+
terminal.pause();
|
|
174172
|
+
if (terminal !== process.stdin)
|
|
174173
|
+
terminal.destroy();
|
|
174174
|
+
process.stdout.write("\x1B[?25h\x1B[?1049l");
|
|
174175
|
+
};
|
|
174176
|
+
const quit = () => {
|
|
174177
|
+
process.off("SIGINT", quit);
|
|
174178
|
+
process.off("SIGTERM", quit);
|
|
174179
|
+
dispose();
|
|
174180
|
+
resolveExit();
|
|
174181
|
+
};
|
|
174182
|
+
const onData = (chunk) => {
|
|
174183
|
+
for (const char of chunk.toString()) {
|
|
174184
|
+
if (char === "q" || char === "\x03")
|
|
174185
|
+
quit();
|
|
174186
|
+
}
|
|
174187
|
+
};
|
|
174188
|
+
process.on("SIGINT", quit);
|
|
174189
|
+
process.on("SIGTERM", quit);
|
|
174190
|
+
process.stdout.write("\x1B[?1049h\x1B[2J\x1B[H\x1B[?25l");
|
|
174191
|
+
terminal.resume();
|
|
174192
|
+
terminal.on("data", onData);
|
|
174193
|
+
process.stdout.on("resize", render);
|
|
174194
|
+
refreshTimer = setInterval(() => {
|
|
174195
|
+
refresh();
|
|
174196
|
+
}, LIST_WATCH_REFRESH_MS);
|
|
174197
|
+
await refresh();
|
|
174198
|
+
await promise;
|
|
174199
|
+
}, runInspectTui = async () => {
|
|
174200
|
+
const input = openTtyStream2();
|
|
174201
|
+
if (!input) {
|
|
174202
|
+
process.stdout.write("Interactive inspect requires a TTY. Run `absolute inspect --json` instead.\n");
|
|
174203
|
+
return;
|
|
174204
|
+
}
|
|
174205
|
+
await driveInspectTui(input);
|
|
174206
|
+
};
|
|
174207
|
+
var init_inspectTui = __esm(() => {
|
|
174208
|
+
init_constants();
|
|
174209
|
+
init_inspectData();
|
|
174210
|
+
init_tuiPrimitives();
|
|
174211
|
+
});
|
|
174212
|
+
|
|
174213
|
+
// src/cli/scripts/inspect.ts
|
|
174214
|
+
var exports_inspect = {};
|
|
174215
|
+
__export(exports_inspect, {
|
|
174216
|
+
runInspect: () => runInspect
|
|
174217
|
+
});
|
|
174218
|
+
var SNAPSHOT_ROWS = 30, printDim4 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
|
|
174219
|
+
`), runInspect = async (args) => {
|
|
174220
|
+
if (!args.includes("--json") && process.stdout.isTTY) {
|
|
174221
|
+
await runInspectTui();
|
|
174222
|
+
return;
|
|
174223
|
+
}
|
|
174224
|
+
const server2 = await findServer();
|
|
174225
|
+
if (!server2 || server2.url === null) {
|
|
174226
|
+
printDim4("No running server found. Start one with `absolute dev`, then run `absolute inspect`.");
|
|
174227
|
+
return;
|
|
174228
|
+
}
|
|
174229
|
+
const records = await fetchRequests(server2.url);
|
|
174230
|
+
if (!records) {
|
|
174231
|
+
printDim4(`Could not read requests from ${server2.name} \u2014 the inspector needs a dev server.`);
|
|
174232
|
+
return;
|
|
174233
|
+
}
|
|
174234
|
+
if (args.includes("--json")) {
|
|
174235
|
+
process.stdout.write(`${JSON.stringify(records, null, 2)}
|
|
174236
|
+
`);
|
|
174237
|
+
return;
|
|
174238
|
+
}
|
|
174239
|
+
if (records.length === 0) {
|
|
174240
|
+
printDim4("No requests captured yet \u2014 hit your app, then run it again.");
|
|
174241
|
+
return;
|
|
174242
|
+
}
|
|
174243
|
+
const width = process.stdout.columns ?? LIST_TUI_DEFAULT_WIDTH;
|
|
174244
|
+
const pathWidth = pathColumnWidth(width);
|
|
174245
|
+
const lines = records.slice(-SNAPSHOT_ROWS).map((record) => ` ${formatRequestRow(record, pathWidth)}`);
|
|
174246
|
+
const { avgMs, count, p95Ms } = aggregates(records);
|
|
174247
|
+
process.stdout.write(` ${requestHeader(pathWidth)}
|
|
174248
|
+
${lines.join(`
|
|
174249
|
+
`)}
|
|
174250
|
+
|
|
174251
|
+
${colors.dim}${count} requests \xB7 ${avgMs}ms avg \xB7 ${p95Ms}ms p95 \xB7 ${server2.name}${colors.reset}
|
|
174252
|
+
`);
|
|
174253
|
+
};
|
|
174254
|
+
var init_inspect = __esm(() => {
|
|
174255
|
+
init_constants();
|
|
174256
|
+
init_inspectData();
|
|
174257
|
+
init_inspectTui();
|
|
174258
|
+
init_tuiPrimitives();
|
|
174259
|
+
});
|
|
174260
|
+
|
|
174261
|
+
// src/build/scanEntryPoints.ts
|
|
174262
|
+
import { existsSync as existsSync25 } from "fs";
|
|
174263
|
+
var {Glob: Glob4 } = globalThis.Bun;
|
|
174264
|
+
var scanEntryPoints = async (dir, pattern) => {
|
|
174265
|
+
if (!existsSync25(dir))
|
|
174266
|
+
return [];
|
|
174267
|
+
const entryPaths = [];
|
|
174268
|
+
const glob = new Glob4(pattern);
|
|
174269
|
+
for await (const file of glob.scan({ absolute: true, cwd: dir })) {
|
|
174270
|
+
entryPaths.push(file);
|
|
174271
|
+
}
|
|
174272
|
+
return entryPaths;
|
|
174273
|
+
};
|
|
174274
|
+
var init_scanEntryPoints = () => {};
|
|
174275
|
+
|
|
174276
|
+
// src/islands/sourceMetadata.ts
|
|
174277
|
+
var islandFrameworks, islandHydrationModes, isIslandFramework = (value) => islandFrameworks.some((framework) => framework === value), isIslandHydrate = (value) => islandHydrationModes.some((hydrate) => hydrate === value), parseIslandTagAttributes = (attributeString) => {
|
|
174278
|
+
const frameworkMatch = attributeString.match(/\bframework\s*=\s*["']([^"']+)["']/);
|
|
174279
|
+
const componentMatch = attributeString.match(/\bcomponent\s*=\s*["']([^"']+)["']/);
|
|
174280
|
+
const hydrateMatch = attributeString.match(/\bhydrate\s*=\s*["']([^"']+)["']/);
|
|
174281
|
+
const framework = frameworkMatch?.[1];
|
|
174282
|
+
const component = componentMatch?.[1];
|
|
174283
|
+
if (!framework || !component) {
|
|
174284
|
+
return null;
|
|
174285
|
+
}
|
|
174286
|
+
if (!isIslandFramework(framework)) {
|
|
174287
|
+
return null;
|
|
174288
|
+
}
|
|
174289
|
+
const hydrateCandidate = hydrateMatch?.[1];
|
|
174290
|
+
return {
|
|
174291
|
+
component,
|
|
174292
|
+
framework,
|
|
174293
|
+
hydrate: hydrateCandidate && isIslandHydrate(hydrateCandidate) ? hydrateCandidate : undefined
|
|
174294
|
+
};
|
|
174295
|
+
}, normalizeUsage = (usage) => `${usage.framework}:${usage.component}:${usage.hydrate ?? ""}`, addUsage = (usageMap, usage) => {
|
|
174296
|
+
if (!usage)
|
|
174297
|
+
return;
|
|
174298
|
+
usageMap.set(normalizeUsage(usage), usage);
|
|
174299
|
+
}, addRenderCallUsage = (usageMap, match) => {
|
|
174300
|
+
const [, framework, component, hydrate] = match;
|
|
174301
|
+
if (!framework || !component || !isIslandFramework(framework)) {
|
|
174302
|
+
return;
|
|
174303
|
+
}
|
|
174304
|
+
addUsage(usageMap, {
|
|
174305
|
+
component,
|
|
174306
|
+
framework,
|
|
174307
|
+
hydrate: hydrate && isIslandHydrate(hydrate) ? hydrate : undefined
|
|
174308
|
+
});
|
|
174309
|
+
}, extractIslandUsagesFromSource = (source) => {
|
|
174310
|
+
const usageMap = new Map;
|
|
174311
|
+
const islandTagRegex = /<Island\b([\s\S]*?)(?:\/>|>(?:[\s\S]*?)<\/Island>)/g;
|
|
174312
|
+
let islandTagMatch = islandTagRegex.exec(source);
|
|
174313
|
+
while (islandTagMatch) {
|
|
174314
|
+
addUsage(usageMap, parseIslandTagAttributes(islandTagMatch[1] ?? ""));
|
|
174315
|
+
islandTagMatch = islandTagRegex.exec(source);
|
|
174316
|
+
}
|
|
174317
|
+
const absoluteIslandTagRegex = /<absolute-island\b([\s\S]*?)(?:\/>|>(?:[\s\S]*?)<\/absolute-island>)/g;
|
|
174318
|
+
let absoluteIslandMatch = absoluteIslandTagRegex.exec(source);
|
|
174319
|
+
while (absoluteIslandMatch) {
|
|
174320
|
+
addUsage(usageMap, parseIslandTagAttributes(absoluteIslandMatch[1] ?? ""));
|
|
174321
|
+
absoluteIslandMatch = absoluteIslandTagRegex.exec(source);
|
|
174322
|
+
}
|
|
174323
|
+
const staticRenderCallRegex = /renderIsland\s*\(\s*\{[\s\S]*?\bframework\s*:\s*['"]([^'"]+)['"][\s\S]*?\bcomponent\s*:\s*['"]([^'"]+)['"](?:[\s\S]*?\bhydrate\s*:\s*['"]([^'"]+)['"])?[\s\S]*?\}\s*\)/g;
|
|
174324
|
+
let renderMatch = staticRenderCallRegex.exec(source);
|
|
174325
|
+
while (renderMatch) {
|
|
174326
|
+
addRenderCallUsage(usageMap, renderMatch);
|
|
174327
|
+
renderMatch = staticRenderCallRegex.exec(source);
|
|
174328
|
+
}
|
|
174329
|
+
return [...usageMap.values()];
|
|
174330
|
+
};
|
|
174331
|
+
var init_sourceMetadata = __esm(() => {
|
|
174332
|
+
islandFrameworks = [
|
|
174333
|
+
"react",
|
|
174334
|
+
"svelte",
|
|
174335
|
+
"vue",
|
|
174336
|
+
"angular"
|
|
174337
|
+
];
|
|
174338
|
+
islandHydrationModes = [
|
|
174339
|
+
"load",
|
|
174340
|
+
"idle",
|
|
174341
|
+
"visible",
|
|
174342
|
+
"none"
|
|
174343
|
+
];
|
|
174344
|
+
});
|
|
174345
|
+
|
|
174346
|
+
// src/islands/pageMetadata.ts
|
|
174347
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
174348
|
+
import { dirname as dirname11, resolve as resolve13 } from "path";
|
|
174349
|
+
var pagePatterns, getPageDirs = (config) => [
|
|
174350
|
+
{ dir: config.angularDirectory, framework: "angular" },
|
|
174351
|
+
{ dir: config.emberDirectory, framework: "ember" },
|
|
174352
|
+
{ dir: config.reactDirectory, framework: "react" },
|
|
174353
|
+
{ dir: config.svelteDirectory, framework: "svelte" },
|
|
174354
|
+
{ dir: config.vueDirectory, framework: "vue" },
|
|
174355
|
+
{ dir: config.htmlDirectory, framework: "html" },
|
|
174356
|
+
{ dir: config.htmxDirectory, framework: "htmx" }
|
|
174357
|
+
].filter((entry) => typeof entry.dir === "string" && entry.dir.length > 0), buildIslandSourceLookup = async (config) => {
|
|
174358
|
+
const registryPath = config.islands?.registry;
|
|
174359
|
+
if (!registryPath) {
|
|
174360
|
+
return new Map;
|
|
174361
|
+
}
|
|
174362
|
+
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
174363
|
+
const lookup = new Map;
|
|
174364
|
+
for (const definition of buildInfo.definitions) {
|
|
174365
|
+
const source = definition.buildReference?.source;
|
|
174366
|
+
if (!source)
|
|
174367
|
+
continue;
|
|
174368
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve13(dirname11(buildInfo.resolvedRegistryPath), source);
|
|
174369
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve13(resolvedSource));
|
|
174370
|
+
}
|
|
174371
|
+
return lookup;
|
|
174372
|
+
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
174373
|
+
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
174374
|
+
return sourcePath ? {
|
|
174375
|
+
...usage,
|
|
174376
|
+
source: sourcePath
|
|
174377
|
+
} : usage;
|
|
174378
|
+
}), loadPageIslandFiles = async (entry, islandSourceLookup, pageMetadata) => {
|
|
174379
|
+
const pattern = pagePatterns[entry.framework];
|
|
174380
|
+
if (!pattern)
|
|
174381
|
+
return;
|
|
174382
|
+
const files = await scanEntryPoints(resolve13(entry.dir), pattern);
|
|
174383
|
+
for (const filePath of files) {
|
|
174384
|
+
const source = readFileSync23(filePath, "utf-8");
|
|
174385
|
+
const islands = extractIslandUsagesFromSource(source);
|
|
174386
|
+
pageMetadata.set(resolve13(filePath), {
|
|
174387
|
+
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
174388
|
+
pagePath: resolve13(filePath)
|
|
174389
|
+
});
|
|
174390
|
+
}
|
|
174391
|
+
}, loadPageIslandMetadata = async (config) => {
|
|
174392
|
+
const pageMetadata = new Map;
|
|
174393
|
+
const islandSourceLookup = await buildIslandSourceLookup(config);
|
|
174394
|
+
await Promise.all(getPageDirs(config).map((entry) => loadPageIslandFiles(entry, islandSourceLookup, pageMetadata)));
|
|
174395
|
+
return pageMetadata;
|
|
174396
|
+
};
|
|
174397
|
+
var init_pageMetadata = __esm(() => {
|
|
174398
|
+
init_islandEntries();
|
|
174399
|
+
init_scanEntryPoints();
|
|
174400
|
+
init_sourceMetadata();
|
|
174401
|
+
pagePatterns = {
|
|
174402
|
+
angular: "pages/**/*.{ts,js}",
|
|
174403
|
+
ember: "pages/**/*.{gjs,gts,ts,js}",
|
|
174404
|
+
html: "pages/**/*.html",
|
|
174405
|
+
htmx: "pages/**/*.html",
|
|
174406
|
+
react: "pages/**/*.{ts,tsx,js,jsx}",
|
|
174407
|
+
svelte: "pages/**/*.svelte",
|
|
174408
|
+
vue: "pages/**/*.vue"
|
|
174409
|
+
};
|
|
174410
|
+
});
|
|
174411
|
+
|
|
174412
|
+
// src/cli/scripts/islands.ts
|
|
174413
|
+
var exports_islands = {};
|
|
174414
|
+
__export(exports_islands, {
|
|
174415
|
+
runIslands: () => runIslands
|
|
174416
|
+
});
|
|
174417
|
+
import { existsSync as existsSync26, readFileSync as readFileSync24, statSync as statSync3 } from "fs";
|
|
174418
|
+
import { join as join24, relative as relative8, resolve as resolve14 } from "path";
|
|
174419
|
+
var FRAMEWORK_DIR_KEY, FRAMEWORK_COLOR, printDim5 = (message) => process.stdout.write(`${colors.dim}${message}${colors.reset}
|
|
174420
|
+
`), hostFrameworkOf = (pagePath, cwd, config) => {
|
|
174421
|
+
const resolved = resolve14(cwd, pagePath);
|
|
174422
|
+
for (const [framework, key] of Object.entries(FRAMEWORK_DIR_KEY)) {
|
|
174423
|
+
const dir = config[key];
|
|
174424
|
+
if (typeof dir === "string" && resolved.startsWith(resolve14(cwd, dir))) {
|
|
174425
|
+
return framework;
|
|
174426
|
+
}
|
|
174427
|
+
}
|
|
174428
|
+
return null;
|
|
174429
|
+
}, fileSize2 = (path) => {
|
|
174430
|
+
try {
|
|
174431
|
+
return statSync3(path).size;
|
|
174432
|
+
} catch {
|
|
174433
|
+
return 0;
|
|
174434
|
+
}
|
|
174435
|
+
}, readManifestSizes2 = (manifestDir) => {
|
|
174436
|
+
const manifestPath = join24(manifestDir, "manifest.json");
|
|
174437
|
+
if (!existsSync26(manifestPath))
|
|
174438
|
+
return null;
|
|
174439
|
+
const manifest = JSON.parse(readFileSync24(manifestPath, "utf-8"));
|
|
174440
|
+
const sizes = new Map;
|
|
174441
|
+
for (const [key, value] of Object.entries(manifest)) {
|
|
174442
|
+
sizes.set(key, fileSize2(join24(manifestDir, value.replace(/^\//, ""))));
|
|
174443
|
+
}
|
|
174444
|
+
return sizes;
|
|
174445
|
+
}, collectIslands = async (cwd, config, sizes) => {
|
|
174446
|
+
const registryPath = config.islands?.registry;
|
|
174447
|
+
if (typeof registryPath !== "string")
|
|
174448
|
+
return null;
|
|
174449
|
+
const buildInfo = await loadIslandRegistryBuildInfo(resolve14(cwd, registryPath));
|
|
174450
|
+
const pageMetadata = await loadPageIslandMetadata(config);
|
|
174451
|
+
const usages = [...pageMetadata.values()].flatMap((meta) => meta.islands.map((island) => ({ ...island, page: meta.pagePath })));
|
|
174452
|
+
return buildInfo.definitions.map((definition) => {
|
|
174453
|
+
const mounts = usages.filter((usage) => usage.framework === definition.framework && usage.component === definition.component).map((usage) => {
|
|
174454
|
+
const hostFramework = hostFrameworkOf(usage.page, cwd, config);
|
|
174455
|
+
return {
|
|
174456
|
+
crossFramework: hostFramework !== null && hostFramework !== definition.framework,
|
|
174457
|
+
hostFramework,
|
|
174458
|
+
hydrate: usage.hydrate ?? "load",
|
|
174459
|
+
page: relative8(cwd, resolve14(cwd, usage.page))
|
|
174460
|
+
};
|
|
174461
|
+
});
|
|
174462
|
+
const key = getIslandManifestKey(definition.framework, definition.component);
|
|
174463
|
+
return {
|
|
174464
|
+
component: definition.component,
|
|
174465
|
+
framework: definition.framework,
|
|
174466
|
+
mounts,
|
|
174467
|
+
size: sizes?.get(key) ?? null,
|
|
174468
|
+
source: definition.buildReference?.source ?? null
|
|
174469
|
+
};
|
|
174470
|
+
});
|
|
174471
|
+
}, groupByPage = (mounts) => {
|
|
174472
|
+
const byPage = new Map;
|
|
174473
|
+
for (const mount of mounts) {
|
|
174474
|
+
const entry = byPage.get(mount.page) ?? {
|
|
174475
|
+
crossFramework: mount.crossFramework,
|
|
174476
|
+
hostFramework: mount.hostFramework,
|
|
174477
|
+
hydrates: new Set
|
|
174478
|
+
};
|
|
174479
|
+
entry.hydrates.add(mount.hydrate);
|
|
174480
|
+
byPage.set(mount.page, entry);
|
|
174481
|
+
}
|
|
174482
|
+
return [...byPage.entries()].map(([page, entry]) => ({
|
|
174483
|
+
crossFramework: entry.crossFramework,
|
|
174484
|
+
hostFramework: entry.hostFramework,
|
|
174485
|
+
hydrate: [...entry.hydrates].join(", "),
|
|
174486
|
+
page
|
|
174487
|
+
}));
|
|
174488
|
+
}, renderIsland = (island, cwd) => {
|
|
174489
|
+
const color = FRAMEWORK_COLOR[island.framework] ?? colors.reset;
|
|
174490
|
+
const pages = groupByPage(island.mounts);
|
|
174491
|
+
const crossCount = pages.filter((page) => page.crossFramework).length;
|
|
174492
|
+
const sizeText = island.size === null ? "" : ` ${colors.dim}${formatBytes(island.size)}${colors.reset}`;
|
|
174493
|
+
const meta = `${colors.dim}${island.framework} \xB7 ${pages.length} page${pages.length === 1 ? "" : "s"}${crossCount > 0 ? ` \xB7 ${crossCount} cross-framework` : ""}${colors.reset}`;
|
|
174494
|
+
const lines = [
|
|
174495
|
+
` ${color}\u2B21${colors.reset} ${colors.bold}${island.component}${colors.reset} ${meta}${sizeText}`
|
|
174496
|
+
];
|
|
174497
|
+
if (island.source) {
|
|
174498
|
+
lines.push(` ${colors.dim}${relative8(cwd, island.source)}${colors.reset}`);
|
|
174499
|
+
}
|
|
174500
|
+
if (pages.length === 0) {
|
|
174501
|
+
lines.push(` ${colors.dim}(registered but not mounted on any page)${colors.reset}`);
|
|
174502
|
+
}
|
|
174503
|
+
const pageWidth = Math.max(0, ...pages.map((page) => page.page.length));
|
|
174504
|
+
for (const page of pages) {
|
|
174505
|
+
const tag = page.crossFramework ? ` ${colors.yellow}\u2192 in ${page.hostFramework}${colors.reset}` : "";
|
|
174506
|
+
lines.push(` ${padLine(page.page, pageWidth)} ${colors.cyan}${page.hydrate}${colors.reset}${tag}`);
|
|
174507
|
+
}
|
|
174508
|
+
return lines.join(`
|
|
174509
|
+
`);
|
|
174510
|
+
}, summarize = (islands) => {
|
|
174511
|
+
const frameworks3 = new Set(islands.map((island) => island.framework));
|
|
174512
|
+
const mounts = islands.reduce((sum, island) => sum + island.mounts.length, 0);
|
|
174513
|
+
const crossFramework = islands.reduce((sum, island) => sum + island.mounts.filter((mount) => mount.crossFramework).length, 0);
|
|
174514
|
+
return `${islands.length} islands \xB7 ${frameworks3.size} frameworks \xB7 ${mounts} mounts \xB7 ${crossFramework} cross-framework`;
|
|
174515
|
+
}, runIslands = async (args) => {
|
|
174516
|
+
const cwd = process.cwd();
|
|
174517
|
+
const configIndex = args.indexOf("--config");
|
|
174518
|
+
const configPath2 = configIndex >= 0 ? args[configIndex + 1] : undefined;
|
|
174519
|
+
let config;
|
|
174520
|
+
try {
|
|
174521
|
+
config = await loadConfig(configPath2);
|
|
174522
|
+
} catch (error) {
|
|
174523
|
+
printDim5(error instanceof Error ? error.message : String(error));
|
|
174524
|
+
return;
|
|
174525
|
+
}
|
|
174526
|
+
const outdirIndex = args.indexOf("--outdir");
|
|
174527
|
+
const outdir = outdirIndex >= 0 ? args[outdirIndex + 1] : config.buildDirectory;
|
|
174528
|
+
const sizes = args.includes("--sizes") ? readManifestSizes2(resolve14(cwd, outdir ?? "build")) : null;
|
|
174529
|
+
const islands = await collectIslands(cwd, config, sizes);
|
|
174530
|
+
if (islands === null) {
|
|
174531
|
+
printDim5('No island registry configured. Set `islands: { registry: "..." }` in absolute.config.ts.');
|
|
174532
|
+
return;
|
|
174533
|
+
}
|
|
174534
|
+
if (args.includes("--json")) {
|
|
174535
|
+
process.stdout.write(`${JSON.stringify(islands, null, 2)}
|
|
174536
|
+
`);
|
|
174537
|
+
return;
|
|
174538
|
+
}
|
|
174539
|
+
if (islands.length === 0) {
|
|
174540
|
+
printDim5("No islands found in the registry.");
|
|
174541
|
+
return;
|
|
174542
|
+
}
|
|
174543
|
+
const sorted = [...islands].sort((left, right) => left.framework.localeCompare(right.framework) || left.component.localeCompare(right.component));
|
|
174544
|
+
const blocks = sorted.map((island) => renderIsland(island, cwd));
|
|
174545
|
+
process.stdout.write(`${blocks.join(`
|
|
174546
|
+
|
|
174547
|
+
`)}
|
|
174548
|
+
|
|
174549
|
+
${colors.dim}${summarize(islands)}${colors.reset}
|
|
174550
|
+
`);
|
|
174551
|
+
};
|
|
174552
|
+
var init_islands2 = __esm(() => {
|
|
174553
|
+
init_islandEntries();
|
|
174554
|
+
init_pageMetadata();
|
|
174555
|
+
init_loadConfig();
|
|
174556
|
+
init_formatBytes();
|
|
174557
|
+
init_tuiPrimitives();
|
|
174558
|
+
FRAMEWORK_DIR_KEY = {
|
|
174559
|
+
angular: "angularDirectory",
|
|
174560
|
+
html: "htmlDirectory",
|
|
174561
|
+
htmx: "htmxDirectory",
|
|
174562
|
+
react: "reactDirectory",
|
|
174563
|
+
svelte: "svelteDirectory",
|
|
174564
|
+
vue: "vueDirectory"
|
|
174565
|
+
};
|
|
174566
|
+
FRAMEWORK_COLOR = {
|
|
174567
|
+
angular: colors.red,
|
|
174568
|
+
html: colors.yellow,
|
|
174569
|
+
htmx: colors.yellow,
|
|
174570
|
+
react: colors.cyan,
|
|
174571
|
+
svelte: colors.red,
|
|
174572
|
+
vue: colors.green
|
|
174573
|
+
};
|
|
174574
|
+
});
|
|
174575
|
+
|
|
174017
174576
|
// src/build/externalAssetPlugin.ts
|
|
174018
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
174019
|
-
import { basename as basename6, dirname as
|
|
174577
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync27, mkdirSync as mkdirSync12, statSync as statSync4 } from "fs";
|
|
174578
|
+
import { basename as basename6, dirname as dirname12, join as join25, resolve as resolve15 } from "path";
|
|
174020
174579
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
174021
174580
|
name: "absolute-external-asset",
|
|
174022
174581
|
setup(bld) {
|
|
174023
174582
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
174024
|
-
const skipRoots = userSourceRoots.map((root) =>
|
|
174583
|
+
const skipRoots = userSourceRoots.map((root) => resolve15(root));
|
|
174025
174584
|
const isUserSource = (path) => skipRoots.some((root) => path.startsWith(`${root}/`));
|
|
174026
174585
|
bld.onLoad({ filter: /\.[mc]?[jt]sx?$/ }, async (args) => {
|
|
174027
174586
|
if (isUserSource(args.path))
|
|
@@ -174031,20 +174590,20 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
174031
174590
|
return;
|
|
174032
174591
|
urlPattern.lastIndex = 0;
|
|
174033
174592
|
let match;
|
|
174034
|
-
const sourceDir =
|
|
174593
|
+
const sourceDir = dirname12(args.path);
|
|
174035
174594
|
while ((match = urlPattern.exec(source)) !== null) {
|
|
174036
174595
|
const relPath = match[1];
|
|
174037
174596
|
if (!relPath)
|
|
174038
174597
|
continue;
|
|
174039
|
-
const assetPath =
|
|
174040
|
-
if (!
|
|
174598
|
+
const assetPath = resolve15(sourceDir, relPath);
|
|
174599
|
+
if (!existsSync27(assetPath))
|
|
174041
174600
|
continue;
|
|
174042
|
-
if (!
|
|
174601
|
+
if (!statSync4(assetPath).isFile())
|
|
174043
174602
|
continue;
|
|
174044
|
-
const targetPath =
|
|
174045
|
-
if (
|
|
174603
|
+
const targetPath = join25(outDir, basename6(assetPath));
|
|
174604
|
+
if (existsSync27(targetPath))
|
|
174046
174605
|
continue;
|
|
174047
|
-
mkdirSync12(
|
|
174606
|
+
mkdirSync12(dirname12(targetPath), { recursive: true });
|
|
174048
174607
|
copyFileSync2(assetPath, targetPath);
|
|
174049
174608
|
}
|
|
174050
174609
|
return;
|
|
@@ -174062,16 +174621,16 @@ __export(exports_compile, {
|
|
|
174062
174621
|
var {env: env4 } = globalThis.Bun;
|
|
174063
174622
|
import {
|
|
174064
174623
|
cpSync,
|
|
174065
|
-
existsSync as
|
|
174624
|
+
existsSync as existsSync28,
|
|
174066
174625
|
mkdirSync as mkdirSync13,
|
|
174067
174626
|
readdirSync as readdirSync6,
|
|
174068
|
-
readFileSync as
|
|
174627
|
+
readFileSync as readFileSync25,
|
|
174069
174628
|
rmSync as rmSync5,
|
|
174070
|
-
statSync as
|
|
174629
|
+
statSync as statSync5,
|
|
174071
174630
|
unlinkSync as unlinkSync4,
|
|
174072
174631
|
writeFileSync as writeFileSync13
|
|
174073
174632
|
} from "fs";
|
|
174074
|
-
import { basename as basename7, dirname as
|
|
174633
|
+
import { basename as basename7, dirname as dirname13, join as join26, relative as relative9, resolve as resolve16 } from "path";
|
|
174075
174634
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
174076
174635
|
const resolvedVersion = version2 || "unknown";
|
|
174077
174636
|
console.log("");
|
|
@@ -174084,7 +174643,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174084
174643
|
const entry = pending.pop();
|
|
174085
174644
|
if (!entry)
|
|
174086
174645
|
continue;
|
|
174087
|
-
const fullPath =
|
|
174646
|
+
const fullPath = join26(entry.parentPath, entry.name);
|
|
174088
174647
|
if (entry.isDirectory())
|
|
174089
174648
|
pending = pending.concat(readdirSync6(fullPath, { withFileTypes: true }));
|
|
174090
174649
|
else
|
|
@@ -174104,7 +174663,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174104
174663
|
const entry = pending.pop();
|
|
174105
174664
|
if (!entry)
|
|
174106
174665
|
continue;
|
|
174107
|
-
const fullPath =
|
|
174666
|
+
const fullPath = join26(entry.parentPath, entry.name);
|
|
174108
174667
|
if (entry.isDirectory()) {
|
|
174109
174668
|
if (SERVER_RUNTIME_SCAN_SKIP_DIRS.has(entry.name))
|
|
174110
174669
|
continue;
|
|
@@ -174116,22 +174675,22 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174116
174675
|
return result;
|
|
174117
174676
|
}, copyServerRuntimeAssetReferences = (outdir) => {
|
|
174118
174677
|
const copied = new Set;
|
|
174119
|
-
const normalizedOutdir =
|
|
174678
|
+
const normalizedOutdir = resolve16(outdir);
|
|
174120
174679
|
const copyReference = (filePath, relPath) => {
|
|
174121
|
-
const assetSource =
|
|
174122
|
-
if (!
|
|
174680
|
+
const assetSource = resolve16(dirname13(filePath), relPath);
|
|
174681
|
+
if (!existsSync28(assetSource) || !statSync5(assetSource).isFile())
|
|
174123
174682
|
return;
|
|
174124
|
-
const assetTarget =
|
|
174683
|
+
const assetTarget = resolve16(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
174125
174684
|
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
174126
174685
|
return;
|
|
174127
174686
|
if (copied.has(assetTarget))
|
|
174128
174687
|
return;
|
|
174129
174688
|
copied.add(assetTarget);
|
|
174130
|
-
mkdirSync13(
|
|
174689
|
+
mkdirSync13(dirname13(assetTarget), { recursive: true });
|
|
174131
174690
|
cpSync(assetSource, assetTarget, { force: true });
|
|
174132
174691
|
};
|
|
174133
174692
|
for (const filePath of collectProjectSourceFiles(process.cwd())) {
|
|
174134
|
-
const source =
|
|
174693
|
+
const source = readFileSync25(filePath, "utf-8");
|
|
174135
174694
|
SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
|
|
174136
174695
|
let match;
|
|
174137
174696
|
while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
|
|
@@ -174160,7 +174719,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174160
174719
|
}
|
|
174161
174720
|
}, readPackageVersion4 = (candidate) => {
|
|
174162
174721
|
try {
|
|
174163
|
-
const pkg = JSON.parse(
|
|
174722
|
+
const pkg = JSON.parse(readFileSync25(candidate, "utf-8"));
|
|
174164
174723
|
if (pkg.name !== "@absolutejs/absolute")
|
|
174165
174724
|
return null;
|
|
174166
174725
|
const ver = pkg.version;
|
|
@@ -174195,18 +174754,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174195
174754
|
return resolveBuildModule3(remaining);
|
|
174196
174755
|
}, resolveJsxDevRuntimeCompatPath2 = () => {
|
|
174197
174756
|
const candidates = [
|
|
174198
|
-
|
|
174199
|
-
|
|
174200
|
-
|
|
174201
|
-
|
|
174202
|
-
|
|
174203
|
-
|
|
174757
|
+
resolve16(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
174758
|
+
resolve16(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
174759
|
+
resolve16(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.ts"),
|
|
174760
|
+
resolve16(import.meta.dir, "..", "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
174761
|
+
resolve16(import.meta.dir, "..", "..", "..", "react", "jsxDevRuntimeCompat.js"),
|
|
174762
|
+
resolve16(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
174204
174763
|
];
|
|
174205
174764
|
for (const candidate of candidates) {
|
|
174206
|
-
if (
|
|
174765
|
+
if (existsSync28(candidate))
|
|
174207
174766
|
return candidate;
|
|
174208
174767
|
}
|
|
174209
|
-
return
|
|
174768
|
+
return resolve16(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
174210
174769
|
}, jsxDevRuntimeCompatPath2, shouldEmbedCompiledAsset = (relativePath, skip = new Set) => {
|
|
174211
174770
|
if (skip.has(relativePath))
|
|
174212
174771
|
return false;
|
|
@@ -174219,11 +174778,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174219
174778
|
return true;
|
|
174220
174779
|
}, tryReadNodePackageJson = (packageDir) => {
|
|
174221
174780
|
try {
|
|
174222
|
-
return JSON.parse(
|
|
174781
|
+
return JSON.parse(readFileSync25(join26(packageDir, "package.json"), "utf-8"));
|
|
174223
174782
|
} catch {
|
|
174224
174783
|
return null;
|
|
174225
174784
|
}
|
|
174226
|
-
}, resolveProjectPackageDir = (specifier) =>
|
|
174785
|
+
}, resolveProjectPackageDir = (specifier) => resolve16(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
|
|
174227
174786
|
if (seen.has(specifier))
|
|
174228
174787
|
return;
|
|
174229
174788
|
const srcDir = resolveProjectPackageDir(specifier);
|
|
@@ -174231,13 +174790,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174231
174790
|
if (!pkg)
|
|
174232
174791
|
return;
|
|
174233
174792
|
seen.add(specifier);
|
|
174234
|
-
const destDir =
|
|
174793
|
+
const destDir = join26(outdir, "node_modules", ...specifier.split("/"));
|
|
174235
174794
|
rmSync5(destDir, { force: true, recursive: true });
|
|
174236
174795
|
cpSync(srcDir, destDir, {
|
|
174237
174796
|
force: true,
|
|
174238
174797
|
recursive: true,
|
|
174239
174798
|
filter(source) {
|
|
174240
|
-
const rel =
|
|
174799
|
+
const rel = relative9(srcDir, source);
|
|
174241
174800
|
const [firstSegment] = rel.split(/[\\/]/);
|
|
174242
174801
|
return firstSegment !== "node_modules" && firstSegment !== ".git";
|
|
174243
174802
|
}
|
|
@@ -174253,8 +174812,8 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174253
174812
|
}, copyAngularRuntimePackages = (buildConfig, outdir) => {
|
|
174254
174813
|
if (!buildConfig.angularDirectory)
|
|
174255
174814
|
return;
|
|
174256
|
-
const angularScopeDir =
|
|
174257
|
-
const angularPackages =
|
|
174815
|
+
const angularScopeDir = resolve16(process.cwd(), "node_modules", "@angular");
|
|
174816
|
+
const angularPackages = existsSync28(angularScopeDir) ? readdirSync6(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
|
|
174258
174817
|
const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
|
|
174259
174818
|
const seen = new Set;
|
|
174260
174819
|
for (const specifier of roots) {
|
|
@@ -174271,15 +174830,15 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174271
174830
|
}
|
|
174272
174831
|
copyAngularRuntimePackages(buildConfig, outdir);
|
|
174273
174832
|
}, collectRuntimePackageSpecifiers = (distDir) => {
|
|
174274
|
-
const nodeModulesDir =
|
|
174275
|
-
if (!
|
|
174833
|
+
const nodeModulesDir = join26(distDir, "node_modules");
|
|
174834
|
+
if (!existsSync28(nodeModulesDir))
|
|
174276
174835
|
return [];
|
|
174277
174836
|
const specifiers = [];
|
|
174278
174837
|
for (const entry of readdirSync6(nodeModulesDir, { withFileTypes: true })) {
|
|
174279
174838
|
if (!entry.isDirectory())
|
|
174280
174839
|
continue;
|
|
174281
174840
|
if (entry.name.startsWith("@")) {
|
|
174282
|
-
const scopeDir =
|
|
174841
|
+
const scopeDir = join26(nodeModulesDir, entry.name);
|
|
174283
174842
|
for (const scopedEntry of readdirSync6(scopeDir, {
|
|
174284
174843
|
withFileTypes: true
|
|
174285
174844
|
})) {
|
|
@@ -174293,7 +174852,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174293
174852
|
}
|
|
174294
174853
|
return specifiers.sort((a, b) => b.length - a.length);
|
|
174295
174854
|
}, ensureRelativeModuleSpecifier = (fromFile, toFile) => {
|
|
174296
|
-
const rel =
|
|
174855
|
+
const rel = relative9(dirname13(fromFile), toFile).replace(/\\/g, "/");
|
|
174297
174856
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
174298
174857
|
}, pickExportEntry = (value) => {
|
|
174299
174858
|
if (typeof value === "string")
|
|
@@ -174311,21 +174870,21 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174311
174870
|
const packageSpecifier = packageSpecifiers.find((root) => specifier === root || specifier.startsWith(`${root}/`));
|
|
174312
174871
|
if (!packageSpecifier)
|
|
174313
174872
|
return null;
|
|
174314
|
-
const packageDir =
|
|
174873
|
+
const packageDir = join26(distDir, "node_modules", ...packageSpecifier.split("/"));
|
|
174315
174874
|
const subpath = specifier.slice(packageSpecifier.length);
|
|
174316
|
-
const subPackageDir = subpath ?
|
|
174317
|
-
const resolvedPackageDir = subPackageDir &&
|
|
174318
|
-
const packageJsonPath =
|
|
174319
|
-
if (!
|
|
174875
|
+
const subPackageDir = subpath ? join26(packageDir, ...subpath.slice(1).split("/")) : null;
|
|
174876
|
+
const resolvedPackageDir = subPackageDir && existsSync28(join26(subPackageDir, "package.json")) ? subPackageDir : packageDir;
|
|
174877
|
+
const packageJsonPath = join26(resolvedPackageDir, "package.json");
|
|
174878
|
+
if (!existsSync28(packageJsonPath))
|
|
174320
174879
|
return null;
|
|
174321
|
-
const pkg = JSON.parse(
|
|
174880
|
+
const pkg = JSON.parse(readFileSync25(packageJsonPath, "utf-8"));
|
|
174322
174881
|
const exportKey = resolvedPackageDir !== subPackageDir && subpath ? `.${subpath}` : ".";
|
|
174323
174882
|
const rootExport = pkg.exports?.[exportKey];
|
|
174324
174883
|
const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
|
|
174325
|
-
return
|
|
174884
|
+
return join26(resolvedPackageDir, entry);
|
|
174326
174885
|
}, RUNTIME_JS_EXTENSIONS, MODULE_SPECIFIER_RE, isRuntimeJsFile = (filePath) => RUNTIME_JS_EXTENSIONS.some((extension) => filePath.endsWith(extension)), isNodeModulesPath = (filePath) => filePath.split(/[\\/]/).includes("node_modules"), isFile = (filePath) => {
|
|
174327
174886
|
try {
|
|
174328
|
-
return
|
|
174887
|
+
return statSync5(filePath).isFile();
|
|
174329
174888
|
} catch {
|
|
174330
174889
|
return false;
|
|
174331
174890
|
}
|
|
@@ -174335,16 +174894,16 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174335
174894
|
const candidates = [
|
|
174336
174895
|
candidate,
|
|
174337
174896
|
...RUNTIME_JS_EXTENSIONS.map((extension) => `${candidate}${extension}`),
|
|
174338
|
-
...RUNTIME_JS_EXTENSIONS.map((extension) =>
|
|
174897
|
+
...RUNTIME_JS_EXTENSIONS.map((extension) => join26(candidate, `index${extension}`))
|
|
174339
174898
|
];
|
|
174340
174899
|
return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
|
|
174341
174900
|
}, findContainingRuntimePackageDir = (filePath) => {
|
|
174342
|
-
let dir =
|
|
174343
|
-
while (dir !==
|
|
174344
|
-
if (isNodeModulesPath(dir) &&
|
|
174901
|
+
let dir = dirname13(filePath);
|
|
174902
|
+
while (dir !== dirname13(dir)) {
|
|
174903
|
+
if (isNodeModulesPath(dir) && existsSync28(join26(dir, "package.json"))) {
|
|
174345
174904
|
return dir;
|
|
174346
174905
|
}
|
|
174347
|
-
dir =
|
|
174906
|
+
dir = dirname13(dir);
|
|
174348
174907
|
}
|
|
174349
174908
|
return null;
|
|
174350
174909
|
}, resolvePackageImportEntryFile = (fromFile, specifier) => {
|
|
@@ -174357,7 +174916,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174357
174916
|
const entry = pickExportEntry(pkg?.imports?.[specifier]);
|
|
174358
174917
|
if (!entry)
|
|
174359
174918
|
return null;
|
|
174360
|
-
return
|
|
174919
|
+
return join26(packageDir, entry);
|
|
174361
174920
|
}, collectRuntimeRewriteRoots = (distDir) => collectFiles2(distDir).filter((filePath) => isRuntimeJsFile(filePath) && !isNodeModulesPath(filePath)), rewriteRuntimeModuleSpecifiers = (distDir) => {
|
|
174362
174921
|
const packageSpecifiers = collectRuntimePackageSpecifiers(distDir);
|
|
174363
174922
|
if (packageSpecifiers.length === 0)
|
|
@@ -174376,10 +174935,10 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174376
174935
|
if (!filePath || seen.has(filePath))
|
|
174377
174936
|
continue;
|
|
174378
174937
|
seen.add(filePath);
|
|
174379
|
-
const source =
|
|
174938
|
+
const source = readFileSync25(filePath, "utf-8");
|
|
174380
174939
|
const rewritten = source.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
|
|
174381
174940
|
if (typeof specifier === "string" && specifier.startsWith(".")) {
|
|
174382
|
-
enqueue(resolveRuntimeJsFile(
|
|
174941
|
+
enqueue(resolveRuntimeJsFile(resolve16(dirname13(filePath), specifier)));
|
|
174383
174942
|
return match;
|
|
174384
174943
|
}
|
|
174385
174944
|
const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
|
|
@@ -174407,25 +174966,25 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174407
174966
|
"_compile_entrypoint.ts"
|
|
174408
174967
|
]);
|
|
174409
174968
|
const embeddedFiles = allFiles.filter((file) => {
|
|
174410
|
-
const rel =
|
|
174969
|
+
const rel = relative9(distDir, file);
|
|
174411
174970
|
if (embeddedSkip.has(rel))
|
|
174412
174971
|
return false;
|
|
174413
174972
|
return true;
|
|
174414
174973
|
});
|
|
174415
|
-
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(
|
|
174974
|
+
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(relative9(distDir, file), assetSkip));
|
|
174416
174975
|
const imports = [];
|
|
174417
174976
|
const embeddedMappings = [];
|
|
174418
174977
|
const mappings = [];
|
|
174419
174978
|
const embeddedVarMap = new Map;
|
|
174420
174979
|
embeddedFiles.forEach((filePath, idx) => {
|
|
174421
|
-
const rel =
|
|
174980
|
+
const rel = relative9(distDir, filePath).replace(/\\/g, "/");
|
|
174422
174981
|
const varName = `__a${idx}`;
|
|
174423
174982
|
embeddedVarMap.set(rel, varName);
|
|
174424
174983
|
imports.push(`import ${varName} from "./${rel}" with { type: "file" };`);
|
|
174425
174984
|
embeddedMappings.push(` ["${rel}", ${varName}],`);
|
|
174426
174985
|
});
|
|
174427
174986
|
clientFiles.forEach((filePath) => {
|
|
174428
|
-
const rel =
|
|
174987
|
+
const rel = relative9(distDir, filePath).replace(/\\/g, "/");
|
|
174429
174988
|
const varName = embeddedVarMap.get(rel);
|
|
174430
174989
|
if (!varName)
|
|
174431
174990
|
return;
|
|
@@ -174439,7 +174998,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174439
174998
|
const pageVarMap = new Map;
|
|
174440
174999
|
const prerenderEntries = Array.from(prerenderMap.entries());
|
|
174441
175000
|
prerenderEntries.forEach(([route, filePath]) => {
|
|
174442
|
-
const rel =
|
|
175001
|
+
const rel = relative9(distDir, filePath).replace(/\\/g, "/");
|
|
174443
175002
|
const varName = embeddedVarMap.get(rel);
|
|
174444
175003
|
if (varName)
|
|
174445
175004
|
pageVarMap.set(route, varName);
|
|
@@ -174468,7 +175027,7 @@ import { websocket as elysiaWebsocket } from "elysia/ws";
|
|
|
174468
175027
|
const SERVER_MODULE = (runtimeDir: string) => import(pathToFileURL(join(runtimeDir, ${JSON.stringify(serverBundleName)})).href);
|
|
174469
175028
|
const RUNTIME_BUILD_ID = ${JSON.stringify(runtimeBuildId)};
|
|
174470
175029
|
const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
|
|
174471
|
-
const ORIGINAL_BUILD_DIR = ${JSON.stringify(
|
|
175030
|
+
const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve16(distDir))};
|
|
174472
175031
|
const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
|
|
174473
175032
|
|
|
174474
175033
|
// \u2500\u2500 Asset URL \u2192 embedded path map \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
@@ -174846,16 +175405,16 @@ console.log(\`
|
|
|
174846
175405
|
}),
|
|
174847
175406
|
...collectUserServerExternals(buildConfig)
|
|
174848
175407
|
], compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
174849
|
-
const resolvedOutdir =
|
|
175408
|
+
const resolvedOutdir = resolve16(outdir ?? "dist");
|
|
174850
175409
|
await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
|
|
174851
175410
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
174852
175411
|
const prerenderPort = Number(env4.COMPILE_PORT) || Number(env4.PORT) || DEFAULT_PORT + 1;
|
|
174853
175412
|
killStaleProcesses(prerenderPort);
|
|
174854
175413
|
const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
|
|
174855
|
-
const resolvedOutfile =
|
|
175414
|
+
const resolvedOutfile = resolve16(outfile ?? "compiled-server");
|
|
174856
175415
|
const absoluteVersion = resolvePackageVersion3([
|
|
174857
|
-
|
|
174858
|
-
|
|
175416
|
+
resolve16(import.meta.dir, "..", "..", "..", "package.json"),
|
|
175417
|
+
resolve16(import.meta.dir, "..", "..", "package.json")
|
|
174859
175418
|
]);
|
|
174860
175419
|
compileBanner(absoluteVersion);
|
|
174861
175420
|
const totalStart = performance.now();
|
|
@@ -174866,8 +175425,8 @@ console.log(\`
|
|
|
174866
175425
|
buildConfig.mode = "production";
|
|
174867
175426
|
try {
|
|
174868
175427
|
const build2 = await resolveBuildModule3([
|
|
174869
|
-
|
|
174870
|
-
|
|
175428
|
+
resolve16(import.meta.dir, "..", "..", "core", "build"),
|
|
175429
|
+
resolve16(import.meta.dir, "..", "build")
|
|
174871
175430
|
]);
|
|
174872
175431
|
if (!build2)
|
|
174873
175432
|
throw new Error("Could not locate build module");
|
|
@@ -174889,10 +175448,10 @@ console.log(\`
|
|
|
174889
175448
|
buildConfig.htmxDirectory
|
|
174890
175449
|
].filter((dir) => Boolean(dir));
|
|
174891
175450
|
const islandRegistrySpec = buildConfig.islands?.registry;
|
|
174892
|
-
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(
|
|
175451
|
+
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve16(islandRegistrySpec))) : undefined;
|
|
174893
175452
|
const serverBundle = await Bun.build({
|
|
174894
175453
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
174895
|
-
entrypoints: [
|
|
175454
|
+
entrypoints: [resolve16(serverEntry)],
|
|
174896
175455
|
external: resolveServerBundleExternals(buildConfig),
|
|
174897
175456
|
outdir: resolvedOutdir,
|
|
174898
175457
|
plugins: [
|
|
@@ -174913,13 +175472,13 @@ console.log(\`
|
|
|
174913
175472
|
console.error(cliTag4("\x1B[31m", "Server bundle failed."));
|
|
174914
175473
|
process.exit(1);
|
|
174915
175474
|
}
|
|
174916
|
-
const outputPath =
|
|
174917
|
-
if (!
|
|
175475
|
+
const outputPath = resolve16(resolvedOutdir, `${entryName}.js`);
|
|
175476
|
+
if (!existsSync28(outputPath)) {
|
|
174918
175477
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
174919
175478
|
process.exit(1);
|
|
174920
175479
|
}
|
|
174921
|
-
if (
|
|
174922
|
-
const vendorDir =
|
|
175480
|
+
if (existsSync28(resolve16(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
175481
|
+
const vendorDir = resolve16(resolvedOutdir, "angular", "vendor", "server");
|
|
174923
175482
|
const vendorEntries = readdirSync6(vendorDir).filter((f) => f.endsWith(".js"));
|
|
174924
175483
|
const angularServerVendorPaths = {};
|
|
174925
175484
|
for (const file of vendorEntries) {
|
|
@@ -174928,7 +175487,7 @@ console.log(\`
|
|
|
174928
175487
|
if (scope !== "angular" || rest.length === 0)
|
|
174929
175488
|
continue;
|
|
174930
175489
|
const specifier = `@angular/${rest.join("/")}`;
|
|
174931
|
-
const relPath =
|
|
175490
|
+
const relPath = relative9(dirname13(outputPath), resolve16(vendorDir, file));
|
|
174932
175491
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
174933
175492
|
}
|
|
174934
175493
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -174940,7 +175499,7 @@ console.log(\`
|
|
|
174940
175499
|
copyServerRuntimeAssetReferences(resolvedOutdir);
|
|
174941
175500
|
const prerenderStart = performance.now();
|
|
174942
175501
|
process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
|
|
174943
|
-
rmSync5(
|
|
175502
|
+
rmSync5(join26(resolvedOutdir, "_prerendered"), {
|
|
174944
175503
|
force: true,
|
|
174945
175504
|
recursive: true
|
|
174946
175505
|
});
|
|
@@ -174959,9 +175518,9 @@ console.log(\`
|
|
|
174959
175518
|
const compileStart = performance.now();
|
|
174960
175519
|
process.stdout.write(cliTag4("\x1B[36m", "Compiling standalone executable"));
|
|
174961
175520
|
const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
|
|
174962
|
-
const entrypointPath =
|
|
175521
|
+
const entrypointPath = join26(resolvedOutdir, "_compile_entrypoint.ts");
|
|
174963
175522
|
await Bun.write(entrypointPath, entrypointCode);
|
|
174964
|
-
mkdirSync13(
|
|
175523
|
+
mkdirSync13(dirname13(resolvedOutfile), { recursive: true });
|
|
174965
175524
|
const result = await Bun.build({
|
|
174966
175525
|
compile: { outfile: resolvedOutfile },
|
|
174967
175526
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
@@ -175055,11 +175614,11 @@ var exports_typecheck = {};
|
|
|
175055
175614
|
__export(exports_typecheck, {
|
|
175056
175615
|
typecheck: () => typecheck
|
|
175057
175616
|
});
|
|
175058
|
-
import { resolve as
|
|
175059
|
-
import { existsSync as
|
|
175617
|
+
import { resolve as resolve17, join as join27 } from "path";
|
|
175618
|
+
import { existsSync as existsSync29, readFileSync as readFileSync26 } from "fs";
|
|
175060
175619
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
175061
|
-
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) =>
|
|
175062
|
-
if (!
|
|
175620
|
+
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve17(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
|
|
175621
|
+
if (!existsSync29(resolveConfigPath(configPath2))) {
|
|
175063
175622
|
return [{}];
|
|
175064
175623
|
}
|
|
175065
175624
|
const rawConfig = await loadRawConfig(configPath2);
|
|
@@ -175079,8 +175638,8 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
175079
175638
|
const exitCode = await proc.exited;
|
|
175080
175639
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
175081
175640
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
175082
|
-
const local =
|
|
175083
|
-
return
|
|
175641
|
+
const local = resolve17("node_modules", ".bin", name);
|
|
175642
|
+
return existsSync29(local) ? local : null;
|
|
175084
175643
|
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
175085
175644
|
const cwd = `${process.cwd()}/`;
|
|
175086
175645
|
const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
|
|
@@ -175127,15 +175686,15 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175127
175686
|
return formatted;
|
|
175128
175687
|
}, ABSOLUTE_INTERNAL_EXCLUDES, resolveAbsoluteTypeFile = (fileName) => {
|
|
175129
175688
|
const candidates = [
|
|
175130
|
-
|
|
175131
|
-
|
|
175132
|
-
|
|
175133
|
-
|
|
175689
|
+
resolve17("node_modules/@absolutejs/absolute/dist/types", fileName),
|
|
175690
|
+
resolve17(import.meta.dir, "../types", fileName),
|
|
175691
|
+
resolve17(import.meta.dir, "../../types", fileName),
|
|
175692
|
+
resolve17(import.meta.dir, "../../../types", fileName)
|
|
175134
175693
|
];
|
|
175135
|
-
return candidates.find((candidate) =>
|
|
175694
|
+
return candidates.find((candidate) => existsSync29(candidate)) ?? candidates[0];
|
|
175136
175695
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
175137
175696
|
try {
|
|
175138
|
-
return JSON.parse(
|
|
175697
|
+
return JSON.parse(readFileSync26(resolve17("tsconfig.json"), "utf-8"));
|
|
175139
175698
|
} catch {
|
|
175140
175699
|
return {};
|
|
175141
175700
|
}
|
|
@@ -175163,22 +175722,22 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175163
175722
|
console.error("\x1B[31m\u2717\x1B[0m vue-tsc is required for Vue type checking. Install it: bun add -d vue-tsc");
|
|
175164
175723
|
process.exit(1);
|
|
175165
175724
|
}
|
|
175166
|
-
const vueTsconfigPath =
|
|
175725
|
+
const vueTsconfigPath = join27(cacheDir, "tsconfig.vue-check.json");
|
|
175167
175726
|
return writeFile(vueTsconfigPath, JSON.stringify({
|
|
175168
175727
|
compilerOptions: {
|
|
175169
175728
|
rootDir: ".."
|
|
175170
175729
|
},
|
|
175171
175730
|
exclude: getProjectTypecheckExcludes(),
|
|
175172
|
-
extends:
|
|
175731
|
+
extends: resolve17("tsconfig.json"),
|
|
175173
175732
|
include: getProjectTypecheckIncludes()
|
|
175174
175733
|
}, null, "\t")).then(() => run("vue-tsc", [
|
|
175175
175734
|
vueTscBin,
|
|
175176
175735
|
"--noEmit",
|
|
175177
175736
|
"--project",
|
|
175178
|
-
|
|
175737
|
+
resolve17(vueTsconfigPath),
|
|
175179
175738
|
"--incremental",
|
|
175180
175739
|
"--tsBuildInfoFile",
|
|
175181
|
-
|
|
175740
|
+
join27(cacheDir, "vue-tsc.tsbuildinfo"),
|
|
175182
175741
|
"--pretty"
|
|
175183
175742
|
]));
|
|
175184
175743
|
}, buildAngularCheck = async (cacheDir, angularDir) => {
|
|
@@ -175187,7 +175746,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175187
175746
|
console.error("\x1B[31m\u2717\x1B[0m @angular/compiler-cli is required for Angular type checking. Install it: bun add -d @angular/compiler-cli");
|
|
175188
175747
|
process.exit(1);
|
|
175189
175748
|
}
|
|
175190
|
-
const angularTsconfigPath =
|
|
175749
|
+
const angularTsconfigPath = join27(cacheDir, "tsconfig.angular-check.json");
|
|
175191
175750
|
await writeFile(angularTsconfigPath, JSON.stringify({
|
|
175192
175751
|
angularCompilerOptions: {
|
|
175193
175752
|
strictTemplates: true
|
|
@@ -175197,32 +175756,32 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175197
175756
|
rootDir: ".."
|
|
175198
175757
|
},
|
|
175199
175758
|
exclude: ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
|
|
175200
|
-
extends:
|
|
175759
|
+
extends: resolve17("tsconfig.json"),
|
|
175201
175760
|
include: [`../${angularDir}/**/*`]
|
|
175202
175761
|
}, null, "\t"));
|
|
175203
|
-
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(
|
|
175762
|
+
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve17(angularTsconfigPath))}`);
|
|
175204
175763
|
}, buildTscCheck = (cacheDir) => {
|
|
175205
175764
|
const tscBin = findBin("tsc");
|
|
175206
175765
|
if (!tscBin) {
|
|
175207
175766
|
console.error("\x1B[31m\u2717\x1B[0m typescript is required for type checking. Install it: bun add -d typescript");
|
|
175208
175767
|
process.exit(1);
|
|
175209
175768
|
}
|
|
175210
|
-
const tscConfigPath =
|
|
175769
|
+
const tscConfigPath = join27(cacheDir, "tsconfig.typecheck.json");
|
|
175211
175770
|
return writeFile(tscConfigPath, JSON.stringify({
|
|
175212
175771
|
compilerOptions: {
|
|
175213
175772
|
rootDir: ".."
|
|
175214
175773
|
},
|
|
175215
175774
|
exclude: getProjectTypecheckExcludes(),
|
|
175216
|
-
extends:
|
|
175775
|
+
extends: resolve17("tsconfig.json"),
|
|
175217
175776
|
include: getProjectTypecheckIncludes()
|
|
175218
175777
|
}, null, "\t")).then(() => run("tsc", [
|
|
175219
175778
|
tscBin,
|
|
175220
175779
|
"--noEmit",
|
|
175221
175780
|
"--project",
|
|
175222
|
-
|
|
175781
|
+
resolve17(tscConfigPath),
|
|
175223
175782
|
"--incremental",
|
|
175224
175783
|
"--tsBuildInfoFile",
|
|
175225
|
-
|
|
175784
|
+
join27(cacheDir, "tsc.tsbuildinfo"),
|
|
175226
175785
|
"--pretty"
|
|
175227
175786
|
]));
|
|
175228
175787
|
}, buildSvelteCheck = async (cacheDir, svelteDir) => {
|
|
@@ -175231,16 +175790,16 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175231
175790
|
console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
|
|
175232
175791
|
process.exit(1);
|
|
175233
175792
|
}
|
|
175234
|
-
const svelteTsconfigPath =
|
|
175793
|
+
const svelteTsconfigPath = join27(cacheDir, "tsconfig.svelte-check.json");
|
|
175235
175794
|
await writeFile(svelteTsconfigPath, JSON.stringify({
|
|
175236
|
-
extends:
|
|
175795
|
+
extends: resolve17("tsconfig.json"),
|
|
175237
175796
|
files: ABSOLUTE_TYPECHECK_FILES,
|
|
175238
175797
|
include: [`../${svelteDir}/**/*`]
|
|
175239
175798
|
}, null, "\t"));
|
|
175240
175799
|
return run("svelte-check", [
|
|
175241
175800
|
svelteBin,
|
|
175242
175801
|
"--tsconfig",
|
|
175243
|
-
|
|
175802
|
+
resolve17(svelteTsconfigPath),
|
|
175244
175803
|
"--threshold",
|
|
175245
175804
|
"error",
|
|
175246
175805
|
"--compiler-warnings",
|
|
@@ -175429,11 +175988,11 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
|
|
|
175429
175988
|
url: url.pathname + url.search,
|
|
175430
175989
|
...bodyBytes && bodyBytes.length > 0 ? { bodyBase64: Buffer.from(bodyBytes).toString("base64") } : {}
|
|
175431
175990
|
};
|
|
175432
|
-
const responsePromise = new Promise((
|
|
175433
|
-
pending.set(id,
|
|
175991
|
+
const responsePromise = new Promise((resolve18) => {
|
|
175992
|
+
pending.set(id, resolve18);
|
|
175434
175993
|
});
|
|
175435
175994
|
client.send(encodeTunnelMessage(message));
|
|
175436
|
-
const timeout = new Promise((
|
|
175995
|
+
const timeout = new Promise((resolve18) => setTimeout(() => resolve18({ id, message: "timeout", type: "error" }), requestTimeoutMs));
|
|
175437
175996
|
const result = await Promise.race([responsePromise, timeout]);
|
|
175438
175997
|
pending.delete(id);
|
|
175439
175998
|
if (result.type === "error") {
|
|
@@ -178970,6 +179529,14 @@ if (command === "dev") {
|
|
|
178970
179529
|
sendTelemetryEvent("cli:command", { command: "routes" });
|
|
178971
179530
|
const { runRoutes: runRoutes2 } = await Promise.resolve().then(() => (init_routes(), exports_routes));
|
|
178972
179531
|
await runRoutes2(args);
|
|
179532
|
+
} else if (command === "inspect") {
|
|
179533
|
+
sendTelemetryEvent("cli:command", { command: "inspect" });
|
|
179534
|
+
const { runInspect: runInspect2 } = await Promise.resolve().then(() => (init_inspect(), exports_inspect));
|
|
179535
|
+
await runInspect2(args);
|
|
179536
|
+
} else if (command === "islands") {
|
|
179537
|
+
sendTelemetryEvent("cli:command", { command: "islands" });
|
|
179538
|
+
const { runIslands: runIslands2 } = await Promise.resolve().then(() => (init_islands2(), exports_islands));
|
|
179539
|
+
await runIslands2(args);
|
|
178973
179540
|
} else if (command === "info") {
|
|
178974
179541
|
sendTelemetryEvent("cli:command", { command });
|
|
178975
179542
|
info();
|
|
@@ -179016,6 +179583,8 @@ if (command === "dev") {
|
|
|
179016
179583
|
console.error(" generate <page|api|component> <name> [--framework <fw>] Scaffold a page, API plugin, or component");
|
|
179017
179584
|
console.error(" htmx [version] Self-host htmx \u2014 report or install/upgrade the pinned copy");
|
|
179018
179585
|
console.error(" info Print system info for bug reports");
|
|
179586
|
+
console.error(" inspect [--json] Live request inspector for a running dev server");
|
|
179587
|
+
console.error(" islands [--sizes] [--json] List islands by framework, hydration, pages (cross-framework aware)");
|
|
179019
179588
|
console.error(" remove <framework> [--prune] Remove a framework from config (keeps source)");
|
|
179020
179589
|
console.error(" logs <name> [-f] [-n <lines>] Tail a running server's log by name");
|
|
179021
179590
|
console.error(" ls [--sizes] [--budget <size>] [--json] List the project's pages by framework");
|