@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/build.js
CHANGED
|
@@ -1718,9 +1718,9 @@ var init_streamingSlots = __esm(() => {
|
|
|
1718
1718
|
});
|
|
1719
1719
|
|
|
1720
1720
|
// src/angular/resolveAngularPackage.ts
|
|
1721
|
-
import { existsSync as existsSync2 } from "fs";
|
|
1722
|
-
import { resolve as resolve3 } from "path";
|
|
1723
|
-
var
|
|
1721
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
1722
|
+
import { join as join3, resolve as resolve3 } from "path";
|
|
1723
|
+
var resolveAngularPackageDir = (specifier) => {
|
|
1724
1724
|
const fromCompiledRuntime = process.env.ABSOLUTE_BUILD_DIR ? resolve3(process.env.ABSOLUTE_BUILD_DIR, "node_modules", specifier) : null;
|
|
1725
1725
|
if (fromCompiledRuntime && existsSync2(fromCompiledRuntime)) {
|
|
1726
1726
|
return fromCompiledRuntime;
|
|
@@ -1729,13 +1729,27 @@ var resolveAngularPackage = (specifier) => {
|
|
|
1729
1729
|
if (existsSync2(fromProject)) {
|
|
1730
1730
|
return fromProject;
|
|
1731
1731
|
}
|
|
1732
|
+
return null;
|
|
1733
|
+
}, resolvePackageEntry = (packageDir) => {
|
|
1734
|
+
try {
|
|
1735
|
+
const pkg = JSON.parse(readFileSync(join3(packageDir, "package.json"), "utf-8"));
|
|
1736
|
+
const rootExport = pkg.exports?.["."];
|
|
1737
|
+
const entry = (typeof rootExport === "string" ? rootExport : rootExport?.default) ?? pkg.module ?? pkg.main ?? "index.js";
|
|
1738
|
+
return join3(packageDir, entry);
|
|
1739
|
+
} catch {
|
|
1740
|
+
return packageDir;
|
|
1741
|
+
}
|
|
1742
|
+
}, resolveAngularPackage = (specifier) => {
|
|
1743
|
+
const packageDir = resolveAngularPackageDir(specifier);
|
|
1744
|
+
if (packageDir)
|
|
1745
|
+
return resolvePackageEntry(packageDir);
|
|
1732
1746
|
return specifier;
|
|
1733
1747
|
};
|
|
1734
1748
|
var init_resolveAngularPackage = () => {};
|
|
1735
1749
|
|
|
1736
1750
|
// src/angular/injectorPatch.ts
|
|
1737
|
-
import { existsSync as existsSync3, readFileSync, writeFileSync as writeFileSync2 } from "fs";
|
|
1738
|
-
import { dirname as dirname2, join as
|
|
1751
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
1752
|
+
import { dirname as dirname2, join as join4 } from "path";
|
|
1739
1753
|
var applyInjectorPatch = (chunkPath, content) => {
|
|
1740
1754
|
if (content.includes('Symbol.for("angular.currentInjector")')) {
|
|
1741
1755
|
return;
|
|
@@ -1771,16 +1785,16 @@ var applyInjectorPatch = (chunkPath, content) => {
|
|
|
1771
1785
|
}
|
|
1772
1786
|
writeFileSync2(chunkPath, patched, "utf-8");
|
|
1773
1787
|
}, resolveAngularCoreDir = () => {
|
|
1774
|
-
const resolved =
|
|
1775
|
-
if (existsSync3(
|
|
1788
|
+
const resolved = resolveAngularPackageDir("@angular/core");
|
|
1789
|
+
if (resolved && existsSync3(join4(resolved, "package.json"))) {
|
|
1776
1790
|
return resolved;
|
|
1777
1791
|
}
|
|
1778
1792
|
return dirname2(__require.resolve("@angular/core/package.json"));
|
|
1779
1793
|
}, patchAngularInjectorSingleton = () => {
|
|
1780
1794
|
try {
|
|
1781
1795
|
const coreDir = resolveAngularCoreDir();
|
|
1782
|
-
const chunkPath =
|
|
1783
|
-
const content =
|
|
1796
|
+
const chunkPath = join4(coreDir, "fesm2022", "_not_found-chunk.mjs");
|
|
1797
|
+
const content = readFileSync2(chunkPath, "utf-8");
|
|
1784
1798
|
applyInjectorPatch(chunkPath, content);
|
|
1785
1799
|
} catch {}
|
|
1786
1800
|
};
|
|
@@ -2392,8 +2406,8 @@ var init_islandSsr = __esm(() => {
|
|
|
2392
2406
|
});
|
|
2393
2407
|
|
|
2394
2408
|
// src/build/resolvePackageImport.ts
|
|
2395
|
-
import { resolve as resolve4, join as
|
|
2396
|
-
import { existsSync as existsSync4, readFileSync as
|
|
2409
|
+
import { resolve as resolve4, join as join5 } from "path";
|
|
2410
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
2397
2411
|
var resolveExportPath = (entry, conditions) => {
|
|
2398
2412
|
if (typeof entry === "string")
|
|
2399
2413
|
return entry;
|
|
@@ -2415,14 +2429,14 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
2415
2429
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
2416
2430
|
const exportKey = subpath ? `./${subpath}` : ".";
|
|
2417
2431
|
const currentPackageJsonPath = resolve4(process.cwd(), "package.json");
|
|
2418
|
-
const currentPackageJson = existsSync4(currentPackageJsonPath) ? JSON.parse(
|
|
2432
|
+
const currentPackageJson = existsSync4(currentPackageJsonPath) ? JSON.parse(readFileSync3(currentPackageJsonPath, "utf-8")) : null;
|
|
2419
2433
|
const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
|
|
2420
2434
|
const packageDir = currentPackageDir ?? resolve4(process.cwd(), "node_modules", packageName ?? "");
|
|
2421
|
-
const packageJsonPath =
|
|
2435
|
+
const packageJsonPath = join5(packageDir, "package.json");
|
|
2422
2436
|
if (!existsSync4(packageJsonPath))
|
|
2423
2437
|
return null;
|
|
2424
2438
|
try {
|
|
2425
|
-
const packageJson = currentPackageDir && currentPackageJson ? currentPackageJson : JSON.parse(
|
|
2439
|
+
const packageJson = currentPackageDir && currentPackageJson ? currentPackageJson : JSON.parse(readFileSync3(packageJsonPath, "utf-8"));
|
|
2426
2440
|
const { exports } = packageJson;
|
|
2427
2441
|
if (!exports)
|
|
2428
2442
|
return null;
|
|
@@ -2586,10 +2600,10 @@ __export(exports_stylePreprocessor, {
|
|
|
2586
2600
|
compileStyleFileIfNeededSync: () => compileStyleFileIfNeededSync,
|
|
2587
2601
|
compileStyleFileIfNeeded: () => compileStyleFileIfNeeded
|
|
2588
2602
|
});
|
|
2589
|
-
import { existsSync as existsSync5, readFileSync as
|
|
2603
|
+
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
|
|
2590
2604
|
import { readFile } from "fs/promises";
|
|
2591
2605
|
import { createRequire } from "module";
|
|
2592
|
-
import { dirname as dirname3, extname as extname3, isAbsolute, join as
|
|
2606
|
+
import { dirname as dirname3, extname as extname3, isAbsolute, join as join6, relative as relative3, resolve as resolve5 } from "path";
|
|
2593
2607
|
import { fileURLToPath } from "url";
|
|
2594
2608
|
var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
2595
2609
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
@@ -2626,7 +2640,7 @@ var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTE
|
|
|
2626
2640
|
return empty;
|
|
2627
2641
|
}
|
|
2628
2642
|
try {
|
|
2629
|
-
const parsed = JSON.parse(stripJsonComments(
|
|
2643
|
+
const parsed = JSON.parse(stripJsonComments(readFileSync4(tsconfigPath, "utf-8")));
|
|
2630
2644
|
const compilerOptions = parsed.compilerOptions ?? {};
|
|
2631
2645
|
const baseUrl = resolve5(cwd, compilerOptions.baseUrl ?? ".");
|
|
2632
2646
|
tsconfigAliasCache = {
|
|
@@ -2667,13 +2681,13 @@ var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTE
|
|
|
2667
2681
|
const ext = extname3(basePath);
|
|
2668
2682
|
const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
|
|
2669
2683
|
`${basePath}${extension}`,
|
|
2670
|
-
|
|
2684
|
+
join6(basePath, `index${extension}`)
|
|
2671
2685
|
]);
|
|
2672
2686
|
if (language === "scss" || language === "sass") {
|
|
2673
2687
|
return paths.flatMap((path) => {
|
|
2674
2688
|
const dir = dirname3(path);
|
|
2675
2689
|
const base = path.slice(dir.length + 1);
|
|
2676
|
-
return [path,
|
|
2690
|
+
return [path, join6(dir, `_${base}`)];
|
|
2677
2691
|
});
|
|
2678
2692
|
}
|
|
2679
2693
|
return paths;
|
|
@@ -2814,7 +2828,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2814
2828
|
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
2815
2829
|
return null;
|
|
2816
2830
|
return {
|
|
2817
|
-
contents: preprocessLoadedStyle(
|
|
2831
|
+
contents: preprocessLoadedStyle(readFileSync4(filePath, "utf-8"), filePath, entryFile, loadPaths, language, config),
|
|
2818
2832
|
syntax: filePath.endsWith(".sass") ? "indented" : "scss"
|
|
2819
2833
|
};
|
|
2820
2834
|
}
|
|
@@ -2975,7 +2989,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2975
2989
|
}
|
|
2976
2990
|
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2977
2991
|
}, compileStyleFileIfNeededSync = (filePath, config) => {
|
|
2978
|
-
const rawContents =
|
|
2992
|
+
const rawContents = readFileSync4(filePath, "utf-8");
|
|
2979
2993
|
const language = getStyleLanguage(filePath);
|
|
2980
2994
|
if (config?.postcss) {
|
|
2981
2995
|
throw new Error(`Unable to compile ${filePath}: PostCSS preprocessing is async-only.`);
|
|
@@ -3016,19 +3030,19 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
3016
3030
|
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
3017
3031
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
3018
3032
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
3019
|
-
requireFromCwd = createRequire(
|
|
3033
|
+
requireFromCwd = createRequire(join6(process.cwd(), "package.json"));
|
|
3020
3034
|
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
3021
3035
|
});
|
|
3022
3036
|
|
|
3023
3037
|
// src/core/svelteServerModule.ts
|
|
3024
3038
|
import { mkdir, readdir as readdir2 } from "fs/promises";
|
|
3025
|
-
import { basename as basename2, dirname as dirname4, extname as extname4, join as
|
|
3039
|
+
import { basename as basename2, dirname as dirname4, extname as extname4, join as join7, relative as relative4, resolve as resolve6 } from "path";
|
|
3026
3040
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
3027
3041
|
const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
|
|
3028
3042
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
3029
3043
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
3030
3044
|
for (const entry of entries) {
|
|
3031
|
-
const entryPath =
|
|
3045
|
+
const entryPath = join7(dir, entry.name);
|
|
3032
3046
|
if (entry.isDirectory())
|
|
3033
3047
|
stack.push(entryPath);
|
|
3034
3048
|
if (entry.isFile() && entry.name === targetFileName) {
|
|
@@ -3058,11 +3072,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3058
3072
|
if (cachedPath !== undefined) {
|
|
3059
3073
|
return cachedPath;
|
|
3060
3074
|
}
|
|
3061
|
-
if (!sourcePath.includes(`${
|
|
3075
|
+
if (!sourcePath.includes(`${join7(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
|
|
3062
3076
|
originalSourcePathCache.set(sourcePath, sourcePath);
|
|
3063
3077
|
return sourcePath;
|
|
3064
3078
|
}
|
|
3065
|
-
const resolvedSourcePath = await findSourceFileByBasename(
|
|
3079
|
+
const resolvedSourcePath = await findSourceFileByBasename(join7(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
|
|
3066
3080
|
const nextPath = resolvedSourcePath ?? sourcePath;
|
|
3067
3081
|
originalSourcePathCache.set(sourcePath, nextPath);
|
|
3068
3082
|
return nextPath;
|
|
@@ -3078,11 +3092,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3078
3092
|
`${basePath}.mjs`,
|
|
3079
3093
|
`${basePath}.cjs`,
|
|
3080
3094
|
`${basePath}.json`,
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3095
|
+
join7(basePath, "index.ts"),
|
|
3096
|
+
join7(basePath, "index.js"),
|
|
3097
|
+
join7(basePath, "index.mjs"),
|
|
3098
|
+
join7(basePath, "index.cjs"),
|
|
3099
|
+
join7(basePath, "index.json")
|
|
3086
3100
|
];
|
|
3087
3101
|
const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
|
|
3088
3102
|
const foundIndex = existResults.indexOf(true);
|
|
@@ -3090,7 +3104,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3090
3104
|
}, getCachedModulePath = (sourcePath) => {
|
|
3091
3105
|
const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
3092
3106
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
3093
|
-
return
|
|
3107
|
+
return join7(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
3094
3108
|
}, resolveSvelteImport = async (spec, from) => {
|
|
3095
3109
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
3096
3110
|
const resolved = resolvePackageImport(spec);
|
|
@@ -3191,7 +3205,7 @@ var init_svelteServerModule = __esm(() => {
|
|
|
3191
3205
|
init_lowerIslandSyntax();
|
|
3192
3206
|
init_lowerAwaitSlotSyntax();
|
|
3193
3207
|
init_stylePreprocessor();
|
|
3194
|
-
serverCacheRoot =
|
|
3208
|
+
serverCacheRoot = join7(process.cwd(), ".absolutejs", "islands", "svelte");
|
|
3195
3209
|
compiledModuleCache = new Map;
|
|
3196
3210
|
originalSourcePathCache = new Map;
|
|
3197
3211
|
transpiler = new Bun.Transpiler({
|
|
@@ -3414,7 +3428,7 @@ var init_staticStreaming = __esm(() => {
|
|
|
3414
3428
|
});
|
|
3415
3429
|
|
|
3416
3430
|
// src/build/staticIslandPages.ts
|
|
3417
|
-
import { readFileSync as
|
|
3431
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
3418
3432
|
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) => {
|
|
3419
3433
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
3420
3434
|
const attributes = new Map;
|
|
@@ -3543,7 +3557,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
3543
3557
|
}
|
|
3544
3558
|
return result + originalHtml.slice(nextIndex);
|
|
3545
3559
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
3546
|
-
const originalHtml =
|
|
3560
|
+
const originalHtml = readFileSync5(pagePath, "utf-8");
|
|
3547
3561
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
3548
3562
|
if (transformedHtml !== originalHtml) {
|
|
3549
3563
|
writeFileSync3(pagePath, transformedHtml);
|
|
@@ -8569,6 +8583,7 @@ __export(exports_tailwindCompiler, {
|
|
|
8569
8583
|
disposeTailwindCompiler: () => disposeTailwindCompiler
|
|
8570
8584
|
});
|
|
8571
8585
|
import { createHash } from "crypto";
|
|
8586
|
+
import { existsSync as existsSync9, readFileSync as readFileSync6 } from "fs";
|
|
8572
8587
|
import { readFile as readFile2, stat } from "fs/promises";
|
|
8573
8588
|
import { dirname as dirname5, isAbsolute as isAbsolute2, resolve as resolve7 } from "path";
|
|
8574
8589
|
var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async () => {
|
|
@@ -8588,8 +8603,42 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
8588
8603
|
} catch {
|
|
8589
8604
|
deps.set(path, 0);
|
|
8590
8605
|
}
|
|
8606
|
+
}, resolveBareCssImport = (id, base) => {
|
|
8607
|
+
const slashIndex = id.indexOf("/");
|
|
8608
|
+
const pkgName = id.startsWith("@") ? id.split("/").slice(0, 2).join("/") : slashIndex === -1 ? id : id.slice(0, slashIndex);
|
|
8609
|
+
const subpath = id.slice(pkgName.length);
|
|
8610
|
+
if (subpath !== "") {
|
|
8611
|
+
return Bun.resolveSync(id, base);
|
|
8612
|
+
}
|
|
8613
|
+
let pkgJsonPath;
|
|
8614
|
+
try {
|
|
8615
|
+
pkgJsonPath = Bun.resolveSync(`${pkgName}/package.json`, base);
|
|
8616
|
+
} catch {
|
|
8617
|
+
return Bun.resolveSync(id, base);
|
|
8618
|
+
}
|
|
8619
|
+
const pkgDir = dirname5(pkgJsonPath);
|
|
8620
|
+
let pkg = {};
|
|
8621
|
+
try {
|
|
8622
|
+
pkg = JSON.parse(readFileSync6(pkgJsonPath, "utf-8"));
|
|
8623
|
+
} catch {
|
|
8624
|
+
return Bun.resolveSync(id, base);
|
|
8625
|
+
}
|
|
8626
|
+
const exportsField = pkg.exports;
|
|
8627
|
+
const styleFromExports = exportsField?.["."]?.style;
|
|
8628
|
+
const candidates = [
|
|
8629
|
+
styleFromExports,
|
|
8630
|
+
typeof pkg.style === "string" ? pkg.style : undefined,
|
|
8631
|
+
"index.css",
|
|
8632
|
+
"dist/index.css"
|
|
8633
|
+
].filter((entry) => typeof entry === "string");
|
|
8634
|
+
for (const candidate of candidates) {
|
|
8635
|
+
const candidatePath = resolve7(pkgDir, candidate);
|
|
8636
|
+
if (existsSync9(candidatePath))
|
|
8637
|
+
return candidatePath;
|
|
8638
|
+
}
|
|
8639
|
+
return Bun.resolveSync(id, base);
|
|
8591
8640
|
}, createLoadStylesheet = (deps) => async (id, base) => {
|
|
8592
|
-
const path = id.startsWith(".") || isAbsolute2(id) ? resolve7(base, id) :
|
|
8641
|
+
const path = id.startsWith(".") || isAbsolute2(id) ? resolve7(base, id) : resolveBareCssImport(id, base);
|
|
8593
8642
|
const content = await readFile2(path, "utf-8");
|
|
8594
8643
|
await recordDependency(deps, path);
|
|
8595
8644
|
return { base: dirname5(path), content, path };
|
|
@@ -8755,9 +8804,9 @@ var init_tailwindCompiler = __esm(() => {
|
|
|
8755
8804
|
|
|
8756
8805
|
// src/build/compileTailwind.ts
|
|
8757
8806
|
import { mkdir as mkdir2 } from "fs/promises";
|
|
8758
|
-
import { dirname as dirname6, join as
|
|
8807
|
+
import { dirname as dirname6, join as join8 } from "path";
|
|
8759
8808
|
var TAILWIND_CANDIDATE_EXTENSION_PATTERN, isTailwindCandidate = (filePath) => TAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath), compileTailwind = async (input, output, buildPath, styleTransformConfig) => {
|
|
8760
|
-
const outputPath =
|
|
8809
|
+
const outputPath = join8(buildPath, output);
|
|
8761
8810
|
await mkdir2(dirname6(outputPath), { recursive: true });
|
|
8762
8811
|
await incrementalTailwindBuild({ input, output }, buildPath, [], styleTransformConfig);
|
|
8763
8812
|
}, compileTailwindConfig = async (tailwind, buildPath, styleTransformConfig) => compileTailwind(tailwind.input, tailwind.output, buildPath, styleTransformConfig);
|
|
@@ -8767,8 +8816,8 @@ var init_compileTailwind = __esm(() => {
|
|
|
8767
8816
|
});
|
|
8768
8817
|
|
|
8769
8818
|
// src/utils/imageProcessing.ts
|
|
8770
|
-
import { existsSync as
|
|
8771
|
-
import { join as
|
|
8819
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "fs";
|
|
8820
|
+
import { join as join9, resolve as resolve8 } from "path";
|
|
8772
8821
|
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) => {
|
|
8773
8822
|
for (const size of sizes) {
|
|
8774
8823
|
if (size >= target)
|
|
@@ -8823,8 +8872,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
8823
8872
|
const image = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
|
|
8824
8873
|
return [...device, ...image].sort((left, right) => left - right);
|
|
8825
8874
|
}, getCacheDir = (buildDir) => {
|
|
8826
|
-
const dir =
|
|
8827
|
-
if (!
|
|
8875
|
+
const dir = join9(buildDir, ".cache", "images");
|
|
8876
|
+
if (!existsSync10(dir))
|
|
8828
8877
|
mkdirSync3(dir, { recursive: true });
|
|
8829
8878
|
return dir;
|
|
8830
8879
|
}, getCacheKey = (url, width, quality, format) => {
|
|
@@ -8880,13 +8929,13 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
8880
8929
|
return toBuffer(buffer);
|
|
8881
8930
|
}
|
|
8882
8931
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
8883
|
-
const metaPath =
|
|
8884
|
-
const dataPath =
|
|
8885
|
-
if (!
|
|
8932
|
+
const metaPath = join9(cacheDir, `${cacheKey}.meta`);
|
|
8933
|
+
const dataPath = join9(cacheDir, `${cacheKey}.data`);
|
|
8934
|
+
if (!existsSync10(metaPath) || !existsSync10(dataPath))
|
|
8886
8935
|
return null;
|
|
8887
8936
|
try {
|
|
8888
|
-
const meta = JSON.parse(
|
|
8889
|
-
const buffer =
|
|
8937
|
+
const meta = JSON.parse(readFileSync7(metaPath, "utf-8"));
|
|
8938
|
+
const buffer = readFileSync7(dataPath);
|
|
8890
8939
|
return { buffer, meta };
|
|
8891
8940
|
} catch {
|
|
8892
8941
|
return null;
|
|
@@ -8908,8 +8957,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
8908
8957
|
return null;
|
|
8909
8958
|
}
|
|
8910
8959
|
}, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
|
|
8911
|
-
const metaPath =
|
|
8912
|
-
const dataPath =
|
|
8960
|
+
const metaPath = join9(cacheDir, `${cacheKey}.meta`);
|
|
8961
|
+
const dataPath = join9(cacheDir, `${cacheKey}.data`);
|
|
8913
8962
|
writeFileSync4(dataPath, buffer);
|
|
8914
8963
|
writeFileSync4(metaPath, JSON.stringify(meta));
|
|
8915
8964
|
};
|
|
@@ -8995,14 +9044,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
8995
9044
|
});
|
|
8996
9045
|
|
|
8997
9046
|
// src/cli/scripts/telemetry.ts
|
|
8998
|
-
import { existsSync as
|
|
9047
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync8, writeFileSync as writeFileSync5 } from "fs";
|
|
8999
9048
|
import { homedir } from "os";
|
|
9000
|
-
import { join as
|
|
9049
|
+
import { join as join10 } from "path";
|
|
9001
9050
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
9002
9051
|
try {
|
|
9003
|
-
if (!
|
|
9052
|
+
if (!existsSync11(configPath))
|
|
9004
9053
|
return null;
|
|
9005
|
-
const raw =
|
|
9054
|
+
const raw = readFileSync8(configPath, "utf-8");
|
|
9006
9055
|
const config = JSON.parse(raw);
|
|
9007
9056
|
return config;
|
|
9008
9057
|
} catch {
|
|
@@ -9010,19 +9059,19 @@ var configDir, configPath, getTelemetryConfig = () => {
|
|
|
9010
9059
|
}
|
|
9011
9060
|
};
|
|
9012
9061
|
var init_telemetry = __esm(() => {
|
|
9013
|
-
configDir =
|
|
9014
|
-
configPath =
|
|
9062
|
+
configDir = join10(homedir(), ".absolutejs");
|
|
9063
|
+
configPath = join10(configDir, "telemetry.json");
|
|
9015
9064
|
});
|
|
9016
9065
|
|
|
9017
9066
|
// src/cli/telemetryEvent.ts
|
|
9018
|
-
import { existsSync as
|
|
9067
|
+
import { existsSync as existsSync12, readFileSync as readFileSync9 } from "fs";
|
|
9019
9068
|
import { arch, platform } from "os";
|
|
9020
|
-
import { dirname as dirname7, join as
|
|
9069
|
+
import { dirname as dirname7, join as join11, parse } from "path";
|
|
9021
9070
|
var checkCandidate = (candidate) => {
|
|
9022
|
-
if (!
|
|
9071
|
+
if (!existsSync12(candidate)) {
|
|
9023
9072
|
return null;
|
|
9024
9073
|
}
|
|
9025
|
-
const pkg = JSON.parse(
|
|
9074
|
+
const pkg = JSON.parse(readFileSync9(candidate, "utf-8"));
|
|
9026
9075
|
if (pkg.name === "@absolutejs/absolute") {
|
|
9027
9076
|
const ver = pkg.version;
|
|
9028
9077
|
return ver;
|
|
@@ -9037,7 +9086,7 @@ var checkCandidate = (candidate) => {
|
|
|
9037
9086
|
}, findPackageVersion = () => {
|
|
9038
9087
|
let { dir } = import.meta;
|
|
9039
9088
|
while (dir !== parse(dir).root) {
|
|
9040
|
-
const candidate =
|
|
9089
|
+
const candidate = join11(dir, "package.json");
|
|
9041
9090
|
const version = checkCandidate(candidate);
|
|
9042
9091
|
if (version) {
|
|
9043
9092
|
return version;
|
|
@@ -9127,17 +9176,17 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
9127
9176
|
});
|
|
9128
9177
|
|
|
9129
9178
|
// src/dev/buildHMRClient.ts
|
|
9130
|
-
import { existsSync as
|
|
9179
|
+
import { existsSync as existsSync13 } from "fs";
|
|
9131
9180
|
import { resolve as resolve9 } from "path";
|
|
9132
9181
|
var {build: bunBuild } = globalThis.Bun;
|
|
9133
9182
|
var resolveHmrClientPath = () => {
|
|
9134
9183
|
const projectRoot = process.cwd();
|
|
9135
9184
|
const fromSource = resolve9(import.meta.dir, "client/hmrClient.ts");
|
|
9136
|
-
if (
|
|
9185
|
+
if (existsSync13(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
9137
9186
|
return fromSource;
|
|
9138
9187
|
}
|
|
9139
9188
|
const fromNodeModules = resolve9(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
9140
|
-
if (
|
|
9189
|
+
if (existsSync13(fromNodeModules))
|
|
9141
9190
|
return fromNodeModules;
|
|
9142
9191
|
return resolve9(import.meta.dir, "dev/client/hmrClient.ts");
|
|
9143
9192
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
@@ -9329,8 +9378,8 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
9329
9378
|
};
|
|
9330
9379
|
|
|
9331
9380
|
// src/build/angularLinkerPlugin.ts
|
|
9332
|
-
import { existsSync as
|
|
9333
|
-
import { dirname as dirname8, join as
|
|
9381
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync5, readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "fs";
|
|
9382
|
+
import { dirname as dirname8, join as join12, relative as relative5, resolve as resolve11 } from "path";
|
|
9334
9383
|
import { createHash as createHash2 } from "crypto";
|
|
9335
9384
|
var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
9336
9385
|
name: "angular-linker",
|
|
@@ -9338,7 +9387,7 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9338
9387
|
let needsLinking;
|
|
9339
9388
|
let babelTransform;
|
|
9340
9389
|
let linkerPlugin;
|
|
9341
|
-
const cacheDir =
|
|
9390
|
+
const cacheDir = join12(CACHE_ROOT, linkerJitMode ? "jit" : "aot");
|
|
9342
9391
|
bld.onLoad({ filter: /[\\/]@angular[\\/].*\.m?js$/ }, async (args) => {
|
|
9343
9392
|
const source = await Bun.file(args.path).text();
|
|
9344
9393
|
if (!needsLinking) {
|
|
@@ -9351,10 +9400,10 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9351
9400
|
return;
|
|
9352
9401
|
}
|
|
9353
9402
|
const hash = createHash2("md5").update(source).digest("hex");
|
|
9354
|
-
const cachePath =
|
|
9355
|
-
if (
|
|
9403
|
+
const cachePath = join12(cacheDir, `${hash}.js`);
|
|
9404
|
+
if (existsSync14(cachePath)) {
|
|
9356
9405
|
return {
|
|
9357
|
-
contents:
|
|
9406
|
+
contents: readFileSync10(cachePath, "utf-8"),
|
|
9358
9407
|
loader: "js"
|
|
9359
9408
|
};
|
|
9360
9409
|
}
|
|
@@ -9369,8 +9418,8 @@ var CACHE_ROOT, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
|
9369
9418
|
linkerPlugin = mod.createEs2015LinkerPlugin({
|
|
9370
9419
|
fileSystem: {
|
|
9371
9420
|
dirname: dirname8,
|
|
9372
|
-
exists:
|
|
9373
|
-
readFile:
|
|
9421
|
+
exists: existsSync14,
|
|
9422
|
+
readFile: readFileSync10,
|
|
9374
9423
|
relative: relative5,
|
|
9375
9424
|
resolve: resolve11
|
|
9376
9425
|
},
|
|
@@ -9431,7 +9480,7 @@ var init_cleanStaleOutputs = __esm(() => {
|
|
|
9431
9480
|
|
|
9432
9481
|
// src/utils/cleanup.ts
|
|
9433
9482
|
import { rm as rm3 } from "fs/promises";
|
|
9434
|
-
import { join as
|
|
9483
|
+
import { join as join13 } from "path";
|
|
9435
9484
|
var cleanup = async ({
|
|
9436
9485
|
angularDir,
|
|
9437
9486
|
reactDir,
|
|
@@ -9439,19 +9488,19 @@ var cleanup = async ({
|
|
|
9439
9488
|
vueDir
|
|
9440
9489
|
}) => {
|
|
9441
9490
|
await Promise.all([
|
|
9442
|
-
angularDir ? rm3(
|
|
9491
|
+
angularDir ? rm3(join13(angularDir, "generated"), {
|
|
9443
9492
|
force: true,
|
|
9444
9493
|
recursive: true
|
|
9445
9494
|
}) : undefined,
|
|
9446
|
-
reactDir ? rm3(
|
|
9495
|
+
reactDir ? rm3(join13(reactDir, "generated"), {
|
|
9447
9496
|
force: true,
|
|
9448
9497
|
recursive: true
|
|
9449
9498
|
}) : undefined,
|
|
9450
|
-
svelteDir ? rm3(
|
|
9499
|
+
svelteDir ? rm3(join13(svelteDir, "generated"), {
|
|
9451
9500
|
force: true,
|
|
9452
9501
|
recursive: true
|
|
9453
9502
|
}) : undefined,
|
|
9454
|
-
vueDir ? rm3(
|
|
9503
|
+
vueDir ? rm3(join13(vueDir, "generated"), {
|
|
9455
9504
|
force: true,
|
|
9456
9505
|
recursive: true
|
|
9457
9506
|
}) : undefined
|
|
@@ -9628,11 +9677,11 @@ __export(exports_compileSvelte, {
|
|
|
9628
9677
|
compileSvelte: () => compileSvelte,
|
|
9629
9678
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
9630
9679
|
});
|
|
9631
|
-
import { existsSync as
|
|
9680
|
+
import { existsSync as existsSync15 } from "fs";
|
|
9632
9681
|
import { mkdir as mkdir3, stat as stat2 } from "fs/promises";
|
|
9633
9682
|
import {
|
|
9634
9683
|
dirname as dirname9,
|
|
9635
|
-
join as
|
|
9684
|
+
join as join14,
|
|
9636
9685
|
basename as basename4,
|
|
9637
9686
|
extname as extname5,
|
|
9638
9687
|
resolve as resolve14,
|
|
@@ -9644,11 +9693,11 @@ var {write, file, Transpiler } = globalThis.Bun;
|
|
|
9644
9693
|
var resolveDevClientDir2 = () => {
|
|
9645
9694
|
const projectRoot = process.cwd();
|
|
9646
9695
|
const fromSource = resolve14(import.meta.dir, "../dev/client");
|
|
9647
|
-
if (
|
|
9696
|
+
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
9648
9697
|
return fromSource;
|
|
9649
9698
|
}
|
|
9650
9699
|
const fromNodeModules = resolve14(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
9651
|
-
if (
|
|
9700
|
+
if (existsSync15(fromNodeModules))
|
|
9652
9701
|
return fromNodeModules;
|
|
9653
9702
|
return resolve14(import.meta.dir, "./dev/client");
|
|
9654
9703
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
@@ -9691,14 +9740,14 @@ var resolveDevClientDir2 = () => {
|
|
|
9691
9740
|
`${basePath}.svelte`,
|
|
9692
9741
|
`${basePath}.svelte.ts`,
|
|
9693
9742
|
`${basePath}.svelte.js`,
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9743
|
+
join14(basePath, "index.ts"),
|
|
9744
|
+
join14(basePath, "index.js"),
|
|
9745
|
+
join14(basePath, "index.mjs"),
|
|
9746
|
+
join14(basePath, "index.cjs"),
|
|
9747
|
+
join14(basePath, "index.json"),
|
|
9748
|
+
join14(basePath, "index.svelte"),
|
|
9749
|
+
join14(basePath, "index.svelte.ts"),
|
|
9750
|
+
join14(basePath, "index.svelte.js")
|
|
9702
9751
|
];
|
|
9703
9752
|
const checks = await Promise.all(candidates.map(exists));
|
|
9704
9753
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -9736,10 +9785,10 @@ var resolveDevClientDir2 = () => {
|
|
|
9736
9785
|
});
|
|
9737
9786
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
|
|
9738
9787
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
9739
|
-
const generatedDir =
|
|
9740
|
-
const clientDir =
|
|
9741
|
-
const indexDir =
|
|
9742
|
-
const serverDir =
|
|
9788
|
+
const generatedDir = join14(svelteRoot, "generated");
|
|
9789
|
+
const clientDir = join14(generatedDir, "client");
|
|
9790
|
+
const indexDir = join14(generatedDir, "indexes");
|
|
9791
|
+
const serverDir = join14(generatedDir, "server");
|
|
9743
9792
|
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir3(dir, { recursive: true })));
|
|
9744
9793
|
const dev = env.NODE_ENV !== "production";
|
|
9745
9794
|
const build = async (src) => {
|
|
@@ -9777,8 +9826,8 @@ var resolveDevClientDir2 = () => {
|
|
|
9777
9826
|
const childBuilt = await Promise.all(childSources.map((child) => build(child)));
|
|
9778
9827
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
9779
9828
|
const externalRewrites = new Map;
|
|
9780
|
-
const ssrOutputDir = dirname9(
|
|
9781
|
-
const clientOutputDir = dirname9(
|
|
9829
|
+
const ssrOutputDir = dirname9(join14(serverDir, relDir, `${baseName}.js`));
|
|
9830
|
+
const clientOutputDir = dirname9(join14(clientDir, relDir, `${baseName}.js`));
|
|
9782
9831
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
9783
9832
|
const rawSpec = importPaths[idx];
|
|
9784
9833
|
if (!rawSpec)
|
|
@@ -9843,8 +9892,8 @@ var resolveDevClientDir2 = () => {
|
|
|
9843
9892
|
code += islandMetadataExports;
|
|
9844
9893
|
return code;
|
|
9845
9894
|
};
|
|
9846
|
-
const ssrPath =
|
|
9847
|
-
const clientPath =
|
|
9895
|
+
const ssrPath = join14(serverDir, relDir, `${baseName}.js`);
|
|
9896
|
+
const clientPath = join14(clientDir, relDir, `${baseName}.js`);
|
|
9848
9897
|
await Promise.all([
|
|
9849
9898
|
mkdir3(dirname9(ssrPath), { recursive: true }),
|
|
9850
9899
|
mkdir3(dirname9(clientPath), { recursive: true })
|
|
@@ -9876,7 +9925,7 @@ var resolveDevClientDir2 = () => {
|
|
|
9876
9925
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
9877
9926
|
const relClientDir = dirname9(relative7(clientDir, client));
|
|
9878
9927
|
const name = basename4(client, extname5(client));
|
|
9879
|
-
const indexPath =
|
|
9928
|
+
const indexPath = join14(indexDir, relClientDir, `${name}.js`);
|
|
9880
9929
|
const importRaw = relative7(dirname9(indexPath), client).split(sep2).join("/");
|
|
9881
9930
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
9882
9931
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
@@ -9955,7 +10004,7 @@ if (typeof window !== "undefined") {
|
|
|
9955
10004
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
9956
10005
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
9957
10006
|
const rel = dirname9(relative7(clientDir, client));
|
|
9958
|
-
return
|
|
10007
|
+
return join14(indexDir, rel, basename4(client));
|
|
9959
10008
|
}),
|
|
9960
10009
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
9961
10010
|
};
|
|
@@ -9969,7 +10018,7 @@ var init_compileSvelte = __esm(() => {
|
|
|
9969
10018
|
init_lowerAwaitSlotSyntax();
|
|
9970
10019
|
init_renderToReadableStream();
|
|
9971
10020
|
devClientDir2 = resolveDevClientDir2();
|
|
9972
|
-
hmrClientPath3 =
|
|
10021
|
+
hmrClientPath3 = join14(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
9973
10022
|
persistentCache = new Map;
|
|
9974
10023
|
sourceHashCache = new Map;
|
|
9975
10024
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
@@ -9984,18 +10033,18 @@ __export(exports_compileVue, {
|
|
|
9984
10033
|
compileVue: () => compileVue,
|
|
9985
10034
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
9986
10035
|
});
|
|
9987
|
-
import { existsSync as
|
|
10036
|
+
import { existsSync as existsSync16 } from "fs";
|
|
9988
10037
|
import { mkdir as mkdir4 } from "fs/promises";
|
|
9989
|
-
import { basename as basename5, dirname as dirname10, join as
|
|
10038
|
+
import { basename as basename5, dirname as dirname10, join as join15, relative as relative8, resolve as resolve15 } from "path";
|
|
9990
10039
|
var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
9991
10040
|
var resolveDevClientDir3 = () => {
|
|
9992
10041
|
const projectRoot = process.cwd();
|
|
9993
10042
|
const fromSource = resolve15(import.meta.dir, "../dev/client");
|
|
9994
|
-
if (
|
|
10043
|
+
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
9995
10044
|
return fromSource;
|
|
9996
10045
|
}
|
|
9997
10046
|
const fromNodeModules = resolve15(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
9998
|
-
if (
|
|
10047
|
+
if (existsSync16(fromNodeModules))
|
|
9999
10048
|
return fromNodeModules;
|
|
10000
10049
|
return resolve15(import.meta.dir, "./dev/client");
|
|
10001
10050
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
@@ -10142,7 +10191,7 @@ var resolveDevClientDir3 = () => {
|
|
|
10142
10191
|
];
|
|
10143
10192
|
let cssOutputPaths = [];
|
|
10144
10193
|
if (isEntryPoint && allCss.length) {
|
|
10145
|
-
const cssOutputFile =
|
|
10194
|
+
const cssOutputFile = join15(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
10146
10195
|
await mkdir4(dirname10(cssOutputFile), { recursive: true });
|
|
10147
10196
|
await write2(cssOutputFile, allCss.join(`
|
|
10148
10197
|
`));
|
|
@@ -10173,8 +10222,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10173
10222
|
};
|
|
10174
10223
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
10175
10224
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
10176
|
-
const clientOutputPath =
|
|
10177
|
-
const serverOutputPath =
|
|
10225
|
+
const clientOutputPath = join15(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
10226
|
+
const serverOutputPath = join15(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
10178
10227
|
const relDir = dirname10(relativeFilePath);
|
|
10179
10228
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
10180
10229
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_2, prefix, dots) => {
|
|
@@ -10214,11 +10263,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10214
10263
|
return result;
|
|
10215
10264
|
}, compileVue = async (entryPoints, vueRootDir, isDev = false, stylePreprocessors) => {
|
|
10216
10265
|
const compiler = await import("@vue/compiler-sfc");
|
|
10217
|
-
const generatedDir =
|
|
10218
|
-
const clientOutputDir =
|
|
10219
|
-
const indexOutputDir =
|
|
10220
|
-
const serverOutputDir =
|
|
10221
|
-
const cssOutputDir =
|
|
10266
|
+
const generatedDir = join15(vueRootDir, "generated");
|
|
10267
|
+
const clientOutputDir = join15(generatedDir, "client");
|
|
10268
|
+
const indexOutputDir = join15(generatedDir, "indexes");
|
|
10269
|
+
const serverOutputDir = join15(generatedDir, "server");
|
|
10270
|
+
const cssOutputDir = join15(generatedDir, "compiled");
|
|
10222
10271
|
await Promise.all([
|
|
10223
10272
|
mkdir4(clientOutputDir, { recursive: true }),
|
|
10224
10273
|
mkdir4(indexOutputDir, { recursive: true }),
|
|
@@ -10235,8 +10284,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10235
10284
|
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
10236
10285
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
10237
10286
|
const entryBaseName = basename5(entryPath, ".vue");
|
|
10238
|
-
const indexOutputFile =
|
|
10239
|
-
const clientOutputFile =
|
|
10287
|
+
const indexOutputFile = join15(indexOutputDir, `${entryBaseName}.js`);
|
|
10288
|
+
const clientOutputFile = join15(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
10240
10289
|
await mkdir4(dirname10(indexOutputFile), { recursive: true });
|
|
10241
10290
|
const vueHmrImports = isDev ? [
|
|
10242
10291
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -10365,8 +10414,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
10365
10414
|
const sourceCode = await file2(tsPath).text();
|
|
10366
10415
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
10367
10416
|
const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
10368
|
-
const outClientPath =
|
|
10369
|
-
const outServerPath =
|
|
10417
|
+
const outClientPath = join15(clientOutputDir, relativeJsPath);
|
|
10418
|
+
const outServerPath = join15(serverOutputDir, relativeJsPath);
|
|
10370
10419
|
await mkdir4(dirname10(outClientPath), { recursive: true });
|
|
10371
10420
|
await mkdir4(dirname10(outServerPath), { recursive: true });
|
|
10372
10421
|
await write2(outClientPath, transpiledCode);
|
|
@@ -10386,7 +10435,7 @@ var init_compileVue = __esm(() => {
|
|
|
10386
10435
|
init_sourceMetadata();
|
|
10387
10436
|
init_stylePreprocessor();
|
|
10388
10437
|
devClientDir3 = resolveDevClientDir3();
|
|
10389
|
-
hmrClientPath4 =
|
|
10438
|
+
hmrClientPath4 = join15(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
10390
10439
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
10391
10440
|
scriptCache = new Map;
|
|
10392
10441
|
scriptSetupCache = new Map;
|
|
@@ -10866,8 +10915,8 @@ __export(exports_compileAngular, {
|
|
|
10866
10915
|
compileAngularFile: () => compileAngularFile,
|
|
10867
10916
|
compileAngular: () => compileAngular
|
|
10868
10917
|
});
|
|
10869
|
-
import { existsSync as
|
|
10870
|
-
import { join as
|
|
10918
|
+
import { existsSync as existsSync17, readFileSync as readFileSync11, promises as fs } from "fs";
|
|
10919
|
+
import { join as join16, basename as basename6, sep as sep3, dirname as dirname11, resolve as resolve16, relative as relative9 } from "path";
|
|
10871
10920
|
import ts2 from "typescript";
|
|
10872
10921
|
var traceAngularPhase = async (name, fn2, metadata) => {
|
|
10873
10922
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
@@ -10909,12 +10958,12 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
10909
10958
|
`${candidate}.tsx`,
|
|
10910
10959
|
`${candidate}.js`,
|
|
10911
10960
|
`${candidate}.jsx`,
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10961
|
+
join16(candidate, "index.ts"),
|
|
10962
|
+
join16(candidate, "index.tsx"),
|
|
10963
|
+
join16(candidate, "index.js"),
|
|
10964
|
+
join16(candidate, "index.jsx")
|
|
10916
10965
|
];
|
|
10917
|
-
return candidates.find((file3) =>
|
|
10966
|
+
return candidates.find((file3) => existsSync17(file3));
|
|
10918
10967
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
10919
10968
|
const baseDir = resolve16(rootDir);
|
|
10920
10969
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
@@ -10995,11 +11044,11 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
10995
11044
|
}, resolveDevClientDir4 = () => {
|
|
10996
11045
|
const projectRoot = process.cwd();
|
|
10997
11046
|
const fromSource = resolve16(import.meta.dir, "../dev/client");
|
|
10998
|
-
if (
|
|
11047
|
+
if (existsSync17(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10999
11048
|
return fromSource;
|
|
11000
11049
|
}
|
|
11001
11050
|
const fromNodeModules = resolve16(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
11002
|
-
if (
|
|
11051
|
+
if (existsSync17(fromNodeModules))
|
|
11003
11052
|
return fromNodeModules;
|
|
11004
11053
|
return resolve16(import.meta.dir, "./dev/client");
|
|
11005
11054
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
@@ -11051,11 +11100,11 @@ ${registrations}
|
|
|
11051
11100
|
return specifier;
|
|
11052
11101
|
const importerDir = dirname11(importerOutputPath);
|
|
11053
11102
|
const fileCandidate = resolve16(importerDir, `${specifier}.js`);
|
|
11054
|
-
if (outputFiles?.has(fileCandidate) ||
|
|
11103
|
+
if (outputFiles?.has(fileCandidate) || existsSync17(fileCandidate)) {
|
|
11055
11104
|
return `${specifier}.js`;
|
|
11056
11105
|
}
|
|
11057
11106
|
const indexCandidate = resolve16(importerDir, specifier, "index.js");
|
|
11058
|
-
if (outputFiles?.has(indexCandidate) ||
|
|
11107
|
+
if (outputFiles?.has(indexCandidate) || existsSync17(indexCandidate)) {
|
|
11059
11108
|
return `${specifier}/index.js`;
|
|
11060
11109
|
}
|
|
11061
11110
|
return `${specifier}.js`;
|
|
@@ -11088,12 +11137,12 @@ ${registrations}
|
|
|
11088
11137
|
`${basePath}.tsx`,
|
|
11089
11138
|
`${basePath}.mts`,
|
|
11090
11139
|
`${basePath}.cts`,
|
|
11091
|
-
|
|
11092
|
-
|
|
11093
|
-
|
|
11094
|
-
|
|
11140
|
+
join16(basePath, "index.ts"),
|
|
11141
|
+
join16(basePath, "index.tsx"),
|
|
11142
|
+
join16(basePath, "index.mts"),
|
|
11143
|
+
join16(basePath, "index.cts")
|
|
11095
11144
|
];
|
|
11096
|
-
return candidates.map((candidate) => resolve16(candidate)).find((candidate) =>
|
|
11145
|
+
return candidates.map((candidate) => resolve16(candidate)).find((candidate) => existsSync17(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
11097
11146
|
}, readFileForAotTransform = async (fileName, readFile5) => {
|
|
11098
11147
|
const hostSource = readFile5?.(fileName);
|
|
11099
11148
|
if (typeof hostSource === "string")
|
|
@@ -11117,15 +11166,15 @@ ${registrations}
|
|
|
11117
11166
|
const paths = [];
|
|
11118
11167
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11119
11168
|
if (templateUrlMatch?.[1])
|
|
11120
|
-
paths.push(
|
|
11169
|
+
paths.push(join16(fileDir, templateUrlMatch[1]));
|
|
11121
11170
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11122
11171
|
if (styleUrlMatch?.[1])
|
|
11123
|
-
paths.push(
|
|
11172
|
+
paths.push(join16(fileDir, styleUrlMatch[1]));
|
|
11124
11173
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
11125
11174
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
11126
11175
|
if (urlMatches) {
|
|
11127
11176
|
for (const urlMatch of urlMatches) {
|
|
11128
|
-
paths.push(
|
|
11177
|
+
paths.push(join16(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
11129
11178
|
}
|
|
11130
11179
|
}
|
|
11131
11180
|
return paths.map((path) => resolve16(path));
|
|
@@ -11159,7 +11208,7 @@ ${registrations}
|
|
|
11159
11208
|
safeStableStringify(stylePreprocessors ?? null)
|
|
11160
11209
|
].join("\x00");
|
|
11161
11210
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
11162
|
-
return
|
|
11211
|
+
return join16(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
11163
11212
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile5, stylePreprocessors) => {
|
|
11164
11213
|
const transformedSources = new Map;
|
|
11165
11214
|
const visited = new Set;
|
|
@@ -11174,7 +11223,7 @@ ${registrations}
|
|
|
11174
11223
|
if (visited.has(resolvedPath))
|
|
11175
11224
|
return;
|
|
11176
11225
|
visited.add(resolvedPath);
|
|
11177
|
-
if (!
|
|
11226
|
+
if (!existsSync17(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
11178
11227
|
return;
|
|
11179
11228
|
stats.filesVisited += 1;
|
|
11180
11229
|
const source = await readFileForAotTransform(resolvedPath, readFile5);
|
|
@@ -11205,10 +11254,10 @@ ${registrations}
|
|
|
11205
11254
|
return { stats, transformedSources };
|
|
11206
11255
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
11207
11256
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
11208
|
-
const outputPath = resolve16(
|
|
11257
|
+
const outputPath = resolve16(join16(outDir, relative9(process.cwd(), resolve16(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
11209
11258
|
return [
|
|
11210
11259
|
outputPath,
|
|
11211
|
-
buildIslandMetadataExports(
|
|
11260
|
+
buildIslandMetadataExports(readFileSync11(inputPath, "utf-8"))
|
|
11212
11261
|
];
|
|
11213
11262
|
})), { entries: inputPaths.length });
|
|
11214
11263
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
@@ -11251,7 +11300,7 @@ ${registrations}
|
|
|
11251
11300
|
const originalGetSourceFile = host.getSourceFile;
|
|
11252
11301
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
11253
11302
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
11254
|
-
const resolvedPath =
|
|
11303
|
+
const resolvedPath = join16(tsLibDir, fileName);
|
|
11255
11304
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
11256
11305
|
}
|
|
11257
11306
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
@@ -11306,7 +11355,7 @@ ${registrations}
|
|
|
11306
11355
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
11307
11356
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
11308
11357
|
content,
|
|
11309
|
-
target:
|
|
11358
|
+
target: join16(outDir, fileName)
|
|
11310
11359
|
}));
|
|
11311
11360
|
const outputFiles = new Set(rawEntries.map(({ target }) => resolve16(target)));
|
|
11312
11361
|
return rawEntries.map(({ content, target }) => {
|
|
@@ -11345,7 +11394,7 @@ ${registrations}
|
|
|
11345
11394
|
return null;
|
|
11346
11395
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
11347
11396
|
const sourceEntry = resolve16(import.meta.dir, "../angular/components/index.ts");
|
|
11348
|
-
if (
|
|
11397
|
+
if (existsSync17(sourceEntry)) {
|
|
11349
11398
|
return sourceEntry.replace(/\\/g, "/");
|
|
11350
11399
|
}
|
|
11351
11400
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -11473,7 +11522,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
11473
11522
|
${fields}
|
|
11474
11523
|
`);
|
|
11475
11524
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
11476
|
-
if (!
|
|
11525
|
+
if (!existsSync17(filePath)) {
|
|
11477
11526
|
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
11478
11527
|
}
|
|
11479
11528
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
@@ -11481,8 +11530,8 @@ ${fields}
|
|
|
11481
11530
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
11482
11531
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11483
11532
|
if (templateUrlMatch?.[1]) {
|
|
11484
|
-
const templatePath =
|
|
11485
|
-
if (!
|
|
11533
|
+
const templatePath = join16(fileDir, templateUrlMatch[1]);
|
|
11534
|
+
if (!existsSync17(templatePath)) {
|
|
11486
11535
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
11487
11536
|
}
|
|
11488
11537
|
const templateRaw2 = await fs.readFile(templatePath, "utf-8");
|
|
@@ -11512,11 +11561,11 @@ ${fields}
|
|
|
11512
11561
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
11513
11562
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11514
11563
|
if (templateUrlMatch?.[1]) {
|
|
11515
|
-
const templatePath =
|
|
11516
|
-
if (!
|
|
11564
|
+
const templatePath = join16(fileDir, templateUrlMatch[1]);
|
|
11565
|
+
if (!existsSync17(templatePath)) {
|
|
11517
11566
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
11518
11567
|
}
|
|
11519
|
-
const templateRaw2 =
|
|
11568
|
+
const templateRaw2 = readFileSync11(templatePath, "utf-8");
|
|
11520
11569
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
11521
11570
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
11522
11571
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -11549,7 +11598,7 @@ ${fields}
|
|
|
11549
11598
|
return source;
|
|
11550
11599
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
11551
11600
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
11552
|
-
return readAndEscapeFile(
|
|
11601
|
+
return readAndEscapeFile(join16(fileDir, styleUrl), stylePreprocessors);
|
|
11553
11602
|
});
|
|
11554
11603
|
const results = await Promise.all(stylePromises);
|
|
11555
11604
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -11560,7 +11609,7 @@ ${fields}
|
|
|
11560
11609
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
11561
11610
|
if (!styleUrlMatch?.[1])
|
|
11562
11611
|
return source;
|
|
11563
|
-
const escaped = await readAndEscapeFile(
|
|
11612
|
+
const escaped = await readAndEscapeFile(join16(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
11564
11613
|
if (!escaped)
|
|
11565
11614
|
return source;
|
|
11566
11615
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -11595,12 +11644,12 @@ ${fields}
|
|
|
11595
11644
|
`${candidate}.tsx`,
|
|
11596
11645
|
`${candidate}.js`,
|
|
11597
11646
|
`${candidate}.jsx`,
|
|
11598
|
-
|
|
11599
|
-
|
|
11600
|
-
|
|
11601
|
-
|
|
11647
|
+
join16(candidate, "index.ts"),
|
|
11648
|
+
join16(candidate, "index.tsx"),
|
|
11649
|
+
join16(candidate, "index.js"),
|
|
11650
|
+
join16(candidate, "index.jsx")
|
|
11602
11651
|
];
|
|
11603
|
-
return candidates.find((file3) =>
|
|
11652
|
+
return candidates.find((file3) => existsSync17(file3));
|
|
11604
11653
|
};
|
|
11605
11654
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
11606
11655
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
@@ -11625,7 +11674,7 @@ ${fields}
|
|
|
11625
11674
|
const inputDir = dirname11(sourcePath);
|
|
11626
11675
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
11627
11676
|
const fileBase = basename6(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
11628
|
-
return
|
|
11677
|
+
return join16(outDir, relativeDir, fileBase);
|
|
11629
11678
|
};
|
|
11630
11679
|
const transpileAndRewrite = (sourceCode, relativeDir, actualPath, importRewrites) => {
|
|
11631
11680
|
let processedContent = angularTranspiler.transformSync(sourceCode);
|
|
@@ -11670,7 +11719,7 @@ ${fields}
|
|
|
11670
11719
|
let actualPath = resolved;
|
|
11671
11720
|
if (!actualPath.endsWith(".ts"))
|
|
11672
11721
|
actualPath += ".ts";
|
|
11673
|
-
if (!
|
|
11722
|
+
if (!existsSync17(actualPath))
|
|
11674
11723
|
return;
|
|
11675
11724
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
11676
11725
|
const inlined = await inlineResources(sourceCode, dirname11(actualPath), stylePreprocessors);
|
|
@@ -11678,7 +11727,7 @@ ${fields}
|
|
|
11678
11727
|
const inputDir = dirname11(actualPath);
|
|
11679
11728
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
11680
11729
|
const fileBase = basename6(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
11681
|
-
const targetDir =
|
|
11730
|
+
const targetDir = join16(outDir, relativeDir);
|
|
11682
11731
|
const targetPath = toOutputPath(actualPath);
|
|
11683
11732
|
const localImports = [];
|
|
11684
11733
|
const importRewrites = new Map;
|
|
@@ -11706,7 +11755,7 @@ ${fields}
|
|
|
11706
11755
|
}).filter((path) => Boolean(path));
|
|
11707
11756
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
11708
11757
|
const cacheKey2 = actualPath;
|
|
11709
|
-
if (jitContentCache.get(cacheKey2) === contentHash &&
|
|
11758
|
+
if (jitContentCache.get(cacheKey2) === contentHash && existsSync17(targetPath)) {
|
|
11710
11759
|
allOutputs.push(targetPath);
|
|
11711
11760
|
} else {
|
|
11712
11761
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
@@ -11719,7 +11768,7 @@ ${fields}
|
|
|
11719
11768
|
};
|
|
11720
11769
|
await transpileFile(inputPath);
|
|
11721
11770
|
const entryOutputPath = toOutputPath(entryPath);
|
|
11722
|
-
if (
|
|
11771
|
+
if (existsSync17(entryOutputPath)) {
|
|
11723
11772
|
const entryOutput = await fs.readFile(entryOutputPath, "utf-8");
|
|
11724
11773
|
const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
|
|
11725
11774
|
`);
|
|
@@ -11732,13 +11781,13 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
11732
11781
|
}
|
|
11733
11782
|
return allOutputs;
|
|
11734
11783
|
}, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
|
|
11735
|
-
const compiledParent =
|
|
11784
|
+
const compiledParent = join16(outRoot, "generated");
|
|
11736
11785
|
if (entryPoints.length === 0) {
|
|
11737
11786
|
const emptyPaths = [];
|
|
11738
11787
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
11739
11788
|
}
|
|
11740
11789
|
const compiledRoot = compiledParent;
|
|
11741
|
-
const indexesDir =
|
|
11790
|
+
const indexesDir = join16(compiledParent, "indexes");
|
|
11742
11791
|
await traceAngularPhase("setup/create-indexes-dir", () => fs.mkdir(indexesDir, { recursive: true }));
|
|
11743
11792
|
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve16(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
11744
11793
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
@@ -11752,21 +11801,21 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
11752
11801
|
const fileBase = basename6(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
11753
11802
|
const jsName = `${fileBase}.js`;
|
|
11754
11803
|
const compiledFallbackPaths = [
|
|
11755
|
-
|
|
11756
|
-
|
|
11757
|
-
|
|
11804
|
+
join16(compiledRoot, relativeEntry),
|
|
11805
|
+
join16(compiledRoot, "pages", jsName),
|
|
11806
|
+
join16(compiledRoot, jsName)
|
|
11758
11807
|
].map((file3) => resolve16(file3));
|
|
11759
11808
|
const resolveRawServerFile = (candidatePaths) => {
|
|
11760
11809
|
const normalizedCandidates = [
|
|
11761
11810
|
...candidatePaths.map((file3) => resolve16(file3)),
|
|
11762
11811
|
...compiledFallbackPaths
|
|
11763
11812
|
];
|
|
11764
|
-
let candidate = normalizedCandidates.find((file3) =>
|
|
11813
|
+
let candidate = normalizedCandidates.find((file3) => existsSync17(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
11765
11814
|
if (!candidate) {
|
|
11766
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
11815
|
+
candidate = normalizedCandidates.find((file3) => existsSync17(file3) && file3.endsWith(`${sep3}${jsName}`));
|
|
11767
11816
|
}
|
|
11768
11817
|
if (!candidate) {
|
|
11769
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
11818
|
+
candidate = normalizedCandidates.find((file3) => existsSync17(file3));
|
|
11770
11819
|
}
|
|
11771
11820
|
return candidate;
|
|
11772
11821
|
};
|
|
@@ -11774,11 +11823,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
11774
11823
|
if (!rawServerFile) {
|
|
11775
11824
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
|
|
11776
11825
|
}
|
|
11777
|
-
if (rawServerFile && !
|
|
11826
|
+
if (rawServerFile && !existsSync17(rawServerFile)) {
|
|
11778
11827
|
outputs = hmr ? await compileEntry() : aotOutputs;
|
|
11779
11828
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
|
|
11780
11829
|
}
|
|
11781
|
-
if (!rawServerFile || !
|
|
11830
|
+
if (!rawServerFile || !existsSync17(rawServerFile)) {
|
|
11782
11831
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
11783
11832
|
...outputs,
|
|
11784
11833
|
...compiledFallbackPaths
|
|
@@ -11798,8 +11847,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
11798
11847
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
11799
11848
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
11800
11849
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
11801
|
-
const clientFile =
|
|
11802
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
11850
|
+
const clientFile = join16(indexesDir, jsName);
|
|
11851
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync17(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
11803
11852
|
return {
|
|
11804
11853
|
clientPath: clientFile,
|
|
11805
11854
|
indexUnchanged: true,
|
|
@@ -12046,8 +12095,8 @@ var init_compileAngular = __esm(() => {
|
|
|
12046
12095
|
init_lowerDeferSyntax();
|
|
12047
12096
|
init_stylePreprocessor();
|
|
12048
12097
|
devClientDir4 = resolveDevClientDir4();
|
|
12049
|
-
hmrClientPath5 =
|
|
12050
|
-
hmrRuntimePath =
|
|
12098
|
+
hmrClientPath5 = join16(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
12099
|
+
hmrRuntimePath = join16(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
|
|
12051
12100
|
jitContentCache = new Map;
|
|
12052
12101
|
wrapperOutputCache = new Map;
|
|
12053
12102
|
});
|
|
@@ -12058,8 +12107,8 @@ __export(exports_buildReactVendor, {
|
|
|
12058
12107
|
computeVendorPaths: () => computeVendorPaths,
|
|
12059
12108
|
buildReactVendor: () => buildReactVendor
|
|
12060
12109
|
});
|
|
12061
|
-
import { existsSync as
|
|
12062
|
-
import { join as
|
|
12110
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync6 } from "fs";
|
|
12111
|
+
import { join as join17, resolve as resolve17 } from "path";
|
|
12063
12112
|
import { rm as rm4 } from "fs/promises";
|
|
12064
12113
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
12065
12114
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
@@ -12072,7 +12121,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
12072
12121
|
resolve17(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
12073
12122
|
];
|
|
12074
12123
|
for (const candidate of candidates) {
|
|
12075
|
-
if (
|
|
12124
|
+
if (existsSync18(candidate)) {
|
|
12076
12125
|
return candidate.replace(/\\/g, "/");
|
|
12077
12126
|
}
|
|
12078
12127
|
}
|
|
@@ -12113,14 +12162,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
12113
12162
|
`)}
|
|
12114
12163
|
`;
|
|
12115
12164
|
}, buildReactVendor = async (buildDir) => {
|
|
12116
|
-
const vendorDir =
|
|
12165
|
+
const vendorDir = join17(buildDir, "react", "vendor");
|
|
12117
12166
|
mkdirSync6(vendorDir, { recursive: true });
|
|
12118
|
-
const tmpDir =
|
|
12167
|
+
const tmpDir = join17(buildDir, "_vendor_tmp");
|
|
12119
12168
|
mkdirSync6(tmpDir, { recursive: true });
|
|
12120
12169
|
const specifiers = resolveVendorSpecifiers();
|
|
12121
12170
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12122
12171
|
const safeName = toSafeFileName(specifier);
|
|
12123
|
-
const entryPath =
|
|
12172
|
+
const entryPath = join17(tmpDir, `${safeName}.ts`);
|
|
12124
12173
|
const source = await generateEntrySource(specifier);
|
|
12125
12174
|
await Bun.write(entryPath, source);
|
|
12126
12175
|
return entryPath;
|
|
@@ -12165,7 +12214,7 @@ __export(exports_buildAngularVendor, {
|
|
|
12165
12214
|
buildAngularVendor: () => buildAngularVendor
|
|
12166
12215
|
});
|
|
12167
12216
|
import { mkdirSync as mkdirSync7 } from "fs";
|
|
12168
|
-
import { join as
|
|
12217
|
+
import { join as join18 } from "path";
|
|
12169
12218
|
import { rm as rm5 } from "fs/promises";
|
|
12170
12219
|
var {build: bunBuild3, Glob: Glob6 } = globalThis.Bun;
|
|
12171
12220
|
var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS, isResolvable2 = (specifier) => {
|
|
@@ -12202,7 +12251,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
|
|
|
12202
12251
|
}
|
|
12203
12252
|
return { angular, transitiveRoots };
|
|
12204
12253
|
}, collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
12205
|
-
const { readFileSync:
|
|
12254
|
+
const { readFileSync: readFileSync12 } = await import("fs");
|
|
12206
12255
|
const transpiler4 = new Bun.Transpiler({ loader: "js" });
|
|
12207
12256
|
const visited = new Set;
|
|
12208
12257
|
const frontier = [];
|
|
@@ -12223,7 +12272,7 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
|
|
|
12223
12272
|
}
|
|
12224
12273
|
let content;
|
|
12225
12274
|
try {
|
|
12226
|
-
content =
|
|
12275
|
+
content = readFileSync12(resolved, "utf-8");
|
|
12227
12276
|
} catch {
|
|
12228
12277
|
continue;
|
|
12229
12278
|
}
|
|
@@ -12258,14 +12307,14 @@ var REQUIRED_ANGULAR_SPECIFIERS, SERVER_ONLY_ANGULAR_SPECIFIERS, SCAN_SKIP_DIRS,
|
|
|
12258
12307
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
12259
12308
|
return Array.from(angular).filter(isResolvable2);
|
|
12260
12309
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
12261
|
-
const vendorDir =
|
|
12310
|
+
const vendorDir = join18(buildDir, "angular", "vendor");
|
|
12262
12311
|
mkdirSync7(vendorDir, { recursive: true });
|
|
12263
|
-
const tmpDir =
|
|
12312
|
+
const tmpDir = join18(buildDir, "_angular_vendor_tmp");
|
|
12264
12313
|
mkdirSync7(tmpDir, { recursive: true });
|
|
12265
12314
|
const specifiers = await resolveAngularSpecifiers(directories);
|
|
12266
12315
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12267
12316
|
const safeName = toSafeFileName2(specifier);
|
|
12268
|
-
const entryPath =
|
|
12317
|
+
const entryPath = join18(tmpDir, `${safeName}.ts`);
|
|
12269
12318
|
await Bun.write(entryPath, generateVendorEntrySource(specifier));
|
|
12270
12319
|
return entryPath;
|
|
12271
12320
|
}));
|
|
@@ -12326,17 +12375,17 @@ __export(exports_buildVueVendor, {
|
|
|
12326
12375
|
buildVueVendor: () => buildVueVendor
|
|
12327
12376
|
});
|
|
12328
12377
|
import { mkdirSync as mkdirSync8 } from "fs";
|
|
12329
|
-
import { join as
|
|
12378
|
+
import { join as join19 } from "path";
|
|
12330
12379
|
import { rm as rm6 } from "fs/promises";
|
|
12331
12380
|
var {build: bunBuild4 } = globalThis.Bun;
|
|
12332
12381
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
12333
|
-
const vendorDir =
|
|
12382
|
+
const vendorDir = join19(buildDir, "vue", "vendor");
|
|
12334
12383
|
mkdirSync8(vendorDir, { recursive: true });
|
|
12335
|
-
const tmpDir =
|
|
12384
|
+
const tmpDir = join19(buildDir, "_vue_vendor_tmp");
|
|
12336
12385
|
mkdirSync8(tmpDir, { recursive: true });
|
|
12337
12386
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
12338
12387
|
const safeName = toSafeFileName3(specifier);
|
|
12339
|
-
const entryPath =
|
|
12388
|
+
const entryPath = join19(tmpDir, `${safeName}.ts`);
|
|
12340
12389
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
12341
12390
|
`);
|
|
12342
12391
|
return entryPath;
|
|
@@ -12361,11 +12410,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
12361
12410
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
12362
12411
|
return;
|
|
12363
12412
|
}
|
|
12364
|
-
const { readFileSync:
|
|
12413
|
+
const { readFileSync: readFileSync12, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
12365
12414
|
const files = readdirSync(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
12366
12415
|
for (const file3 of files) {
|
|
12367
|
-
const filePath =
|
|
12368
|
-
const content =
|
|
12416
|
+
const filePath = join19(vendorDir, file3);
|
|
12417
|
+
const content = readFileSync12(filePath, "utf-8");
|
|
12369
12418
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
12370
12419
|
continue;
|
|
12371
12420
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -12391,7 +12440,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
12391
12440
|
buildSvelteVendor: () => buildSvelteVendor
|
|
12392
12441
|
});
|
|
12393
12442
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
12394
|
-
import { join as
|
|
12443
|
+
import { join as join20 } from "path";
|
|
12395
12444
|
import { rm as rm7 } from "fs/promises";
|
|
12396
12445
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
12397
12446
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
@@ -12405,13 +12454,13 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
12405
12454
|
const specifiers = resolveVendorSpecifiers2();
|
|
12406
12455
|
if (specifiers.length === 0)
|
|
12407
12456
|
return;
|
|
12408
|
-
const vendorDir =
|
|
12457
|
+
const vendorDir = join20(buildDir, "svelte", "vendor");
|
|
12409
12458
|
mkdirSync9(vendorDir, { recursive: true });
|
|
12410
|
-
const tmpDir =
|
|
12459
|
+
const tmpDir = join20(buildDir, "_svelte_vendor_tmp");
|
|
12411
12460
|
mkdirSync9(tmpDir, { recursive: true });
|
|
12412
12461
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12413
12462
|
const safeName = toSafeFileName4(specifier);
|
|
12414
|
-
const entryPath =
|
|
12463
|
+
const entryPath = join20(tmpDir, `${safeName}.ts`);
|
|
12415
12464
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
12416
12465
|
`);
|
|
12417
12466
|
return entryPath;
|
|
@@ -12484,11 +12533,11 @@ var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewrit
|
|
|
12484
12533
|
if (Object.keys(vendorPaths).length === 0)
|
|
12485
12534
|
return;
|
|
12486
12535
|
const { readdirSync } = await import("fs");
|
|
12487
|
-
const { join:
|
|
12536
|
+
const { join: join21 } = await import("path");
|
|
12488
12537
|
const allFiles = [];
|
|
12489
12538
|
for (const dir of vendorDirs) {
|
|
12490
12539
|
try {
|
|
12491
|
-
const files = readdirSync(dir).filter((f2) => f2.endsWith(".js")).map((f2) =>
|
|
12540
|
+
const files = readdirSync(dir).filter((f2) => f2.endsWith(".js")).map((f2) => join21(dir, f2));
|
|
12492
12541
|
allFiles.push(...files);
|
|
12493
12542
|
} catch {}
|
|
12494
12543
|
}
|
|
@@ -12557,14 +12606,14 @@ var init_rewriteImports = __esm(() => {
|
|
|
12557
12606
|
import {
|
|
12558
12607
|
copyFileSync,
|
|
12559
12608
|
cpSync,
|
|
12560
|
-
existsSync as
|
|
12609
|
+
existsSync as existsSync19,
|
|
12561
12610
|
mkdirSync as mkdirSync10,
|
|
12562
|
-
readFileSync as
|
|
12611
|
+
readFileSync as readFileSync12,
|
|
12563
12612
|
rmSync as rmSync2,
|
|
12564
12613
|
statSync,
|
|
12565
12614
|
writeFileSync as writeFileSync7
|
|
12566
12615
|
} from "fs";
|
|
12567
|
-
import { basename as basename7, dirname as dirname12, join as
|
|
12616
|
+
import { basename as basename7, dirname as dirname12, join as join21, relative as relative10, resolve as resolve18 } from "path";
|
|
12568
12617
|
import { cwd, env as env2, exit } from "process";
|
|
12569
12618
|
var {build: bunBuild6, Glob: Glob7 } = globalThis.Bun;
|
|
12570
12619
|
var isDev, isBuildTraceEnabled = () => {
|
|
@@ -12642,8 +12691,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
12642
12691
|
mkdirSync10(htmxDestDir, { recursive: true });
|
|
12643
12692
|
const glob = new Glob7("htmx*.min.js");
|
|
12644
12693
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
12645
|
-
const src =
|
|
12646
|
-
const dest =
|
|
12694
|
+
const src = join21(htmxDir, relPath);
|
|
12695
|
+
const dest = join21(htmxDestDir, "htmx.min.js");
|
|
12647
12696
|
copyFileSync(src, dest);
|
|
12648
12697
|
return;
|
|
12649
12698
|
}
|
|
@@ -12687,7 +12736,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
12687
12736
|
addWorkerPathIfExists(file3, relPath, workerPaths);
|
|
12688
12737
|
}
|
|
12689
12738
|
}, collectWorkerPathsFromFile = (file3, patterns, workerPaths) => {
|
|
12690
|
-
const content =
|
|
12739
|
+
const content = readFileSync12(file3, "utf-8");
|
|
12691
12740
|
for (const pattern of patterns) {
|
|
12692
12741
|
collectWorkerPathsFromContent(content, pattern, file3, workerPaths);
|
|
12693
12742
|
}
|
|
@@ -12718,7 +12767,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
12718
12767
|
vuePagesPath
|
|
12719
12768
|
}) => {
|
|
12720
12769
|
const { readdirSync: readDir } = await import("fs");
|
|
12721
|
-
const devIndexDir =
|
|
12770
|
+
const devIndexDir = join21(buildPath, "_src_indexes");
|
|
12722
12771
|
mkdirSync10(devIndexDir, { recursive: true });
|
|
12723
12772
|
if (reactIndexesPath && reactPagesPath) {
|
|
12724
12773
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -12730,41 +12779,41 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
12730
12779
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
12731
12780
|
}
|
|
12732
12781
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
12733
|
-
if (!
|
|
12782
|
+
if (!existsSync19(reactIndexesPath)) {
|
|
12734
12783
|
return;
|
|
12735
12784
|
}
|
|
12736
12785
|
const indexFiles = readDir(reactIndexesPath).filter((file3) => file3.endsWith(".tsx"));
|
|
12737
12786
|
const pagesRel = relative10(process.cwd(), resolve18(reactPagesPath)).replace(/\\/g, "/");
|
|
12738
12787
|
for (const file3 of indexFiles) {
|
|
12739
|
-
let content =
|
|
12788
|
+
let content = readFileSync12(join21(reactIndexesPath, file3), "utf-8");
|
|
12740
12789
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
12741
|
-
writeFileSync7(
|
|
12790
|
+
writeFileSync7(join21(devIndexDir, file3), content);
|
|
12742
12791
|
}
|
|
12743
12792
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
12744
|
-
const svelteIndexDir =
|
|
12793
|
+
const svelteIndexDir = join21(svelteDir, "generated", "indexes");
|
|
12745
12794
|
const sveltePageEntries = svelteEntries.filter((file3) => resolve18(file3).startsWith(resolve18(sveltePagesPath)));
|
|
12746
12795
|
for (const entry of sveltePageEntries) {
|
|
12747
12796
|
const name = basename7(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
12748
|
-
const indexFile =
|
|
12749
|
-
if (!
|
|
12797
|
+
const indexFile = join21(svelteIndexDir, "pages", `${name}.js`);
|
|
12798
|
+
if (!existsSync19(indexFile))
|
|
12750
12799
|
continue;
|
|
12751
|
-
let content =
|
|
12800
|
+
let content = readFileSync12(indexFile, "utf-8");
|
|
12752
12801
|
const srcRel = relative10(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
12753
12802
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
12754
|
-
writeFileSync7(
|
|
12803
|
+
writeFileSync7(join21(devIndexDir, `${name}.svelte.js`), content);
|
|
12755
12804
|
}
|
|
12756
12805
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
12757
|
-
const vueIndexDir =
|
|
12806
|
+
const vueIndexDir = join21(vueDir, "generated", "indexes");
|
|
12758
12807
|
const vuePageEntries = vueEntries.filter((file3) => resolve18(file3).startsWith(resolve18(vuePagesPath)));
|
|
12759
12808
|
for (const entry of vuePageEntries) {
|
|
12760
12809
|
const name = basename7(entry, ".vue");
|
|
12761
|
-
const indexFile =
|
|
12762
|
-
if (!
|
|
12810
|
+
const indexFile = join21(vueIndexDir, `${name}.js`);
|
|
12811
|
+
if (!existsSync19(indexFile))
|
|
12763
12812
|
continue;
|
|
12764
|
-
let content =
|
|
12813
|
+
let content = readFileSync12(indexFile, "utf-8");
|
|
12765
12814
|
const srcRel = relative10(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
12766
12815
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
12767
|
-
writeFileSync7(
|
|
12816
|
+
writeFileSync7(join21(devIndexDir, `${name}.vue.js`), content);
|
|
12768
12817
|
}
|
|
12769
12818
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
12770
12819
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -12812,7 +12861,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
12812
12861
|
}
|
|
12813
12862
|
return result;
|
|
12814
12863
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
12815
|
-
let content =
|
|
12864
|
+
let content = readFileSync12(outputPath, "utf-8");
|
|
12816
12865
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
12817
12866
|
const useNames = [];
|
|
12818
12867
|
let match;
|
|
@@ -12862,7 +12911,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
12862
12911
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
12863
12912
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
12864
12913
|
for (const outputPath of outputPaths) {
|
|
12865
|
-
let content =
|
|
12914
|
+
let content = readFileSync12(outputPath, "utf-8");
|
|
12866
12915
|
let changed = false;
|
|
12867
12916
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
12868
12917
|
const targetName = basename7(relPath);
|
|
@@ -12981,10 +13030,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
12981
13030
|
restoreTracePhase();
|
|
12982
13031
|
return;
|
|
12983
13032
|
}
|
|
12984
|
-
const traceDir =
|
|
13033
|
+
const traceDir = join21(buildPath2, ".absolute-trace");
|
|
12985
13034
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
12986
13035
|
mkdirSync10(traceDir, { recursive: true });
|
|
12987
|
-
writeFileSync7(
|
|
13036
|
+
writeFileSync7(join21(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
12988
13037
|
events: traceEvents,
|
|
12989
13038
|
frameworks: traceFrameworkNames,
|
|
12990
13039
|
generatedAt: new Date().toISOString(),
|
|
@@ -13014,14 +13063,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13014
13063
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
13015
13064
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
13016
13065
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
13017
|
-
const reactIndexesPath = reactDir &&
|
|
13018
|
-
const reactPagesPath = reactDir &&
|
|
13019
|
-
const htmlPagesPath = htmlDir &&
|
|
13020
|
-
const htmlScriptsPath = htmlDir &&
|
|
13021
|
-
const sveltePagesPath = svelteDir &&
|
|
13022
|
-
const vuePagesPath = vueDir &&
|
|
13023
|
-
const htmxPagesPath = htmxDir &&
|
|
13024
|
-
const angularPagesPath = angularDir &&
|
|
13066
|
+
const reactIndexesPath = reactDir && join21(reactDir, "generated", "indexes");
|
|
13067
|
+
const reactPagesPath = reactDir && join21(reactDir, "pages");
|
|
13068
|
+
const htmlPagesPath = htmlDir && join21(htmlDir, "pages");
|
|
13069
|
+
const htmlScriptsPath = htmlDir && join21(htmlDir, "scripts");
|
|
13070
|
+
const sveltePagesPath = svelteDir && join21(svelteDir, "pages");
|
|
13071
|
+
const vuePagesPath = vueDir && join21(vueDir, "pages");
|
|
13072
|
+
const htmxPagesPath = htmxDir && join21(htmxDir, "pages");
|
|
13073
|
+
const angularPagesPath = angularDir && join21(angularDir, "pages");
|
|
13025
13074
|
const frontends = [
|
|
13026
13075
|
reactDir,
|
|
13027
13076
|
htmlDir,
|
|
@@ -13059,12 +13108,12 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13059
13108
|
if (svelteDir)
|
|
13060
13109
|
serverDirMap.push({
|
|
13061
13110
|
dir: svelteDir,
|
|
13062
|
-
subdir:
|
|
13111
|
+
subdir: join21("generated", "server")
|
|
13063
13112
|
});
|
|
13064
13113
|
if (vueDir)
|
|
13065
13114
|
serverDirMap.push({
|
|
13066
13115
|
dir: vueDir,
|
|
13067
|
-
subdir:
|
|
13116
|
+
subdir: join21("generated", "server")
|
|
13068
13117
|
});
|
|
13069
13118
|
if (angularDir)
|
|
13070
13119
|
serverDirMap.push({ dir: angularDir, subdir: "generated" });
|
|
@@ -13074,8 +13123,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13074
13123
|
const [firstEntry] = serverDirMap;
|
|
13075
13124
|
if (!firstEntry)
|
|
13076
13125
|
throw new Error("Expected at least one server directory entry");
|
|
13077
|
-
serverRoot =
|
|
13078
|
-
serverOutDir =
|
|
13126
|
+
serverRoot = join21(firstEntry.dir, firstEntry.subdir);
|
|
13127
|
+
serverOutDir = join21(buildPath, basename7(firstEntry.dir));
|
|
13079
13128
|
} else if (serverDirMap.length > 1) {
|
|
13080
13129
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
13081
13130
|
serverOutDir = buildPath;
|
|
@@ -13103,7 +13152,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13103
13152
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
13104
13153
|
}
|
|
13105
13154
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
13106
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
13155
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join21(buildPath, "assets"), {
|
|
13107
13156
|
force: true,
|
|
13108
13157
|
recursive: true
|
|
13109
13158
|
}));
|
|
@@ -13152,7 +13201,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13152
13201
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
13153
13202
|
if (entry.startsWith(resolve18(reactIndexesPath))) {
|
|
13154
13203
|
const pageName = basename7(entry, ".tsx");
|
|
13155
|
-
return
|
|
13204
|
+
return join21(reactPagesPath, `${pageName}.tsx`);
|
|
13156
13205
|
}
|
|
13157
13206
|
return null;
|
|
13158
13207
|
}) : allReactEntries;
|
|
@@ -13249,7 +13298,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13249
13298
|
const compileReactConventions = async () => {
|
|
13250
13299
|
if (reactConventionSources.length === 0)
|
|
13251
13300
|
return emptyStringArray;
|
|
13252
|
-
const destDir =
|
|
13301
|
+
const destDir = join21(buildPath, "conventions", "react");
|
|
13253
13302
|
rmSync2(destDir, { force: true, recursive: true });
|
|
13254
13303
|
mkdirSync10(destDir, { recursive: true });
|
|
13255
13304
|
const destPaths = [];
|
|
@@ -13293,7 +13342,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13293
13342
|
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 }
|
|
13294
13343
|
]);
|
|
13295
13344
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
13296
|
-
const destDir =
|
|
13345
|
+
const destDir = join21(buildPath, "conventions", framework);
|
|
13297
13346
|
rmSync2(destDir, { force: true, recursive: true });
|
|
13298
13347
|
mkdirSync10(destDir, { recursive: true });
|
|
13299
13348
|
const destPaths = [];
|
|
@@ -13366,7 +13415,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13366
13415
|
}
|
|
13367
13416
|
})) : {
|
|
13368
13417
|
entries: [],
|
|
13369
|
-
generatedRoot:
|
|
13418
|
+
generatedRoot: join21(buildPath, "_island_entries")
|
|
13370
13419
|
};
|
|
13371
13420
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
13372
13421
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -13402,7 +13451,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13402
13451
|
return {};
|
|
13403
13452
|
}
|
|
13404
13453
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
13405
|
-
const refreshEntry =
|
|
13454
|
+
const refreshEntry = join21(reactIndexesPath, "_refresh.tsx");
|
|
13406
13455
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
13407
13456
|
reactClientEntryPoints.push(refreshEntry);
|
|
13408
13457
|
}
|
|
@@ -13472,19 +13521,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13472
13521
|
throw: false
|
|
13473
13522
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
13474
13523
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
13475
|
-
rmSync2(
|
|
13524
|
+
rmSync2(join21(buildPath, "react", "generated", "indexes"), {
|
|
13476
13525
|
force: true,
|
|
13477
13526
|
recursive: true
|
|
13478
13527
|
});
|
|
13479
13528
|
}
|
|
13480
13529
|
if (angularDir && angularClientPaths.length > 0) {
|
|
13481
|
-
rmSync2(
|
|
13530
|
+
rmSync2(join21(buildPath, "angular", "indexes"), {
|
|
13482
13531
|
force: true,
|
|
13483
13532
|
recursive: true
|
|
13484
13533
|
});
|
|
13485
13534
|
}
|
|
13486
13535
|
if (islandClientEntryPoints.length > 0) {
|
|
13487
|
-
rmSync2(
|
|
13536
|
+
rmSync2(join21(buildPath, "islands"), {
|
|
13488
13537
|
force: true,
|
|
13489
13538
|
recursive: true
|
|
13490
13539
|
});
|
|
@@ -13550,7 +13599,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13550
13599
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild6(mergeBunBuildConfig({
|
|
13551
13600
|
entrypoints: globalCssEntries,
|
|
13552
13601
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
13553
|
-
outdir: stylesDir ?
|
|
13602
|
+
outdir: stylesDir ? join21(buildPath, basename7(stylesDir)) : buildPath,
|
|
13554
13603
|
plugins: [stylePreprocessorPlugin2],
|
|
13555
13604
|
root: stylesDir || clientRoot,
|
|
13556
13605
|
target: "browser",
|
|
@@ -13559,7 +13608,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13559
13608
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild6(mergeBunBuildConfig({
|
|
13560
13609
|
entrypoints: vueCssPaths,
|
|
13561
13610
|
naming: `[name].[hash].[ext]`,
|
|
13562
|
-
outdir:
|
|
13611
|
+
outdir: join21(buildPath, assetsPath ? basename7(assetsPath) : "assets", "css"),
|
|
13563
13612
|
target: "browser",
|
|
13564
13613
|
throw: false
|
|
13565
13614
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -13681,7 +13730,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13681
13730
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
13682
13731
|
if (!hmrClientBundle)
|
|
13683
13732
|
return;
|
|
13684
|
-
let html =
|
|
13733
|
+
let html = readFileSync12(filePath, "utf-8");
|
|
13685
13734
|
if (html.includes("data-hmr-client"))
|
|
13686
13735
|
return;
|
|
13687
13736
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -13692,7 +13741,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13692
13741
|
const processHtmlPages = async () => {
|
|
13693
13742
|
if (!(htmlDir && htmlPagesPath))
|
|
13694
13743
|
return;
|
|
13695
|
-
const outputHtmlPages = isSingle ?
|
|
13744
|
+
const outputHtmlPages = isSingle ? join21(buildPath, "pages") : join21(buildPath, basename7(htmlDir), "pages");
|
|
13696
13745
|
mkdirSync10(outputHtmlPages, { recursive: true });
|
|
13697
13746
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
13698
13747
|
force: true,
|
|
@@ -13714,14 +13763,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13714
13763
|
const processHtmxPages = async () => {
|
|
13715
13764
|
if (!(htmxDir && htmxPagesPath))
|
|
13716
13765
|
return;
|
|
13717
|
-
const outputHtmxPages = isSingle ?
|
|
13766
|
+
const outputHtmxPages = isSingle ? join21(buildPath, "pages") : join21(buildPath, basename7(htmxDir), "pages");
|
|
13718
13767
|
mkdirSync10(outputHtmxPages, { recursive: true });
|
|
13719
13768
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
13720
13769
|
force: true,
|
|
13721
13770
|
recursive: true
|
|
13722
13771
|
});
|
|
13723
13772
|
if (shouldCopyHtmx) {
|
|
13724
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
13773
|
+
const htmxDestDir = isSingle ? buildPath : join21(buildPath, basename7(htmxDir));
|
|
13725
13774
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
13726
13775
|
}
|
|
13727
13776
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -13782,9 +13831,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
13782
13831
|
writeBuildTrace(buildPath);
|
|
13783
13832
|
return { conventions: conventionsMap, manifest };
|
|
13784
13833
|
}
|
|
13785
|
-
writeFileSync7(
|
|
13834
|
+
writeFileSync7(join21(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
13786
13835
|
if (Object.keys(conventionsMap).length > 0) {
|
|
13787
|
-
writeFileSync7(
|
|
13836
|
+
writeFileSync7(join21(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
13788
13837
|
}
|
|
13789
13838
|
writeBuildTrace(buildPath);
|
|
13790
13839
|
if (tailwind && mode === "production") {
|
|
@@ -13873,7 +13922,7 @@ var init_build = __esm(() => {
|
|
|
13873
13922
|
});
|
|
13874
13923
|
|
|
13875
13924
|
// src/dev/dependencyGraph.ts
|
|
13876
|
-
import { existsSync as
|
|
13925
|
+
import { existsSync as existsSync20, readFileSync as readFileSync13 } from "fs";
|
|
13877
13926
|
var {Glob: Glob8 } = globalThis.Bun;
|
|
13878
13927
|
import { resolve as resolve19 } from "path";
|
|
13879
13928
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -13903,10 +13952,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
13903
13952
|
];
|
|
13904
13953
|
for (const ext of extensions) {
|
|
13905
13954
|
const withExt = normalized + ext;
|
|
13906
|
-
if (
|
|
13955
|
+
if (existsSync20(withExt))
|
|
13907
13956
|
return withExt;
|
|
13908
13957
|
}
|
|
13909
|
-
if (
|
|
13958
|
+
if (existsSync20(normalized))
|
|
13910
13959
|
return normalized;
|
|
13911
13960
|
return null;
|
|
13912
13961
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -13921,7 +13970,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
13921
13970
|
}
|
|
13922
13971
|
}, addFileToGraph = (graph, filePath) => {
|
|
13923
13972
|
const normalizedPath = resolve19(filePath);
|
|
13924
|
-
if (!
|
|
13973
|
+
if (!existsSync20(normalizedPath))
|
|
13925
13974
|
return;
|
|
13926
13975
|
const dependencies = extractDependencies(normalizedPath);
|
|
13927
13976
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -13937,7 +13986,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
13937
13986
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
13938
13987
|
const processedFiles = new Set;
|
|
13939
13988
|
const glob = new Glob8("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
13940
|
-
const resolvedDirs = directories.map((dir) => resolve19(dir)).filter((dir) =>
|
|
13989
|
+
const resolvedDirs = directories.map((dir) => resolve19(dir)).filter((dir) => existsSync20(dir));
|
|
13941
13990
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
13942
13991
|
for (const file3 of allFiles) {
|
|
13943
13992
|
const fullPath = resolve19(file3);
|
|
@@ -14034,15 +14083,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
14034
14083
|
const lowerPath = filePath.toLowerCase();
|
|
14035
14084
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
14036
14085
|
if (loader === "html") {
|
|
14037
|
-
const content =
|
|
14086
|
+
const content = readFileSync13(filePath, "utf-8");
|
|
14038
14087
|
return extractHtmlDependencies(filePath, content);
|
|
14039
14088
|
}
|
|
14040
14089
|
if (loader === "tsx" || loader === "js") {
|
|
14041
|
-
const content =
|
|
14090
|
+
const content = readFileSync13(filePath, "utf-8");
|
|
14042
14091
|
return extractJsDependencies(filePath, content, loader);
|
|
14043
14092
|
}
|
|
14044
14093
|
if (isSvelteOrVue) {
|
|
14045
|
-
const content =
|
|
14094
|
+
const content = readFileSync13(filePath, "utf-8");
|
|
14046
14095
|
return extractSvelteVueDependencies(filePath, content);
|
|
14047
14096
|
}
|
|
14048
14097
|
return [];
|
|
@@ -14330,8 +14379,8 @@ var init_pathUtils = __esm(() => {
|
|
|
14330
14379
|
|
|
14331
14380
|
// src/dev/fileWatcher.ts
|
|
14332
14381
|
import { watch } from "fs";
|
|
14333
|
-
import { existsSync as
|
|
14334
|
-
import { join as
|
|
14382
|
+
import { existsSync as existsSync21 } from "fs";
|
|
14383
|
+
import { join as join22, resolve as resolve21 } from "path";
|
|
14335
14384
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
14336
14385
|
try {
|
|
14337
14386
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -14358,16 +14407,16 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
14358
14407
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
14359
14408
|
return;
|
|
14360
14409
|
}
|
|
14361
|
-
const fullPath =
|
|
14410
|
+
const fullPath = join22(absolutePath, filename).replace(/\\/g, "/");
|
|
14362
14411
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
14363
14412
|
return;
|
|
14364
14413
|
}
|
|
14365
|
-
if (event === "rename" && !
|
|
14414
|
+
if (event === "rename" && !existsSync21(fullPath)) {
|
|
14366
14415
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
14367
14416
|
onFileChange(fullPath);
|
|
14368
14417
|
return;
|
|
14369
14418
|
}
|
|
14370
|
-
if (
|
|
14419
|
+
if (existsSync21(fullPath)) {
|
|
14371
14420
|
onFileChange(fullPath);
|
|
14372
14421
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
14373
14422
|
}
|
|
@@ -14377,7 +14426,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
14377
14426
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
14378
14427
|
paths.forEach((path) => {
|
|
14379
14428
|
const absolutePath = resolve21(path).replace(/\\/g, "/");
|
|
14380
|
-
if (!
|
|
14429
|
+
if (!existsSync21(absolutePath)) {
|
|
14381
14430
|
return;
|
|
14382
14431
|
}
|
|
14383
14432
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -14388,7 +14437,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
14388
14437
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
14389
14438
|
watchPaths.forEach((path) => {
|
|
14390
14439
|
const absolutePath = resolve21(path).replace(/\\/g, "/");
|
|
14391
|
-
if (!
|
|
14440
|
+
if (!existsSync21(absolutePath)) {
|
|
14392
14441
|
return;
|
|
14393
14442
|
}
|
|
14394
14443
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -14506,7 +14555,7 @@ var init_assetStore = __esm(() => {
|
|
|
14506
14555
|
});
|
|
14507
14556
|
|
|
14508
14557
|
// src/islands/pageMetadata.ts
|
|
14509
|
-
import { readFileSync as
|
|
14558
|
+
import { readFileSync as readFileSync14 } from "fs";
|
|
14510
14559
|
import { dirname as dirname13, resolve as resolve23 } from "path";
|
|
14511
14560
|
var pagePatterns, getPageDirs = (config) => [
|
|
14512
14561
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
@@ -14548,7 +14597,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
14548
14597
|
return;
|
|
14549
14598
|
const files = await scanEntryPoints(resolve23(entry.dir), pattern);
|
|
14550
14599
|
for (const filePath of files) {
|
|
14551
|
-
const source =
|
|
14600
|
+
const source = readFileSync14(filePath, "utf-8");
|
|
14552
14601
|
const islands = extractIslandUsagesFromSource(source);
|
|
14553
14602
|
pageMetadata.set(resolve23(filePath), {
|
|
14554
14603
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
@@ -14578,10 +14627,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
14578
14627
|
});
|
|
14579
14628
|
|
|
14580
14629
|
// src/dev/fileHashTracker.ts
|
|
14581
|
-
import { readFileSync as
|
|
14630
|
+
import { readFileSync as readFileSync15 } from "fs";
|
|
14582
14631
|
var computeFileHash = (filePath) => {
|
|
14583
14632
|
try {
|
|
14584
|
-
const fileContent =
|
|
14633
|
+
const fileContent = readFileSync15(filePath);
|
|
14585
14634
|
return Number(Bun.hash(fileContent));
|
|
14586
14635
|
} catch {
|
|
14587
14636
|
return UNFOUND_INDEX;
|
|
@@ -14913,7 +14962,7 @@ __export(exports_moduleServer, {
|
|
|
14913
14962
|
createModuleServer: () => createModuleServer,
|
|
14914
14963
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
14915
14964
|
});
|
|
14916
|
-
import { existsSync as
|
|
14965
|
+
import { existsSync as existsSync22, readFileSync as readFileSync16, statSync as statSync2 } from "fs";
|
|
14917
14966
|
import { basename as basename9, dirname as dirname14, extname as extname6, resolve as resolve26, relative as relative11 } from "path";
|
|
14918
14967
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
14919
14968
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
@@ -14934,7 +14983,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
14934
14983
|
${stubs}
|
|
14935
14984
|
`;
|
|
14936
14985
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
14937
|
-
const found = extensions.find((ext) =>
|
|
14986
|
+
const found = extensions.find((ext) => existsSync22(resolve26(projectRoot, srcPath + ext)));
|
|
14938
14987
|
return found ? srcPath + found : srcPath;
|
|
14939
14988
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
14940
14989
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -15046,7 +15095,7 @@ ${stubs}
|
|
|
15046
15095
|
`)}
|
|
15047
15096
|
${code}`;
|
|
15048
15097
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
15049
|
-
const raw =
|
|
15098
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15050
15099
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
15051
15100
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
15052
15101
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -15062,7 +15111,7 @@ ${transpiled}`;
|
|
|
15062
15111
|
transpiled += buildIslandMetadataExports(raw);
|
|
15063
15112
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
15064
15113
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
15065
|
-
const raw =
|
|
15114
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15066
15115
|
const ext = extname6(filePath);
|
|
15067
15116
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
15068
15117
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -15228,7 +15277,7 @@ ${code}`;
|
|
|
15228
15277
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
15229
15278
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
15230
15279
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
15231
|
-
const raw =
|
|
15280
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15232
15281
|
if (!svelteCompiler) {
|
|
15233
15282
|
svelteCompiler = await import("svelte/compiler");
|
|
15234
15283
|
}
|
|
@@ -15288,7 +15337,7 @@ export default __script__;`;
|
|
|
15288
15337
|
return `${cssInjection}
|
|
15289
15338
|
${code}`;
|
|
15290
15339
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
15291
|
-
const raw =
|
|
15340
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15292
15341
|
if (!vueCompiler) {
|
|
15293
15342
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
15294
15343
|
}
|
|
@@ -15324,11 +15373,11 @@ ${code}`;
|
|
|
15324
15373
|
`);
|
|
15325
15374
|
return result;
|
|
15326
15375
|
}, resolveSvelteModulePath = (path) => {
|
|
15327
|
-
if (
|
|
15376
|
+
if (existsSync22(path))
|
|
15328
15377
|
return path;
|
|
15329
|
-
if (
|
|
15378
|
+
if (existsSync22(`${path}.ts`))
|
|
15330
15379
|
return `${path}.ts`;
|
|
15331
|
-
if (
|
|
15380
|
+
if (existsSync22(`${path}.js`))
|
|
15332
15381
|
return `${path}.js`;
|
|
15333
15382
|
return path;
|
|
15334
15383
|
}, jsResponse = (body) => {
|
|
@@ -15341,7 +15390,7 @@ ${code}`;
|
|
|
15341
15390
|
}
|
|
15342
15391
|
});
|
|
15343
15392
|
}, handleCssRequest = (filePath) => {
|
|
15344
|
-
const raw =
|
|
15393
|
+
const raw = readFileSync16(filePath, "utf-8");
|
|
15345
15394
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
15346
15395
|
return [
|
|
15347
15396
|
`const style = document.createElement('style');`,
|
|
@@ -15474,7 +15523,7 @@ export default {};
|
|
|
15474
15523
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
15475
15524
|
if (ext)
|
|
15476
15525
|
return { ext, filePath };
|
|
15477
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
15526
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync22(filePath + candidate));
|
|
15478
15527
|
if (!found)
|
|
15479
15528
|
return { ext, filePath };
|
|
15480
15529
|
const resolved = filePath + found;
|
|
@@ -15679,7 +15728,7 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
15679
15728
|
var init_simpleHTMXHMR = () => {};
|
|
15680
15729
|
|
|
15681
15730
|
// src/dev/rebuildTrigger.ts
|
|
15682
|
-
import { existsSync as
|
|
15731
|
+
import { existsSync as existsSync23 } from "fs";
|
|
15683
15732
|
import { basename as basename10, dirname as dirname15, relative as relative12, resolve as resolve29 } from "path";
|
|
15684
15733
|
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) => {
|
|
15685
15734
|
if (!config.tailwind)
|
|
@@ -15768,7 +15817,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
15768
15817
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
15769
15818
|
}
|
|
15770
15819
|
return { ...parsed, framework: detectedFw };
|
|
15771
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
15820
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync23(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
15772
15821
|
state.fileHashes.delete(filePathInSet);
|
|
15773
15822
|
try {
|
|
15774
15823
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
@@ -15786,7 +15835,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
15786
15835
|
if (!dependents || dependents.size === 0) {
|
|
15787
15836
|
return;
|
|
15788
15837
|
}
|
|
15789
|
-
const dependentFiles = Array.from(dependents).filter((file3) =>
|
|
15838
|
+
const dependentFiles = Array.from(dependents).filter((file3) => existsSync23(file3));
|
|
15790
15839
|
if (dependentFiles.length === 0) {
|
|
15791
15840
|
return;
|
|
15792
15841
|
}
|
|
@@ -15802,7 +15851,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
15802
15851
|
try {
|
|
15803
15852
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
15804
15853
|
affectedFiles.forEach((affectedFile) => {
|
|
15805
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
15854
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync23(affectedFile)) {
|
|
15806
15855
|
validFiles.push(affectedFile);
|
|
15807
15856
|
processedFiles.add(affectedFile);
|
|
15808
15857
|
}
|
|
@@ -15827,7 +15876,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
15827
15876
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
15828
15877
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
15829
15878
|
filePathSet.forEach((filePathInSet) => {
|
|
15830
|
-
if (!
|
|
15879
|
+
if (!existsSync23(filePathInSet)) {
|
|
15831
15880
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
15832
15881
|
return;
|
|
15833
15882
|
}
|
|
@@ -15946,7 +15995,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
15946
15995
|
return componentFile;
|
|
15947
15996
|
}
|
|
15948
15997
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
15949
|
-
if (
|
|
15998
|
+
if (existsSync23(tsCounterpart)) {
|
|
15950
15999
|
return tsCounterpart;
|
|
15951
16000
|
}
|
|
15952
16001
|
if (!graph)
|
|
@@ -16092,7 +16141,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16092
16141
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
16093
16142
|
const pageName = basename10(normalized, ".tsx");
|
|
16094
16143
|
const indexPath = resolve29(reactIndexesPath, `${pageName}.tsx`);
|
|
16095
|
-
if (!
|
|
16144
|
+
if (!existsSync23(indexPath)) {
|
|
16096
16145
|
return;
|
|
16097
16146
|
}
|
|
16098
16147
|
return indexPath;
|
|
@@ -16104,7 +16153,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
16104
16153
|
}
|
|
16105
16154
|
const pageName = basename10(dep, ".tsx");
|
|
16106
16155
|
const indexPath = resolve29(reactIndexesPath, `${pageName}.tsx`);
|
|
16107
|
-
if (
|
|
16156
|
+
if (existsSync23(indexPath) && !reactEntries.includes(indexPath)) {
|
|
16108
16157
|
reactEntries.push(indexPath);
|
|
16109
16158
|
}
|
|
16110
16159
|
});
|
|
@@ -17300,7 +17349,7 @@ __export(exports_buildDepVendor, {
|
|
|
17300
17349
|
buildDepVendor: () => buildDepVendor
|
|
17301
17350
|
});
|
|
17302
17351
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
17303
|
-
import { join as
|
|
17352
|
+
import { join as join23 } from "path";
|
|
17304
17353
|
import { rm as rm8 } from "fs/promises";
|
|
17305
17354
|
var {build: bunBuild7, Glob: Glob9 } = globalThis.Bun;
|
|
17306
17355
|
var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_"), isResolvable4 = (specifier) => {
|
|
@@ -17351,7 +17400,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17351
17400
|
framework: Array.from(framework).filter(isResolvable4)
|
|
17352
17401
|
};
|
|
17353
17402
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
17354
|
-
const { readFileSync:
|
|
17403
|
+
const { readFileSync: readFileSync17 } = await import("fs");
|
|
17355
17404
|
const transpiler4 = new Bun.Transpiler({ loader: "js" });
|
|
17356
17405
|
const newSpecs = new Set;
|
|
17357
17406
|
for (const spec of specs) {
|
|
@@ -17366,7 +17415,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17366
17415
|
}
|
|
17367
17416
|
let content;
|
|
17368
17417
|
try {
|
|
17369
|
-
content =
|
|
17418
|
+
content = readFileSync17(resolved, "utf-8");
|
|
17370
17419
|
} catch {
|
|
17371
17420
|
continue;
|
|
17372
17421
|
}
|
|
@@ -17395,7 +17444,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17395
17444
|
}, buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
17396
17445
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
17397
17446
|
const safeName = toSafeFileName5(specifier);
|
|
17398
|
-
const entryPath =
|
|
17447
|
+
const entryPath = join23(tmpDir, `${safeName}.ts`);
|
|
17399
17448
|
await Bun.write(entryPath, generateVendorEntrySource(specifier));
|
|
17400
17449
|
return entryPath;
|
|
17401
17450
|
}));
|
|
@@ -17414,9 +17463,9 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
17414
17463
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
17415
17464
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
17416
17465
|
return {};
|
|
17417
|
-
const vendorDir =
|
|
17466
|
+
const vendorDir = join23(buildDir, "vendor");
|
|
17418
17467
|
mkdirSync11(vendorDir, { recursive: true });
|
|
17419
|
-
const tmpDir =
|
|
17468
|
+
const tmpDir = join23(buildDir, "_dep_vendor_tmp");
|
|
17420
17469
|
mkdirSync11(tmpDir, { recursive: true });
|
|
17421
17470
|
const allSpecs = new Set(initialSpecs);
|
|
17422
17471
|
const alreadyScanned = new Set;
|
|
@@ -17840,5 +17889,5 @@ export {
|
|
|
17840
17889
|
build
|
|
17841
17890
|
};
|
|
17842
17891
|
|
|
17843
|
-
//# debugId=
|
|
17892
|
+
//# debugId=88D2B49420F3E55264756E2164756E21
|
|
17844
17893
|
//# sourceMappingURL=build.js.map
|