@absolutejs/absolute 0.19.0-beta.1041 → 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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-5y3q6r/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var __require = import.meta.require;
|
|
3
3
|
|
|
4
|
-
// .angular-partial-tmp-
|
|
4
|
+
// .angular-partial-tmp-5y3q6r/src/core/streamingSlotRegistrar.ts
|
|
5
5
|
var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
|
|
6
6
|
var STREAMING_SLOT_WARNING_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotWarningController");
|
|
7
7
|
var STREAMING_SLOT_COLLECTION_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotCollectionController");
|
|
@@ -48,7 +48,7 @@ var warnMissingStreamingSlotCollector = (primitiveName) => {
|
|
|
48
48
|
getWarningController()?.maybeWarn(primitiveName);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// .angular-partial-tmp-
|
|
51
|
+
// .angular-partial-tmp-5y3q6r/src/core/streamingSlotRegistry.ts
|
|
52
52
|
var STREAMING_SLOT_STORAGE_KEY = Symbol.for("absolutejs.streamingSlotAsyncLocalStorage");
|
|
53
53
|
var isObjectRecord2 = (value) => Boolean(value) && typeof value === "object";
|
|
54
54
|
var isAsyncLocalStorage = (value) => isObjectRecord2(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
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))
|
|
@@ -174254,14 +174258,329 @@ var init_inspect = __esm(() => {
|
|
|
174254
174258
|
init_tuiPrimitives();
|
|
174255
174259
|
});
|
|
174256
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
|
+
|
|
174257
174576
|
// src/build/externalAssetPlugin.ts
|
|
174258
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
174259
|
-
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";
|
|
174260
174579
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
174261
174580
|
name: "absolute-external-asset",
|
|
174262
174581
|
setup(bld) {
|
|
174263
174582
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
174264
|
-
const skipRoots = userSourceRoots.map((root) =>
|
|
174583
|
+
const skipRoots = userSourceRoots.map((root) => resolve15(root));
|
|
174265
174584
|
const isUserSource = (path) => skipRoots.some((root) => path.startsWith(`${root}/`));
|
|
174266
174585
|
bld.onLoad({ filter: /\.[mc]?[jt]sx?$/ }, async (args) => {
|
|
174267
174586
|
if (isUserSource(args.path))
|
|
@@ -174271,20 +174590,20 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
174271
174590
|
return;
|
|
174272
174591
|
urlPattern.lastIndex = 0;
|
|
174273
174592
|
let match;
|
|
174274
|
-
const sourceDir =
|
|
174593
|
+
const sourceDir = dirname12(args.path);
|
|
174275
174594
|
while ((match = urlPattern.exec(source)) !== null) {
|
|
174276
174595
|
const relPath = match[1];
|
|
174277
174596
|
if (!relPath)
|
|
174278
174597
|
continue;
|
|
174279
|
-
const assetPath =
|
|
174280
|
-
if (!
|
|
174598
|
+
const assetPath = resolve15(sourceDir, relPath);
|
|
174599
|
+
if (!existsSync27(assetPath))
|
|
174281
174600
|
continue;
|
|
174282
|
-
if (!
|
|
174601
|
+
if (!statSync4(assetPath).isFile())
|
|
174283
174602
|
continue;
|
|
174284
|
-
const targetPath =
|
|
174285
|
-
if (
|
|
174603
|
+
const targetPath = join25(outDir, basename6(assetPath));
|
|
174604
|
+
if (existsSync27(targetPath))
|
|
174286
174605
|
continue;
|
|
174287
|
-
mkdirSync12(
|
|
174606
|
+
mkdirSync12(dirname12(targetPath), { recursive: true });
|
|
174288
174607
|
copyFileSync2(assetPath, targetPath);
|
|
174289
174608
|
}
|
|
174290
174609
|
return;
|
|
@@ -174302,16 +174621,16 @@ __export(exports_compile, {
|
|
|
174302
174621
|
var {env: env4 } = globalThis.Bun;
|
|
174303
174622
|
import {
|
|
174304
174623
|
cpSync,
|
|
174305
|
-
existsSync as
|
|
174624
|
+
existsSync as existsSync28,
|
|
174306
174625
|
mkdirSync as mkdirSync13,
|
|
174307
174626
|
readdirSync as readdirSync6,
|
|
174308
|
-
readFileSync as
|
|
174627
|
+
readFileSync as readFileSync25,
|
|
174309
174628
|
rmSync as rmSync5,
|
|
174310
|
-
statSync as
|
|
174629
|
+
statSync as statSync5,
|
|
174311
174630
|
unlinkSync as unlinkSync4,
|
|
174312
174631
|
writeFileSync as writeFileSync13
|
|
174313
174632
|
} from "fs";
|
|
174314
|
-
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";
|
|
174315
174634
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
174316
174635
|
const resolvedVersion = version2 || "unknown";
|
|
174317
174636
|
console.log("");
|
|
@@ -174324,7 +174643,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174324
174643
|
const entry = pending.pop();
|
|
174325
174644
|
if (!entry)
|
|
174326
174645
|
continue;
|
|
174327
|
-
const fullPath =
|
|
174646
|
+
const fullPath = join26(entry.parentPath, entry.name);
|
|
174328
174647
|
if (entry.isDirectory())
|
|
174329
174648
|
pending = pending.concat(readdirSync6(fullPath, { withFileTypes: true }));
|
|
174330
174649
|
else
|
|
@@ -174344,7 +174663,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174344
174663
|
const entry = pending.pop();
|
|
174345
174664
|
if (!entry)
|
|
174346
174665
|
continue;
|
|
174347
|
-
const fullPath =
|
|
174666
|
+
const fullPath = join26(entry.parentPath, entry.name);
|
|
174348
174667
|
if (entry.isDirectory()) {
|
|
174349
174668
|
if (SERVER_RUNTIME_SCAN_SKIP_DIRS.has(entry.name))
|
|
174350
174669
|
continue;
|
|
@@ -174356,22 +174675,22 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174356
174675
|
return result;
|
|
174357
174676
|
}, copyServerRuntimeAssetReferences = (outdir) => {
|
|
174358
174677
|
const copied = new Set;
|
|
174359
|
-
const normalizedOutdir =
|
|
174678
|
+
const normalizedOutdir = resolve16(outdir);
|
|
174360
174679
|
const copyReference = (filePath, relPath) => {
|
|
174361
|
-
const assetSource =
|
|
174362
|
-
if (!
|
|
174680
|
+
const assetSource = resolve16(dirname13(filePath), relPath);
|
|
174681
|
+
if (!existsSync28(assetSource) || !statSync5(assetSource).isFile())
|
|
174363
174682
|
return;
|
|
174364
|
-
const assetTarget =
|
|
174683
|
+
const assetTarget = resolve16(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
174365
174684
|
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
174366
174685
|
return;
|
|
174367
174686
|
if (copied.has(assetTarget))
|
|
174368
174687
|
return;
|
|
174369
174688
|
copied.add(assetTarget);
|
|
174370
|
-
mkdirSync13(
|
|
174689
|
+
mkdirSync13(dirname13(assetTarget), { recursive: true });
|
|
174371
174690
|
cpSync(assetSource, assetTarget, { force: true });
|
|
174372
174691
|
};
|
|
174373
174692
|
for (const filePath of collectProjectSourceFiles(process.cwd())) {
|
|
174374
|
-
const source =
|
|
174693
|
+
const source = readFileSync25(filePath, "utf-8");
|
|
174375
174694
|
SERVER_RUNTIME_ASSET_RE.lastIndex = 0;
|
|
174376
174695
|
let match;
|
|
174377
174696
|
while ((match = SERVER_RUNTIME_ASSET_RE.exec(source)) !== null) {
|
|
@@ -174400,7 +174719,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174400
174719
|
}
|
|
174401
174720
|
}, readPackageVersion4 = (candidate) => {
|
|
174402
174721
|
try {
|
|
174403
|
-
const pkg = JSON.parse(
|
|
174722
|
+
const pkg = JSON.parse(readFileSync25(candidate, "utf-8"));
|
|
174404
174723
|
if (pkg.name !== "@absolutejs/absolute")
|
|
174405
174724
|
return null;
|
|
174406
174725
|
const ver = pkg.version;
|
|
@@ -174435,18 +174754,18 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174435
174754
|
return resolveBuildModule3(remaining);
|
|
174436
174755
|
}, resolveJsxDevRuntimeCompatPath2 = () => {
|
|
174437
174756
|
const candidates = [
|
|
174438
|
-
|
|
174439
|
-
|
|
174440
|
-
|
|
174441
|
-
|
|
174442
|
-
|
|
174443
|
-
|
|
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")
|
|
174444
174763
|
];
|
|
174445
174764
|
for (const candidate of candidates) {
|
|
174446
|
-
if (
|
|
174765
|
+
if (existsSync28(candidate))
|
|
174447
174766
|
return candidate;
|
|
174448
174767
|
}
|
|
174449
|
-
return
|
|
174768
|
+
return resolve16(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
174450
174769
|
}, jsxDevRuntimeCompatPath2, shouldEmbedCompiledAsset = (relativePath, skip = new Set) => {
|
|
174451
174770
|
if (skip.has(relativePath))
|
|
174452
174771
|
return false;
|
|
@@ -174459,11 +174778,11 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174459
174778
|
return true;
|
|
174460
174779
|
}, tryReadNodePackageJson = (packageDir) => {
|
|
174461
174780
|
try {
|
|
174462
|
-
return JSON.parse(
|
|
174781
|
+
return JSON.parse(readFileSync25(join26(packageDir, "package.json"), "utf-8"));
|
|
174463
174782
|
} catch {
|
|
174464
174783
|
return null;
|
|
174465
174784
|
}
|
|
174466
|
-
}, resolveProjectPackageDir = (specifier) =>
|
|
174785
|
+
}, resolveProjectPackageDir = (specifier) => resolve16(process.cwd(), "node_modules", ...specifier.split("/")), copyPackageToBuild = (specifier, outdir, seen) => {
|
|
174467
174786
|
if (seen.has(specifier))
|
|
174468
174787
|
return;
|
|
174469
174788
|
const srcDir = resolveProjectPackageDir(specifier);
|
|
@@ -174471,13 +174790,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174471
174790
|
if (!pkg)
|
|
174472
174791
|
return;
|
|
174473
174792
|
seen.add(specifier);
|
|
174474
|
-
const destDir =
|
|
174793
|
+
const destDir = join26(outdir, "node_modules", ...specifier.split("/"));
|
|
174475
174794
|
rmSync5(destDir, { force: true, recursive: true });
|
|
174476
174795
|
cpSync(srcDir, destDir, {
|
|
174477
174796
|
force: true,
|
|
174478
174797
|
recursive: true,
|
|
174479
174798
|
filter(source) {
|
|
174480
|
-
const rel =
|
|
174799
|
+
const rel = relative9(srcDir, source);
|
|
174481
174800
|
const [firstSegment] = rel.split(/[\\/]/);
|
|
174482
174801
|
return firstSegment !== "node_modules" && firstSegment !== ".git";
|
|
174483
174802
|
}
|
|
@@ -174493,8 +174812,8 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174493
174812
|
}, copyAngularRuntimePackages = (buildConfig, outdir) => {
|
|
174494
174813
|
if (!buildConfig.angularDirectory)
|
|
174495
174814
|
return;
|
|
174496
|
-
const angularScopeDir =
|
|
174497
|
-
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}`) : [];
|
|
174498
174817
|
const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
|
|
174499
174818
|
const seen = new Set;
|
|
174500
174819
|
for (const specifier of roots) {
|
|
@@ -174511,15 +174830,15 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174511
174830
|
}
|
|
174512
174831
|
copyAngularRuntimePackages(buildConfig, outdir);
|
|
174513
174832
|
}, collectRuntimePackageSpecifiers = (distDir) => {
|
|
174514
|
-
const nodeModulesDir =
|
|
174515
|
-
if (!
|
|
174833
|
+
const nodeModulesDir = join26(distDir, "node_modules");
|
|
174834
|
+
if (!existsSync28(nodeModulesDir))
|
|
174516
174835
|
return [];
|
|
174517
174836
|
const specifiers = [];
|
|
174518
174837
|
for (const entry of readdirSync6(nodeModulesDir, { withFileTypes: true })) {
|
|
174519
174838
|
if (!entry.isDirectory())
|
|
174520
174839
|
continue;
|
|
174521
174840
|
if (entry.name.startsWith("@")) {
|
|
174522
|
-
const scopeDir =
|
|
174841
|
+
const scopeDir = join26(nodeModulesDir, entry.name);
|
|
174523
174842
|
for (const scopedEntry of readdirSync6(scopeDir, {
|
|
174524
174843
|
withFileTypes: true
|
|
174525
174844
|
})) {
|
|
@@ -174533,7 +174852,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174533
174852
|
}
|
|
174534
174853
|
return specifiers.sort((a, b) => b.length - a.length);
|
|
174535
174854
|
}, ensureRelativeModuleSpecifier = (fromFile, toFile) => {
|
|
174536
|
-
const rel =
|
|
174855
|
+
const rel = relative9(dirname13(fromFile), toFile).replace(/\\/g, "/");
|
|
174537
174856
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
174538
174857
|
}, pickExportEntry = (value) => {
|
|
174539
174858
|
if (typeof value === "string")
|
|
@@ -174551,21 +174870,21 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174551
174870
|
const packageSpecifier = packageSpecifiers.find((root) => specifier === root || specifier.startsWith(`${root}/`));
|
|
174552
174871
|
if (!packageSpecifier)
|
|
174553
174872
|
return null;
|
|
174554
|
-
const packageDir =
|
|
174873
|
+
const packageDir = join26(distDir, "node_modules", ...packageSpecifier.split("/"));
|
|
174555
174874
|
const subpath = specifier.slice(packageSpecifier.length);
|
|
174556
|
-
const subPackageDir = subpath ?
|
|
174557
|
-
const resolvedPackageDir = subPackageDir &&
|
|
174558
|
-
const packageJsonPath =
|
|
174559
|
-
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))
|
|
174560
174879
|
return null;
|
|
174561
|
-
const pkg = JSON.parse(
|
|
174880
|
+
const pkg = JSON.parse(readFileSync25(packageJsonPath, "utf-8"));
|
|
174562
174881
|
const exportKey = resolvedPackageDir !== subPackageDir && subpath ? `.${subpath}` : ".";
|
|
174563
174882
|
const rootExport = pkg.exports?.[exportKey];
|
|
174564
174883
|
const entry = pickExportEntry(rootExport) ?? (resolvedPackageDir === subPackageDir || !subpath ? pkg.module ?? pkg.main ?? "index.js" : `.${subpath}`);
|
|
174565
|
-
return
|
|
174884
|
+
return join26(resolvedPackageDir, entry);
|
|
174566
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) => {
|
|
174567
174886
|
try {
|
|
174568
|
-
return
|
|
174887
|
+
return statSync5(filePath).isFile();
|
|
174569
174888
|
} catch {
|
|
174570
174889
|
return false;
|
|
174571
174890
|
}
|
|
@@ -174575,16 +174894,16 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174575
174894
|
const candidates = [
|
|
174576
174895
|
candidate,
|
|
174577
174896
|
...RUNTIME_JS_EXTENSIONS.map((extension) => `${candidate}${extension}`),
|
|
174578
|
-
...RUNTIME_JS_EXTENSIONS.map((extension) =>
|
|
174897
|
+
...RUNTIME_JS_EXTENSIONS.map((extension) => join26(candidate, `index${extension}`))
|
|
174579
174898
|
];
|
|
174580
174899
|
return candidates.find((filePath) => isRuntimeJsFile(filePath) && isFile(filePath)) ?? null;
|
|
174581
174900
|
}, findContainingRuntimePackageDir = (filePath) => {
|
|
174582
|
-
let dir =
|
|
174583
|
-
while (dir !==
|
|
174584
|
-
if (isNodeModulesPath(dir) &&
|
|
174901
|
+
let dir = dirname13(filePath);
|
|
174902
|
+
while (dir !== dirname13(dir)) {
|
|
174903
|
+
if (isNodeModulesPath(dir) && existsSync28(join26(dir, "package.json"))) {
|
|
174585
174904
|
return dir;
|
|
174586
174905
|
}
|
|
174587
|
-
dir =
|
|
174906
|
+
dir = dirname13(dir);
|
|
174588
174907
|
}
|
|
174589
174908
|
return null;
|
|
174590
174909
|
}, resolvePackageImportEntryFile = (fromFile, specifier) => {
|
|
@@ -174597,7 +174916,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174597
174916
|
const entry = pickExportEntry(pkg?.imports?.[specifier]);
|
|
174598
174917
|
if (!entry)
|
|
174599
174918
|
return null;
|
|
174600
|
-
return
|
|
174919
|
+
return join26(packageDir, entry);
|
|
174601
174920
|
}, collectRuntimeRewriteRoots = (distDir) => collectFiles2(distDir).filter((filePath) => isRuntimeJsFile(filePath) && !isNodeModulesPath(filePath)), rewriteRuntimeModuleSpecifiers = (distDir) => {
|
|
174602
174921
|
const packageSpecifiers = collectRuntimePackageSpecifiers(distDir);
|
|
174603
174922
|
if (packageSpecifiers.length === 0)
|
|
@@ -174616,10 +174935,10 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174616
174935
|
if (!filePath || seen.has(filePath))
|
|
174617
174936
|
continue;
|
|
174618
174937
|
seen.add(filePath);
|
|
174619
|
-
const source =
|
|
174938
|
+
const source = readFileSync25(filePath, "utf-8");
|
|
174620
174939
|
const rewritten = source.replace(MODULE_SPECIFIER_RE, (match, prefix, quote, specifier) => {
|
|
174621
174940
|
if (typeof specifier === "string" && specifier.startsWith(".")) {
|
|
174622
|
-
enqueue(resolveRuntimeJsFile(
|
|
174941
|
+
enqueue(resolveRuntimeJsFile(resolve16(dirname13(filePath), specifier)));
|
|
174623
174942
|
return match;
|
|
174624
174943
|
}
|
|
174625
174944
|
const packageImportTarget = resolveRuntimeJsFile(resolvePackageImportEntryFile(filePath, specifier) ?? "");
|
|
@@ -174647,25 +174966,25 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174647
174966
|
"_compile_entrypoint.ts"
|
|
174648
174967
|
]);
|
|
174649
174968
|
const embeddedFiles = allFiles.filter((file) => {
|
|
174650
|
-
const rel =
|
|
174969
|
+
const rel = relative9(distDir, file);
|
|
174651
174970
|
if (embeddedSkip.has(rel))
|
|
174652
174971
|
return false;
|
|
174653
174972
|
return true;
|
|
174654
174973
|
});
|
|
174655
|
-
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(
|
|
174974
|
+
const clientFiles = embeddedFiles.filter((file) => shouldEmbedCompiledAsset(relative9(distDir, file), assetSkip));
|
|
174656
174975
|
const imports = [];
|
|
174657
174976
|
const embeddedMappings = [];
|
|
174658
174977
|
const mappings = [];
|
|
174659
174978
|
const embeddedVarMap = new Map;
|
|
174660
174979
|
embeddedFiles.forEach((filePath, idx) => {
|
|
174661
|
-
const rel =
|
|
174980
|
+
const rel = relative9(distDir, filePath).replace(/\\/g, "/");
|
|
174662
174981
|
const varName = `__a${idx}`;
|
|
174663
174982
|
embeddedVarMap.set(rel, varName);
|
|
174664
174983
|
imports.push(`import ${varName} from "./${rel}" with { type: "file" };`);
|
|
174665
174984
|
embeddedMappings.push(` ["${rel}", ${varName}],`);
|
|
174666
174985
|
});
|
|
174667
174986
|
clientFiles.forEach((filePath) => {
|
|
174668
|
-
const rel =
|
|
174987
|
+
const rel = relative9(distDir, filePath).replace(/\\/g, "/");
|
|
174669
174988
|
const varName = embeddedVarMap.get(rel);
|
|
174670
174989
|
if (!varName)
|
|
174671
174990
|
return;
|
|
@@ -174679,7 +174998,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
174679
174998
|
const pageVarMap = new Map;
|
|
174680
174999
|
const prerenderEntries = Array.from(prerenderMap.entries());
|
|
174681
175000
|
prerenderEntries.forEach(([route, filePath]) => {
|
|
174682
|
-
const rel =
|
|
175001
|
+
const rel = relative9(distDir, filePath).replace(/\\/g, "/");
|
|
174683
175002
|
const varName = embeddedVarMap.get(rel);
|
|
174684
175003
|
if (varName)
|
|
174685
175004
|
pageVarMap.set(route, varName);
|
|
@@ -174708,7 +175027,7 @@ import { websocket as elysiaWebsocket } from "elysia/ws";
|
|
|
174708
175027
|
const SERVER_MODULE = (runtimeDir: string) => import(pathToFileURL(join(runtimeDir, ${JSON.stringify(serverBundleName)})).href);
|
|
174709
175028
|
const RUNTIME_BUILD_ID = ${JSON.stringify(runtimeBuildId)};
|
|
174710
175029
|
const RUNTIME_CONFIG_SOURCE = ${JSON.stringify(runtimeConfigSource)};
|
|
174711
|
-
const ORIGINAL_BUILD_DIR = ${JSON.stringify(
|
|
175030
|
+
const ORIGINAL_BUILD_DIR = ${JSON.stringify(resolve16(distDir))};
|
|
174712
175031
|
const ORIGINAL_BUILD_DIR_NORMALIZED = ORIGINAL_BUILD_DIR.replace(/\\\\/g, "/");
|
|
174713
175032
|
|
|
174714
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
|
|
@@ -175086,16 +175405,16 @@ console.log(\`
|
|
|
175086
175405
|
}),
|
|
175087
175406
|
...collectUserServerExternals(buildConfig)
|
|
175088
175407
|
], compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
175089
|
-
const resolvedOutdir =
|
|
175408
|
+
const resolvedOutdir = resolve16(outdir ?? "dist");
|
|
175090
175409
|
await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
|
|
175091
175410
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
175092
175411
|
const prerenderPort = Number(env4.COMPILE_PORT) || Number(env4.PORT) || DEFAULT_PORT + 1;
|
|
175093
175412
|
killStaleProcesses(prerenderPort);
|
|
175094
175413
|
const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
|
|
175095
|
-
const resolvedOutfile =
|
|
175414
|
+
const resolvedOutfile = resolve16(outfile ?? "compiled-server");
|
|
175096
175415
|
const absoluteVersion = resolvePackageVersion3([
|
|
175097
|
-
|
|
175098
|
-
|
|
175416
|
+
resolve16(import.meta.dir, "..", "..", "..", "package.json"),
|
|
175417
|
+
resolve16(import.meta.dir, "..", "..", "package.json")
|
|
175099
175418
|
]);
|
|
175100
175419
|
compileBanner(absoluteVersion);
|
|
175101
175420
|
const totalStart = performance.now();
|
|
@@ -175106,8 +175425,8 @@ console.log(\`
|
|
|
175106
175425
|
buildConfig.mode = "production";
|
|
175107
175426
|
try {
|
|
175108
175427
|
const build2 = await resolveBuildModule3([
|
|
175109
|
-
|
|
175110
|
-
|
|
175428
|
+
resolve16(import.meta.dir, "..", "..", "core", "build"),
|
|
175429
|
+
resolve16(import.meta.dir, "..", "build")
|
|
175111
175430
|
]);
|
|
175112
175431
|
if (!build2)
|
|
175113
175432
|
throw new Error("Could not locate build module");
|
|
@@ -175129,10 +175448,10 @@ console.log(\`
|
|
|
175129
175448
|
buildConfig.htmxDirectory
|
|
175130
175449
|
].filter((dir) => Boolean(dir));
|
|
175131
175450
|
const islandRegistrySpec = buildConfig.islands?.registry;
|
|
175132
|
-
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(
|
|
175451
|
+
const islandRegistryPlugin = islandRegistrySpec ? createIslandRegistryDefinitionPlugin(await loadIslandRegistryBuildInfo(resolve16(islandRegistrySpec))) : undefined;
|
|
175133
175452
|
const serverBundle = await Bun.build({
|
|
175134
175453
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
175135
|
-
entrypoints: [
|
|
175454
|
+
entrypoints: [resolve16(serverEntry)],
|
|
175136
175455
|
external: resolveServerBundleExternals(buildConfig),
|
|
175137
175456
|
outdir: resolvedOutdir,
|
|
175138
175457
|
plugins: [
|
|
@@ -175153,13 +175472,13 @@ console.log(\`
|
|
|
175153
175472
|
console.error(cliTag4("\x1B[31m", "Server bundle failed."));
|
|
175154
175473
|
process.exit(1);
|
|
175155
175474
|
}
|
|
175156
|
-
const outputPath =
|
|
175157
|
-
if (!
|
|
175475
|
+
const outputPath = resolve16(resolvedOutdir, `${entryName}.js`);
|
|
175476
|
+
if (!existsSync28(outputPath)) {
|
|
175158
175477
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
175159
175478
|
process.exit(1);
|
|
175160
175479
|
}
|
|
175161
|
-
if (
|
|
175162
|
-
const vendorDir =
|
|
175480
|
+
if (existsSync28(resolve16(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
175481
|
+
const vendorDir = resolve16(resolvedOutdir, "angular", "vendor", "server");
|
|
175163
175482
|
const vendorEntries = readdirSync6(vendorDir).filter((f) => f.endsWith(".js"));
|
|
175164
175483
|
const angularServerVendorPaths = {};
|
|
175165
175484
|
for (const file of vendorEntries) {
|
|
@@ -175168,7 +175487,7 @@ console.log(\`
|
|
|
175168
175487
|
if (scope !== "angular" || rest.length === 0)
|
|
175169
175488
|
continue;
|
|
175170
175489
|
const specifier = `@angular/${rest.join("/")}`;
|
|
175171
|
-
const relPath =
|
|
175490
|
+
const relPath = relative9(dirname13(outputPath), resolve16(vendorDir, file));
|
|
175172
175491
|
angularServerVendorPaths[specifier] = relPath.startsWith(".") ? relPath : `./${relPath}`;
|
|
175173
175492
|
}
|
|
175174
175493
|
if (Object.keys(angularServerVendorPaths).length > 0) {
|
|
@@ -175180,7 +175499,7 @@ console.log(\`
|
|
|
175180
175499
|
copyServerRuntimeAssetReferences(resolvedOutdir);
|
|
175181
175500
|
const prerenderStart = performance.now();
|
|
175182
175501
|
process.stdout.write(cliTag4("\x1B[36m", "Pre-rendering pages"));
|
|
175183
|
-
rmSync5(
|
|
175502
|
+
rmSync5(join26(resolvedOutdir, "_prerendered"), {
|
|
175184
175503
|
force: true,
|
|
175185
175504
|
recursive: true
|
|
175186
175505
|
});
|
|
@@ -175199,9 +175518,9 @@ console.log(\`
|
|
|
175199
175518
|
const compileStart = performance.now();
|
|
175200
175519
|
process.stdout.write(cliTag4("\x1B[36m", "Compiling standalone executable"));
|
|
175201
175520
|
const entrypointCode = generateEntrypoint(resolvedOutdir, serverEntry, prerenderMap, absoluteVersion, buildConfig);
|
|
175202
|
-
const entrypointPath =
|
|
175521
|
+
const entrypointPath = join26(resolvedOutdir, "_compile_entrypoint.ts");
|
|
175203
175522
|
await Bun.write(entrypointPath, entrypointCode);
|
|
175204
|
-
mkdirSync13(
|
|
175523
|
+
mkdirSync13(dirname13(resolvedOutfile), { recursive: true });
|
|
175205
175524
|
const result = await Bun.build({
|
|
175206
175525
|
compile: { outfile: resolvedOutfile },
|
|
175207
175526
|
define: { "process.env.NODE_ENV": '"production"' },
|
|
@@ -175295,11 +175614,11 @@ var exports_typecheck = {};
|
|
|
175295
175614
|
__export(exports_typecheck, {
|
|
175296
175615
|
typecheck: () => typecheck
|
|
175297
175616
|
});
|
|
175298
|
-
import { resolve as
|
|
175299
|
-
import { existsSync as
|
|
175617
|
+
import { resolve as resolve17, join as join27 } from "path";
|
|
175618
|
+
import { existsSync as existsSync29, readFileSync as readFileSync26 } from "fs";
|
|
175300
175619
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
175301
|
-
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) =>
|
|
175302
|
-
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))) {
|
|
175303
175622
|
return [{}];
|
|
175304
175623
|
}
|
|
175305
175624
|
const rawConfig = await loadRawConfig(configPath2);
|
|
@@ -175319,8 +175638,8 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
175319
175638
|
const exitCode = await proc.exited;
|
|
175320
175639
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
175321
175640
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
175322
|
-
const local =
|
|
175323
|
-
return
|
|
175641
|
+
const local = resolve17("node_modules", ".bin", name);
|
|
175642
|
+
return existsSync29(local) ? local : null;
|
|
175324
175643
|
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
175325
175644
|
const cwd = `${process.cwd()}/`;
|
|
175326
175645
|
const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
|
|
@@ -175367,15 +175686,15 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175367
175686
|
return formatted;
|
|
175368
175687
|
}, ABSOLUTE_INTERNAL_EXCLUDES, resolveAbsoluteTypeFile = (fileName) => {
|
|
175369
175688
|
const candidates = [
|
|
175370
|
-
|
|
175371
|
-
|
|
175372
|
-
|
|
175373
|
-
|
|
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)
|
|
175374
175693
|
];
|
|
175375
|
-
return candidates.find((candidate) =>
|
|
175694
|
+
return candidates.find((candidate) => existsSync29(candidate)) ?? candidates[0];
|
|
175376
175695
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
175377
175696
|
try {
|
|
175378
|
-
return JSON.parse(
|
|
175697
|
+
return JSON.parse(readFileSync26(resolve17("tsconfig.json"), "utf-8"));
|
|
175379
175698
|
} catch {
|
|
175380
175699
|
return {};
|
|
175381
175700
|
}
|
|
@@ -175403,22 +175722,22 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175403
175722
|
console.error("\x1B[31m\u2717\x1B[0m vue-tsc is required for Vue type checking. Install it: bun add -d vue-tsc");
|
|
175404
175723
|
process.exit(1);
|
|
175405
175724
|
}
|
|
175406
|
-
const vueTsconfigPath =
|
|
175725
|
+
const vueTsconfigPath = join27(cacheDir, "tsconfig.vue-check.json");
|
|
175407
175726
|
return writeFile(vueTsconfigPath, JSON.stringify({
|
|
175408
175727
|
compilerOptions: {
|
|
175409
175728
|
rootDir: ".."
|
|
175410
175729
|
},
|
|
175411
175730
|
exclude: getProjectTypecheckExcludes(),
|
|
175412
|
-
extends:
|
|
175731
|
+
extends: resolve17("tsconfig.json"),
|
|
175413
175732
|
include: getProjectTypecheckIncludes()
|
|
175414
175733
|
}, null, "\t")).then(() => run("vue-tsc", [
|
|
175415
175734
|
vueTscBin,
|
|
175416
175735
|
"--noEmit",
|
|
175417
175736
|
"--project",
|
|
175418
|
-
|
|
175737
|
+
resolve17(vueTsconfigPath),
|
|
175419
175738
|
"--incremental",
|
|
175420
175739
|
"--tsBuildInfoFile",
|
|
175421
|
-
|
|
175740
|
+
join27(cacheDir, "vue-tsc.tsbuildinfo"),
|
|
175422
175741
|
"--pretty"
|
|
175423
175742
|
]));
|
|
175424
175743
|
}, buildAngularCheck = async (cacheDir, angularDir) => {
|
|
@@ -175427,7 +175746,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175427
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");
|
|
175428
175747
|
process.exit(1);
|
|
175429
175748
|
}
|
|
175430
|
-
const angularTsconfigPath =
|
|
175749
|
+
const angularTsconfigPath = join27(cacheDir, "tsconfig.angular-check.json");
|
|
175431
175750
|
await writeFile(angularTsconfigPath, JSON.stringify({
|
|
175432
175751
|
angularCompilerOptions: {
|
|
175433
175752
|
strictTemplates: true
|
|
@@ -175437,32 +175756,32 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175437
175756
|
rootDir: ".."
|
|
175438
175757
|
},
|
|
175439
175758
|
exclude: ABSOLUTE_INTERNAL_EXCLUDES.map(toGeneratedConfigPath),
|
|
175440
|
-
extends:
|
|
175759
|
+
extends: resolve17("tsconfig.json"),
|
|
175441
175760
|
include: [`../${angularDir}/**/*`]
|
|
175442
175761
|
}, null, "\t"));
|
|
175443
|
-
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(
|
|
175762
|
+
return runShell("ngc", `${shellEscape(ngcBin)} -p ${shellEscape(resolve17(angularTsconfigPath))}`);
|
|
175444
175763
|
}, buildTscCheck = (cacheDir) => {
|
|
175445
175764
|
const tscBin = findBin("tsc");
|
|
175446
175765
|
if (!tscBin) {
|
|
175447
175766
|
console.error("\x1B[31m\u2717\x1B[0m typescript is required for type checking. Install it: bun add -d typescript");
|
|
175448
175767
|
process.exit(1);
|
|
175449
175768
|
}
|
|
175450
|
-
const tscConfigPath =
|
|
175769
|
+
const tscConfigPath = join27(cacheDir, "tsconfig.typecheck.json");
|
|
175451
175770
|
return writeFile(tscConfigPath, JSON.stringify({
|
|
175452
175771
|
compilerOptions: {
|
|
175453
175772
|
rootDir: ".."
|
|
175454
175773
|
},
|
|
175455
175774
|
exclude: getProjectTypecheckExcludes(),
|
|
175456
|
-
extends:
|
|
175775
|
+
extends: resolve17("tsconfig.json"),
|
|
175457
175776
|
include: getProjectTypecheckIncludes()
|
|
175458
175777
|
}, null, "\t")).then(() => run("tsc", [
|
|
175459
175778
|
tscBin,
|
|
175460
175779
|
"--noEmit",
|
|
175461
175780
|
"--project",
|
|
175462
|
-
|
|
175781
|
+
resolve17(tscConfigPath),
|
|
175463
175782
|
"--incremental",
|
|
175464
175783
|
"--tsBuildInfoFile",
|
|
175465
|
-
|
|
175784
|
+
join27(cacheDir, "tsc.tsbuildinfo"),
|
|
175466
175785
|
"--pretty"
|
|
175467
175786
|
]));
|
|
175468
175787
|
}, buildSvelteCheck = async (cacheDir, svelteDir) => {
|
|
@@ -175471,16 +175790,16 @@ Found ${errorCount} error${suffix}.`;
|
|
|
175471
175790
|
console.error("\x1B[31m\u2717\x1B[0m svelte-check is required for Svelte type checking. Install it: bun add -d svelte-check");
|
|
175472
175791
|
process.exit(1);
|
|
175473
175792
|
}
|
|
175474
|
-
const svelteTsconfigPath =
|
|
175793
|
+
const svelteTsconfigPath = join27(cacheDir, "tsconfig.svelte-check.json");
|
|
175475
175794
|
await writeFile(svelteTsconfigPath, JSON.stringify({
|
|
175476
|
-
extends:
|
|
175795
|
+
extends: resolve17("tsconfig.json"),
|
|
175477
175796
|
files: ABSOLUTE_TYPECHECK_FILES,
|
|
175478
175797
|
include: [`../${svelteDir}/**/*`]
|
|
175479
175798
|
}, null, "\t"));
|
|
175480
175799
|
return run("svelte-check", [
|
|
175481
175800
|
svelteBin,
|
|
175482
175801
|
"--tsconfig",
|
|
175483
|
-
|
|
175802
|
+
resolve17(svelteTsconfigPath),
|
|
175484
175803
|
"--threshold",
|
|
175485
175804
|
"error",
|
|
175486
175805
|
"--compiler-warnings",
|
|
@@ -175669,11 +175988,11 @@ var DEFAULT_RELAY_PORT = 8787, DEFAULT_REQUEST_TIMEOUT_MS = 30000, headersToObje
|
|
|
175669
175988
|
url: url.pathname + url.search,
|
|
175670
175989
|
...bodyBytes && bodyBytes.length > 0 ? { bodyBase64: Buffer.from(bodyBytes).toString("base64") } : {}
|
|
175671
175990
|
};
|
|
175672
|
-
const responsePromise = new Promise((
|
|
175673
|
-
pending.set(id,
|
|
175991
|
+
const responsePromise = new Promise((resolve18) => {
|
|
175992
|
+
pending.set(id, resolve18);
|
|
175674
175993
|
});
|
|
175675
175994
|
client.send(encodeTunnelMessage(message));
|
|
175676
|
-
const timeout = new Promise((
|
|
175995
|
+
const timeout = new Promise((resolve18) => setTimeout(() => resolve18({ id, message: "timeout", type: "error" }), requestTimeoutMs));
|
|
175677
175996
|
const result = await Promise.race([responsePromise, timeout]);
|
|
175678
175997
|
pending.delete(id);
|
|
175679
175998
|
if (result.type === "error") {
|
|
@@ -179214,6 +179533,10 @@ if (command === "dev") {
|
|
|
179214
179533
|
sendTelemetryEvent("cli:command", { command: "inspect" });
|
|
179215
179534
|
const { runInspect: runInspect2 } = await Promise.resolve().then(() => (init_inspect(), exports_inspect));
|
|
179216
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);
|
|
179217
179540
|
} else if (command === "info") {
|
|
179218
179541
|
sendTelemetryEvent("cli:command", { command });
|
|
179219
179542
|
info();
|
|
@@ -179261,6 +179584,7 @@ if (command === "dev") {
|
|
|
179261
179584
|
console.error(" htmx [version] Self-host htmx \u2014 report or install/upgrade the pinned copy");
|
|
179262
179585
|
console.error(" info Print system info for bug reports");
|
|
179263
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)");
|
|
179264
179588
|
console.error(" remove <framework> [--prune] Remove a framework from config (keeps source)");
|
|
179265
179589
|
console.error(" logs <name> [-f] [-n <lines>] Tail a running server's log by name");
|
|
179266
179590
|
console.error(" ls [--sizes] [--budget <size>] [--json] List the project's pages by framework");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const runIslands: (args: string[]) => Promise<void>;
|