@absolutejs/absolute 0.19.0-beta.772 → 0.19.0-beta.773
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/index.js +94 -78
- package/dist/angular/index.js.map +5 -5
- package/dist/angular/server.js +94 -78
- package/dist/angular/server.js.map +5 -5
- package/dist/build.js +350 -299
- package/dist/build.js.map +5 -5
- package/dist/cli/index.js +27 -3
- package/dist/client/index.js +27 -11
- package/dist/client/index.js.map +4 -4
- package/dist/index.js +408 -357
- package/dist/index.js.map +5 -5
- package/dist/islands/index.js +52 -36
- package/dist/islands/index.js.map +4 -4
- package/dist/react/browser.js +7 -7
- package/dist/react/browser.js.map +2 -2
- package/dist/react/components/browser/index.js +101 -101
- package/dist/react/components/index.js +104 -104
- package/dist/react/components/index.js.map +2 -2
- package/dist/react/index.js +63 -47
- package/dist/react/index.js.map +4 -4
- package/dist/react/server.js +2 -2
- package/dist/react/server.js.map +1 -1
- package/dist/src/angular/resolveAngularPackage.d.ts +6 -4
- package/dist/svelte/index.js +29 -13
- package/dist/svelte/index.js.map +4 -4
- package/dist/svelte/server.js +3 -3
- package/dist/svelte/server.js.map +1 -1
- package/dist/vue/index.js +53 -37
- package/dist/vue/index.js.map +4 -4
- package/dist/vue/server.js +2 -2
- package/dist/vue/server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -262,7 +262,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
262
262
|
const config = normalizePostcssModule(loaded);
|
|
263
263
|
const value = typeof config === "function" ? await config({
|
|
264
264
|
cwd: process.cwd(),
|
|
265
|
-
env: "
|
|
265
|
+
env: "test"
|
|
266
266
|
}) : config;
|
|
267
267
|
return normalizePostcssModule(value) ?? {};
|
|
268
268
|
}, normalizePostcssPlugins = (plugins) => {
|
|
@@ -5422,6 +5422,7 @@ __export(exports_tailwindCompiler, {
|
|
|
5422
5422
|
disposeTailwindCompiler: () => disposeTailwindCompiler
|
|
5423
5423
|
});
|
|
5424
5424
|
import { createHash } from "crypto";
|
|
5425
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
5425
5426
|
import { readFile as readFile2, stat } from "fs/promises";
|
|
5426
5427
|
import { dirname as dirname2, isAbsolute as isAbsolute2, resolve as resolve2 } from "path";
|
|
5427
5428
|
var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async () => {
|
|
@@ -5441,8 +5442,42 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
5441
5442
|
} catch {
|
|
5442
5443
|
deps.set(path, 0);
|
|
5443
5444
|
}
|
|
5445
|
+
}, resolveBareCssImport = (id, base) => {
|
|
5446
|
+
const slashIndex = id.indexOf("/");
|
|
5447
|
+
const pkgName = id.startsWith("@") ? id.split("/").slice(0, 2).join("/") : slashIndex === -1 ? id : id.slice(0, slashIndex);
|
|
5448
|
+
const subpath = id.slice(pkgName.length);
|
|
5449
|
+
if (subpath !== "") {
|
|
5450
|
+
return Bun.resolveSync(id, base);
|
|
5451
|
+
}
|
|
5452
|
+
let pkgJsonPath;
|
|
5453
|
+
try {
|
|
5454
|
+
pkgJsonPath = Bun.resolveSync(`${pkgName}/package.json`, base);
|
|
5455
|
+
} catch {
|
|
5456
|
+
return Bun.resolveSync(id, base);
|
|
5457
|
+
}
|
|
5458
|
+
const pkgDir = dirname2(pkgJsonPath);
|
|
5459
|
+
let pkg = {};
|
|
5460
|
+
try {
|
|
5461
|
+
pkg = JSON.parse(readFileSync2(pkgJsonPath, "utf-8"));
|
|
5462
|
+
} catch {
|
|
5463
|
+
return Bun.resolveSync(id, base);
|
|
5464
|
+
}
|
|
5465
|
+
const exportsField = pkg.exports;
|
|
5466
|
+
const styleFromExports = exportsField?.["."]?.style;
|
|
5467
|
+
const candidates = [
|
|
5468
|
+
styleFromExports,
|
|
5469
|
+
typeof pkg.style === "string" ? pkg.style : undefined,
|
|
5470
|
+
"index.css",
|
|
5471
|
+
"dist/index.css"
|
|
5472
|
+
].filter((entry) => typeof entry === "string");
|
|
5473
|
+
for (const candidate of candidates) {
|
|
5474
|
+
const candidatePath = resolve2(pkgDir, candidate);
|
|
5475
|
+
if (existsSync2(candidatePath))
|
|
5476
|
+
return candidatePath;
|
|
5477
|
+
}
|
|
5478
|
+
return Bun.resolveSync(id, base);
|
|
5444
5479
|
}, createLoadStylesheet = (deps) => async (id, base) => {
|
|
5445
|
-
const path = id.startsWith(".") || isAbsolute2(id) ? resolve2(base, id) :
|
|
5480
|
+
const path = id.startsWith(".") || isAbsolute2(id) ? resolve2(base, id) : resolveBareCssImport(id, base);
|
|
5446
5481
|
const content = await readFile2(path, "utf-8");
|
|
5447
5482
|
await recordDependency(deps, path);
|
|
5448
5483
|
return { base: dirname2(path), content, path };
|
|
@@ -6367,24 +6402,38 @@ var init_streamingSlots = __esm(() => {
|
|
|
6367
6402
|
});
|
|
6368
6403
|
|
|
6369
6404
|
// src/angular/resolveAngularPackage.ts
|
|
6370
|
-
import { existsSync as
|
|
6371
|
-
import { resolve as resolve3 } from "path";
|
|
6372
|
-
var
|
|
6405
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
6406
|
+
import { join as join3, resolve as resolve3 } from "path";
|
|
6407
|
+
var resolveAngularPackageDir = (specifier) => {
|
|
6373
6408
|
const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve3(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
|
|
6374
|
-
if (fromCompiledRuntime &&
|
|
6409
|
+
if (fromCompiledRuntime && existsSync3(fromCompiledRuntime)) {
|
|
6375
6410
|
return fromCompiledRuntime;
|
|
6376
6411
|
}
|
|
6377
6412
|
const fromProject = resolve3(process.cwd(), "node_modules", specifier);
|
|
6378
|
-
if (
|
|
6413
|
+
if (existsSync3(fromProject)) {
|
|
6379
6414
|
return fromProject;
|
|
6380
6415
|
}
|
|
6416
|
+
return null;
|
|
6417
|
+
}, resolvePackageEntry = (packageDir) => {
|
|
6418
|
+
try {
|
|
6419
|
+
const pkg = JSON.parse(readFileSync3(join3(packageDir, "package.json"), "utf-8"));
|
|
6420
|
+
const rootExport = pkg.exports?.["."];
|
|
6421
|
+
const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
|
|
6422
|
+
return join3(packageDir, entry);
|
|
6423
|
+
} catch {
|
|
6424
|
+
return packageDir;
|
|
6425
|
+
}
|
|
6426
|
+
}, resolveAngularPackage = (specifier) => {
|
|
6427
|
+
const packageDir = resolveAngularPackageDir(specifier);
|
|
6428
|
+
if (packageDir)
|
|
6429
|
+
return resolvePackageEntry(packageDir);
|
|
6381
6430
|
return specifier;
|
|
6382
6431
|
};
|
|
6383
6432
|
var init_resolveAngularPackage = () => {};
|
|
6384
6433
|
|
|
6385
6434
|
// src/angular/injectorPatch.ts
|
|
6386
|
-
import { existsSync as
|
|
6387
|
-
import { dirname as dirname4, join as
|
|
6435
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync } from "fs";
|
|
6436
|
+
import { dirname as dirname4, join as join4 } from "path";
|
|
6388
6437
|
var applyInjectorPatch = (chunkPath, content) => {
|
|
6389
6438
|
if (content.includes('Symbol.for("angular.currentInjector")')) {
|
|
6390
6439
|
return;
|
|
@@ -6420,16 +6469,16 @@ var applyInjectorPatch = (chunkPath, content) => {
|
|
|
6420
6469
|
}
|
|
6421
6470
|
writeFileSync(chunkPath, patched, "utf-8");
|
|
6422
6471
|
}, resolveAngularCoreDir = () => {
|
|
6423
|
-
const resolved =
|
|
6424
|
-
if (
|
|
6472
|
+
const resolved = resolveAngularPackageDir("@angular/core");
|
|
6473
|
+
if (resolved && existsSync4(join4(resolved, "package.json"))) {
|
|
6425
6474
|
return resolved;
|
|
6426
6475
|
}
|
|
6427
6476
|
return dirname4(__require.resolve("@angular/core/package.json"));
|
|
6428
6477
|
}, patchAngularInjectorSingleton = () => {
|
|
6429
6478
|
try {
|
|
6430
6479
|
const coreDir = resolveAngularCoreDir();
|
|
6431
|
-
const chunkPath =
|
|
6432
|
-
const content =
|
|
6480
|
+
const chunkPath = join4(coreDir, "fesm2022", "_not_found-chunk.mjs");
|
|
6481
|
+
const content = readFileSync4(chunkPath, "utf-8");
|
|
6433
6482
|
applyInjectorPatch(chunkPath, content);
|
|
6434
6483
|
} catch {}
|
|
6435
6484
|
};
|
|
@@ -6598,7 +6647,9 @@ var initDominoAdapter = (platformServer) => {
|
|
|
6598
6647
|
import(resolveAngularPackage("@angular/common")),
|
|
6599
6648
|
import(resolveAngularPackage("@angular/core"))
|
|
6600
6649
|
]);
|
|
6601
|
-
if (
|
|
6650
|
+
if (true) {
|
|
6651
|
+
core.enableProdMode();
|
|
6652
|
+
}
|
|
6602
6653
|
initDominoAdapter(platformServer);
|
|
6603
6654
|
return {
|
|
6604
6655
|
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
@@ -7049,8 +7100,8 @@ var init_islandSsr = __esm(() => {
|
|
|
7049
7100
|
});
|
|
7050
7101
|
|
|
7051
7102
|
// src/build/resolvePackageImport.ts
|
|
7052
|
-
import { resolve as resolve4, join as
|
|
7053
|
-
import { existsSync as
|
|
7103
|
+
import { resolve as resolve4, join as join5 } from "path";
|
|
7104
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
|
|
7054
7105
|
var resolveExportPath = (entry, conditions) => {
|
|
7055
7106
|
if (typeof entry === "string")
|
|
7056
7107
|
return entry;
|
|
@@ -7072,14 +7123,14 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
7072
7123
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
7073
7124
|
const exportKey = subpath ? `./${subpath}` : ".";
|
|
7074
7125
|
const currentPackageJsonPath = resolve4(process.cwd(), "package.json");
|
|
7075
|
-
const currentPackageJson =
|
|
7126
|
+
const currentPackageJson = existsSync5(currentPackageJsonPath) ? JSON.parse(readFileSync5(currentPackageJsonPath, "utf-8")) : null;
|
|
7076
7127
|
const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
|
|
7077
7128
|
const packageDir = currentPackageDir ?? resolve4(process.cwd(), "node_modules", packageName ?? "");
|
|
7078
|
-
const packageJsonPath =
|
|
7079
|
-
if (!
|
|
7129
|
+
const packageJsonPath = join5(packageDir, "package.json");
|
|
7130
|
+
if (!existsSync5(packageJsonPath))
|
|
7080
7131
|
return null;
|
|
7081
7132
|
try {
|
|
7082
|
-
const packageJson = currentPackageDir && currentPackageJson ? currentPackageJson : JSON.parse(
|
|
7133
|
+
const packageJson = currentPackageDir && currentPackageJson ? currentPackageJson : JSON.parse(readFileSync5(packageJsonPath, "utf-8"));
|
|
7083
7134
|
const { exports } = packageJson;
|
|
7084
7135
|
if (!exports)
|
|
7085
7136
|
return null;
|
|
@@ -7091,12 +7142,12 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
7091
7142
|
return null;
|
|
7092
7143
|
if (currentPackageDir && importPath.startsWith("./dist/")) {
|
|
7093
7144
|
const sourceCandidate = resolve4(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
|
|
7094
|
-
if (
|
|
7145
|
+
if (existsSync5(sourceCandidate)) {
|
|
7095
7146
|
return sourceCandidate;
|
|
7096
7147
|
}
|
|
7097
7148
|
}
|
|
7098
7149
|
const resolved = resolve4(packageDir, importPath);
|
|
7099
|
-
return
|
|
7150
|
+
return existsSync5(resolved) ? resolved : null;
|
|
7100
7151
|
} catch {
|
|
7101
7152
|
return null;
|
|
7102
7153
|
}
|
|
@@ -7229,13 +7280,13 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
7229
7280
|
|
|
7230
7281
|
// src/core/svelteServerModule.ts
|
|
7231
7282
|
import { mkdir as mkdir2, readdir } from "fs/promises";
|
|
7232
|
-
import { basename, dirname as dirname5, extname as extname2, join as
|
|
7283
|
+
import { basename, dirname as dirname5, extname as extname2, join as join6, relative as relative2, resolve as resolve5 } from "path";
|
|
7233
7284
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
7234
7285
|
const importPath = relative2(dirname5(from), target).replace(/\\/g, "/");
|
|
7235
7286
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
7236
7287
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
7237
7288
|
for (const entry of entries) {
|
|
7238
|
-
const entryPath =
|
|
7289
|
+
const entryPath = join6(dir, entry.name);
|
|
7239
7290
|
if (entry.isDirectory())
|
|
7240
7291
|
stack.push(entryPath);
|
|
7241
7292
|
if (entry.isFile() && entry.name === targetFileName) {
|
|
@@ -7265,11 +7316,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
7265
7316
|
if (cachedPath !== undefined) {
|
|
7266
7317
|
return cachedPath;
|
|
7267
7318
|
}
|
|
7268
|
-
if (!sourcePath.includes(`${
|
|
7319
|
+
if (!sourcePath.includes(`${join6(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
|
|
7269
7320
|
originalSourcePathCache.set(sourcePath, sourcePath);
|
|
7270
7321
|
return sourcePath;
|
|
7271
7322
|
}
|
|
7272
|
-
const resolvedSourcePath = await findSourceFileByBasename(
|
|
7323
|
+
const resolvedSourcePath = await findSourceFileByBasename(join6(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
|
|
7273
7324
|
const nextPath = resolvedSourcePath ?? sourcePath;
|
|
7274
7325
|
originalSourcePathCache.set(sourcePath, nextPath);
|
|
7275
7326
|
return nextPath;
|
|
@@ -7285,11 +7336,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
7285
7336
|
`${basePath}.mjs`,
|
|
7286
7337
|
`${basePath}.cjs`,
|
|
7287
7338
|
`${basePath}.json`,
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7339
|
+
join6(basePath, "index.ts"),
|
|
7340
|
+
join6(basePath, "index.js"),
|
|
7341
|
+
join6(basePath, "index.mjs"),
|
|
7342
|
+
join6(basePath, "index.cjs"),
|
|
7343
|
+
join6(basePath, "index.json")
|
|
7293
7344
|
];
|
|
7294
7345
|
const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
|
|
7295
7346
|
const foundIndex = existResults.indexOf(true);
|
|
@@ -7297,7 +7348,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
7297
7348
|
}, getCachedModulePath = (sourcePath) => {
|
|
7298
7349
|
const relativeSourcePath = relative2(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
7299
7350
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
7300
|
-
return
|
|
7351
|
+
return join6(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
7301
7352
|
}, resolveSvelteImport = async (spec, from) => {
|
|
7302
7353
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
7303
7354
|
const resolved = resolvePackageImport(spec);
|
|
@@ -7398,7 +7449,7 @@ var init_svelteServerModule = __esm(() => {
|
|
|
7398
7449
|
init_lowerIslandSyntax();
|
|
7399
7450
|
init_lowerAwaitSlotSyntax();
|
|
7400
7451
|
init_stylePreprocessor();
|
|
7401
|
-
serverCacheRoot =
|
|
7452
|
+
serverCacheRoot = join6(process.cwd(), ".absolutejs", "islands", "svelte");
|
|
7402
7453
|
compiledModuleCache = new Map;
|
|
7403
7454
|
originalSourcePathCache = new Map;
|
|
7404
7455
|
transpiler = new Bun.Transpiler({
|
|
@@ -7556,7 +7607,7 @@ var init_renderIslandMarkup = __esm(() => {
|
|
|
7556
7607
|
|
|
7557
7608
|
// src/build/islandEntries.ts
|
|
7558
7609
|
import { mkdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
7559
|
-
import { dirname as dirname6, extname as extname3, join as
|
|
7610
|
+
import { dirname as dirname6, extname as extname3, join as join7, relative as relative3, resolve as resolve6 } from "path";
|
|
7560
7611
|
import ts from "typescript";
|
|
7561
7612
|
var frameworks, isRecord4 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
|
|
7562
7613
|
if (isRecord4(mod.islandRegistry))
|
|
@@ -7789,11 +7840,11 @@ export default component;
|
|
|
7789
7840
|
buildPath,
|
|
7790
7841
|
clientPathMaps = {}
|
|
7791
7842
|
}) => {
|
|
7792
|
-
const generatedRoot =
|
|
7843
|
+
const generatedRoot = join7(buildPath, "_island_entries");
|
|
7793
7844
|
rmSync(generatedRoot, { force: true, recursive: true });
|
|
7794
7845
|
const entries = [];
|
|
7795
7846
|
for (const definition of buildInfo.definitions) {
|
|
7796
|
-
const entryPath =
|
|
7847
|
+
const entryPath = join7(generatedRoot, "islands", definition.framework, `${definition.component}.ts`);
|
|
7797
7848
|
const { buildReference } = definition;
|
|
7798
7849
|
const source = buildReference ? resolveIslandSourcePath(buildInfo.resolvedRegistryPath, buildReference.source) : null;
|
|
7799
7850
|
const compiledSourcePath = source && shouldUseCompiledClientPath(definition.framework, source) ? clientPathMaps[definition.framework]?.get(source) : undefined;
|
|
@@ -7906,7 +7957,7 @@ var init_staticStreaming = __esm(() => {
|
|
|
7906
7957
|
});
|
|
7907
7958
|
|
|
7908
7959
|
// src/build/staticIslandPages.ts
|
|
7909
|
-
import { readFileSync as
|
|
7960
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "fs";
|
|
7910
7961
|
var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:[\\s\\S]*?)<\\/(?:absolute-island|island)>)", ATTRIBUTE_RE_SOURCE = `([A-Za-z_:][-A-Za-z0-9_:.]*)\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, islandFrameworks, islandHydrationModes, isRecord5 = (value) => typeof value === "object" && value !== null, isIslandFramework = (value) => islandFrameworks.some((framework) => framework === value), isIslandHydrationMode = (value) => islandHydrationModes.some((mode) => mode === value), parseHtmlAttributes = (attributeString) => {
|
|
7911
7962
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
7912
7963
|
const attributes = new Map;
|
|
@@ -8035,7 +8086,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
8035
8086
|
}
|
|
8036
8087
|
return result + originalHtml.slice(nextIndex);
|
|
8037
8088
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
8038
|
-
const originalHtml =
|
|
8089
|
+
const originalHtml = readFileSync6(pagePath, "utf-8");
|
|
8039
8090
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
8040
8091
|
if (transformedHtml !== originalHtml) {
|
|
8041
8092
|
writeFileSync3(pagePath, transformedHtml);
|
|
@@ -8071,10 +8122,10 @@ var init_staticIslandPages = __esm(() => {
|
|
|
8071
8122
|
});
|
|
8072
8123
|
|
|
8073
8124
|
// src/build/scanEntryPoints.ts
|
|
8074
|
-
import { existsSync as
|
|
8125
|
+
import { existsSync as existsSync6 } from "fs";
|
|
8075
8126
|
var {Glob } = globalThis.Bun;
|
|
8076
8127
|
var scanEntryPoints = async (dir, pattern) => {
|
|
8077
|
-
if (!
|
|
8128
|
+
if (!existsSync6(dir))
|
|
8078
8129
|
return [];
|
|
8079
8130
|
const entryPaths = [];
|
|
8080
8131
|
const glob = new Glob(pattern);
|
|
@@ -8163,7 +8214,7 @@ var init_sourceMetadata = __esm(() => {
|
|
|
8163
8214
|
});
|
|
8164
8215
|
|
|
8165
8216
|
// src/islands/pageMetadata.ts
|
|
8166
|
-
import { readFileSync as
|
|
8217
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
8167
8218
|
import { dirname as dirname7, resolve as resolve9 } from "path";
|
|
8168
8219
|
var pagePatterns, getPageDirs = (config) => [
|
|
8169
8220
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
@@ -8205,7 +8256,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
8205
8256
|
return;
|
|
8206
8257
|
const files = await scanEntryPoints(resolve9(entry.dir), pattern);
|
|
8207
8258
|
for (const filePath of files) {
|
|
8208
|
-
const source =
|
|
8259
|
+
const source = readFileSync7(filePath, "utf-8");
|
|
8209
8260
|
const islands = extractIslandUsagesFromSource(source);
|
|
8210
8261
|
pageMetadata.set(resolve9(filePath), {
|
|
8211
8262
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
@@ -8568,22 +8619,22 @@ var exports_generateReactIndexes = {};
|
|
|
8568
8619
|
__export(exports_generateReactIndexes, {
|
|
8569
8620
|
generateReactIndexFiles: () => generateReactIndexFiles
|
|
8570
8621
|
});
|
|
8571
|
-
import { existsSync as
|
|
8622
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2 } from "fs";
|
|
8572
8623
|
import { readdir as readdir2, rm, writeFile } from "fs/promises";
|
|
8573
|
-
import { basename as basename3, join as
|
|
8624
|
+
import { basename as basename3, join as join8, relative as relative4, resolve as resolve10, sep } from "path";
|
|
8574
8625
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
8575
8626
|
var indexContentCache, resolveDevClientDir = () => {
|
|
8576
8627
|
const projectRoot = process.cwd();
|
|
8577
8628
|
const fromSource = resolve10(import.meta.dir, "../dev/client");
|
|
8578
|
-
if (
|
|
8629
|
+
if (existsSync7(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
8579
8630
|
return fromSource;
|
|
8580
8631
|
}
|
|
8581
8632
|
const fromNodeModules = resolve10(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
8582
|
-
if (
|
|
8633
|
+
if (existsSync7(fromNodeModules))
|
|
8583
8634
|
return fromNodeModules;
|
|
8584
8635
|
return resolve10(import.meta.dir, "./dev/client");
|
|
8585
8636
|
}, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
|
|
8586
|
-
if (!
|
|
8637
|
+
if (!existsSync7(reactIndexesDirectory)) {
|
|
8587
8638
|
mkdirSync2(reactIndexesDirectory, { recursive: true });
|
|
8588
8639
|
}
|
|
8589
8640
|
const CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
|
|
@@ -8603,8 +8654,8 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
8603
8654
|
});
|
|
8604
8655
|
if (staleIndexes.length > 0) {
|
|
8605
8656
|
await Promise.all(staleIndexes.map((indexFile) => {
|
|
8606
|
-
indexContentCache.delete(
|
|
8607
|
-
return rm(
|
|
8657
|
+
indexContentCache.delete(join8(reactIndexesDirectory, indexFile));
|
|
8658
|
+
return rm(join8(reactIndexesDirectory, indexFile), {
|
|
8608
8659
|
force: true
|
|
8609
8660
|
});
|
|
8610
8661
|
}));
|
|
@@ -8873,11 +8924,11 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
8873
8924
|
] : []
|
|
8874
8925
|
].join(`
|
|
8875
8926
|
`);
|
|
8876
|
-
const indexPath =
|
|
8927
|
+
const indexPath = join8(reactIndexesDirectory, `${componentName}.tsx`);
|
|
8877
8928
|
const hasher = new Bun.CryptoHasher("md5");
|
|
8878
8929
|
hasher.update(content);
|
|
8879
8930
|
const contentHash = hasher.digest("hex");
|
|
8880
|
-
if (indexContentCache.get(indexPath) === contentHash &&
|
|
8931
|
+
if (indexContentCache.get(indexPath) === contentHash && existsSync7(indexPath)) {
|
|
8881
8932
|
return;
|
|
8882
8933
|
}
|
|
8883
8934
|
indexContentCache.set(indexPath, contentHash);
|
|
@@ -8887,8 +8938,8 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
8887
8938
|
if (!isDev2) {
|
|
8888
8939
|
return;
|
|
8889
8940
|
}
|
|
8890
|
-
const refreshPath =
|
|
8891
|
-
if (!
|
|
8941
|
+
const refreshPath = join8(reactIndexesDirectory, "_refresh.tsx");
|
|
8942
|
+
if (!existsSync7(refreshPath)) {
|
|
8892
8943
|
await writeFile(refreshPath, `import '${refreshSetupPath}';
|
|
8893
8944
|
import 'react';
|
|
8894
8945
|
import 'react-dom/client';
|
|
@@ -8898,9 +8949,9 @@ import 'react-dom/client';
|
|
|
8898
8949
|
var init_generateReactIndexes = __esm(() => {
|
|
8899
8950
|
indexContentCache = new Map;
|
|
8900
8951
|
devClientDir = resolveDevClientDir();
|
|
8901
|
-
errorOverlayPath =
|
|
8902
|
-
hmrClientPath =
|
|
8903
|
-
refreshSetupPath =
|
|
8952
|
+
errorOverlayPath = join8(devClientDir, "errorOverlay.ts").replace(/\\/g, "/");
|
|
8953
|
+
hmrClientPath = join8(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
|
|
8954
|
+
refreshSetupPath = join8(devClientDir, "reactRefreshSetup.ts").replace(/\\/g, "/");
|
|
8904
8955
|
});
|
|
8905
8956
|
|
|
8906
8957
|
// src/build/wrapHTMLScript.ts
|
|
@@ -8968,7 +9019,7 @@ var init_outputLogs = __esm(() => {
|
|
|
8968
9019
|
// src/build/scanConventions.ts
|
|
8969
9020
|
import { basename as basename4 } from "path";
|
|
8970
9021
|
var {Glob: Glob3 } = globalThis.Bun;
|
|
8971
|
-
import { existsSync as
|
|
9022
|
+
import { existsSync as existsSync8 } from "fs";
|
|
8972
9023
|
var CONVENTION_RE, classifyFile = (file2, pageFiles, defaults, pages) => {
|
|
8973
9024
|
const fileName = basename4(file2);
|
|
8974
9025
|
const match = CONVENTION_RE.exec(fileName);
|
|
@@ -8993,7 +9044,7 @@ var CONVENTION_RE, classifyFile = (file2, pageFiles, defaults, pages) => {
|
|
|
8993
9044
|
else if (kind === "loading")
|
|
8994
9045
|
pages[pageName].loading = file2;
|
|
8995
9046
|
}, scanConventions = async (pagesDir, pattern) => {
|
|
8996
|
-
if (!
|
|
9047
|
+
if (!existsSync8(pagesDir)) {
|
|
8997
9048
|
const pageFiles2 = [];
|
|
8998
9049
|
return { conventions: undefined, pageFiles: pageFiles2 };
|
|
8999
9050
|
}
|
|
@@ -9016,10 +9067,10 @@ var init_scanConventions = __esm(() => {
|
|
|
9016
9067
|
});
|
|
9017
9068
|
|
|
9018
9069
|
// src/build/scanCssEntryPoints.ts
|
|
9019
|
-
import { existsSync as
|
|
9070
|
+
import { existsSync as existsSync9 } from "fs";
|
|
9020
9071
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
9021
9072
|
var scanCssEntryPoints = async (dir, ignore) => {
|
|
9022
|
-
if (!
|
|
9073
|
+
if (!existsSync9(dir))
|
|
9023
9074
|
return [];
|
|
9024
9075
|
const entryPaths = [];
|
|
9025
9076
|
const glob = new Glob4("**/*.{css,scss,sass,less,styl,stylus}");
|
|
@@ -9036,8 +9087,8 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
9036
9087
|
});
|
|
9037
9088
|
|
|
9038
9089
|
// src/utils/imageProcessing.ts
|
|
9039
|
-
import { existsSync as
|
|
9040
|
-
import { join as
|
|
9090
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "fs";
|
|
9091
|
+
import { join as join9, resolve as resolve11 } from "path";
|
|
9041
9092
|
var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
|
|
9042
9093
|
for (const size of sizes) {
|
|
9043
9094
|
if (size >= target)
|
|
@@ -9092,8 +9143,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9092
9143
|
const image2 = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
|
|
9093
9144
|
return [...device, ...image2].sort((left, right) => left - right);
|
|
9094
9145
|
}, getCacheDir = (buildDir) => {
|
|
9095
|
-
const dir =
|
|
9096
|
-
if (!
|
|
9146
|
+
const dir = join9(buildDir, ".cache", "images");
|
|
9147
|
+
if (!existsSync10(dir))
|
|
9097
9148
|
mkdirSync3(dir, { recursive: true });
|
|
9098
9149
|
return dir;
|
|
9099
9150
|
}, getCacheKey = (url, width, quality, format) => {
|
|
@@ -9149,13 +9200,13 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9149
9200
|
return toBuffer(buffer);
|
|
9150
9201
|
}
|
|
9151
9202
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
9152
|
-
const metaPath =
|
|
9153
|
-
const dataPath =
|
|
9154
|
-
if (!
|
|
9203
|
+
const metaPath = join9(cacheDir, `${cacheKey}.meta`);
|
|
9204
|
+
const dataPath = join9(cacheDir, `${cacheKey}.data`);
|
|
9205
|
+
if (!existsSync10(metaPath) || !existsSync10(dataPath))
|
|
9155
9206
|
return null;
|
|
9156
9207
|
try {
|
|
9157
|
-
const meta = JSON.parse(
|
|
9158
|
-
const buffer =
|
|
9208
|
+
const meta = JSON.parse(readFileSync8(metaPath, "utf-8"));
|
|
9209
|
+
const buffer = readFileSync8(dataPath);
|
|
9159
9210
|
return { buffer, meta };
|
|
9160
9211
|
} catch {
|
|
9161
9212
|
return null;
|
|
@@ -9177,8 +9228,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
9177
9228
|
return null;
|
|
9178
9229
|
}
|
|
9179
9230
|
}, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
|
|
9180
|
-
const metaPath =
|
|
9181
|
-
const dataPath =
|
|
9231
|
+
const metaPath = join9(cacheDir, `${cacheKey}.meta`);
|
|
9232
|
+
const dataPath = join9(cacheDir, `${cacheKey}.data`);
|
|
9182
9233
|
writeFileSync4(dataPath, buffer);
|
|
9183
9234
|
writeFileSync4(metaPath, JSON.stringify(meta));
|
|
9184
9235
|
};
|
|
@@ -9264,14 +9315,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
9264
9315
|
});
|
|
9265
9316
|
|
|
9266
9317
|
// src/cli/scripts/telemetry.ts
|
|
9267
|
-
import { existsSync as
|
|
9318
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
|
|
9268
9319
|
import { homedir } from "os";
|
|
9269
|
-
import { join as
|
|
9320
|
+
import { join as join10 } from "path";
|
|
9270
9321
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
9271
9322
|
try {
|
|
9272
|
-
if (!
|
|
9323
|
+
if (!existsSync11(configPath))
|
|
9273
9324
|
return null;
|
|
9274
|
-
const raw =
|
|
9325
|
+
const raw = readFileSync9(configPath, "utf-8");
|
|
9275
9326
|
const config = JSON.parse(raw);
|
|
9276
9327
|
return config;
|
|
9277
9328
|
} catch {
|
|
@@ -9279,19 +9330,19 @@ var configDir, configPath, getTelemetryConfig = () => {
|
|
|
9279
9330
|
}
|
|
9280
9331
|
};
|
|
9281
9332
|
var init_telemetry = __esm(() => {
|
|
9282
|
-
configDir =
|
|
9283
|
-
configPath =
|
|
9333
|
+
configDir = join10(homedir(), ".absolutejs");
|
|
9334
|
+
configPath = join10(configDir, "telemetry.json");
|
|
9284
9335
|
});
|
|
9285
9336
|
|
|
9286
9337
|
// src/cli/telemetryEvent.ts
|
|
9287
|
-
import { existsSync as
|
|
9338
|
+
import { existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
|
|
9288
9339
|
import { arch, platform } from "os";
|
|
9289
|
-
import { dirname as dirname8, join as
|
|
9340
|
+
import { dirname as dirname8, join as join11, parse } from "path";
|
|
9290
9341
|
var checkCandidate = (candidate) => {
|
|
9291
|
-
if (!
|
|
9342
|
+
if (!existsSync12(candidate)) {
|
|
9292
9343
|
return null;
|
|
9293
9344
|
}
|
|
9294
|
-
const pkg = JSON.parse(
|
|
9345
|
+
const pkg = JSON.parse(readFileSync10(candidate, "utf-8"));
|
|
9295
9346
|
if (pkg.name === "@absolutejs/absolute") {
|
|
9296
9347
|
const ver = pkg.version;
|
|
9297
9348
|
return ver;
|
|
@@ -9306,7 +9357,7 @@ var checkCandidate = (candidate) => {
|
|
|
9306
9357
|
}, findPackageVersion = () => {
|
|
9307
9358
|
let { dir } = import.meta;
|
|
9308
9359
|
while (dir !== parse(dir).root) {
|
|
9309
|
-
const candidate =
|
|
9360
|
+
const candidate = join11(dir, "package.json");
|
|
9310
9361
|
const version = checkCandidate(candidate);
|
|
9311
9362
|
if (version) {
|
|
9312
9363
|
return version;
|
|
@@ -9396,17 +9447,17 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
9396
9447
|
});
|
|
9397
9448
|
|
|
9398
9449
|
// src/dev/buildHMRClient.ts
|
|
9399
|
-
import { existsSync as
|
|
9450
|
+
import { existsSync as existsSync13 } from "fs";
|
|
9400
9451
|
import { resolve as resolve12 } from "path";
|
|
9401
9452
|
var {build: bunBuild } = globalThis.Bun;
|
|
9402
9453
|
var resolveHmrClientPath = () => {
|
|
9403
9454
|
const projectRoot = process.cwd();
|
|
9404
9455
|
const fromSource = resolve12(import.meta.dir, "client/hmrClient.ts");
|
|
9405
|
-
if (
|
|
9456
|
+
if (existsSync13(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
9406
9457
|
return fromSource;
|
|
9407
9458
|
}
|
|
9408
9459
|
const fromNodeModules = resolve12(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
9409
|
-
if (
|
|
9460
|
+
if (existsSync13(fromNodeModules))
|
|
9410
9461
|
return fromNodeModules;
|
|
9411
9462
|
return resolve12(import.meta.dir, "dev/client/hmrClient.ts");
|
|
9412
9463
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
@@ -9598,8 +9649,8 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
9598
9649
|
};
|
|
9599
9650
|
|
|
9600
9651
|
// src/build/angularLinkerPlugin.ts
|
|
9601
|
-
import { existsSync as
|
|
9602
|
-
import { dirname as dirname9, join as
|
|
9652
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync5, readFileSync as readFileSync11, writeFileSync as writeFileSync6 } from "fs";
|
|
9653
|
+
import { dirname as dirname9, join as join12, relative as relative5, resolve as resolve14 } from "path";
|
|
9603
9654
|
import { createHash as createHash2 } from "crypto";
|
|
9604
9655
|
var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
9605
9656
|
name: "angular-linker",
|
|
@@ -9607,7 +9658,7 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9607
9658
|
let needsLinking;
|
|
9608
9659
|
let babelTransform;
|
|
9609
9660
|
let linkerPlugin;
|
|
9610
|
-
const cacheDir =
|
|
9661
|
+
const cacheDir = join12(CACHE_ROOT, linkerJitMode ? "jit" : "aot");
|
|
9611
9662
|
bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
|
|
9612
9663
|
const source = await Bun.file(args.path).text();
|
|
9613
9664
|
if (!needsLinking) {
|
|
@@ -9620,10 +9671,10 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9620
9671
|
return;
|
|
9621
9672
|
}
|
|
9622
9673
|
const hash = createHash2("md5").update(source).digest("hex");
|
|
9623
|
-
const cachePath =
|
|
9624
|
-
if (
|
|
9674
|
+
const cachePath = join12(cacheDir, `${hash}.js`);
|
|
9675
|
+
if (existsSync14(cachePath)) {
|
|
9625
9676
|
return {
|
|
9626
|
-
contents:
|
|
9677
|
+
contents: readFileSync11(cachePath, "utf-8"),
|
|
9627
9678
|
loader: "js"
|
|
9628
9679
|
};
|
|
9629
9680
|
}
|
|
@@ -9638,8 +9689,8 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9638
9689
|
linkerPlugin = mod.createEs2015LinkerPlugin({
|
|
9639
9690
|
fileSystem: {
|
|
9640
9691
|
dirname: dirname9,
|
|
9641
|
-
exists:
|
|
9642
|
-
readFile:
|
|
9692
|
+
exists: existsSync14,
|
|
9693
|
+
readFile: readFileSync11,
|
|
9643
9694
|
relative: relative5,
|
|
9644
9695
|
resolve: resolve14
|
|
9645
9696
|
},
|
|
@@ -9700,7 +9751,7 @@ var init_cleanStaleOutputs = __esm(() => {
|
|
|
9700
9751
|
|
|
9701
9752
|
// src/utils/cleanup.ts
|
|
9702
9753
|
import { rm as rm3 } from "fs/promises";
|
|
9703
|
-
import { join as
|
|
9754
|
+
import { join as join13 } from "path";
|
|
9704
9755
|
var cleanup = async ({
|
|
9705
9756
|
angularDir,
|
|
9706
9757
|
reactDir,
|
|
@@ -9708,19 +9759,19 @@ var cleanup = async ({
|
|
|
9708
9759
|
vueDir
|
|
9709
9760
|
}) => {
|
|
9710
9761
|
await Promise.all([
|
|
9711
|
-
angularDir ? rm3(
|
|
9762
|
+
angularDir ? rm3(join13(angularDir, "generated"), {
|
|
9712
9763
|
force: true,
|
|
9713
9764
|
recursive: true
|
|
9714
9765
|
}) : undefined,
|
|
9715
|
-
reactDir ? rm3(
|
|
9766
|
+
reactDir ? rm3(join13(reactDir, "generated"), {
|
|
9716
9767
|
force: true,
|
|
9717
9768
|
recursive: true
|
|
9718
9769
|
}) : undefined,
|
|
9719
|
-
svelteDir ? rm3(
|
|
9770
|
+
svelteDir ? rm3(join13(svelteDir, "generated"), {
|
|
9720
9771
|
force: true,
|
|
9721
9772
|
recursive: true
|
|
9722
9773
|
}) : undefined,
|
|
9723
|
-
vueDir ? rm3(
|
|
9774
|
+
vueDir ? rm3(join13(vueDir, "generated"), {
|
|
9724
9775
|
force: true,
|
|
9725
9776
|
recursive: true
|
|
9726
9777
|
}) : undefined
|
|
@@ -9820,11 +9871,11 @@ __export(exports_compileSvelte, {
|
|
|
9820
9871
|
compileSvelte: () => compileSvelte,
|
|
9821
9872
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
9822
9873
|
});
|
|
9823
|
-
import { existsSync as
|
|
9874
|
+
import { existsSync as existsSync15 } from "fs";
|
|
9824
9875
|
import { mkdir as mkdir3, stat as stat2 } from "fs/promises";
|
|
9825
9876
|
import {
|
|
9826
9877
|
dirname as dirname10,
|
|
9827
|
-
join as
|
|
9878
|
+
join as join14,
|
|
9828
9879
|
basename as basename5,
|
|
9829
9880
|
extname as extname5,
|
|
9830
9881
|
resolve as resolve17,
|
|
@@ -9836,11 +9887,11 @@ var {write, file: file2, Transpiler } = globalThis.Bun;
|
|
|
9836
9887
|
var resolveDevClientDir2 = () => {
|
|
9837
9888
|
const projectRoot = process.cwd();
|
|
9838
9889
|
const fromSource = resolve17(import.meta.dir, "../dev/client");
|
|
9839
|
-
if (
|
|
9890
|
+
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
9840
9891
|
return fromSource;
|
|
9841
9892
|
}
|
|
9842
9893
|
const fromNodeModules = resolve17(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
9843
|
-
if (
|
|
9894
|
+
if (existsSync15(fromNodeModules))
|
|
9844
9895
|
return fromNodeModules;
|
|
9845
9896
|
return resolve17(import.meta.dir, "./dev/client");
|
|
9846
9897
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
@@ -9883,14 +9934,14 @@ var resolveDevClientDir2 = () => {
|
|
|
9883
9934
|
`${basePath}.svelte`,
|
|
9884
9935
|
`${basePath}.svelte.ts`,
|
|
9885
9936
|
`${basePath}.svelte.js`,
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9937
|
+
join14(basePath, "index.ts"),
|
|
9938
|
+
join14(basePath, "index.js"),
|
|
9939
|
+
join14(basePath, "index.mjs"),
|
|
9940
|
+
join14(basePath, "index.cjs"),
|
|
9941
|
+
join14(basePath, "index.json"),
|
|
9942
|
+
join14(basePath, "index.svelte"),
|
|
9943
|
+
join14(basePath, "index.svelte.ts"),
|
|
9944
|
+
join14(basePath, "index.svelte.js")
|
|
9894
9945
|
];
|
|
9895
9946
|
const checks = await Promise.all(candidates.map(exists));
|
|
9896
9947
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -9928,10 +9979,10 @@ var resolveDevClientDir2 = () => {
|
|
|
9928
9979
|
});
|
|
9929
9980
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
|
|
9930
9981
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
9931
|
-
const generatedDir =
|
|
9932
|
-
const clientDir =
|
|
9933
|
-
const indexDir =
|
|
9934
|
-
const serverDir =
|
|
9982
|
+
const generatedDir = join14(svelteRoot, "generated");
|
|
9983
|
+
const clientDir = join14(generatedDir, "client");
|
|
9984
|
+
const indexDir = join14(generatedDir, "indexes");
|
|
9985
|
+
const serverDir = join14(generatedDir, "server");
|
|
9935
9986
|
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir3(dir, { recursive: true })));
|
|
9936
9987
|
const dev = env2.NODE_ENV !== "production";
|
|
9937
9988
|
const build2 = async (src) => {
|
|
@@ -9969,8 +10020,8 @@ var resolveDevClientDir2 = () => {
|
|
|
9969
10020
|
const childBuilt = await Promise.all(childSources.map((child) => build2(child)));
|
|
9970
10021
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
9971
10022
|
const externalRewrites = new Map;
|
|
9972
|
-
const ssrOutputDir = dirname10(
|
|
9973
|
-
const clientOutputDir = dirname10(
|
|
10023
|
+
const ssrOutputDir = dirname10(join14(serverDir, relDir, `${baseName}.js`));
|
|
10024
|
+
const clientOutputDir = dirname10(join14(clientDir, relDir, `${baseName}.js`));
|
|
9974
10025
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
9975
10026
|
const rawSpec = importPaths[idx];
|
|
9976
10027
|
if (!rawSpec)
|
|
@@ -10035,8 +10086,8 @@ var resolveDevClientDir2 = () => {
|
|
|
10035
10086
|
code += islandMetadataExports;
|
|
10036
10087
|
return code;
|
|
10037
10088
|
};
|
|
10038
|
-
const ssrPath =
|
|
10039
|
-
const clientPath =
|
|
10089
|
+
const ssrPath = join14(serverDir, relDir, `${baseName}.js`);
|
|
10090
|
+
const clientPath = join14(clientDir, relDir, `${baseName}.js`);
|
|
10040
10091
|
await Promise.all([
|
|
10041
10092
|
mkdir3(dirname10(ssrPath), { recursive: true }),
|
|
10042
10093
|
mkdir3(dirname10(clientPath), { recursive: true })
|
|
@@ -10068,7 +10119,7 @@ var resolveDevClientDir2 = () => {
|
|
|
10068
10119
|
await Promise.all(roots.map(async ({ client: client2, hasAwaitSlot }) => {
|
|
10069
10120
|
const relClientDir = dirname10(relative7(clientDir, client2));
|
|
10070
10121
|
const name = basename5(client2, extname5(client2));
|
|
10071
|
-
const indexPath =
|
|
10122
|
+
const indexPath = join14(indexDir, relClientDir, `${name}.js`);
|
|
10072
10123
|
const importRaw = relative7(dirname10(indexPath), client2).split(sep2).join("/");
|
|
10073
10124
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
10074
10125
|
const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
@@ -10147,7 +10198,7 @@ if (typeof window !== "undefined") {
|
|
|
10147
10198
|
svelteClientPaths: roots.map(({ client: client2 }) => client2),
|
|
10148
10199
|
svelteIndexPaths: roots.map(({ client: client2 }) => {
|
|
10149
10200
|
const rel = dirname10(relative7(clientDir, client2));
|
|
10150
|
-
return
|
|
10201
|
+
return join14(indexDir, rel, basename5(client2));
|
|
10151
10202
|
}),
|
|
10152
10203
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
10153
10204
|
};
|
|
@@ -10161,7 +10212,7 @@ var init_compileSvelte = __esm(() => {
|
|
|
10161
10212
|
init_lowerAwaitSlotSyntax();
|
|
10162
10213
|
init_renderToReadableStream();
|
|
10163
10214
|
devClientDir2 = resolveDevClientDir2();
|
|
10164
|
-
hmrClientPath3 =
|
|
10215
|
+
hmrClientPath3 = join14(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
10165
10216
|
persistentCache = new Map;
|
|
10166
10217
|
sourceHashCache = new Map;
|
|
10167
10218
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
@@ -10176,18 +10227,18 @@ __export(exports_compileVue, {
|
|
|
10176
10227
|
compileVue: () => compileVue,
|
|
10177
10228
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
10178
10229
|
});
|
|
10179
|
-
import { existsSync as
|
|
10230
|
+
import { existsSync as existsSync16 } from "fs";
|
|
10180
10231
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
10181
|
-
import { basename as basename6, dirname as dirname11, join as
|
|
10232
|
+
import { basename as basename6, dirname as dirname11, join as join15, relative as relative8, resolve as resolve18 } from "path";
|
|
10182
10233
|
var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
10183
10234
|
var resolveDevClientDir3 = () => {
|
|
10184
10235
|
const projectRoot = process.cwd();
|
|
10185
10236
|
const fromSource = resolve18(import.meta.dir, "../dev/client");
|
|
10186
|
-
if (
|
|
10237
|
+
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10187
10238
|
return fromSource;
|
|
10188
10239
|
}
|
|
10189
10240
|
const fromNodeModules = resolve18(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
10190
|
-
if (
|
|
10241
|
+
if (existsSync16(fromNodeModules))
|
|
10191
10242
|
return fromNodeModules;
|
|
10192
10243
|
return resolve18(import.meta.dir, "./dev/client");
|
|
10193
10244
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
@@ -10334,7 +10385,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10334
10385
|
];
|
|
10335
10386
|
let cssOutputPaths = [];
|
|
10336
10387
|
if (isEntryPoint && allCss.length) {
|
|
10337
|
-
const cssOutputFile =
|
|
10388
|
+
const cssOutputFile = join15(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
10338
10389
|
await mkdir4(dirname11(cssOutputFile), { recursive: true });
|
|
10339
10390
|
await write2(cssOutputFile, allCss.join(`
|
|
10340
10391
|
`));
|
|
@@ -10365,8 +10416,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10365
10416
|
};
|
|
10366
10417
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
10367
10418
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
10368
|
-
const clientOutputPath =
|
|
10369
|
-
const serverOutputPath =
|
|
10419
|
+
const clientOutputPath = join15(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
10420
|
+
const serverOutputPath = join15(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
10370
10421
|
const relDir = dirname11(relativeFilePath);
|
|
10371
10422
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
10372
10423
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_2, prefix, dots) => {
|
|
@@ -10406,11 +10457,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10406
10457
|
return result;
|
|
10407
10458
|
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors) => {
|
|
10408
10459
|
const compiler = await import("@vue/compiler-sfc");
|
|
10409
|
-
const generatedDir =
|
|
10410
|
-
const clientOutputDir =
|
|
10411
|
-
const indexOutputDir =
|
|
10412
|
-
const serverOutputDir =
|
|
10413
|
-
const cssOutputDir =
|
|
10460
|
+
const generatedDir = join15(vueRootDir, "generated");
|
|
10461
|
+
const clientOutputDir = join15(generatedDir, "client");
|
|
10462
|
+
const indexOutputDir = join15(generatedDir, "indexes");
|
|
10463
|
+
const serverOutputDir = join15(generatedDir, "server");
|
|
10464
|
+
const cssOutputDir = join15(generatedDir, "compiled");
|
|
10414
10465
|
await Promise.all([
|
|
10415
10466
|
mkdir4(clientOutputDir, { recursive: true }),
|
|
10416
10467
|
mkdir4(indexOutputDir, { recursive: true }),
|
|
@@ -10427,8 +10478,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10427
10478
|
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
10428
10479
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
10429
10480
|
const entryBaseName = basename6(entryPath, ".vue");
|
|
10430
|
-
const indexOutputFile =
|
|
10431
|
-
const clientOutputFile =
|
|
10481
|
+
const indexOutputFile = join15(indexOutputDir, `${entryBaseName}.js`);
|
|
10482
|
+
const clientOutputFile = join15(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
10432
10483
|
await mkdir4(dirname11(indexOutputFile), { recursive: true });
|
|
10433
10484
|
const vueHmrImports = isDev2 ? [
|
|
10434
10485
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -10557,8 +10608,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10557
10608
|
const sourceCode = await file3(tsPath).text();
|
|
10558
10609
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
10559
10610
|
const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
10560
|
-
const outClientPath =
|
|
10561
|
-
const outServerPath =
|
|
10611
|
+
const outClientPath = join15(clientOutputDir, relativeJsPath);
|
|
10612
|
+
const outServerPath = join15(serverOutputDir, relativeJsPath);
|
|
10562
10613
|
await mkdir4(dirname11(outClientPath), { recursive: true });
|
|
10563
10614
|
await mkdir4(dirname11(outServerPath), { recursive: true });
|
|
10564
10615
|
await write2(outClientPath, transpiledCode);
|
|
@@ -10578,7 +10629,7 @@ var init_compileVue = __esm(() => {
|
|
|
10578
10629
|
init_sourceMetadata();
|
|
10579
10630
|
init_stylePreprocessor();
|
|
10580
10631
|
devClientDir3 = resolveDevClientDir3();
|
|
10581
|
-
hmrClientPath4 =
|
|
10632
|
+
hmrClientPath4 = join15(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
10582
10633
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
10583
10634
|
scriptCache = new Map;
|
|
10584
10635
|
scriptSetupCache = new Map;
|
|
@@ -11058,8 +11109,8 @@ __export(exports_compileAngular, {
|
|
|
11058
11109
|
compileAngularFile: () => compileAngularFile,
|
|
11059
11110
|
compileAngular: () => compileAngular
|
|
11060
11111
|
});
|
|
11061
|
-
import { existsSync as
|
|
11062
|
-
import { join as
|
|
11112
|
+
import { existsSync as existsSync17, readFileSync as readFileSync12, promises as fs } from "fs";
|
|
11113
|
+
import { join as join16, basename as basename7, sep as sep3, dirname as dirname12, resolve as resolve19, relative as relative9 } from "path";
|
|
11063
11114
|
import ts2 from "typescript";
|
|
11064
11115
|
var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
11065
11116
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
@@ -11101,12 +11152,12 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11101
11152
|
`${candidate}.tsx`,
|
|
11102
11153
|
`${candidate}.js`,
|
|
11103
11154
|
`${candidate}.jsx`,
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11155
|
+
join16(candidate, "index.ts"),
|
|
11156
|
+
join16(candidate, "index.tsx"),
|
|
11157
|
+
join16(candidate, "index.js"),
|
|
11158
|
+
join16(candidate, "index.jsx")
|
|
11108
11159
|
];
|
|
11109
|
-
return candidates.find((file4) =>
|
|
11160
|
+
return candidates.find((file4) => existsSync17(file4));
|
|
11110
11161
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
11111
11162
|
const baseDir = resolve19(rootDir);
|
|
11112
11163
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
@@ -11187,11 +11238,11 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
11187
11238
|
}, resolveDevClientDir4 = () => {
|
|
11188
11239
|
const projectRoot = process.cwd();
|
|
11189
11240
|
const fromSource = resolve19(import.meta.dir, "../dev/client");
|
|
11190
|
-
if (
|
|
11241
|
+
if (existsSync17(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
11191
11242
|
return fromSource;
|
|
11192
11243
|
}
|
|
11193
11244
|
const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
11194
|
-
if (
|
|
11245
|
+
if (existsSync17(fromNodeModules))
|
|
11195
11246
|
return fromNodeModules;
|
|
11196
11247
|
return resolve19(import.meta.dir, "./dev/client");
|
|
11197
11248
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
@@ -11243,11 +11294,11 @@ ${registrations}
|
|
|
11243
11294
|
return specifier;
|
|
11244
11295
|
const importerDir = dirname12(importerOutputPath);
|
|
11245
11296
|
const fileCandidate = resolve19(importerDir, `${specifier}.js`);
|
|
11246
|
-
if (outputFiles?.has(fileCandidate) ||
|
|
11297
|
+
if (outputFiles?.has(fileCandidate) || existsSync17(fileCandidate)) {
|
|
11247
11298
|
return `${specifier}.js`;
|
|
11248
11299
|
}
|
|
11249
11300
|
const indexCandidate = resolve19(importerDir, specifier, "index.js");
|
|
11250
|
-
if (outputFiles?.has(indexCandidate) ||
|
|
11301
|
+
if (outputFiles?.has(indexCandidate) || existsSync17(indexCandidate)) {
|
|
11251
11302
|
return `${specifier}/index.js`;
|
|
11252
11303
|
}
|
|
11253
11304
|
return `${specifier}.js`;
|
|
@@ -11280,12 +11331,12 @@ ${registrations}
|
|
|
11280
11331
|
`${basePath}.tsx`,
|
|
11281
11332
|
`${basePath}.mts`,
|
|
11282
11333
|
`${basePath}.cts`,
|
|
11283
|
-
|
|
11284
|
-
|
|
11285
|
-
|
|
11286
|
-
|
|
11334
|
+
join16(basePath, "index.ts"),
|
|
11335
|
+
join16(basePath, "index.tsx"),
|
|
11336
|
+
join16(basePath, "index.mts"),
|
|
11337
|
+
join16(basePath, "index.cts")
|
|
11287
11338
|
];
|
|
11288
|
-
return candidates.map((candidate) => resolve19(candidate)).find((candidate) =>
|
|
11339
|
+
return candidates.map((candidate) => resolve19(candidate)).find((candidate) => existsSync17(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
11289
11340
|
}, readFileForAotTransform = async (fileName, readFile5) => {
|
|
11290
11341
|
const hostSource = readFile5?.(fileName);
|
|
11291
11342
|
if (typeof hostSource === "string")
|
|
@@ -11309,15 +11360,15 @@ ${registrations}
|
|
|
11309
11360
|
const paths = [];
|
|
11310
11361
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11311
11362
|
if (templateUrlMatch?.[1])
|
|
11312
|
-
paths.push(
|
|
11363
|
+
paths.push(join16(fileDir, templateUrlMatch[1]));
|
|
11313
11364
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11314
11365
|
if (styleUrlMatch?.[1])
|
|
11315
|
-
paths.push(
|
|
11366
|
+
paths.push(join16(fileDir, styleUrlMatch[1]));
|
|
11316
11367
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
11317
11368
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
11318
11369
|
if (urlMatches) {
|
|
11319
11370
|
for (const urlMatch of urlMatches) {
|
|
11320
|
-
paths.push(
|
|
11371
|
+
paths.push(join16(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
11321
11372
|
}
|
|
11322
11373
|
}
|
|
11323
11374
|
return paths.map((path) => resolve19(path));
|
|
@@ -11351,7 +11402,7 @@ ${registrations}
|
|
|
11351
11402
|
safeStableStringify(stylePreprocessors ?? null)
|
|
11352
11403
|
].join("\x00");
|
|
11353
11404
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
11354
|
-
return
|
|
11405
|
+
return join16(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
11355
11406
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile5, stylePreprocessors) => {
|
|
11356
11407
|
const transformedSources = new Map;
|
|
11357
11408
|
const visited = new Set;
|
|
@@ -11366,7 +11417,7 @@ ${registrations}
|
|
|
11366
11417
|
if (visited.has(resolvedPath))
|
|
11367
11418
|
return;
|
|
11368
11419
|
visited.add(resolvedPath);
|
|
11369
|
-
if (!
|
|
11420
|
+
if (!existsSync17(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
11370
11421
|
return;
|
|
11371
11422
|
stats.filesVisited += 1;
|
|
11372
11423
|
const source = await readFileForAotTransform(resolvedPath, readFile5);
|
|
@@ -11397,10 +11448,10 @@ ${registrations}
|
|
|
11397
11448
|
return { stats, transformedSources };
|
|
11398
11449
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
11399
11450
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
11400
|
-
const outputPath = resolve19(
|
|
11451
|
+
const outputPath = resolve19(join16(outDir, relative9(process.cwd(), resolve19(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
11401
11452
|
return [
|
|
11402
11453
|
outputPath,
|
|
11403
|
-
buildIslandMetadataExports(
|
|
11454
|
+
buildIslandMetadataExports(readFileSync12(inputPath, "utf-8"))
|
|
11404
11455
|
];
|
|
11405
11456
|
})), { entries: inputPaths.length });
|
|
11406
11457
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
@@ -11443,7 +11494,7 @@ ${registrations}
|
|
|
11443
11494
|
const originalGetSourceFile = host.getSourceFile;
|
|
11444
11495
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
11445
11496
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
11446
|
-
const resolvedPath =
|
|
11497
|
+
const resolvedPath = join16(tsLibDir, fileName);
|
|
11447
11498
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
11448
11499
|
}
|
|
11449
11500
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
@@ -11498,7 +11549,7 @@ ${registrations}
|
|
|
11498
11549
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
11499
11550
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
11500
11551
|
content,
|
|
11501
|
-
target:
|
|
11552
|
+
target: join16(outDir, fileName)
|
|
11502
11553
|
}));
|
|
11503
11554
|
const outputFiles = new Set(rawEntries.map(({ target }) => resolve19(target)));
|
|
11504
11555
|
return rawEntries.map(({ content, target }) => {
|
|
@@ -11537,7 +11588,7 @@ ${registrations}
|
|
|
11537
11588
|
return null;
|
|
11538
11589
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
11539
11590
|
const sourceEntry = resolve19(import.meta.dir, "../angular/components/index.ts");
|
|
11540
|
-
if (
|
|
11591
|
+
if (existsSync17(sourceEntry)) {
|
|
11541
11592
|
return sourceEntry.replace(/\\/g, "/");
|
|
11542
11593
|
}
|
|
11543
11594
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -11665,7 +11716,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
11665
11716
|
${fields}
|
|
11666
11717
|
`);
|
|
11667
11718
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
11668
|
-
if (!
|
|
11719
|
+
if (!existsSync17(filePath)) {
|
|
11669
11720
|
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
11670
11721
|
}
|
|
11671
11722
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
@@ -11673,8 +11724,8 @@ ${fields}
|
|
|
11673
11724
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
11674
11725
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11675
11726
|
if (templateUrlMatch?.[1]) {
|
|
11676
|
-
const templatePath =
|
|
11677
|
-
if (!
|
|
11727
|
+
const templatePath = join16(fileDir, templateUrlMatch[1]);
|
|
11728
|
+
if (!existsSync17(templatePath)) {
|
|
11678
11729
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
11679
11730
|
}
|
|
11680
11731
|
const templateRaw2 = await fs.readFile(templatePath, "utf-8");
|
|
@@ -11704,11 +11755,11 @@ ${fields}
|
|
|
11704
11755
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
11705
11756
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11706
11757
|
if (templateUrlMatch?.[1]) {
|
|
11707
|
-
const templatePath =
|
|
11708
|
-
if (!
|
|
11758
|
+
const templatePath = join16(fileDir, templateUrlMatch[1]);
|
|
11759
|
+
if (!existsSync17(templatePath)) {
|
|
11709
11760
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
11710
11761
|
}
|
|
11711
|
-
const templateRaw2 =
|
|
11762
|
+
const templateRaw2 = readFileSync12(templatePath, "utf-8");
|
|
11712
11763
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
11713
11764
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
11714
11765
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -11741,7 +11792,7 @@ ${fields}
|
|
|
11741
11792
|
return source;
|
|
11742
11793
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
11743
11794
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
11744
|
-
return readAndEscapeFile(
|
|
11795
|
+
return readAndEscapeFile(join16(fileDir, styleUrl), stylePreprocessors);
|
|
11745
11796
|
});
|
|
11746
11797
|
const results = await Promise.all(stylePromises);
|
|
11747
11798
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -11752,7 +11803,7 @@ ${fields}
|
|
|
11752
11803
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11753
11804
|
if (!styleUrlMatch?.[1])
|
|
11754
11805
|
return source;
|
|
11755
|
-
const escaped = await readAndEscapeFile(
|
|
11806
|
+
const escaped = await readAndEscapeFile(join16(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
11756
11807
|
if (!escaped)
|
|
11757
11808
|
return source;
|
|
11758
11809
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -11787,12 +11838,12 @@ ${fields}
|
|
|
11787
11838
|
`${candidate}.tsx`,
|
|
11788
11839
|
`${candidate}.js`,
|
|
11789
11840
|
`${candidate}.jsx`,
|
|
11790
|
-
|
|
11791
|
-
|
|
11792
|
-
|
|
11793
|
-
|
|
11841
|
+
join16(candidate, "index.ts"),
|
|
11842
|
+
join16(candidate, "index.tsx"),
|
|
11843
|
+
join16(candidate, "index.js"),
|
|
11844
|
+
join16(candidate, "index.jsx")
|
|
11794
11845
|
];
|
|
11795
|
-
return candidates.find((file4) =>
|
|
11846
|
+
return candidates.find((file4) => existsSync17(file4));
|
|
11796
11847
|
};
|
|
11797
11848
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
11798
11849
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
@@ -11817,7 +11868,7 @@ ${fields}
|
|
|
11817
11868
|
const inputDir = dirname12(sourcePath);
|
|
11818
11869
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
11819
11870
|
const fileBase = basename7(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
11820
|
-
return
|
|
11871
|
+
return join16(outDir, relativeDir, fileBase);
|
|
11821
11872
|
};
|
|
11822
11873
|
const transpileAndRewrite = (sourceCode, relativeDir, actualPath, importRewrites) => {
|
|
11823
11874
|
let processedContent = angularTranspiler.transformSync(sourceCode);
|
|
@@ -11862,7 +11913,7 @@ ${fields}
|
|
|
11862
11913
|
let actualPath = resolved;
|
|
11863
11914
|
if (!actualPath.endsWith(".ts"))
|
|
11864
11915
|
actualPath += ".ts";
|
|
11865
|
-
if (!
|
|
11916
|
+
if (!existsSync17(actualPath))
|
|
11866
11917
|
return;
|
|
11867
11918
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
11868
11919
|
const inlined = await inlineResources(sourceCode, dirname12(actualPath), stylePreprocessors);
|
|
@@ -11870,7 +11921,7 @@ ${fields}
|
|
|
11870
11921
|
const inputDir = dirname12(actualPath);
|
|
11871
11922
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
11872
11923
|
const fileBase = basename7(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
11873
|
-
const targetDir =
|
|
11924
|
+
const targetDir = join16(outDir, relativeDir);
|
|
11874
11925
|
const targetPath = toOutputPath(actualPath);
|
|
11875
11926
|
const localImports = [];
|
|
11876
11927
|
const importRewrites = new Map;
|
|
@@ -11898,7 +11949,7 @@ ${fields}
|
|
|
11898
11949
|
}).filter((path) => Boolean(path));
|
|
11899
11950
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
11900
11951
|
const cacheKey2 = actualPath;
|
|
11901
|
-
if (jitContentCache.get(cacheKey2) === contentHash &&
|
|
11952
|
+
if (jitContentCache.get(cacheKey2) === contentHash && existsSync17(targetPath)) {
|
|
11902
11953
|
allOutputs.push(targetPath);
|
|
11903
11954
|
} else {
|
|
11904
11955
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
@@ -11911,7 +11962,7 @@ ${fields}
|
|
|
11911
11962
|
};
|
|
11912
11963
|
await transpileFile(inputPath);
|
|
11913
11964
|
const entryOutputPath = toOutputPath(entryPath);
|
|
11914
|
-
if (
|
|
11965
|
+
if (existsSync17(entryOutputPath)) {
|
|
11915
11966
|
const entryOutput = await fs.readFile(entryOutputPath, "utf-8");
|
|
11916
11967
|
const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
|
|
11917
11968
|
`);
|
|
@@ -11924,13 +11975,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
11924
11975
|
}
|
|
11925
11976
|
return allOutputs;
|
|
11926
11977
|
}, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
|
|
11927
|
-
const compiledParent =
|
|
11978
|
+
const compiledParent = join16(outRoot, "generated");
|
|
11928
11979
|
if (entryPoints.length === 0) {
|
|
11929
11980
|
const emptyPaths = [];
|
|
11930
11981
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
11931
11982
|
}
|
|
11932
11983
|
const compiledRoot = compiledParent;
|
|
11933
|
-
const indexesDir =
|
|
11984
|
+
const indexesDir = join16(compiledParent, "indexes");
|
|
11934
11985
|
await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
|
|
11935
11986
|
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve19(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
11936
11987
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
@@ -11944,21 +11995,21 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
11944
11995
|
const fileBase = basename7(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
11945
11996
|
const jsName = `${fileBase}.js`;
|
|
11946
11997
|
const compiledFallbackPaths = [
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11998
|
+
join16(compiledRoot, relativeEntry),
|
|
11999
|
+
join16(compiledRoot, "pages", jsName),
|
|
12000
|
+
join16(compiledRoot, jsName)
|
|
11950
12001
|
].map((file4) => resolve19(file4));
|
|
11951
12002
|
const resolveRawServerFile = (candidatePaths) => {
|
|
11952
12003
|
const normalizedCandidates = [
|
|
11953
12004
|
...candidatePaths.map((file4) => resolve19(file4)),
|
|
11954
12005
|
...compiledFallbackPaths
|
|
11955
12006
|
];
|
|
11956
|
-
let candidate = normalizedCandidates.find((file4) =>
|
|
12007
|
+
let candidate = normalizedCandidates.find((file4) => existsSync17(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
11957
12008
|
if (!candidate) {
|
|
11958
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
12009
|
+
candidate = normalizedCandidates.find((file4) => existsSync17(file4) && file4.endsWith(`${sep3}${jsName}`));
|
|
11959
12010
|
}
|
|
11960
12011
|
if (!candidate) {
|
|
11961
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
12012
|
+
candidate = normalizedCandidates.find((file4) => existsSync17(file4));
|
|
11962
12013
|
}
|
|
11963
12014
|
return candidate;
|
|
11964
12015
|
};
|
|
@@ -11966,11 +12017,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
11966
12017
|
if (!rawServerFile) {
|
|
11967
12018
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
|
|
11968
12019
|
}
|
|
11969
|
-
if (rawServerFile && !
|
|
12020
|
+
if (rawServerFile && !existsSync17(rawServerFile)) {
|
|
11970
12021
|
outputs = hmr ? await compileEntry() : aotOutputs;
|
|
11971
12022
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
|
|
11972
12023
|
}
|
|
11973
|
-
if (!rawServerFile || !
|
|
12024
|
+
if (!rawServerFile || !existsSync17(rawServerFile)) {
|
|
11974
12025
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
11975
12026
|
...outputs,
|
|
11976
12027
|
...compiledFallbackPaths
|
|
@@ -11990,8 +12041,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
11990
12041
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
11991
12042
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
11992
12043
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
11993
|
-
const clientFile =
|
|
11994
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
12044
|
+
const clientFile = join16(indexesDir, jsName);
|
|
12045
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync17(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
11995
12046
|
return {
|
|
11996
12047
|
clientPath: clientFile,
|
|
11997
12048
|
indexUnchanged: true,
|
|
@@ -12238,8 +12289,8 @@ var init_compileAngular = __esm(() => {
|
|
|
12238
12289
|
init_lowerDeferSyntax();
|
|
12239
12290
|
init_stylePreprocessor();
|
|
12240
12291
|
devClientDir4 = resolveDevClientDir4();
|
|
12241
|
-
hmrClientPath5 =
|
|
12242
|
-
hmrRuntimePath =
|
|
12292
|
+
hmrClientPath5 = join16(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
12293
|
+
hmrRuntimePath = join16(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
|
|
12243
12294
|
jitContentCache = new Map;
|
|
12244
12295
|
wrapperOutputCache = new Map;
|
|
12245
12296
|
});
|
|
@@ -12250,8 +12301,8 @@ __export(exports_buildReactVendor, {
|
|
|
12250
12301
|
computeVendorPaths: () => computeVendorPaths,
|
|
12251
12302
|
buildReactVendor: () => buildReactVendor
|
|
12252
12303
|
});
|
|
12253
|
-
import { existsSync as
|
|
12254
|
-
import { join as
|
|
12304
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync6 } from "fs";
|
|
12305
|
+
import { join as join17, resolve as resolve20 } from "path";
|
|
12255
12306
|
import { rm as rm4 } from "fs/promises";
|
|
12256
12307
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
12257
12308
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
@@ -12264,7 +12315,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
12264
12315
|
resolve20(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
12265
12316
|
];
|
|
12266
12317
|
for (const candidate of candidates) {
|
|
12267
|
-
if (
|
|
12318
|
+
if (existsSync18(candidate)) {
|
|
12268
12319
|
return candidate.replace(/\\/g, "/");
|
|
12269
12320
|
}
|
|
12270
12321
|
}
|
|
@@ -12305,14 +12356,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
12305
12356
|
`)}
|
|
12306
12357
|
`;
|
|
12307
12358
|
}, buildReactVendor = async (buildDir) => {
|
|
12308
|
-
const vendorDir =
|
|
12359
|
+
const vendorDir = join17(buildDir, "react", "vendor");
|
|
12309
12360
|
mkdirSync6(vendorDir, { recursive: true });
|
|
12310
|
-
const tmpDir =
|
|
12361
|
+
const tmpDir = join17(buildDir, "_vendor_tmp");
|
|
12311
12362
|
mkdirSync6(tmpDir, { recursive: true });
|
|
12312
12363
|
const specifiers = resolveVendorSpecifiers();
|
|
12313
12364
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12314
12365
|
const safeName = toSafeFileName(specifier);
|
|
12315
|
-
const entryPath =
|
|
12366
|
+
const entryPath = join17(tmpDir, `${safeName}.ts`);
|
|
12316
12367
|
const source = await generateEntrySource(specifier);
|
|
12317
12368
|
await Bun.write(entryPath, source);
|
|
12318
12369
|
return entryPath;
|
|
@@ -12357,7 +12408,7 @@ __export(exports_buildAngularVendor, {
|
|
|
12357
12408
|
buildAngularVendor: () => buildAngularVendor
|
|
12358
12409
|
});
|
|
12359
12410
|
import { mkdirSync as mkdirSync7 } from "fs";
|
|
12360
|
-
import { join as
|
|
12411
|
+
import { join as join18 } from "path";
|
|
12361
12412
|
import { rm as rm5 } from "fs/promises";
|
|
12362
12413
|
var {build: bunBuild3, Glob: Glob6 } = globalThis.Bun;
|
|
12363
12414
|
var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS, isResolvable2 = (specifier) => {
|
|
@@ -12394,7 +12445,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
|
|
|
12394
12445
|
}
|
|
12395
12446
|
return { angular, transitiveRoots };
|
|
12396
12447
|
}, collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
12397
|
-
const { readFileSync:
|
|
12448
|
+
const { readFileSync: readFileSync13 } = await import("fs");
|
|
12398
12449
|
const transpiler4 = new Bun.Transpiler({ loader: "js" });
|
|
12399
12450
|
const visited = new Set;
|
|
12400
12451
|
const frontier = [];
|
|
@@ -12415,7 +12466,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
|
|
|
12415
12466
|
}
|
|
12416
12467
|
let content;
|
|
12417
12468
|
try {
|
|
12418
|
-
content =
|
|
12469
|
+
content = readFileSync13(resolved, "utf-8");
|
|
12419
12470
|
} catch {
|
|
12420
12471
|
continue;
|
|
12421
12472
|
}
|
|
@@ -12450,14 +12501,14 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
|
|
|
12450
12501
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
12451
12502
|
return Array.from(angular).filter(isResolvable2);
|
|
12452
12503
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
12453
|
-
const vendorDir =
|
|
12504
|
+
const vendorDir = join18(buildDir, "angular", "vendor");
|
|
12454
12505
|
mkdirSync7(vendorDir, { recursive: true });
|
|
12455
|
-
const tmpDir =
|
|
12506
|
+
const tmpDir = join18(buildDir, "_angular_vendor_tmp");
|
|
12456
12507
|
mkdirSync7(tmpDir, { recursive: true });
|
|
12457
12508
|
const specifiers = await resolveAngularSpecifiers(directories);
|
|
12458
12509
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12459
12510
|
const safeName = toSafeFileName2(specifier);
|
|
12460
|
-
const entryPath =
|
|
12511
|
+
const entryPath = join18(tmpDir, `${safeName}.ts`);
|
|
12461
12512
|
await Bun.write(entryPath, generateVendorEntrySource(specifier));
|
|
12462
12513
|
return entryPath;
|
|
12463
12514
|
}));
|
|
@@ -12518,17 +12569,17 @@ __export(exports_buildVueVendor, {
|
|
|
12518
12569
|
buildVueVendor: () => buildVueVendor
|
|
12519
12570
|
});
|
|
12520
12571
|
import { mkdirSync as mkdirSync8 } from "fs";
|
|
12521
|
-
import { join as
|
|
12572
|
+
import { join as join19 } from "path";
|
|
12522
12573
|
import { rm as rm6 } from "fs/promises";
|
|
12523
12574
|
var {build: bunBuild4 } = globalThis.Bun;
|
|
12524
12575
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
12525
|
-
const vendorDir =
|
|
12576
|
+
const vendorDir = join19(buildDir, "vue", "vendor");
|
|
12526
12577
|
mkdirSync8(vendorDir, { recursive: true });
|
|
12527
|
-
const tmpDir =
|
|
12578
|
+
const tmpDir = join19(buildDir, "_vue_vendor_tmp");
|
|
12528
12579
|
mkdirSync8(tmpDir, { recursive: true });
|
|
12529
12580
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
12530
12581
|
const safeName = toSafeFileName3(specifier);
|
|
12531
|
-
const entryPath =
|
|
12582
|
+
const entryPath = join19(tmpDir, `${safeName}.ts`);
|
|
12532
12583
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
12533
12584
|
`);
|
|
12534
12585
|
return entryPath;
|
|
@@ -12553,11 +12604,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
12553
12604
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
12554
12605
|
return;
|
|
12555
12606
|
}
|
|
12556
|
-
const { readFileSync:
|
|
12607
|
+
const { readFileSync: readFileSync13, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
12557
12608
|
const files = readdirSync(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
12558
12609
|
for (const file4 of files) {
|
|
12559
|
-
const filePath =
|
|
12560
|
-
const content =
|
|
12610
|
+
const filePath = join19(vendorDir, file4);
|
|
12611
|
+
const content = readFileSync13(filePath, "utf-8");
|
|
12561
12612
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
12562
12613
|
continue;
|
|
12563
12614
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -12583,7 +12634,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
12583
12634
|
buildSvelteVendor: () => buildSvelteVendor
|
|
12584
12635
|
});
|
|
12585
12636
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
12586
|
-
import { join as
|
|
12637
|
+
import { join as join20 } from "path";
|
|
12587
12638
|
import { rm as rm7 } from "fs/promises";
|
|
12588
12639
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
12589
12640
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
@@ -12597,13 +12648,13 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
12597
12648
|
const specifiers = resolveVendorSpecifiers2();
|
|
12598
12649
|
if (specifiers.length === 0)
|
|
12599
12650
|
return;
|
|
12600
|
-
const vendorDir =
|
|
12651
|
+
const vendorDir = join20(buildDir, "svelte", "vendor");
|
|
12601
12652
|
mkdirSync9(vendorDir, { recursive: true });
|
|
12602
|
-
const tmpDir =
|
|
12653
|
+
const tmpDir = join20(buildDir, "_svelte_vendor_tmp");
|
|
12603
12654
|
mkdirSync9(tmpDir, { recursive: true });
|
|
12604
12655
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12605
12656
|
const safeName = toSafeFileName4(specifier);
|
|
12606
|
-
const entryPath =
|
|
12657
|
+
const entryPath = join20(tmpDir, `${safeName}.ts`);
|
|
12607
12658
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
12608
12659
|
`);
|
|
12609
12660
|
return entryPath;
|
|
@@ -12676,11 +12727,11 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
|
|
|
12676
12727
|
if (Object.keys(vendorPaths).length === 0)
|
|
12677
12728
|
return;
|
|
12678
12729
|
const { readdirSync } = await import("fs");
|
|
12679
|
-
const { join:
|
|
12730
|
+
const { join: join21 } = await import("path");
|
|
12680
12731
|
const allFiles = [];
|
|
12681
12732
|
for (const dir of vendorDirs) {
|
|
12682
12733
|
try {
|
|
12683
|
-
const files = readdirSync(dir).filter((f2) => f2.endsWith(".js")).map((f2) =>
|
|
12734
|
+
const files = readdirSync(dir).filter((f2) => f2.endsWith(".js")).map((f2) => join21(dir, f2));
|
|
12684
12735
|
allFiles.push(...files);
|
|
12685
12736
|
} catch {}
|
|
12686
12737
|
}
|
|
@@ -12749,14 +12800,14 @@ var init_rewriteImports = __esm(() => {
|
|
|
12749
12800
|
import {
|
|
12750
12801
|
copyFileSync,
|
|
12751
12802
|
cpSync,
|
|
12752
|
-
existsSync as
|
|
12803
|
+
existsSync as existsSync19,
|
|
12753
12804
|
mkdirSync as mkdirSync10,
|
|
12754
|
-
readFileSync as
|
|
12805
|
+
readFileSync as readFileSync13,
|
|
12755
12806
|
rmSync as rmSync2,
|
|
12756
12807
|
statSync,
|
|
12757
12808
|
writeFileSync as writeFileSync7
|
|
12758
12809
|
} from "fs";
|
|
12759
|
-
import { basename as basename8, dirname as dirname13, join as
|
|
12810
|
+
import { basename as basename8, dirname as dirname13, join as join21, relative as relative10, resolve as resolve21 } from "path";
|
|
12760
12811
|
import { cwd, env as env3, exit } from "process";
|
|
12761
12812
|
var {build: bunBuild6, Glob: Glob7 } = globalThis.Bun;
|
|
12762
12813
|
var isDev2, isBuildTraceEnabled = () => {
|
|
@@ -12834,8 +12885,8 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
12834
12885
|
mkdirSync10(htmxDestDir, { recursive: true });
|
|
12835
12886
|
const glob = new Glob7("htmx*.min.js");
|
|
12836
12887
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
12837
|
-
const src =
|
|
12838
|
-
const dest =
|
|
12888
|
+
const src = join21(htmxDir, relPath);
|
|
12889
|
+
const dest = join21(htmxDestDir, "htmx.min.js");
|
|
12839
12890
|
copyFileSync(src, dest);
|
|
12840
12891
|
return;
|
|
12841
12892
|
}
|
|
@@ -12879,7 +12930,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
12879
12930
|
addWorkerPathIfExists(file4, relPath, workerPaths);
|
|
12880
12931
|
}
|
|
12881
12932
|
}, collectWorkerPathsFromFile = (file4, patterns, workerPaths) => {
|
|
12882
|
-
const content =
|
|
12933
|
+
const content = readFileSync13(file4, "utf-8");
|
|
12883
12934
|
for (const pattern of patterns) {
|
|
12884
12935
|
collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
|
|
12885
12936
|
}
|
|
@@ -12910,7 +12961,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
12910
12961
|
vuePagesPath
|
|
12911
12962
|
}) => {
|
|
12912
12963
|
const { readdirSync: readDir } = await import("fs");
|
|
12913
|
-
const devIndexDir =
|
|
12964
|
+
const devIndexDir = join21(buildPath, "_src_indexes");
|
|
12914
12965
|
mkdirSync10(devIndexDir, { recursive: true });
|
|
12915
12966
|
if (reactIndexesPath && reactPagesPath) {
|
|
12916
12967
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -12922,41 +12973,41 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
12922
12973
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
12923
12974
|
}
|
|
12924
12975
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
12925
|
-
if (!
|
|
12976
|
+
if (!existsSync19(reactIndexesPath)) {
|
|
12926
12977
|
return;
|
|
12927
12978
|
}
|
|
12928
12979
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
12929
12980
|
const pagesRel = relative10(process.cwd(), resolve21(reactPagesPath)).replace(/\\/g, "/");
|
|
12930
12981
|
for (const file4 of indexFiles) {
|
|
12931
|
-
let content =
|
|
12982
|
+
let content = readFileSync13(join21(reactIndexesPath, file4), "utf-8");
|
|
12932
12983
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
12933
|
-
writeFileSync7(
|
|
12984
|
+
writeFileSync7(join21(devIndexDir, file4), content);
|
|
12934
12985
|
}
|
|
12935
12986
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
12936
|
-
const svelteIndexDir =
|
|
12987
|
+
const svelteIndexDir = join21(svelteDir, "generated", "indexes");
|
|
12937
12988
|
const sveltePageEntries = svelteEntries.filter((file4) => resolve21(file4).startsWith(resolve21(sveltePagesPath)));
|
|
12938
12989
|
for (const entry of sveltePageEntries) {
|
|
12939
12990
|
const name = basename8(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
12940
|
-
const indexFile =
|
|
12941
|
-
if (!
|
|
12991
|
+
const indexFile = join21(svelteIndexDir, "pages", `${name}.js`);
|
|
12992
|
+
if (!existsSync19(indexFile))
|
|
12942
12993
|
continue;
|
|
12943
|
-
let content =
|
|
12994
|
+
let content = readFileSync13(indexFile, "utf-8");
|
|
12944
12995
|
const srcRel = relative10(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
12945
12996
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
12946
|
-
writeFileSync7(
|
|
12997
|
+
writeFileSync7(join21(devIndexDir, `${name}.svelte.js`), content);
|
|
12947
12998
|
}
|
|
12948
12999
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
12949
|
-
const vueIndexDir =
|
|
13000
|
+
const vueIndexDir = join21(vueDir, "generated", "indexes");
|
|
12950
13001
|
const vuePageEntries = vueEntries.filter((file4) => resolve21(file4).startsWith(resolve21(vuePagesPath)));
|
|
12951
13002
|
for (const entry of vuePageEntries) {
|
|
12952
13003
|
const name = basename8(entry, ".vue");
|
|
12953
|
-
const indexFile =
|
|
12954
|
-
if (!
|
|
13004
|
+
const indexFile = join21(vueIndexDir, `${name}.js`);
|
|
13005
|
+
if (!existsSync19(indexFile))
|
|
12955
13006
|
continue;
|
|
12956
|
-
let content =
|
|
13007
|
+
let content = readFileSync13(indexFile, "utf-8");
|
|
12957
13008
|
const srcRel = relative10(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
12958
13009
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
12959
|
-
writeFileSync7(
|
|
13010
|
+
writeFileSync7(join21(devIndexDir, `${name}.vue.js`), content);
|
|
12960
13011
|
}
|
|
12961
13012
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
12962
13013
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -13004,7 +13055,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
13004
13055
|
}
|
|
13005
13056
|
return result;
|
|
13006
13057
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
13007
|
-
let content =
|
|
13058
|
+
let content = readFileSync13(outputPath, "utf-8");
|
|
13008
13059
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
13009
13060
|
const useNames = [];
|
|
13010
13061
|
let match;
|
|
@@ -13054,7 +13105,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13054
13105
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
13055
13106
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
13056
13107
|
for (const outputPath of outputPaths) {
|
|
13057
|
-
let content =
|
|
13108
|
+
let content = readFileSync13(outputPath, "utf-8");
|
|
13058
13109
|
let changed = false;
|
|
13059
13110
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
13060
13111
|
const targetName = basename8(relPath);
|
|
@@ -13173,10 +13224,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13173
13224
|
restoreTracePhase();
|
|
13174
13225
|
return;
|
|
13175
13226
|
}
|
|
13176
|
-
const traceDir =
|
|
13227
|
+
const traceDir = join21(buildPath2, ".absolute-trace");
|
|
13177
13228
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
13178
13229
|
mkdirSync10(traceDir, { recursive: true });
|
|
13179
|
-
writeFileSync7(
|
|
13230
|
+
writeFileSync7(join21(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
13180
13231
|
events: traceEvents,
|
|
13181
13232
|
frameworks: traceFrameworkNames,
|
|
13182
13233
|
generatedAt: new Date().toISOString(),
|
|
@@ -13206,14 +13257,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13206
13257
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
13207
13258
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
13208
13259
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
13209
|
-
const reactIndexesPath = reactDir &&
|
|
13210
|
-
const reactPagesPath = reactDir &&
|
|
13211
|
-
const htmlPagesPath = htmlDir &&
|
|
13212
|
-
const htmlScriptsPath = htmlDir &&
|
|
13213
|
-
const sveltePagesPath = svelteDir &&
|
|
13214
|
-
const vuePagesPath = vueDir &&
|
|
13215
|
-
const htmxPagesPath = htmxDir &&
|
|
13216
|
-
const angularPagesPath = angularDir &&
|
|
13260
|
+
const reactIndexesPath = reactDir && join21(reactDir, "generated", "indexes");
|
|
13261
|
+
const reactPagesPath = reactDir && join21(reactDir, "pages");
|
|
13262
|
+
const htmlPagesPath = htmlDir && join21(htmlDir, "pages");
|
|
13263
|
+
const htmlScriptsPath = htmlDir && join21(htmlDir, "scripts");
|
|
13264
|
+
const sveltePagesPath = svelteDir && join21(svelteDir, "pages");
|
|
13265
|
+
const vuePagesPath = vueDir && join21(vueDir, "pages");
|
|
13266
|
+
const htmxPagesPath = htmxDir && join21(htmxDir, "pages");
|
|
13267
|
+
const angularPagesPath = angularDir && join21(angularDir, "pages");
|
|
13217
13268
|
const frontends = [
|
|
13218
13269
|
reactDir,
|
|
13219
13270
|
htmlDir,
|
|
@@ -13251,12 +13302,12 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13251
13302
|
if (svelteDir)
|
|
13252
13303
|
serverDirMap.push({
|
|
13253
13304
|
dir: svelteDir,
|
|
13254
|
-
subdir:
|
|
13305
|
+
subdir: join21("generated", "server")
|
|
13255
13306
|
});
|
|
13256
13307
|
if (vueDir)
|
|
13257
13308
|
serverDirMap.push({
|
|
13258
13309
|
dir: vueDir,
|
|
13259
|
-
subdir:
|
|
13310
|
+
subdir: join21("generated", "server")
|
|
13260
13311
|
});
|
|
13261
13312
|
if (angularDir)
|
|
13262
13313
|
serverDirMap.push({ dir: angularDir, subdir: "generated" });
|
|
@@ -13266,8 +13317,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13266
13317
|
const [firstEntry] = serverDirMap;
|
|
13267
13318
|
if (!firstEntry)
|
|
13268
13319
|
throw new Error("Expected at least one server directory entry");
|
|
13269
|
-
serverRoot =
|
|
13270
|
-
serverOutDir =
|
|
13320
|
+
serverRoot = join21(firstEntry.dir, firstEntry.subdir);
|
|
13321
|
+
serverOutDir = join21(buildPath, basename8(firstEntry.dir));
|
|
13271
13322
|
} else if (serverDirMap.length > 1) {
|
|
13272
13323
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
13273
13324
|
serverOutDir = buildPath;
|
|
@@ -13295,7 +13346,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13295
13346
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
13296
13347
|
}
|
|
13297
13348
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
13298
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
13349
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join21(buildPath, "assets"), {
|
|
13299
13350
|
force: true,
|
|
13300
13351
|
recursive: true
|
|
13301
13352
|
}));
|
|
@@ -13344,7 +13395,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13344
13395
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
13345
13396
|
if (entry.startsWith(resolve21(reactIndexesPath))) {
|
|
13346
13397
|
const pageName = basename8(entry, ".tsx");
|
|
13347
|
-
return
|
|
13398
|
+
return join21(reactPagesPath, `${pageName}.tsx`);
|
|
13348
13399
|
}
|
|
13349
13400
|
return null;
|
|
13350
13401
|
}) : allReactEntries;
|
|
@@ -13441,7 +13492,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13441
13492
|
const compileReactConventions = async () => {
|
|
13442
13493
|
if (reactConventionSources.length === 0)
|
|
13443
13494
|
return emptyStringArray;
|
|
13444
|
-
const destDir =
|
|
13495
|
+
const destDir = join21(buildPath, "conventions", "react");
|
|
13445
13496
|
rmSync2(destDir, { force: true, recursive: true });
|
|
13446
13497
|
mkdirSync10(destDir, { recursive: true });
|
|
13447
13498
|
const destPaths = [];
|
|
@@ -13485,7 +13536,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13485
13536
|
angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
|
|
13486
13537
|
]);
|
|
13487
13538
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
13488
|
-
const destDir =
|
|
13539
|
+
const destDir = join21(buildPath, "conventions", framework);
|
|
13489
13540
|
rmSync2(destDir, { force: true, recursive: true });
|
|
13490
13541
|
mkdirSync10(destDir, { recursive: true });
|
|
13491
13542
|
const destPaths = [];
|
|
@@ -13558,7 +13609,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13558
13609
|
}
|
|
13559
13610
|
})) : {
|
|
13560
13611
|
entries: [],
|
|
13561
|
-
generatedRoot:
|
|
13612
|
+
generatedRoot: join21(buildPath, "_island_entries")
|
|
13562
13613
|
};
|
|
13563
13614
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
13564
13615
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -13594,7 +13645,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13594
13645
|
return {};
|
|
13595
13646
|
}
|
|
13596
13647
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
13597
|
-
const refreshEntry =
|
|
13648
|
+
const refreshEntry = join21(reactIndexesPath, "_refresh.tsx");
|
|
13598
13649
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
13599
13650
|
reactClientEntryPoints.push(refreshEntry);
|
|
13600
13651
|
}
|
|
@@ -13664,19 +13715,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13664
13715
|
throw: false
|
|
13665
13716
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
13666
13717
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
13667
|
-
rmSync2(
|
|
13718
|
+
rmSync2(join21(buildPath, "react", "generated", "indexes"), {
|
|
13668
13719
|
force: true,
|
|
13669
13720
|
recursive: true
|
|
13670
13721
|
});
|
|
13671
13722
|
}
|
|
13672
13723
|
if (angularDir && angularClientPaths.length > 0) {
|
|
13673
|
-
rmSync2(
|
|
13724
|
+
rmSync2(join21(buildPath, "angular", "indexes"), {
|
|
13674
13725
|
force: true,
|
|
13675
13726
|
recursive: true
|
|
13676
13727
|
});
|
|
13677
13728
|
}
|
|
13678
13729
|
if (islandClientEntryPoints.length > 0) {
|
|
13679
|
-
rmSync2(
|
|
13730
|
+
rmSync2(join21(buildPath, "islands"), {
|
|
13680
13731
|
force: true,
|
|
13681
13732
|
recursive: true
|
|
13682
13733
|
});
|
|
@@ -13742,7 +13793,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13742
13793
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild6(mergeBunBuildConfig({
|
|
13743
13794
|
entrypoints: globalCssEntries,
|
|
13744
13795
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
13745
|
-
outdir: stylesDir ?
|
|
13796
|
+
outdir: stylesDir ? join21(buildPath, basename8(stylesDir)) : buildPath,
|
|
13746
13797
|
plugins: [stylePreprocessorPlugin2],
|
|
13747
13798
|
root: stylesDir || clientRoot,
|
|
13748
13799
|
target: "browser",
|
|
@@ -13751,7 +13802,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13751
13802
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild6(mergeBunBuildConfig({
|
|
13752
13803
|
entrypoints: vueCssPaths,
|
|
13753
13804
|
naming: `[name].[hash].[ext]`,
|
|
13754
|
-
outdir:
|
|
13805
|
+
outdir: join21(buildPath, assetsPath ? basename8(assetsPath) : "assets", "css"),
|
|
13755
13806
|
target: "browser",
|
|
13756
13807
|
throw: false
|
|
13757
13808
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -13873,7 +13924,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13873
13924
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
13874
13925
|
if (!hmrClientBundle)
|
|
13875
13926
|
return;
|
|
13876
|
-
let html =
|
|
13927
|
+
let html = readFileSync13(filePath, "utf-8");
|
|
13877
13928
|
if (html.includes("data-hmr-client"))
|
|
13878
13929
|
return;
|
|
13879
13930
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -13884,7 +13935,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13884
13935
|
const processHtmlPages = async () => {
|
|
13885
13936
|
if (!(htmlDir && htmlPagesPath))
|
|
13886
13937
|
return;
|
|
13887
|
-
const outputHtmlPages = isSingle ?
|
|
13938
|
+
const outputHtmlPages = isSingle ? join21(buildPath, "pages") : join21(buildPath, basename8(htmlDir), "pages");
|
|
13888
13939
|
mkdirSync10(outputHtmlPages, { recursive: true });
|
|
13889
13940
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
13890
13941
|
force: true,
|
|
@@ -13906,14 +13957,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13906
13957
|
const processHtmxPages = async () => {
|
|
13907
13958
|
if (!(htmxDir && htmxPagesPath))
|
|
13908
13959
|
return;
|
|
13909
|
-
const outputHtmxPages = isSingle ?
|
|
13960
|
+
const outputHtmxPages = isSingle ? join21(buildPath, "pages") : join21(buildPath, basename8(htmxDir), "pages");
|
|
13910
13961
|
mkdirSync10(outputHtmxPages, { recursive: true });
|
|
13911
13962
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
13912
13963
|
force: true,
|
|
13913
13964
|
recursive: true
|
|
13914
13965
|
});
|
|
13915
13966
|
if (shouldCopyHtmx) {
|
|
13916
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
13967
|
+
const htmxDestDir = isSingle ? buildPath : join21(buildPath, basename8(htmxDir));
|
|
13917
13968
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
13918
13969
|
}
|
|
13919
13970
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -13974,9 +14025,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13974
14025
|
writeBuildTrace(buildPath);
|
|
13975
14026
|
return { conventions: conventionsMap, manifest };
|
|
13976
14027
|
}
|
|
13977
|
-
writeFileSync7(
|
|
14028
|
+
writeFileSync7(join21(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
13978
14029
|
if (Object.keys(conventionsMap).length > 0) {
|
|
13979
|
-
writeFileSync7(
|
|
14030
|
+
writeFileSync7(join21(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
13980
14031
|
}
|
|
13981
14032
|
writeBuildTrace(buildPath);
|
|
13982
14033
|
if (tailwind && mode === "production") {
|
|
@@ -14065,7 +14116,7 @@ var init_build = __esm(() => {
|
|
|
14065
14116
|
});
|
|
14066
14117
|
|
|
14067
14118
|
// src/dev/dependencyGraph.ts
|
|
14068
|
-
import { existsSync as
|
|
14119
|
+
import { existsSync as existsSync20, readFileSync as readFileSync14 } from "fs";
|
|
14069
14120
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
14070
14121
|
import { resolve as resolve22 } from "path";
|
|
14071
14122
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -14095,10 +14146,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14095
14146
|
];
|
|
14096
14147
|
for (const ext of extensions) {
|
|
14097
14148
|
const withExt = normalized + ext;
|
|
14098
|
-
if (
|
|
14149
|
+
if (existsSync20(withExt))
|
|
14099
14150
|
return withExt;
|
|
14100
14151
|
}
|
|
14101
|
-
if (
|
|
14152
|
+
if (existsSync20(normalized))
|
|
14102
14153
|
return normalized;
|
|
14103
14154
|
return null;
|
|
14104
14155
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -14113,7 +14164,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14113
14164
|
}
|
|
14114
14165
|
}, addFileToGraph = (graph, filePath) => {
|
|
14115
14166
|
const normalizedPath = resolve22(filePath);
|
|
14116
|
-
if (!
|
|
14167
|
+
if (!existsSync20(normalizedPath))
|
|
14117
14168
|
return;
|
|
14118
14169
|
const dependencies = extractDependencies(normalizedPath);
|
|
14119
14170
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -14129,7 +14180,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14129
14180
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
14130
14181
|
const processedFiles = new Set;
|
|
14131
14182
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
14132
|
-
const resolvedDirs = directories.map((dir) => resolve22(dir)).filter((dir) =>
|
|
14183
|
+
const resolvedDirs = directories.map((dir) => resolve22(dir)).filter((dir) => existsSync20(dir));
|
|
14133
14184
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
14134
14185
|
for (const file4 of allFiles) {
|
|
14135
14186
|
const fullPath = resolve22(file4);
|
|
@@ -14226,15 +14277,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14226
14277
|
const lowerPath = filePath.toLowerCase();
|
|
14227
14278
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
14228
14279
|
if (loader === "html") {
|
|
14229
|
-
const content =
|
|
14280
|
+
const content = readFileSync14(filePath, "utf-8");
|
|
14230
14281
|
return extractHtmlDependencies(filePath, content);
|
|
14231
14282
|
}
|
|
14232
14283
|
if (loader === "tsx" || loader === "js") {
|
|
14233
|
-
const content =
|
|
14284
|
+
const content = readFileSync14(filePath, "utf-8");
|
|
14234
14285
|
return extractJsDependencies(filePath, content, loader);
|
|
14235
14286
|
}
|
|
14236
14287
|
if (isSvelteOrVue) {
|
|
14237
|
-
const content =
|
|
14288
|
+
const content = readFileSync14(filePath, "utf-8");
|
|
14238
14289
|
return extractSvelteVueDependencies(filePath, content);
|
|
14239
14290
|
}
|
|
14240
14291
|
return [];
|
|
@@ -14522,8 +14573,8 @@ var init_pathUtils = __esm(() => {
|
|
|
14522
14573
|
|
|
14523
14574
|
// src/dev/fileWatcher.ts
|
|
14524
14575
|
import { watch } from "fs";
|
|
14525
|
-
import { existsSync as
|
|
14526
|
-
import { join as
|
|
14576
|
+
import { existsSync as existsSync21 } from "fs";
|
|
14577
|
+
import { join as join22, resolve as resolve24 } from "path";
|
|
14527
14578
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
14528
14579
|
try {
|
|
14529
14580
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -14550,16 +14601,16 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
14550
14601
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
14551
14602
|
return;
|
|
14552
14603
|
}
|
|
14553
|
-
const fullPath =
|
|
14604
|
+
const fullPath = join22(absolutePath, filename).replace(/\\/g, "/");
|
|
14554
14605
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
14555
14606
|
return;
|
|
14556
14607
|
}
|
|
14557
|
-
if (event === "rename" && !
|
|
14608
|
+
if (event === "rename" && !existsSync21(fullPath)) {
|
|
14558
14609
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
14559
14610
|
onFileChange(fullPath);
|
|
14560
14611
|
return;
|
|
14561
14612
|
}
|
|
14562
|
-
if (
|
|
14613
|
+
if (existsSync21(fullPath)) {
|
|
14563
14614
|
onFileChange(fullPath);
|
|
14564
14615
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
14565
14616
|
}
|
|
@@ -14569,7 +14620,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
14569
14620
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
14570
14621
|
paths.forEach((path) => {
|
|
14571
14622
|
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
14572
|
-
if (!
|
|
14623
|
+
if (!existsSync21(absolutePath)) {
|
|
14573
14624
|
return;
|
|
14574
14625
|
}
|
|
14575
14626
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -14580,7 +14631,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
14580
14631
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
14581
14632
|
watchPaths.forEach((path) => {
|
|
14582
14633
|
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
14583
|
-
if (!
|
|
14634
|
+
if (!existsSync21(absolutePath)) {
|
|
14584
14635
|
return;
|
|
14585
14636
|
}
|
|
14586
14637
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -14698,10 +14749,10 @@ var init_assetStore = __esm(() => {
|
|
|
14698
14749
|
});
|
|
14699
14750
|
|
|
14700
14751
|
// src/dev/fileHashTracker.ts
|
|
14701
|
-
import { readFileSync as
|
|
14752
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
14702
14753
|
var computeFileHash = (filePath) => {
|
|
14703
14754
|
try {
|
|
14704
|
-
const fileContent =
|
|
14755
|
+
const fileContent = readFileSync15(filePath);
|
|
14705
14756
|
return Number(Bun.hash(fileContent));
|
|
14706
14757
|
} catch {
|
|
14707
14758
|
return UNFOUND_INDEX;
|
|
@@ -15010,7 +15061,7 @@ __export(exports_moduleServer, {
|
|
|
15010
15061
|
createModuleServer: () => createModuleServer,
|
|
15011
15062
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
15012
15063
|
});
|
|
15013
|
-
import { existsSync as
|
|
15064
|
+
import { existsSync as existsSync22, readFileSync as readFileSync16, statSync as statSync2 } from "fs";
|
|
15014
15065
|
import { basename as basename10, dirname as dirname14, extname as extname6, resolve as resolve28, relative as relative11 } from "path";
|
|
15015
15066
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
15016
15067
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
@@ -15031,7 +15082,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
15031
15082
|
${stubs}
|
|
15032
15083
|
`;
|
|
15033
15084
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
15034
|
-
const found = extensions.find((ext) =>
|
|
15085
|
+
const found = extensions.find((ext) => existsSync22(resolve28(projectRoot, srcPath + ext)));
|
|
15035
15086
|
return found ? srcPath + found : srcPath;
|
|
15036
15087
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
15037
15088
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -15143,7 +15194,7 @@ ${stubs}
|
|
|
15143
15194
|
`)}
|
|
15144
15195
|
${code}`;
|
|
15145
15196
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
15146
|
-
const raw =
|
|
15197
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15147
15198
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
15148
15199
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
15149
15200
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -15159,7 +15210,7 @@ ${transpiled}`;
|
|
|
15159
15210
|
transpiled += buildIslandMetadataExports(raw);
|
|
15160
15211
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
15161
15212
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
15162
|
-
const raw =
|
|
15213
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15163
15214
|
const ext = extname6(filePath);
|
|
15164
15215
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
15165
15216
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -15325,7 +15376,7 @@ ${code}`;
|
|
|
15325
15376
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
15326
15377
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
15327
15378
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
15328
|
-
const raw =
|
|
15379
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15329
15380
|
if (!svelteCompiler) {
|
|
15330
15381
|
svelteCompiler = await import("svelte/compiler");
|
|
15331
15382
|
}
|
|
@@ -15385,7 +15436,7 @@ export default __script__;`;
|
|
|
15385
15436
|
return `${cssInjection}
|
|
15386
15437
|
${code}`;
|
|
15387
15438
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
15388
|
-
const raw =
|
|
15439
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15389
15440
|
if (!vueCompiler) {
|
|
15390
15441
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
15391
15442
|
}
|
|
@@ -15421,11 +15472,11 @@ ${code}`;
|
|
|
15421
15472
|
`);
|
|
15422
15473
|
return result;
|
|
15423
15474
|
}, resolveSvelteModulePath = (path) => {
|
|
15424
|
-
if (
|
|
15475
|
+
if (existsSync22(path))
|
|
15425
15476
|
return path;
|
|
15426
|
-
if (
|
|
15477
|
+
if (existsSync22(`${path}.ts`))
|
|
15427
15478
|
return `${path}.ts`;
|
|
15428
|
-
if (
|
|
15479
|
+
if (existsSync22(`${path}.js`))
|
|
15429
15480
|
return `${path}.js`;
|
|
15430
15481
|
return path;
|
|
15431
15482
|
}, jsResponse = (body) => {
|
|
@@ -15438,7 +15489,7 @@ ${code}`;
|
|
|
15438
15489
|
}
|
|
15439
15490
|
});
|
|
15440
15491
|
}, handleCssRequest = (filePath) => {
|
|
15441
|
-
const raw =
|
|
15492
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15442
15493
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
15443
15494
|
return [
|
|
15444
15495
|
`const style = document.createElement('style');`,
|
|
@@ -15571,7 +15622,7 @@ export default {};
|
|
|
15571
15622
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
15572
15623
|
if (ext)
|
|
15573
15624
|
return { ext, filePath };
|
|
15574
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
15625
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync22(filePath + candidate));
|
|
15575
15626
|
if (!found)
|
|
15576
15627
|
return { ext, filePath };
|
|
15577
15628
|
const resolved = filePath + found;
|
|
@@ -15776,7 +15827,7 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
15776
15827
|
var init_simpleHTMXHMR = () => {};
|
|
15777
15828
|
|
|
15778
15829
|
// src/dev/rebuildTrigger.ts
|
|
15779
|
-
import { existsSync as
|
|
15830
|
+
import { existsSync as existsSync23 } from "fs";
|
|
15780
15831
|
import { basename as basename11, dirname as dirname15, relative as relative12, resolve as resolve31 } from "path";
|
|
15781
15832
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
|
|
15782
15833
|
if (!config.tailwind)
|
|
@@ -15865,7 +15916,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
15865
15916
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
15866
15917
|
}
|
|
15867
15918
|
return { ...parsed, framework: detectedFw };
|
|
15868
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
15919
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync23(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
15869
15920
|
state.fileHashes.delete(filePathInSet);
|
|
15870
15921
|
try {
|
|
15871
15922
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
@@ -15883,7 +15934,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
15883
15934
|
if (!dependents || dependents.size === 0) {
|
|
15884
15935
|
return;
|
|
15885
15936
|
}
|
|
15886
|
-
const dependentFiles = Array.from(dependents).filter((file4) =>
|
|
15937
|
+
const dependentFiles = Array.from(dependents).filter((file4) => existsSync23(file4));
|
|
15887
15938
|
if (dependentFiles.length === 0) {
|
|
15888
15939
|
return;
|
|
15889
15940
|
}
|
|
@@ -15899,7 +15950,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
15899
15950
|
try {
|
|
15900
15951
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
15901
15952
|
affectedFiles.forEach((affectedFile) => {
|
|
15902
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
15953
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync23(affectedFile)) {
|
|
15903
15954
|
validFiles.push(affectedFile);
|
|
15904
15955
|
processedFiles.add(affectedFile);
|
|
15905
15956
|
}
|
|
@@ -15924,7 +15975,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
15924
15975
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
15925
15976
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
15926
15977
|
filePathSet.forEach((filePathInSet) => {
|
|
15927
|
-
if (!
|
|
15978
|
+
if (!existsSync23(filePathInSet)) {
|
|
15928
15979
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
15929
15980
|
return;
|
|
15930
15981
|
}
|
|
@@ -16043,7 +16094,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16043
16094
|
return componentFile;
|
|
16044
16095
|
}
|
|
16045
16096
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
16046
|
-
if (
|
|
16097
|
+
if (existsSync23(tsCounterpart)) {
|
|
16047
16098
|
return tsCounterpart;
|
|
16048
16099
|
}
|
|
16049
16100
|
if (!graph)
|
|
@@ -16189,7 +16240,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16189
16240
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
16190
16241
|
const pageName = basename11(normalized, ".tsx");
|
|
16191
16242
|
const indexPath = resolve31(reactIndexesPath, `${pageName}.tsx`);
|
|
16192
|
-
if (!
|
|
16243
|
+
if (!existsSync23(indexPath)) {
|
|
16193
16244
|
return;
|
|
16194
16245
|
}
|
|
16195
16246
|
return indexPath;
|
|
@@ -16201,7 +16252,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16201
16252
|
}
|
|
16202
16253
|
const pageName = basename11(dep, ".tsx");
|
|
16203
16254
|
const indexPath = resolve31(reactIndexesPath, `${pageName}.tsx`);
|
|
16204
|
-
if (
|
|
16255
|
+
if (existsSync23(indexPath) && !reactEntries.includes(indexPath)) {
|
|
16205
16256
|
reactEntries.push(indexPath);
|
|
16206
16257
|
}
|
|
16207
16258
|
});
|
|
@@ -17377,7 +17428,7 @@ __export(exports_buildDepVendor, {
|
|
|
17377
17428
|
buildDepVendor: () => buildDepVendor
|
|
17378
17429
|
});
|
|
17379
17430
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
17380
|
-
import { join as
|
|
17431
|
+
import { join as join23 } from "path";
|
|
17381
17432
|
import { rm as rm8 } from "fs/promises";
|
|
17382
17433
|
var {build: bunBuild7, Glob: Glob9 } = globalThis.Bun;
|
|
17383
17434
|
var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_"), isResolvable4 = (specifier) => {
|
|
@@ -17428,7 +17479,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17428
17479
|
framework: Array.from(framework).filter(isResolvable4)
|
|
17429
17480
|
};
|
|
17430
17481
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
17431
|
-
const { readFileSync:
|
|
17482
|
+
const { readFileSync: readFileSync17 } = await import("fs");
|
|
17432
17483
|
const transpiler4 = new Bun.Transpiler({ loader: "js" });
|
|
17433
17484
|
const newSpecs = new Set;
|
|
17434
17485
|
for (const spec of specs) {
|
|
@@ -17443,7 +17494,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17443
17494
|
}
|
|
17444
17495
|
let content;
|
|
17445
17496
|
try {
|
|
17446
|
-
content =
|
|
17497
|
+
content = readFileSync17(resolved, "utf-8");
|
|
17447
17498
|
} catch {
|
|
17448
17499
|
continue;
|
|
17449
17500
|
}
|
|
@@ -17472,7 +17523,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17472
17523
|
}, buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
17473
17524
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
17474
17525
|
const safeName = toSafeFileName5(specifier);
|
|
17475
|
-
const entryPath =
|
|
17526
|
+
const entryPath = join23(tmpDir, `${safeName}.ts`);
|
|
17476
17527
|
await Bun.write(entryPath, generateVendorEntrySource(specifier));
|
|
17477
17528
|
return entryPath;
|
|
17478
17529
|
}));
|
|
@@ -17491,9 +17542,9 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17491
17542
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
17492
17543
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
17493
17544
|
return {};
|
|
17494
|
-
const vendorDir =
|
|
17545
|
+
const vendorDir = join23(buildDir, "vendor");
|
|
17495
17546
|
mkdirSync11(vendorDir, { recursive: true });
|
|
17496
|
-
const tmpDir =
|
|
17547
|
+
const tmpDir = join23(buildDir, "_dep_vendor_tmp");
|
|
17497
17548
|
mkdirSync11(tmpDir, { recursive: true });
|
|
17498
17549
|
const allSpecs = new Set(initialSpecs);
|
|
17499
17550
|
const alreadyScanned = new Set;
|
|
@@ -18032,17 +18083,17 @@ __export(exports_devtoolsJson, {
|
|
|
18032
18083
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
18033
18084
|
devtoolsJson: () => devtoolsJson
|
|
18034
18085
|
});
|
|
18035
|
-
import { existsSync as
|
|
18036
|
-
import { dirname as dirname16, join as
|
|
18086
|
+
import { existsSync as existsSync24, mkdirSync as mkdirSync12, readFileSync as readFileSync17, writeFileSync as writeFileSync8 } from "fs";
|
|
18087
|
+
import { dirname as dirname16, join as join24, resolve as resolve33 } from "path";
|
|
18037
18088
|
import { Elysia as Elysia3 } from "elysia";
|
|
18038
18089
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
18039
18090
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
18040
18091
|
return uuid;
|
|
18041
|
-
}, 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) => resolve33(uuidCachePath ??
|
|
18042
|
-
if (!
|
|
18092
|
+
}, 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) => resolve33(uuidCachePath ?? join24(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
18093
|
+
if (!existsSync24(cachePath))
|
|
18043
18094
|
return null;
|
|
18044
18095
|
try {
|
|
18045
|
-
const value =
|
|
18096
|
+
const value = readFileSync17(cachePath, "utf-8").trim();
|
|
18046
18097
|
return isUuidV4(value) ? value : null;
|
|
18047
18098
|
} catch {
|
|
18048
18099
|
return null;
|
|
@@ -18077,11 +18128,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
18077
18128
|
if (process.env.WSL_DISTRO_NAME) {
|
|
18078
18129
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
18079
18130
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
18080
|
-
return
|
|
18131
|
+
return join24("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
18081
18132
|
}
|
|
18082
18133
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
18083
18134
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
18084
|
-
return
|
|
18135
|
+
return join24("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
18085
18136
|
}
|
|
18086
18137
|
return root;
|
|
18087
18138
|
};
|
|
@@ -18092,13 +18143,13 @@ var exports_imageOptimizer = {};
|
|
|
18092
18143
|
__export(exports_imageOptimizer, {
|
|
18093
18144
|
imageOptimizer: () => imageOptimizer
|
|
18094
18145
|
});
|
|
18095
|
-
import { existsSync as
|
|
18146
|
+
import { existsSync as existsSync25 } from "fs";
|
|
18096
18147
|
import { resolve as resolve34 } from "path";
|
|
18097
18148
|
import { Elysia as Elysia4 } from "elysia";
|
|
18098
18149
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
18099
18150
|
try {
|
|
18100
18151
|
const resolved = validateSafePath(path, baseDir);
|
|
18101
|
-
if (
|
|
18152
|
+
if (existsSync25(resolved))
|
|
18102
18153
|
return resolved;
|
|
18103
18154
|
return null;
|
|
18104
18155
|
} catch {
|
|
@@ -18397,15 +18448,15 @@ __export(exports_prerender, {
|
|
|
18397
18448
|
prerender: () => prerender,
|
|
18398
18449
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
18399
18450
|
});
|
|
18400
|
-
import { mkdirSync as mkdirSync13, readFileSync as
|
|
18401
|
-
import { join as
|
|
18451
|
+
import { mkdirSync as mkdirSync13, readFileSync as readFileSync18 } from "fs";
|
|
18452
|
+
import { join as join25 } from "path";
|
|
18402
18453
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
18403
18454
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
18404
18455
|
await Bun.write(metaPath, String(Date.now()));
|
|
18405
18456
|
}, readTimestamp = (htmlPath) => {
|
|
18406
18457
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
18407
18458
|
try {
|
|
18408
|
-
const content =
|
|
18459
|
+
const content = readFileSync18(metaPath, "utf-8");
|
|
18409
18460
|
return Number(content) || 0;
|
|
18410
18461
|
} catch {
|
|
18411
18462
|
return 0;
|
|
@@ -18463,7 +18514,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
18463
18514
|
return false;
|
|
18464
18515
|
const html = await res.text();
|
|
18465
18516
|
const fileName = routeToFilename(route);
|
|
18466
|
-
const filePath =
|
|
18517
|
+
const filePath = join25(prerenderDir, fileName);
|
|
18467
18518
|
await Bun.write(filePath, html);
|
|
18468
18519
|
await writeTimestamp(filePath);
|
|
18469
18520
|
return true;
|
|
@@ -18487,13 +18538,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
18487
18538
|
}
|
|
18488
18539
|
const html = await res.text();
|
|
18489
18540
|
const fileName = routeToFilename(route);
|
|
18490
|
-
const filePath =
|
|
18541
|
+
const filePath = join25(prerenderDir, fileName);
|
|
18491
18542
|
await Bun.write(filePath, html);
|
|
18492
18543
|
await writeTimestamp(filePath);
|
|
18493
18544
|
result.routes.set(route, filePath);
|
|
18494
18545
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
18495
18546
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
18496
|
-
const prerenderDir =
|
|
18547
|
+
const prerenderDir = join25(outDir, "_prerendered");
|
|
18497
18548
|
mkdirSync13(prerenderDir, { recursive: true });
|
|
18498
18549
|
const baseUrl = `http://localhost:${port}`;
|
|
18499
18550
|
let routes;
|
|
@@ -19022,8 +19073,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
19022
19073
|
});
|
|
19023
19074
|
};
|
|
19024
19075
|
// src/core/prepare.ts
|
|
19025
|
-
import { existsSync as
|
|
19026
|
-
import { basename as basename12, join as
|
|
19076
|
+
import { existsSync as existsSync26, readdirSync as readdirSync2, readFileSync as readFileSync19 } from "fs";
|
|
19077
|
+
import { basename as basename12, join as join26, relative as relative13, resolve as resolve35 } from "path";
|
|
19027
19078
|
import { Elysia as Elysia5 } from "elysia";
|
|
19028
19079
|
|
|
19029
19080
|
// src/utils/loadConfig.ts
|
|
@@ -19210,7 +19261,7 @@ var hasErrorConvention = (framework) => {
|
|
|
19210
19261
|
var setConventions = (map) => {
|
|
19211
19262
|
Reflect.set(globalThis, CONVENTIONS_KEY, map);
|
|
19212
19263
|
};
|
|
19213
|
-
var isDev = () =>
|
|
19264
|
+
var isDev = () => false;
|
|
19214
19265
|
var buildErrorProps = (error) => {
|
|
19215
19266
|
const message = error instanceof Error ? error.message : String(error);
|
|
19216
19267
|
const stack = isDev() && error instanceof Error ? error.stack : undefined;
|
|
@@ -19478,7 +19529,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
19478
19529
|
if (!fileName)
|
|
19479
19530
|
continue;
|
|
19480
19531
|
const srcPath = resolve35(devIndexDir, fileName);
|
|
19481
|
-
if (!
|
|
19532
|
+
if (!existsSync26(srcPath))
|
|
19482
19533
|
continue;
|
|
19483
19534
|
const rel = relative13(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
19484
19535
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
@@ -19586,7 +19637,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
19586
19637
|
};
|
|
19587
19638
|
var loadPrerenderMap = (prerenderDir) => {
|
|
19588
19639
|
const map = new Map;
|
|
19589
|
-
if (!
|
|
19640
|
+
if (!existsSync26(prerenderDir))
|
|
19590
19641
|
return map;
|
|
19591
19642
|
let entries;
|
|
19592
19643
|
try {
|
|
@@ -19599,7 +19650,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
19599
19650
|
continue;
|
|
19600
19651
|
const name = basename12(entry, ".html");
|
|
19601
19652
|
const route = name === "index" ? "/" : `/${name}`;
|
|
19602
|
-
map.set(route,
|
|
19653
|
+
map.set(route, join26(prerenderDir, entry));
|
|
19603
19654
|
}
|
|
19604
19655
|
return map;
|
|
19605
19656
|
};
|
|
@@ -19640,7 +19691,7 @@ var prepare = async (configOrPath) => {
|
|
|
19640
19691
|
return result;
|
|
19641
19692
|
}
|
|
19642
19693
|
stepStartedAt = performance.now();
|
|
19643
|
-
const manifest = JSON.parse(
|
|
19694
|
+
const manifest = JSON.parse(readFileSync19(`${buildDir}/manifest.json`, "utf-8"));
|
|
19644
19695
|
setCurrentIslandManifest(manifest);
|
|
19645
19696
|
if (config.islands?.registry) {
|
|
19646
19697
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -19648,9 +19699,9 @@ var prepare = async (configOrPath) => {
|
|
|
19648
19699
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
19649
19700
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
19650
19701
|
stepStartedAt = performance.now();
|
|
19651
|
-
const conventionsPath =
|
|
19652
|
-
if (
|
|
19653
|
-
const conventions2 = JSON.parse(
|
|
19702
|
+
const conventionsPath = join26(buildDir, "conventions.json");
|
|
19703
|
+
if (existsSync26(conventionsPath)) {
|
|
19704
|
+
const conventions2 = JSON.parse(readFileSync19(conventionsPath, "utf-8"));
|
|
19654
19705
|
setConventions(conventions2);
|
|
19655
19706
|
}
|
|
19656
19707
|
recordStep("load production conventions", stepStartedAt);
|
|
@@ -19664,7 +19715,7 @@ var prepare = async (configOrPath) => {
|
|
|
19664
19715
|
});
|
|
19665
19716
|
recordStep("create static plugin", stepStartedAt);
|
|
19666
19717
|
stepStartedAt = performance.now();
|
|
19667
|
-
const prerenderDir =
|
|
19718
|
+
const prerenderDir = join26(buildDir, "_prerendered");
|
|
19668
19719
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
19669
19720
|
recordStep("load prerender map", stepStartedAt);
|
|
19670
19721
|
if (prerenderMap.size > 0) {
|
|
@@ -19722,18 +19773,18 @@ import { argv } from "process";
|
|
|
19722
19773
|
var {env: env4 } = globalThis.Bun;
|
|
19723
19774
|
|
|
19724
19775
|
// src/dev/devCert.ts
|
|
19725
|
-
import { existsSync as
|
|
19726
|
-
import { join as
|
|
19727
|
-
var CERT_DIR =
|
|
19728
|
-
var CERT_PATH =
|
|
19729
|
-
var KEY_PATH =
|
|
19776
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync14, readFileSync as readFileSync20, rmSync as rmSync3 } from "fs";
|
|
19777
|
+
import { join as join27 } from "path";
|
|
19778
|
+
var CERT_DIR = join27(process.cwd(), ".absolutejs");
|
|
19779
|
+
var CERT_PATH = join27(CERT_DIR, "cert.pem");
|
|
19780
|
+
var KEY_PATH = join27(CERT_DIR, "key.pem");
|
|
19730
19781
|
var CERT_VALIDITY_DAYS = 365;
|
|
19731
19782
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
19732
19783
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
19733
|
-
var certFilesExist = () =>
|
|
19784
|
+
var certFilesExist = () => existsSync27(CERT_PATH) && existsSync27(KEY_PATH);
|
|
19734
19785
|
var isCertExpired = () => {
|
|
19735
19786
|
try {
|
|
19736
|
-
const certPem =
|
|
19787
|
+
const certPem = readFileSync20(CERT_PATH, "utf-8");
|
|
19737
19788
|
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
19738
19789
|
stdin: new TextEncoder().encode(certPem)
|
|
19739
19790
|
});
|
|
@@ -19829,8 +19880,8 @@ var loadDevCert = () => {
|
|
|
19829
19880
|
return null;
|
|
19830
19881
|
try {
|
|
19831
19882
|
return {
|
|
19832
|
-
cert:
|
|
19833
|
-
key:
|
|
19883
|
+
cert: readFileSync20(paths.cert, "utf-8"),
|
|
19884
|
+
key: readFileSync20(paths.key, "utf-8")
|
|
19834
19885
|
};
|
|
19835
19886
|
} catch {
|
|
19836
19887
|
return null;
|
|
@@ -20058,7 +20109,7 @@ var jsonLd2 = (schema) => {
|
|
|
20058
20109
|
};
|
|
20059
20110
|
// src/utils/defineEnv.ts
|
|
20060
20111
|
var {env: bunEnv } = globalThis.Bun;
|
|
20061
|
-
import { existsSync as
|
|
20112
|
+
import { existsSync as existsSync28, readFileSync as readFileSync21 } from "fs";
|
|
20062
20113
|
import { resolve as resolve36 } from "path";
|
|
20063
20114
|
|
|
20064
20115
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
@@ -26095,18 +26146,18 @@ ${lines.join(`
|
|
|
26095
26146
|
var checkEnvFileSecurity = (properties) => {
|
|
26096
26147
|
const cwd2 = process.cwd();
|
|
26097
26148
|
const envPath = resolve36(cwd2, ".env");
|
|
26098
|
-
if (!
|
|
26149
|
+
if (!existsSync28(envPath))
|
|
26099
26150
|
return;
|
|
26100
26151
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
26101
26152
|
if (sensitiveKeys.length === 0)
|
|
26102
26153
|
return;
|
|
26103
|
-
const envContent =
|
|
26154
|
+
const envContent = readFileSync21(envPath, "utf-8");
|
|
26104
26155
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
26105
26156
|
if (presentKeys.length === 0)
|
|
26106
26157
|
return;
|
|
26107
26158
|
const gitignorePath = resolve36(cwd2, ".gitignore");
|
|
26108
|
-
if (
|
|
26109
|
-
const gitignore =
|
|
26159
|
+
if (existsSync28(gitignorePath)) {
|
|
26160
|
+
const gitignore = readFileSync21(gitignorePath, "utf-8");
|
|
26110
26161
|
if (gitignore.split(`
|
|
26111
26162
|
`).some((line) => line.trim() === ".env"))
|
|
26112
26163
|
return;
|
|
@@ -26344,5 +26395,5 @@ export {
|
|
|
26344
26395
|
ANGULAR_INIT_TIMEOUT_MS
|
|
26345
26396
|
};
|
|
26346
26397
|
|
|
26347
|
-
//# debugId=
|
|
26398
|
+
//# debugId=50595625A644F6FB64756E2164756E21
|
|
26348
26399
|
//# sourceMappingURL=index.js.map
|