@absolutejs/absolute 0.19.0-beta.1030 → 0.19.0-beta.1032
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/browser.js +18 -16
- package/dist/angular/browser.js.map +5 -5
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/hmrPreserveCore.ts +83 -118
- package/dist/angular/index.js +49 -49
- package/dist/angular/index.js.map +12 -12
- package/dist/angular/server.js +34 -34
- package/dist/angular/server.js.map +10 -10
- package/dist/build.js +135 -135
- package/dist/build.js.map +26 -26
- package/dist/cli/config/client.js +1 -1
- package/dist/cli/config/server.js +43 -43
- package/dist/cli/index.js +247 -168
- package/dist/client/index.js +9 -9
- package/dist/client/index.js.map +8 -8
- package/dist/dev/client/errorOverlay.ts +4 -4
- package/dist/dev/client/handlers/angularHmrShim.ts +17 -17
- package/dist/dev/client/handlers/angularRemount.ts +6 -4
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -1
- package/dist/dev/client/hmrToast.ts +18 -18
- package/dist/index.js +149 -150
- package/dist/index.js.map +31 -31
- package/dist/islands/browser.js.map +1 -1
- package/dist/islands/index.js +5 -5
- package/dist/islands/index.js.map +6 -6
- package/dist/react/browser.js.map +1 -1
- package/dist/react/components/index.js +2 -2
- package/dist/react/components/index.js.map +3 -3
- package/dist/react/hooks/index.js.map +1 -1
- package/dist/react/index.js +21 -21
- package/dist/react/index.js.map +9 -9
- package/dist/react/server.js +17 -17
- package/dist/react/server.js.map +5 -5
- package/dist/src/angular/hmrPreserveCore.d.ts +5 -18
- package/dist/src/angular/islands.d.ts +1 -1
- package/dist/src/cli/config/packageJson/editPackageJson.d.ts +2 -2
- package/dist/src/cli/config/schema/fromJsonSchema.d.ts +1 -1
- package/dist/src/client/hydrators/react.d.ts +1 -1
- package/dist/src/client/hydrators/svelte.d.ts +1 -1
- package/dist/src/client/hydrators/vue.d.ts +1 -1
- package/dist/src/client/islandStore.d.ts +3 -3
- package/dist/src/core/devRouteRegistrationCallsite.d.ts +1 -5
- package/dist/src/dev/angular/fastHmrCompiler.d.ts +2 -2
- package/dist/src/dev/angular/hmrCompiler.d.ts +1 -1
- package/dist/src/dev/angular/resolveOwningComponents.d.ts +1 -1
- package/dist/src/svelte/router/hashMode.d.ts +1 -6
- package/dist/src/svelte/router/matchPath.d.ts +2 -22
- package/dist/src/svelte/router/page.svelte.d.ts +1 -10
- package/dist/src/svelte/router/prefetchCache.d.ts +2 -6
- package/dist/src/utils/generatedDir.d.ts +1 -1
- package/dist/src/utils/inlinePageCss.d.ts +1 -3
- package/dist/src/utils/jsonLd.d.ts +1 -1
- package/dist/src/utils/loadConfig.d.ts +2 -3
- package/dist/src/utils/resolveConvention.d.ts +1 -1
- package/dist/src/utils/runtimeMode.d.ts +1 -1
- package/dist/src/vue/defineVuePage.d.ts +1 -11
- package/dist/svelte/browser.js.map +1 -1
- package/dist/svelte/index.js +26 -26
- package/dist/svelte/index.js.map +9 -9
- package/dist/svelte/router/hashMode.ts +6 -12
- package/dist/svelte/router/matchPath.ts +23 -45
- package/dist/svelte/router/page.d.ts +1 -10
- package/dist/svelte/router/page.js +6 -6
- package/dist/svelte/router/prefetchCache.ts +12 -20
- package/dist/svelte/server.js +22 -22
- package/dist/svelte/server.js.map +5 -5
- package/dist/vue/browser.js +2 -2
- package/dist/vue/browser.js.map +4 -4
- package/dist/vue/index.js +29 -29
- package/dist/vue/index.js.map +11 -11
- package/dist/vue/server.js +24 -24
- package/dist/vue/server.js.map +6 -6
- package/package.json +38 -38
package/dist/cli/index.js
CHANGED
|
@@ -316,7 +316,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
316
316
|
process.kill(pid, 0);
|
|
317
317
|
return true;
|
|
318
318
|
} catch (err) {
|
|
319
|
-
const code = err
|
|
319
|
+
const { code } = err;
|
|
320
320
|
if (code === "ESRCH")
|
|
321
321
|
return false;
|
|
322
322
|
if (code === "EPERM")
|
|
@@ -170858,40 +170858,124 @@ var init_build = __esm(() => {
|
|
|
170858
170858
|
init_telemetryEvent();
|
|
170859
170859
|
});
|
|
170860
170860
|
|
|
170861
|
+
// src/build/scanConventions.ts
|
|
170862
|
+
import { basename as basename4 } from "path";
|
|
170863
|
+
var {Glob: Glob2 } = globalThis.Bun;
|
|
170864
|
+
import { existsSync as existsSync10 } from "fs";
|
|
170865
|
+
var CONVENTION_RE, classifyFile = (file, pageFiles, defaults, pages) => {
|
|
170866
|
+
const fileName = basename4(file);
|
|
170867
|
+
const match = CONVENTION_RE.exec(fileName);
|
|
170868
|
+
if (!match) {
|
|
170869
|
+
pageFiles.push(file);
|
|
170870
|
+
return;
|
|
170871
|
+
}
|
|
170872
|
+
const [, pageName, kind] = match;
|
|
170873
|
+
if (!pageName) {
|
|
170874
|
+
if (kind === "error")
|
|
170875
|
+
defaults.error = file;
|
|
170876
|
+
else if (kind === "loading")
|
|
170877
|
+
defaults.loading = file;
|
|
170878
|
+
else if (kind === "not-found")
|
|
170879
|
+
defaults.notFound = file;
|
|
170880
|
+
return;
|
|
170881
|
+
}
|
|
170882
|
+
if (!pages[pageName])
|
|
170883
|
+
pages[pageName] = {};
|
|
170884
|
+
if (kind === "error")
|
|
170885
|
+
pages[pageName].error = file;
|
|
170886
|
+
else if (kind === "loading")
|
|
170887
|
+
pages[pageName].loading = file;
|
|
170888
|
+
}, scanConventions = async (pagesDir, pattern) => {
|
|
170889
|
+
if (!existsSync10(pagesDir)) {
|
|
170890
|
+
const pageFiles2 = [];
|
|
170891
|
+
return { conventions: undefined, pageFiles: pageFiles2 };
|
|
170892
|
+
}
|
|
170893
|
+
const pageFiles = [];
|
|
170894
|
+
const defaults = {};
|
|
170895
|
+
const pages = {};
|
|
170896
|
+
const glob = new Glob2(pattern);
|
|
170897
|
+
for await (const file of glob.scan({ absolute: true, cwd: pagesDir })) {
|
|
170898
|
+
classifyFile(file, pageFiles, defaults, pages);
|
|
170899
|
+
}
|
|
170900
|
+
const hasConventions = defaults.error !== undefined || defaults.loading !== undefined || defaults.notFound !== undefined || Object.keys(pages).length > 0;
|
|
170901
|
+
const conventions = hasConventions ? {
|
|
170902
|
+
...defaults.error || defaults.loading || defaults.notFound ? { defaults } : {},
|
|
170903
|
+
...Object.keys(pages).length > 0 ? { pages } : {}
|
|
170904
|
+
} : undefined;
|
|
170905
|
+
return { conventions, pageFiles };
|
|
170906
|
+
};
|
|
170907
|
+
var init_scanConventions = __esm(() => {
|
|
170908
|
+
CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
|
|
170909
|
+
});
|
|
170910
|
+
|
|
170911
|
+
// src/utils/stringModifiers.ts
|
|
170912
|
+
var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-"), toPascal = (str) => {
|
|
170913
|
+
if (!str.includes("-") && !str.includes("_")) {
|
|
170914
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
170915
|
+
}
|
|
170916
|
+
return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
|
|
170917
|
+
};
|
|
170918
|
+
|
|
170861
170919
|
// src/cli/scripts/ls.ts
|
|
170862
170920
|
var exports_ls = {};
|
|
170863
170921
|
__export(exports_ls, {
|
|
170864
170922
|
runLs: () => runLs
|
|
170865
170923
|
});
|
|
170866
|
-
import { existsSync as
|
|
170867
|
-
import { join as join11, relative as relative2 } from "path";
|
|
170868
|
-
var DEFAULT_BUILD_DIR = "build",
|
|
170869
|
-
const
|
|
170924
|
+
import { existsSync as existsSync11, readFileSync as readFileSync13, statSync } from "fs";
|
|
170925
|
+
import { basename as basename5, extname as extname2, join as join11, relative as relative2 } from "path";
|
|
170926
|
+
var DEFAULT_BUILD_DIR = "build", LABEL_ORDER, ARTIFACT_SUFFIXES, FRAMEWORK_FIELDS, readStringField = (source, key) => {
|
|
170927
|
+
const value = Reflect.get(source, key);
|
|
170928
|
+
return typeof value === "string" ? value : undefined;
|
|
170929
|
+
}, parseFlagValue = (args, flag) => {
|
|
170930
|
+
const index = args.indexOf(flag);
|
|
170870
170931
|
if (index === UNFOUND_INDEX)
|
|
170871
170932
|
return;
|
|
170872
170933
|
return args[index + 1];
|
|
170873
|
-
},
|
|
170934
|
+
}, loadRawConfigSafe = async (configPath2) => {
|
|
170874
170935
|
try {
|
|
170875
|
-
|
|
170876
|
-
return typeof config.buildDirectory === "string" ? config.buildDirectory : DEFAULT_BUILD_DIR;
|
|
170936
|
+
return await loadRawConfig(configPath2);
|
|
170877
170937
|
} catch {
|
|
170878
|
-
return
|
|
170938
|
+
return null;
|
|
170879
170939
|
}
|
|
170880
|
-
},
|
|
170881
|
-
|
|
170882
|
-
|
|
170883
|
-
},
|
|
170884
|
-
const
|
|
170885
|
-
|
|
170886
|
-
|
|
170887
|
-
|
|
170888
|
-
|
|
170889
|
-
|
|
170940
|
+
}, relativeOrSelf = (target) => relative2(process.cwd(), target) || target, configCandidates = (raw) => isWorkspaceConfig(raw) ? Object.values(raw).map((service) => ({
|
|
170941
|
+
baseDir: readStringField(service, "cwd") ?? ".",
|
|
170942
|
+
source: service
|
|
170943
|
+
})) : [{ baseDir: ".", source: raw }], specsFor = (source, baseDir) => FRAMEWORK_FIELDS.flatMap((framework) => {
|
|
170944
|
+
const dir = readStringField(source, framework.field);
|
|
170945
|
+
return dir === undefined ? [] : [
|
|
170946
|
+
{
|
|
170947
|
+
dir: join11(baseDir, dir),
|
|
170948
|
+
label: framework.label,
|
|
170949
|
+
pattern: framework.pattern
|
|
170950
|
+
}
|
|
170951
|
+
];
|
|
170952
|
+
}), scanFramework = async (spec) => {
|
|
170953
|
+
const { pageFiles } = await scanConventions(join11(spec.dir, "pages"), spec.pattern);
|
|
170954
|
+
if (pageFiles.length === 0)
|
|
170955
|
+
return null;
|
|
170956
|
+
const pages = pageFiles.map((file) => ({
|
|
170957
|
+
name: basename5(file, extname2(file)),
|
|
170958
|
+
sizeBytes: null,
|
|
170959
|
+
sourcePath: relativeOrSelf(file)
|
|
170960
|
+
}));
|
|
170961
|
+
return { label: spec.label, pages };
|
|
170962
|
+
}, sortPages = (pages) => [...pages].sort((left, right) => left.name.localeCompare(right.name)), mergeByLabel = (groups) => {
|
|
170963
|
+
const byLabel = new Map;
|
|
170964
|
+
groups.forEach((group) => {
|
|
170965
|
+
byLabel.set(group.label, [
|
|
170966
|
+
...byLabel.get(group.label) ?? [],
|
|
170967
|
+
...group.pages
|
|
170968
|
+
]);
|
|
170969
|
+
});
|
|
170970
|
+
return LABEL_ORDER.flatMap((label) => {
|
|
170971
|
+
const pages = byLabel.get(label);
|
|
170972
|
+
return pages ? [{ label, pages: sortPages(pages) }] : [];
|
|
170973
|
+
});
|
|
170890
170974
|
}, resolveDiskPath = (buildDir, value) => {
|
|
170891
|
-
if (
|
|
170975
|
+
if (existsSync11(value))
|
|
170892
170976
|
return value;
|
|
170893
170977
|
const underBuild = join11(buildDir, value);
|
|
170894
|
-
if (
|
|
170978
|
+
if (existsSync11(underBuild))
|
|
170895
170979
|
return underBuild;
|
|
170896
170980
|
return join11(process.cwd(), value);
|
|
170897
170981
|
}, fileSize = (diskPath) => {
|
|
@@ -170900,17 +170984,29 @@ var DEFAULT_BUILD_DIR = "build", FRAMEWORK_SEGMENTS, FRAMEWORK_ORDER, FRAMEWORK_
|
|
|
170900
170984
|
} catch {
|
|
170901
170985
|
return 0;
|
|
170902
170986
|
}
|
|
170903
|
-
},
|
|
170904
|
-
|
|
170905
|
-
|
|
170906
|
-
|
|
170907
|
-
|
|
170908
|
-
|
|
170909
|
-
|
|
170910
|
-
|
|
170911
|
-
|
|
170912
|
-
|
|
170913
|
-
|
|
170987
|
+
}, readManifestSizes = (manifestDir) => {
|
|
170988
|
+
const manifest = JSON.parse(readFileSync13(join11(manifestDir, "manifest.json"), "utf-8"));
|
|
170989
|
+
const sizes = new Map;
|
|
170990
|
+
Object.entries(manifest).forEach(([key, value]) => {
|
|
170991
|
+
sizes.set(key, fileSize(resolveDiskPath(manifestDir, value)));
|
|
170992
|
+
});
|
|
170993
|
+
return sizes;
|
|
170994
|
+
}, pageSizer = (sizes) => (name) => {
|
|
170995
|
+
const base = toPascal(name);
|
|
170996
|
+
const total = ARTIFACT_SUFFIXES.reduce((sum, suffix) => sum + (sizes.get(`${base}${suffix}`) ?? 0), 0);
|
|
170997
|
+
return total > 0 ? total : null;
|
|
170998
|
+
}, withSizes = (groups, sizeOf) => groups.map((group) => ({
|
|
170999
|
+
label: group.label,
|
|
171000
|
+
pages: group.pages.map((page) => ({
|
|
171001
|
+
name: page.name,
|
|
171002
|
+
sizeBytes: sizeOf(page.name),
|
|
171003
|
+
sourcePath: page.sourcePath
|
|
171004
|
+
}))
|
|
171005
|
+
})), manifestAge = (manifestPath) => getDurationString(Date.now() - statSync(manifestPath).mtimeMs), firstBuildDir = (candidates) => candidates.map((candidate) => {
|
|
171006
|
+
const dir = readStringField(candidate.source, "buildDirectory");
|
|
171007
|
+
return dir === undefined ? undefined : join11(candidate.baseDir, dir);
|
|
171008
|
+
}).find((dir) => dir !== undefined), resolveSizesDir = (args, candidates) => parseFlagValue(args, "--outdir") ?? firstBuildDir(candidates) ?? DEFAULT_BUILD_DIR, formatSize = (bytes) => {
|
|
171009
|
+
if (bytes === null || bytes === 0)
|
|
170914
171010
|
return "-";
|
|
170915
171011
|
if (bytes < BYTES_PER_KILOBYTE)
|
|
170916
171012
|
return `${bytes} B`;
|
|
@@ -170923,129 +171019,102 @@ var DEFAULT_BUILD_DIR = "build", FRAMEWORK_SEGMENTS, FRAMEWORK_ORDER, FRAMEWORK_
|
|
|
170923
171019
|
if (padding <= 0)
|
|
170924
171020
|
return value;
|
|
170925
171021
|
return `${" ".repeat(padding)}${value}`;
|
|
170926
|
-
}, columnWidths = (
|
|
170927
|
-
|
|
170928
|
-
|
|
170929
|
-
|
|
170930
|
-
|
|
170931
|
-
|
|
170932
|
-
|
|
170933
|
-
|
|
170934
|
-
|
|
170935
|
-
|
|
170936
|
-
|
|
170937
|
-
|
|
170938
|
-
const kind = padLine(KIND_LABELS[entry.kind], widths.kind);
|
|
170939
|
-
const size = padStart(formatSize(entry.sizeBytes), widths.size);
|
|
170940
|
-
return ` ${id} ${colors.dim}${kind}${colors.reset} ${size}`;
|
|
170941
|
-
}, visibleEntries = (entries, showAll) => showAll ? entries : entries.filter((entry) => entry.kind !== "chunk"), renderChunkSummary = (entries, showAll) => {
|
|
170942
|
-
const chunks = entries.filter((entry) => entry.kind === "chunk");
|
|
170943
|
-
if (showAll || chunks.length === 0)
|
|
170944
|
-
return [];
|
|
170945
|
-
return [
|
|
170946
|
-
` ${colors.dim}+ ${chunks.length} shared ${chunks.length === 1 ? "chunk" : "chunks"} \xB7 ${formatSize(sumSizes(chunks))} (--all to list)${colors.reset}`
|
|
170947
|
-
];
|
|
170948
|
-
}, renderGroup = (group, widths, showAll) => [
|
|
171022
|
+
}, pluralPages = (count) => count === 1 ? "page" : "pages", columnWidths = (groups, showSizes) => {
|
|
171023
|
+
const pages = groups.flatMap((group) => group.pages);
|
|
171024
|
+
return {
|
|
171025
|
+
name: Math.max(...pages.map((page) => page.name.length)),
|
|
171026
|
+
size: showSizes ? Math.max(...pages.map((page) => formatSize(page.sizeBytes).length)) : 0
|
|
171027
|
+
};
|
|
171028
|
+
}, renderGroupHeader = (group) => `
|
|
171029
|
+
${colors.bold}${group.label}${colors.reset}${colors.dim} \xB7 ${group.pages.length} ${pluralPages(group.pages.length)}${colors.reset}`, renderPageLine = (page, widths, showSizes) => {
|
|
171030
|
+
const name = padLine(page.name, widths.name);
|
|
171031
|
+
const size = showSizes ? ` ${padStart(formatSize(page.sizeBytes), widths.size)}` : "";
|
|
171032
|
+
return ` ${name}${size} ${colors.dim}${page.sourcePath}${colors.reset}`;
|
|
171033
|
+
}, renderGroup = (group, widths, showSizes) => [
|
|
170949
171034
|
renderGroupHeader(group),
|
|
170950
|
-
...
|
|
170951
|
-
|
|
170952
|
-
|
|
170953
|
-
|
|
170954
|
-
|
|
170955
|
-
|
|
170956
|
-
|
|
170957
|
-
|
|
170958
|
-
|
|
170959
|
-
|
|
171035
|
+
...group.pages.map((page) => renderPageLine(page, widths, showSizes))
|
|
171036
|
+
], renderFooter = (groups) => {
|
|
171037
|
+
const frameworkCount = groups.length;
|
|
171038
|
+
const pageCount = groups.reduce((sum, group) => sum + group.pages.length, 0);
|
|
171039
|
+
return `
|
|
171040
|
+
${colors.dim}${frameworkCount} ${frameworkCount === 1 ? "framework" : "frameworks"} \xB7 ${pageCount} ${pluralPages(pageCount)}${colors.reset}`;
|
|
171041
|
+
}, printInventory = (groups, showSizes, note) => {
|
|
171042
|
+
const widths = columnWidths(groups, showSizes);
|
|
171043
|
+
const header = note === null ? [] : [`${colors.dim}${note}${colors.reset}`];
|
|
171044
|
+
const body = groups.flatMap((group) => renderGroup(group, widths, showSizes));
|
|
171045
|
+
const lines = [...header, ...body, renderFooter(groups)];
|
|
170960
171046
|
process.stdout.write(`${lines.join(`
|
|
170961
171047
|
`)}
|
|
170962
171048
|
`);
|
|
170963
|
-
},
|
|
170964
|
-
|
|
171049
|
+
}, emit = (groups, showSizes, note, wantsJson) => {
|
|
171050
|
+
if (wantsJson) {
|
|
171051
|
+
process.stdout.write(`${JSON.stringify(groups, null, 2)}
|
|
170965
171052
|
`);
|
|
170966
|
-
|
|
171053
|
+
return;
|
|
171054
|
+
}
|
|
171055
|
+
printInventory(groups, showSizes, note);
|
|
171056
|
+
}, printDim = (message) => {
|
|
171057
|
+
process.stdout.write(`${colors.dim}${message}${colors.reset}
|
|
171058
|
+
`);
|
|
171059
|
+
}, guardBrokenPipe = () => {
|
|
170967
171060
|
process.stdout.on("error", (error) => {
|
|
170968
171061
|
if (error instanceof Error && "code" in error && error.code === "EPIPE") {
|
|
170969
171062
|
process.exit(0);
|
|
170970
171063
|
}
|
|
170971
171064
|
});
|
|
170972
|
-
|
|
170973
|
-
|
|
170974
|
-
const
|
|
170975
|
-
if (!
|
|
170976
|
-
|
|
171065
|
+
}, runLs = async (args) => {
|
|
171066
|
+
guardBrokenPipe();
|
|
171067
|
+
const raw = await loadRawConfigSafe(parseFlagValue(args, "--config"));
|
|
171068
|
+
if (!raw) {
|
|
171069
|
+
printDim("Could not load absolute.config.ts \u2014 run `absolute ls` from your project root.");
|
|
170977
171070
|
return;
|
|
170978
171071
|
}
|
|
170979
|
-
const
|
|
170980
|
-
|
|
170981
|
-
|
|
170982
|
-
|
|
171072
|
+
const candidates = configCandidates(raw);
|
|
171073
|
+
const specs = candidates.flatMap((candidate) => specsFor(candidate.source, candidate.baseDir));
|
|
171074
|
+
const scanned = (await Promise.all(specs.map(scanFramework))).flatMap((group) => group ? [group] : []);
|
|
171075
|
+
const groups = mergeByLabel(scanned);
|
|
171076
|
+
if (groups.length === 0) {
|
|
171077
|
+
printDim("No pages found. Check the framework directories in absolute.config.ts.");
|
|
170983
171078
|
return;
|
|
170984
171079
|
}
|
|
170985
|
-
|
|
170986
|
-
|
|
170987
|
-
|
|
171080
|
+
const wantsJson = args.includes("--json");
|
|
171081
|
+
if (!args.includes("--sizes")) {
|
|
171082
|
+
emit(groups, false, null, wantsJson);
|
|
171083
|
+
return;
|
|
171084
|
+
}
|
|
171085
|
+
const sizesDir = resolveSizesDir(args, candidates);
|
|
171086
|
+
const manifestPath = join11(sizesDir, "manifest.json");
|
|
171087
|
+
if (!existsSync11(manifestPath)) {
|
|
171088
|
+
printDim(`No build at ${relativeOrSelf(manifestPath)}. Run \`absolute build\` first, or pass \`--outdir <dir>\`.`);
|
|
170988
171089
|
return;
|
|
170989
171090
|
}
|
|
170990
|
-
|
|
171091
|
+
const sized = withSizes(groups, pageSizer(readManifestSizes(sizesDir)));
|
|
171092
|
+
const note = `${relativeOrSelf(manifestPath)} \xB7 built ${manifestAge(manifestPath)} ago`;
|
|
171093
|
+
emit(sized, true, note, wantsJson);
|
|
170991
171094
|
};
|
|
170992
171095
|
var init_ls = __esm(() => {
|
|
171096
|
+
init_scanConventions();
|
|
170993
171097
|
init_constants();
|
|
171098
|
+
init_getDurationString();
|
|
170994
171099
|
init_loadConfig();
|
|
170995
171100
|
init_tuiPrimitives();
|
|
170996
|
-
|
|
170997
|
-
|
|
170998
|
-
"
|
|
170999
|
-
"
|
|
171000
|
-
"
|
|
171001
|
-
"
|
|
171002
|
-
"
|
|
171101
|
+
LABEL_ORDER = ["React", "Vue", "Svelte", "Angular", "HTML", "HTMX"];
|
|
171102
|
+
ARTIFACT_SUFFIXES = [
|
|
171103
|
+
"",
|
|
171104
|
+
"Page",
|
|
171105
|
+
"Index",
|
|
171106
|
+
"Client",
|
|
171107
|
+
"BundledCSS",
|
|
171108
|
+
"CompiledCSS",
|
|
171109
|
+
"CSS"
|
|
171003
171110
|
];
|
|
171004
|
-
|
|
171005
|
-
"
|
|
171006
|
-
"vue",
|
|
171007
|
-
"svelte",
|
|
171008
|
-
"
|
|
171009
|
-
"html",
|
|
171010
|
-
"
|
|
171011
|
-
"shared"
|
|
171012
|
-
];
|
|
171013
|
-
FRAMEWORK_LABELS = {
|
|
171014
|
-
angular: "Angular",
|
|
171015
|
-
html: "HTML",
|
|
171016
|
-
htmx: "HTMX",
|
|
171017
|
-
react: "React",
|
|
171018
|
-
shared: "Shared",
|
|
171019
|
-
svelte: "Svelte",
|
|
171020
|
-
vue: "Vue"
|
|
171021
|
-
};
|
|
171022
|
-
KIND_LABELS = {
|
|
171023
|
-
chunk: "chunk",
|
|
171024
|
-
client: "client",
|
|
171025
|
-
css: "css",
|
|
171026
|
-
index: "index",
|
|
171027
|
-
island: "island",
|
|
171028
|
-
page: "page",
|
|
171029
|
-
script: "script"
|
|
171030
|
-
};
|
|
171031
|
-
KIND_RANK = {
|
|
171032
|
-
chunk: 6,
|
|
171033
|
-
client: 2,
|
|
171034
|
-
css: 4,
|
|
171035
|
-
index: 1,
|
|
171036
|
-
island: 3,
|
|
171037
|
-
page: 0,
|
|
171038
|
-
script: 5
|
|
171039
|
-
};
|
|
171040
|
-
KIND_RULES = [
|
|
171041
|
-
{ kind: "chunk", matches: (probe) => probe.id.startsWith("Chunk") },
|
|
171042
|
-
{ kind: "css", matches: (probe) => probe.path.endsWith(".css") },
|
|
171043
|
-
{ kind: "page", matches: (probe) => probe.path.endsWith(".html") },
|
|
171044
|
-
{ kind: "island", matches: (probe) => probe.id.startsWith("Island") },
|
|
171045
|
-
{ kind: "index", matches: (probe) => probe.id.endsWith("Index") },
|
|
171046
|
-
{ kind: "client", matches: (probe) => probe.id.endsWith("Client") },
|
|
171047
|
-
{ kind: "page", matches: (probe) => probe.path.includes("/server/") },
|
|
171048
|
-
{ kind: "script", matches: (probe) => probe.path.includes("/scripts/") }
|
|
171111
|
+
FRAMEWORK_FIELDS = [
|
|
171112
|
+
{ field: "reactDirectory", label: "React", pattern: "*.tsx" },
|
|
171113
|
+
{ field: "vueDirectory", label: "Vue", pattern: "*.vue" },
|
|
171114
|
+
{ field: "svelteDirectory", label: "Svelte", pattern: "*.svelte" },
|
|
171115
|
+
{ field: "angularDirectory", label: "Angular", pattern: "**/*.ts" },
|
|
171116
|
+
{ field: "htmlDirectory", label: "HTML", pattern: "*.html" },
|
|
171117
|
+
{ field: "htmxDirectory", label: "HTMX", pattern: "*.html" }
|
|
171049
171118
|
];
|
|
171050
171119
|
});
|
|
171051
171120
|
|
|
@@ -171768,8 +171837,8 @@ var init_ps = __esm(() => {
|
|
|
171768
171837
|
});
|
|
171769
171838
|
|
|
171770
171839
|
// src/build/externalAssetPlugin.ts
|
|
171771
|
-
import { copyFileSync as copyFileSync2, existsSync as
|
|
171772
|
-
import { basename as
|
|
171840
|
+
import { copyFileSync as copyFileSync2, existsSync as existsSync12, mkdirSync as mkdirSync7, statSync as statSync2 } from "fs";
|
|
171841
|
+
import { basename as basename6, dirname as dirname4, join as join12, resolve as resolve11 } from "path";
|
|
171773
171842
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
171774
171843
|
name: "absolute-external-asset",
|
|
171775
171844
|
setup(bld) {
|
|
@@ -171790,12 +171859,12 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
171790
171859
|
if (!relPath)
|
|
171791
171860
|
continue;
|
|
171792
171861
|
const assetPath = resolve11(sourceDir, relPath);
|
|
171793
|
-
if (!
|
|
171862
|
+
if (!existsSync12(assetPath))
|
|
171794
171863
|
continue;
|
|
171795
171864
|
if (!statSync2(assetPath).isFile())
|
|
171796
171865
|
continue;
|
|
171797
|
-
const targetPath = join12(outDir,
|
|
171798
|
-
if (
|
|
171866
|
+
const targetPath = join12(outDir, basename6(assetPath));
|
|
171867
|
+
if (existsSync12(targetPath))
|
|
171799
171868
|
continue;
|
|
171800
171869
|
mkdirSync7(dirname4(targetPath), { recursive: true });
|
|
171801
171870
|
copyFileSync2(assetPath, targetPath);
|
|
@@ -171815,7 +171884,7 @@ __export(exports_compile, {
|
|
|
171815
171884
|
var {env: env3 } = globalThis.Bun;
|
|
171816
171885
|
import {
|
|
171817
171886
|
cpSync,
|
|
171818
|
-
existsSync as
|
|
171887
|
+
existsSync as existsSync13,
|
|
171819
171888
|
mkdirSync as mkdirSync8,
|
|
171820
171889
|
readdirSync as readdirSync3,
|
|
171821
171890
|
readFileSync as readFileSync14,
|
|
@@ -171824,7 +171893,7 @@ import {
|
|
|
171824
171893
|
unlinkSync as unlinkSync4,
|
|
171825
171894
|
writeFileSync as writeFileSync5
|
|
171826
171895
|
} from "fs";
|
|
171827
|
-
import { basename as
|
|
171896
|
+
import { basename as basename7, dirname as dirname5, join as join13, relative as relative3, resolve as resolve12 } from "path";
|
|
171828
171897
|
var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[cli]\x1B[0m ${color}${message}\x1B[0m`, compileBanner = (version2) => {
|
|
171829
171898
|
const resolvedVersion = version2 || "unknown";
|
|
171830
171899
|
console.log("");
|
|
@@ -171872,7 +171941,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
171872
171941
|
const normalizedOutdir = resolve12(outdir);
|
|
171873
171942
|
const copyReference = (filePath, relPath) => {
|
|
171874
171943
|
const assetSource = resolve12(dirname5(filePath), relPath);
|
|
171875
|
-
if (!
|
|
171944
|
+
if (!existsSync13(assetSource) || !statSync3(assetSource).isFile())
|
|
171876
171945
|
return;
|
|
171877
171946
|
const assetTarget = resolve12(normalizedOutdir, relPath.replace(/^\.\//, ""));
|
|
171878
171947
|
if (assetTarget !== normalizedOutdir && !assetTarget.startsWith(`${normalizedOutdir}/`))
|
|
@@ -171956,7 +172025,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
171956
172025
|
resolve12(import.meta.dir, "..", "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
171957
172026
|
];
|
|
171958
172027
|
for (const candidate of candidates) {
|
|
171959
|
-
if (
|
|
172028
|
+
if (existsSync13(candidate))
|
|
171960
172029
|
return candidate;
|
|
171961
172030
|
}
|
|
171962
172031
|
return resolve12(import.meta.dir, "..", "..", "react", "jsxDevRuntimeCompat.js");
|
|
@@ -171987,13 +172056,13 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
171987
172056
|
const destDir = join13(outdir, "node_modules", ...specifier.split("/"));
|
|
171988
172057
|
rmSync4(destDir, { force: true, recursive: true });
|
|
171989
172058
|
cpSync(srcDir, destDir, {
|
|
172059
|
+
force: true,
|
|
172060
|
+
recursive: true,
|
|
171990
172061
|
filter(source) {
|
|
171991
172062
|
const rel = relative3(srcDir, source);
|
|
171992
172063
|
const [firstSegment] = rel.split(/[\\/]/);
|
|
171993
172064
|
return firstSegment !== "node_modules" && firstSegment !== ".git";
|
|
171994
|
-
}
|
|
171995
|
-
force: true,
|
|
171996
|
-
recursive: true
|
|
172065
|
+
}
|
|
171997
172066
|
});
|
|
171998
172067
|
const deps = {
|
|
171999
172068
|
...pkg.dependencies ?? {},
|
|
@@ -172007,7 +172076,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
172007
172076
|
if (!buildConfig.angularDirectory)
|
|
172008
172077
|
return;
|
|
172009
172078
|
const angularScopeDir = resolve12(process.cwd(), "node_modules", "@angular");
|
|
172010
|
-
const angularPackages =
|
|
172079
|
+
const angularPackages = existsSync13(angularScopeDir) ? readdirSync3(angularScopeDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).filter((entry) => entry.name !== "compiler-cli").map((entry) => `@angular/${entry.name}`) : [];
|
|
172011
172080
|
const roots = new Set([...angularPackages, "rxjs", "tslib", "typescript"]);
|
|
172012
172081
|
const seen = new Set;
|
|
172013
172082
|
for (const specifier of roots) {
|
|
@@ -172025,7 +172094,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
172025
172094
|
copyAngularRuntimePackages(buildConfig, outdir);
|
|
172026
172095
|
}, collectRuntimePackageSpecifiers = (distDir) => {
|
|
172027
172096
|
const nodeModulesDir = join13(distDir, "node_modules");
|
|
172028
|
-
if (!
|
|
172097
|
+
if (!existsSync13(nodeModulesDir))
|
|
172029
172098
|
return [];
|
|
172030
172099
|
const specifiers = [];
|
|
172031
172100
|
for (const entry of readdirSync3(nodeModulesDir, { withFileTypes: true })) {
|
|
@@ -172067,9 +172136,9 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
172067
172136
|
const packageDir = join13(distDir, "node_modules", ...packageSpecifier.split("/"));
|
|
172068
172137
|
const subpath = specifier.slice(packageSpecifier.length);
|
|
172069
172138
|
const subPackageDir = subpath ? join13(packageDir, ...subpath.slice(1).split("/")) : null;
|
|
172070
|
-
const resolvedPackageDir = subPackageDir &&
|
|
172139
|
+
const resolvedPackageDir = subPackageDir && existsSync13(join13(subPackageDir, "package.json")) ? subPackageDir : packageDir;
|
|
172071
172140
|
const packageJsonPath = join13(resolvedPackageDir, "package.json");
|
|
172072
|
-
if (!
|
|
172141
|
+
if (!existsSync13(packageJsonPath))
|
|
172073
172142
|
return null;
|
|
172074
172143
|
const pkg = JSON.parse(readFileSync14(packageJsonPath, "utf-8"));
|
|
172075
172144
|
const exportKey = resolvedPackageDir === subPackageDir ? "." : subpath ? `.${subpath}` : ".";
|
|
@@ -172094,7 +172163,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
172094
172163
|
}, findContainingRuntimePackageDir = (filePath) => {
|
|
172095
172164
|
let dir = dirname5(filePath);
|
|
172096
172165
|
while (dir !== dirname5(dir)) {
|
|
172097
|
-
if (isNodeModulesPath(dir) &&
|
|
172166
|
+
if (isNodeModulesPath(dir) && existsSync13(join13(dir, "package.json"))) {
|
|
172098
172167
|
return dir;
|
|
172099
172168
|
}
|
|
172100
172169
|
dir = dirname5(dir);
|
|
@@ -172152,7 +172221,7 @@ var cliTag4 = (color, message) => `\x1B[2m${formatTimestamp()}\x1B[0m ${color}[c
|
|
|
172152
172221
|
}
|
|
172153
172222
|
}, generateEntrypoint = (distDir, serverEntry, prerenderMap, version2, buildConfig) => {
|
|
172154
172223
|
const allFiles = collectFiles2(distDir);
|
|
172155
|
-
const serverBundleName = `${
|
|
172224
|
+
const serverBundleName = `${basename7(serverEntry).replace(/\.[^.]+$/, "")}.js`;
|
|
172156
172225
|
const embeddedSkip = new Set(["_compile_entrypoint.ts"]);
|
|
172157
172226
|
const assetSkip = new Set([
|
|
172158
172227
|
serverBundleName,
|
|
@@ -172580,21 +172649,31 @@ console.log(\`
|
|
|
172580
172649
|
return;
|
|
172581
172650
|
});
|
|
172582
172651
|
}
|
|
172583
|
-
}), FRAMEWORK_EXTERNALS,
|
|
172584
|
-
|
|
172585
|
-
|
|
172586
|
-
|
|
172587
|
-
|
|
172588
|
-
|
|
172589
|
-
|
|
172590
|
-
|
|
172591
|
-
|
|
172652
|
+
}), FRAMEWORK_EXTERNALS, collectUserServerExternals = (buildConfig) => {
|
|
172653
|
+
const bunBuild = buildConfig.bunBuild;
|
|
172654
|
+
if (!bunBuild)
|
|
172655
|
+
return [];
|
|
172656
|
+
const override = Array.isArray(bunBuild.external) ? bunBuild.external : [];
|
|
172657
|
+
const fromDefault = Array.isArray(bunBuild.default?.external) ? bunBuild.default.external : [];
|
|
172658
|
+
return [...override, ...fromDefault];
|
|
172659
|
+
}, resolveServerBundleExternals = (buildConfig) => [
|
|
172660
|
+
...FRAMEWORK_EXTERNALS.filter((specifier) => {
|
|
172661
|
+
if (buildConfig.reactDirectory && (specifier === "react" || specifier.startsWith("react/") || specifier.startsWith("react-dom")))
|
|
172662
|
+
return false;
|
|
172663
|
+
if (buildConfig.vueDirectory && (specifier === "vue" || specifier.startsWith("vue/") || specifier === "@vue/server-renderer"))
|
|
172664
|
+
return false;
|
|
172665
|
+
if (buildConfig.svelteDirectory && (specifier === "svelte" || specifier.startsWith("svelte/")))
|
|
172666
|
+
return false;
|
|
172667
|
+
return true;
|
|
172668
|
+
}),
|
|
172669
|
+
...collectUserServerExternals(buildConfig)
|
|
172670
|
+
], compile = async (serverEntry, outdir, outfile, configPath2) => {
|
|
172592
172671
|
const resolvedOutdir = resolve12(outdir ?? "dist");
|
|
172593
172672
|
await withBuildDirectoryLock(resolvedOutdir, () => compileUnlocked(serverEntry, resolvedOutdir, outfile, configPath2));
|
|
172594
172673
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
172595
172674
|
const prerenderPort = Number(env3.COMPILE_PORT) || Number(env3.PORT) || DEFAULT_PORT + 1;
|
|
172596
172675
|
killStaleProcesses(prerenderPort);
|
|
172597
|
-
const entryName =
|
|
172676
|
+
const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
|
|
172598
172677
|
const resolvedOutfile = resolve12(outfile ?? "compiled-server");
|
|
172599
172678
|
const absoluteVersion = resolvePackageVersion3([
|
|
172600
172679
|
resolve12(import.meta.dir, "..", "..", "..", "package.json"),
|
|
@@ -172657,11 +172736,11 @@ console.log(\`
|
|
|
172657
172736
|
process.exit(1);
|
|
172658
172737
|
}
|
|
172659
172738
|
const outputPath = resolve12(resolvedOutdir, `${entryName}.js`);
|
|
172660
|
-
if (!
|
|
172739
|
+
if (!existsSync13(outputPath)) {
|
|
172661
172740
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
172662
172741
|
process.exit(1);
|
|
172663
172742
|
}
|
|
172664
|
-
if (
|
|
172743
|
+
if (existsSync13(resolve12(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
172665
172744
|
const vendorDir = resolve12(resolvedOutdir, "angular", "vendor", "server");
|
|
172666
172745
|
const vendorEntries = readdirSync3(vendorDir).filter((f) => f.endsWith(".js"));
|
|
172667
172746
|
const angularServerVendorPaths = {};
|
|
@@ -172732,7 +172811,7 @@ console.log(\`
|
|
|
172732
172811
|
const size = (Bun.file(resolvedOutfile).size / BYTES_PER_MB).toFixed(0);
|
|
172733
172812
|
const totalDuration = getDurationString(performance.now() - totalStart);
|
|
172734
172813
|
console.log(cliTag4("\x1B[32m", `Compiled to ${resolvedOutfile} (${size}MB) in ${totalDuration}`));
|
|
172735
|
-
console.log(cliTag4("\x1B[2m", `Run with: ./${
|
|
172814
|
+
console.log(cliTag4("\x1B[2m", `Run with: ./${basename7(resolvedOutfile)}`));
|
|
172736
172815
|
sendTelemetryEvent("compile:complete", {
|
|
172737
172816
|
durationMs: Math.round(performance.now() - totalStart),
|
|
172738
172817
|
entry: serverEntry,
|
|
@@ -172799,10 +172878,10 @@ __export(exports_typecheck, {
|
|
|
172799
172878
|
typecheck: () => typecheck
|
|
172800
172879
|
});
|
|
172801
172880
|
import { resolve as resolve13, join as join14 } from "path";
|
|
172802
|
-
import { existsSync as
|
|
172881
|
+
import { existsSync as existsSync14, readFileSync as readFileSync15 } from "fs";
|
|
172803
172882
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
172804
172883
|
var isCommandService3 = (service) => service.kind === "command" || Array.isArray(service.command), resolveConfigPath = (configPath2) => resolve13(configPath2 ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts"), getTypecheckTargets = async (configPath2) => {
|
|
172805
|
-
if (!
|
|
172884
|
+
if (!existsSync14(resolveConfigPath(configPath2))) {
|
|
172806
172885
|
return [{}];
|
|
172807
172886
|
}
|
|
172808
172887
|
const rawConfig = await loadRawConfig(configPath2);
|
|
@@ -172823,7 +172902,7 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
172823
172902
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
172824
172903
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
172825
172904
|
const local = resolve13("node_modules", ".bin", name);
|
|
172826
|
-
return
|
|
172905
|
+
return existsSync14(local) ? local : null;
|
|
172827
172906
|
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
172828
172907
|
const cwd = `${process.cwd()}/`;
|
|
172829
172908
|
const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
|
|
@@ -172875,7 +172954,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
172875
172954
|
resolve13(import.meta.dir, "../../types", fileName),
|
|
172876
172955
|
resolve13(import.meta.dir, "../../../types", fileName)
|
|
172877
172956
|
];
|
|
172878
|
-
return candidates.find((candidate) =>
|
|
172957
|
+
return candidates.find((candidate) => existsSync14(candidate)) ?? candidates[0];
|
|
172879
172958
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
172880
172959
|
try {
|
|
172881
172960
|
return JSON.parse(readFileSync15(resolve13("tsconfig.json"), "utf-8"));
|