@absolutejs/absolute 0.19.0-beta.1030 → 0.19.0-beta.1031
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-C44j2A/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-C44j2A/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-C44j2A/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
|
@@ -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");
|
|
@@ -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,
|
|
@@ -172594,7 +172663,7 @@ console.log(\`
|
|
|
172594
172663
|
}, compileUnlocked = async (serverEntry, resolvedOutdir, outfile, configPath2) => {
|
|
172595
172664
|
const prerenderPort = Number(env3.COMPILE_PORT) || Number(env3.PORT) || DEFAULT_PORT + 1;
|
|
172596
172665
|
killStaleProcesses(prerenderPort);
|
|
172597
|
-
const entryName =
|
|
172666
|
+
const entryName = basename7(serverEntry).replace(/\.[^.]+$/, "");
|
|
172598
172667
|
const resolvedOutfile = resolve12(outfile ?? "compiled-server");
|
|
172599
172668
|
const absoluteVersion = resolvePackageVersion3([
|
|
172600
172669
|
resolve12(import.meta.dir, "..", "..", "..", "package.json"),
|
|
@@ -172657,11 +172726,11 @@ console.log(\`
|
|
|
172657
172726
|
process.exit(1);
|
|
172658
172727
|
}
|
|
172659
172728
|
const outputPath = resolve12(resolvedOutdir, `${entryName}.js`);
|
|
172660
|
-
if (!
|
|
172729
|
+
if (!existsSync13(outputPath)) {
|
|
172661
172730
|
console.error(cliTag4("\x1B[31m", `Expected output not found: ${outputPath}`));
|
|
172662
172731
|
process.exit(1);
|
|
172663
172732
|
}
|
|
172664
|
-
if (
|
|
172733
|
+
if (existsSync13(resolve12(resolvedOutdir, "angular", "vendor", "server"))) {
|
|
172665
172734
|
const vendorDir = resolve12(resolvedOutdir, "angular", "vendor", "server");
|
|
172666
172735
|
const vendorEntries = readdirSync3(vendorDir).filter((f) => f.endsWith(".js"));
|
|
172667
172736
|
const angularServerVendorPaths = {};
|
|
@@ -172732,7 +172801,7 @@ console.log(\`
|
|
|
172732
172801
|
const size = (Bun.file(resolvedOutfile).size / BYTES_PER_MB).toFixed(0);
|
|
172733
172802
|
const totalDuration = getDurationString(performance.now() - totalStart);
|
|
172734
172803
|
console.log(cliTag4("\x1B[32m", `Compiled to ${resolvedOutfile} (${size}MB) in ${totalDuration}`));
|
|
172735
|
-
console.log(cliTag4("\x1B[2m", `Run with: ./${
|
|
172804
|
+
console.log(cliTag4("\x1B[2m", `Run with: ./${basename7(resolvedOutfile)}`));
|
|
172736
172805
|
sendTelemetryEvent("compile:complete", {
|
|
172737
172806
|
durationMs: Math.round(performance.now() - totalStart),
|
|
172738
172807
|
entry: serverEntry,
|
|
@@ -172799,10 +172868,10 @@ __export(exports_typecheck, {
|
|
|
172799
172868
|
typecheck: () => typecheck
|
|
172800
172869
|
});
|
|
172801
172870
|
import { resolve as resolve13, join as join14 } from "path";
|
|
172802
|
-
import { existsSync as
|
|
172871
|
+
import { existsSync as existsSync14, readFileSync as readFileSync15 } from "fs";
|
|
172803
172872
|
import { mkdir as mkdir2, writeFile } from "fs/promises";
|
|
172804
172873
|
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 (!
|
|
172874
|
+
if (!existsSync14(resolveConfigPath(configPath2))) {
|
|
172806
172875
|
return [{}];
|
|
172807
172876
|
}
|
|
172808
172877
|
const rawConfig = await loadRawConfig(configPath2);
|
|
@@ -172823,7 +172892,7 @@ var isCommandService3 = (service) => service.kind === "command" || Array.isArray
|
|
|
172823
172892
|
return { exitCode, name, output: (stdout + stderr).trim() };
|
|
172824
172893
|
}, shellEscape = (value) => `'${value.replaceAll("'", "'\\''")}'`, runShell = async (name, command) => run(name, ["/bin/bash", "-lc", command]), findBin = (name) => {
|
|
172825
172894
|
const local = resolve13("node_modules", ".bin", name);
|
|
172826
|
-
return
|
|
172895
|
+
return existsSync14(local) ? local : null;
|
|
172827
172896
|
}, ANSI_COLOR_REGEX, ANSI_PURPLE_REGEX, ANSI_CYAN_REGEX, ANSI_TOKEN_END_REGEX, stripAnsi3 = (str) => str.replace(ANSI_COLOR_REGEX, ""), formatSvelteOutput = (output) => {
|
|
172828
172897
|
const cwd = `${process.cwd()}/`;
|
|
172829
172898
|
const summaryMatch = stripAnsi3(output).match(/svelte-check found (\d+) error/);
|
|
@@ -172875,7 +172944,7 @@ Found ${errorCount} error${suffix}.`;
|
|
|
172875
172944
|
resolve13(import.meta.dir, "../../types", fileName),
|
|
172876
172945
|
resolve13(import.meta.dir, "../../../types", fileName)
|
|
172877
172946
|
];
|
|
172878
|
-
return candidates.find((candidate) =>
|
|
172947
|
+
return candidates.find((candidate) => existsSync14(candidate)) ?? candidates[0];
|
|
172879
172948
|
}, ABSOLUTE_TYPECHECK_FILES, readProjectTsconfig = () => {
|
|
172880
172949
|
try {
|
|
172881
172950
|
return JSON.parse(readFileSync15(resolve13("tsconfig.json"), "utf-8"));
|
package/package.json
CHANGED