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