@absolutejs/absolute 0.20.0-beta.140 → 0.20.0-beta.143
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/CHANGELOG.md +23 -0
- package/changelog.json +37 -0
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/build.js +887 -704
- package/dist/build.js.map +19 -15
- package/dist/cli/{buildDepVendor-bpac1bhq.js → buildDepVendor-e2zz9x78.js} +5 -4
- package/dist/cli/{dev-4ps2yg1z.js → dev-e4w5nq6y.js} +21 -8
- package/dist/cli/index-6vpdsqa1.js +50 -0
- package/dist/cli/index.js +1 -1
- package/dist/dev/serverBootstrap.js +63 -30
- package/dist/index.js +1050 -853
- package/dist/index.js.map +21 -16
- package/dist/src/build/importFromProject.d.ts +1 -0
- package/dist/src/build/workspacePackages.d.ts +2 -0
- package/dist/src/core/precompressed.d.ts +23 -0
- package/dist/src/dev/hot/plugin.d.ts +5 -0
- package/dist/src/dev/srcPath.d.ts +4 -0
- package/dist/src/plugins/headFallback.d.ts +11 -0
- package/package.json +2 -2
- package/dist/cli/index-65kqn88a.js +0 -8
package/dist/build.js
CHANGED
|
@@ -11676,6 +11676,17 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
11676
11676
|
emberVendorPaths = paths;
|
|
11677
11677
|
};
|
|
11678
11678
|
|
|
11679
|
+
// src/dev/srcPath.ts
|
|
11680
|
+
var UP_SEGMENT = "@up", PARENT_SEGMENT = "..", mapLeading = (path, source, target) => {
|
|
11681
|
+
const segments = path.split("/");
|
|
11682
|
+
let index = 0;
|
|
11683
|
+
while (segments[index] === source) {
|
|
11684
|
+
segments[index] = target;
|
|
11685
|
+
index += 1;
|
|
11686
|
+
}
|
|
11687
|
+
return segments.join("/");
|
|
11688
|
+
}, decodeSrcPath = (srcPath) => mapLeading(srcPath, UP_SEGMENT, PARENT_SEGMENT), encodeSrcPath = (relativePath) => mapLeading(relativePath.replace(/\\/g, "/"), PARENT_SEGMENT, UP_SEGMENT);
|
|
11689
|
+
|
|
11679
11690
|
// src/dev/lazyPages.ts
|
|
11680
11691
|
import { existsSync as existsSync18 } from "fs";
|
|
11681
11692
|
import { basename as basename6, extname as extname7, isAbsolute as isAbsolute3, join as join20, resolve as resolve14 } from "path";
|
|
@@ -11683,7 +11694,7 @@ var PAGE_EXTENSIONS, KEY_SUFFIXES, SRC_URL_PREFIX = "/@src/", isTruthyFlag = (va
|
|
|
11683
11694
|
const extension = PAGE_EXTENSIONS[framework].find((ext) => existsSync18(join20(dir, `${name}${ext}`)));
|
|
11684
11695
|
return extension === undefined ? undefined : toDevPageEntry(framework, join20(dir, `${name}${extension}`));
|
|
11685
11696
|
}, resolveSourcePath = (keyOrPath) => {
|
|
11686
|
-
const stripped = keyOrPath.startsWith(SRC_URL_PREFIX) ? keyOrPath.slice(SRC_URL_PREFIX.length).split("?")[0] ?? "" : keyOrPath;
|
|
11697
|
+
const stripped = keyOrPath.startsWith(SRC_URL_PREFIX) ? decodeSrcPath(keyOrPath.slice(SRC_URL_PREFIX.length).split("?")[0] ?? "") : keyOrPath;
|
|
11687
11698
|
return isAbsolute3(stripped) ? stripped : resolve14(stripped);
|
|
11688
11699
|
}, firstDefined = (candidates, lookup) => {
|
|
11689
11700
|
for (const candidate of candidates) {
|
|
@@ -14090,6 +14101,109 @@ var init_pwa = __esm(() => {
|
|
|
14090
14101
|
init_syncSchema();
|
|
14091
14102
|
});
|
|
14092
14103
|
|
|
14104
|
+
// src/core/precompressed.ts
|
|
14105
|
+
import { readdir as readdir4, readFile as readFile6, stat as stat2, writeFile as writeFile6 } from "fs/promises";
|
|
14106
|
+
import { extname as extname10, join as join30, relative as relative14, resolve as resolve24, sep as sep3 } from "path";
|
|
14107
|
+
import { promisify } from "util";
|
|
14108
|
+
import { brotliCompress, constants, gzip } from "zlib";
|
|
14109
|
+
import { Elysia as Elysia2 } from "elysia";
|
|
14110
|
+
var COMPRESSIBLE_EXTENSIONS, MIN_COMPRESSIBLE_BYTES = 1024, MIN_SAVING_RATIO = 0.9, BROTLI_QUALITY = 9, GZIP_LEVEL = 9, brotliAsync, gzipAsync, ENCODINGS, listFiles = async (directory) => {
|
|
14111
|
+
const entries = await readdir4(directory, { withFileTypes: true }).catch(() => []);
|
|
14112
|
+
const nested = await Promise.all(entries.map((entry) => {
|
|
14113
|
+
const path = join30(directory, entry.name);
|
|
14114
|
+
return entry.isDirectory() ? listFiles(path) : Promise.resolve(entry.isFile() ? [path] : []);
|
|
14115
|
+
}));
|
|
14116
|
+
return nested.flat();
|
|
14117
|
+
}, isCompressible = (path) => COMPRESSIBLE_EXTENSIONS.has(extname10(path).toLowerCase()), acceptedEncodings = (header) => {
|
|
14118
|
+
const accepted = new Set((header ?? "").split(",").map((part) => part.trim().split(";")).filter(([, quality]) => !quality || !/^\s*q=0(\.0*)?\s*$/u.test(quality)).map(([name]) => name?.trim().toLowerCase()));
|
|
14119
|
+
return ENCODINGS.filter(({ encoding }) => accepted.has(encoding));
|
|
14120
|
+
}, assetCacheControl = (pathname) => isFingerprintedAsset(pathname) ? "public, max-age=31536000, immutable" : "public, max-age=0, must-revalidate", createPrecompressedPlugin = async (buildDir) => {
|
|
14121
|
+
const root = resolve24(buildDir);
|
|
14122
|
+
const copies = new Map;
|
|
14123
|
+
for (const path of await listFiles(root)) {
|
|
14124
|
+
const encoding = ENCODINGS.find(({ suffix }) => path.endsWith(suffix));
|
|
14125
|
+
if (!encoding)
|
|
14126
|
+
continue;
|
|
14127
|
+
const original = path.slice(0, -encoding.suffix.length);
|
|
14128
|
+
const pathname = `/${relative14(root, original).split(sep3).join("/")}`;
|
|
14129
|
+
const known = copies.get(pathname) ?? new Set;
|
|
14130
|
+
known.add(encoding.encoding);
|
|
14131
|
+
copies.set(pathname, known);
|
|
14132
|
+
}
|
|
14133
|
+
return new Elysia2({ name: "absolutejs-precompressed" }).request(({ request }) => {
|
|
14134
|
+
if (copies.size === 0)
|
|
14135
|
+
return;
|
|
14136
|
+
if (request.method !== "GET" && request.method !== "HEAD")
|
|
14137
|
+
return;
|
|
14138
|
+
const { pathname } = new URL(request.url);
|
|
14139
|
+
const available = copies.get(decodeURIComponent(pathname));
|
|
14140
|
+
if (!available)
|
|
14141
|
+
return;
|
|
14142
|
+
const chosen = acceptedEncodings(request.headers.get("accept-encoding")).find(({ encoding }) => available.has(encoding));
|
|
14143
|
+
if (!chosen)
|
|
14144
|
+
return;
|
|
14145
|
+
const original = Bun.file(join30(root, pathname));
|
|
14146
|
+
return new Response(Bun.file(`${join30(root, pathname)}${chosen.suffix}`), {
|
|
14147
|
+
headers: {
|
|
14148
|
+
"cache-control": assetCacheControl(pathname),
|
|
14149
|
+
"content-encoding": chosen.encoding,
|
|
14150
|
+
"content-type": original.type,
|
|
14151
|
+
vary: "Accept-Encoding"
|
|
14152
|
+
}
|
|
14153
|
+
});
|
|
14154
|
+
});
|
|
14155
|
+
}, isFingerprintedAsset = (pathname) => {
|
|
14156
|
+
if (pathname.startsWith("/.absolutejs/"))
|
|
14157
|
+
return true;
|
|
14158
|
+
const base = pathname.slice(pathname.lastIndexOf("/") + 1);
|
|
14159
|
+
const hash = base.match(/[.-]([0-9a-z]{6,12})\.[0-9a-z]+$/i)?.[1];
|
|
14160
|
+
return hash ? /[0-9]/.test(hash) && /[a-z]/i.test(hash) : false;
|
|
14161
|
+
}, writePrecompressedAssets = async (buildDir) => {
|
|
14162
|
+
const files = (await listFiles(buildDir)).filter(isCompressible);
|
|
14163
|
+
const written = await Promise.all(files.map(async (path) => {
|
|
14164
|
+
if ((await stat2(path)).size < MIN_COMPRESSIBLE_BYTES)
|
|
14165
|
+
return false;
|
|
14166
|
+
const content = await readFile6(path);
|
|
14167
|
+
const limit = content.byteLength * MIN_SAVING_RATIO;
|
|
14168
|
+
const [brotli, gzipped] = await Promise.all([
|
|
14169
|
+
brotliAsync(content, {
|
|
14170
|
+
params: {
|
|
14171
|
+
[constants.BROTLI_PARAM_QUALITY]: BROTLI_QUALITY,
|
|
14172
|
+
[constants.BROTLI_PARAM_SIZE_HINT]: content.byteLength
|
|
14173
|
+
}
|
|
14174
|
+
}),
|
|
14175
|
+
gzipAsync(content, { level: GZIP_LEVEL })
|
|
14176
|
+
]);
|
|
14177
|
+
if (brotli.byteLength > limit)
|
|
14178
|
+
return false;
|
|
14179
|
+
await Promise.all([
|
|
14180
|
+
writeFile6(`${path}.br`, brotli),
|
|
14181
|
+
writeFile6(`${path}.gz`, gzipped)
|
|
14182
|
+
]);
|
|
14183
|
+
return true;
|
|
14184
|
+
}));
|
|
14185
|
+
return written.filter(Boolean).length;
|
|
14186
|
+
};
|
|
14187
|
+
var init_precompressed = __esm(() => {
|
|
14188
|
+
COMPRESSIBLE_EXTENSIONS = new Set([
|
|
14189
|
+
".css",
|
|
14190
|
+
".html",
|
|
14191
|
+
".js",
|
|
14192
|
+
".json",
|
|
14193
|
+
".mjs",
|
|
14194
|
+
".svg",
|
|
14195
|
+
".txt",
|
|
14196
|
+
".webmanifest",
|
|
14197
|
+
".xml"
|
|
14198
|
+
]);
|
|
14199
|
+
brotliAsync = promisify(brotliCompress);
|
|
14200
|
+
gzipAsync = promisify(gzip);
|
|
14201
|
+
ENCODINGS = [
|
|
14202
|
+
{ encoding: "br", suffix: ".br" },
|
|
14203
|
+
{ encoding: "gzip", suffix: ".gz" }
|
|
14204
|
+
];
|
|
14205
|
+
});
|
|
14206
|
+
|
|
14093
14207
|
// src/dev/angular/hmrImportGenerator.ts
|
|
14094
14208
|
import ts9 from "typescript";
|
|
14095
14209
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
@@ -14793,7 +14907,7 @@ var init_typescript_translator = __esm(() => {
|
|
|
14793
14907
|
|
|
14794
14908
|
// src/dev/angular/fastHmrCompiler.ts
|
|
14795
14909
|
import { existsSync as existsSync23, readFileSync as readFileSync17, statSync as statSync4 } from "fs";
|
|
14796
|
-
import { dirname as dirname16, extname as
|
|
14910
|
+
import { dirname as dirname16, extname as extname11, relative as relative15, resolve as resolve25 } from "path";
|
|
14797
14911
|
import ts12 from "typescript";
|
|
14798
14912
|
var fail = (reason, detail, location) => ({
|
|
14799
14913
|
detail,
|
|
@@ -14905,7 +15019,7 @@ var fail = (reason, detail, location) => ({
|
|
|
14905
15019
|
const decoratorName = findAngularDecoratorName(decorators);
|
|
14906
15020
|
if (!decoratorName)
|
|
14907
15021
|
continue;
|
|
14908
|
-
const projectRel =
|
|
15022
|
+
const projectRel = relative15(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
14909
15023
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
14910
15024
|
if (decoratorName === "Component") {
|
|
14911
15025
|
const componentDecorator = decorators.find((d) => {
|
|
@@ -15106,7 +15220,7 @@ var fail = (reason, detail, location) => ({
|
|
|
15106
15220
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
15107
15221
|
return true;
|
|
15108
15222
|
}
|
|
15109
|
-
const base =
|
|
15223
|
+
const base = resolve25(componentDir, spec);
|
|
15110
15224
|
const candidates = [
|
|
15111
15225
|
`${base}.ts`,
|
|
15112
15226
|
`${base}.tsx`,
|
|
@@ -15922,7 +16036,7 @@ var fail = (reason, detail, location) => ({
|
|
|
15922
16036
|
return null;
|
|
15923
16037
|
}, resolveDtsFromSpec = (spec, fromDir) => {
|
|
15924
16038
|
const stripped = spec.replace(/\.[mc]?js$/, "");
|
|
15925
|
-
const base =
|
|
16039
|
+
const base = resolve25(fromDir, stripped);
|
|
15926
16040
|
const candidates = [
|
|
15927
16041
|
`${base}.d.ts`,
|
|
15928
16042
|
`${base}.d.mts`,
|
|
@@ -15946,7 +16060,7 @@ var fail = (reason, detail, location) => ({
|
|
|
15946
16060
|
return null;
|
|
15947
16061
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
15948
16062
|
if (spec.startsWith(".") || spec.startsWith("/")) {
|
|
15949
|
-
const base =
|
|
16063
|
+
const base = resolve25(componentDir, spec);
|
|
15950
16064
|
const candidates = [
|
|
15951
16065
|
`${base}.ts`,
|
|
15952
16066
|
`${base}.tsx`,
|
|
@@ -16165,13 +16279,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16165
16279
|
}
|
|
16166
16280
|
if (!matches)
|
|
16167
16281
|
continue;
|
|
16168
|
-
const resolved =
|
|
16282
|
+
const resolved = resolve25(componentDir, spec);
|
|
16169
16283
|
for (const ext of TS_EXTENSIONS) {
|
|
16170
16284
|
const candidate = resolved + ext;
|
|
16171
16285
|
if (existsSync23(candidate))
|
|
16172
16286
|
return candidate;
|
|
16173
16287
|
}
|
|
16174
|
-
const indexCandidate =
|
|
16288
|
+
const indexCandidate = resolve25(resolved, "index.ts");
|
|
16175
16289
|
if (existsSync23(indexCandidate))
|
|
16176
16290
|
return indexCandidate;
|
|
16177
16291
|
}
|
|
@@ -16409,10 +16523,10 @@ ${transpiled}
|
|
|
16409
16523
|
}
|
|
16410
16524
|
}${staticPatch}`;
|
|
16411
16525
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
16412
|
-
const abs =
|
|
16526
|
+
const abs = resolve25(componentDir, url);
|
|
16413
16527
|
if (!existsSync23(abs))
|
|
16414
16528
|
return null;
|
|
16415
|
-
const ext =
|
|
16529
|
+
const ext = extname11(abs).toLowerCase();
|
|
16416
16530
|
if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
|
|
16417
16531
|
return readFileSync17(abs, "utf8");
|
|
16418
16532
|
}
|
|
@@ -16448,7 +16562,7 @@ ${block}
|
|
|
16448
16562
|
const cached = projectOptionsCache.get(projectRoot);
|
|
16449
16563
|
if (cached !== undefined)
|
|
16450
16564
|
return cached;
|
|
16451
|
-
const tsconfigPath =
|
|
16565
|
+
const tsconfigPath = resolve25(projectRoot, "tsconfig.json");
|
|
16452
16566
|
const opts = {};
|
|
16453
16567
|
if (existsSync23(tsconfigPath)) {
|
|
16454
16568
|
try {
|
|
@@ -16494,7 +16608,7 @@ ${block}
|
|
|
16494
16608
|
}
|
|
16495
16609
|
const kind = params.kind ?? "component";
|
|
16496
16610
|
if (kind !== "component") {
|
|
16497
|
-
const entityId = encodeURIComponent(`${
|
|
16611
|
+
const entityId = encodeURIComponent(`${relative15(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
|
|
16498
16612
|
const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
|
|
16499
16613
|
const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
|
|
16500
16614
|
if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
|
|
@@ -16532,7 +16646,7 @@ ${block}
|
|
|
16532
16646
|
templateText = decoratorMeta.template;
|
|
16533
16647
|
templatePath = componentFilePath;
|
|
16534
16648
|
} else if (decoratorMeta.templateUrl) {
|
|
16535
|
-
const tplAbs =
|
|
16649
|
+
const tplAbs = resolve25(componentDir, decoratorMeta.templateUrl);
|
|
16536
16650
|
if (!existsSync23(tplAbs)) {
|
|
16537
16651
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
16538
16652
|
}
|
|
@@ -16578,7 +16692,7 @@ ${block}
|
|
|
16578
16692
|
return fail("class-not-found", "anonymous class");
|
|
16579
16693
|
const wrappedClass = new compiler.WrappedNodeExpr(className_);
|
|
16580
16694
|
const { inputs, outputs, hasDecoratorIO, hasSignalIO } = extractInputsAndOutputs(classNode, compiler);
|
|
16581
|
-
const projectRelPath =
|
|
16695
|
+
const projectRelPath = relative15(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
16582
16696
|
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
16583
16697
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
16584
16698
|
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
@@ -16857,7 +16971,7 @@ var init_fastHmrCompiler = __esm(() => {
|
|
|
16857
16971
|
|
|
16858
16972
|
// src/build/scanVueSsrOnlyPages.ts
|
|
16859
16973
|
import { readdirSync as readdirSync3, readFileSync as readFileSync18 } from "fs";
|
|
16860
|
-
import { join as
|
|
16974
|
+
import { join as join31 } from "path";
|
|
16861
16975
|
import ts13 from "typescript";
|
|
16862
16976
|
var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
16863
16977
|
if (filePath.endsWith(".tsx"))
|
|
@@ -16890,9 +17004,9 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
|
16890
17004
|
continue;
|
|
16891
17005
|
if (entry.name.startsWith("."))
|
|
16892
17006
|
continue;
|
|
16893
|
-
stack.push(
|
|
17007
|
+
stack.push(join31(dir, entry.name));
|
|
16894
17008
|
} else if (entry.isFile() && hasSourceExtension2(entry.name)) {
|
|
16895
|
-
out.push(
|
|
17009
|
+
out.push(join31(dir, entry.name));
|
|
16896
17010
|
}
|
|
16897
17011
|
}
|
|
16898
17012
|
}
|
|
@@ -17012,7 +17126,7 @@ var init_scanVueSsrOnlyPages = __esm(() => {
|
|
|
17012
17126
|
|
|
17013
17127
|
// src/build/scanAngularHandlerCalls.ts
|
|
17014
17128
|
import { readdirSync as readdirSync4, readFileSync as readFileSync19 } from "fs";
|
|
17015
|
-
import { join as
|
|
17129
|
+
import { join as join32 } from "path";
|
|
17016
17130
|
import ts14 from "typescript";
|
|
17017
17131
|
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PREFIX = ".absolutejs-hmr-", getScriptKind4 = (filePath) => {
|
|
17018
17132
|
if (filePath.endsWith(".tsx"))
|
|
@@ -17045,9 +17159,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS4, SERVER_ENTRY_COPY_PRE
|
|
|
17045
17159
|
continue;
|
|
17046
17160
|
if (entry.name.startsWith("."))
|
|
17047
17161
|
continue;
|
|
17048
|
-
stack.push(
|
|
17162
|
+
stack.push(join32(dir, entry.name));
|
|
17049
17163
|
} else if (entry.isFile() && !entry.name.startsWith(SERVER_ENTRY_COPY_PREFIX) && hasSourceExtension3(entry.name)) {
|
|
17050
|
-
out.push(
|
|
17164
|
+
out.push(join32(dir, entry.name));
|
|
17051
17165
|
}
|
|
17052
17166
|
}
|
|
17053
17167
|
}
|
|
@@ -17162,7 +17276,7 @@ var init_scanAngularHandlerCalls = __esm(() => {
|
|
|
17162
17276
|
|
|
17163
17277
|
// src/build/scanAngularPageRoutes.ts
|
|
17164
17278
|
import { readdirSync as readdirSync5, readFileSync as readFileSync20 } from "fs";
|
|
17165
|
-
import { basename as basename12, join as
|
|
17279
|
+
import { basename as basename12, join as join33 } from "path";
|
|
17166
17280
|
import ts15 from "typescript";
|
|
17167
17281
|
var SOURCE_EXTENSIONS5, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
17168
17282
|
const idx = filePath.lastIndexOf(".");
|
|
@@ -17202,9 +17316,9 @@ var SOURCE_EXTENSIONS5, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
|
17202
17316
|
continue;
|
|
17203
17317
|
if (entry.name.startsWith("."))
|
|
17204
17318
|
continue;
|
|
17205
|
-
stack.push(
|
|
17319
|
+
stack.push(join33(dir, entry.name));
|
|
17206
17320
|
} else if (entry.isFile() && isPageFile(entry.name)) {
|
|
17207
|
-
out.push(
|
|
17321
|
+
out.push(join33(dir, entry.name));
|
|
17208
17322
|
}
|
|
17209
17323
|
}
|
|
17210
17324
|
}
|
|
@@ -17273,7 +17387,7 @@ var init_runAngularHandlerScan = __esm(() => {
|
|
|
17273
17387
|
|
|
17274
17388
|
// src/build/parseAngularConfigImports.ts
|
|
17275
17389
|
import { existsSync as existsSync24, readFileSync as readFileSync21 } from "fs";
|
|
17276
|
-
import { dirname as dirname17, isAbsolute as isAbsolute6, join as
|
|
17390
|
+
import { dirname as dirname17, isAbsolute as isAbsolute6, join as join34 } from "path";
|
|
17277
17391
|
import ts16 from "typescript";
|
|
17278
17392
|
var findDefineConfigCall = (sf) => {
|
|
17279
17393
|
let result = null;
|
|
@@ -17328,15 +17442,15 @@ var findDefineConfigCall = (sf) => {
|
|
|
17328
17442
|
}, resolveConfigPath = (projectRoot) => {
|
|
17329
17443
|
const envOverride = process.env.ABSOLUTE_CONFIG;
|
|
17330
17444
|
if (envOverride) {
|
|
17331
|
-
const resolved = isAbsolute6(envOverride) ? envOverride :
|
|
17445
|
+
const resolved = isAbsolute6(envOverride) ? envOverride : join34(projectRoot, envOverride);
|
|
17332
17446
|
if (existsSync24(resolved))
|
|
17333
17447
|
return resolved;
|
|
17334
17448
|
}
|
|
17335
17449
|
const candidates = [
|
|
17336
|
-
|
|
17337
|
-
|
|
17338
|
-
|
|
17339
|
-
|
|
17450
|
+
join34(projectRoot, "absolute.config.ts"),
|
|
17451
|
+
join34(projectRoot, "absolute.config.mts"),
|
|
17452
|
+
join34(projectRoot, "absolute.config.js"),
|
|
17453
|
+
join34(projectRoot, "absolute.config.mjs")
|
|
17340
17454
|
];
|
|
17341
17455
|
for (const candidate of candidates) {
|
|
17342
17456
|
if (existsSync24(candidate))
|
|
@@ -17369,7 +17483,7 @@ var findDefineConfigCall = (sf) => {
|
|
|
17369
17483
|
if (!importInfo)
|
|
17370
17484
|
return null;
|
|
17371
17485
|
const configDir = dirname17(configPath);
|
|
17372
|
-
const absolutePath = importInfo.source.startsWith(".") ?
|
|
17486
|
+
const absolutePath = importInfo.source.startsWith(".") ? join34(configDir, importInfo.source).replace(/\.[cm]?[tj]sx?$/, "") : isAbsolute6(importInfo.source) ? importInfo.source.replace(/\.[cm]?[tj]sx?$/, "") : importInfo.source;
|
|
17373
17487
|
return {
|
|
17374
17488
|
absolutePath,
|
|
17375
17489
|
bindingName: binding,
|
|
@@ -17508,28 +17622,28 @@ var init_renderToReadableStream = __esm(() => {
|
|
|
17508
17622
|
|
|
17509
17623
|
// src/build/compileSvelte.ts
|
|
17510
17624
|
import { existsSync as existsSync25 } from "fs";
|
|
17511
|
-
import { mkdir as mkdir6, stat as
|
|
17625
|
+
import { mkdir as mkdir6, stat as stat3 } from "fs/promises";
|
|
17512
17626
|
import {
|
|
17513
17627
|
dirname as dirname18,
|
|
17514
|
-
join as
|
|
17628
|
+
join as join35,
|
|
17515
17629
|
basename as basename13,
|
|
17516
|
-
extname as
|
|
17517
|
-
resolve as
|
|
17518
|
-
relative as
|
|
17519
|
-
sep as
|
|
17630
|
+
extname as extname12,
|
|
17631
|
+
resolve as resolve26,
|
|
17632
|
+
relative as relative16,
|
|
17633
|
+
sep as sep4
|
|
17520
17634
|
} from "path";
|
|
17521
17635
|
import { env } from "process";
|
|
17522
17636
|
var {write: write2, file, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
17523
17637
|
var resolveDevClientDir2 = () => {
|
|
17524
17638
|
const projectRoot = process.cwd();
|
|
17525
|
-
const fromSource =
|
|
17639
|
+
const fromSource = resolve26(import.meta.dir, "../dev/client");
|
|
17526
17640
|
if (existsSync25(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
17527
17641
|
return fromSource;
|
|
17528
17642
|
}
|
|
17529
|
-
const fromNodeModules =
|
|
17643
|
+
const fromNodeModules = resolve26(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
17530
17644
|
if (existsSync25(fromNodeModules))
|
|
17531
17645
|
return fromNodeModules;
|
|
17532
|
-
return
|
|
17646
|
+
return resolve26(import.meta.dir, "./dev/client");
|
|
17533
17647
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, transpiler3, removeUnusedRequireHelper = (code) => {
|
|
17534
17648
|
const helperStart = code.indexOf("var __require = /* @__PURE__ */");
|
|
17535
17649
|
if (helperStart === -1) {
|
|
@@ -17548,7 +17662,7 @@ var resolveDevClientDir2 = () => {
|
|
|
17548
17662
|
return /\b__require\b/.test(stripped) ? code : stripped;
|
|
17549
17663
|
}, exists = async (path) => {
|
|
17550
17664
|
try {
|
|
17551
|
-
await
|
|
17665
|
+
await stat3(path);
|
|
17552
17666
|
return true;
|
|
17553
17667
|
} catch {
|
|
17554
17668
|
return false;
|
|
@@ -17556,7 +17670,7 @@ var resolveDevClientDir2 = () => {
|
|
|
17556
17670
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
17557
17671
|
if (!spec.startsWith("."))
|
|
17558
17672
|
return null;
|
|
17559
|
-
const basePath =
|
|
17673
|
+
const basePath = resolve26(dirname18(from), spec);
|
|
17560
17674
|
const candidates = [
|
|
17561
17675
|
basePath,
|
|
17562
17676
|
`${basePath}.ts`,
|
|
@@ -17567,14 +17681,14 @@ var resolveDevClientDir2 = () => {
|
|
|
17567
17681
|
`${basePath}.svelte`,
|
|
17568
17682
|
`${basePath}.svelte.ts`,
|
|
17569
17683
|
`${basePath}.svelte.js`,
|
|
17570
|
-
|
|
17571
|
-
|
|
17572
|
-
|
|
17573
|
-
|
|
17574
|
-
|
|
17575
|
-
|
|
17576
|
-
|
|
17577
|
-
|
|
17684
|
+
join35(basePath, "index.ts"),
|
|
17685
|
+
join35(basePath, "index.js"),
|
|
17686
|
+
join35(basePath, "index.mjs"),
|
|
17687
|
+
join35(basePath, "index.cjs"),
|
|
17688
|
+
join35(basePath, "index.json"),
|
|
17689
|
+
join35(basePath, "index.svelte"),
|
|
17690
|
+
join35(basePath, "index.svelte.ts"),
|
|
17691
|
+
join35(basePath, "index.svelte.js")
|
|
17578
17692
|
];
|
|
17579
17693
|
const checks = await Promise.all(candidates.map(exists));
|
|
17580
17694
|
return candidates.find((_, index) => checks[index]) ?? null;
|
|
@@ -17583,7 +17697,7 @@ var resolveDevClientDir2 = () => {
|
|
|
17583
17697
|
const resolved = resolvePackageImport(spec);
|
|
17584
17698
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
17585
17699
|
}
|
|
17586
|
-
const basePath =
|
|
17700
|
+
const basePath = resolve26(dirname18(from), spec);
|
|
17587
17701
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
17588
17702
|
if (!explicit) {
|
|
17589
17703
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -17604,8 +17718,8 @@ var resolveDevClientDir2 = () => {
|
|
|
17604
17718
|
return jsPath;
|
|
17605
17719
|
return null;
|
|
17606
17720
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
17607
|
-
const toServer =
|
|
17608
|
-
const toClient =
|
|
17721
|
+
const toServer = relative16(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
17722
|
+
const toClient = relative16(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
17609
17723
|
rewrites.set(rawSpec, {
|
|
17610
17724
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
17611
17725
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -17613,9 +17727,9 @@ var resolveDevClientDir2 = () => {
|
|
|
17613
17727
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
|
|
17614
17728
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
17615
17729
|
const generatedDir = getFrameworkGeneratedDir("svelte");
|
|
17616
|
-
const clientDir =
|
|
17617
|
-
const indexDir =
|
|
17618
|
-
const serverDir =
|
|
17730
|
+
const clientDir = join35(generatedDir, "client");
|
|
17731
|
+
const indexDir = join35(generatedDir, "indexes");
|
|
17732
|
+
const serverDir = join35(generatedDir, "server");
|
|
17619
17733
|
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir6(dir, { recursive: true })));
|
|
17620
17734
|
const dev = env.NODE_ENV !== "production";
|
|
17621
17735
|
const build = async (src) => {
|
|
@@ -17643,8 +17757,8 @@ var resolveDevClientDir2 = () => {
|
|
|
17643
17757
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
17644
17758
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
|
|
17645
17759
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
|
|
17646
|
-
const rawRel = dirname18(
|
|
17647
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
17760
|
+
const rawRel = dirname18(relative16(svelteRoot, src)).replace(/\\/g, "/");
|
|
17761
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative16(process.cwd(), dirname18(src)).replace(/\\/g, "/")}` : rawRel;
|
|
17648
17762
|
const baseName = basename13(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
17649
17763
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
17650
17764
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -17653,8 +17767,8 @@ var resolveDevClientDir2 = () => {
|
|
|
17653
17767
|
const childBuilt = await Promise.all(childSources.map((child) => build(child)));
|
|
17654
17768
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
17655
17769
|
const externalRewrites = new Map;
|
|
17656
|
-
const ssrOutputDir = dirname18(
|
|
17657
|
-
const clientOutputDir = dirname18(
|
|
17770
|
+
const ssrOutputDir = dirname18(join35(serverDir, relDir, `${baseName}.js`));
|
|
17771
|
+
const clientOutputDir = dirname18(join35(clientDir, relDir, `${baseName}.js`));
|
|
17658
17772
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
17659
17773
|
const rawSpec = importPaths[idx];
|
|
17660
17774
|
if (!rawSpec)
|
|
@@ -17665,15 +17779,15 @@ var resolveDevClientDir2 = () => {
|
|
|
17665
17779
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
17666
17780
|
if (!resolved)
|
|
17667
17781
|
continue;
|
|
17668
|
-
const childRel =
|
|
17782
|
+
const childRel = relative16(svelteRoot, resolved).replace(/\\/g, "/");
|
|
17669
17783
|
if (!childRel.startsWith(".."))
|
|
17670
17784
|
continue;
|
|
17671
17785
|
const childBuilt = cache.get(resolved);
|
|
17672
17786
|
if (!childBuilt)
|
|
17673
17787
|
continue;
|
|
17674
17788
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
17675
|
-
const toServer =
|
|
17676
|
-
const toClient =
|
|
17789
|
+
const toServer = relative16(ssrOutputDir, childBuilt.ssr).replace(/\\/g, "/");
|
|
17790
|
+
const toClient = relative16(clientOutputDir, childBuilt.client).replace(/\\/g, "/");
|
|
17677
17791
|
externalRewrites.set(origSpec, {
|
|
17678
17792
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
17679
17793
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -17707,7 +17821,7 @@ var resolveDevClientDir2 = () => {
|
|
|
17707
17821
|
}).js;
|
|
17708
17822
|
let code = compiledJs.code.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
17709
17823
|
if (mode === "client" && isDev) {
|
|
17710
|
-
const moduleKey = `/@src/${
|
|
17824
|
+
const moduleKey = `/@src/${relative16(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
17711
17825
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
17712
17826
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
17713
17827
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -17719,8 +17833,8 @@ var resolveDevClientDir2 = () => {
|
|
|
17719
17833
|
code += islandMetadataExports;
|
|
17720
17834
|
return { code, map: compiledJs.map };
|
|
17721
17835
|
};
|
|
17722
|
-
const ssrPath =
|
|
17723
|
-
const clientPath =
|
|
17836
|
+
const ssrPath = join35(serverDir, relDir, `${baseName}.js`);
|
|
17837
|
+
const clientPath = join35(clientDir, relDir, `${baseName}.js`);
|
|
17724
17838
|
await Promise.all([
|
|
17725
17839
|
mkdir6(dirname18(ssrPath), { recursive: true }),
|
|
17726
17840
|
mkdir6(dirname18(clientPath), { recursive: true })
|
|
@@ -17758,10 +17872,10 @@ var resolveDevClientDir2 = () => {
|
|
|
17758
17872
|
const roots = await Promise.all(entryPoints.map(build));
|
|
17759
17873
|
const componentRoots = roots.filter((root) => !root.isModule);
|
|
17760
17874
|
await Promise.all(componentRoots.map(async ({ client, hasAwaitSlot }) => {
|
|
17761
|
-
const relClientDir = dirname18(
|
|
17762
|
-
const name = basename13(client,
|
|
17763
|
-
const indexPath =
|
|
17764
|
-
const importRaw =
|
|
17875
|
+
const relClientDir = dirname18(relative16(clientDir, client));
|
|
17876
|
+
const name = basename13(client, extname12(client));
|
|
17877
|
+
const indexPath = join35(indexDir, relClientDir, `${name}.js`);
|
|
17878
|
+
const importRaw = relative16(dirname18(indexPath), client).split(sep4).join("/");
|
|
17765
17879
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
17766
17880
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
17767
17881
|
import "${hmrClientPath3}";
|
|
@@ -17862,8 +17976,8 @@ if (typeof window !== "undefined") {
|
|
|
17862
17976
|
return {
|
|
17863
17977
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
17864
17978
|
svelteIndexPaths: componentRoots.map(({ client }) => {
|
|
17865
|
-
const rel = dirname18(
|
|
17866
|
-
return
|
|
17979
|
+
const rel = dirname18(relative16(clientDir, client));
|
|
17980
|
+
return join35(indexDir, rel, basename13(client));
|
|
17867
17981
|
}),
|
|
17868
17982
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
17869
17983
|
};
|
|
@@ -17878,7 +17992,7 @@ var init_compileSvelte = __esm(() => {
|
|
|
17878
17992
|
init_lowerAwaitSlotSyntax();
|
|
17879
17993
|
init_renderToReadableStream();
|
|
17880
17994
|
devClientDir2 = resolveDevClientDir2();
|
|
17881
|
-
hmrClientPath3 =
|
|
17995
|
+
hmrClientPath3 = join35(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
17882
17996
|
persistentCache = new Map;
|
|
17883
17997
|
sourceHashCache = new Map;
|
|
17884
17998
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
@@ -18368,8 +18482,8 @@ var init_chainInlineSourcemaps = __esm(() => {
|
|
|
18368
18482
|
// src/build/vueCompileCache.ts
|
|
18369
18483
|
import { createHash as createHash3 } from "crypto";
|
|
18370
18484
|
import { existsSync as existsSync26, readFileSync as readFileSync23 } from "fs";
|
|
18371
|
-
import { mkdir as mkdir7, rename, writeFile as
|
|
18372
|
-
import { join as
|
|
18485
|
+
import { mkdir as mkdir7, rename, writeFile as writeFile7 } from "fs/promises";
|
|
18486
|
+
import { join as join36, resolve as resolve27 } from "path";
|
|
18373
18487
|
var CACHE_DIR_NAME = "compile-cache", ABSOLUTE_CACHE_DIR_NAME2 = ".absolutejs", CACHE_FORMAT_VERSION = 2, FILE_NAME_HASH_LENGTH = 32, vueCompileCacheEnabled = () => process.env.ABSOLUTE_COMPILE_CACHE !== "0", hashContent = (content) => createHash3("sha256").update(content).digest("hex"), hashParts = (parts) => {
|
|
18374
18488
|
const hash = createHash3("sha256");
|
|
18375
18489
|
for (const part of parts) {
|
|
@@ -18379,8 +18493,8 @@ var CACHE_DIR_NAME = "compile-cache", ABSOLUTE_CACHE_DIR_NAME2 = ".absolutejs",
|
|
|
18379
18493
|
return hash.digest("hex");
|
|
18380
18494
|
}, readOwnPackageVersion = () => {
|
|
18381
18495
|
const candidates = [
|
|
18382
|
-
|
|
18383
|
-
|
|
18496
|
+
resolve27(import.meta.dir, "..", "..", "package.json"),
|
|
18497
|
+
resolve27(import.meta.dir, "..", "package.json")
|
|
18384
18498
|
];
|
|
18385
18499
|
for (const candidate of candidates) {
|
|
18386
18500
|
try {
|
|
@@ -18395,7 +18509,7 @@ var CACHE_DIR_NAME = "compile-cache", ABSOLUTE_CACHE_DIR_NAME2 = ".absolutejs",
|
|
|
18395
18509
|
}, cachedFrameworkVersion, frameworkVersionForCache = () => {
|
|
18396
18510
|
cachedFrameworkVersion ??= readOwnPackageVersion();
|
|
18397
18511
|
return cachedFrameworkVersion;
|
|
18398
|
-
}, vueCompileCacheDir = (projectRoot = process.cwd()) =>
|
|
18512
|
+
}, vueCompileCacheDir = (projectRoot = process.cwd()) => join36(projectRoot, ABSOLUTE_CACHE_DIR_NAME2, CACHE_DIR_NAME, "vue"), entryFileFor = (sourceFilePath, projectRoot) => join36(vueCompileCacheDir(projectRoot), `${hashContent(sourceFilePath).slice(0, FILE_NAME_HASH_LENGTH)}.json`), vueCompileCacheFingerprint = (parts) => {
|
|
18399
18513
|
const frameworkVersion = frameworkVersionForCache();
|
|
18400
18514
|
if (!frameworkVersion)
|
|
18401
18515
|
return null;
|
|
@@ -18447,7 +18561,7 @@ var CACHE_DIR_NAME = "compile-cache", ABSOLUTE_CACHE_DIR_NAME2 = ".absolutejs",
|
|
|
18447
18561
|
try {
|
|
18448
18562
|
await mkdir7(vueCompileCacheDir(projectRoot), { recursive: true });
|
|
18449
18563
|
const tempFile = `${entryFile}.${process.pid}.tmp`;
|
|
18450
|
-
await
|
|
18564
|
+
await writeFile7(tempFile, JSON.stringify(entry));
|
|
18451
18565
|
await rename(tempFile, entryFile);
|
|
18452
18566
|
} catch {}
|
|
18453
18567
|
};
|
|
@@ -18460,9 +18574,9 @@ __export(exports_emitTsHelpers, {
|
|
|
18460
18574
|
});
|
|
18461
18575
|
var {file: file2, Transpiler: Transpiler3, write: write3 } = globalThis.Bun;
|
|
18462
18576
|
import { copyFileSync as copyFileSync2, existsSync as existsSync27, readdirSync as readdirSync6 } from "fs";
|
|
18463
|
-
import { mkdir as mkdir8, rename as rename2, writeFile as
|
|
18464
|
-
import { dirname as dirname19, join as
|
|
18465
|
-
var CACHE_DIR_NAME2 = "vue-helpers", CACHE_FORMAT_VERSION2 = 1, HASH_LENGTH = 24, transpiler4, cacheDir = () =>
|
|
18577
|
+
import { mkdir as mkdir8, rename as rename2, writeFile as writeFile8 } from "fs/promises";
|
|
18578
|
+
import { dirname as dirname19, join as join37 } from "path";
|
|
18579
|
+
var CACHE_DIR_NAME2 = "vue-helpers", CACHE_FORMAT_VERSION2 = 1, HASH_LENGTH = 24, transpiler4, cacheDir = () => join37(process.cwd(), ".absolutejs", "compile-cache", CACHE_DIR_NAME2), cacheKey2 = (sourcePath, sourceCode) => {
|
|
18466
18580
|
const frameworkVersion = frameworkVersionForCache();
|
|
18467
18581
|
if (!frameworkVersion || !vueCompileCacheEnabled())
|
|
18468
18582
|
return null;
|
|
@@ -18495,13 +18609,13 @@ var CACHE_DIR_NAME2 = "vue-helpers", CACHE_FORMAT_VERSION2 = 1, HASH_LENGTH = 24
|
|
|
18495
18609
|
}, publishCacheEntry = async (directory, fileName, pathHash, content) => {
|
|
18496
18610
|
try {
|
|
18497
18611
|
await mkdir8(directory, { recursive: true });
|
|
18498
|
-
const target =
|
|
18612
|
+
const target = join37(directory, fileName);
|
|
18499
18613
|
const temporary = `${target}.${process.pid}.tmp`;
|
|
18500
|
-
await
|
|
18614
|
+
await writeFile8(temporary, content);
|
|
18501
18615
|
await rename2(temporary, target);
|
|
18502
18616
|
const superseded = entriesForPath(directory, pathHash).filter((name) => name !== fileName);
|
|
18503
18617
|
existingEntries?.set(pathHash, [fileName]);
|
|
18504
|
-
await Promise.all(superseded.map((name) => Bun.file(
|
|
18618
|
+
await Promise.all(superseded.map((name) => Bun.file(join37(directory, name)).delete().catch(() => {
|
|
18505
18619
|
return;
|
|
18506
18620
|
})));
|
|
18507
18621
|
} catch {}
|
|
@@ -18530,7 +18644,7 @@ var CACHE_DIR_NAME2 = "vue-helpers", CACHE_FORMAT_VERSION2 = 1, HASH_LENGTH = 24
|
|
|
18530
18644
|
const key = cacheKey2(sourcePath, sourceCode);
|
|
18531
18645
|
const directory = cacheDir();
|
|
18532
18646
|
const fileName = key ? `${key.path}-${key.content}.js` : null;
|
|
18533
|
-
const cachedPath = fileName ?
|
|
18647
|
+
const cachedPath = fileName ? join37(directory, fileName) : null;
|
|
18534
18648
|
if (cachedPath && existsSync27(cachedPath)) {
|
|
18535
18649
|
await copyBoth(clientOutputPath, serverOutputPath, cachedPath);
|
|
18536
18650
|
return;
|
|
@@ -18555,7 +18669,7 @@ var init_emitTsHelpers = __esm(() => {
|
|
|
18555
18669
|
|
|
18556
18670
|
// src/build/compileVueSfc.ts
|
|
18557
18671
|
import { existsSync as existsSync28, readFileSync as readFileSync24, realpathSync as realpathSync2 } from "fs";
|
|
18558
|
-
import { dirname as dirname20, relative as
|
|
18672
|
+
import { dirname as dirname20, relative as relative17, resolve as resolve28 } from "path";
|
|
18559
18673
|
var {Transpiler: Transpiler4 } = globalThis.Bun;
|
|
18560
18674
|
var transpiler5, inlineCssImports = (cssContent, cssFilePath, visited = new Set) => {
|
|
18561
18675
|
const resolved = realpathSync2(cssFilePath);
|
|
@@ -18564,7 +18678,7 @@ var transpiler5, inlineCssImports = (cssContent, cssFilePath, visited = new Set)
|
|
|
18564
18678
|
visited.add(resolved);
|
|
18565
18679
|
const importRegex = /@import\s+(?:url\(\s*)?(['"])(\.{1,2}\/[^'"]+)\1\s*\)?\s*;?/g;
|
|
18566
18680
|
return cssContent.replace(importRegex, (match, _quote, relPath) => {
|
|
18567
|
-
const importedPath =
|
|
18681
|
+
const importedPath = resolve28(dirname20(cssFilePath), relPath);
|
|
18568
18682
|
if (!isFile(importedPath))
|
|
18569
18683
|
return match;
|
|
18570
18684
|
const importedContent = readFileSync24(importedPath, "utf-8");
|
|
@@ -18577,15 +18691,15 @@ var transpiler5, inlineCssImports = (cssContent, cssFilePath, visited = new Set)
|
|
|
18577
18691
|
return filePath.replace(/\.ts$/, ".js");
|
|
18578
18692
|
if (isStylePath(filePath)) {
|
|
18579
18693
|
if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
|
|
18580
|
-
return
|
|
18694
|
+
return resolve28(sourceDir, filePath);
|
|
18581
18695
|
}
|
|
18582
18696
|
return filePath;
|
|
18583
18697
|
}
|
|
18584
18698
|
if (sourceDir && (filePath.startsWith("./") || filePath.startsWith("../"))) {
|
|
18585
|
-
const directTs =
|
|
18699
|
+
const directTs = resolve28(sourceDir, `${filePath}.ts`);
|
|
18586
18700
|
if (existsSync28(directTs))
|
|
18587
18701
|
return `${filePath}.js`;
|
|
18588
|
-
const indexedTs =
|
|
18702
|
+
const indexedTs = resolve28(sourceDir, filePath, "index.ts");
|
|
18589
18703
|
if (existsSync28(indexedTs))
|
|
18590
18704
|
return `${filePath}/index.js`;
|
|
18591
18705
|
}
|
|
@@ -18728,7 +18842,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
18728
18842
|
let result = code;
|
|
18729
18843
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
18730
18844
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
18731
|
-
let rel =
|
|
18845
|
+
let rel = relative17(dirname20(outputPath), targetPath).replace(/\\/g, "/");
|
|
18732
18846
|
if (!rel.startsWith("."))
|
|
18733
18847
|
rel = `./${rel}`;
|
|
18734
18848
|
result = result.replaceAll(bareImport, rel);
|
|
@@ -18827,7 +18941,7 @@ var init_workerJobs = __esm(() => {
|
|
|
18827
18941
|
// src/build/workerPool.ts
|
|
18828
18942
|
import { existsSync as existsSync29, readFileSync as readFileSync25 } from "fs";
|
|
18829
18943
|
import { availableParallelism, freemem } from "os";
|
|
18830
|
-
import { dirname as dirname21, join as
|
|
18944
|
+
import { dirname as dirname21, join as join38 } from "path";
|
|
18831
18945
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
18832
18946
|
var MIN_WORKERS = 2, MAX_DEFAULT_WORKERS = 8, MAX_OVERRIDE_WORKERS = 64, WORKER_MEMORY_BUDGET_BYTES, DEFAULT_IDLE_TIMEOUT_MS = 2000, DEFAULT_MIN_BATCH = 4, PACKAGE_WALK_DEPTH = 6, PERCENT = 100, OWN_PACKAGE_NAME = "@absolutejs/absolute", parseWorkerOverride = (raw) => {
|
|
18833
18947
|
if (raw === undefined || raw.trim() === "")
|
|
@@ -18844,7 +18958,7 @@ var MIN_WORKERS = 2, MAX_DEFAULT_WORKERS = 8, MAX_OVERRIDE_WORKERS = 64, WORKER_
|
|
|
18844
18958
|
const byMemory = Math.floor(freemem() / WORKER_MEMORY_BUDGET_BYTES);
|
|
18845
18959
|
return Math.max(MIN_WORKERS, Math.min(byCpu, byMemory));
|
|
18846
18960
|
}, isOwnPackageRoot = (dir) => {
|
|
18847
|
-
const packageFile =
|
|
18961
|
+
const packageFile = join38(dir, "package.json");
|
|
18848
18962
|
if (!existsSync29(packageFile))
|
|
18849
18963
|
return false;
|
|
18850
18964
|
try {
|
|
@@ -18868,9 +18982,9 @@ var MIN_WORKERS = 2, MAX_DEFAULT_WORKERS = 8, MAX_OVERRIDE_WORKERS = 64, WORKER_
|
|
|
18868
18982
|
const root = findOwnPackageRoot(fromDir);
|
|
18869
18983
|
if (!root)
|
|
18870
18984
|
return null;
|
|
18871
|
-
const distEntry =
|
|
18872
|
-
const sourceEntry =
|
|
18873
|
-
const runningFromDist = fromDir.startsWith(
|
|
18985
|
+
const distEntry = join38(root, "dist", "build", "buildWorker.js");
|
|
18986
|
+
const sourceEntry = join38(root, "src", "build", "buildWorker.ts");
|
|
18987
|
+
const runningFromDist = fromDir.startsWith(join38(root, "dist"));
|
|
18874
18988
|
const ordered = runningFromDist ? [distEntry, sourceEntry] : [sourceEntry, distEntry];
|
|
18875
18989
|
return ordered.find((candidate) => existsSync29(candidate)) ?? null;
|
|
18876
18990
|
}, formatPercent = (ratio) => `${Math.round(ratio * PERCENT)}%`, createBuildWorkerPool = (options = {}) => {
|
|
@@ -19156,21 +19270,21 @@ import {
|
|
|
19156
19270
|
basename as basename14,
|
|
19157
19271
|
dirname as dirname22,
|
|
19158
19272
|
isAbsolute as isAbsolute7,
|
|
19159
|
-
join as
|
|
19160
|
-
relative as
|
|
19161
|
-
resolve as
|
|
19273
|
+
join as join39,
|
|
19274
|
+
relative as relative18,
|
|
19275
|
+
resolve as resolve29
|
|
19162
19276
|
} from "path";
|
|
19163
19277
|
var {file: file3, write: write4 } = globalThis.Bun;
|
|
19164
19278
|
var resolveDevClientDir3 = () => {
|
|
19165
19279
|
const projectRoot = process.cwd();
|
|
19166
|
-
const fromSource =
|
|
19280
|
+
const fromSource = resolve29(import.meta.dir, "../dev/client");
|
|
19167
19281
|
if (existsSync30(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
19168
19282
|
return fromSource;
|
|
19169
19283
|
}
|
|
19170
|
-
const fromNodeModules =
|
|
19284
|
+
const fromNodeModules = resolve29(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
19171
19285
|
if (existsSync30(fromNodeModules))
|
|
19172
19286
|
return fromNodeModules;
|
|
19173
|
-
return
|
|
19287
|
+
return resolve29(import.meta.dir, "./dev/client");
|
|
19174
19288
|
}, devClientDir3, hmrClientPath4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, detectVueChangeType = (filePath, descriptor) => {
|
|
19175
19289
|
const prevScript = scriptCache.get(filePath);
|
|
19176
19290
|
const prevScriptSetup = scriptSetupCache.get(filePath);
|
|
@@ -19201,7 +19315,7 @@ var resolveDevClientDir3 = () => {
|
|
|
19201
19315
|
return "template-only";
|
|
19202
19316
|
}
|
|
19203
19317
|
return "full";
|
|
19204
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
19318
|
+
}, generateVueHmrId = (sourceFilePath, vueRootDir) => relative18(vueRootDir, sourceFilePath).replace(/\\/g, "/").replace(/\.vue$/, ""), importScanner, IMPORT_PATTERNS, matchImports = (sourceCode) => IMPORT_PATTERNS.flatMap((pattern) => Array.from(sourceCode.matchAll(pattern), (match) => match[1])).filter((importPath) => importPath !== undefined), extractImports = (sourceCode) => {
|
|
19205
19319
|
let found;
|
|
19206
19320
|
try {
|
|
19207
19321
|
found = importScanner.scanImports(sourceCode).map(({ path }) => path);
|
|
@@ -19211,11 +19325,11 @@ var resolveDevClientDir3 = () => {
|
|
|
19211
19325
|
return Array.from(new Set(found));
|
|
19212
19326
|
}, resolveHelperTsPath = (sourceDir, helper) => {
|
|
19213
19327
|
if (helper.endsWith(".ts"))
|
|
19214
|
-
return
|
|
19215
|
-
const direct =
|
|
19328
|
+
return resolve29(sourceDir, helper);
|
|
19329
|
+
const direct = resolve29(sourceDir, `${helper}.ts`);
|
|
19216
19330
|
if (existsSync30(direct))
|
|
19217
19331
|
return direct;
|
|
19218
|
-
const indexed =
|
|
19332
|
+
const indexed = resolve29(sourceDir, helper, "index.ts");
|
|
19219
19333
|
if (existsSync30(indexed))
|
|
19220
19334
|
return indexed;
|
|
19221
19335
|
return direct;
|
|
@@ -19283,7 +19397,7 @@ var resolveDevClientDir3 = () => {
|
|
|
19283
19397
|
]);
|
|
19284
19398
|
}, materialiseVueCompileCacheEntry = async (entry, cacheKey, isEntryPoint, outputDirs, fileBaseName) => {
|
|
19285
19399
|
const { result } = entry;
|
|
19286
|
-
const cssOutputFile = isEntryPoint && result.cssCodes.length > 0 ?
|
|
19400
|
+
const cssOutputFile = isEntryPoint && result.cssCodes.length > 0 ? join39(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`) : null;
|
|
19287
19401
|
trackWrite(writeVueOutputs({
|
|
19288
19402
|
clientCode: entry.clientCode,
|
|
19289
19403
|
clientPath: result.clientPath,
|
|
@@ -19375,12 +19489,12 @@ var resolveDevClientDir3 = () => {
|
|
|
19375
19489
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
19376
19490
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
19377
19491
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
19378
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute7(path)) && isStylePath(path)).map((path) => isAbsolute7(path) ? path :
|
|
19492
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute7(path)) && isStylePath(path)).map((path) => isAbsolute7(path) ? path : resolve29(dirname22(sourceFilePath), path));
|
|
19379
19493
|
for (const stylePath of stylePathsImported) {
|
|
19380
19494
|
addStyleImporter(sourceFilePath, stylePath);
|
|
19381
19495
|
}
|
|
19382
19496
|
const childBuildResults = await Promise.all([
|
|
19383
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
19497
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve29(dirname22(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, runSfc, stylePreprocessors)),
|
|
19384
19498
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, runSfc, stylePreprocessors))
|
|
19385
19499
|
]);
|
|
19386
19500
|
const cacheKeyStartedAt = performance.now();
|
|
@@ -19431,7 +19545,7 @@ var resolveDevClientDir3 = () => {
|
|
|
19431
19545
|
...localCss,
|
|
19432
19546
|
...childBuildResults.flatMap((result) => result.cssCodes)
|
|
19433
19547
|
];
|
|
19434
|
-
const cssOutputFile = isEntryPoint && allCss.length ?
|
|
19548
|
+
const cssOutputFile = isEntryPoint && allCss.length ? join39(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`) : null;
|
|
19435
19549
|
const cssOutputPaths = cssOutputFile ? [cssOutputFile] : [];
|
|
19436
19550
|
trackWrite(writeVueOutputs({
|
|
19437
19551
|
clientCode: clientOutput,
|
|
@@ -19475,10 +19589,10 @@ var resolveDevClientDir3 = () => {
|
|
|
19475
19589
|
const compilerLoadMs = performance.now() - compilerLoadStartedAt;
|
|
19476
19590
|
vueCompileProfile.stageCompilerMs = compilerLoadMs;
|
|
19477
19591
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
19478
|
-
const clientOutputDir =
|
|
19479
|
-
const indexOutputDir =
|
|
19480
|
-
const serverOutputDir =
|
|
19481
|
-
const cssOutputDir =
|
|
19592
|
+
const clientOutputDir = join39(generatedDir, "client");
|
|
19593
|
+
const indexOutputDir = join39(generatedDir, "indexes");
|
|
19594
|
+
const serverOutputDir = join39(generatedDir, "server");
|
|
19595
|
+
const cssOutputDir = join39(generatedDir, "compiled");
|
|
19482
19596
|
await Promise.all([
|
|
19483
19597
|
mkdir9(clientOutputDir, { recursive: true }),
|
|
19484
19598
|
mkdir9(indexOutputDir, { recursive: true }),
|
|
@@ -19488,7 +19602,7 @@ var resolveDevClientDir3 = () => {
|
|
|
19488
19602
|
const buildCache = new Map;
|
|
19489
19603
|
const allTsHelperPaths = new Set;
|
|
19490
19604
|
const expandSpaRouteChildren = async (entries) => {
|
|
19491
|
-
const expanded = new Set(entries.map((entry) =>
|
|
19605
|
+
const expanded = new Set(entries.map((entry) => resolve29(entry)));
|
|
19492
19606
|
const queue = [...expanded];
|
|
19493
19607
|
while (queue.length > 0) {
|
|
19494
19608
|
const entryPath = queue.pop();
|
|
@@ -19505,7 +19619,7 @@ var resolveDevClientDir3 = () => {
|
|
|
19505
19619
|
});
|
|
19506
19620
|
const routes = parseVueSpaRoutes(descriptor.script?.content ?? "");
|
|
19507
19621
|
for (const { importPath } of routes) {
|
|
19508
|
-
const childPath =
|
|
19622
|
+
const childPath = resolve29(dirname22(entryPath), importPath);
|
|
19509
19623
|
if (expanded.has(childPath) || !existsSync30(childPath)) {
|
|
19510
19624
|
continue;
|
|
19511
19625
|
}
|
|
@@ -19520,7 +19634,7 @@ var resolveDevClientDir3 = () => {
|
|
|
19520
19634
|
vueCompileProfile.stageExpandMs = performance.now() - stageStartedAt;
|
|
19521
19635
|
stageStartedAt = performance.now();
|
|
19522
19636
|
const compiledPages = await Promise.all(expandedEntryPoints.map(async (entryPath) => {
|
|
19523
|
-
const resolvedEntryPath =
|
|
19637
|
+
const resolvedEntryPath = resolve29(entryPath);
|
|
19524
19638
|
const result = await compileVueFile(resolvedEntryPath, {
|
|
19525
19639
|
client: clientOutputDir,
|
|
19526
19640
|
css: cssOutputDir,
|
|
@@ -19538,7 +19652,7 @@ var resolveDevClientDir3 = () => {
|
|
|
19538
19652
|
};
|
|
19539
19653
|
}
|
|
19540
19654
|
const entryBaseName = basename14(entryPath, ".vue");
|
|
19541
|
-
const indexOutputFile =
|
|
19655
|
+
const indexOutputFile = join39(indexOutputDir, `${entryBaseName}.js`);
|
|
19542
19656
|
const clientOutputFile = result.clientPath;
|
|
19543
19657
|
await mkdir9(dirname22(indexOutputFile), { recursive: true });
|
|
19544
19658
|
const vueHmrImports = isDev ? [
|
|
@@ -19547,7 +19661,7 @@ var resolveDevClientDir3 = () => {
|
|
|
19547
19661
|
] : [];
|
|
19548
19662
|
await write4(indexOutputFile, [
|
|
19549
19663
|
...vueHmrImports,
|
|
19550
|
-
`import Comp, * as PageModule from "${
|
|
19664
|
+
`import Comp, * as PageModule from "${relative18(dirname22(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
19551
19665
|
'import { createSSRApp, createApp } from "vue";',
|
|
19552
19666
|
'import { prepareBrowserTranslationHydration } from "@absolutejs/absolute/vue";',
|
|
19553
19667
|
"",
|
|
@@ -19775,7 +19889,7 @@ var init_compileVue = __esm(() => {
|
|
|
19775
19889
|
init_stylePreprocessor();
|
|
19776
19890
|
init_vueCompileCache();
|
|
19777
19891
|
devClientDir3 = resolveDevClientDir3();
|
|
19778
|
-
hmrClientPath4 =
|
|
19892
|
+
hmrClientPath4 = join39(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
19779
19893
|
scriptCache = new Map;
|
|
19780
19894
|
scriptSetupCache = new Map;
|
|
19781
19895
|
templateCache = new Map;
|
|
@@ -20284,7 +20398,7 @@ __export(exports_compileAngular, {
|
|
|
20284
20398
|
invalidateAngularJitCache: () => invalidateAngularJitCache
|
|
20285
20399
|
});
|
|
20286
20400
|
import { existsSync as existsSync31, readFileSync as readFileSync26, promises as fs5 } from "fs";
|
|
20287
|
-
import { join as
|
|
20401
|
+
import { join as join40, basename as basename15, sep as sep5, dirname as dirname23, resolve as resolve30, relative as relative19 } from "path";
|
|
20288
20402
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
20289
20403
|
import ts18 from "typescript";
|
|
20290
20404
|
var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) => {
|
|
@@ -20300,10 +20414,10 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20300
20414
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn, metadata) : await fn();
|
|
20301
20415
|
}, readTsconfigPathAliases = () => {
|
|
20302
20416
|
try {
|
|
20303
|
-
const configPath =
|
|
20417
|
+
const configPath = resolve30(process.cwd(), "tsconfig.json");
|
|
20304
20418
|
const config = ts18.readConfigFile(configPath, ts18.sys.readFile).config;
|
|
20305
20419
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
20306
|
-
const baseUrl =
|
|
20420
|
+
const baseUrl = resolve30(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
20307
20421
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
20308
20422
|
return { aliases, baseUrl };
|
|
20309
20423
|
} catch {
|
|
@@ -20323,7 +20437,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20323
20437
|
const wildcardValue = exactMatch ? "" : specifier.slice(prefix.length, specifier.length - suffix.length);
|
|
20324
20438
|
for (const replacement of alias.replacements) {
|
|
20325
20439
|
const candidate = replacement.replace("*", wildcardValue);
|
|
20326
|
-
const resolved = resolveSourceFile(
|
|
20440
|
+
const resolved = resolveSourceFile(resolve30(baseUrl, candidate));
|
|
20327
20441
|
if (resolved)
|
|
20328
20442
|
return resolved;
|
|
20329
20443
|
}
|
|
@@ -20335,20 +20449,20 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20335
20449
|
`${candidate}.tsx`,
|
|
20336
20450
|
`${candidate}.js`,
|
|
20337
20451
|
`${candidate}.jsx`,
|
|
20338
|
-
|
|
20339
|
-
|
|
20340
|
-
|
|
20341
|
-
|
|
20452
|
+
join40(candidate, "index.ts"),
|
|
20453
|
+
join40(candidate, "index.tsx"),
|
|
20454
|
+
join40(candidate, "index.js"),
|
|
20455
|
+
join40(candidate, "index.jsx")
|
|
20342
20456
|
];
|
|
20343
20457
|
return candidates.find((file) => existsSync31(file));
|
|
20344
20458
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
20345
|
-
const baseDir =
|
|
20459
|
+
const baseDir = resolve30(rootDir);
|
|
20346
20460
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
20347
20461
|
const transpiler = new Bun.Transpiler({ loader: "tsx" });
|
|
20348
20462
|
const scanCache = new Map;
|
|
20349
20463
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
20350
20464
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
20351
|
-
return resolveSourceFile(
|
|
20465
|
+
return resolveSourceFile(resolve30(fromDir, specifier));
|
|
20352
20466
|
}
|
|
20353
20467
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
20354
20468
|
if (aliased)
|
|
@@ -20357,7 +20471,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20357
20471
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
20358
20472
|
if (resolved.includes("/node_modules/"))
|
|
20359
20473
|
return;
|
|
20360
|
-
const absolute =
|
|
20474
|
+
const absolute = resolve30(resolved);
|
|
20361
20475
|
if (!absolute.startsWith(baseDir))
|
|
20362
20476
|
return;
|
|
20363
20477
|
return resolveSourceFile(absolute);
|
|
@@ -20373,7 +20487,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20373
20487
|
usesLegacyAnimations: false
|
|
20374
20488
|
});
|
|
20375
20489
|
}
|
|
20376
|
-
const resolved =
|
|
20490
|
+
const resolved = resolve30(actualPath);
|
|
20377
20491
|
const cached = scanCache.get(resolved);
|
|
20378
20492
|
if (cached)
|
|
20379
20493
|
return cached;
|
|
@@ -20402,7 +20516,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20402
20516
|
const actualPath = resolveSourceFile(filePath);
|
|
20403
20517
|
if (!actualPath)
|
|
20404
20518
|
return false;
|
|
20405
|
-
const resolved =
|
|
20519
|
+
const resolved = resolve30(actualPath);
|
|
20406
20520
|
if (visited.has(resolved))
|
|
20407
20521
|
return false;
|
|
20408
20522
|
visited.add(resolved);
|
|
@@ -20420,14 +20534,14 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20420
20534
|
return (entryPath) => visit(entryPath);
|
|
20421
20535
|
}, resolveDevClientDir4 = () => {
|
|
20422
20536
|
const projectRoot = process.cwd();
|
|
20423
|
-
const fromSource =
|
|
20537
|
+
const fromSource = resolve30(import.meta.dir, "../dev/client");
|
|
20424
20538
|
if (existsSync31(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
20425
20539
|
return fromSource;
|
|
20426
20540
|
}
|
|
20427
|
-
const fromNodeModules =
|
|
20541
|
+
const fromNodeModules = resolve30(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
20428
20542
|
if (existsSync31(fromNodeModules))
|
|
20429
20543
|
return fromNodeModules;
|
|
20430
|
-
return
|
|
20544
|
+
return resolve30(import.meta.dir, "./dev/client");
|
|
20431
20545
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
20432
20546
|
try {
|
|
20433
20547
|
return ts18.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
@@ -20470,11 +20584,11 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20470
20584
|
if (hasJsLikeExtension(path))
|
|
20471
20585
|
return `${path}${query}`;
|
|
20472
20586
|
const importerDir = dirname23(importerOutputPath);
|
|
20473
|
-
const fileCandidate =
|
|
20587
|
+
const fileCandidate = resolve30(importerDir, `${path}.js`);
|
|
20474
20588
|
if (outputFiles?.has(fileCandidate) || existsSync31(fileCandidate)) {
|
|
20475
20589
|
return `${path}.js${query}`;
|
|
20476
20590
|
}
|
|
20477
|
-
const indexCandidate =
|
|
20591
|
+
const indexCandidate = resolve30(importerDir, path, "index.js");
|
|
20478
20592
|
if (outputFiles?.has(indexCandidate) || existsSync31(indexCandidate)) {
|
|
20479
20593
|
return `${path}/index.js${query}`;
|
|
20480
20594
|
}
|
|
@@ -20502,18 +20616,18 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20502
20616
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
20503
20617
|
if (!isRelativeModuleSpecifier(specifier))
|
|
20504
20618
|
return null;
|
|
20505
|
-
const basePath =
|
|
20619
|
+
const basePath = resolve30(dirname23(fromFile), specifier);
|
|
20506
20620
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
20507
20621
|
`${basePath}.ts`,
|
|
20508
20622
|
`${basePath}.tsx`,
|
|
20509
20623
|
`${basePath}.mts`,
|
|
20510
20624
|
`${basePath}.cts`,
|
|
20511
|
-
|
|
20512
|
-
|
|
20513
|
-
|
|
20514
|
-
|
|
20625
|
+
join40(basePath, "index.ts"),
|
|
20626
|
+
join40(basePath, "index.tsx"),
|
|
20627
|
+
join40(basePath, "index.mts"),
|
|
20628
|
+
join40(basePath, "index.cts")
|
|
20515
20629
|
];
|
|
20516
|
-
return candidates.map((candidate) =>
|
|
20630
|
+
return candidates.map((candidate) => resolve30(candidate)).find((candidate) => existsSync31(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
20517
20631
|
}, readFileForAotTransform = async (fileName, readFile) => {
|
|
20518
20632
|
const hostSource = readFile?.(fileName);
|
|
20519
20633
|
if (typeof hostSource === "string")
|
|
@@ -20537,18 +20651,18 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20537
20651
|
const paths = [];
|
|
20538
20652
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
20539
20653
|
if (templateUrlMatch?.[1])
|
|
20540
|
-
paths.push(
|
|
20654
|
+
paths.push(join40(fileDir, templateUrlMatch[1]));
|
|
20541
20655
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
20542
20656
|
if (styleUrlMatch?.[1])
|
|
20543
|
-
paths.push(
|
|
20657
|
+
paths.push(join40(fileDir, styleUrlMatch[1]));
|
|
20544
20658
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
20545
20659
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
20546
20660
|
if (urlMatches) {
|
|
20547
20661
|
for (const urlMatch of urlMatches) {
|
|
20548
|
-
paths.push(
|
|
20662
|
+
paths.push(join40(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
20549
20663
|
}
|
|
20550
20664
|
}
|
|
20551
|
-
return paths.map((path) =>
|
|
20665
|
+
return paths.map((path) => resolve30(path));
|
|
20552
20666
|
}, readResourceCacheFile = async (cachePath) => {
|
|
20553
20667
|
try {
|
|
20554
20668
|
const entry = JSON.parse(await fs5.readFile(cachePath, "utf-8"));
|
|
@@ -20579,7 +20693,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20579
20693
|
safeStableStringify(stylePreprocessors ?? null)
|
|
20580
20694
|
].join("\x00");
|
|
20581
20695
|
const cacheKey = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
20582
|
-
return
|
|
20696
|
+
return join40(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey}.json`);
|
|
20583
20697
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile, stylePreprocessors) => {
|
|
20584
20698
|
const transformedSources = new Map;
|
|
20585
20699
|
const visited = new Set;
|
|
@@ -20590,7 +20704,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20590
20704
|
transformedFiles: 0
|
|
20591
20705
|
};
|
|
20592
20706
|
const transformFile = async (filePath) => {
|
|
20593
|
-
const resolvedPath =
|
|
20707
|
+
const resolvedPath = resolve30(filePath);
|
|
20594
20708
|
if (visited.has(resolvedPath))
|
|
20595
20709
|
return;
|
|
20596
20710
|
visited.add(resolvedPath);
|
|
@@ -20625,7 +20739,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20625
20739
|
return { stats, transformedSources };
|
|
20626
20740
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
20627
20741
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
20628
|
-
const outputPath =
|
|
20742
|
+
const outputPath = resolve30(join40(outDir, relative19(process.cwd(), resolve30(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
20629
20743
|
return [
|
|
20630
20744
|
outputPath,
|
|
20631
20745
|
buildIslandMetadataExports(readFileSync26(inputPath, "utf-8"))
|
|
@@ -20636,7 +20750,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20636
20750
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
20637
20751
|
const tsPath = __require.resolve("typescript");
|
|
20638
20752
|
const tsRootDir = dirname23(tsPath);
|
|
20639
|
-
return tsRootDir.endsWith("lib") ? tsRootDir :
|
|
20753
|
+
return tsRootDir.endsWith("lib") ? tsRootDir : resolve30(tsRootDir, "lib");
|
|
20640
20754
|
});
|
|
20641
20755
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
20642
20756
|
const options = {
|
|
@@ -20672,13 +20786,13 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20672
20786
|
const originalGetSourceFile = host.getSourceFile;
|
|
20673
20787
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
20674
20788
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
20675
|
-
const resolvedPath =
|
|
20789
|
+
const resolvedPath = join40(tsLibDir, fileName);
|
|
20676
20790
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
20677
20791
|
}
|
|
20678
20792
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
20679
20793
|
};
|
|
20680
20794
|
const emitted = {};
|
|
20681
|
-
const resolvedOutDir =
|
|
20795
|
+
const resolvedOutDir = resolve30(outDir);
|
|
20682
20796
|
host.writeFile = (fileName, text) => {
|
|
20683
20797
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
20684
20798
|
emitted[relativePath] = text;
|
|
@@ -20700,12 +20814,12 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20700
20814
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
20701
20815
|
return source;
|
|
20702
20816
|
}
|
|
20703
|
-
const resolvedPath =
|
|
20817
|
+
const resolvedPath = resolve30(fileName);
|
|
20704
20818
|
return transformedSources.get(resolvedPath) ?? source;
|
|
20705
20819
|
};
|
|
20706
20820
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
20707
20821
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
20708
|
-
const source = transformedSources.get(
|
|
20822
|
+
const source = transformedSources.get(resolve30(fileName));
|
|
20709
20823
|
if (source) {
|
|
20710
20824
|
return ts18.createSourceFile(fileName, source, languageVersion, true);
|
|
20711
20825
|
}
|
|
@@ -20727,9 +20841,9 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20727
20841
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
20728
20842
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
20729
20843
|
content,
|
|
20730
|
-
target:
|
|
20844
|
+
target: join40(outDir, fileName)
|
|
20731
20845
|
}));
|
|
20732
|
-
const outputFiles = new Set(rawEntries.map(({ target }) =>
|
|
20846
|
+
const outputFiles = new Set(rawEntries.map(({ target }) => resolve30(target)));
|
|
20733
20847
|
return rawEntries.map(({ content, target }) => {
|
|
20734
20848
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
20735
20849
|
const rewritten = rewriteRelativeJsSpecifier(target, path, outputFiles);
|
|
@@ -20744,7 +20858,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20744
20858
|
return cleaned ? `import { ${cleaned}, InternalInjectFlags } from '@angular/core'` : `import { InternalInjectFlags } from '@angular/core'`;
|
|
20745
20859
|
});
|
|
20746
20860
|
processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
|
|
20747
|
-
processedContent += islandMetadataByOutputPath.get(
|
|
20861
|
+
processedContent += islandMetadataByOutputPath.get(resolve30(target)) ?? "";
|
|
20748
20862
|
return { content: processedContent, target };
|
|
20749
20863
|
});
|
|
20750
20864
|
});
|
|
@@ -20754,7 +20868,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20754
20868
|
})), { outputs: entries.length });
|
|
20755
20869
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
20756
20870
|
}, jitContentCache, invalidateAngularJitCache = (filePath) => {
|
|
20757
|
-
jitContentCache.delete(
|
|
20871
|
+
jitContentCache.delete(resolve30(filePath));
|
|
20758
20872
|
}, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), findUncommentedMatch = (source, pattern) => {
|
|
20759
20873
|
const re = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : pattern.flags + "g");
|
|
20760
20874
|
let match;
|
|
@@ -20767,7 +20881,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
|
|
|
20767
20881
|
}
|
|
20768
20882
|
return null;
|
|
20769
20883
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
20770
|
-
const sourceEntry =
|
|
20884
|
+
const sourceEntry = resolve30(import.meta.dir, "../angular/components/index.ts");
|
|
20771
20885
|
if (existsSync31(sourceEntry)) {
|
|
20772
20886
|
return sourceEntry.replace(/\\/g, "/");
|
|
20773
20887
|
}
|
|
@@ -20904,7 +21018,7 @@ ${fields}
|
|
|
20904
21018
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
20905
21019
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
20906
21020
|
if (templateUrlMatch?.[1]) {
|
|
20907
|
-
const templatePath =
|
|
21021
|
+
const templatePath = join40(fileDir, templateUrlMatch[1]);
|
|
20908
21022
|
if (!existsSync31(templatePath)) {
|
|
20909
21023
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
20910
21024
|
}
|
|
@@ -20935,7 +21049,7 @@ ${fields}
|
|
|
20935
21049
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
20936
21050
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
20937
21051
|
if (templateUrlMatch?.[1]) {
|
|
20938
|
-
const templatePath =
|
|
21052
|
+
const templatePath = join40(fileDir, templateUrlMatch[1]);
|
|
20939
21053
|
if (!existsSync31(templatePath)) {
|
|
20940
21054
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
20941
21055
|
}
|
|
@@ -20972,7 +21086,7 @@ ${fields}
|
|
|
20972
21086
|
return source;
|
|
20973
21087
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
20974
21088
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
20975
|
-
return readAndEscapeFile(
|
|
21089
|
+
return readAndEscapeFile(join40(fileDir, styleUrl), stylePreprocessors);
|
|
20976
21090
|
});
|
|
20977
21091
|
const results = await Promise.all(stylePromises);
|
|
20978
21092
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -20983,7 +21097,7 @@ ${fields}
|
|
|
20983
21097
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
20984
21098
|
if (!styleUrlMatch?.[1])
|
|
20985
21099
|
return source;
|
|
20986
|
-
const escaped = await readAndEscapeFile(
|
|
21100
|
+
const escaped = await readAndEscapeFile(join40(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
20987
21101
|
if (!escaped)
|
|
20988
21102
|
return source;
|
|
20989
21103
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -21057,10 +21171,10 @@ ${fields}
|
|
|
21057
21171
|
return "";
|
|
21058
21172
|
}
|
|
21059
21173
|
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors, cacheBuster) => {
|
|
21060
|
-
const entryPath =
|
|
21174
|
+
const entryPath = resolve30(inputPath);
|
|
21061
21175
|
const allOutputs = [];
|
|
21062
21176
|
const visited = new Set;
|
|
21063
|
-
const baseDir =
|
|
21177
|
+
const baseDir = resolve30(rootDir ?? process.cwd());
|
|
21064
21178
|
let usesLegacyAnimations = false;
|
|
21065
21179
|
const angularTranspiler = new Bun.Transpiler({
|
|
21066
21180
|
loader: "ts",
|
|
@@ -21079,16 +21193,16 @@ ${fields}
|
|
|
21079
21193
|
`${candidate}.js`,
|
|
21080
21194
|
`${candidate}.jsx`,
|
|
21081
21195
|
`${candidate}.json`,
|
|
21082
|
-
|
|
21083
|
-
|
|
21084
|
-
|
|
21085
|
-
|
|
21196
|
+
join40(candidate, "index.ts"),
|
|
21197
|
+
join40(candidate, "index.tsx"),
|
|
21198
|
+
join40(candidate, "index.js"),
|
|
21199
|
+
join40(candidate, "index.jsx")
|
|
21086
21200
|
];
|
|
21087
21201
|
return candidates.find((file) => existsSync31(file));
|
|
21088
21202
|
};
|
|
21089
21203
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
21090
21204
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
21091
|
-
return resolveSourceFile(
|
|
21205
|
+
return resolveSourceFile(resolve30(fromDir, specifier));
|
|
21092
21206
|
}
|
|
21093
21207
|
const aliased = matchTsconfigAlias(specifier, tsconfigAliases.aliases, tsconfigAliases.baseUrl, resolveSourceFile);
|
|
21094
21208
|
if (aliased)
|
|
@@ -21097,7 +21211,7 @@ ${fields}
|
|
|
21097
21211
|
const resolved = Bun.resolveSync(specifier, fromDir);
|
|
21098
21212
|
if (resolved.includes("/node_modules/"))
|
|
21099
21213
|
return;
|
|
21100
|
-
const absolute =
|
|
21214
|
+
const absolute = resolve30(resolved);
|
|
21101
21215
|
if (!absolute.startsWith(baseDir))
|
|
21102
21216
|
return;
|
|
21103
21217
|
return resolveSourceFile(absolute);
|
|
@@ -21108,11 +21222,11 @@ ${fields}
|
|
|
21108
21222
|
const toOutputPath = (sourcePath) => {
|
|
21109
21223
|
const inputDir = dirname23(sourcePath);
|
|
21110
21224
|
const fileBase = basename15(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
21111
|
-
if (inputDir === outDir || inputDir.startsWith(`${outDir}${
|
|
21112
|
-
return
|
|
21225
|
+
if (inputDir === outDir || inputDir.startsWith(`${outDir}${sep5}`)) {
|
|
21226
|
+
return join40(inputDir, fileBase);
|
|
21113
21227
|
}
|
|
21114
21228
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
21115
|
-
return
|
|
21229
|
+
return join40(outDir, relativeDir, fileBase);
|
|
21116
21230
|
};
|
|
21117
21231
|
const withCacheBuster = (specifier) => {
|
|
21118
21232
|
if (!cacheBuster)
|
|
@@ -21149,21 +21263,21 @@ ${fields}
|
|
|
21149
21263
|
return `${prefix}${dots}`;
|
|
21150
21264
|
return `${prefix}../${dots}`;
|
|
21151
21265
|
});
|
|
21152
|
-
if (
|
|
21266
|
+
if (resolve30(actualPath) === entryPath) {
|
|
21153
21267
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
21154
21268
|
}
|
|
21155
21269
|
return processedContent;
|
|
21156
21270
|
};
|
|
21157
21271
|
const transpileFile = async (filePath) => {
|
|
21158
|
-
const resolved =
|
|
21272
|
+
const resolved = resolve30(filePath);
|
|
21159
21273
|
if (visited.has(resolved))
|
|
21160
21274
|
return;
|
|
21161
21275
|
visited.add(resolved);
|
|
21162
21276
|
if (resolved.endsWith(".json") && existsSync31(resolved)) {
|
|
21163
21277
|
const inputDir = dirname23(resolved);
|
|
21164
21278
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
21165
|
-
const targetDir =
|
|
21166
|
-
const targetPath =
|
|
21279
|
+
const targetDir = join40(outDir, relativeDir);
|
|
21280
|
+
const targetPath = join40(targetDir, basename15(resolved));
|
|
21167
21281
|
await fs5.mkdir(targetDir, { recursive: true });
|
|
21168
21282
|
await fs5.copyFile(resolved, targetPath);
|
|
21169
21283
|
allOutputs.push(targetPath);
|
|
@@ -21181,7 +21295,7 @@ ${fields}
|
|
|
21181
21295
|
const fileBase = basename15(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
21182
21296
|
const targetPath = toOutputPath(actualPath);
|
|
21183
21297
|
const targetDir = dirname23(targetPath);
|
|
21184
|
-
const relativeDir =
|
|
21298
|
+
const relativeDir = relative19(outDir, targetDir).replace(/\\/g, "/");
|
|
21185
21299
|
const localImports = [];
|
|
21186
21300
|
const importRewrites = new Map;
|
|
21187
21301
|
const fromRegex = /(?:from|import)\s+['"]([^'".][^'"]*|\.\.?\/[^'"]+)['"]/g;
|
|
@@ -21202,12 +21316,12 @@ ${fields}
|
|
|
21202
21316
|
const resolved = resolveLocalImport(specifier, inputDir);
|
|
21203
21317
|
if (!resolved)
|
|
21204
21318
|
return null;
|
|
21205
|
-
const relativeImport =
|
|
21319
|
+
const relativeImport = relative19(targetDir, toOutputPath(resolved)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
21206
21320
|
const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
|
|
21207
21321
|
importRewrites.set(specifier, relativeRewrite);
|
|
21208
21322
|
return resolved;
|
|
21209
21323
|
}).filter((path) => Boolean(path));
|
|
21210
|
-
const isEntry =
|
|
21324
|
+
const isEntry = resolve30(actualPath) === resolve30(entryPath);
|
|
21211
21325
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
21212
21326
|
const cacheKey = actualPath;
|
|
21213
21327
|
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey) !== contentHash || !existsSync31(targetPath);
|
|
@@ -21242,13 +21356,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
21242
21356
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
21243
21357
|
}
|
|
21244
21358
|
const compiledRoot = compiledParent;
|
|
21245
|
-
const indexesDir =
|
|
21359
|
+
const indexesDir = join40(compiledParent, "indexes");
|
|
21246
21360
|
await traceAngularPhase("setup/create-indexes-dir", () => fs5.mkdir(indexesDir, { recursive: true }));
|
|
21247
|
-
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) =>
|
|
21361
|
+
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve30(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
21248
21362
|
if (!hmr) {
|
|
21249
21363
|
await traceAngularPhase("aot/copy-json-resources", async () => {
|
|
21250
21364
|
const cwd = process.cwd();
|
|
21251
|
-
const angularSrcDir =
|
|
21365
|
+
const angularSrcDir = resolve30(outRoot);
|
|
21252
21366
|
if (!existsSync31(angularSrcDir))
|
|
21253
21367
|
return;
|
|
21254
21368
|
const jsonGlob = new Glob6("**/*.json");
|
|
@@ -21256,9 +21370,9 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
21256
21370
|
absolute: false,
|
|
21257
21371
|
cwd: angularSrcDir
|
|
21258
21372
|
})) {
|
|
21259
|
-
const sourcePath =
|
|
21260
|
-
const cwdRel =
|
|
21261
|
-
const targetPath =
|
|
21373
|
+
const sourcePath = join40(angularSrcDir, rel);
|
|
21374
|
+
const cwdRel = relative19(cwd, sourcePath);
|
|
21375
|
+
const targetPath = join40(compiledRoot, cwdRel);
|
|
21262
21376
|
await fs5.mkdir(dirname23(targetPath), { recursive: true });
|
|
21263
21377
|
await fs5.copyFile(sourcePath, targetPath);
|
|
21264
21378
|
}
|
|
@@ -21266,8 +21380,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
21266
21380
|
}
|
|
21267
21381
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
21268
21382
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
21269
|
-
const resolvedEntry =
|
|
21270
|
-
const relativeEntry =
|
|
21383
|
+
const resolvedEntry = resolve30(entry);
|
|
21384
|
+
const relativeEntry = relative19(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
21271
21385
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
21272
21386
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
21273
21387
|
entry: resolvedEntry
|
|
@@ -21275,21 +21389,21 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
21275
21389
|
const fileBase = basename15(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
21276
21390
|
const jsName = `${fileBase}.js`;
|
|
21277
21391
|
const compiledFallbackPaths = [
|
|
21278
|
-
|
|
21279
|
-
|
|
21280
|
-
|
|
21281
|
-
].map((file) =>
|
|
21392
|
+
join40(compiledRoot, relativeEntry),
|
|
21393
|
+
join40(compiledRoot, "pages", jsName),
|
|
21394
|
+
join40(compiledRoot, jsName)
|
|
21395
|
+
].map((file) => resolve30(file));
|
|
21282
21396
|
const resolveRawServerFile = (candidatePaths) => {
|
|
21283
21397
|
const normalizedCandidates = [
|
|
21284
|
-
...candidatePaths.map((file) =>
|
|
21398
|
+
...candidatePaths.map((file) => resolve30(file)),
|
|
21285
21399
|
...compiledFallbackPaths
|
|
21286
21400
|
];
|
|
21287
|
-
let candidate = normalizedCandidates.find((file) => existsSync31(file) && file.endsWith(`${
|
|
21401
|
+
let candidate = normalizedCandidates.find((file) => existsSync31(file) && file.endsWith(`${sep5}${relativeEntry}`));
|
|
21288
21402
|
if (!candidate) {
|
|
21289
|
-
candidate = normalizedCandidates.find((file) => existsSync31(file) && file.endsWith(`${
|
|
21403
|
+
candidate = normalizedCandidates.find((file) => existsSync31(file) && file.endsWith(`${sep5}pages${sep5}${jsName}`));
|
|
21290
21404
|
}
|
|
21291
21405
|
if (!candidate) {
|
|
21292
|
-
candidate = normalizedCandidates.find((file) => existsSync31(file) && file.endsWith(`${
|
|
21406
|
+
candidate = normalizedCandidates.find((file) => existsSync31(file) && file.endsWith(`${sep5}${jsName}`));
|
|
21293
21407
|
}
|
|
21294
21408
|
if (!candidate) {
|
|
21295
21409
|
candidate = normalizedCandidates.find((file) => existsSync31(file));
|
|
@@ -21339,7 +21453,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
21339
21453
|
})() : "no-providers";
|
|
21340
21454
|
const serverContentHash = `${Bun.hash(original).toString(BASE_36_RADIX)}.${Bun.hash(providersHashInput).toString(BASE_36_RADIX)}`;
|
|
21341
21455
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
21342
|
-
const clientFile =
|
|
21456
|
+
const clientFile = join40(indexesDir, jsName);
|
|
21343
21457
|
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync31(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
21344
21458
|
return {
|
|
21345
21459
|
clientPath: clientFile,
|
|
@@ -21371,13 +21485,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
21371
21485
|
const fragments = [];
|
|
21372
21486
|
if (providersInjection.appProvidersSource) {
|
|
21373
21487
|
const compiledAppProvidersPath = (() => {
|
|
21374
|
-
const angularDirAbs =
|
|
21375
|
-
const appSourceAbs =
|
|
21376
|
-
const rel =
|
|
21377
|
-
return
|
|
21488
|
+
const angularDirAbs = resolve30(outRoot);
|
|
21489
|
+
const appSourceAbs = resolve30(providersInjection.appProvidersSource);
|
|
21490
|
+
const rel = relative19(angularDirAbs, appSourceAbs).replace(/\\/g, "/");
|
|
21491
|
+
return join40(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
21378
21492
|
})();
|
|
21379
21493
|
const appProvidersSpec = (() => {
|
|
21380
|
-
const rel =
|
|
21494
|
+
const rel = relative19(dirname23(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
|
|
21381
21495
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
21382
21496
|
})();
|
|
21383
21497
|
importLines.push(`import { appProviders as __abs_globalProviders } from "${appProvidersSpec}";`);
|
|
@@ -21402,7 +21516,7 @@ export const providers = [${fragments.join(", ")}];
|
|
|
21402
21516
|
}
|
|
21403
21517
|
}
|
|
21404
21518
|
await traceAngularPhase("wrapper/write-server-output", () => writeTextFileAtomically(rawServerFile, rewritten), { entry: resolvedEntry });
|
|
21405
|
-
const relativePath =
|
|
21519
|
+
const relativePath = relative19(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
21406
21520
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
21407
21521
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
21408
21522
|
import "${hmrClientPath5}";
|
|
@@ -21635,7 +21749,7 @@ var init_compileAngular = __esm(() => {
|
|
|
21635
21749
|
init_stylePreprocessor();
|
|
21636
21750
|
init_generatedDir();
|
|
21637
21751
|
devClientDir4 = resolveDevClientDir4();
|
|
21638
|
-
hmrClientPath5 =
|
|
21752
|
+
hmrClientPath5 = join40(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
21639
21753
|
jitContentCache = new Map;
|
|
21640
21754
|
wrapperOutputCache = new Map;
|
|
21641
21755
|
PROVIDERS_INJECTION_BLOCK_RE = /\n\/\* __ABS_PROVIDERS_INJECTION_START \*\/[\s\S]*?\/\* __ABS_PROVIDERS_INJECTION_END \*\/\n?/;
|
|
@@ -22078,7 +22192,7 @@ var require_node = __commonJS(function(exports, module) {
|
|
|
22078
22192
|
// src/build/compileEmber.ts
|
|
22079
22193
|
import { existsSync as existsSync32 } from "fs";
|
|
22080
22194
|
import { mkdir as mkdir10, rm as rm5 } from "fs/promises";
|
|
22081
|
-
import { basename as basename16, dirname as dirname24, extname as
|
|
22195
|
+
import { basename as basename16, dirname as dirname24, extname as extname13, join as join41, resolve as resolve31 } from "path";
|
|
22082
22196
|
var {build: bunBuild2, Transpiler: Transpiler5, write: write5, file: file4 } = globalThis.Bun;
|
|
22083
22197
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
22084
22198
|
if (cachedPreprocessor)
|
|
@@ -22087,7 +22201,7 @@ var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
|
22087
22201
|
cachedPreprocessor = new module.Preprocessor;
|
|
22088
22202
|
return cachedPreprocessor;
|
|
22089
22203
|
}, transpiler6, isTemplateTagFile = (entry) => {
|
|
22090
|
-
const ext =
|
|
22204
|
+
const ext = extname13(entry);
|
|
22091
22205
|
return ext === ".gjs" || ext === ".gts";
|
|
22092
22206
|
}, rewriteTemplateEvalToScope = (source) => {
|
|
22093
22207
|
const importedNames = new Set;
|
|
@@ -22174,7 +22288,7 @@ export const importSync = (specifier) => {
|
|
|
22174
22288
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
22175
22289
|
if (!originalImporter)
|
|
22176
22290
|
return;
|
|
22177
|
-
const candidateBase =
|
|
22291
|
+
const candidateBase = resolve31(dirname24(originalImporter), args.path);
|
|
22178
22292
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
22179
22293
|
for (const ext of extensionsToTry) {
|
|
22180
22294
|
const candidate = candidateBase + ext;
|
|
@@ -22197,7 +22311,7 @@ export const importSync = (specifier) => {
|
|
|
22197
22311
|
build.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
22198
22312
|
if (standalonePackages.has(args.path))
|
|
22199
22313
|
return;
|
|
22200
|
-
const internal =
|
|
22314
|
+
const internal = join41(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
22201
22315
|
if (existsSync32(internal))
|
|
22202
22316
|
return { path: internal };
|
|
22203
22317
|
return;
|
|
@@ -22233,7 +22347,7 @@ export const renderToHTML = (props = {}) => {
|
|
|
22233
22347
|
export { PageComponent };
|
|
22234
22348
|
export default PageComponent;
|
|
22235
22349
|
`, compileEmberFile = async (entry, compiledRoot, cwd = process.cwd()) => {
|
|
22236
|
-
const resolvedEntry =
|
|
22350
|
+
const resolvedEntry = resolve31(entry);
|
|
22237
22351
|
const source = await file4(resolvedEntry).text();
|
|
22238
22352
|
let preprocessed = source;
|
|
22239
22353
|
if (isTemplateTagFile(resolvedEntry)) {
|
|
@@ -22245,16 +22359,16 @@ export default PageComponent;
|
|
|
22245
22359
|
}
|
|
22246
22360
|
const transpiled = transpiler6.transformSync(preprocessed);
|
|
22247
22361
|
const baseName = basename16(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
22248
|
-
const tmpDir =
|
|
22249
|
-
const serverDir =
|
|
22250
|
-
const clientDir =
|
|
22362
|
+
const tmpDir = join41(compiledRoot, "_tmp");
|
|
22363
|
+
const serverDir = join41(compiledRoot, "server");
|
|
22364
|
+
const clientDir = join41(compiledRoot, "client");
|
|
22251
22365
|
await Promise.all([
|
|
22252
22366
|
mkdir10(tmpDir, { recursive: true }),
|
|
22253
22367
|
mkdir10(serverDir, { recursive: true }),
|
|
22254
22368
|
mkdir10(clientDir, { recursive: true })
|
|
22255
22369
|
]);
|
|
22256
|
-
const tmpPagePath =
|
|
22257
|
-
const tmpHarnessPath =
|
|
22370
|
+
const tmpPagePath = resolve31(join41(tmpDir, `${baseName}.module.js`));
|
|
22371
|
+
const tmpHarnessPath = resolve31(join41(tmpDir, `${baseName}.harness.js`));
|
|
22258
22372
|
await Promise.all([
|
|
22259
22373
|
write5(tmpPagePath, transpiled),
|
|
22260
22374
|
write5(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -22262,7 +22376,7 @@ export default PageComponent;
|
|
|
22262
22376
|
const stagedSourceMap = new Map([
|
|
22263
22377
|
[tmpPagePath, resolvedEntry]
|
|
22264
22378
|
]);
|
|
22265
|
-
const serverPath =
|
|
22379
|
+
const serverPath = join41(serverDir, `${baseName}.js`);
|
|
22266
22380
|
const buildResult = await bunBuild2({
|
|
22267
22381
|
entrypoints: [tmpHarnessPath],
|
|
22268
22382
|
format: "esm",
|
|
@@ -22279,7 +22393,7 @@ export default PageComponent;
|
|
|
22279
22393
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
22280
22394
|
}
|
|
22281
22395
|
await rm5(tmpDir, { force: true, recursive: true });
|
|
22282
|
-
const clientPath =
|
|
22396
|
+
const clientPath = join41(clientDir, `${baseName}.js`);
|
|
22283
22397
|
await write5(clientPath, transpiled);
|
|
22284
22398
|
return { clientPath, serverPath };
|
|
22285
22399
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -22310,26 +22424,35 @@ var init_compileEmber = __esm(() => {
|
|
|
22310
22424
|
});
|
|
22311
22425
|
});
|
|
22312
22426
|
|
|
22427
|
+
// src/build/importFromProject.ts
|
|
22428
|
+
var importFromProject = (specifier, projectRoot = process.cwd()) => {
|
|
22429
|
+
let target = specifier;
|
|
22430
|
+
try {
|
|
22431
|
+
target = Bun.resolveSync(specifier, projectRoot);
|
|
22432
|
+
} catch {}
|
|
22433
|
+
return import(target);
|
|
22434
|
+
};
|
|
22435
|
+
|
|
22313
22436
|
// src/build/buildReactVendor.ts
|
|
22314
22437
|
import { existsSync as existsSync33, mkdirSync as mkdirSync8 } from "fs";
|
|
22315
|
-
import { join as
|
|
22438
|
+
import { join as join42, resolve as resolve32 } from "path";
|
|
22316
22439
|
import { rm as rm6 } from "fs/promises";
|
|
22317
22440
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
22318
22441
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
22319
22442
|
const candidates = [
|
|
22320
|
-
|
|
22321
|
-
|
|
22322
|
-
|
|
22323
|
-
|
|
22324
|
-
|
|
22325
|
-
|
|
22443
|
+
resolve32(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
22444
|
+
resolve32(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
22445
|
+
resolve32(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
22446
|
+
resolve32(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
22447
|
+
resolve32(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
22448
|
+
resolve32(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
22326
22449
|
];
|
|
22327
22450
|
for (const candidate of candidates) {
|
|
22328
22451
|
if (existsSync33(candidate)) {
|
|
22329
22452
|
return candidate.replace(/\\/g, "/");
|
|
22330
22453
|
}
|
|
22331
22454
|
}
|
|
22332
|
-
return (candidates[0] ??
|
|
22455
|
+
return (candidates[0] ?? resolve32(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
22333
22456
|
}, jsxDevRuntimeCompatPath, jsxRuntimeCompatPath, reactSpecifiers, toSafeFileName = (specifier) => specifier.replace(/\//g, "_"), computeVendorPaths = () => {
|
|
22334
22457
|
const paths = {};
|
|
22335
22458
|
for (const specifier of reactSpecifiers) {
|
|
@@ -22349,7 +22472,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
22349
22472
|
return `export * from '${reactRefreshRuntimePath}';
|
|
22350
22473
|
`;
|
|
22351
22474
|
}
|
|
22352
|
-
const mod = await
|
|
22475
|
+
const mod = await importFromProject(specifier);
|
|
22353
22476
|
const exportNames = Object.keys(mod).filter((key) => key !== "default" && key !== "__esModule");
|
|
22354
22477
|
const lines = [];
|
|
22355
22478
|
if (exportNames.length > 0) {
|
|
@@ -22362,14 +22485,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
22362
22485
|
`)}
|
|
22363
22486
|
`;
|
|
22364
22487
|
}, buildReactVendor = async (buildDir, { production = false } = {}) => {
|
|
22365
|
-
const vendorDir =
|
|
22488
|
+
const vendorDir = join42(buildDir, "react", "vendor");
|
|
22366
22489
|
mkdirSync8(vendorDir, { recursive: true });
|
|
22367
|
-
const tmpDir =
|
|
22490
|
+
const tmpDir = join42(buildDir, "_vendor_tmp");
|
|
22368
22491
|
mkdirSync8(tmpDir, { recursive: true });
|
|
22369
22492
|
const specifiers = reactSpecifiers;
|
|
22370
22493
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
22371
22494
|
const safeName = toSafeFileName(specifier);
|
|
22372
|
-
const entryPath =
|
|
22495
|
+
const entryPath = join42(tmpDir, `${safeName}.ts`);
|
|
22373
22496
|
const source = await generateEntrySource(specifier);
|
|
22374
22497
|
await Bun.write(entryPath, source);
|
|
22375
22498
|
return entryPath;
|
|
@@ -22406,7 +22529,7 @@ var init_buildReactVendor = __esm(() => {
|
|
|
22406
22529
|
|
|
22407
22530
|
// src/build/vendorEntrySource.ts
|
|
22408
22531
|
var RESERVED_KEYS, VALID_IDENTIFIER, generateVendorEntrySource = async (specifier) => {
|
|
22409
|
-
const mod = await
|
|
22532
|
+
const mod = await importFromProject(specifier);
|
|
22410
22533
|
const exportKeys = Object.keys(mod).filter((key) => !RESERVED_KEYS.has(key) && VALID_IDENTIFIER.test(key));
|
|
22411
22534
|
const localBindings = exportKeys.map((key, i) => `const __abs_${i} = __abs_ns[${JSON.stringify(key)}];`).join(`
|
|
22412
22535
|
`);
|
|
@@ -22415,7 +22538,7 @@ var RESERVED_KEYS, VALID_IDENTIFIER, generateVendorEntrySource = async (specifie
|
|
|
22415
22538
|
return `import * as __abs_ns from '${specifier}';
|
|
22416
22539
|
` + (localBindings ? `${localBindings}
|
|
22417
22540
|
` : "") + reExportClause + `export default __abs_ns.default;
|
|
22418
|
-
export const __ABSOLUTE_VENDOR_NAMESPACE__ = __abs_ns;
|
|
22541
|
+
` + `export const __ABSOLUTE_VENDOR_NAMESPACE__ = __abs_ns;
|
|
22419
22542
|
`;
|
|
22420
22543
|
};
|
|
22421
22544
|
var init_vendorEntrySource = __esm(() => {
|
|
@@ -22429,7 +22552,7 @@ var init_vendorEntrySource = __esm(() => {
|
|
|
22429
22552
|
|
|
22430
22553
|
// src/build/buildAngularVendor.ts
|
|
22431
22554
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
22432
|
-
import { join as
|
|
22555
|
+
import { join as join43 } from "path";
|
|
22433
22556
|
import { rm as rm7 } from "fs/promises";
|
|
22434
22557
|
var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
|
|
22435
22558
|
var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => jitMode ? [...REQUIRED_ANGULAR_SPECIFIERS_BASE, "@angular/compiler"] : REQUIRED_ANGULAR_SPECIFIERS_BASE, SERVER_ONLY_ANGULAR_SPECIFIERS, BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES, isBuildOnlyAngularSpecifier = (spec) => BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES.some((prefix) => spec === prefix || spec.startsWith(`${prefix}/`)), SCAN_SKIP_DIRS, isResolvable = (specifier) => {
|
|
@@ -22526,14 +22649,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
22526
22649
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
22527
22650
|
return Array.from(angular).filter(isResolvable);
|
|
22528
22651
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
22529
|
-
const vendorDir =
|
|
22652
|
+
const vendorDir = join43(buildDir, "angular", "vendor");
|
|
22530
22653
|
mkdirSync9(vendorDir, { recursive: true });
|
|
22531
|
-
const tmpDir =
|
|
22654
|
+
const tmpDir = join43(buildDir, "_angular_vendor_tmp");
|
|
22532
22655
|
mkdirSync9(tmpDir, { recursive: true });
|
|
22533
22656
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
22534
22657
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
22535
22658
|
const safeName = toSafeFileName2(specifier);
|
|
22536
|
-
const entryPath =
|
|
22659
|
+
const entryPath = join43(tmpDir, `${safeName}.ts`);
|
|
22537
22660
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
22538
22661
|
return entryPath;
|
|
22539
22662
|
}));
|
|
@@ -22564,9 +22687,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
22564
22687
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
22565
22688
|
return computeAngularVendorPaths(specifiers);
|
|
22566
22689
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
22567
|
-
const vendorDir =
|
|
22690
|
+
const vendorDir = join43(buildDir, "angular", "vendor", "server");
|
|
22568
22691
|
mkdirSync9(vendorDir, { recursive: true });
|
|
22569
|
-
const tmpDir =
|
|
22692
|
+
const tmpDir = join43(buildDir, "_angular_server_vendor_tmp");
|
|
22570
22693
|
mkdirSync9(tmpDir, { recursive: true });
|
|
22571
22694
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
22572
22695
|
const allSpecs = new Set(browserSpecs);
|
|
@@ -22577,7 +22700,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
22577
22700
|
const specifiers = Array.from(allSpecs);
|
|
22578
22701
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
22579
22702
|
const safeName = toSafeFileName2(specifier);
|
|
22580
|
-
const entryPath =
|
|
22703
|
+
const entryPath = join43(tmpDir, `${safeName}.ts`);
|
|
22581
22704
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
22582
22705
|
return entryPath;
|
|
22583
22706
|
}));
|
|
@@ -22599,9 +22722,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
22599
22722
|
return specifiers;
|
|
22600
22723
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
22601
22724
|
const paths = {};
|
|
22602
|
-
const vendorDir =
|
|
22725
|
+
const vendorDir = join43(buildDir, "angular", "vendor", "server");
|
|
22603
22726
|
for (const specifier of specifiers) {
|
|
22604
|
-
paths[specifier] =
|
|
22727
|
+
paths[specifier] = join43(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
22605
22728
|
}
|
|
22606
22729
|
return paths;
|
|
22607
22730
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -22652,17 +22775,17 @@ var init_buildAngularVendor = __esm(() => {
|
|
|
22652
22775
|
|
|
22653
22776
|
// src/build/buildVueVendor.ts
|
|
22654
22777
|
import { mkdirSync as mkdirSync10 } from "fs";
|
|
22655
|
-
import { join as
|
|
22778
|
+
import { join as join44 } from "path";
|
|
22656
22779
|
import { rm as rm8 } from "fs/promises";
|
|
22657
22780
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
22658
22781
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
22659
|
-
const vendorDir =
|
|
22782
|
+
const vendorDir = join44(buildDir, "vue", "vendor");
|
|
22660
22783
|
mkdirSync10(vendorDir, { recursive: true });
|
|
22661
|
-
const tmpDir =
|
|
22784
|
+
const tmpDir = join44(buildDir, "_vue_vendor_tmp");
|
|
22662
22785
|
mkdirSync10(tmpDir, { recursive: true });
|
|
22663
22786
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
22664
22787
|
const safeName = toSafeFileName3(specifier);
|
|
22665
|
-
const entryPath =
|
|
22788
|
+
const entryPath = join44(tmpDir, `${safeName}.ts`);
|
|
22666
22789
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
22667
22790
|
`);
|
|
22668
22791
|
return entryPath;
|
|
@@ -22690,7 +22813,7 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
22690
22813
|
const { readFileSync, writeFileSync, readdirSync } = await import("fs");
|
|
22691
22814
|
const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
22692
22815
|
for (const file of files) {
|
|
22693
|
-
const filePath =
|
|
22816
|
+
const filePath = join44(vendorDir, file);
|
|
22694
22817
|
const content = readFileSync(filePath, "utf-8");
|
|
22695
22818
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
22696
22819
|
continue;
|
|
@@ -22712,7 +22835,7 @@ var init_buildVueVendor = __esm(() => {
|
|
|
22712
22835
|
|
|
22713
22836
|
// src/build/buildSvelteVendor.ts
|
|
22714
22837
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
22715
|
-
import { join as
|
|
22838
|
+
import { join as join45 } from "path";
|
|
22716
22839
|
import { rm as rm9 } from "fs/promises";
|
|
22717
22840
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
22718
22841
|
var svelteSpecifiers, isResolvable2 = (specifier) => {
|
|
@@ -22726,13 +22849,13 @@ var svelteSpecifiers, isResolvable2 = (specifier) => {
|
|
|
22726
22849
|
const specifiers = resolveVendorSpecifiers();
|
|
22727
22850
|
if (specifiers.length === 0)
|
|
22728
22851
|
return;
|
|
22729
|
-
const vendorDir =
|
|
22852
|
+
const vendorDir = join45(buildDir, "svelte", "vendor");
|
|
22730
22853
|
mkdirSync11(vendorDir, { recursive: true });
|
|
22731
|
-
const tmpDir =
|
|
22854
|
+
const tmpDir = join45(buildDir, "_svelte_vendor_tmp");
|
|
22732
22855
|
mkdirSync11(tmpDir, { recursive: true });
|
|
22733
22856
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
22734
22857
|
const safeName = toSafeFileName4(specifier);
|
|
22735
|
-
const entryPath =
|
|
22858
|
+
const entryPath = join45(tmpDir, `${safeName}.ts`);
|
|
22736
22859
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
22737
22860
|
`);
|
|
22738
22861
|
return entryPath;
|
|
@@ -22783,7 +22906,7 @@ import {
|
|
|
22783
22906
|
statSync as statSync5,
|
|
22784
22907
|
writeFileSync as writeFileSync9
|
|
22785
22908
|
} from "fs";
|
|
22786
|
-
import { basename as basename17, dirname as dirname25, extname as
|
|
22909
|
+
import { basename as basename17, dirname as dirname25, extname as extname14, join as join46, relative as relative20, resolve as resolve33 } from "path";
|
|
22787
22910
|
import { cwd, env as env2, exit } from "process";
|
|
22788
22911
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
22789
22912
|
var isBuildTraceEnabled = () => {
|
|
@@ -22917,8 +23040,8 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
22917
23040
|
mkdirSync12(htmxDestDir, { recursive: true });
|
|
22918
23041
|
const glob = new Glob8("htmx*.min.js");
|
|
22919
23042
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
22920
|
-
const src =
|
|
22921
|
-
const dest =
|
|
23043
|
+
const src = join46(htmxDir, relPath);
|
|
23044
|
+
const dest = join46(htmxDestDir, "htmx.min.js");
|
|
22922
23045
|
copyFileSync3(src, dest);
|
|
22923
23046
|
return;
|
|
22924
23047
|
}
|
|
@@ -22932,8 +23055,8 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
22932
23055
|
if (globalThis.__absoluteVersion)
|
|
22933
23056
|
return;
|
|
22934
23057
|
const candidates = [
|
|
22935
|
-
|
|
22936
|
-
|
|
23058
|
+
resolve33(import.meta.dir, "..", "..", "package.json"),
|
|
23059
|
+
resolve33(import.meta.dir, "..", "package.json")
|
|
22937
23060
|
];
|
|
22938
23061
|
const resolveCandidate = async (remaining) => {
|
|
22939
23062
|
const [candidate, ...rest] = remaining;
|
|
@@ -22949,7 +23072,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
22949
23072
|
};
|
|
22950
23073
|
await resolveCandidate(candidates);
|
|
22951
23074
|
}, SKIP_DIRS5, addWorkerPathIfExists = (file, relPath, workerPaths) => {
|
|
22952
|
-
const absPath =
|
|
23075
|
+
const absPath = resolve33(file, "..", relPath);
|
|
22953
23076
|
try {
|
|
22954
23077
|
statSync5(absPath);
|
|
22955
23078
|
workerPaths.add(absPath);
|
|
@@ -23002,7 +23125,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23002
23125
|
const out = [];
|
|
23003
23126
|
const directories = [];
|
|
23004
23127
|
for (const entry of entries) {
|
|
23005
|
-
const full =
|
|
23128
|
+
const full = join46(dir, entry.name);
|
|
23006
23129
|
if (entry.isDirectory()) {
|
|
23007
23130
|
directories.push(full);
|
|
23008
23131
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -23028,7 +23151,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23028
23151
|
vuePagesPath
|
|
23029
23152
|
}) => {
|
|
23030
23153
|
const { readdirSync: readDir } = await import("fs");
|
|
23031
|
-
const devIndexDir =
|
|
23154
|
+
const devIndexDir = join46(buildPath, "_src_indexes");
|
|
23032
23155
|
mkdirSync12(devIndexDir, { recursive: true });
|
|
23033
23156
|
if (reactIndexesPath && reactPagesPath) {
|
|
23034
23157
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -23044,42 +23167,42 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23044
23167
|
return;
|
|
23045
23168
|
}
|
|
23046
23169
|
const indexFiles = readDir(reactIndexesPath).filter((file) => file.endsWith(".tsx"));
|
|
23047
|
-
const pagesRel =
|
|
23170
|
+
const pagesRel = relative20(process.cwd(), resolve33(reactPagesPath)).replace(/\\/g, "/");
|
|
23048
23171
|
for (const file of indexFiles) {
|
|
23049
|
-
let content = readFileSync27(
|
|
23172
|
+
let content = readFileSync27(join46(reactIndexesPath, file), "utf-8");
|
|
23050
23173
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
23051
|
-
writeFileSync9(
|
|
23174
|
+
writeFileSync9(join46(devIndexDir, file), content);
|
|
23052
23175
|
}
|
|
23053
23176
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
23054
|
-
const svelteIndexDir =
|
|
23055
|
-
const sveltePageEntries = svelteEntries.filter((file) =>
|
|
23177
|
+
const svelteIndexDir = join46(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
23178
|
+
const sveltePageEntries = svelteEntries.filter((file) => resolve33(file).startsWith(resolve33(sveltePagesPath)));
|
|
23056
23179
|
for (const entry of sveltePageEntries) {
|
|
23057
23180
|
const name = basename17(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
23058
|
-
const indexFile =
|
|
23181
|
+
const indexFile = join46(svelteIndexDir, "pages", `${name}.js`);
|
|
23059
23182
|
if (!existsSync34(indexFile))
|
|
23060
23183
|
continue;
|
|
23061
23184
|
let content = readFileSync27(indexFile, "utf-8");
|
|
23062
|
-
const srcRel =
|
|
23185
|
+
const srcRel = relative20(process.cwd(), resolve33(entry)).replace(/\\/g, "/");
|
|
23063
23186
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
23064
|
-
writeFileSync9(
|
|
23187
|
+
writeFileSync9(join46(devIndexDir, `${name}.svelte.js`), content);
|
|
23065
23188
|
}
|
|
23066
23189
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
23067
|
-
const vueIndexDir =
|
|
23068
|
-
const vuePageEntries = vueEntries.filter((file) =>
|
|
23190
|
+
const vueIndexDir = join46(getFrameworkGeneratedDir("vue"), "indexes");
|
|
23191
|
+
const vuePageEntries = vueEntries.filter((file) => resolve33(file).startsWith(resolve33(vuePagesPath)));
|
|
23069
23192
|
for (const entry of vuePageEntries) {
|
|
23070
23193
|
const name = basename17(entry, ".vue");
|
|
23071
|
-
const indexFile =
|
|
23194
|
+
const indexFile = join46(vueIndexDir, `${name}.js`);
|
|
23072
23195
|
if (!existsSync34(indexFile))
|
|
23073
23196
|
continue;
|
|
23074
23197
|
let content = readFileSync27(indexFile, "utf-8");
|
|
23075
|
-
const srcRel =
|
|
23198
|
+
const srcRel = relative20(process.cwd(), resolve33(entry)).replace(/\\/g, "/");
|
|
23076
23199
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
23077
|
-
writeFileSync9(
|
|
23200
|
+
writeFileSync9(join46(devIndexDir, `${name}.vue.js`), content);
|
|
23078
23201
|
}
|
|
23079
23202
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
23080
23203
|
const urlFileMap = new Map;
|
|
23081
23204
|
for (const srcPath of urlReferencedFiles) {
|
|
23082
|
-
const rel =
|
|
23205
|
+
const rel = relative20(projectRoot, srcPath).replace(/\\/g, "/");
|
|
23083
23206
|
const name = basename17(srcPath);
|
|
23084
23207
|
const mtime = Math.round(statSync5(srcPath).mtimeMs);
|
|
23085
23208
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -23094,7 +23217,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23094
23217
|
const output = nonReactClientOutputs.find((artifact) => basename17(artifact.path).startsWith(`${srcBase}.`));
|
|
23095
23218
|
if (!output)
|
|
23096
23219
|
continue;
|
|
23097
|
-
urlFileMap.set(basename17(srcPath), `/${
|
|
23220
|
+
urlFileMap.set(basename17(srcPath), `/${relative20(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
23098
23221
|
}
|
|
23099
23222
|
return urlFileMap;
|
|
23100
23223
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -23235,10 +23358,10 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23235
23358
|
restoreTracePhase();
|
|
23236
23359
|
return;
|
|
23237
23360
|
}
|
|
23238
|
-
const traceDir =
|
|
23361
|
+
const traceDir = join46(buildPath, ".absolute-trace");
|
|
23239
23362
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
23240
23363
|
mkdirSync12(traceDir, { recursive: true });
|
|
23241
|
-
writeFileSync9(
|
|
23364
|
+
writeFileSync9(join46(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
23242
23365
|
events: traceEvents,
|
|
23243
23366
|
frameworks: traceFrameworkNames,
|
|
23244
23367
|
generatedAt: new Date().toISOString(),
|
|
@@ -23269,16 +23392,16 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23269
23392
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
23270
23393
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
23271
23394
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
23272
|
-
const reactIndexesPath = reactDir &&
|
|
23273
|
-
const reactPagesPath = reactDir &&
|
|
23274
|
-
const htmlPagesPath = htmlDir &&
|
|
23275
|
-
const htmlScriptsPath = htmlDir &&
|
|
23276
|
-
const sveltePagesPath = svelteDir &&
|
|
23277
|
-
const vuePagesPath = vueDir &&
|
|
23278
|
-
const htmxPagesPath = htmxDir &&
|
|
23279
|
-
const htmxScriptsPath = htmxDir &&
|
|
23280
|
-
const angularPagesPath = angularDir &&
|
|
23281
|
-
const emberPagesPath = emberDir &&
|
|
23395
|
+
const reactIndexesPath = reactDir && join46(getFrameworkGeneratedDir("react"), "indexes");
|
|
23396
|
+
const reactPagesPath = reactDir && join46(reactDir, "pages");
|
|
23397
|
+
const htmlPagesPath = htmlDir && join46(htmlDir, "pages");
|
|
23398
|
+
const htmlScriptsPath = htmlDir && join46(htmlDir, "scripts");
|
|
23399
|
+
const sveltePagesPath = svelteDir && join46(svelteDir, "pages");
|
|
23400
|
+
const vuePagesPath = vueDir && join46(vueDir, "pages");
|
|
23401
|
+
const htmxPagesPath = htmxDir && join46(htmxDir, "pages");
|
|
23402
|
+
const htmxScriptsPath = htmxDir && join46(htmxDir, "scripts");
|
|
23403
|
+
const angularPagesPath = angularDir && join46(angularDir, "pages");
|
|
23404
|
+
const emberPagesPath = emberDir && join46(emberDir, "pages");
|
|
23282
23405
|
const frontends = [
|
|
23283
23406
|
reactDir,
|
|
23284
23407
|
htmlDir,
|
|
@@ -23339,8 +23462,8 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23339
23462
|
const [firstEntry] = serverDirMap;
|
|
23340
23463
|
if (!firstEntry)
|
|
23341
23464
|
throw new Error("Expected at least one server directory entry");
|
|
23342
|
-
serverRoot =
|
|
23343
|
-
serverOutDir =
|
|
23465
|
+
serverRoot = join46(firstEntry.dir, firstEntry.subdir);
|
|
23466
|
+
serverOutDir = join46(buildPath, basename17(firstEntry.dir));
|
|
23344
23467
|
} else if (serverDirMap.length > 1) {
|
|
23345
23468
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
23346
23469
|
serverOutDir = buildPath;
|
|
@@ -23359,13 +23482,13 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23359
23482
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
23360
23483
|
if (!isIncremental || !incrementalFiles)
|
|
23361
23484
|
return entryPoints;
|
|
23362
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f) =>
|
|
23485
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f) => resolve33(f)));
|
|
23363
23486
|
const matchingEntries = [];
|
|
23364
23487
|
for (const entry of entryPoints) {
|
|
23365
23488
|
const sourceFile = mapToSource(entry);
|
|
23366
23489
|
if (!sourceFile)
|
|
23367
23490
|
continue;
|
|
23368
|
-
if (!normalizedIncremental.has(
|
|
23491
|
+
if (!normalizedIncremental.has(resolve33(sourceFile)))
|
|
23369
23492
|
continue;
|
|
23370
23493
|
matchingEntries.push(entry);
|
|
23371
23494
|
}
|
|
@@ -23375,7 +23498,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23375
23498
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
23376
23499
|
}
|
|
23377
23500
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/assets/")))) {
|
|
23378
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
23501
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join46(buildPath, "assets"), {
|
|
23379
23502
|
force: true,
|
|
23380
23503
|
recursive: true
|
|
23381
23504
|
}));
|
|
@@ -23489,11 +23612,11 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23489
23612
|
}
|
|
23490
23613
|
}
|
|
23491
23614
|
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
23492
|
-
const htmlConventionsOutDir =
|
|
23615
|
+
const htmlConventionsOutDir = join46(buildPath, "conventions", "html");
|
|
23493
23616
|
mkdirSync12(htmlConventionsOutDir, { recursive: true });
|
|
23494
23617
|
const htmlPathRemap = new Map;
|
|
23495
23618
|
for (const sourcePath of htmlConventionSources) {
|
|
23496
|
-
const dest =
|
|
23619
|
+
const dest = join46(htmlConventionsOutDir, basename17(sourcePath));
|
|
23497
23620
|
cpSync(sourcePath, dest, { force: true });
|
|
23498
23621
|
htmlPathRemap.set(sourcePath, dest);
|
|
23499
23622
|
}
|
|
@@ -23541,13 +23664,13 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23541
23664
|
return scoped;
|
|
23542
23665
|
return scoped.filter((entry) => {
|
|
23543
23666
|
const source = mapToSource(entry);
|
|
23544
|
-
return source !== null && deferPageEntries.except.has(
|
|
23667
|
+
return source !== null && deferPageEntries.except.has(resolve33(source));
|
|
23545
23668
|
});
|
|
23546
23669
|
};
|
|
23547
23670
|
const mapReactIndexToPage = (entry) => {
|
|
23548
|
-
if (reactIndexesPath && reactPagesPath && entry.startsWith(
|
|
23671
|
+
if (reactIndexesPath && reactPagesPath && entry.startsWith(resolve33(reactIndexesPath))) {
|
|
23549
23672
|
const pageName = basename17(entry, ".tsx");
|
|
23550
|
-
return
|
|
23673
|
+
return join46(reactPagesPath, `${pageName}.tsx`);
|
|
23551
23674
|
}
|
|
23552
23675
|
return null;
|
|
23553
23676
|
};
|
|
@@ -23587,7 +23710,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23587
23710
|
for (const entry of vueEntries) {
|
|
23588
23711
|
const name = basename17(entry, ".vue");
|
|
23589
23712
|
if (ssrOnlyPageNames.has(name)) {
|
|
23590
|
-
resolved.add(
|
|
23713
|
+
resolved.add(resolve33(entry));
|
|
23591
23714
|
}
|
|
23592
23715
|
}
|
|
23593
23716
|
return resolved;
|
|
@@ -23700,7 +23823,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23700
23823
|
const clientPath = islandSvelteClientPaths[idx];
|
|
23701
23824
|
if (!sourcePath || !clientPath)
|
|
23702
23825
|
continue;
|
|
23703
|
-
islandSvelteClientPathMap.set(
|
|
23826
|
+
islandSvelteClientPathMap.set(resolve33(sourcePath), clientPath);
|
|
23704
23827
|
}
|
|
23705
23828
|
const islandVueClientPathMap = new Map;
|
|
23706
23829
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -23708,7 +23831,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23708
23831
|
const clientPath = islandVueClientPaths[idx];
|
|
23709
23832
|
if (!sourcePath || !clientPath)
|
|
23710
23833
|
continue;
|
|
23711
|
-
islandVueClientPathMap.set(
|
|
23834
|
+
islandVueClientPathMap.set(resolve33(sourcePath), clientPath);
|
|
23712
23835
|
}
|
|
23713
23836
|
const islandAngularClientPathMap = new Map;
|
|
23714
23837
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -23716,7 +23839,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23716
23839
|
const clientPath = islandAngularClientPaths[idx];
|
|
23717
23840
|
if (!sourcePath || !clientPath)
|
|
23718
23841
|
continue;
|
|
23719
|
-
islandAngularClientPathMap.set(
|
|
23842
|
+
islandAngularClientPathMap.set(resolve33(sourcePath), clientPath);
|
|
23720
23843
|
}
|
|
23721
23844
|
const reactConventionSources = collectConventionSourceFiles(conventionsMap.react);
|
|
23722
23845
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
@@ -23727,7 +23850,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23727
23850
|
const compileReactConventions = async () => {
|
|
23728
23851
|
if (reactConventionSources.length === 0)
|
|
23729
23852
|
return emptyStringArray;
|
|
23730
|
-
const destDir =
|
|
23853
|
+
const destDir = join46(buildPath, "conventions", "react");
|
|
23731
23854
|
rmSync2(destDir, { force: true, recursive: true });
|
|
23732
23855
|
mkdirSync12(destDir, { recursive: true });
|
|
23733
23856
|
const destPaths = await Promise.all(reactConventionSources.map(async (source, idx) => {
|
|
@@ -23771,7 +23894,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23771
23894
|
angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), {})).then((mod) => compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
|
|
23772
23895
|
]);
|
|
23773
23896
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
23774
|
-
const destDir =
|
|
23897
|
+
const destDir = join46(buildPath, "conventions", framework);
|
|
23775
23898
|
rmSync2(destDir, { force: true, recursive: true });
|
|
23776
23899
|
mkdirSync12(destDir, { recursive: true });
|
|
23777
23900
|
const destPaths = await Promise.all(compiledPaths.map(async (compiledPath, idx) => {
|
|
@@ -23846,7 +23969,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23846
23969
|
}
|
|
23847
23970
|
})) : {
|
|
23848
23971
|
entries: [],
|
|
23849
|
-
generatedRoot:
|
|
23972
|
+
generatedRoot: join46(buildPath, "_island_entries")
|
|
23850
23973
|
};
|
|
23851
23974
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
23852
23975
|
if (!deferPageEntries && serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && urlReferencedFiles.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -23882,7 +24005,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23882
24005
|
return {};
|
|
23883
24006
|
}
|
|
23884
24007
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
23885
|
-
const refreshEntry =
|
|
24008
|
+
const refreshEntry = join46(reactIndexesPath, "_refresh.tsx");
|
|
23886
24009
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
23887
24010
|
reactClientEntryPoints.push(refreshEntry);
|
|
23888
24011
|
}
|
|
@@ -23994,19 +24117,19 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
23994
24117
|
throw: false
|
|
23995
24118
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
23996
24119
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
23997
|
-
rmSync2(
|
|
24120
|
+
rmSync2(join46(buildPath, "react", "generated", "indexes"), {
|
|
23998
24121
|
force: true,
|
|
23999
24122
|
recursive: true
|
|
24000
24123
|
});
|
|
24001
24124
|
}
|
|
24002
24125
|
if (angularDir && angularClientPaths.length > 0) {
|
|
24003
|
-
rmSync2(
|
|
24126
|
+
rmSync2(join46(buildPath, "angular", "indexes"), {
|
|
24004
24127
|
force: true,
|
|
24005
24128
|
recursive: true
|
|
24006
24129
|
});
|
|
24007
24130
|
}
|
|
24008
24131
|
if (islandClientEntryPoints.length > 0) {
|
|
24009
|
-
rmSync2(
|
|
24132
|
+
rmSync2(join46(buildPath, "islands"), {
|
|
24010
24133
|
force: true,
|
|
24011
24134
|
recursive: true
|
|
24012
24135
|
});
|
|
@@ -24121,7 +24244,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24121
24244
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
24122
24245
|
entrypoints: globalCssEntries,
|
|
24123
24246
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
24124
|
-
outdir: stylesDir ?
|
|
24247
|
+
outdir: stylesDir ? join46(buildPath, basename17(stylesDir)) : buildPath,
|
|
24125
24248
|
plugins: [stylePreprocessorPlugin],
|
|
24126
24249
|
root: stylesDir || clientRoot,
|
|
24127
24250
|
target: "browser",
|
|
@@ -24130,7 +24253,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24130
24253
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
24131
24254
|
entrypoints: vueCssPaths,
|
|
24132
24255
|
naming: `[name].[hash].[ext]`,
|
|
24133
|
-
outdir:
|
|
24256
|
+
outdir: join46(buildPath, assetsPath ? basename17(assetsPath) : "assets", "css"),
|
|
24134
24257
|
target: "browser",
|
|
24135
24258
|
throw: false
|
|
24136
24259
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -24152,15 +24275,15 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24152
24275
|
}
|
|
24153
24276
|
if (!isDev && resolveClientSourcemap(sourcemaps, isDev) === "external") {
|
|
24154
24277
|
await Promise.resolve().then(() => init_chainInlineSourcemaps());
|
|
24155
|
-
const sourcemapDir =
|
|
24278
|
+
const sourcemapDir = join46(projectRoot, "sourcemaps");
|
|
24156
24279
|
mkdirSync12(sourcemapDir, { recursive: true });
|
|
24157
24280
|
const mapFiles = readdirSync7(buildPath, {
|
|
24158
24281
|
encoding: "utf8",
|
|
24159
24282
|
recursive: true
|
|
24160
|
-
}).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) =>
|
|
24283
|
+
}).filter((entry) => entry.endsWith(".js.map") && !entry.includes("node_modules")).map((entry) => join46(buildPath, entry));
|
|
24161
24284
|
for (const mapPath of mapFiles) {
|
|
24162
24285
|
chainExternalSourcemap(mapPath);
|
|
24163
|
-
renameSync(mapPath,
|
|
24286
|
+
renameSync(mapPath, join46(sourcemapDir, basename17(mapPath)));
|
|
24164
24287
|
const jsPath = mapPath.slice(0, -4);
|
|
24165
24288
|
try {
|
|
24166
24289
|
const javascript = readFileSync27(jsPath, "utf-8").replace(/\n?\/\/# sourceMappingURL=[^\n]*\s*$/, `
|
|
@@ -24168,7 +24291,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24168
24291
|
writeFileSync9(jsPath, javascript);
|
|
24169
24292
|
} catch {}
|
|
24170
24293
|
}
|
|
24171
|
-
console.info(`[absolute] sourcemaps: chained + privatized ${mapFiles.length} client maps \u2192 ${
|
|
24294
|
+
console.info(`[absolute] sourcemaps: chained + privatized ${mapFiles.length} client maps \u2192 ${relative20(projectRoot, sourcemapDir)}/`);
|
|
24172
24295
|
}
|
|
24173
24296
|
if (serverResult && !serverResult.success && serverLogs.length > 0) {
|
|
24174
24297
|
handlePassFailure(serverLogs, "server", "Server");
|
|
@@ -24225,7 +24348,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24225
24348
|
};
|
|
24226
24349
|
await tracePhase("postprocess/client-rewrite", rewriteClientGroups, clientRewriteStats);
|
|
24227
24350
|
if (!hmr) {
|
|
24228
|
-
const reactVendorDir =
|
|
24351
|
+
const reactVendorDir = join46(buildPath, "react", "vendor");
|
|
24229
24352
|
const vendorChunkPaths = existsSync34(reactVendorDir) ? [
|
|
24230
24353
|
...new Glob8("**/*.js").scanSync({
|
|
24231
24354
|
absolute: true,
|
|
@@ -24245,7 +24368,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24245
24368
|
const fileDir = dirname25(artifact.path);
|
|
24246
24369
|
const relativePaths = {};
|
|
24247
24370
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths)) {
|
|
24248
|
-
const rel =
|
|
24371
|
+
const rel = relative20(fileDir, absolute);
|
|
24249
24372
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
24250
24373
|
}
|
|
24251
24374
|
return relativePaths;
|
|
@@ -24301,7 +24424,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24301
24424
|
], buildPath)
|
|
24302
24425
|
};
|
|
24303
24426
|
for (const artifact of serverOutputs) {
|
|
24304
|
-
if (
|
|
24427
|
+
if (extname14(artifact.path) !== ".js")
|
|
24305
24428
|
continue;
|
|
24306
24429
|
const fileWithHash = basename17(artifact.path);
|
|
24307
24430
|
const [baseName] = fileWithHash.split(`.${artifact.hash}.`);
|
|
@@ -24321,7 +24444,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24321
24444
|
};
|
|
24322
24445
|
const cssByName = new Map;
|
|
24323
24446
|
for (const artifact of cssOutputs) {
|
|
24324
|
-
if (
|
|
24447
|
+
if (extname14(artifact.path) !== ".css")
|
|
24325
24448
|
continue;
|
|
24326
24449
|
const cssName = stripHash(basename17(artifact.path), artifact.hash);
|
|
24327
24450
|
if (cssName)
|
|
@@ -24331,7 +24454,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24331
24454
|
const siblingCssPaths = [];
|
|
24332
24455
|
const serverJsByPascalName = new Map;
|
|
24333
24456
|
await Promise.all(serverOutputs.map(async (artifact) => {
|
|
24334
|
-
if (
|
|
24457
|
+
if (extname14(artifact.path) !== ".js")
|
|
24335
24458
|
return;
|
|
24336
24459
|
const pascalName = stripHash(basename17(artifact.path), artifact.hash);
|
|
24337
24460
|
if (!pascalName)
|
|
@@ -24358,7 +24481,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24358
24481
|
if (skipAngularClientBundle) {
|
|
24359
24482
|
for (const clientPath of angularClientPaths) {
|
|
24360
24483
|
const fileBase = basename17(clientPath, ".js");
|
|
24361
|
-
const relFromCwd =
|
|
24484
|
+
const relFromCwd = relative20(projectRoot, clientPath).replace(/\\/g, "/");
|
|
24362
24485
|
manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
|
|
24363
24486
|
}
|
|
24364
24487
|
}
|
|
@@ -24381,7 +24504,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24381
24504
|
const processHtmlPages = async () => {
|
|
24382
24505
|
if (!(htmlDir && htmlPagesPath))
|
|
24383
24506
|
return;
|
|
24384
|
-
const outputHtmlPages = isSingle ?
|
|
24507
|
+
const outputHtmlPages = isSingle ? join46(buildPath, "pages") : join46(buildPath, basename17(htmlDir), "pages");
|
|
24385
24508
|
mkdirSync12(outputHtmlPages, { recursive: true });
|
|
24386
24509
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
24387
24510
|
force: true,
|
|
@@ -24408,14 +24531,14 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24408
24531
|
const processHtmxPages = async () => {
|
|
24409
24532
|
if (!(htmxDir && htmxPagesPath))
|
|
24410
24533
|
return;
|
|
24411
|
-
const outputHtmxPages = isSingle ?
|
|
24534
|
+
const outputHtmxPages = isSingle ? join46(buildPath, "pages") : join46(buildPath, basename17(htmxDir), "pages");
|
|
24412
24535
|
mkdirSync12(outputHtmxPages, { recursive: true });
|
|
24413
24536
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
24414
24537
|
force: true,
|
|
24415
24538
|
recursive: true
|
|
24416
24539
|
});
|
|
24417
24540
|
if (shouldCopyHtmx) {
|
|
24418
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
24541
|
+
const htmxDestDir = isSingle ? buildPath : join46(buildPath, basename17(htmxDir));
|
|
24419
24542
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
24420
24543
|
}
|
|
24421
24544
|
await updateAssetPaths(manifest, outputHtmxPages);
|
|
@@ -24504,7 +24627,7 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24504
24627
|
}))
|
|
24505
24628
|
];
|
|
24506
24629
|
setSpaRouteManifest(spaRouteHosts);
|
|
24507
|
-
writeFileSync9(
|
|
24630
|
+
writeFileSync9(join46(buildPath, "spa-routes.json"), JSON.stringify(spaRouteHosts, null, "\t"));
|
|
24508
24631
|
if (isIncremental) {
|
|
24509
24632
|
writeBuildTrace(buildPath);
|
|
24510
24633
|
return {
|
|
@@ -24515,9 +24638,9 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24515
24638
|
tailwindChanged: tailwindResult?.cssChanged ?? false
|
|
24516
24639
|
};
|
|
24517
24640
|
}
|
|
24518
|
-
writeFileSync9(
|
|
24641
|
+
writeFileSync9(join46(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
24519
24642
|
if (Object.keys(conventionsMap).length > 0) {
|
|
24520
|
-
writeFileSync9(
|
|
24643
|
+
writeFileSync9(join46(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
24521
24644
|
}
|
|
24522
24645
|
writeBuildTrace(buildPath);
|
|
24523
24646
|
if (mode === "production") {
|
|
@@ -24538,6 +24661,9 @@ ${offenders.map((o) => ` \u2022 ${o}`).join(`
|
|
|
24538
24661
|
console.warn("[sitemap] Build-time generation failed:", err);
|
|
24539
24662
|
}
|
|
24540
24663
|
}
|
|
24664
|
+
if (mode === "production") {
|
|
24665
|
+
await tracePhase("compress/assets", () => writePrecompressedAssets(buildPath));
|
|
24666
|
+
}
|
|
24541
24667
|
if (tailwind && mode === "production") {
|
|
24542
24668
|
disposeTailwindCompiler(tailwind.input);
|
|
24543
24669
|
}
|
|
@@ -24596,6 +24722,7 @@ var init_build = __esm(() => {
|
|
|
24596
24722
|
init_validateSafePath();
|
|
24597
24723
|
init_spaRouteManifest();
|
|
24598
24724
|
init_pwa();
|
|
24725
|
+
init_precompressed();
|
|
24599
24726
|
REACT_VENDOR_SPECIFIERS = [
|
|
24600
24727
|
"react-dom/client",
|
|
24601
24728
|
"react-refresh/runtime",
|
|
@@ -24637,7 +24764,7 @@ var init_build = __esm(() => {
|
|
|
24637
24764
|
|
|
24638
24765
|
// src/build/buildEmberVendor.ts
|
|
24639
24766
|
import { mkdirSync as mkdirSync13, existsSync as existsSync35 } from "fs";
|
|
24640
|
-
import { join as
|
|
24767
|
+
import { join as join47 } from "path";
|
|
24641
24768
|
import { rm as rm10 } from "fs/promises";
|
|
24642
24769
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
24643
24770
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -24689,7 +24816,7 @@ export const importSync = (specifier) => {
|
|
|
24689
24816
|
if (standaloneSpecifiers.has(specifier)) {
|
|
24690
24817
|
return { resolveTo: specifier, specifier };
|
|
24691
24818
|
}
|
|
24692
|
-
const emberInternalPath =
|
|
24819
|
+
const emberInternalPath = join47(cwd, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
24693
24820
|
if (!existsSync35(emberInternalPath)) {
|
|
24694
24821
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
24695
24822
|
}
|
|
@@ -24721,7 +24848,7 @@ export const importSync = (specifier) => {
|
|
|
24721
24848
|
if (standalonePackages.has(args.path)) {
|
|
24722
24849
|
return;
|
|
24723
24850
|
}
|
|
24724
|
-
const internal =
|
|
24851
|
+
const internal = join47(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
24725
24852
|
if (existsSync35(internal)) {
|
|
24726
24853
|
return { path: internal };
|
|
24727
24854
|
}
|
|
@@ -24729,16 +24856,16 @@ export const importSync = (specifier) => {
|
|
|
24729
24856
|
});
|
|
24730
24857
|
}
|
|
24731
24858
|
}), buildEmberVendor = async (buildDir, cwd = process.cwd()) => {
|
|
24732
|
-
const vendorDir =
|
|
24859
|
+
const vendorDir = join47(buildDir, "ember", "vendor");
|
|
24733
24860
|
mkdirSync13(vendorDir, { recursive: true });
|
|
24734
|
-
const tmpDir =
|
|
24861
|
+
const tmpDir = join47(buildDir, "_ember_vendor_tmp");
|
|
24735
24862
|
mkdirSync13(tmpDir, { recursive: true });
|
|
24736
|
-
const macrosShimPath =
|
|
24863
|
+
const macrosShimPath = join47(tmpDir, "embroider_macros_shim.js");
|
|
24737
24864
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
24738
24865
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd));
|
|
24739
24866
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
24740
24867
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
24741
|
-
const entryPath =
|
|
24868
|
+
const entryPath = join47(tmpDir, `${safeName}.js`);
|
|
24742
24869
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
24743
24870
|
` : generateVendorEntrySource2(resolution);
|
|
24744
24871
|
await Bun.write(entryPath, source);
|
|
@@ -24781,6 +24908,49 @@ var init_buildEmberVendor = __esm(() => {
|
|
|
24781
24908
|
]);
|
|
24782
24909
|
});
|
|
24783
24910
|
|
|
24911
|
+
// src/build/workspacePackages.ts
|
|
24912
|
+
import { readFileSync as readFileSync28, realpathSync as realpathSync3 } from "fs";
|
|
24913
|
+
import { join as join48, sep as sep6 } from "path";
|
|
24914
|
+
var NODE_MODULES_SEGMENT, verdicts, isWorkspacePackageSpecifier = (specifier, projectRoot = process.cwd()) => {
|
|
24915
|
+
const key = `${projectRoot}\x00${specifier}`;
|
|
24916
|
+
const known = verdicts.get(key);
|
|
24917
|
+
if (known !== undefined)
|
|
24918
|
+
return known;
|
|
24919
|
+
let verdict = false;
|
|
24920
|
+
try {
|
|
24921
|
+
const resolved = realpathSync3(Bun.resolveSync(specifier, projectRoot));
|
|
24922
|
+
verdict = !resolved.includes(NODE_MODULES_SEGMENT);
|
|
24923
|
+
} catch {
|
|
24924
|
+
verdict = false;
|
|
24925
|
+
}
|
|
24926
|
+
verdicts.set(key, verdict);
|
|
24927
|
+
return verdict;
|
|
24928
|
+
}, workspacePackageDirs = (projectRoot = process.cwd()) => {
|
|
24929
|
+
let manifest;
|
|
24930
|
+
try {
|
|
24931
|
+
manifest = JSON.parse(readFileSync28(join48(projectRoot, "package.json"), "utf-8"));
|
|
24932
|
+
} catch {
|
|
24933
|
+
return [];
|
|
24934
|
+
}
|
|
24935
|
+
const names = ["dependencies", "devDependencies", "optionalDependencies"].flatMap((field) => {
|
|
24936
|
+
const deps = manifest[field];
|
|
24937
|
+
return deps && typeof deps === "object" ? Object.keys(deps) : [];
|
|
24938
|
+
});
|
|
24939
|
+
const dirs = new Set;
|
|
24940
|
+
for (const name of names) {
|
|
24941
|
+
try {
|
|
24942
|
+
const linked = realpathSync3(join48(projectRoot, "node_modules", name));
|
|
24943
|
+
if (!`${linked}${sep6}`.includes(NODE_MODULES_SEGMENT))
|
|
24944
|
+
dirs.add(linked);
|
|
24945
|
+
} catch {}
|
|
24946
|
+
}
|
|
24947
|
+
return [...dirs];
|
|
24948
|
+
};
|
|
24949
|
+
var init_workspacePackages = __esm(() => {
|
|
24950
|
+
NODE_MODULES_SEGMENT = `${sep6}node_modules${sep6}`;
|
|
24951
|
+
verdicts = new Map;
|
|
24952
|
+
});
|
|
24953
|
+
|
|
24784
24954
|
// src/utils/stripStringsAndComments.ts
|
|
24785
24955
|
var stripStringsAndComments = (source) => {
|
|
24786
24956
|
const { length } = source;
|
|
@@ -24885,9 +25055,9 @@ var stripStringsAndComments = (source) => {
|
|
|
24885
25055
|
};
|
|
24886
25056
|
|
|
24887
25057
|
// src/dev/dependencyGraph.ts
|
|
24888
|
-
import { existsSync as existsSync36, readFileSync as
|
|
25058
|
+
import { existsSync as existsSync36, readFileSync as readFileSync29, realpathSync as realpathSync4 } from "fs";
|
|
24889
25059
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
24890
|
-
import { resolve as
|
|
25060
|
+
import { resolve as resolve34 } from "path";
|
|
24891
25061
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
24892
25062
|
const lower = filePath.toLowerCase();
|
|
24893
25063
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -24898,11 +25068,17 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24898
25068
|
return "html";
|
|
24899
25069
|
return null;
|
|
24900
25070
|
}, resolveImportPath2 = (importPath, fromFile) => {
|
|
25071
|
+
const fromDir = resolve34(fromFile, "..");
|
|
24901
25072
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
24902
|
-
|
|
25073
|
+
if (!isWorkspacePackageSpecifier(importPath, fromDir))
|
|
25074
|
+
return null;
|
|
25075
|
+
try {
|
|
25076
|
+
return realpathSync4(Bun.resolveSync(importPath, fromDir));
|
|
25077
|
+
} catch {
|
|
25078
|
+
return null;
|
|
25079
|
+
}
|
|
24903
25080
|
}
|
|
24904
|
-
const
|
|
24905
|
-
const normalized = resolve33(fromDir, importPath);
|
|
25081
|
+
const normalized = resolve34(fromDir, importPath);
|
|
24906
25082
|
const extensions = [
|
|
24907
25083
|
".ts",
|
|
24908
25084
|
".tsx",
|
|
@@ -24932,7 +25108,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24932
25108
|
dependents.delete(normalizedPath);
|
|
24933
25109
|
}
|
|
24934
25110
|
}, addFileToGraph = (graph, filePath) => {
|
|
24935
|
-
const normalizedPath =
|
|
25111
|
+
const normalizedPath = resolve34(filePath);
|
|
24936
25112
|
if (!existsSync36(normalizedPath))
|
|
24937
25113
|
return;
|
|
24938
25114
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -24959,10 +25135,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
24959
25135
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
24960
25136
|
const processedFiles = new Set;
|
|
24961
25137
|
const glob = new Glob9("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
24962
|
-
const resolvedDirs = directories.map((dir) =>
|
|
25138
|
+
const resolvedDirs = directories.map((dir) => resolve34(dir)).filter((dir) => existsSync36(dir));
|
|
24963
25139
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
24964
25140
|
for (const file of allFiles) {
|
|
24965
|
-
const fullPath =
|
|
25141
|
+
const fullPath = resolve34(file);
|
|
24966
25142
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
24967
25143
|
continue;
|
|
24968
25144
|
if (processedFiles.has(fullPath))
|
|
@@ -25056,15 +25232,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
25056
25232
|
const lowerPath = filePath.toLowerCase();
|
|
25057
25233
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
25058
25234
|
if (loader === "html") {
|
|
25059
|
-
const content =
|
|
25235
|
+
const content = readFileSync29(filePath, "utf-8");
|
|
25060
25236
|
return extractHtmlDependencies(filePath, content);
|
|
25061
25237
|
}
|
|
25062
25238
|
if (loader === "tsx" || loader === "js") {
|
|
25063
|
-
const content =
|
|
25239
|
+
const content = readFileSync29(filePath, "utf-8");
|
|
25064
25240
|
return extractJsDependencies(filePath, content, loader);
|
|
25065
25241
|
}
|
|
25066
25242
|
if (isSvelteOrVue) {
|
|
25067
|
-
const content =
|
|
25243
|
+
const content = readFileSync29(filePath, "utf-8");
|
|
25068
25244
|
return extractSvelteVueDependencies(filePath, content);
|
|
25069
25245
|
}
|
|
25070
25246
|
return [];
|
|
@@ -25075,7 +25251,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
25075
25251
|
return [];
|
|
25076
25252
|
}
|
|
25077
25253
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
25078
|
-
const normalizedPath =
|
|
25254
|
+
const normalizedPath = resolve34(changedFile);
|
|
25079
25255
|
const affected = new Set;
|
|
25080
25256
|
const toProcess = [normalizedPath];
|
|
25081
25257
|
const processNode = (current) => {
|
|
@@ -25106,11 +25282,12 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
25106
25282
|
}, removeDependentsForFile = (graph, normalizedPath) => {
|
|
25107
25283
|
graph.dependents.delete(normalizedPath);
|
|
25108
25284
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
25109
|
-
const normalizedPath =
|
|
25285
|
+
const normalizedPath = resolve34(filePath);
|
|
25110
25286
|
removeDepsForFile(graph, normalizedPath);
|
|
25111
25287
|
removeDependentsForFile(graph, normalizedPath);
|
|
25112
25288
|
};
|
|
25113
25289
|
var init_dependencyGraph = __esm(() => {
|
|
25290
|
+
init_workspacePackages();
|
|
25114
25291
|
emptyDependencyGraph = {
|
|
25115
25292
|
dependencies: new Map,
|
|
25116
25293
|
dependents: new Map
|
|
@@ -25149,12 +25326,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
25149
25326
|
};
|
|
25150
25327
|
|
|
25151
25328
|
// src/dev/configResolver.ts
|
|
25152
|
-
import { resolve as
|
|
25329
|
+
import { resolve as resolve35 } from "path";
|
|
25153
25330
|
var resolveBuildPaths = (config) => {
|
|
25154
25331
|
const cwd = process.cwd();
|
|
25155
25332
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
25156
|
-
const withDefault = (value, fallback) => normalize(
|
|
25157
|
-
const optional = (value) => value ? normalize(
|
|
25333
|
+
const withDefault = (value, fallback) => normalize(resolve35(cwd, value ?? fallback));
|
|
25334
|
+
const optional = (value) => value ? normalize(resolve35(cwd, value)) : undefined;
|
|
25158
25335
|
return {
|
|
25159
25336
|
angularDir: optional(config.angularDirectory),
|
|
25160
25337
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -25213,8 +25390,8 @@ var init_clientManager = __esm(() => {
|
|
|
25213
25390
|
});
|
|
25214
25391
|
|
|
25215
25392
|
// src/dev/pathUtils.ts
|
|
25216
|
-
import { existsSync as existsSync37, readdirSync as readdirSync8, readFileSync as
|
|
25217
|
-
import { dirname as dirname26, resolve as
|
|
25393
|
+
import { existsSync as existsSync37, readdirSync as readdirSync8, readFileSync as readFileSync30 } from "fs";
|
|
25394
|
+
import { dirname as dirname26, resolve as resolve36 } from "path";
|
|
25218
25395
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
25219
25396
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
25220
25397
|
return "ignored";
|
|
@@ -25290,7 +25467,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
25290
25467
|
return "unknown";
|
|
25291
25468
|
}, collectAngularResourceDirs = (angularDir) => {
|
|
25292
25469
|
const out = new Set;
|
|
25293
|
-
const angularRoot =
|
|
25470
|
+
const angularRoot = resolve36(angularDir);
|
|
25294
25471
|
const angularRootNormalized = normalizePath(angularRoot);
|
|
25295
25472
|
const walk = (dir) => {
|
|
25296
25473
|
let entries;
|
|
@@ -25303,7 +25480,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
25303
25480
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
25304
25481
|
continue;
|
|
25305
25482
|
}
|
|
25306
|
-
const full =
|
|
25483
|
+
const full = resolve36(dir, entry.name);
|
|
25307
25484
|
if (entry.isDirectory()) {
|
|
25308
25485
|
walk(full);
|
|
25309
25486
|
continue;
|
|
@@ -25313,7 +25490,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
25313
25490
|
}
|
|
25314
25491
|
let source;
|
|
25315
25492
|
try {
|
|
25316
|
-
source =
|
|
25493
|
+
source = readFileSync30(full, "utf8");
|
|
25317
25494
|
} catch {
|
|
25318
25495
|
continue;
|
|
25319
25496
|
}
|
|
@@ -25344,7 +25521,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
25344
25521
|
}
|
|
25345
25522
|
const componentDir = dirname26(full);
|
|
25346
25523
|
for (const ref of refs) {
|
|
25347
|
-
const refAbs = normalizePath(
|
|
25524
|
+
const refAbs = normalizePath(resolve36(componentDir, ref));
|
|
25348
25525
|
const refDir = normalizePath(dirname26(refAbs));
|
|
25349
25526
|
if (refDir === angularRootNormalized || refDir.startsWith(`${angularRootNormalized}/`)) {
|
|
25350
25527
|
continue;
|
|
@@ -25361,7 +25538,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
25361
25538
|
const push = (path) => {
|
|
25362
25539
|
if (!path)
|
|
25363
25540
|
return;
|
|
25364
|
-
const abs = normalizePath(
|
|
25541
|
+
const abs = normalizePath(resolve36(cwd, path));
|
|
25365
25542
|
if (!roots.includes(abs))
|
|
25366
25543
|
roots.push(abs);
|
|
25367
25544
|
};
|
|
@@ -25386,7 +25563,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
25386
25563
|
push(cfg.assetsDir);
|
|
25387
25564
|
push(cfg.stylesDir);
|
|
25388
25565
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
25389
|
-
const abs = normalizePath(
|
|
25566
|
+
const abs = normalizePath(resolve36(cwd, candidate));
|
|
25390
25567
|
if (existsSync37(abs) && !roots.includes(abs))
|
|
25391
25568
|
roots.push(abs);
|
|
25392
25569
|
}
|
|
@@ -25397,7 +25574,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
25397
25574
|
continue;
|
|
25398
25575
|
if (entry.name.startsWith("."))
|
|
25399
25576
|
continue;
|
|
25400
|
-
const abs = normalizePath(
|
|
25577
|
+
const abs = normalizePath(resolve36(cwd, entry.name));
|
|
25401
25578
|
if (roots.includes(abs))
|
|
25402
25579
|
continue;
|
|
25403
25580
|
if (shouldIgnorePath(abs, resolved))
|
|
@@ -25408,6 +25585,11 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
25408
25585
|
const extraDirs = config.dev?.watchDirs ?? [];
|
|
25409
25586
|
for (const dir of extraDirs)
|
|
25410
25587
|
push(dir);
|
|
25588
|
+
for (const dir of workspacePackageDirs(cwd)) {
|
|
25589
|
+
const abs = normalizePath(dir);
|
|
25590
|
+
if (!roots.includes(abs))
|
|
25591
|
+
roots.push(abs);
|
|
25592
|
+
}
|
|
25411
25593
|
if (cfg.angularDir) {
|
|
25412
25594
|
const resourceDirs = collectAngularResourceDirs(cfg.angularDir);
|
|
25413
25595
|
for (const dir of resourceDirs) {
|
|
@@ -25474,14 +25656,15 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
25474
25656
|
return false;
|
|
25475
25657
|
};
|
|
25476
25658
|
var init_pathUtils = __esm(() => {
|
|
25659
|
+
init_workspacePackages();
|
|
25477
25660
|
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less|styl(?:us)?)$/i;
|
|
25478
|
-
HARD_DENY_PATTERN = /(^|\/)(build|generated|compiled|indexes|\.absolutejs|node_modules|\.git|\.test-builds|dist)(\/|$)/;
|
|
25661
|
+
HARD_DENY_PATTERN = /(^|\/)(build|generated|compiled|indexes|\.absolutejs|node_modules|\.git|\.test-builds|test-results|playwright-report|blob-report|\.playwright-mcp|\.playwright-artifacts(?:-[^/]+)?|dist)(\/|$)/;
|
|
25479
25662
|
});
|
|
25480
25663
|
|
|
25481
25664
|
// src/dev/devPrescan.ts
|
|
25482
25665
|
import { existsSync as existsSync38, readdirSync as readdirSync9, rmSync as rmSync3 } from "fs";
|
|
25483
|
-
import { mkdir as mkdir11, readFile as
|
|
25484
|
-
import { join as
|
|
25666
|
+
import { mkdir as mkdir11, readFile as readFile7, rename as rename3, writeFile as writeFile9 } from "fs/promises";
|
|
25667
|
+
import { join as join49 } from "path";
|
|
25485
25668
|
var PRESCAN_DIR, PAYLOAD_VERSION = 1, POLL_INTERVAL_MS = 10, DEFAULT_WAIT_MS = 2000, collectConfigVendorSourceDirs = (config) => Array.from(new Set([
|
|
25486
25669
|
config.reactDirectory,
|
|
25487
25670
|
config.svelteDirectory,
|
|
@@ -25495,7 +25678,7 @@ var PRESCAN_DIR, PAYLOAD_VERSION = 1, POLL_INTERVAL_MS = 10, DEFAULT_WAIT_MS = 2
|
|
|
25495
25678
|
if (!existsSync38(path))
|
|
25496
25679
|
return;
|
|
25497
25680
|
try {
|
|
25498
|
-
const parsed = JSON.parse(await
|
|
25681
|
+
const parsed = JSON.parse(await readFile7(path, "utf8"));
|
|
25499
25682
|
if (!isPayload(parsed))
|
|
25500
25683
|
return;
|
|
25501
25684
|
return parsed.ok ? parsed : null;
|
|
@@ -25539,7 +25722,7 @@ var init_devPrescan = __esm(() => {
|
|
|
25539
25722
|
init_configResolver();
|
|
25540
25723
|
init_dependencyGraph();
|
|
25541
25724
|
init_pathUtils();
|
|
25542
|
-
PRESCAN_DIR =
|
|
25725
|
+
PRESCAN_DIR = join49(".absolutejs", "dev-prescan");
|
|
25543
25726
|
});
|
|
25544
25727
|
|
|
25545
25728
|
// src/dev/serverEntryCopies.ts
|
|
@@ -25549,7 +25732,7 @@ var init_serverEntryCopies = () => {};
|
|
|
25549
25732
|
// src/dev/fileWatcher.ts
|
|
25550
25733
|
import { watch } from "fs";
|
|
25551
25734
|
import { existsSync as existsSync39, readdirSync as readdirSync10, statSync as statSync6 } from "fs";
|
|
25552
|
-
import { dirname as dirname27, join as
|
|
25735
|
+
import { dirname as dirname27, join as join50, resolve as resolve37 } from "path";
|
|
25553
25736
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
25554
25737
|
try {
|
|
25555
25738
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -25581,7 +25764,9 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25581
25764
|
for (const name of entries) {
|
|
25582
25765
|
if (shouldSkipFilename(name, isStylesDir))
|
|
25583
25766
|
continue;
|
|
25584
|
-
const child =
|
|
25767
|
+
const child = join50(eventDir, name).replace(/\\/g, "/");
|
|
25768
|
+
if (shouldIgnorePath(child, state.resolvedPaths))
|
|
25769
|
+
continue;
|
|
25585
25770
|
let st;
|
|
25586
25771
|
try {
|
|
25587
25772
|
st = statSync6(child);
|
|
@@ -25602,7 +25787,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25602
25787
|
return;
|
|
25603
25788
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
25604
25789
|
if (event === "rename") {
|
|
25605
|
-
const eventDir = dirname27(
|
|
25790
|
+
const eventDir = dirname27(join50(absolutePath, filename)).replace(/\\/g, "/");
|
|
25606
25791
|
atomicRecoveryScan(eventDir);
|
|
25607
25792
|
for (const delay of [25, 100]) {
|
|
25608
25793
|
const timer = setTimeout(() => atomicRecoveryScan(eventDir), delay);
|
|
@@ -25611,7 +25796,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25611
25796
|
}
|
|
25612
25797
|
return;
|
|
25613
25798
|
}
|
|
25614
|
-
const fullPath =
|
|
25799
|
+
const fullPath = join50(absolutePath, filename).replace(/\\/g, "/");
|
|
25615
25800
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
25616
25801
|
return;
|
|
25617
25802
|
}
|
|
@@ -25629,7 +25814,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25629
25814
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
25630
25815
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
25631
25816
|
paths.forEach((path) => {
|
|
25632
|
-
const absolutePath =
|
|
25817
|
+
const absolutePath = resolve37(path).replace(/\\/g, "/");
|
|
25633
25818
|
if (!existsSync39(absolutePath)) {
|
|
25634
25819
|
return;
|
|
25635
25820
|
}
|
|
@@ -25640,7 +25825,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
25640
25825
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
25641
25826
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
25642
25827
|
watchPaths.forEach((path) => {
|
|
25643
|
-
const absolutePath =
|
|
25828
|
+
const absolutePath = resolve37(path).replace(/\\/g, "/");
|
|
25644
25829
|
if (!existsSync39(absolutePath)) {
|
|
25645
25830
|
return;
|
|
25646
25831
|
}
|
|
@@ -25660,13 +25845,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
25660
25845
|
});
|
|
25661
25846
|
|
|
25662
25847
|
// src/dev/assetStore.ts
|
|
25663
|
-
import { resolve as
|
|
25664
|
-
import { readdir as
|
|
25848
|
+
import { resolve as resolve38 } from "path";
|
|
25849
|
+
import { readdir as readdir5, unlink } from "fs/promises";
|
|
25665
25850
|
var mimeTypes, getMimeType = (filePath) => {
|
|
25666
25851
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
25667
25852
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
25668
25853
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
25669
|
-
const fullPath =
|
|
25854
|
+
const fullPath = resolve38(dir, entry.name);
|
|
25670
25855
|
if (entry.isDirectory()) {
|
|
25671
25856
|
return walkAndClean(fullPath);
|
|
25672
25857
|
}
|
|
@@ -25682,10 +25867,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
25682
25867
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
25683
25868
|
const liveByIdentity = new Map;
|
|
25684
25869
|
for (const webPath of store.keys()) {
|
|
25685
|
-
const diskPath =
|
|
25870
|
+
const diskPath = resolve38(buildDir, webPath.slice(1));
|
|
25686
25871
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
25687
25872
|
}
|
|
25688
|
-
const absBuildDir =
|
|
25873
|
+
const absBuildDir = resolve38(buildDir);
|
|
25689
25874
|
Object.values(manifest).forEach((val) => {
|
|
25690
25875
|
if (!HASHED_FILE_RE.test(val))
|
|
25691
25876
|
return;
|
|
@@ -25695,7 +25880,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
25695
25880
|
});
|
|
25696
25881
|
try {
|
|
25697
25882
|
const walkAndClean = async (dir) => {
|
|
25698
|
-
const entries = await
|
|
25883
|
+
const entries = await readdir5(dir, { withFileTypes: true });
|
|
25699
25884
|
const tasks = entries.map((entry) => processWalkEntry(entry, dir, liveByIdentity, walkAndClean)).filter((task) => task !== null);
|
|
25700
25885
|
await Promise.all(tasks);
|
|
25701
25886
|
};
|
|
@@ -25705,13 +25890,13 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
25705
25890
|
}, evictMissingChunks = async (store, buildDir) => {
|
|
25706
25891
|
const chunkKeys = [...store.keys()].filter((webPath) => webPath.includes("/chunk-"));
|
|
25707
25892
|
await Promise.all(chunkKeys.map(async (webPath) => {
|
|
25708
|
-
const onDisk = await Bun.file(
|
|
25893
|
+
const onDisk = await Bun.file(resolve38(buildDir, webPath.slice(1))).exists().catch(() => false);
|
|
25709
25894
|
if (!onDisk)
|
|
25710
25895
|
store.delete(webPath);
|
|
25711
25896
|
}));
|
|
25712
25897
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
25713
25898
|
if (entry.isDirectory()) {
|
|
25714
|
-
return scanDir(
|
|
25899
|
+
return scanDir(resolve38(dir, entry.name), `${prefix}${entry.name}/`);
|
|
25715
25900
|
}
|
|
25716
25901
|
if (!entry.name.startsWith("chunk-")) {
|
|
25717
25902
|
return null;
|
|
@@ -25720,7 +25905,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
25720
25905
|
if (store.has(webPath)) {
|
|
25721
25906
|
return null;
|
|
25722
25907
|
}
|
|
25723
|
-
return Bun.file(
|
|
25908
|
+
return Bun.file(resolve38(dir, entry.name)).bytes().then((bytes) => {
|
|
25724
25909
|
store.set(webPath, bytes);
|
|
25725
25910
|
return;
|
|
25726
25911
|
}).catch(() => {});
|
|
@@ -25742,14 +25927,14 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
25742
25927
|
for (const webPath of newIdentities.values()) {
|
|
25743
25928
|
if (store.has(webPath))
|
|
25744
25929
|
continue;
|
|
25745
|
-
loadPromises.push(Bun.file(
|
|
25930
|
+
loadPromises.push(Bun.file(resolve38(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
25746
25931
|
store.set(webPath, bytes);
|
|
25747
25932
|
return;
|
|
25748
25933
|
}).catch(() => {}));
|
|
25749
25934
|
}
|
|
25750
25935
|
try {
|
|
25751
25936
|
const scanDir = async (dir, prefix) => {
|
|
25752
|
-
const entries = await
|
|
25937
|
+
const entries = await readdir5(dir, { withFileTypes: true });
|
|
25753
25938
|
const subTasks = entries.map((entry) => processScanEntry(entry, dir, prefix, store, scanDir)).filter((task) => task !== null);
|
|
25754
25939
|
await Promise.all(subTasks);
|
|
25755
25940
|
};
|
|
@@ -25788,10 +25973,10 @@ var init_assetStore = __esm(() => {
|
|
|
25788
25973
|
});
|
|
25789
25974
|
|
|
25790
25975
|
// src/dev/restartScope.ts
|
|
25791
|
-
import { realpathSync as
|
|
25976
|
+
import { realpathSync as realpathSync5 } from "fs";
|
|
25792
25977
|
var MODULE_FILE, DOCUMENT_FILE, realPath = (path) => {
|
|
25793
25978
|
try {
|
|
25794
|
-
return
|
|
25979
|
+
return realpathSync5(path);
|
|
25795
25980
|
} catch {
|
|
25796
25981
|
return path;
|
|
25797
25982
|
}
|
|
@@ -25808,8 +25993,8 @@ var init_restartScope = __esm(() => {
|
|
|
25808
25993
|
});
|
|
25809
25994
|
|
|
25810
25995
|
// src/islands/pageMetadata.ts
|
|
25811
|
-
import { readFileSync as
|
|
25812
|
-
import { dirname as dirname28, resolve as
|
|
25996
|
+
import { readFileSync as readFileSync31 } from "fs";
|
|
25997
|
+
import { dirname as dirname28, resolve as resolve39 } from "path";
|
|
25813
25998
|
var pagePatterns, getPageDirs = (config) => [
|
|
25814
25999
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
25815
26000
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -25829,15 +26014,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
25829
26014
|
const source = definition.buildReference?.source;
|
|
25830
26015
|
if (!source)
|
|
25831
26016
|
continue;
|
|
25832
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
25833
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
26017
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve39(dirname28(buildInfo.resolvedRegistryPath), source);
|
|
26018
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve39(resolvedSource));
|
|
25834
26019
|
}
|
|
25835
26020
|
return lookup;
|
|
25836
26021
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
|
|
25837
26022
|
const candidate = usage.source;
|
|
25838
|
-
return candidate ?
|
|
26023
|
+
return candidate ? resolve39(candidate) === target : false;
|
|
25839
26024
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
25840
|
-
const target =
|
|
26025
|
+
const target = resolve39(sourcePath);
|
|
25841
26026
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
25842
26027
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
25843
26028
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -25849,13 +26034,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
25849
26034
|
const pattern = pagePatterns[entry.framework];
|
|
25850
26035
|
if (!pattern)
|
|
25851
26036
|
return;
|
|
25852
|
-
const files = await scanEntryPoints(
|
|
26037
|
+
const files = await scanEntryPoints(resolve39(entry.dir), pattern);
|
|
25853
26038
|
for (const filePath of files) {
|
|
25854
|
-
const source =
|
|
26039
|
+
const source = readFileSync31(filePath, "utf-8");
|
|
25855
26040
|
const islands = extractIslandUsagesFromSource(source);
|
|
25856
|
-
pageMetadata.set(
|
|
26041
|
+
pageMetadata.set(resolve39(filePath), {
|
|
25857
26042
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
25858
|
-
pagePath:
|
|
26043
|
+
pagePath: resolve39(filePath)
|
|
25859
26044
|
});
|
|
25860
26045
|
}
|
|
25861
26046
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -25882,10 +26067,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
25882
26067
|
});
|
|
25883
26068
|
|
|
25884
26069
|
// src/dev/fileHashTracker.ts
|
|
25885
|
-
import { readFileSync as
|
|
26070
|
+
import { readFileSync as readFileSync32, statSync as statSync7 } from "fs";
|
|
25886
26071
|
var computeFileHash = (filePath) => {
|
|
25887
26072
|
try {
|
|
25888
|
-
const fileContent =
|
|
26073
|
+
const fileContent = readFileSync32(filePath);
|
|
25889
26074
|
return Number(Bun.hash(fileContent));
|
|
25890
26075
|
} catch {
|
|
25891
26076
|
return UNFOUND_INDEX;
|
|
@@ -25973,9 +26158,9 @@ var init_transformCache = __esm(() => {
|
|
|
25973
26158
|
});
|
|
25974
26159
|
|
|
25975
26160
|
// src/dev/reactComponentClassifier.ts
|
|
25976
|
-
import { resolve as
|
|
26161
|
+
import { resolve as resolve40 } from "path";
|
|
25977
26162
|
var classifyComponent = (filePath) => {
|
|
25978
|
-
const normalizedPath =
|
|
26163
|
+
const normalizedPath = resolve40(filePath);
|
|
25979
26164
|
if (normalizedPath.includes("/react/pages/")) {
|
|
25980
26165
|
return "server";
|
|
25981
26166
|
}
|
|
@@ -25987,7 +26172,7 @@ var classifyComponent = (filePath) => {
|
|
|
25987
26172
|
var init_reactComponentClassifier = () => {};
|
|
25988
26173
|
|
|
25989
26174
|
// src/dev/moduleMapper.ts
|
|
25990
|
-
import { basename as basename18, resolve as
|
|
26175
|
+
import { basename as basename18, resolve as resolve41 } from "path";
|
|
25991
26176
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
25992
26177
|
const modulePaths = {};
|
|
25993
26178
|
moduleKeys.forEach((key) => {
|
|
@@ -25997,7 +26182,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
25997
26182
|
});
|
|
25998
26183
|
return modulePaths;
|
|
25999
26184
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
26000
|
-
const normalizedFile =
|
|
26185
|
+
const normalizedFile = resolve41(sourceFile);
|
|
26001
26186
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
26002
26187
|
if (processedFiles.has(normalizedFile)) {
|
|
26003
26188
|
return null;
|
|
@@ -26033,7 +26218,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
26033
26218
|
});
|
|
26034
26219
|
return grouped;
|
|
26035
26220
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
26036
|
-
const normalizedFile =
|
|
26221
|
+
const normalizedFile = resolve41(sourceFile);
|
|
26037
26222
|
const fileName = basename18(normalizedFile);
|
|
26038
26223
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
26039
26224
|
const pascalName = toPascal(baseName);
|
|
@@ -26088,14 +26273,14 @@ var init_moduleMapper = __esm(() => {
|
|
|
26088
26273
|
});
|
|
26089
26274
|
|
|
26090
26275
|
// src/utils/spaRouteCss.ts
|
|
26091
|
-
import { readFile as
|
|
26092
|
-
import { dirname as dirname29, isAbsolute as isAbsolute8, resolve as
|
|
26276
|
+
import { readFile as readFile8 } from "fs/promises";
|
|
26277
|
+
import { dirname as dirname29, isAbsolute as isAbsolute8, resolve as resolve42 } from "path";
|
|
26093
26278
|
var sideManifestCache, readSideManifest = async (sideManifestPath) => {
|
|
26094
26279
|
const cached = sideManifestCache.get(sideManifestPath);
|
|
26095
26280
|
if (cached !== undefined)
|
|
26096
26281
|
return cached;
|
|
26097
26282
|
try {
|
|
26098
|
-
const raw = await
|
|
26283
|
+
const raw = await readFile8(sideManifestPath, "utf-8");
|
|
26099
26284
|
const parsed = JSON.parse(raw);
|
|
26100
26285
|
const routes = Array.isArray(parsed) ? parsed : [];
|
|
26101
26286
|
sideManifestCache.set(sideManifestPath, routes);
|
|
@@ -26127,12 +26312,12 @@ var sideManifestCache, readSideManifest = async (sideManifestPath) => {
|
|
|
26127
26312
|
}, readChildCss = async (cssPath, sideManifestPath) => {
|
|
26128
26313
|
if (!cssPath)
|
|
26129
26314
|
return "";
|
|
26130
|
-
const resolvedCssPath = isAbsolute8(cssPath) ? cssPath :
|
|
26315
|
+
const resolvedCssPath = isAbsolute8(cssPath) ? cssPath : resolve42(dirname29(sideManifestPath), cssPath);
|
|
26131
26316
|
const cached = childCssCache.get(resolvedCssPath);
|
|
26132
26317
|
if (cached !== undefined)
|
|
26133
26318
|
return cached;
|
|
26134
26319
|
try {
|
|
26135
|
-
const css = await
|
|
26320
|
+
const css = await readFile8(resolvedCssPath, "utf-8");
|
|
26136
26321
|
childCssCache.set(resolvedCssPath, css);
|
|
26137
26322
|
return css;
|
|
26138
26323
|
} catch {
|
|
@@ -26210,8 +26395,8 @@ __export(exports_resolveOwningComponents, {
|
|
|
26210
26395
|
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
26211
26396
|
resolveOwningComponents: () => resolveOwningComponents
|
|
26212
26397
|
});
|
|
26213
|
-
import { readdirSync as readdirSync11, readFileSync as
|
|
26214
|
-
import { dirname as dirname30, extname as
|
|
26398
|
+
import { readdirSync as readdirSync11, readFileSync as readFileSync33, statSync as statSync8 } from "fs";
|
|
26399
|
+
import { dirname as dirname30, extname as extname15, join as join51, resolve as resolve43 } from "path";
|
|
26215
26400
|
import ts19 from "typescript";
|
|
26216
26401
|
var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || file.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
26217
26402
|
const out = [];
|
|
@@ -26226,7 +26411,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
26226
26411
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
26227
26412
|
continue;
|
|
26228
26413
|
}
|
|
26229
|
-
const full =
|
|
26414
|
+
const full = join51(dir, entry.name);
|
|
26230
26415
|
if (entry.isDirectory()) {
|
|
26231
26416
|
visit(full);
|
|
26232
26417
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -26270,7 +26455,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
26270
26455
|
}, parseDecoratedClasses = (filePath) => {
|
|
26271
26456
|
let source;
|
|
26272
26457
|
try {
|
|
26273
|
-
source =
|
|
26458
|
+
source = readFileSync33(filePath, "utf8");
|
|
26274
26459
|
} catch {
|
|
26275
26460
|
return [];
|
|
26276
26461
|
}
|
|
@@ -26324,11 +26509,11 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
26324
26509
|
};
|
|
26325
26510
|
visit(sourceFile);
|
|
26326
26511
|
return out;
|
|
26327
|
-
}, safeNormalize = (path) =>
|
|
26512
|
+
}, safeNormalize = (path) => resolve43(path).replace(/\\/g, "/"), resolveOwningComponents = (params) => {
|
|
26328
26513
|
const { changedFilePath, userAngularRoot } = params;
|
|
26329
26514
|
const changedAbs = safeNormalize(changedFilePath);
|
|
26330
26515
|
const out = [];
|
|
26331
|
-
const ext =
|
|
26516
|
+
const ext = extname15(changedAbs).toLowerCase();
|
|
26332
26517
|
if (ext === ".ts" || ext === ".tsx") {
|
|
26333
26518
|
const classes = parseDecoratedClasses(changedAbs);
|
|
26334
26519
|
for (const cls of classes) {
|
|
@@ -26360,7 +26545,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
26360
26545
|
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
26361
26546
|
let source;
|
|
26362
26547
|
try {
|
|
26363
|
-
source =
|
|
26548
|
+
source = readFileSync33(childFilePath, "utf8");
|
|
26364
26549
|
} catch {
|
|
26365
26550
|
return null;
|
|
26366
26551
|
}
|
|
@@ -26393,7 +26578,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
26393
26578
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
26394
26579
|
return null;
|
|
26395
26580
|
}
|
|
26396
|
-
const base =
|
|
26581
|
+
const base = resolve43(childDir, spec);
|
|
26397
26582
|
const candidates = [
|
|
26398
26583
|
`${base}.ts`,
|
|
26399
26584
|
`${base}.tsx`,
|
|
@@ -26431,7 +26616,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file) => file.endsWith(".ts") || f
|
|
|
26431
26616
|
};
|
|
26432
26617
|
if (cls.kind === "component") {
|
|
26433
26618
|
for (const url of [...cls.templateUrls, ...cls.styleUrls]) {
|
|
26434
|
-
const abs = safeNormalize(
|
|
26619
|
+
const abs = safeNormalize(resolve43(componentDir, url));
|
|
26435
26620
|
const existing = resource.get(abs);
|
|
26436
26621
|
if (existing)
|
|
26437
26622
|
existing.push(entity);
|
|
@@ -26699,7 +26884,7 @@ var init_webSocket = __esm(() => {
|
|
|
26699
26884
|
});
|
|
26700
26885
|
|
|
26701
26886
|
// src/utils/loadConfig.ts
|
|
26702
|
-
import { resolve as
|
|
26887
|
+
import { resolve as resolve44 } from "path";
|
|
26703
26888
|
var RESERVED_TOP_LEVEL_KEYS, isObject2 = (value) => typeof value === "object" && value !== null, isCommandService = (service) => service.kind === "command" || Array.isArray(service.command), isServiceCandidate = (value) => isObject2(value) && (typeof value.entry === "string" || Array.isArray(value.command)), isWorkspaceConfig = (config) => {
|
|
26704
26889
|
if (!isObject2(config)) {
|
|
26705
26890
|
return false;
|
|
@@ -26750,7 +26935,7 @@ var RESERVED_TOP_LEVEL_KEYS, isObject2 = (value) => typeof value === "object" &&
|
|
|
26750
26935
|
}
|
|
26751
26936
|
return config;
|
|
26752
26937
|
}, loadRawConfig = async (configPath) => {
|
|
26753
|
-
const resolved =
|
|
26938
|
+
const resolved = resolve44(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
26754
26939
|
const mod = await import(resolved);
|
|
26755
26940
|
const config = mod.default ?? mod.config;
|
|
26756
26941
|
if (!config) {
|
|
@@ -26876,15 +27061,15 @@ var init_hotResources = __esm(() => {
|
|
|
26876
27061
|
});
|
|
26877
27062
|
|
|
26878
27063
|
// src/plugins/openApiPlugin.ts
|
|
26879
|
-
import { existsSync as existsSync40, readFileSync as
|
|
26880
|
-
import { join as
|
|
27064
|
+
import { existsSync as existsSync40, readFileSync as readFileSync34 } from "fs";
|
|
27065
|
+
import { join as join52 } from "path";
|
|
26881
27066
|
var FALLBACK_NAME = "AbsoluteJS API", FALLBACK_VERSION = "1.0.0", projectInfo = (cwd) => {
|
|
26882
|
-
const path =
|
|
27067
|
+
const path = join52(cwd, "package.json");
|
|
26883
27068
|
if (!existsSync40(path)) {
|
|
26884
27069
|
return { name: FALLBACK_NAME, version: FALLBACK_VERSION };
|
|
26885
27070
|
}
|
|
26886
27071
|
try {
|
|
26887
|
-
const pkg = JSON.parse(
|
|
27072
|
+
const pkg = JSON.parse(readFileSync34(path, "utf-8"));
|
|
26888
27073
|
return {
|
|
26889
27074
|
name: typeof pkg.name === "string" ? pkg.name : FALLBACK_NAME,
|
|
26890
27075
|
version: typeof pkg.version === "string" ? pkg.version : FALLBACK_VERSION
|
|
@@ -26933,14 +27118,14 @@ var FALLBACK_NAME = "AbsoluteJS API", FALLBACK_VERSION = "1.0.0", projectInfo =
|
|
|
26933
27118
|
var init_openApiPlugin = () => {};
|
|
26934
27119
|
|
|
26935
27120
|
// src/plugins/telemetryPlugin.ts
|
|
26936
|
-
import { existsSync as existsSync41, readFileSync as
|
|
26937
|
-
import { join as
|
|
27121
|
+
import { existsSync as existsSync41, readFileSync as readFileSync35 } from "fs";
|
|
27122
|
+
import { join as join53 } from "path";
|
|
26938
27123
|
var OTEL_PACKAGE = "@elysia/opentelemetry", readPackageName = (cwd) => {
|
|
26939
|
-
const path =
|
|
27124
|
+
const path = join53(cwd, "package.json");
|
|
26940
27125
|
if (!existsSync41(path))
|
|
26941
27126
|
return null;
|
|
26942
27127
|
try {
|
|
26943
|
-
const pkg = JSON.parse(
|
|
27128
|
+
const pkg = JSON.parse(readFileSync35(path, "utf-8"));
|
|
26944
27129
|
return typeof pkg.name === "string" ? pkg.name : null;
|
|
26945
27130
|
} catch {
|
|
26946
27131
|
return null;
|
|
@@ -27252,7 +27437,7 @@ ${error ?? "The dev-server terminal has the build output."}`,
|
|
|
27252
27437
|
|
|
27253
27438
|
// src/core/requestContext.ts
|
|
27254
27439
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
27255
|
-
import { Elysia as
|
|
27440
|
+
import { Elysia as Elysia3 } from "elysia";
|
|
27256
27441
|
var REQUEST_STORAGE_KEY, PAGE_WARMER_KEY, isAbsoluteRequestStorage = (value) => typeof value === "object" && value !== null && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function", getRequestStorage = () => {
|
|
27257
27442
|
const value = Reflect.get(globalThis, REQUEST_STORAGE_KEY);
|
|
27258
27443
|
return isAbsoluteRequestStorage(value) ? value : undefined;
|
|
@@ -27324,7 +27509,7 @@ var REQUEST_STORAGE_KEY, PAGE_WARMER_KEY, isAbsoluteRequestStorage = (value) =>
|
|
|
27324
27509
|
var init_requestContext = __esm(() => {
|
|
27325
27510
|
REQUEST_STORAGE_KEY = Symbol.for("absolutejs.requestAsyncLocalStorage");
|
|
27326
27511
|
PAGE_WARMER_KEY = Symbol.for("absolutejs.devPageWarmer");
|
|
27327
|
-
absoluteRequestContext = new
|
|
27512
|
+
absoluteRequestContext = new Elysia3({
|
|
27328
27513
|
name: "absolutejs-request-context"
|
|
27329
27514
|
}).request(({ request }) => {
|
|
27330
27515
|
ensureRequestStorage().enterWith({ request });
|
|
@@ -27333,7 +27518,7 @@ var init_requestContext = __esm(() => {
|
|
|
27333
27518
|
});
|
|
27334
27519
|
|
|
27335
27520
|
// src/core/loadIslandRegistry.ts
|
|
27336
|
-
import { resolve as
|
|
27521
|
+
import { resolve as resolve45 } from "path";
|
|
27337
27522
|
var isRecord6 = (value) => typeof value === "object" && value !== null, resolveRegistryExport2 = (mod) => {
|
|
27338
27523
|
if (isRecord6(mod.islandRegistry))
|
|
27339
27524
|
return mod.islandRegistry;
|
|
@@ -27341,7 +27526,7 @@ var isRecord6 = (value) => typeof value === "object" && value !== null, resolveR
|
|
|
27341
27526
|
return mod.default;
|
|
27342
27527
|
throw new Error("Island registry module must export `islandRegistry` or a default registry object.");
|
|
27343
27528
|
}, isRegistryModuleExport = (value) => isRecord6(value), isIslandRegistryInput = (value) => isRecord6(value), loadIslandRegistry = async (registryPath) => {
|
|
27344
|
-
const resolvedRegistryPath =
|
|
27529
|
+
const resolvedRegistryPath = resolve45(registryPath);
|
|
27345
27530
|
const buildInfo = await loadIslandRegistryBuildInfo(resolvedRegistryPath);
|
|
27346
27531
|
if (buildInfo.definitions.length > 0) {
|
|
27347
27532
|
return buildInfo.registry;
|
|
@@ -27548,12 +27733,12 @@ var exports_config = {};
|
|
|
27548
27733
|
__export(exports_config, {
|
|
27549
27734
|
normalizeAbsoluteMobileConfig: () => normalizeAbsoluteMobileConfig
|
|
27550
27735
|
});
|
|
27551
|
-
import { readFileSync as
|
|
27552
|
-
import { resolve as
|
|
27736
|
+
import { readFileSync as readFileSync36 } from "fs";
|
|
27737
|
+
import { resolve as resolve46 } from "path";
|
|
27553
27738
|
import { createHash as createHash4, createPublicKey, X509Certificate } from "crypto";
|
|
27554
27739
|
var APP_ID_PATTERN, SCHEME_PATTERN, APPLE_APP_ID_PREFIX_PATTERN, CERTIFICATE_FINGERPRINT_PATTERN, UPDATE_NAME_PATTERN, RELEASE_TARGET_PATTERN, UPDATE_PUBLIC_KEY_PATTERN, ENVIRONMENT_NAME_PATTERN, COLOR_PATTERN, DEFAULT_UPDATE_BOOT_TIMEOUT_MS = 20000, DEFAULT_UPDATE_HEALTH_FAILURE_RATE = 0.2, DEFAULT_UPDATE_HEALTH_MINIMUM_REPORTS = 20, DEFAULT_UPDATE_ROLLOUT_FAILURE_RATE = 0.05, DEFAULT_UPDATE_ROLLOUT_OBSERVATION_MINUTES = 60, MINUTE_MS, DEFAULT_UPDATE_ROLLOUT_STAGES, MINIMUM_UPDATE_BOOT_TIMEOUT_MS = 5000, MAXIMUM_UPDATE_BOOT_TIMEOUT_MS = 120000, HOSTNAME_PATTERN, EXPO_RESERVED_ROUTE_PREFIXES, resolveProjectPath = (projectRoot, value, field) => {
|
|
27555
|
-
const root =
|
|
27556
|
-
const path =
|
|
27740
|
+
const root = resolve46(projectRoot);
|
|
27741
|
+
const path = resolve46(root, value);
|
|
27557
27742
|
if (path !== root && !path.startsWith(`${root}/`)) {
|
|
27558
27743
|
throw new TypeError(`${field} must remain inside the project root.`);
|
|
27559
27744
|
}
|
|
@@ -27747,7 +27932,7 @@ var APP_ID_PATTERN, SCHEME_PATTERN, APPLE_APP_ID_PREFIX_PATTERN, CERTIFICATE_FIN
|
|
|
27747
27932
|
}))
|
|
27748
27933
|
].sort(), readExpoCodeSigningCertificate = (certificatePath) => {
|
|
27749
27934
|
try {
|
|
27750
|
-
const certificateSource =
|
|
27935
|
+
const certificateSource = readFileSync36(certificatePath, "utf8");
|
|
27751
27936
|
const certificatePem = certificateSource.endsWith(`
|
|
27752
27937
|
`) ? certificateSource : `${certificateSource}
|
|
27753
27938
|
`;
|
|
@@ -28067,13 +28252,13 @@ __export(exports_associationFiles, {
|
|
|
28067
28252
|
import {
|
|
28068
28253
|
access,
|
|
28069
28254
|
mkdir as mkdir12,
|
|
28070
|
-
readFile as
|
|
28255
|
+
readFile as readFile9,
|
|
28071
28256
|
rename as rename4,
|
|
28072
28257
|
rm as rm11,
|
|
28073
|
-
writeFile as
|
|
28258
|
+
writeFile as writeFile10
|
|
28074
28259
|
} from "fs/promises";
|
|
28075
|
-
import { resolve as
|
|
28076
|
-
import { Elysia as
|
|
28260
|
+
import { resolve as resolve47 } from "path";
|
|
28261
|
+
import { Elysia as Elysia4 } from "elysia";
|
|
28077
28262
|
var JSON_HEADERS, OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_OK = 200, VERIFY_TIMEOUT_MS = 1e4, ANDROID_ASSOCIATION_PATH = "/.well-known/assetlinks.json", APPLE_ASSOCIATION_PATH = "/.well-known/apple-app-site-association", missingIdentity = (field, platform) => new TypeError(`${field} is required to publish ${platform} deep-link association files.`), createAppleDocument = (config, requireAll) => {
|
|
28078
28263
|
if (!config.platforms.includes("ios"))
|
|
28079
28264
|
return;
|
|
@@ -28124,7 +28309,7 @@ var JSON_HEADERS, OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_
|
|
|
28124
28309
|
return documents;
|
|
28125
28310
|
}, jsonResponse = (value) => new Response(`${JSON.stringify(value)}
|
|
28126
28311
|
`, { headers: JSON_HEADERS }), createAbsoluteMobileAssociationPlugin = (mobile, projectRoot, options = {}) => {
|
|
28127
|
-
const plugin = new
|
|
28312
|
+
const plugin = new Elysia4({ name: "absolutejs-mobile-associations" });
|
|
28128
28313
|
if (!mobile)
|
|
28129
28314
|
return plugin;
|
|
28130
28315
|
const config = normalizeAbsoluteMobileConfig(mobile, projectRoot);
|
|
@@ -28139,7 +28324,7 @@ var JSON_HEADERS, OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_
|
|
|
28139
28324
|
}, writeAtomic = async (path, source) => {
|
|
28140
28325
|
let current;
|
|
28141
28326
|
try {
|
|
28142
|
-
current = await
|
|
28327
|
+
current = await readFile9(path, "utf8");
|
|
28143
28328
|
} catch (error) {
|
|
28144
28329
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "ENOENT") {
|
|
28145
28330
|
throw error;
|
|
@@ -28148,7 +28333,7 @@ var JSON_HEADERS, OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_
|
|
|
28148
28333
|
if (current === source)
|
|
28149
28334
|
return false;
|
|
28150
28335
|
const temporary = `${path}.${crypto.randomUUID()}.tmp`;
|
|
28151
|
-
await
|
|
28336
|
+
await writeFile10(temporary, source, { flag: "wx" });
|
|
28152
28337
|
await rename4(temporary, path);
|
|
28153
28338
|
return true;
|
|
28154
28339
|
}, exists2 = async (path) => {
|
|
@@ -28159,10 +28344,10 @@ var JSON_HEADERS, OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_
|
|
|
28159
28344
|
return false;
|
|
28160
28345
|
}
|
|
28161
28346
|
}, assertOwnedOutput = async (root) => {
|
|
28162
|
-
const path =
|
|
28347
|
+
const path = resolve47(root, OWNERSHIP_FILE);
|
|
28163
28348
|
let ownership;
|
|
28164
28349
|
try {
|
|
28165
|
-
ownership = JSON.parse(await
|
|
28350
|
+
ownership = JSON.parse(await readFile9(path, "utf8"));
|
|
28166
28351
|
} catch {
|
|
28167
28352
|
throw new TypeError(`Association output ${root} already exists and is not owned by AbsoluteJS.`);
|
|
28168
28353
|
}
|
|
@@ -28186,10 +28371,10 @@ var JSON_HEADERS, OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_
|
|
|
28186
28371
|
if (hasCurrent)
|
|
28187
28372
|
await rm11(backup, { force: true, recursive: true });
|
|
28188
28373
|
}, materializeHost = async (root, host, files) => {
|
|
28189
|
-
const directory =
|
|
28374
|
+
const directory = resolve47(root, host, ".well-known");
|
|
28190
28375
|
await mkdir12(directory, { recursive: true });
|
|
28191
28376
|
return Promise.all(files.map(async ([name, document2]) => {
|
|
28192
|
-
const path =
|
|
28377
|
+
const path = resolve47(directory, name);
|
|
28193
28378
|
await writeAtomic(path, `${JSON.stringify(document2, null, 2)}
|
|
28194
28379
|
`);
|
|
28195
28380
|
return path;
|
|
@@ -28212,7 +28397,7 @@ var JSON_HEADERS, OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_
|
|
|
28212
28397
|
});
|
|
28213
28398
|
return endpoints;
|
|
28214
28399
|
}), materializeAbsoluteMobileAssociationFiles = async (config, outputDirectory) => {
|
|
28215
|
-
const root =
|
|
28400
|
+
const root = resolve47(outputDirectory);
|
|
28216
28401
|
const temporary = `${root}.${crypto.randomUUID()}.tmp`;
|
|
28217
28402
|
const documents = createAbsoluteMobileAssociationDocuments(config, {
|
|
28218
28403
|
requireAll: true
|
|
@@ -28226,10 +28411,10 @@ var JSON_HEADERS, OWNERSHIP_FILE = ".absolutejs-mobile-associations.json", HTTP_
|
|
|
28226
28411
|
await mkdir12(temporary, { recursive: true });
|
|
28227
28412
|
try {
|
|
28228
28413
|
const temporaryPaths = (await Promise.all(config.deepLinkHosts.map((host) => materializeHost(temporary, host, files)))).flat();
|
|
28229
|
-
await writeAtomic(
|
|
28414
|
+
await writeAtomic(resolve47(temporary, OWNERSHIP_FILE), `${JSON.stringify({ format: 1, hosts: config.deepLinkHosts }, null, 2)}
|
|
28230
28415
|
`);
|
|
28231
28416
|
await publishGeneratedDirectory(temporary, root);
|
|
28232
|
-
const written = temporaryPaths.map((path) =>
|
|
28417
|
+
const written = temporaryPaths.map((path) => resolve47(root, path.slice(temporary.length + 1)));
|
|
28233
28418
|
return { root, written };
|
|
28234
28419
|
} catch (error) {
|
|
28235
28420
|
await rm11(temporary, { force: true, recursive: true });
|
|
@@ -28280,7 +28465,7 @@ __export(exports_mobilePreview, {
|
|
|
28280
28465
|
absoluteMobilePreviewDocument: () => absoluteMobilePreviewDocument,
|
|
28281
28466
|
createAbsoluteMobilePreviewPlugin: () => createAbsoluteMobilePreviewPlugin
|
|
28282
28467
|
});
|
|
28283
|
-
import { Elysia as
|
|
28468
|
+
import { Elysia as Elysia5 } from "elysia";
|
|
28284
28469
|
var ABSOLUTE_MOBILE_PREVIEW_PATH = "/__absolute/mobile-preview", escapeHtml2 = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """), isRecord7 = (value) => typeof value === "object" && value !== null, normalizeEntry2 = (entry) => {
|
|
28285
28470
|
const parsed = new URL(entry ?? "/", "https://absolute.invalid");
|
|
28286
28471
|
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
@@ -28320,8 +28505,8 @@ var ABSOLUTE_MOBILE_PREVIEW_PATH = "/__absolute/mobile-preview", escapeHtml2 = (
|
|
|
28320
28505
|
</html>`;
|
|
28321
28506
|
}, createAbsoluteMobilePreviewPlugin = (mobile) => {
|
|
28322
28507
|
if (!mobile)
|
|
28323
|
-
return new
|
|
28324
|
-
return new
|
|
28508
|
+
return new Elysia5({ name: "absolutejs-mobile-preview-disabled" });
|
|
28509
|
+
return new Elysia5({ name: "absolutejs-mobile-preview" }).get(ABSOLUTE_MOBILE_PREVIEW_PATH, () => new Response(absoluteMobilePreviewDocument(mobile), {
|
|
28325
28510
|
headers: {
|
|
28326
28511
|
"Cache-Control": "no-store",
|
|
28327
28512
|
"Content-Security-Policy": "default-src 'self'; script-src 'unsafe-inline' 'self'; style-src 'unsafe-inline'; frame-src 'self'; img-src 'self' data: blob:; connect-src 'self' ws: wss:",
|
|
@@ -28349,11 +28534,11 @@ var init_mobilePreview = __esm(() => {
|
|
|
28349
28534
|
});
|
|
28350
28535
|
|
|
28351
28536
|
// src/mobile/nativeAuth.ts
|
|
28352
|
-
import { readFileSync as
|
|
28353
|
-
import { join as
|
|
28537
|
+
import { readFileSync as readFileSync37 } from "fs";
|
|
28538
|
+
import { join as join54 } from "path";
|
|
28354
28539
|
var ABSOLUTE_AUTH_PACKAGE = "@absolutejs/auth", ABSOLUTE_EXPO_AUTH_CORE_VERSION = "0.76.3", ABSOLUTE_EXPO_AUTH_PACKAGE = "@absolutejs/auth-expo", ABSOLUTE_EXPO_AUTH_VERSION = "0.0.6", ABSOLUTE_EXPO_SYNC_CORE_VERSION = "2.31.0", ABSOLUTE_EXPO_SYNC_PACKAGE = "@absolutejs/sync-expo", ABSOLUTE_EXPO_SYNC_VERSION = "0.0.4", ABSOLUTE_NATIVE_AUTH_CLIENTS_ENV = "ABSOLUTE_AUTH_NATIVE_CLIENTS", ABSOLUTE_NATIVE_AUTH_SCOPES, ABSOLUTE_SYNC_PACKAGE = "@absolutejs/sync", readPackageManifest = (projectRoot) => {
|
|
28355
28540
|
try {
|
|
28356
|
-
return JSON.parse(
|
|
28541
|
+
return JSON.parse(readFileSync37(join54(projectRoot, "package.json"), "utf8"));
|
|
28357
28542
|
} catch {
|
|
28358
28543
|
return;
|
|
28359
28544
|
}
|
|
@@ -28393,8 +28578,8 @@ var init_nativeAuth = __esm(() => {
|
|
|
28393
28578
|
});
|
|
28394
28579
|
|
|
28395
28580
|
// src/mobile/devDeviceAdapter.ts
|
|
28396
|
-
import { access as access2, mkdtemp, rm as rm12, writeFile as
|
|
28397
|
-
import { join as
|
|
28581
|
+
import { access as access2, mkdtemp, rm as rm12, writeFile as writeFile11 } from "fs/promises";
|
|
28582
|
+
import { join as join55 } from "path";
|
|
28398
28583
|
import { tmpdir } from "os";
|
|
28399
28584
|
var absoluteNativeDevAdapterSource = (projectRoot, mobile, resolveModule = (specifier) => specifier, expoAdapterModule = "@absolutejs/absolute/mobile/expo-devices", expoAuthModule = "@absolutejs/absolute/mobile/expo-auth", expoSyncModule = "@absolutejs/absolute/mobile/expo-sync") => {
|
|
28400
28585
|
if ((mobile.engine ?? "capacitor") === "expo") {
|
|
@@ -28432,7 +28617,7 @@ ${auth ? `void createAbsoluteExpoShellAuth(${JSON.stringify(auth)}).then(auth =>
|
|
|
28432
28617
|
`);
|
|
28433
28618
|
}, expoAdapterPath = async () => {
|
|
28434
28619
|
const candidates = await Promise.all(["ts", "js"].map(async (extension) => {
|
|
28435
|
-
const path =
|
|
28620
|
+
const path = join55(import.meta.dir, `shellExpoDevices.${extension}`);
|
|
28436
28621
|
try {
|
|
28437
28622
|
await access2(path);
|
|
28438
28623
|
return path;
|
|
@@ -28446,7 +28631,7 @@ ${auth ? `void createAbsoluteExpoShellAuth(${JSON.stringify(auth)}).then(auth =>
|
|
|
28446
28631
|
throw new TypeError("The AbsoluteJS Expo development adapter is missing.");
|
|
28447
28632
|
}, expoAuthPath = async () => {
|
|
28448
28633
|
const candidates = await Promise.all(["ts", "js"].map(async (extension) => {
|
|
28449
|
-
const path =
|
|
28634
|
+
const path = join55(import.meta.dir, `shellExpoAuth.${extension}`);
|
|
28450
28635
|
try {
|
|
28451
28636
|
await access2(path);
|
|
28452
28637
|
return path;
|
|
@@ -28460,7 +28645,7 @@ ${auth ? `void createAbsoluteExpoShellAuth(${JSON.stringify(auth)}).then(auth =>
|
|
|
28460
28645
|
throw new TypeError("The AbsoluteJS Expo Auth development adapter is missing.");
|
|
28461
28646
|
}, expoSyncPath = async () => {
|
|
28462
28647
|
const candidates = await Promise.all(["ts", "js"].map(async (extension) => {
|
|
28463
|
-
const path =
|
|
28648
|
+
const path = join55(import.meta.dir, `shellExpoSync.${extension}`);
|
|
28464
28649
|
try {
|
|
28465
28650
|
await access2(path);
|
|
28466
28651
|
return path;
|
|
@@ -28473,10 +28658,10 @@ ${auth ? `void createAbsoluteExpoShellAuth(${JSON.stringify(auth)}).then(auth =>
|
|
|
28473
28658
|
return path;
|
|
28474
28659
|
throw new TypeError("The AbsoluteJS Expo Sync development adapter is missing.");
|
|
28475
28660
|
}, buildAbsoluteNativeDevAdapter = async (projectRoot, mobile) => {
|
|
28476
|
-
const temporaryDirectory = await mkdtemp(
|
|
28477
|
-
const entry =
|
|
28661
|
+
const temporaryDirectory = await mkdtemp(join55(tmpdir(), "absolutejs-native-dev-adapter-"));
|
|
28662
|
+
const entry = join55(temporaryDirectory, "entry.ts");
|
|
28478
28663
|
try {
|
|
28479
|
-
await
|
|
28664
|
+
await writeFile11(entry, absoluteNativeDevAdapterSource(projectRoot, mobile, (specifier) => Bun.resolveSync(specifier, projectRoot), await expoAdapterPath(), await expoAuthPath(), await expoSyncPath()));
|
|
28480
28665
|
const result = await Bun.build({
|
|
28481
28666
|
entrypoints: [entry],
|
|
28482
28667
|
format: "esm",
|
|
@@ -28500,11 +28685,11 @@ var init_devDeviceAdapter = __esm(() => {
|
|
|
28500
28685
|
|
|
28501
28686
|
// src/mobile/mobilePreviewClientBundle.ts
|
|
28502
28687
|
import { access as access3 } from "fs/promises";
|
|
28503
|
-
import { join as
|
|
28688
|
+
import { join as join56 } from "path";
|
|
28504
28689
|
var PREVIEW_CLIENT_FILE = "mobilePreviewClient.ts", fileExists = (path) => access3(path).then(() => true, () => false), resolveAbsoluteMobilePreviewClientEntry = async () => {
|
|
28505
28690
|
const candidates = [
|
|
28506
|
-
|
|
28507
|
-
|
|
28691
|
+
join56(import.meta.dir, PREVIEW_CLIENT_FILE),
|
|
28692
|
+
join56(import.meta.dir, "mobile", PREVIEW_CLIENT_FILE)
|
|
28508
28693
|
];
|
|
28509
28694
|
const present = await Promise.all(candidates.map(fileExists));
|
|
28510
28695
|
const entry = candidates.find((_candidate, index) => present[index]);
|
|
@@ -29018,14 +29203,14 @@ import {
|
|
|
29018
29203
|
X509Certificate as X509Certificate3
|
|
29019
29204
|
} from "crypto";
|
|
29020
29205
|
import { access as access4, mkdir as mkdir13 } from "fs/promises";
|
|
29021
|
-
import { dirname as dirname31, isAbsolute as isAbsolute9, relative as
|
|
29206
|
+
import { dirname as dirname31, isAbsolute as isAbsolute9, relative as relative21, resolve as resolve48, sep as sep7 } from "path";
|
|
29022
29207
|
import { pathToFileURL as pathToFileURL3 } from "url";
|
|
29023
|
-
import { Elysia as
|
|
29208
|
+
import { Elysia as Elysia6 } from "elysia";
|
|
29024
29209
|
var ABSOLUTE_MOBILE_UPDATE_SERVER_FORMAT = 1, DEFAULT_MOBILE_UPDATE_REGISTRY_MODULE = "mobile.update.ts", object4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), projectPath = (projectRoot, requested) => {
|
|
29025
|
-
const root =
|
|
29026
|
-
const path =
|
|
29027
|
-
const projectRelative =
|
|
29028
|
-
if (projectRelative === ".." || projectRelative.startsWith(`..${
|
|
29210
|
+
const root = resolve48(projectRoot);
|
|
29211
|
+
const path = resolve48(root, requested);
|
|
29212
|
+
const projectRelative = relative21(root, path);
|
|
29213
|
+
if (projectRelative === ".." || projectRelative.startsWith(`..${sep7}`) || isAbsolute9(projectRelative))
|
|
29029
29214
|
throw new TypeError("mobile.updates.server.registry must remain inside the project.");
|
|
29030
29215
|
return path;
|
|
29031
29216
|
}, isRegistry2 = (value) => object4(value) && [
|
|
@@ -29117,7 +29302,7 @@ var ABSOLUTE_MOBILE_UPDATE_SERVER_FORMAT = 1, DEFAULT_MOBILE_UPDATE_REGISTRY_MOD
|
|
|
29117
29302
|
}, createAbsoluteMobileUpdateServerPlugin = async (config, projectRoot, options = {}) => {
|
|
29118
29303
|
const { updates, updateServer: server } = config;
|
|
29119
29304
|
if (!updates || !server?.autoMount)
|
|
29120
|
-
return new
|
|
29305
|
+
return new Elysia6({ name: "absolutejs-mobile-updates-disabled" });
|
|
29121
29306
|
const module = await loadAbsoluteMobileUpdateServerModule(projectRoot, server.registryModule);
|
|
29122
29307
|
if (options.production) {
|
|
29123
29308
|
await verifyDurableModule(module);
|
|
@@ -29136,7 +29321,7 @@ var ABSOLUTE_MOBILE_UPDATE_SERVER_FORMAT = 1, DEFAULT_MOBILE_UPDATE_REGISTRY_MOD
|
|
|
29136
29321
|
registry: module.registry,
|
|
29137
29322
|
route
|
|
29138
29323
|
});
|
|
29139
|
-
return new
|
|
29324
|
+
return new Elysia6({ name: "absolutejs-mobile-updates" }).all(`${route}/*`, ({ request }) => handler(request));
|
|
29140
29325
|
}, inspectAbsoluteMobileUpdateServer = async (config, projectRoot) => {
|
|
29141
29326
|
if (!config.updates)
|
|
29142
29327
|
return;
|
|
@@ -29294,10 +29479,10 @@ var init_bridgeInternals = __esm(() => {
|
|
|
29294
29479
|
});
|
|
29295
29480
|
|
|
29296
29481
|
// src/dev/angular/hmrCompiler.ts
|
|
29297
|
-
import { dirname as dirname32, relative as
|
|
29482
|
+
import { dirname as dirname32, relative as relative22, resolve as resolve49 } from "path";
|
|
29298
29483
|
import { performance as performance2 } from "perf_hooks";
|
|
29299
29484
|
var encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
29300
|
-
const projectRel =
|
|
29485
|
+
const projectRel = relative22(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
29301
29486
|
return `${projectRel}@${className}`;
|
|
29302
29487
|
}, getApplyMetadataModule = async (encodedId) => {
|
|
29303
29488
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -29306,8 +29491,8 @@ var encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
|
29306
29491
|
return null;
|
|
29307
29492
|
const filePathRel = decoded.slice(0, separatorIndex);
|
|
29308
29493
|
const className = decoded.slice(separatorIndex + 1);
|
|
29309
|
-
const componentFilePath =
|
|
29310
|
-
const projectRelPath =
|
|
29494
|
+
const componentFilePath = resolve49(process.cwd(), filePathRel);
|
|
29495
|
+
const projectRelPath = relative22(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
29311
29496
|
const cacheKey = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
29312
29497
|
await Promise.resolve().then(() => init_fastHmrCompiler());
|
|
29313
29498
|
const cached = takePendingModule(cacheKey);
|
|
@@ -29335,7 +29520,7 @@ var init_hmrCompiler = __esm(() => {
|
|
|
29335
29520
|
});
|
|
29336
29521
|
|
|
29337
29522
|
// src/plugins/hmr.ts
|
|
29338
|
-
import
|
|
29523
|
+
import Elysia7 from "elysia";
|
|
29339
29524
|
import { websocket } from "elysia/websocket";
|
|
29340
29525
|
var STORE_KEY = "__elysiaStore", restoredStores, getGlobalValue = (key) => Reflect.get(globalThis, key), restoreStore = (store) => {
|
|
29341
29526
|
if (!store || typeof store !== "object")
|
|
@@ -29431,7 +29616,7 @@ var STORE_KEY = "__elysiaStore", restoredStores, getGlobalValue = (key) => Refle
|
|
|
29431
29616
|
return candidate;
|
|
29432
29617
|
}
|
|
29433
29618
|
return null;
|
|
29434
|
-
}, hmr = (hmrState, manifest, moduleServerHandler) => new
|
|
29619
|
+
}, hmr = (hmrState, manifest, moduleServerHandler) => new Elysia7({ name: "absolutejs-hmr" }).use(websocket({
|
|
29435
29620
|
idleTimeout: DEFAULT_WEBSOCKET_IDLE_TIMEOUT_SECONDS,
|
|
29436
29621
|
sendPings: true
|
|
29437
29622
|
})).request(async ({ request, store }) => {
|
|
@@ -29511,17 +29696,17 @@ var init_hmr = __esm(() => {
|
|
|
29511
29696
|
});
|
|
29512
29697
|
|
|
29513
29698
|
// src/plugins/devtoolsJson.ts
|
|
29514
|
-
import { existsSync as existsSync42, mkdirSync as mkdirSync14, readFileSync as
|
|
29515
|
-
import { dirname as dirname33, join as
|
|
29516
|
-
import { Elysia as
|
|
29699
|
+
import { existsSync as existsSync42, mkdirSync as mkdirSync14, readFileSync as readFileSync38, writeFileSync as writeFileSync10 } from "fs";
|
|
29700
|
+
import { dirname as dirname33, join as join57, resolve as resolve50 } from "path";
|
|
29701
|
+
import { Elysia as Elysia8 } from "elysia";
|
|
29517
29702
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
29518
29703
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
29519
29704
|
return uuid;
|
|
29520
|
-
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) =>
|
|
29705
|
+
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve50(uuidCachePath ?? join57(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
29521
29706
|
if (!existsSync42(cachePath))
|
|
29522
29707
|
return null;
|
|
29523
29708
|
try {
|
|
29524
|
-
const value =
|
|
29709
|
+
const value = readFileSync38(cachePath, "utf-8").trim();
|
|
29525
29710
|
return isUuidV4(value) ? value : null;
|
|
29526
29711
|
} catch {
|
|
29527
29712
|
return null;
|
|
@@ -29543,10 +29728,10 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
29543
29728
|
writeFileSync10(cachePath, uuid, "utf-8");
|
|
29544
29729
|
return setGlobalUuid(uuid);
|
|
29545
29730
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
29546
|
-
const rootPath =
|
|
29731
|
+
const rootPath = resolve50(options.projectRoot ?? process.cwd());
|
|
29547
29732
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
29548
29733
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
29549
|
-
return new
|
|
29734
|
+
return new Elysia8({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
29550
29735
|
workspace: {
|
|
29551
29736
|
root,
|
|
29552
29737
|
uuid
|
|
@@ -29556,11 +29741,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
29556
29741
|
if (process.env.WSL_DISTRO_NAME) {
|
|
29557
29742
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
29558
29743
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
29559
|
-
return
|
|
29744
|
+
return join57("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
29560
29745
|
}
|
|
29561
29746
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
29562
29747
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
29563
|
-
return
|
|
29748
|
+
return join57("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
29564
29749
|
}
|
|
29565
29750
|
return root;
|
|
29566
29751
|
};
|
|
@@ -29568,8 +29753,8 @@ var init_devtoolsJson = () => {};
|
|
|
29568
29753
|
|
|
29569
29754
|
// src/plugins/imageOptimizer.ts
|
|
29570
29755
|
import { existsSync as existsSync43 } from "fs";
|
|
29571
|
-
import { resolve as
|
|
29572
|
-
import { Elysia as
|
|
29756
|
+
import { resolve as resolve51 } from "path";
|
|
29757
|
+
import { Elysia as Elysia9 } from "elysia";
|
|
29573
29758
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
29574
29759
|
try {
|
|
29575
29760
|
const resolved = validateSafePath(path, baseDir);
|
|
@@ -29581,7 +29766,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
29581
29766
|
}
|
|
29582
29767
|
}, resolveLocalImage = (url, buildDir) => {
|
|
29583
29768
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
29584
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
29769
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve51(process.cwd()));
|
|
29585
29770
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
29586
29771
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
29587
29772
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -29682,7 +29867,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
29682
29867
|
}
|
|
29683
29868
|
});
|
|
29684
29869
|
}, imageOptimizer = (config, buildDir) => {
|
|
29685
|
-
const plugin = new
|
|
29870
|
+
const plugin = new Elysia9({ name: "image-optimizer" });
|
|
29686
29871
|
if (!config && config !== undefined)
|
|
29687
29872
|
return plugin;
|
|
29688
29873
|
if (config?.unoptimized)
|
|
@@ -29779,7 +29964,7 @@ var init_imageOptimizer = __esm(() => {
|
|
|
29779
29964
|
});
|
|
29780
29965
|
|
|
29781
29966
|
// src/dev/requestInspector.ts
|
|
29782
|
-
import { Elysia as
|
|
29967
|
+
import { Elysia as Elysia10 } from "elysia";
|
|
29783
29968
|
var RING_MAX = 200, DEFAULT_STATUS = 200, ASSET_EXTENSION, requestLog = () => {
|
|
29784
29969
|
globalThis.__absoluteRequestLog ??= [];
|
|
29785
29970
|
return globalThis.__absoluteRequestLog;
|
|
@@ -29815,7 +30000,7 @@ var RING_MAX = 200, DEFAULT_STATUS = 200, ASSET_EXTENSION, requestLog = () => {
|
|
|
29815
30000
|
var init_requestInspector = __esm(() => {
|
|
29816
30001
|
ASSET_EXTENSION = /\.(?:avif|css|gif|ico|jpe?g|js|json|map|mjs|otf|png|svg|ttf|txt|wasm|webp|woff2?)$/i;
|
|
29817
30002
|
pending = new WeakMap;
|
|
29818
|
-
requestInspector = new
|
|
30003
|
+
requestInspector = new Elysia10({
|
|
29819
30004
|
name: "absolute-request-inspector"
|
|
29820
30005
|
}).get("/__absolute/requests", () => requestLog()).request(({ request }) => {
|
|
29821
30006
|
noteDevRequestStart();
|
|
@@ -30078,13 +30263,13 @@ import { createHash as createHash7 } from "crypto";
|
|
|
30078
30263
|
import {
|
|
30079
30264
|
mkdir as mkdir14,
|
|
30080
30265
|
mkdtemp as mkdtemp2,
|
|
30081
|
-
readFile as
|
|
30082
|
-
readdir as
|
|
30266
|
+
readFile as readFile10,
|
|
30267
|
+
readdir as readdir6,
|
|
30083
30268
|
rename as rename5,
|
|
30084
30269
|
rm as rm13,
|
|
30085
|
-
writeFile as
|
|
30270
|
+
writeFile as writeFile12
|
|
30086
30271
|
} from "fs/promises";
|
|
30087
|
-
import { join as
|
|
30272
|
+
import { join as join58, resolve as resolvePath } from "path";
|
|
30088
30273
|
import { pathToFileURL as pathToFileURL4 } from "url";
|
|
30089
30274
|
var DEFAULT_MAX_PRODUCER_BYTES = 134217728, SHA_2562 = "sha256", ARTIFACT_FILE = "artifact.json", RELEASE_ID_PATTERN, DEFAULT_BLOB_PREFIX = "absolutejs/mobile-compatibility", hashBlob = async (blob) => {
|
|
30090
30275
|
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
@@ -30099,7 +30284,7 @@ var DEFAULT_MAX_PRODUCER_BYTES = 134217728, SHA_2562 = "sha256", ARTIFACT_FILE =
|
|
|
30099
30284
|
}
|
|
30100
30285
|
return releaseId;
|
|
30101
30286
|
}, readStoredArtifact = async (releaseDirectory) => {
|
|
30102
|
-
const serialized = await
|
|
30287
|
+
const serialized = await readFile10(join58(releaseDirectory, ARTIFACT_FILE), "utf8");
|
|
30103
30288
|
const parsed = JSON.parse(serialized);
|
|
30104
30289
|
return parseAbsoluteMobileCompatibilityArtifact(parsed);
|
|
30105
30290
|
}, validateStoredIdentity = (artifact, appId, releaseId) => {
|
|
@@ -30194,8 +30379,8 @@ var DEFAULT_MAX_PRODUCER_BYTES = 134217728, SHA_2562 = "sha256", ARTIFACT_FILE =
|
|
|
30194
30379
|
}, createAbsoluteMobileFileArtifactStore = (options) => {
|
|
30195
30380
|
const root = resolvePath(options.root);
|
|
30196
30381
|
const maxProducerBytes = options.maxProducerBytes ?? DEFAULT_MAX_PRODUCER_BYTES;
|
|
30197
|
-
const appDirectory = (appId) =>
|
|
30198
|
-
const releaseDirectory = (appId, releaseId) =>
|
|
30382
|
+
const appDirectory = (appId) => join58(root, appDirectoryName(appId));
|
|
30383
|
+
const releaseDirectory = (appId, releaseId) => join58(appDirectory(appId), requireReleaseId(releaseId));
|
|
30199
30384
|
const acceptExistingRelease = async (error, artifact) => {
|
|
30200
30385
|
if (!errorHasCode(error, "EEXIST") && !errorHasCode(error, "ENOTEMPTY")) {
|
|
30201
30386
|
return false;
|
|
@@ -30213,7 +30398,7 @@ var DEFAULT_MAX_PRODUCER_BYTES = 134217728, SHA_2562 = "sha256", ARTIFACT_FILE =
|
|
|
30213
30398
|
list: async (appId) => {
|
|
30214
30399
|
let entries;
|
|
30215
30400
|
try {
|
|
30216
|
-
entries = await
|
|
30401
|
+
entries = await readdir6(appDirectory(appId), {
|
|
30217
30402
|
withFileTypes: true
|
|
30218
30403
|
});
|
|
30219
30404
|
} catch (error) {
|
|
@@ -30236,7 +30421,7 @@ var DEFAULT_MAX_PRODUCER_BYTES = 134217728, SHA_2562 = "sha256", ARTIFACT_FILE =
|
|
|
30236
30421
|
}
|
|
30237
30422
|
return {
|
|
30238
30423
|
artifact,
|
|
30239
|
-
producer: Bun.file(
|
|
30424
|
+
producer: Bun.file(join58(directory, artifact.producer.module))
|
|
30240
30425
|
};
|
|
30241
30426
|
},
|
|
30242
30427
|
write: async (release) => {
|
|
@@ -30244,16 +30429,16 @@ var DEFAULT_MAX_PRODUCER_BYTES = 134217728, SHA_2562 = "sha256", ARTIFACT_FILE =
|
|
|
30244
30429
|
const validated = await verifyAbsoluteMobileCompatibilityProducer({ artifact: validatedArtifact, producer: release.producer }, maxProducerBytes);
|
|
30245
30430
|
const parent = appDirectory(validated.artifact.appId);
|
|
30246
30431
|
await mkdir14(parent, { recursive: true });
|
|
30247
|
-
const staging = await mkdtemp2(
|
|
30248
|
-
const producerPath =
|
|
30432
|
+
const staging = await mkdtemp2(join58(parent, ".stage-"));
|
|
30433
|
+
const producerPath = join58(staging, validated.artifact.producer.module);
|
|
30249
30434
|
try {
|
|
30250
30435
|
await mkdir14(resolvePath(producerPath, ".."), {
|
|
30251
30436
|
recursive: true
|
|
30252
30437
|
});
|
|
30253
30438
|
await Promise.all([
|
|
30254
|
-
|
|
30439
|
+
writeFile12(join58(staging, ARTIFACT_FILE), `${JSON.stringify(validated.artifact, null, "\t")}
|
|
30255
30440
|
`),
|
|
30256
|
-
|
|
30441
|
+
writeFile12(producerPath, new Uint8Array(await validated.producer.arrayBuffer()))
|
|
30257
30442
|
]);
|
|
30258
30443
|
await rename5(staging, releaseDirectory(validated.artifact.appId, validated.artifact.releaseId));
|
|
30259
30444
|
} catch (error) {
|
|
@@ -30303,12 +30488,12 @@ import {
|
|
|
30303
30488
|
access as access5,
|
|
30304
30489
|
mkdir as mkdir15,
|
|
30305
30490
|
mkdtemp as mkdtemp3,
|
|
30306
|
-
readFile as
|
|
30491
|
+
readFile as readFile11,
|
|
30307
30492
|
rename as rename6,
|
|
30308
30493
|
rm as rm14,
|
|
30309
|
-
writeFile as
|
|
30494
|
+
writeFile as writeFile13
|
|
30310
30495
|
} from "fs/promises";
|
|
30311
|
-
import { dirname as dirname34, join as
|
|
30496
|
+
import { dirname as dirname34, join as join59, resolve as resolvePath2 } from "path";
|
|
30312
30497
|
import { pathToFileURL as pathToFileURL5 } from "url";
|
|
30313
30498
|
var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "current.json", BUNDLES_DIRECTORY = "bundles", ARTIFACT_FILE2 = "artifact.json", BUNDLE_ID_PATTERN, isRecord9 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), errorHasCode2 = (error, code) => typeof error === "object" && error !== null && Reflect.get(error, "code") === code, bundleIdFor = (currentReleaseId, releases) => {
|
|
30314
30499
|
const identity = JSON.stringify({
|
|
@@ -30339,16 +30524,16 @@ var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "curre
|
|
|
30339
30524
|
releases
|
|
30340
30525
|
};
|
|
30341
30526
|
}, writeRelease = async (root, release) => {
|
|
30342
|
-
const directory =
|
|
30343
|
-
const producerPath =
|
|
30527
|
+
const directory = join59(root, release.artifact.releaseId);
|
|
30528
|
+
const producerPath = join59(directory, release.artifact.producer.module);
|
|
30344
30529
|
await mkdir15(dirname34(producerPath), { recursive: true });
|
|
30345
30530
|
await Promise.all([
|
|
30346
|
-
|
|
30531
|
+
writeFile13(join59(directory, ARTIFACT_FILE2), `${JSON.stringify(release.artifact, null, "\t")}
|
|
30347
30532
|
`),
|
|
30348
|
-
|
|
30533
|
+
writeFile13(producerPath, new Uint8Array(await release.producer.arrayBuffer()))
|
|
30349
30534
|
]);
|
|
30350
30535
|
}, installImmutableBundle = async (bundlesRoot, bundleId, releases) => {
|
|
30351
|
-
const destination =
|
|
30536
|
+
const destination = join59(bundlesRoot, bundleId);
|
|
30352
30537
|
try {
|
|
30353
30538
|
await access5(destination);
|
|
30354
30539
|
return destination;
|
|
@@ -30356,7 +30541,7 @@ var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "curre
|
|
|
30356
30541
|
if (!errorHasCode2(error, "ENOENT"))
|
|
30357
30542
|
throw error;
|
|
30358
30543
|
}
|
|
30359
|
-
const staging = await mkdtemp3(
|
|
30544
|
+
const staging = await mkdtemp3(join59(bundlesRoot, ".stage-"));
|
|
30360
30545
|
try {
|
|
30361
30546
|
await Promise.all(releases.map((release) => writeRelease(staging, release)));
|
|
30362
30547
|
await rename6(staging, destination);
|
|
@@ -30387,15 +30572,15 @@ var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "curre
|
|
|
30387
30572
|
};
|
|
30388
30573
|
}, loadAbsoluteMobileMaterializedBundle = async (root) => {
|
|
30389
30574
|
const resolvedRoot = resolvePath2(root);
|
|
30390
|
-
const serialized = await
|
|
30575
|
+
const serialized = await readFile11(join59(resolvedRoot, CURRENT_BUNDLE_FILE), "utf8");
|
|
30391
30576
|
const parsed = JSON.parse(serialized);
|
|
30392
30577
|
const index = parseBundleIndex(parsed);
|
|
30393
|
-
const bundleRoot =
|
|
30578
|
+
const bundleRoot = join59(resolvedRoot, BUNDLES_DIRECTORY, index.bundleId);
|
|
30394
30579
|
return {
|
|
30395
30580
|
artifacts: index.releases,
|
|
30396
30581
|
currentReleaseId: index.currentReleaseId,
|
|
30397
30582
|
loadProducer: async (artifact) => {
|
|
30398
|
-
const modulePath =
|
|
30583
|
+
const modulePath = join59(bundleRoot, artifact.releaseId, artifact.producer.module);
|
|
30399
30584
|
await verifyAbsoluteMobileCompatibilityProducer({
|
|
30400
30585
|
artifact,
|
|
30401
30586
|
producer: Bun.file(modulePath)
|
|
@@ -30421,7 +30606,7 @@ var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "curre
|
|
|
30421
30606
|
return release;
|
|
30422
30607
|
});
|
|
30423
30608
|
const root = resolvePath2(input.root);
|
|
30424
|
-
const bundlesRoot =
|
|
30609
|
+
const bundlesRoot = join59(root, BUNDLES_DIRECTORY);
|
|
30425
30610
|
await mkdir15(bundlesRoot, { recursive: true });
|
|
30426
30611
|
const bundleId = bundleIdFor(input.currentReleaseId, artifacts);
|
|
30427
30612
|
await installImmutableBundle(bundlesRoot, bundleId, orderedReleases);
|
|
@@ -30431,21 +30616,21 @@ var ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT = 1, CURRENT_BUNDLE_FILE = "curre
|
|
|
30431
30616
|
format: ABSOLUTE_MOBILE_MATERIALIZED_BUNDLE_FORMAT,
|
|
30432
30617
|
releases: artifacts
|
|
30433
30618
|
};
|
|
30434
|
-
const pointerPath =
|
|
30435
|
-
const temporaryPointerPath =
|
|
30436
|
-
await
|
|
30619
|
+
const pointerPath = join59(root, CURRENT_BUNDLE_FILE);
|
|
30620
|
+
const temporaryPointerPath = join59(root, `.current-${crypto.randomUUID()}.json`);
|
|
30621
|
+
await writeFile13(temporaryPointerPath, `${JSON.stringify(index, null, "\t")}
|
|
30437
30622
|
`, { flag: "wx" });
|
|
30438
30623
|
await rename6(temporaryPointerPath, pointerPath);
|
|
30439
30624
|
return index;
|
|
30440
30625
|
}, readAbsoluteMobileMaterializedReleases = async (root) => {
|
|
30441
30626
|
const resolvedRoot = resolvePath2(root);
|
|
30442
30627
|
try {
|
|
30443
|
-
const serialized = await
|
|
30628
|
+
const serialized = await readFile11(join59(resolvedRoot, CURRENT_BUNDLE_FILE), "utf8");
|
|
30444
30629
|
const parsed = JSON.parse(serialized);
|
|
30445
30630
|
const index = parseBundleIndex(parsed);
|
|
30446
|
-
const bundleRoot =
|
|
30631
|
+
const bundleRoot = join59(resolvedRoot, BUNDLES_DIRECTORY, index.bundleId);
|
|
30447
30632
|
return Promise.all(index.releases.map(async (artifact) => {
|
|
30448
|
-
const producer = Bun.file(
|
|
30633
|
+
const producer = Bun.file(join59(bundleRoot, artifact.releaseId, artifact.producer.module));
|
|
30449
30634
|
await verifyAbsoluteMobileCompatibilityProducer({
|
|
30450
30635
|
artifact,
|
|
30451
30636
|
producer
|
|
@@ -30853,7 +31038,7 @@ var exports_compatibilityDispatcher = {};
|
|
|
30853
31038
|
__export(exports_compatibilityDispatcher, {
|
|
30854
31039
|
createAbsoluteMobileCompatibilityDispatcher: () => createAbsoluteMobileCompatibilityDispatcher
|
|
30855
31040
|
});
|
|
30856
|
-
import { Elysia as
|
|
31041
|
+
import { Elysia as Elysia11 } from "elysia";
|
|
30857
31042
|
var MOBILE_WEBVIEW_ORIGINS, MOBILE_REQUEST_HEADER_NAMES, MOBILE_CORS_ALLOW_HEADERS, MOBILE_CORS_METHODS, mobileWebViewOrigin = (request) => {
|
|
30858
31043
|
const origin = request.headers.get("origin");
|
|
30859
31044
|
return origin && MOBILE_WEBVIEW_ORIGINS.has(origin) ? origin : undefined;
|
|
@@ -30908,7 +31093,7 @@ var MOBILE_WEBVIEW_ORIGINS, MOBILE_REQUEST_HEADER_NAMES, MOBILE_CORS_ALLOW_HEADE
|
|
|
30908
31093
|
throw new TypeError("currentReleaseId must identify a retained compatibility artifact.");
|
|
30909
31094
|
}
|
|
30910
31095
|
const resolveProducer = createProducerResolver(options.loadProducer);
|
|
30911
|
-
return new
|
|
31096
|
+
return new Elysia11({ name: "absolutejs-mobile-compatibility-dispatcher" }).request(async ({ request }) => {
|
|
30912
31097
|
if (getCurrentAbsoluteMobileProducerContext())
|
|
30913
31098
|
return;
|
|
30914
31099
|
const preflight = mobilePreflightResponse(request);
|
|
@@ -30979,15 +31164,15 @@ var init_compatibilityDispatcher = __esm(() => {
|
|
|
30979
31164
|
});
|
|
30980
31165
|
|
|
30981
31166
|
// src/core/prerender.ts
|
|
30982
|
-
import { mkdirSync as mkdirSync15, readFileSync as
|
|
30983
|
-
import { join as
|
|
31167
|
+
import { mkdirSync as mkdirSync15, readFileSync as readFileSync39 } from "fs";
|
|
31168
|
+
import { join as join60 } from "path";
|
|
30984
31169
|
var DEFAULT_FETCH_TIMEOUT_MS = 1e4, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
30985
31170
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
30986
31171
|
await Bun.write(metaPath, String(Date.now()));
|
|
30987
31172
|
}, readTimestamp = (htmlPath) => {
|
|
30988
31173
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
30989
31174
|
try {
|
|
30990
|
-
const content =
|
|
31175
|
+
const content = readFileSync39(metaPath, "utf-8");
|
|
30991
31176
|
return Number(content) || 0;
|
|
30992
31177
|
} catch {
|
|
30993
31178
|
return 0;
|
|
@@ -31004,7 +31189,7 @@ var DEFAULT_FETCH_TIMEOUT_MS = 1e4, PRERENDER_BYPASS_HEADER = "X-Absolute-Preren
|
|
|
31004
31189
|
if (!isCompleteHtml(html))
|
|
31005
31190
|
return false;
|
|
31006
31191
|
const fileName = routeToFilename(route);
|
|
31007
|
-
const filePath =
|
|
31192
|
+
const filePath = join60(prerenderDir, fileName);
|
|
31008
31193
|
await Bun.write(filePath, html);
|
|
31009
31194
|
await writeTimestamp(filePath);
|
|
31010
31195
|
return true;
|
|
@@ -31023,9 +31208,9 @@ var init_prerender = () => {};
|
|
|
31023
31208
|
|
|
31024
31209
|
// src/core/prepare.ts
|
|
31025
31210
|
import { createHash as createHash9 } from "crypto";
|
|
31026
|
-
import { existsSync as existsSync44, readdirSync as readdirSync12, readFileSync as
|
|
31027
|
-
import { basename as basename19, join as
|
|
31028
|
-
import { Elysia as
|
|
31211
|
+
import { existsSync as existsSync44, readdirSync as readdirSync12, readFileSync as readFileSync40 } from "fs";
|
|
31212
|
+
import { basename as basename19, join as join61, relative as relative23, resolve as resolvePath3 } from "path";
|
|
31213
|
+
import { Elysia as Elysia12, NotFound } from "elysia";
|
|
31029
31214
|
var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_PLUGIN_RETRY_DELAY_MS = 50, waitForStaticPluginRetry = () => new Promise((resolve) => {
|
|
31030
31215
|
setTimeout(resolve, STATIC_PLUGIN_RETRY_DELAY_MS);
|
|
31031
31216
|
}), retryStaticPlugin = async (createStaticPlugin, options) => {
|
|
@@ -31033,7 +31218,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31033
31218
|
return await createStaticPlugin(options);
|
|
31034
31219
|
} catch (error) {
|
|
31035
31220
|
logWarn(`Static asset routes were skipped this cycle \u2014 a build file was unavailable mid-rebuild: ${error instanceof Error ? error.message : String(error)}`);
|
|
31036
|
-
return new
|
|
31221
|
+
return new Elysia12({ name: "absolutejs-static-fallback" });
|
|
31037
31222
|
}
|
|
31038
31223
|
}, mountStaticPlugin = async (createStaticPlugin, options) => {
|
|
31039
31224
|
try {
|
|
@@ -31044,7 +31229,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31044
31229
|
}
|
|
31045
31230
|
}, MOBILE_DEV_MODULE_HEADERS, NATIVE_DEVICE_ADAPTER_PATH = "/__absolute/native-device-adapter.js", MOBILE_PREVIEW_CLIENT_PATH = "/__absolute/mobile-preview-client.js", loadMobileDevPlugin = async (mobile) => {
|
|
31046
31231
|
if (!mobile)
|
|
31047
|
-
return new
|
|
31232
|
+
return new Elysia12({ name: "absolutejs-mobile-disabled" });
|
|
31048
31233
|
const [
|
|
31049
31234
|
{ createAbsoluteMobileAssociationPlugin },
|
|
31050
31235
|
{ createAbsoluteMobilePreviewPlugin }
|
|
@@ -31055,14 +31240,14 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31055
31240
|
let nativeDevAdapterBundle;
|
|
31056
31241
|
const getNativeDevAdapterBundle = () => nativeDevAdapterBundle ??= Promise.resolve().then(() => (init_devDeviceAdapter(), {})).then(({}) => buildAbsoluteNativeDevAdapter(process.cwd(), mobile));
|
|
31057
31242
|
const getMobilePreviewClientBundle = () => Promise.resolve().then(() => (init_mobilePreviewClientBundle(), {})).then(({}) => getAbsoluteMobilePreviewClientBundle());
|
|
31058
|
-
return new
|
|
31243
|
+
return new Elysia12({ name: "absolutejs-mobile-dev" }).use(createAbsoluteMobileAssociationPlugin(mobile, process.cwd())).use(createAbsoluteMobilePreviewPlugin(mobile)).get(NATIVE_DEVICE_ADAPTER_PATH, async () => new Response(await getNativeDevAdapterBundle(), {
|
|
31059
31244
|
headers: MOBILE_DEV_MODULE_HEADERS
|
|
31060
31245
|
})).get(MOBILE_PREVIEW_CLIENT_PATH, async () => new Response(await getMobilePreviewClientBundle(), {
|
|
31061
31246
|
headers: MOBILE_DEV_MODULE_HEADERS
|
|
31062
31247
|
}));
|
|
31063
31248
|
}, loadMobileAssociationPlugin = async (mobile) => {
|
|
31064
31249
|
if (!mobile) {
|
|
31065
|
-
return new
|
|
31250
|
+
return new Elysia12({ name: "absolutejs-mobile-associations-disabled" });
|
|
31066
31251
|
}
|
|
31067
31252
|
await Promise.resolve().then(() => init_associationFiles());
|
|
31068
31253
|
return createAbsoluteMobileAssociationPlugin(mobile, process.cwd(), {
|
|
@@ -31070,7 +31255,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31070
31255
|
});
|
|
31071
31256
|
}, loadMobileUpdatePlugin = async (mobile, production) => {
|
|
31072
31257
|
if (!mobile?.updates)
|
|
31073
|
-
return new
|
|
31258
|
+
return new Elysia12({ name: "absolutejs-mobile-updates-unconfigured" });
|
|
31074
31259
|
const [
|
|
31075
31260
|
{ normalizeAbsoluteMobileConfig },
|
|
31076
31261
|
{ createAbsoluteMobileUpdateServerPlugin }
|
|
@@ -31113,7 +31298,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31113
31298
|
return files;
|
|
31114
31299
|
}, PREWARM_MAX_PAUSE_MS = 60000, toWarmTasks = function* (files, warmCache, srcUrlPrefix) {
|
|
31115
31300
|
for (const file of files) {
|
|
31116
|
-
const rel =
|
|
31301
|
+
const rel = relative23(process.cwd(), file).replace(/\\/g, "/");
|
|
31117
31302
|
yield () => warmCache(`${srcUrlPrefix}${rel}`);
|
|
31118
31303
|
}
|
|
31119
31304
|
}, builtPageSources = () => {
|
|
@@ -31154,8 +31339,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31154
31339
|
const srcPath = resolvePath3(devIndexDir, fileName);
|
|
31155
31340
|
if (!existsSync44(srcPath))
|
|
31156
31341
|
continue;
|
|
31157
|
-
|
|
31158
|
-
manifest[key] = `${SRC_URL_PREFIX}${rel}`;
|
|
31342
|
+
manifest[key] = `${SRC_URL_PREFIX}${encodeSrcPath(relative23(process.cwd(), srcPath))}`;
|
|
31159
31343
|
}
|
|
31160
31344
|
}, ICON_HASH_LENGTH = 8, registerIconVersioning = (buildDir) => {
|
|
31161
31345
|
const cache = new Map;
|
|
@@ -31166,10 +31350,10 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31166
31350
|
if (cached !== undefined)
|
|
31167
31351
|
return cached;
|
|
31168
31352
|
const path = href.split("?")[0] ?? href;
|
|
31169
|
-
const filePath =
|
|
31353
|
+
const filePath = join61(buildDir, path);
|
|
31170
31354
|
let versioned = href;
|
|
31171
31355
|
if (existsSync44(filePath)) {
|
|
31172
|
-
const hash = createHash9("sha256").update(
|
|
31356
|
+
const hash = createHash9("sha256").update(readFileSync40(filePath)).digest("hex").slice(0, ICON_HASH_LENGTH);
|
|
31173
31357
|
versioned = href.includes("?") ? `${href}&v=${hash}` : `${href}?v=${hash}`;
|
|
31174
31358
|
}
|
|
31175
31359
|
cache.set(href, versioned);
|
|
@@ -31264,7 +31448,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31264
31448
|
const { serverTiming } = await import("@elysia/server-timing");
|
|
31265
31449
|
const mobileDevPlugin = await loadMobileDevPlugin(config.mobile);
|
|
31266
31450
|
const mobileUpdatePlugin = await loadMobileUpdatePlugin(config.mobile, false);
|
|
31267
|
-
const absolutejs = new
|
|
31451
|
+
const absolutejs = new Elysia12({ name: "absolutejs-runtime" }).use(requestInspector).use(absoluteRequestContext).use(serverTiming()).use(devtoolsJson(buildDir, {
|
|
31268
31452
|
normalizeForWindowsContainer: config.dev?.devtools?.normalizeForWindowsContainer,
|
|
31269
31453
|
projectRoot: config.dev?.devtools?.projectRoot,
|
|
31270
31454
|
uuid: config.dev?.devtools?.uuid,
|
|
@@ -31302,13 +31486,13 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31302
31486
|
continue;
|
|
31303
31487
|
const name = basename19(entry, ".html");
|
|
31304
31488
|
const route = name === "index" ? "/" : `/${name}`;
|
|
31305
|
-
map.set(route,
|
|
31489
|
+
map.set(route, join61(prerenderDir, entry));
|
|
31306
31490
|
}
|
|
31307
31491
|
return map;
|
|
31308
31492
|
}, loadMobileCompatibilityPlugin = async (buildDir) => {
|
|
31309
|
-
const root =
|
|
31310
|
-
if (!existsSync44(
|
|
31311
|
-
return new
|
|
31493
|
+
const root = join61(buildDir, ".absolutejs", "mobile-compatibility");
|
|
31494
|
+
if (!existsSync44(join61(root, "current.json"))) {
|
|
31495
|
+
return new Elysia12({ name: "absolutejs-mobile-compatibility-empty" });
|
|
31312
31496
|
}
|
|
31313
31497
|
const [
|
|
31314
31498
|
{ loadAbsoluteMobileMaterializedBundle },
|
|
@@ -31319,12 +31503,12 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31319
31503
|
]);
|
|
31320
31504
|
const options = await loadAbsoluteMobileMaterializedBundle(root);
|
|
31321
31505
|
return createAbsoluteMobileCompatibilityDispatcher(options);
|
|
31322
|
-
}, createNotFoundPlugin = () => new
|
|
31506
|
+
}, createNotFoundPlugin = () => new Elysia12({ name: "absolutejs-not-found" }).error("global", NotFound, async () => {
|
|
31323
31507
|
const response = await renderFirstNotFound();
|
|
31324
31508
|
if (response)
|
|
31325
31509
|
return response;
|
|
31326
31510
|
return;
|
|
31327
|
-
}), createBuildErrorRecoveryPlugin = () => new
|
|
31511
|
+
}), createBuildErrorRecoveryPlugin = () => new Elysia12({ name: "absolutejs-build-error-recovery" }).error("global", async ({ error }) => {
|
|
31328
31512
|
const message = error instanceof Error ? error.message : String(error);
|
|
31329
31513
|
const assetMatch = /^Asset "(.+)" not found in manifest\.$/.exec(message);
|
|
31330
31514
|
if (!assetMatch)
|
|
@@ -31363,7 +31547,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31363
31547
|
return result;
|
|
31364
31548
|
}
|
|
31365
31549
|
stepStartedAt = performance.now();
|
|
31366
|
-
const manifest = JSON.parse(
|
|
31550
|
+
const manifest = JSON.parse(readFileSync40(`${buildDir}/manifest.json`, "utf-8"));
|
|
31367
31551
|
setCurrentIslandManifest(manifest);
|
|
31368
31552
|
if (config.islands?.registry) {
|
|
31369
31553
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -31371,14 +31555,14 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31371
31555
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
31372
31556
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
31373
31557
|
stepStartedAt = performance.now();
|
|
31374
|
-
const conventionsPath =
|
|
31558
|
+
const conventionsPath = join61(buildDir, "conventions.json");
|
|
31375
31559
|
if (existsSync44(conventionsPath)) {
|
|
31376
|
-
const conventions = JSON.parse(
|
|
31560
|
+
const conventions = JSON.parse(readFileSync40(conventionsPath, "utf-8"));
|
|
31377
31561
|
setConventions(conventions);
|
|
31378
31562
|
}
|
|
31379
|
-
const spaRoutesPath =
|
|
31563
|
+
const spaRoutesPath = join61(buildDir, "spa-routes.json");
|
|
31380
31564
|
if (existsSync44(spaRoutesPath)) {
|
|
31381
|
-
setSpaRouteManifest(JSON.parse(
|
|
31565
|
+
setSpaRouteManifest(JSON.parse(readFileSync40(spaRoutesPath, "utf-8")));
|
|
31382
31566
|
}
|
|
31383
31567
|
recordStep("load production conventions", stepStartedAt);
|
|
31384
31568
|
stepStartedAt = performance.now();
|
|
@@ -31389,12 +31573,12 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31389
31573
|
prefix: "",
|
|
31390
31574
|
staticLimit: MAX_STATIC_ROUTE_COUNT
|
|
31391
31575
|
});
|
|
31392
|
-
const generatedAssetsRoot =
|
|
31393
|
-
const generatedAssetsPlugin = new
|
|
31576
|
+
const generatedAssetsRoot = join61(buildDir, ".absolutejs");
|
|
31577
|
+
const generatedAssetsPlugin = new Elysia12({
|
|
31394
31578
|
name: "absolutejs-generated-assets"
|
|
31395
31579
|
}).get("/.absolutejs/*", async ({ params, set }) => {
|
|
31396
31580
|
const requestedPath = resolvePath3(generatedAssetsRoot, params["*"]);
|
|
31397
|
-
if (
|
|
31581
|
+
if (relative23(generatedAssetsRoot, requestedPath).startsWith("..")) {
|
|
31398
31582
|
set.status = 404;
|
|
31399
31583
|
return "Not Found";
|
|
31400
31584
|
}
|
|
@@ -31406,15 +31590,9 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31406
31590
|
set.headers["cache-control"] = "public, max-age=31536000, immutable";
|
|
31407
31591
|
return file;
|
|
31408
31592
|
});
|
|
31593
|
+
const precompressedFiles = await createPrecompressedPlugin(buildDir);
|
|
31409
31594
|
recordStep("create static plugin", stepStartedAt);
|
|
31410
|
-
const
|
|
31411
|
-
if (pathname.startsWith("/.absolutejs/"))
|
|
31412
|
-
return true;
|
|
31413
|
-
const base = pathname.slice(pathname.lastIndexOf("/") + 1);
|
|
31414
|
-
const hash = base.match(/[.-]([0-9a-z]{6,12})\.[0-9a-z]+$/i)?.[1];
|
|
31415
|
-
return hash ? /[0-9]/.test(hash) && /[a-z]/i.test(hash) : false;
|
|
31416
|
-
};
|
|
31417
|
-
const assetCachePlugin = new Elysia11({
|
|
31595
|
+
const assetCachePlugin = new Elysia12({
|
|
31418
31596
|
name: "absolutejs-asset-cache"
|
|
31419
31597
|
}).afterHandle("global", ({ request, responseValue }) => {
|
|
31420
31598
|
if (!(responseValue instanceof Response))
|
|
@@ -31424,10 +31602,10 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31424
31602
|
const { pathname } = new URL(request.url);
|
|
31425
31603
|
if (pathname.endsWith("/") || !/\.[0-9a-z]+$/i.test(pathname))
|
|
31426
31604
|
return;
|
|
31427
|
-
responseValue.headers.set("cache-control",
|
|
31605
|
+
responseValue.headers.set("cache-control", assetCacheControl(pathname));
|
|
31428
31606
|
});
|
|
31429
31607
|
stepStartedAt = performance.now();
|
|
31430
|
-
const prerenderDir =
|
|
31608
|
+
const prerenderDir = join61(buildDir, "_prerendered");
|
|
31431
31609
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
31432
31610
|
const mobileCompatibilityPlugin = await loadMobileCompatibilityPlugin(buildDir);
|
|
31433
31611
|
const mobileAssociationPlugin = await loadMobileAssociationPlugin(config.mobile);
|
|
@@ -31438,7 +31616,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31438
31616
|
const revalidateMs = config.static?.revalidate ? config.static.revalidate * MS_PER_SECOND2 : 0;
|
|
31439
31617
|
const port = Number(process.env.PORT) || DEFAULT_PORT2;
|
|
31440
31618
|
const rerendering = new Set;
|
|
31441
|
-
const prerenderPlugin = new
|
|
31619
|
+
const prerenderPlugin = new Elysia12({
|
|
31442
31620
|
name: "prerendered-pages"
|
|
31443
31621
|
}).request(({ request }) => {
|
|
31444
31622
|
const url = new URL(request.url);
|
|
@@ -31461,7 +31639,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31461
31639
|
});
|
|
31462
31640
|
stepStartedAt = performance.now();
|
|
31463
31641
|
await Promise.resolve().then(() => init_imageOptimizer());
|
|
31464
|
-
const absolutejs = new
|
|
31642
|
+
const absolutejs = new Elysia12({ name: "absolutejs-runtime" }).use(absoluteRequestContext).use(mobileAssociationPlugin).use(mobileCompatibilityPlugin).use(mobileUpdatePlugin).use(assetCachePlugin).use(imageOptimizer(config.images, buildDir)).use(prerenderPlugin).use(precompressedFiles).use(staticFiles).use(generatedAssetsPlugin).use(createNotFoundPlugin());
|
|
31465
31643
|
await withOpenApi(absolutejs, config, process.cwd(), false);
|
|
31466
31644
|
await withTelemetry(absolutejs, config, process.cwd());
|
|
31467
31645
|
recordStep("assemble production runtime", stepStartedAt);
|
|
@@ -31470,7 +31648,7 @@ var MS_PER_SECOND2 = 1000, DEFAULT_PORT2 = 3000, MAX_STATIC_ROUTE_COUNT, STATIC_
|
|
|
31470
31648
|
}
|
|
31471
31649
|
stepStartedAt = performance.now();
|
|
31472
31650
|
await Promise.resolve().then(() => init_imageOptimizer());
|
|
31473
|
-
const absolutejs = new
|
|
31651
|
+
const absolutejs = new Elysia12({ name: "absolutejs-runtime" }).use(absoluteRequestContext).use(mobileAssociationPlugin).use(mobileCompatibilityPlugin).use(mobileUpdatePlugin).use(assetCachePlugin).use(imageOptimizer(config.images, buildDir)).use(precompressedFiles).use(staticFiles).use(generatedAssetsPlugin).use(createNotFoundPlugin());
|
|
31474
31652
|
await withOpenApi(absolutejs, config, process.cwd(), false);
|
|
31475
31653
|
await withTelemetry(absolutejs, config, process.cwd());
|
|
31476
31654
|
recordStep("assemble production runtime", stepStartedAt);
|
|
@@ -31527,6 +31705,7 @@ var init_prepare = __esm(() => {
|
|
|
31527
31705
|
init_bootTimeline();
|
|
31528
31706
|
init_logger();
|
|
31529
31707
|
init_bootLifecycle();
|
|
31708
|
+
init_precompressed();
|
|
31530
31709
|
init_idleScheduler();
|
|
31531
31710
|
MAX_STATIC_ROUTE_COUNT = Number.MAX_SAFE_INTEGER;
|
|
31532
31711
|
MOBILE_DEV_MODULE_HEADERS = {
|
|
@@ -31552,8 +31731,8 @@ __export(exports_moduleServer, {
|
|
|
31552
31731
|
warmPage: () => warmPage,
|
|
31553
31732
|
warnIfReactFastRefreshUnsupported: () => warnIfReactFastRefreshUnsupported
|
|
31554
31733
|
});
|
|
31555
|
-
import { existsSync as existsSync45, readFileSync as
|
|
31556
|
-
import { basename as basename20, dirname as dirname35, extname as
|
|
31734
|
+
import { existsSync as existsSync45, readFileSync as readFileSync41, realpathSync as realpathSync6, statSync as statSync9 } from "fs";
|
|
31735
|
+
import { basename as basename20, dirname as dirname35, extname as extname16, join as join62, resolve as resolve52, relative as relative24 } from "path";
|
|
31557
31736
|
var SRC_PREFIX = "/@src/", BROWSER_DEFINE, jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
31558
31737
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
31559
31738
|
const allExports = [];
|
|
@@ -31573,10 +31752,10 @@ var SRC_PREFIX = "/@src/", BROWSER_DEFINE, jsTranspiler2, legacyDecoratorTsconfi
|
|
|
31573
31752
|
${stubs}
|
|
31574
31753
|
`;
|
|
31575
31754
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
31576
|
-
const directHit = extensions.find((ext) => existsSync45(
|
|
31755
|
+
const directHit = extensions.find((ext) => existsSync45(resolve52(projectRoot, srcPath + ext)));
|
|
31577
31756
|
if (directHit)
|
|
31578
31757
|
return srcPath + directHit;
|
|
31579
|
-
const indexHit = extensions.find((ext) => existsSync45(
|
|
31758
|
+
const indexHit = extensions.find((ext) => existsSync45(resolve52(projectRoot, srcPath, `index${ext}`)));
|
|
31580
31759
|
if (indexHit)
|
|
31581
31760
|
return `${srcPath}/index${indexHit}`;
|
|
31582
31761
|
return srcPath;
|
|
@@ -31604,8 +31783,8 @@ ${stubs}
|
|
|
31604
31783
|
const invalidationVersion = getInvalidationVersion(absPath);
|
|
31605
31784
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
31606
31785
|
}, srcUrl = (relPath, projectRoot) => {
|
|
31607
|
-
const base = `${SRC_PREFIX}${relPath
|
|
31608
|
-
const absPath =
|
|
31786
|
+
const base = `${SRC_PREFIX}${encodeSrcPath(relPath)}`;
|
|
31787
|
+
const absPath = resolve52(projectRoot, relPath);
|
|
31609
31788
|
const cached = mtimeCache.get(absPath);
|
|
31610
31789
|
if (cached !== undefined)
|
|
31611
31790
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -31617,12 +31796,12 @@ ${stubs}
|
|
|
31617
31796
|
return base;
|
|
31618
31797
|
}
|
|
31619
31798
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
31620
|
-
const absPath =
|
|
31621
|
-
const rel =
|
|
31622
|
-
const extension =
|
|
31799
|
+
const absPath = resolve52(fileDir, relPath);
|
|
31800
|
+
const rel = relative24(projectRoot, absPath);
|
|
31801
|
+
const extension = extname16(rel);
|
|
31623
31802
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
31624
|
-
if (
|
|
31625
|
-
srcPath =
|
|
31803
|
+
if (extname16(srcPath) === ".svelte") {
|
|
31804
|
+
srcPath = relative24(projectRoot, resolveSvelteModulePath(resolve52(projectRoot, srcPath)));
|
|
31626
31805
|
}
|
|
31627
31806
|
return srcUrl(srcPath, projectRoot);
|
|
31628
31807
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -31634,27 +31813,27 @@ ${stubs}
|
|
|
31634
31813
|
"import"
|
|
31635
31814
|
]);
|
|
31636
31815
|
if (fromExports)
|
|
31637
|
-
return
|
|
31816
|
+
return relative24(projectRoot, fromExports);
|
|
31638
31817
|
try {
|
|
31639
31818
|
const isScoped = specifier.startsWith("@");
|
|
31640
31819
|
const parts = specifier.split("/");
|
|
31641
31820
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
31642
31821
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
31643
31822
|
if (!subpath) {
|
|
31644
|
-
const pkgDir =
|
|
31645
|
-
const pkgJsonPath =
|
|
31823
|
+
const pkgDir = resolve52(projectRoot, "node_modules", packageName ?? "");
|
|
31824
|
+
const pkgJsonPath = join62(pkgDir, "package.json");
|
|
31646
31825
|
if (existsSync45(pkgJsonPath)) {
|
|
31647
|
-
const pkg = JSON.parse(
|
|
31826
|
+
const pkg = JSON.parse(readFileSync41(pkgJsonPath, "utf-8"));
|
|
31648
31827
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
31649
31828
|
if (esmEntry) {
|
|
31650
|
-
const resolved =
|
|
31829
|
+
const resolved = resolve52(pkgDir, esmEntry);
|
|
31651
31830
|
if (existsSync45(resolved))
|
|
31652
|
-
return
|
|
31831
|
+
return relative24(projectRoot, resolved);
|
|
31653
31832
|
}
|
|
31654
31833
|
}
|
|
31655
31834
|
}
|
|
31656
31835
|
} catch {}
|
|
31657
|
-
return
|
|
31836
|
+
return relative24(projectRoot, Bun.resolveSync(specifier, projectRoot));
|
|
31658
31837
|
} catch {
|
|
31659
31838
|
return;
|
|
31660
31839
|
}
|
|
@@ -31693,22 +31872,24 @@ ${stubs}
|
|
|
31693
31872
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => isRealImport(relPath) ? `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}` : _match);
|
|
31694
31873
|
const rewriteAbsoluteToSrc = (_match, prefix, absPath, _ext, suffix) => {
|
|
31695
31874
|
if (absPath.startsWith(projectRoot)) {
|
|
31696
|
-
const rel =
|
|
31875
|
+
const rel = relative24(projectRoot, absPath).replace(/\\/g, "/");
|
|
31697
31876
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
31698
31877
|
}
|
|
31699
|
-
|
|
31878
|
+
if (!existsSync45(absPath))
|
|
31879
|
+
return _match;
|
|
31880
|
+
const rel = relative24(projectRoot, absPath).replace(/\\/g, "/");
|
|
31700
31881
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
31701
31882
|
};
|
|
31702
31883
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
31703
31884
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
31704
31885
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
31705
|
-
const absPath =
|
|
31706
|
-
const rel =
|
|
31886
|
+
const absPath = resolve52(fileDir, relPath);
|
|
31887
|
+
const rel = relative24(projectRoot, absPath);
|
|
31707
31888
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
31708
31889
|
});
|
|
31709
31890
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
31710
|
-
const absPath =
|
|
31711
|
-
const rel =
|
|
31891
|
+
const absPath = resolve52(fileDir, relPath);
|
|
31892
|
+
const rel = relative24(projectRoot, absPath);
|
|
31712
31893
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
31713
31894
|
});
|
|
31714
31895
|
return result;
|
|
@@ -31753,7 +31934,7 @@ ${code}`;
|
|
|
31753
31934
|
reactFastRefreshWarningEmitted = true;
|
|
31754
31935
|
logWarn("React edits remount the page instead of keeping component state: " + "this Bun ignores `reactFastRefresh` on Bun.Transpiler " + "(https://github.com/oven-sh/bun/issues/32919). Run " + "`absolute bun-patch install` to use AbsoluteJS's patched Bun, " + "which has the fix; `absolute dev` then uses it automatically.");
|
|
31755
31936
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
31756
|
-
const raw =
|
|
31937
|
+
const raw = readFileSync41(filePath, "utf-8");
|
|
31757
31938
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
31758
31939
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
31759
31940
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -31764,13 +31945,13 @@ ${code}`;
|
|
|
31764
31945
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
31765
31946
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
31766
31947
|
${transpiled}`;
|
|
31767
|
-
const relPath =
|
|
31948
|
+
const relPath = relative24(projectRoot, filePath).replace(/\\/g, "/");
|
|
31768
31949
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
31769
31950
|
transpiled += buildIslandMetadataExports(raw);
|
|
31770
31951
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
31771
31952
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
31772
|
-
const raw =
|
|
31773
|
-
const ext =
|
|
31953
|
+
const raw = readFileSync41(filePath, "utf-8");
|
|
31954
|
+
const ext = extname16(filePath);
|
|
31774
31955
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
31775
31956
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
31776
31957
|
let transpiler = jsTranspiler2;
|
|
@@ -31925,17 +32106,17 @@ ${code}`;
|
|
|
31925
32106
|
if (compiled.css?.code) {
|
|
31926
32107
|
const cssPath = `${filePath}.css`;
|
|
31927
32108
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
31928
|
-
const cssUrl = srcUrl(
|
|
32109
|
+
const cssUrl = srcUrl(relative24(projectRoot, cssPath), projectRoot);
|
|
31929
32110
|
code = `import "${cssUrl}";
|
|
31930
32111
|
${code}`;
|
|
31931
32112
|
}
|
|
31932
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
32113
|
+
const moduleUrl = `${SRC_PREFIX}${encodeSrcPath(relative24(projectRoot, filePath))}`;
|
|
31933
32114
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
31934
32115
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
31935
32116
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
31936
32117
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
31937
32118
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
31938
|
-
const raw =
|
|
32119
|
+
const raw = readFileSync41(filePath, "utf-8");
|
|
31939
32120
|
if (!svelteCompiler) {
|
|
31940
32121
|
svelteCompiler = await import("svelte/compiler");
|
|
31941
32122
|
}
|
|
@@ -32001,7 +32182,7 @@ export default __script__;`;
|
|
|
32001
32182
|
return `${cssInjection}
|
|
32002
32183
|
${code}`;
|
|
32003
32184
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
32004
|
-
const rawSource =
|
|
32185
|
+
const rawSource = readFileSync41(filePath, "utf-8");
|
|
32005
32186
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
32006
32187
|
if (!vueCompiler) {
|
|
32007
32188
|
vueCompiler = await loadVueCompiler();
|
|
@@ -32013,8 +32194,8 @@ ${code}`;
|
|
|
32013
32194
|
const compiledScript = hasScript ? vueCompiler.compileScript(descriptor, {
|
|
32014
32195
|
fs: {
|
|
32015
32196
|
fileExists: isFile,
|
|
32016
|
-
realpath:
|
|
32017
|
-
readFile: (file) => isFile(file) ?
|
|
32197
|
+
realpath: realpathSync6,
|
|
32198
|
+
readFile: (file) => isFile(file) ? readFileSync41(file, "utf-8") : undefined
|
|
32018
32199
|
},
|
|
32019
32200
|
id: componentId,
|
|
32020
32201
|
inlineTemplate: false
|
|
@@ -32029,8 +32210,8 @@ ${code}`;
|
|
|
32029
32210
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
32030
32211
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
32031
32212
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
32032
|
-
const hmrBase = vueDir ?
|
|
32033
|
-
const hmrId =
|
|
32213
|
+
const hmrBase = vueDir ? resolve52(vueDir) : projectRoot;
|
|
32214
|
+
const hmrId = relative24(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
32034
32215
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
32035
32216
|
result += [
|
|
32036
32217
|
"",
|
|
@@ -32061,7 +32242,7 @@ ${code}`;
|
|
|
32061
32242
|
}
|
|
32062
32243
|
});
|
|
32063
32244
|
}, handleCssRequest = (filePath) => {
|
|
32064
|
-
const raw =
|
|
32245
|
+
const raw = readFileSync41(filePath, "utf-8");
|
|
32065
32246
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
32066
32247
|
return [
|
|
32067
32248
|
`const style = document.createElement('style');`,
|
|
@@ -32156,7 +32337,7 @@ ${code}`;
|
|
|
32156
32337
|
"Content-Type": "application/javascript"
|
|
32157
32338
|
}
|
|
32158
32339
|
}), buildStubCode = async (specifier, requested = []) => {
|
|
32159
|
-
const discovered = await
|
|
32340
|
+
const discovered = await importFromProject(specifier).then((mod) => Object.keys(mod).filter((key) => key !== "default" && key !== "__esModule"), () => []);
|
|
32160
32341
|
const names = [...new Set([...discovered, ...requested])];
|
|
32161
32342
|
if (names.length === 0)
|
|
32162
32343
|
return `export default {};
|
|
@@ -32190,8 +32371,8 @@ export default {};
|
|
|
32190
32371
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
32191
32372
|
return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
|
|
32192
32373
|
}, resolveSourcePath2 = (relPath, projectRoot) => {
|
|
32193
|
-
const filePath =
|
|
32194
|
-
const ext =
|
|
32374
|
+
const filePath = resolve52(projectRoot, decodeSrcPath(relPath));
|
|
32375
|
+
const ext = extname16(filePath);
|
|
32195
32376
|
if (ext === ".svelte")
|
|
32196
32377
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
32197
32378
|
if (ext)
|
|
@@ -32227,14 +32408,14 @@ export default {};
|
|
|
32227
32408
|
const absoluteCandidate = `/${tail.replace(/^\/+/, "")}`;
|
|
32228
32409
|
const candidates = [
|
|
32229
32410
|
absoluteCandidate,
|
|
32230
|
-
|
|
32411
|
+
resolve52(projectRoot, tail)
|
|
32231
32412
|
];
|
|
32232
32413
|
try {
|
|
32233
32414
|
await Promise.resolve().then(() => init_loadConfig());
|
|
32234
32415
|
const cfg = await loadConfig();
|
|
32235
|
-
const angularDir = cfg.angularDirectory &&
|
|
32416
|
+
const angularDir = cfg.angularDirectory && resolve52(projectRoot, cfg.angularDirectory);
|
|
32236
32417
|
if (angularDir)
|
|
32237
|
-
candidates.push(
|
|
32418
|
+
candidates.push(resolve52(angularDir, tail));
|
|
32238
32419
|
} catch {}
|
|
32239
32420
|
for (const candidate of candidates) {
|
|
32240
32421
|
if (await fileExists(candidate)) {
|
|
@@ -32265,7 +32446,7 @@ export default {};
|
|
|
32265
32446
|
if (!TRANSPILABLE.has(ext))
|
|
32266
32447
|
return;
|
|
32267
32448
|
const stat = statSync9(filePath);
|
|
32268
|
-
const resolvedVueDir = vueDir ?
|
|
32449
|
+
const resolvedVueDir = vueDir ? resolve52(vueDir) : undefined;
|
|
32269
32450
|
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
32270
32451
|
const isAngularGeneratedJs = ext === ".js" && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
32271
32452
|
if (isAngularGeneratedJs) {
|
|
@@ -32321,7 +32502,7 @@ export default {};
|
|
|
32321
32502
|
const ownMessage = source && typeof source === "object" ? Reflect.get(source, "message") : undefined;
|
|
32322
32503
|
const message = typeof ownMessage === "string" ? ownMessage : String(source);
|
|
32323
32504
|
return { message, ...readPosition(first) };
|
|
32324
|
-
}, getTransformError = (filePath) => transformErrors.get(
|
|
32505
|
+
}, getTransformError = (filePath) => transformErrors.get(resolve52(filePath)), transformErrorResponse = (err) => {
|
|
32325
32506
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
32326
32507
|
return new Response(`console.error('[ModuleServer] Transform error:', ${JSON.stringify(errMsg)});`, {
|
|
32327
32508
|
headers: { "Content-Type": "application/javascript" },
|
|
@@ -32344,16 +32525,16 @@ export default {};
|
|
|
32344
32525
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
32345
32526
|
if (relPath === "bun:wrap" || relPath.startsWith("bun:wrap?"))
|
|
32346
32527
|
return handleBunWrapRequest();
|
|
32347
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
32528
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve52(projectRoot, decodeSrcPath(relPath)));
|
|
32348
32529
|
if (virtualCssResponse)
|
|
32349
32530
|
return virtualCssResponse;
|
|
32350
32531
|
const { filePath, ext } = resolveSourcePath2(relPath, projectRoot);
|
|
32351
32532
|
try {
|
|
32352
32533
|
const response = await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue, stylePreprocessors);
|
|
32353
|
-
transformErrors.delete(
|
|
32534
|
+
transformErrors.delete(resolve52(filePath));
|
|
32354
32535
|
return response;
|
|
32355
32536
|
} catch (err) {
|
|
32356
|
-
transformErrors.set(
|
|
32537
|
+
transformErrors.set(resolve52(filePath), describeTransformError(err));
|
|
32357
32538
|
return transformErrorResponse(err);
|
|
32358
32539
|
}
|
|
32359
32540
|
};
|
|
@@ -32363,11 +32544,11 @@ export default {};
|
|
|
32363
32544
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
32364
32545
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
32365
32546
|
if (match[1])
|
|
32366
|
-
files.push(
|
|
32547
|
+
files.push(resolve52(projectRoot, decodeSrcPath(match[1])));
|
|
32367
32548
|
}
|
|
32368
32549
|
return files;
|
|
32369
32550
|
}, SRC_URL_PREFIX2, invalidateModule = (filePath) => {
|
|
32370
|
-
const resolved =
|
|
32551
|
+
const resolved = resolve52(filePath);
|
|
32371
32552
|
transformErrors.delete(resolved);
|
|
32372
32553
|
invalidate(filePath);
|
|
32373
32554
|
if (resolved !== filePath)
|
|
@@ -32433,7 +32614,7 @@ export default {};
|
|
|
32433
32614
|
return false;
|
|
32434
32615
|
}
|
|
32435
32616
|
await Promise.resolve().then(() => init_prepare());
|
|
32436
|
-
patchManifestIndexes(cached.manifest,
|
|
32617
|
+
patchManifestIndexes(cached.manifest, resolve52(state.resolvedPaths.buildDir, "_src_indexes"), SRC_PREFIX);
|
|
32437
32618
|
logPageBuild(entry.source, entry.framework, Math.round(durationMs));
|
|
32438
32619
|
logStartupTimingBlock("AbsoluteJS on-demand page build", [
|
|
32439
32620
|
{ durationMs, label: entry.name }
|
|
@@ -32692,11 +32873,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
32692
32873
|
__export(exports_simpleHTMLHMR, {
|
|
32693
32874
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
32694
32875
|
});
|
|
32695
|
-
import { resolve as
|
|
32876
|
+
import { resolve as resolve53 } from "path";
|
|
32696
32877
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
32697
32878
|
let htmlContent;
|
|
32698
32879
|
try {
|
|
32699
|
-
const resolvedPath =
|
|
32880
|
+
const resolvedPath = resolve53(htmlFilePath);
|
|
32700
32881
|
const file = Bun.file(resolvedPath);
|
|
32701
32882
|
if (!await file.exists()) {
|
|
32702
32883
|
return null;
|
|
@@ -32722,11 +32903,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
32722
32903
|
__export(exports_simpleHTMXHMR, {
|
|
32723
32904
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
32724
32905
|
});
|
|
32725
|
-
import { resolve as
|
|
32906
|
+
import { resolve as resolve54 } from "path";
|
|
32726
32907
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
32727
32908
|
let htmlContent;
|
|
32728
32909
|
try {
|
|
32729
|
-
const resolvedPath =
|
|
32910
|
+
const resolvedPath = resolve54(htmxFilePath);
|
|
32730
32911
|
const file = Bun.file(resolvedPath);
|
|
32731
32912
|
if (!await file.exists()) {
|
|
32732
32913
|
return null;
|
|
@@ -32748,10 +32929,10 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
32748
32929
|
var init_simpleHTMXHMR = () => {};
|
|
32749
32930
|
|
|
32750
32931
|
// src/dev/backendGraph.ts
|
|
32751
|
-
import { readFileSync as
|
|
32752
|
-
import { dirname as dirname36, extname as
|
|
32932
|
+
import { readFileSync as readFileSync42, realpathSync as realpathSync7, statSync as statSync10 } from "fs";
|
|
32933
|
+
import { dirname as dirname36, extname as extname17, resolve as resolve55 } from "path";
|
|
32753
32934
|
var SOURCE_FILE, VENDORED, LOADERS, fileCache, transpilers, transpilerFor = (path) => {
|
|
32754
|
-
const loader = LOADERS[
|
|
32935
|
+
const loader = LOADERS[extname17(path)] ?? "ts";
|
|
32755
32936
|
const existing = transpilers.get(loader);
|
|
32756
32937
|
if (existing)
|
|
32757
32938
|
return existing;
|
|
@@ -32760,11 +32941,11 @@ var SOURCE_FILE, VENDORED, LOADERS, fileCache, transpilers, transpilerFor = (pat
|
|
|
32760
32941
|
return created;
|
|
32761
32942
|
}, realPath2 = (path) => {
|
|
32762
32943
|
try {
|
|
32763
|
-
return
|
|
32944
|
+
return realpathSync7(path);
|
|
32764
32945
|
} catch {
|
|
32765
32946
|
return path;
|
|
32766
32947
|
}
|
|
32767
|
-
}, isProjectModule = (path, root = process.cwd()) => SOURCE_FILE.test(path) && !VENDORED.test(path) &&
|
|
32948
|
+
}, isProjectModule = (path, root = process.cwd()) => SOURCE_FILE.test(path) && !VENDORED.test(path) && resolve55(path).startsWith(resolve55(root)), resolveImport = (specifier, fromFile) => {
|
|
32768
32949
|
try {
|
|
32769
32950
|
return realPath2(Bun.resolveSync(specifier, dirname36(fromFile)));
|
|
32770
32951
|
} catch {
|
|
@@ -32783,20 +32964,20 @@ var SOURCE_FILE, VENDORED, LOADERS, fileCache, transpilers, transpilerFor = (pat
|
|
|
32783
32964
|
return cached.imports;
|
|
32784
32965
|
let imports = [];
|
|
32785
32966
|
try {
|
|
32786
|
-
const source =
|
|
32967
|
+
const source = readFileSync42(path, "utf-8");
|
|
32787
32968
|
imports = transpilerFor(path).scanImports(source).map((entry) => resolveImport(entry.path, path)).filter((target) => target !== undefined);
|
|
32788
32969
|
} catch {}
|
|
32789
32970
|
fileCache.set(path, { imports, mtimeMs });
|
|
32790
32971
|
return imports;
|
|
32791
32972
|
}, importersOf = (target, entry, loaded = loadedProjectModules(entry)) => {
|
|
32792
|
-
const goal = realPath2(
|
|
32973
|
+
const goal = realPath2(resolve55(target));
|
|
32793
32974
|
const importers = [];
|
|
32794
32975
|
for (const file of loaded)
|
|
32795
32976
|
if (readImports(file).includes(goal))
|
|
32796
32977
|
importers.push(file);
|
|
32797
32978
|
return importers;
|
|
32798
32979
|
}, loadedProjectModules = (entry, loaded = Object.keys(__require.cache), root = process.cwd()) => {
|
|
32799
|
-
const entryPath = realPath2(
|
|
32980
|
+
const entryPath = realPath2(resolve55(entry));
|
|
32800
32981
|
const modules = new Set([entryPath]);
|
|
32801
32982
|
for (const path of loaded) {
|
|
32802
32983
|
if (isAbsoluteServerEntryCopyPath(path))
|
|
@@ -32825,9 +33006,9 @@ var init_backendGraph = __esm(() => {
|
|
|
32825
33006
|
});
|
|
32826
33007
|
|
|
32827
33008
|
// src/dev/hot/analyze.ts
|
|
32828
|
-
import { dirname as dirname37, extname as
|
|
33009
|
+
import { dirname as dirname37, extname as extname18 } from "path";
|
|
32829
33010
|
var ANALYZER_VERSION = 1, hashText = (text) => Bun.hash(text).toString(36), scriptKindFor = (tsc, path) => {
|
|
32830
|
-
switch (
|
|
33011
|
+
switch (extname18(path)) {
|
|
32831
33012
|
case ".tsx":
|
|
32832
33013
|
return tsc.ScriptKind.TSX;
|
|
32833
33014
|
case ".jsx":
|
|
@@ -33581,11 +33762,11 @@ var init_runtime = __esm(() => {
|
|
|
33581
33762
|
});
|
|
33582
33763
|
|
|
33583
33764
|
// src/dev/hot/plugin.ts
|
|
33584
|
-
import { mkdirSync as mkdirSync16, readFileSync as
|
|
33585
|
-
import { extname as
|
|
33765
|
+
import { mkdirSync as mkdirSync16, readFileSync as readFileSync43, realpathSync as realpathSync8, writeFileSync as writeFileSync11 } from "fs";
|
|
33766
|
+
import { extname as extname19, join as join63, relative as relative25, resolve as resolve56, sep as sep8 } from "path";
|
|
33586
33767
|
var SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, realPath3 = (path) => {
|
|
33587
33768
|
try {
|
|
33588
|
-
return
|
|
33769
|
+
return realpathSync8(path);
|
|
33589
33770
|
} catch {
|
|
33590
33771
|
return path;
|
|
33591
33772
|
}
|
|
@@ -33599,13 +33780,14 @@ var SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, realPath3 = (path) => {
|
|
|
33599
33780
|
const file = realPath3(path);
|
|
33600
33781
|
if (!SOURCE.test(file))
|
|
33601
33782
|
return false;
|
|
33602
|
-
|
|
33783
|
+
const root = [state.root, ...state.extraRoots ?? []].find((candidate) => file.startsWith(`${candidate}${sep8}`));
|
|
33784
|
+
if (root === undefined)
|
|
33603
33785
|
return false;
|
|
33604
|
-
if (file.startsWith(`${ABSOLUTE_ROOT}${
|
|
33786
|
+
if (file.startsWith(`${ABSOLUTE_ROOT}${sep8}src${sep8}`))
|
|
33605
33787
|
return false;
|
|
33606
|
-
if (file.startsWith(`${ABSOLUTE_ROOT}${
|
|
33788
|
+
if (file.startsWith(`${ABSOLUTE_ROOT}${sep8}dist${sep8}`))
|
|
33607
33789
|
return false;
|
|
33608
|
-
if (GENERATED.test(file.slice(
|
|
33790
|
+
if (GENERATED.test(file.slice(root.length)))
|
|
33609
33791
|
return false;
|
|
33610
33792
|
if (TEST_FILE.test(file))
|
|
33611
33793
|
return false;
|
|
@@ -33613,7 +33795,7 @@ var SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, realPath3 = (path) => {
|
|
|
33613
33795
|
return false;
|
|
33614
33796
|
if (isAbsoluteServerEntryCopyPath(file))
|
|
33615
33797
|
return false;
|
|
33616
|
-
return !state.excludedDirs.some((dir) => file === dir || file.startsWith(`${dir}${
|
|
33798
|
+
return !state.excludedDirs.some((dir) => file === dir || file.startsWith(`${dir}${sep8}`));
|
|
33617
33799
|
}, isAnalysis = (value) => {
|
|
33618
33800
|
if (typeof value !== "object" || value === null)
|
|
33619
33801
|
return false;
|
|
@@ -33621,12 +33803,12 @@ var SOURCE, TEST_FILE, GENERATED, ABSOLUTE_ROOT, realPath3 = (path) => {
|
|
|
33621
33803
|
if (status === false)
|
|
33622
33804
|
return typeof Reflect.get(value, "reason") === "string";
|
|
33623
33805
|
return status === true && typeof Reflect.get(value, "code") === "string" && typeof Reflect.get(value, "exports") === "object" && Array.isArray(Reflect.get(value, "reexports")) && Array.isArray(Reflect.get(value, "plan"));
|
|
33624
|
-
}, cachePath = (cacheDir, key) =>
|
|
33806
|
+
}, cachePath = (cacheDir, key) => join63(cacheDir, `${key}.json`), readCached = (key) => {
|
|
33625
33807
|
const state = shared.installed;
|
|
33626
33808
|
if (!state)
|
|
33627
33809
|
return;
|
|
33628
33810
|
try {
|
|
33629
|
-
const cached = JSON.parse(
|
|
33811
|
+
const cached = JSON.parse(readFileSync43(cachePath(state.cacheDir, key), "utf-8"));
|
|
33630
33812
|
return isAnalysis(cached) ? cached : undefined;
|
|
33631
33813
|
} catch {
|
|
33632
33814
|
return;
|
|
@@ -33660,7 +33842,7 @@ var init_plugin = __esm(() => {
|
|
|
33660
33842
|
SOURCE = /\.(?:[cm]?[jt]sx?)$/;
|
|
33661
33843
|
TEST_FILE = /(?:\.(?:spec|test)\.[cm]?[jt]sx?$)|(?:[\\/]__tests__[\\/])/;
|
|
33662
33844
|
GENERATED = /(?:^|[\\/])(?:build|generated|compiled|indexes|\.absolutejs|node_modules|dist)(?:[\\/]|$)/;
|
|
33663
|
-
ABSOLUTE_ROOT =
|
|
33845
|
+
ABSOLUTE_ROOT = resolve56(import.meta.dir, "..", "..", "..");
|
|
33664
33846
|
shared = globalThis.__absoluteHotPlugin ??= {
|
|
33665
33847
|
analyses: new Map,
|
|
33666
33848
|
installed: undefined
|
|
@@ -33669,11 +33851,11 @@ var init_plugin = __esm(() => {
|
|
|
33669
33851
|
});
|
|
33670
33852
|
|
|
33671
33853
|
// src/dev/hot/reload.ts
|
|
33672
|
-
import { readFileSync as
|
|
33673
|
-
import { relative as
|
|
33854
|
+
import { readFileSync as readFileSync44, realpathSync as realpathSync9 } from "fs";
|
|
33855
|
+
import { relative as relative26 } from "path";
|
|
33674
33856
|
var MAX_PROPAGATION_STEPS = 500, realPath4 = (path) => {
|
|
33675
33857
|
try {
|
|
33676
|
-
return
|
|
33858
|
+
return realpathSync9(path);
|
|
33677
33859
|
} catch {
|
|
33678
33860
|
return path;
|
|
33679
33861
|
}
|
|
@@ -33708,7 +33890,7 @@ var MAX_PROPAGATION_STEPS = 500, realPath4 = (path) => {
|
|
|
33708
33890
|
if (typeof namespace !== "object" || namespace === null)
|
|
33709
33891
|
throw new Error(`${path} did not evaluate to a module`);
|
|
33710
33892
|
return Object.fromEntries(Object.entries(namespace));
|
|
33711
|
-
}, display = (path) =>
|
|
33893
|
+
}, display = (path) => relative26(process.cwd(), path) || path, SLOW_UPDATE_MS = 500, SLOWEST_SHOWN = 3, statementLabel = (id) => {
|
|
33712
33894
|
const name = id.slice(id.indexOf(":") + 1);
|
|
33713
33895
|
return /^\d+$/.test(name) ? `statement #${name}` : name;
|
|
33714
33896
|
}, slowestStatements = (modules) => modules.flatMap((module) => [...moduleRecord(module)?.lastTimings ?? []].map(([id, duration]) => ({
|
|
@@ -33747,7 +33929,7 @@ var MAX_PROPAGATION_STEPS = 500, realPath4 = (path) => {
|
|
|
33747
33929
|
return { status: "entry" };
|
|
33748
33930
|
if (!moduleRecord(path) || !isHotManaged(path))
|
|
33749
33931
|
return { status: "unmanaged" };
|
|
33750
|
-
const source =
|
|
33932
|
+
const source = readFileSync44(path, "utf-8");
|
|
33751
33933
|
if (moduleRecord(path)?.source === source)
|
|
33752
33934
|
return { status: "unchanged" };
|
|
33753
33935
|
const analysis = await analyzeSource(path, source);
|
|
@@ -33841,10 +34023,10 @@ import {
|
|
|
33841
34023
|
basename as basename21,
|
|
33842
34024
|
dirname as dirname38,
|
|
33843
34025
|
isAbsolute as isAbsolute10,
|
|
33844
|
-
join as
|
|
33845
|
-
relative as
|
|
34026
|
+
join as join64,
|
|
34027
|
+
relative as relative27,
|
|
33846
34028
|
resolve as resolvePath4,
|
|
33847
|
-
sep as
|
|
34029
|
+
sep as sep9
|
|
33848
34030
|
} from "path";
|
|
33849
34031
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSsrCssCaches = () => {
|
|
33850
34032
|
clearSpaRouteCssCaches();
|
|
@@ -33968,8 +34150,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
33968
34150
|
const relJs = `${rel.slice(0, -ext[0].length)}.js`;
|
|
33969
34151
|
const generatedDir = getFrameworkGeneratedDir(framework, cwd);
|
|
33970
34152
|
for (const candidate of [
|
|
33971
|
-
|
|
33972
|
-
`${
|
|
34153
|
+
join64(generatedDir, relJs),
|
|
34154
|
+
`${join64(generatedDir, relJs)}.map`
|
|
33973
34155
|
]) {
|
|
33974
34156
|
try {
|
|
33975
34157
|
rmSync4(candidate, { force: true });
|
|
@@ -34214,7 +34396,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
34214
34396
|
const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
|
|
34215
34397
|
state.assetStore.set(webPath, new Uint8Array(bytes));
|
|
34216
34398
|
state.fileHashes.set(absSource, currentHash);
|
|
34217
|
-
logHmrUpdate(
|
|
34399
|
+
logHmrUpdate(relative27(process.cwd(), filePath));
|
|
34218
34400
|
broadcastToClients(state, {
|
|
34219
34401
|
data: {
|
|
34220
34402
|
framework: urlPrefix || "public",
|
|
@@ -34236,7 +34418,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
34236
34418
|
applyBackendEdit(resolvePath4(filePath)).catch((error) => console.error("[hmr] server update for a React file failed:", error));
|
|
34237
34419
|
if (framework === "unknown") {
|
|
34238
34420
|
invalidate(resolvePath4(filePath));
|
|
34239
|
-
const relPath =
|
|
34421
|
+
const relPath = relative27(process.cwd(), filePath);
|
|
34240
34422
|
logHmrUpdate(relPath);
|
|
34241
34423
|
let hasFrontendDependent = false;
|
|
34242
34424
|
let hasAngularDependent = false;
|
|
@@ -34797,7 +34979,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
34797
34979
|
const angularDirAbs = resolvePath4(angularDir);
|
|
34798
34980
|
const filesUnderAngular = Array.from(editedFiles).filter((file) => {
|
|
34799
34981
|
const abs = resolvePath4(file);
|
|
34800
|
-
return abs === angularDirAbs || abs.startsWith(angularDirAbs +
|
|
34982
|
+
return abs === angularDirAbs || abs.startsWith(angularDirAbs + sep9);
|
|
34801
34983
|
});
|
|
34802
34984
|
if (filesUnderAngular.length === 0)
|
|
34803
34985
|
return;
|
|
@@ -34840,7 +35022,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
34840
35022
|
try {
|
|
34841
35023
|
await Promise.resolve().then(() => init_moduleServer());
|
|
34842
35024
|
for (const tsFile of tsFilesToRefresh) {
|
|
34843
|
-
const rel =
|
|
35025
|
+
const rel = relative27(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
|
|
34844
35026
|
const compiledFile = resolvePath4(compiledRoot, rel);
|
|
34845
35027
|
invalidateModule(compiledFile);
|
|
34846
35028
|
}
|
|
@@ -34893,7 +35075,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
34893
35075
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
34894
35076
|
const files = [];
|
|
34895
35077
|
for (const entry of entries) {
|
|
34896
|
-
const full =
|
|
35078
|
+
const full = join64(dir, entry.name);
|
|
34897
35079
|
if (entry.isDirectory()) {
|
|
34898
35080
|
files.push(...await walk(full));
|
|
34899
35081
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -34995,8 +35177,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
34995
35177
|
}, getModuleUrl = async (pageFile) => {
|
|
34996
35178
|
await Promise.resolve().then(() => init_moduleServer());
|
|
34997
35179
|
invalidateModule(pageFile);
|
|
34998
|
-
|
|
34999
|
-
const url = `${SRC_URL_PREFIX2}${
|
|
35180
|
+
await Promise.resolve();
|
|
35181
|
+
const url = `${SRC_URL_PREFIX2}${encodeSrcPath(relative27(process.cwd(), pageFile))}`;
|
|
35000
35182
|
await warmCache(url);
|
|
35001
35183
|
return url;
|
|
35002
35184
|
}, getReactModuleUrl, isReactComponentPath = (file) => file.endsWith(".tsx") || file.endsWith(".jsx"), isReactPagePath = (file) => file.replace(/\\/g, "/").includes("/pages/"), isImportableModule = (file) => {
|
|
@@ -35086,7 +35268,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
35086
35268
|
const primaryFile = reactFiles.find((file) => isImportableModule(file) && !isReactPagePath(file)) ?? primaryTarget;
|
|
35087
35269
|
if (pageModuleUrl) {
|
|
35088
35270
|
const serverDuration = Date.now() - startTime;
|
|
35089
|
-
state.lastHmrPath =
|
|
35271
|
+
state.lastHmrPath = relative27(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
35090
35272
|
state.lastHmrFramework = "react";
|
|
35091
35273
|
broadcastToClients(state, {
|
|
35092
35274
|
data: {
|
|
@@ -35528,7 +35710,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
35528
35710
|
} = await compileVue(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
|
|
35529
35711
|
const serverEntries = [...vueServerPaths];
|
|
35530
35712
|
const clientEntries = [...vueIndexPaths, ...vueClientPaths];
|
|
35531
|
-
const cssOutDir =
|
|
35713
|
+
const cssOutDir = join64(buildDir, state.resolvedPaths.assetsDir ? basename21(state.resolvedPaths.assetsDir) : "assets", "css");
|
|
35532
35714
|
const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
|
|
35533
35715
|
const serverExternals = await getServerBundleExternals();
|
|
35534
35716
|
const serverExternalsPlugins = await getServerBundleExternalsPlugins(state.config);
|
|
@@ -35712,7 +35894,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
35712
35894
|
const duration = Date.now() - startTime;
|
|
35713
35895
|
const [primary] = emberFiles;
|
|
35714
35896
|
if (primary) {
|
|
35715
|
-
state.lastHmrPath =
|
|
35897
|
+
state.lastHmrPath = relative27(process.cwd(), primary).replace(/\\/g, "/");
|
|
35716
35898
|
state.lastHmrFramework = "ember";
|
|
35717
35899
|
logHmrUpdate(primary, "ember", duration);
|
|
35718
35900
|
}
|
|
@@ -35978,7 +36160,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, clearDevSs
|
|
|
35978
36160
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
35979
36161
|
const pascalName = toPascal(baseName);
|
|
35980
36162
|
const vueRoot = config.vueDirectory;
|
|
35981
|
-
const hmrId = vueRoot ?
|
|
36163
|
+
const hmrId = vueRoot ? relative27(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
35982
36164
|
const cssKey = `${pascalName}CSS`;
|
|
35983
36165
|
const cssUrl = manifest[cssKey] || null;
|
|
35984
36166
|
await Promise.resolve().then(() => init_compileVue());
|
|
@@ -36641,7 +36823,7 @@ var init_rebuildTrigger = __esm(() => {
|
|
|
36641
36823
|
// src/build/buildDepVendor.ts
|
|
36642
36824
|
import { mkdirSync as mkdirSync17 } from "fs";
|
|
36643
36825
|
import { isBuiltin as isBuiltin2 } from "module";
|
|
36644
|
-
import { join as
|
|
36826
|
+
import { join as join65 } from "path";
|
|
36645
36827
|
import { rm as rm15 } from "fs/promises";
|
|
36646
36828
|
var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
|
|
36647
36829
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -36659,7 +36841,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
36659
36841
|
} catch {
|
|
36660
36842
|
return false;
|
|
36661
36843
|
}
|
|
36662
|
-
}, isBareSpecifier3 = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAbsolutePackageSpecifier = (spec) => spec === "@absolutejs/absolute" || spec.startsWith("@absolutejs/absolute/"), FRAMEWORK_SPECIFIERS, FRAMEWORK_NAMESPACE_PREFIXES, isFrameworkSpecifier = (spec) => FRAMEWORK_SPECIFIERS.has(spec) || FRAMEWORK_NAMESPACE_PREFIXES.some((prefix) => spec.startsWith(prefix)), FRAMEWORK_EXTERNALS, isSkippedFile = (file) => file.includes("node_modules") || file.includes("/build/") || file.includes("/dist/") || file.includes("/indexes/") || isTestSourcePath(file), isDepSpecifier = (path) => isBareSpecifier3(path) && !isBuiltin2(path) && !isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), isFrameworkRootCandidate = (path) => isBareSpecifier3(path) && isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), readFileSpecifiers = async (file, transpiler) => {
|
|
36844
|
+
}, isBareSpecifier3 = (spec) => !spec.startsWith(".") && !spec.startsWith("/") && !spec.startsWith("@src/"), isAbsolutePackageSpecifier = (spec) => spec === "@absolutejs/absolute" || spec.startsWith("@absolutejs/absolute/"), FRAMEWORK_SPECIFIERS, FRAMEWORK_NAMESPACE_PREFIXES, isFrameworkSpecifier = (spec) => FRAMEWORK_SPECIFIERS.has(spec) || FRAMEWORK_NAMESPACE_PREFIXES.some((prefix) => spec.startsWith(prefix)), FRAMEWORK_EXTERNALS, isSkippedFile = (file) => file.includes("node_modules") || file.includes("/build/") || file.includes("/dist/") || file.includes("/indexes/") || isTestSourcePath(file), isDepSpecifier = (path) => isBareSpecifier3(path) && !isBuiltin2(path) && !isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path) && !isWorkspacePackageSpecifier(path), isFrameworkRootCandidate = (path) => isBareSpecifier3(path) && isFrameworkSpecifier(path) && !isAbsolutePackageSpecifier(path), readFileSpecifiers = async (file, transpiler) => {
|
|
36663
36845
|
const dep = [];
|
|
36664
36846
|
const framework = [];
|
|
36665
36847
|
try {
|
|
@@ -36799,7 +36981,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
36799
36981
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
36800
36982
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
36801
36983
|
const safeName = toSafeFileName6(specifier);
|
|
36802
|
-
const entryPath =
|
|
36984
|
+
const entryPath = join65(tmpDir, `${safeName}.ts`);
|
|
36803
36985
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
36804
36986
|
return { entryPath, specifier };
|
|
36805
36987
|
}));
|
|
@@ -36890,9 +37072,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
36890
37072
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories, files);
|
|
36891
37073
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
36892
37074
|
return {};
|
|
36893
|
-
const vendorDir =
|
|
37075
|
+
const vendorDir = join65(buildDir, "vendor");
|
|
36894
37076
|
mkdirSync17(vendorDir, { recursive: true });
|
|
36895
|
-
const tmpDir =
|
|
37077
|
+
const tmpDir = join65(buildDir, "_dep_vendor_tmp");
|
|
36896
37078
|
mkdirSync17(tmpDir, { recursive: true });
|
|
36897
37079
|
const allSpecs = new Set(initialSpecs);
|
|
36898
37080
|
const alreadyScanned = new Set;
|
|
@@ -36944,6 +37126,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
36944
37126
|
return paths;
|
|
36945
37127
|
};
|
|
36946
37128
|
var init_buildDepVendor = __esm(() => {
|
|
37129
|
+
init_workspacePackages();
|
|
36947
37130
|
init_vendorEntrySource();
|
|
36948
37131
|
init_startupTimings();
|
|
36949
37132
|
FRAMEWORK_SPECIFIERS = new Set([
|
|
@@ -36981,10 +37164,10 @@ import {
|
|
|
36981
37164
|
existsSync as existsSync47,
|
|
36982
37165
|
mkdirSync as mkdirSync18,
|
|
36983
37166
|
readdirSync as readdirSync14,
|
|
36984
|
-
readFileSync as
|
|
37167
|
+
readFileSync as readFileSync45
|
|
36985
37168
|
} from "fs";
|
|
36986
|
-
import { mkdir as mkdir16, readFile as
|
|
36987
|
-
import { basename as basename22, join as
|
|
37169
|
+
import { mkdir as mkdir16, readFile as readFile12, rename as rename7, rm as rm16, writeFile as writeFile14 } from "fs/promises";
|
|
37170
|
+
import { basename as basename22, join as join66, resolve as resolve57 } from "path";
|
|
36988
37171
|
var CACHE_ROOT2, CACHE_FORMAT_VERSION3 = 1, KEY_LENGTH = 32, LOCKFILES, computeVendorCacheKey = (inputs) => {
|
|
36989
37172
|
const hash = createHash11("sha256");
|
|
36990
37173
|
hash.update(String(CACHE_FORMAT_VERSION3));
|
|
@@ -37004,26 +37187,26 @@ var CACHE_ROOT2, CACHE_FORMAT_VERSION3 = 1, KEY_LENGTH = 32, LOCKFILES, computeV
|
|
|
37004
37187
|
}
|
|
37005
37188
|
for (const dir of inputs.vendorDirs) {
|
|
37006
37189
|
hash.update("\x00v");
|
|
37007
|
-
hash.update(basename22(
|
|
37190
|
+
hash.update(basename22(resolve57(dir, "..")));
|
|
37008
37191
|
}
|
|
37009
37192
|
return hash.digest("hex").slice(0, KEY_LENGTH);
|
|
37010
37193
|
}, readLockfileHash = (projectRoot = process.cwd()) => {
|
|
37011
37194
|
const hash = createHash11("sha256");
|
|
37012
37195
|
let found = false;
|
|
37013
37196
|
for (const name of LOCKFILES) {
|
|
37014
|
-
const path =
|
|
37197
|
+
const path = join66(projectRoot, name);
|
|
37015
37198
|
if (!existsSync47(path))
|
|
37016
37199
|
continue;
|
|
37017
37200
|
found = true;
|
|
37018
37201
|
hash.update(name);
|
|
37019
|
-
hash.update(
|
|
37202
|
+
hash.update(readFileSync45(path));
|
|
37020
37203
|
}
|
|
37021
37204
|
return found ? hash.digest("hex") : null;
|
|
37022
37205
|
}, vendorCacheEnabled = () => process.env.ABSOLUTE_DEV_VENDOR_CACHE !== "0", copyTree = (fromDir, toDir) => {
|
|
37023
37206
|
mkdirSync18(toDir, { recursive: true });
|
|
37024
37207
|
for (const entry of readdirSync14(fromDir, { withFileTypes: true })) {
|
|
37025
|
-
const source =
|
|
37026
|
-
const destination =
|
|
37208
|
+
const source = join66(fromDir, entry.name);
|
|
37209
|
+
const destination = join66(toDir, entry.name);
|
|
37027
37210
|
if (entry.isDirectory())
|
|
37028
37211
|
copyTree(source, destination);
|
|
37029
37212
|
else
|
|
@@ -37031,7 +37214,7 @@ var CACHE_ROOT2, CACHE_FORMAT_VERSION3 = 1, KEY_LENGTH = 32, LOCKFILES, computeV
|
|
|
37031
37214
|
}
|
|
37032
37215
|
}, copySlotsInto = (cacheDir, vendorDirs) => {
|
|
37033
37216
|
for (const [index, dir] of vendorDirs.entries()) {
|
|
37034
|
-
const source =
|
|
37217
|
+
const source = join66(cacheDir, slotName(index, dir));
|
|
37035
37218
|
if (!existsSync47(source)) {
|
|
37036
37219
|
throw new Error(`missing cached vendor dir ${source}`);
|
|
37037
37220
|
}
|
|
@@ -37041,15 +37224,15 @@ var CACHE_ROOT2, CACHE_FORMAT_VERSION3 = 1, KEY_LENGTH = 32, LOCKFILES, computeV
|
|
|
37041
37224
|
for (const [index, dir] of vendorDirs.entries()) {
|
|
37042
37225
|
if (!existsSync47(dir))
|
|
37043
37226
|
continue;
|
|
37044
|
-
copyTree(dir,
|
|
37227
|
+
copyTree(dir, join66(stagingDir, slotName(index, dir)));
|
|
37045
37228
|
}
|
|
37046
|
-
}, isVendorCachePayload = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "depPaths") === "object", cacheDirFor = (key, projectRoot) =>
|
|
37229
|
+
}, isVendorCachePayload = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "depPaths") === "object", cacheDirFor = (key, projectRoot) => resolve57(projectRoot, CACHE_ROOT2, key), slotName = (index, dir) => `${index}-${basename22(resolve57(dir, ".."))}`, restoreVendorCache = async (key, vendorDirs, projectRoot = process.cwd()) => {
|
|
37047
37230
|
const cacheDir = cacheDirFor(key, projectRoot);
|
|
37048
|
-
const payloadPath =
|
|
37231
|
+
const payloadPath = join66(cacheDir, "payload.json");
|
|
37049
37232
|
if (!existsSync47(payloadPath))
|
|
37050
37233
|
return null;
|
|
37051
37234
|
try {
|
|
37052
|
-
const payload = JSON.parse(await
|
|
37235
|
+
const payload = JSON.parse(await readFile12(payloadPath, "utf8"));
|
|
37053
37236
|
if (!isVendorCachePayload(payload))
|
|
37054
37237
|
return null;
|
|
37055
37238
|
copySlotsInto(cacheDir, vendorDirs);
|
|
@@ -37059,14 +37242,14 @@ var CACHE_ROOT2, CACHE_FORMAT_VERSION3 = 1, KEY_LENGTH = 32, LOCKFILES, computeV
|
|
|
37059
37242
|
}
|
|
37060
37243
|
}, saveVendorCache = async (key, vendorDirs, payload, projectRoot = process.cwd()) => {
|
|
37061
37244
|
const cacheDir = cacheDirFor(key, projectRoot);
|
|
37062
|
-
if (existsSync47(
|
|
37245
|
+
if (existsSync47(join66(cacheDir, "payload.json")))
|
|
37063
37246
|
return;
|
|
37064
37247
|
const stagingDir = `${cacheDir}.${process.pid}.tmp`;
|
|
37065
37248
|
try {
|
|
37066
37249
|
await rm16(stagingDir, { force: true, recursive: true });
|
|
37067
37250
|
await mkdir16(stagingDir, { recursive: true });
|
|
37068
37251
|
copySlotsFrom(stagingDir, vendorDirs);
|
|
37069
|
-
await
|
|
37252
|
+
await writeFile14(join66(stagingDir, "payload.json"), JSON.stringify(payload));
|
|
37070
37253
|
await rm16(cacheDir, { force: true, recursive: true });
|
|
37071
37254
|
await rename7(stagingDir, cacheDir);
|
|
37072
37255
|
} catch {
|
|
@@ -37076,7 +37259,7 @@ var CACHE_ROOT2, CACHE_FORMAT_VERSION3 = 1, KEY_LENGTH = 32, LOCKFILES, computeV
|
|
|
37076
37259
|
}
|
|
37077
37260
|
};
|
|
37078
37261
|
var init_vendorCache = __esm(() => {
|
|
37079
|
-
CACHE_ROOT2 =
|
|
37262
|
+
CACHE_ROOT2 = join66(".absolutejs", "vendor-cache");
|
|
37080
37263
|
LOCKFILES = [
|
|
37081
37264
|
"bun.lock",
|
|
37082
37265
|
"bun.lockb",
|
|
@@ -37087,10 +37270,10 @@ var init_vendorCache = __esm(() => {
|
|
|
37087
37270
|
});
|
|
37088
37271
|
|
|
37089
37272
|
// src/core/devBuild.ts
|
|
37090
|
-
import { readdir as
|
|
37273
|
+
import { readdir as readdir7 } from "fs/promises";
|
|
37091
37274
|
import { existsSync as existsSync48, statSync as statSync12 } from "fs";
|
|
37092
|
-
import { resolve as
|
|
37093
|
-
var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir = () =>
|
|
37275
|
+
import { resolve as resolve58 } from "path";
|
|
37276
|
+
var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir = () => resolve58(import.meta.dir, "../dev/client"), collectDepVendorSourceDirs = (config) => {
|
|
37094
37277
|
const configuredDirs = [
|
|
37095
37278
|
...collectConfigVendorSourceDirs(config),
|
|
37096
37279
|
devClientVendorSourceDir()
|
|
@@ -37113,7 +37296,7 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir = () => resolve57(import.meta.d
|
|
|
37113
37296
|
return Object.keys(config).length > 0 ? config : null;
|
|
37114
37297
|
}, reloadConfig = async () => {
|
|
37115
37298
|
try {
|
|
37116
|
-
const configPath =
|
|
37299
|
+
const configPath = resolve58(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
37117
37300
|
const source = await Bun.file(configPath).text();
|
|
37118
37301
|
return parseDirectoryConfig(source);
|
|
37119
37302
|
} catch {
|
|
@@ -37228,7 +37411,7 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir = () => resolve57(import.meta.d
|
|
|
37228
37411
|
});
|
|
37229
37412
|
}
|
|
37230
37413
|
}, handleCachedReload = async () => {
|
|
37231
|
-
const serverMtime = statSync12(
|
|
37414
|
+
const serverMtime = statSync12(resolve58(Bun.main)).mtimeMs;
|
|
37232
37415
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
37233
37416
|
globalThis.__hmrServerMtime = serverMtime;
|
|
37234
37417
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -37269,8 +37452,8 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir = () => resolve57(import.meta.d
|
|
|
37269
37452
|
return true;
|
|
37270
37453
|
}, resolveAbsoluteVersion2 = async () => {
|
|
37271
37454
|
const candidates = [
|
|
37272
|
-
|
|
37273
|
-
|
|
37455
|
+
resolve58(import.meta.dir, "..", "..", "package.json"),
|
|
37456
|
+
resolve58(import.meta.dir, "..", "package.json")
|
|
37274
37457
|
];
|
|
37275
37458
|
const [candidate, ...remaining] = candidates;
|
|
37276
37459
|
if (!candidate) {
|
|
@@ -37293,10 +37476,10 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir = () => resolve57(import.meta.d
|
|
|
37293
37476
|
await resolveAbsoluteVersionFromCandidates(remaining);
|
|
37294
37477
|
}, loadVendorFiles = async (assetStore, vendorDir, framework) => {
|
|
37295
37478
|
const emptyStringArray = [];
|
|
37296
|
-
const entries = await
|
|
37479
|
+
const entries = await readdir7(vendorDir).catch(() => emptyStringArray);
|
|
37297
37480
|
await Promise.all(entries.filter((entry) => entry.endsWith(".js")).map(async (entry) => {
|
|
37298
37481
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
37299
|
-
const bytes = await Bun.file(
|
|
37482
|
+
const bytes = await Bun.file(resolve58(vendorDir, entry)).bytes();
|
|
37300
37483
|
assetStore.set(webPath, bytes);
|
|
37301
37484
|
}));
|
|
37302
37485
|
}, devBuild = async (config) => {
|
|
@@ -37482,11 +37665,11 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir = () => resolve57(import.meta.d
|
|
|
37482
37665
|
}
|
|
37483
37666
|
stepStartedAt = performance.now();
|
|
37484
37667
|
setBootPhase("build vendor bundles");
|
|
37485
|
-
const reactVendorDir =
|
|
37486
|
-
const angularVendorDir =
|
|
37487
|
-
const svelteVendorDir =
|
|
37488
|
-
const vueVendorDir =
|
|
37489
|
-
const depVendorDir =
|
|
37668
|
+
const reactVendorDir = resolve58(state.resolvedPaths.buildDir, "react", "vendor");
|
|
37669
|
+
const angularVendorDir = resolve58(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
37670
|
+
const svelteVendorDir = resolve58(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
37671
|
+
const vueVendorDir = resolve58(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
37672
|
+
const depVendorDir = resolve58(state.resolvedPaths.buildDir, "vendor");
|
|
37490
37673
|
await Promise.resolve().then(() => init_buildDepVendor());
|
|
37491
37674
|
const activeVendorDirs = [
|
|
37492
37675
|
config.reactDirectory ? reactVendorDir : null,
|
|
@@ -37603,7 +37786,7 @@ var FRAMEWORK_DIR_KEYS, devClientVendorSourceDir = () => resolve57(import.meta.d
|
|
|
37603
37786
|
manifest
|
|
37604
37787
|
};
|
|
37605
37788
|
globalThis.__hmrDevResult = result;
|
|
37606
|
-
globalThis.__hmrServerMtime = statSync12(
|
|
37789
|
+
globalThis.__hmrServerMtime = statSync12(resolve58(Bun.main)).mtimeMs;
|
|
37607
37790
|
return result;
|
|
37608
37791
|
};
|
|
37609
37792
|
var init_devBuild = __esm(() => {
|
|
@@ -37644,5 +37827,5 @@ export {
|
|
|
37644
37827
|
devBuild
|
|
37645
37828
|
};
|
|
37646
37829
|
|
|
37647
|
-
//# debugId=
|
|
37830
|
+
//# debugId=5CC37A06E132748E64756E2164756E21
|
|
37648
37831
|
//# sourceMappingURL=build.js.map
|