@absolutejs/absolute 0.19.0-beta.693 → 0.19.0-beta.694
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 +247 -47
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +247 -47
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +386 -186
- package/dist/build.js.map +5 -5
- package/dist/index.js +433 -233
- package/dist/index.js.map +5 -5
- package/dist/islands/index.js +219 -19
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +219 -19
- package/dist/react/index.js.map +3 -3
- package/dist/svelte/index.js +229 -29
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +224 -24
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +17 -0
- package/dist/vue/index.js +219 -19
- package/dist/vue/index.js.map +3 -3
- package/package.json +12 -7
package/dist/index.js
CHANGED
|
@@ -2502,10 +2502,12 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2502
2502
|
});
|
|
2503
2503
|
|
|
2504
2504
|
// src/build/stylePreprocessor.ts
|
|
2505
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
2505
2506
|
import { readFile } from "fs/promises";
|
|
2506
2507
|
import { createRequire } from "module";
|
|
2507
|
-
import { dirname as dirname2, extname, join as join3, resolve as resolve4 } from "path";
|
|
2508
|
-
|
|
2508
|
+
import { dirname as dirname2, extname, isAbsolute, join as join3, relative, resolve as resolve4 } from "path";
|
|
2509
|
+
import { fileURLToPath } from "url";
|
|
2510
|
+
var 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) => {
|
|
2509
2511
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2510
2512
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
2511
2513
|
return "scss";
|
|
@@ -2513,16 +2515,196 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2513
2515
|
return "sass";
|
|
2514
2516
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
2515
2517
|
return "less";
|
|
2518
|
+
if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
|
|
2519
|
+
return "stylus";
|
|
2516
2520
|
return null;
|
|
2517
2521
|
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
2518
2522
|
dirname2(filePath),
|
|
2519
2523
|
process.cwd(),
|
|
2520
2524
|
...paths.map((path) => resolve4(process.cwd(), path))
|
|
2521
|
-
],
|
|
2525
|
+
], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
|
|
2526
|
+
pattern,
|
|
2527
|
+
replacements: Array.isArray(value) ? value : [value]
|
|
2528
|
+
})), readTsconfigAliases = () => {
|
|
2529
|
+
const cwd = process.cwd();
|
|
2530
|
+
if (tsconfigAliasCache?.cwd === cwd)
|
|
2531
|
+
return tsconfigAliasCache;
|
|
2532
|
+
const tsconfigPath = resolve4(cwd, "tsconfig.json");
|
|
2533
|
+
const empty = { aliases: [], baseUrl: cwd, cwd };
|
|
2534
|
+
if (!existsSync4(tsconfigPath)) {
|
|
2535
|
+
tsconfigAliasCache = empty;
|
|
2536
|
+
return empty;
|
|
2537
|
+
}
|
|
2538
|
+
try {
|
|
2539
|
+
const parsed = JSON.parse(stripJsonComments(readFileSync3(tsconfigPath, "utf-8")));
|
|
2540
|
+
const compilerOptions = parsed.compilerOptions ?? {};
|
|
2541
|
+
const baseUrl = resolve4(cwd, compilerOptions.baseUrl ?? ".");
|
|
2542
|
+
tsconfigAliasCache = {
|
|
2543
|
+
aliases: normalizeAliasEntries(compilerOptions.paths),
|
|
2544
|
+
baseUrl,
|
|
2545
|
+
cwd
|
|
2546
|
+
};
|
|
2547
|
+
} catch {
|
|
2548
|
+
tsconfigAliasCache = empty;
|
|
2549
|
+
}
|
|
2550
|
+
return tsconfigAliasCache;
|
|
2551
|
+
}, getAliasEntries = (config) => {
|
|
2552
|
+
const tsconfig = readTsconfigAliases();
|
|
2553
|
+
return {
|
|
2554
|
+
aliases: [...normalizeAliasEntries(config?.aliases), ...tsconfig.aliases],
|
|
2555
|
+
baseUrl: tsconfig.baseUrl
|
|
2556
|
+
};
|
|
2557
|
+
}, aliasPatternToRegExp = (pattern) => new RegExp(`^${pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("(.+)")}$`), resolveAliasTargets = (specifier, config) => {
|
|
2558
|
+
const { aliases, baseUrl } = getAliasEntries(config);
|
|
2559
|
+
const targets = [];
|
|
2560
|
+
for (const alias of aliases) {
|
|
2561
|
+
const match = specifier.match(aliasPatternToRegExp(alias.pattern));
|
|
2562
|
+
if (!match)
|
|
2563
|
+
continue;
|
|
2564
|
+
const wildcard = match[1] ?? "";
|
|
2565
|
+
for (const replacement of alias.replacements) {
|
|
2566
|
+
targets.push(resolve4(baseUrl, replacement.replace("*", wildcard)));
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
return targets;
|
|
2570
|
+
}, getLanguageExtensions = (language) => {
|
|
2571
|
+
if (language === "less")
|
|
2572
|
+
return [".less", ".css"];
|
|
2573
|
+
if (language === "stylus")
|
|
2574
|
+
return [".styl", ".stylus", ".css"];
|
|
2575
|
+
return [".scss", ".sass", ".css"];
|
|
2576
|
+
}, getCandidatePaths = (basePath, language) => {
|
|
2577
|
+
const ext = extname(basePath);
|
|
2578
|
+
const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
|
|
2579
|
+
`${basePath}${extension}`,
|
|
2580
|
+
join3(basePath, `index${extension}`)
|
|
2581
|
+
]);
|
|
2582
|
+
if (language === "scss" || language === "sass") {
|
|
2583
|
+
return paths.flatMap((path) => {
|
|
2584
|
+
const dir = dirname2(path);
|
|
2585
|
+
const base = path.slice(dir.length + 1);
|
|
2586
|
+
return [path, join3(dir, `_${base}`)];
|
|
2587
|
+
});
|
|
2588
|
+
}
|
|
2589
|
+
return paths;
|
|
2590
|
+
}, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
|
|
2591
|
+
const rawCandidates = [
|
|
2592
|
+
...resolveAliasTargets(specifier, config),
|
|
2593
|
+
isAbsolute(specifier) ? specifier : resolve4(fromDirectory, specifier),
|
|
2594
|
+
...loadPaths.map((path) => resolve4(path, specifier))
|
|
2595
|
+
];
|
|
2596
|
+
for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
|
|
2597
|
+
if (existsSync4(candidate))
|
|
2598
|
+
return candidate;
|
|
2599
|
+
}
|
|
2600
|
+
return null;
|
|
2601
|
+
}, isExternalCssUrl = (url) => /^(?:[a-z][a-z0-9+.-]*:|\/\/|#|\/)/i.test(url), splitCssUrl = (url) => {
|
|
2602
|
+
const markerIndex = url.search(/[?#]/);
|
|
2603
|
+
if (markerIndex === -1)
|
|
2604
|
+
return { marker: "", path: url };
|
|
2605
|
+
return {
|
|
2606
|
+
marker: url.slice(markerIndex),
|
|
2607
|
+
path: url.slice(0, markerIndex)
|
|
2608
|
+
};
|
|
2609
|
+
}, rebaseCssUrls = (contents, sourceFile, entryFile) => {
|
|
2610
|
+
const sourceDir = dirname2(sourceFile);
|
|
2611
|
+
const entryDir = dirname2(entryFile);
|
|
2612
|
+
if (sourceDir === entryDir)
|
|
2613
|
+
return contents;
|
|
2614
|
+
return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
|
|
2615
|
+
const trimmedUrl = rawUrl.trim();
|
|
2616
|
+
if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
|
|
2617
|
+
return match;
|
|
2618
|
+
const { marker, path } = splitCssUrl(trimmedUrl);
|
|
2619
|
+
const rebased = relative(entryDir, resolve4(sourceDir, path)).replace(/\\/g, "/");
|
|
2620
|
+
const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
|
|
2621
|
+
const nextQuote = quote || '"';
|
|
2622
|
+
return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
|
|
2623
|
+
});
|
|
2624
|
+
}, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
|
|
2625
|
+
if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
|
|
2626
|
+
return match;
|
|
2627
|
+
const resolved = resolveImportPath(specifier, dirname2(sourceFile), loadPaths, language, config);
|
|
2628
|
+
return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
|
|
2629
|
+
}), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
|
|
2630
|
+
const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
|
|
2631
|
+
return language ? rewriteAliasedStyleImports(rebased, sourceFile, loadPaths, language, config) : rebased;
|
|
2632
|
+
}, extractCssModuleExports = (css) => {
|
|
2633
|
+
const exports = {};
|
|
2634
|
+
const nextCss = css.replace(/:export\s*\{([^}]*)\}/g, (_, body) => {
|
|
2635
|
+
for (const declaration of body.split(";")) {
|
|
2636
|
+
const separator = declaration.indexOf(":");
|
|
2637
|
+
if (separator === -1)
|
|
2638
|
+
continue;
|
|
2639
|
+
const key = declaration.slice(0, separator).trim();
|
|
2640
|
+
const value = declaration.slice(separator + 1).trim();
|
|
2641
|
+
if (key && value)
|
|
2642
|
+
exports[key] = value;
|
|
2643
|
+
}
|
|
2644
|
+
return "";
|
|
2645
|
+
});
|
|
2646
|
+
return { css: nextCss, exports };
|
|
2647
|
+
}, getSassOptions = (config, language) => ({
|
|
2522
2648
|
...config?.sass ?? {},
|
|
2523
2649
|
...language === "scss" ? config?.scss ?? {} : {}
|
|
2524
|
-
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2525
|
-
${contents}` : contents,
|
|
2650
|
+
}), getLessOptions = (config) => config?.less ?? {}, getStylusOptions = (config) => config?.stylus ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2651
|
+
${contents}` : contents, createSassImporter = (entryFile, loadPaths, language, config) => ({
|
|
2652
|
+
canonicalize(specifier, options) {
|
|
2653
|
+
const fromDirectory = options.containingUrl ? dirname2(fileURLToPath(options.containingUrl)) : dirname2(entryFile);
|
|
2654
|
+
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
2655
|
+
return resolved ? new URL(`file://${resolved}`) : null;
|
|
2656
|
+
},
|
|
2657
|
+
load(canonicalUrl) {
|
|
2658
|
+
const filePath = fileURLToPath(canonicalUrl);
|
|
2659
|
+
const fileLanguage = getStyleLanguage(filePath);
|
|
2660
|
+
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
2661
|
+
return null;
|
|
2662
|
+
return {
|
|
2663
|
+
contents: preprocessLoadedStyle(readFileSync3(filePath, "utf-8"), filePath, entryFile, loadPaths, language, config),
|
|
2664
|
+
syntax: filePath.endsWith(".sass") ? "indented" : "scss"
|
|
2665
|
+
};
|
|
2666
|
+
}
|
|
2667
|
+
}), createLessFileManager = (entryFile, loadPaths, config) => ({
|
|
2668
|
+
install(less, pluginManager) {
|
|
2669
|
+
const baseManager = new less.FileManager;
|
|
2670
|
+
const manager = Object.create(baseManager);
|
|
2671
|
+
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config));
|
|
2672
|
+
manager.loadFile = async (filename, currentDirectory) => {
|
|
2673
|
+
const resolved = resolveImportPath(filename, resolve4(currentDirectory), loadPaths, "less", config);
|
|
2674
|
+
if (!resolved) {
|
|
2675
|
+
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
2676
|
+
}
|
|
2677
|
+
return {
|
|
2678
|
+
contents: preprocessLoadedStyle(await readFile(resolved, "utf-8"), resolved, entryFile, loadPaths, "less", config),
|
|
2679
|
+
filename: resolved
|
|
2680
|
+
};
|
|
2681
|
+
};
|
|
2682
|
+
pluginManager.addFileManager(manager);
|
|
2683
|
+
}
|
|
2684
|
+
}), renderStylus = async (contents, filePath, loadPaths, options) => {
|
|
2685
|
+
let stylus;
|
|
2686
|
+
try {
|
|
2687
|
+
const stylusModule = await importOptionalPeer("stylus");
|
|
2688
|
+
stylus = stylusModule.default ?? stylusModule;
|
|
2689
|
+
} catch {
|
|
2690
|
+
throw missingDependencyError("stylus", filePath);
|
|
2691
|
+
}
|
|
2692
|
+
return new Promise((resolveCss, reject) => {
|
|
2693
|
+
const renderer = stylus(contents);
|
|
2694
|
+
renderer.set("filename", filePath);
|
|
2695
|
+
for (const [key, value] of Object.entries(options.options ?? {})) {
|
|
2696
|
+
renderer.set(key, value);
|
|
2697
|
+
}
|
|
2698
|
+
for (const path of loadPaths)
|
|
2699
|
+
renderer.include(path);
|
|
2700
|
+
renderer.render((error, css) => {
|
|
2701
|
+
if (error)
|
|
2702
|
+
reject(error);
|
|
2703
|
+
else
|
|
2704
|
+
resolveCss(css ?? "");
|
|
2705
|
+
});
|
|
2706
|
+
});
|
|
2707
|
+
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
2526
2708
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2527
2709
|
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2528
2710
|
if (language === "scss" || language === "sass") {
|
|
@@ -2535,8 +2717,12 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
2535
2717
|
throw missingDependencyError(packageName, filePath);
|
|
2536
2718
|
}
|
|
2537
2719
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2720
|
+
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
2538
2721
|
const result = sass.compileString(contents, {
|
|
2539
|
-
|
|
2722
|
+
importers: [
|
|
2723
|
+
createSassImporter(filePath, loadPaths, language, config)
|
|
2724
|
+
],
|
|
2725
|
+
loadPaths,
|
|
2540
2726
|
style: "expanded",
|
|
2541
2727
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2542
2728
|
url: new URL(`file://${filePath}`)
|
|
@@ -2556,13 +2742,24 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
2556
2742
|
if (!render)
|
|
2557
2743
|
throw missingDependencyError("less", filePath);
|
|
2558
2744
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2745
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
2559
2746
|
const result = await render(contents, {
|
|
2560
2747
|
...options.options ?? {},
|
|
2561
2748
|
filename: filePath,
|
|
2562
|
-
paths:
|
|
2749
|
+
paths: loadPaths,
|
|
2750
|
+
plugins: [
|
|
2751
|
+
...options.options?.plugins ?? [],
|
|
2752
|
+
createLessFileManager(filePath, loadPaths, config)
|
|
2753
|
+
]
|
|
2563
2754
|
});
|
|
2564
2755
|
return result.css;
|
|
2565
2756
|
}
|
|
2757
|
+
if (language === "stylus") {
|
|
2758
|
+
const options = getStylusOptions(config);
|
|
2759
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
2760
|
+
const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
|
|
2761
|
+
return renderStylus(contents, filePath, loadPaths, options);
|
|
2762
|
+
}
|
|
2566
2763
|
return rawContents;
|
|
2567
2764
|
}, createStylePreprocessorPlugin = (config) => ({
|
|
2568
2765
|
name: "absolute-style-preprocessor",
|
|
@@ -2573,21 +2770,24 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
2573
2770
|
path: path.slice("absolute-style-module:".length)
|
|
2574
2771
|
}));
|
|
2575
2772
|
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2576
|
-
const
|
|
2577
|
-
if (!
|
|
2773
|
+
const source = cssModuleSources.get(path);
|
|
2774
|
+
if (!source) {
|
|
2578
2775
|
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2579
2776
|
}
|
|
2580
2777
|
return {
|
|
2581
|
-
contents:
|
|
2778
|
+
contents: source.css,
|
|
2582
2779
|
loader: "css"
|
|
2583
2780
|
};
|
|
2584
2781
|
});
|
|
2585
2782
|
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2586
2783
|
if (isStyleModulePath(path)) {
|
|
2587
2784
|
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2588
|
-
|
|
2785
|
+
const compiled = await compileStyleSource(path, undefined, undefined, config);
|
|
2786
|
+
const { css, exports } = extractCssModuleExports(compiled);
|
|
2787
|
+
cssModuleSources.set(cssModulePath, { css, exports });
|
|
2788
|
+
const exportSource = Object.keys(exports).length > 0 ? `import styles from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)}; export default Object.assign({}, styles, ${JSON.stringify(exports)});` : `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`;
|
|
2589
2789
|
return {
|
|
2590
|
-
contents:
|
|
2790
|
+
contents: exportSource,
|
|
2591
2791
|
loader: "js"
|
|
2592
2792
|
};
|
|
2593
2793
|
}
|
|
@@ -2618,9 +2818,9 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
2618
2818
|
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2619
2819
|
};
|
|
2620
2820
|
var init_stylePreprocessor = __esm(() => {
|
|
2621
|
-
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
2622
|
-
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less)$/i;
|
|
2623
|
-
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less)$/i;
|
|
2821
|
+
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2822
|
+
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2823
|
+
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2624
2824
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2625
2825
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2626
2826
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
@@ -2629,9 +2829,9 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2629
2829
|
|
|
2630
2830
|
// src/core/svelteServerModule.ts
|
|
2631
2831
|
import { mkdir, readdir } from "fs/promises";
|
|
2632
|
-
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
2832
|
+
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative as relative2, resolve as resolve5 } from "path";
|
|
2633
2833
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2634
|
-
const importPath =
|
|
2834
|
+
const importPath = relative2(dirname3(from), target).replace(/\\/g, "/");
|
|
2635
2835
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2636
2836
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
2637
2837
|
for (const entry of entries) {
|
|
@@ -2695,7 +2895,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2695
2895
|
const foundIndex = existResults.indexOf(true);
|
|
2696
2896
|
return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
|
|
2697
2897
|
}, getCachedModulePath = (sourcePath) => {
|
|
2698
|
-
const relativeSourcePath =
|
|
2898
|
+
const relativeSourcePath = relative2(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2699
2899
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2700
2900
|
return join4(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
2701
2901
|
}, resolveSvelteImport = async (spec, from) => {
|
|
@@ -2964,7 +3164,7 @@ import {
|
|
|
2964
3164
|
rmSync,
|
|
2965
3165
|
writeFileSync as writeFileSync2
|
|
2966
3166
|
} from "fs";
|
|
2967
|
-
import { dirname as dirname4, extname as extname3, join as join5, relative as
|
|
3167
|
+
import { dirname as dirname4, extname as extname3, join as join5, relative as relative3, resolve as resolve6 } from "path";
|
|
2968
3168
|
import ts from "typescript";
|
|
2969
3169
|
var frameworks, isRecord4 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
|
|
2970
3170
|
if (isRecord4(mod.islandRegistry))
|
|
@@ -2973,7 +3173,7 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
|
|
|
2973
3173
|
return mod.default;
|
|
2974
3174
|
throw new Error("Island registry module must export `islandRegistry` or a default registry object.");
|
|
2975
3175
|
}, normalizeImportPath = (wrapperPath, targetPath) => {
|
|
2976
|
-
const importPath =
|
|
3176
|
+
const importPath = relative3(dirname4(wrapperPath), targetPath).replace(/\\/g, "/");
|
|
2977
3177
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2978
3178
|
}, isIdentifier = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value), resolveIslandSourcePath = (registryPath, sourcePath) => {
|
|
2979
3179
|
if (sourcePath.startsWith("file://")) {
|
|
@@ -3231,7 +3431,7 @@ var init_staticStreaming = __esm(() => {
|
|
|
3231
3431
|
});
|
|
3232
3432
|
|
|
3233
3433
|
// src/build/staticIslandPages.ts
|
|
3234
|
-
import { readFileSync as
|
|
3434
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
3235
3435
|
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) => {
|
|
3236
3436
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
3237
3437
|
const attributes = new Map;
|
|
@@ -3360,7 +3560,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
3360
3560
|
}
|
|
3361
3561
|
return result + originalHtml.slice(nextIndex);
|
|
3362
3562
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
3363
|
-
const originalHtml =
|
|
3563
|
+
const originalHtml = readFileSync4(pagePath, "utf-8");
|
|
3364
3564
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
3365
3565
|
if (transformedHtml !== originalHtml) {
|
|
3366
3566
|
writeFileSync3(pagePath, transformedHtml);
|
|
@@ -3396,10 +3596,10 @@ var init_staticIslandPages = __esm(() => {
|
|
|
3396
3596
|
});
|
|
3397
3597
|
|
|
3398
3598
|
// src/build/scanEntryPoints.ts
|
|
3399
|
-
import { existsSync as
|
|
3599
|
+
import { existsSync as existsSync5 } from "fs";
|
|
3400
3600
|
var {Glob } = globalThis.Bun;
|
|
3401
3601
|
var scanEntryPoints = async (dir, pattern) => {
|
|
3402
|
-
if (!
|
|
3602
|
+
if (!existsSync5(dir))
|
|
3403
3603
|
return [];
|
|
3404
3604
|
const entryPaths = [];
|
|
3405
3605
|
const glob = new Glob(pattern);
|
|
@@ -3488,7 +3688,7 @@ var init_sourceMetadata = __esm(() => {
|
|
|
3488
3688
|
});
|
|
3489
3689
|
|
|
3490
3690
|
// src/islands/pageMetadata.ts
|
|
3491
|
-
import { readFileSync as
|
|
3691
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
3492
3692
|
import { dirname as dirname5, resolve as resolve9 } from "path";
|
|
3493
3693
|
var pagePatterns, getPageDirs = (config) => [
|
|
3494
3694
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
@@ -3530,7 +3730,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
3530
3730
|
return;
|
|
3531
3731
|
const files = await scanEntryPoints(resolve9(entry.dir), pattern);
|
|
3532
3732
|
for (const filePath of files) {
|
|
3533
|
-
const source =
|
|
3733
|
+
const source = readFileSync5(filePath, "utf-8");
|
|
3534
3734
|
const islands = extractIslandUsagesFromSource(source);
|
|
3535
3735
|
pageMetadata.set(resolve9(filePath), {
|
|
3536
3736
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
@@ -3613,9 +3813,9 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
3613
3813
|
}, generateManifest = (outputs, buildPath) => outputs.reduce((manifest, artifact) => {
|
|
3614
3814
|
const normalizedArtifactPath = normalizePath(artifact.path);
|
|
3615
3815
|
const normalizedBuildPath = normalizePath(buildPath);
|
|
3616
|
-
let
|
|
3617
|
-
|
|
3618
|
-
const segments =
|
|
3816
|
+
let relative4 = normalizedArtifactPath.startsWith(normalizedBuildPath) ? normalizedArtifactPath.slice(normalizedBuildPath.length) : normalizedArtifactPath;
|
|
3817
|
+
relative4 = relative4.replace(/^\/+/, "");
|
|
3818
|
+
const segments = relative4.split("/");
|
|
3619
3819
|
const fileWithHash = segments.pop();
|
|
3620
3820
|
if (!fileWithHash)
|
|
3621
3821
|
return manifest;
|
|
@@ -3627,15 +3827,15 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
3627
3827
|
const islandIndex = segments.findIndex((seg) => seg === "islands");
|
|
3628
3828
|
if (ext === ".css") {
|
|
3629
3829
|
const cssKey = getCssKey(pascalName, segments);
|
|
3630
|
-
if (manifest[cssKey] && manifest[cssKey] !== `/${
|
|
3631
|
-
logWarn(`Duplicate manifest key "${cssKey}" \u2014 "${manifest[cssKey]}" will be overwritten by "/${
|
|
3632
|
-
manifest[cssKey] = `/${
|
|
3830
|
+
if (manifest[cssKey] && manifest[cssKey] !== `/${relative4}`)
|
|
3831
|
+
logWarn(`Duplicate manifest key "${cssKey}" \u2014 "${manifest[cssKey]}" will be overwritten by "/${relative4}". Use unique page names across frameworks.`);
|
|
3832
|
+
manifest[cssKey] = `/${relative4}`;
|
|
3633
3833
|
return manifest;
|
|
3634
3834
|
}
|
|
3635
3835
|
const frameworkSegment = islandIndex > UNFOUND_INDEX ? segments[islandIndex + 1] : undefined;
|
|
3636
3836
|
if (frameworkSegment === "react" || frameworkSegment === "svelte" || frameworkSegment === "vue" || frameworkSegment === "angular") {
|
|
3637
3837
|
const manifestKey2 = getIslandManifestKey(frameworkSegment, pascalName);
|
|
3638
|
-
manifest[manifestKey2] = `/${
|
|
3838
|
+
manifest[manifestKey2] = `/${relative4}`;
|
|
3639
3839
|
return manifest;
|
|
3640
3840
|
}
|
|
3641
3841
|
const idx = segments.findIndex((seg) => seg === "indexes" || seg === "pages" || seg === "client");
|
|
@@ -3646,10 +3846,10 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
3646
3846
|
const isAngular = segments.some((seg) => seg === "angular");
|
|
3647
3847
|
const isClientComponent = segments.includes("client");
|
|
3648
3848
|
const manifestKey = getManifestKey(folder, pascalName, isClientComponent, isReact, isVue, isSvelte, isAngular);
|
|
3649
|
-
if (manifest[manifestKey] && manifest[manifestKey] !== `/${
|
|
3650
|
-
logWarn(`Duplicate manifest key "${manifestKey}" \u2014 "${manifest[manifestKey]}" will be overwritten by "/${
|
|
3849
|
+
if (manifest[manifestKey] && manifest[manifestKey] !== `/${relative4}`) {
|
|
3850
|
+
logWarn(`Duplicate manifest key "${manifestKey}" \u2014 "${manifest[manifestKey]}" will be overwritten by "/${relative4}". Use unique page names across frameworks.`);
|
|
3651
3851
|
}
|
|
3652
|
-
manifest[manifestKey] = `/${
|
|
3852
|
+
manifest[manifestKey] = `/${relative4}`;
|
|
3653
3853
|
return manifest;
|
|
3654
3854
|
}, {});
|
|
3655
3855
|
var init_generateManifest = __esm(() => {
|
|
@@ -3662,22 +3862,22 @@ var exports_generateReactIndexes = {};
|
|
|
3662
3862
|
__export(exports_generateReactIndexes, {
|
|
3663
3863
|
generateReactIndexFiles: () => generateReactIndexFiles
|
|
3664
3864
|
});
|
|
3665
|
-
import { existsSync as
|
|
3865
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync2 } from "fs";
|
|
3666
3866
|
import { readdir as readdir2, rm, writeFile } from "fs/promises";
|
|
3667
|
-
import { basename as basename3, join as join6, relative as
|
|
3867
|
+
import { basename as basename3, join as join6, relative as relative4, resolve as resolve10, sep } from "path";
|
|
3668
3868
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
3669
3869
|
var indexContentCache, resolveDevClientDir = () => {
|
|
3670
3870
|
const projectRoot = process.cwd();
|
|
3671
3871
|
const fromSource = resolve10(import.meta.dir, "../dev/client");
|
|
3672
|
-
if (
|
|
3872
|
+
if (existsSync6(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3673
3873
|
return fromSource;
|
|
3674
3874
|
}
|
|
3675
3875
|
const fromNodeModules = resolve10(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
3676
|
-
if (
|
|
3876
|
+
if (existsSync6(fromNodeModules))
|
|
3677
3877
|
return fromNodeModules;
|
|
3678
3878
|
return resolve10(import.meta.dir, "./dev/client");
|
|
3679
3879
|
}, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
|
|
3680
|
-
if (!
|
|
3880
|
+
if (!existsSync6(reactIndexesDirectory)) {
|
|
3681
3881
|
mkdirSync2(reactIndexesDirectory, { recursive: true });
|
|
3682
3882
|
}
|
|
3683
3883
|
const CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
|
|
@@ -3703,7 +3903,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3703
3903
|
});
|
|
3704
3904
|
}));
|
|
3705
3905
|
}
|
|
3706
|
-
const pagesRelPath =
|
|
3906
|
+
const pagesRelPath = relative4(resolve10(reactIndexesDirectory), resolve10(reactPagesDirectory)).split(sep).join("/");
|
|
3707
3907
|
const promises = files.map(async (file2) => {
|
|
3708
3908
|
const fileName = basename3(file2);
|
|
3709
3909
|
const [componentName] = fileName.split(".");
|
|
@@ -3963,7 +4163,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3963
4163
|
`
|
|
3964
4164
|
// Pre-warm: import the page module from the module server`,
|
|
3965
4165
|
`// immediately so the browser caches all /@src/ URLs.`,
|
|
3966
|
-
`import('/@src/${
|
|
4166
|
+
`import('/@src/${relative4(process.cwd(), resolve10(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\/g, "/")}').catch(() => {});`
|
|
3967
4167
|
] : []
|
|
3968
4168
|
].join(`
|
|
3969
4169
|
`);
|
|
@@ -3971,7 +4171,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3971
4171
|
const hasher = new Bun.CryptoHasher("md5");
|
|
3972
4172
|
hasher.update(content);
|
|
3973
4173
|
const contentHash = hasher.digest("hex");
|
|
3974
|
-
if (indexContentCache.get(indexPath) === contentHash &&
|
|
4174
|
+
if (indexContentCache.get(indexPath) === contentHash && existsSync6(indexPath)) {
|
|
3975
4175
|
return;
|
|
3976
4176
|
}
|
|
3977
4177
|
indexContentCache.set(indexPath, contentHash);
|
|
@@ -3982,7 +4182,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3982
4182
|
return;
|
|
3983
4183
|
}
|
|
3984
4184
|
const refreshPath = join6(reactIndexesDirectory, "_refresh.tsx");
|
|
3985
|
-
if (!
|
|
4185
|
+
if (!existsSync6(refreshPath)) {
|
|
3986
4186
|
await writeFile(refreshPath, `import '${refreshSetupPath}';
|
|
3987
4187
|
import 'react';
|
|
3988
4188
|
import 'react-dom/client';
|
|
@@ -4062,7 +4262,7 @@ var init_outputLogs = __esm(() => {
|
|
|
4062
4262
|
// src/build/scanConventions.ts
|
|
4063
4263
|
import { basename as basename4 } from "path";
|
|
4064
4264
|
var {Glob: Glob3 } = globalThis.Bun;
|
|
4065
|
-
import { existsSync as
|
|
4265
|
+
import { existsSync as existsSync7 } from "fs";
|
|
4066
4266
|
var CONVENTION_RE, classifyFile = (file2, pageFiles, defaults, pages) => {
|
|
4067
4267
|
const fileName = basename4(file2);
|
|
4068
4268
|
const match = CONVENTION_RE.exec(fileName);
|
|
@@ -4087,7 +4287,7 @@ var CONVENTION_RE, classifyFile = (file2, pageFiles, defaults, pages) => {
|
|
|
4087
4287
|
else if (kind === "loading")
|
|
4088
4288
|
pages[pageName].loading = file2;
|
|
4089
4289
|
}, scanConventions = async (pagesDir, pattern) => {
|
|
4090
|
-
if (!
|
|
4290
|
+
if (!existsSync7(pagesDir)) {
|
|
4091
4291
|
const pageFiles2 = [];
|
|
4092
4292
|
return { conventions: undefined, pageFiles: pageFiles2 };
|
|
4093
4293
|
}
|
|
@@ -4110,13 +4310,13 @@ var init_scanConventions = __esm(() => {
|
|
|
4110
4310
|
});
|
|
4111
4311
|
|
|
4112
4312
|
// src/build/scanCssEntryPoints.ts
|
|
4113
|
-
import { existsSync as
|
|
4313
|
+
import { existsSync as existsSync8 } from "fs";
|
|
4114
4314
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
4115
4315
|
var scanCssEntryPoints = async (dir, ignore) => {
|
|
4116
|
-
if (!
|
|
4316
|
+
if (!existsSync8(dir))
|
|
4117
4317
|
return [];
|
|
4118
4318
|
const entryPaths = [];
|
|
4119
|
-
const glob = new Glob4("**/*.{css,scss,sass,less}");
|
|
4319
|
+
const glob = new Glob4("**/*.{css,scss,sass,less,styl,stylus}");
|
|
4120
4320
|
for await (const file2 of glob.scan({ absolute: true, cwd: dir })) {
|
|
4121
4321
|
const normalized = normalizePath(file2);
|
|
4122
4322
|
if (isStyleModulePath(normalized) || ignore?.some((pattern) => normalized.includes(pattern)))
|
|
@@ -4130,7 +4330,7 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
4130
4330
|
});
|
|
4131
4331
|
|
|
4132
4332
|
// src/utils/imageProcessing.ts
|
|
4133
|
-
import { existsSync as
|
|
4333
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
4134
4334
|
import { join as join7, resolve as resolve11 } from "path";
|
|
4135
4335
|
var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
|
|
4136
4336
|
for (const size of sizes) {
|
|
@@ -4185,7 +4385,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
4185
4385
|
return [...device, ...image2].sort((left, right) => left - right);
|
|
4186
4386
|
}, getCacheDir = (buildDir) => {
|
|
4187
4387
|
const dir = join7(buildDir, ".cache", "images");
|
|
4188
|
-
if (!
|
|
4388
|
+
if (!existsSync9(dir))
|
|
4189
4389
|
mkdirSync3(dir, { recursive: true });
|
|
4190
4390
|
return dir;
|
|
4191
4391
|
}, getCacheKey = (url, width, quality, format) => {
|
|
@@ -4243,11 +4443,11 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
4243
4443
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
4244
4444
|
const metaPath = join7(cacheDir, `${cacheKey}.meta`);
|
|
4245
4445
|
const dataPath = join7(cacheDir, `${cacheKey}.data`);
|
|
4246
|
-
if (!
|
|
4446
|
+
if (!existsSync9(metaPath) || !existsSync9(dataPath))
|
|
4247
4447
|
return null;
|
|
4248
4448
|
try {
|
|
4249
|
-
const meta = JSON.parse(
|
|
4250
|
-
const buffer =
|
|
4449
|
+
const meta = JSON.parse(readFileSync6(metaPath, "utf-8"));
|
|
4450
|
+
const buffer = readFileSync6(dataPath);
|
|
4251
4451
|
return { buffer, meta };
|
|
4252
4452
|
} catch {
|
|
4253
4453
|
return null;
|
|
@@ -4362,14 +4562,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
4362
4562
|
});
|
|
4363
4563
|
|
|
4364
4564
|
// src/cli/scripts/telemetry.ts
|
|
4365
|
-
import { existsSync as
|
|
4565
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
|
|
4366
4566
|
import { homedir } from "os";
|
|
4367
4567
|
import { join as join8 } from "path";
|
|
4368
4568
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
4369
4569
|
try {
|
|
4370
|
-
if (!
|
|
4570
|
+
if (!existsSync10(configPath))
|
|
4371
4571
|
return null;
|
|
4372
|
-
const raw =
|
|
4572
|
+
const raw = readFileSync7(configPath, "utf-8");
|
|
4373
4573
|
const config = JSON.parse(raw);
|
|
4374
4574
|
return config;
|
|
4375
4575
|
} catch {
|
|
@@ -4382,14 +4582,14 @@ var init_telemetry = __esm(() => {
|
|
|
4382
4582
|
});
|
|
4383
4583
|
|
|
4384
4584
|
// src/cli/telemetryEvent.ts
|
|
4385
|
-
import { existsSync as
|
|
4585
|
+
import { existsSync as existsSync11, readFileSync as readFileSync8 } from "fs";
|
|
4386
4586
|
import { arch, platform } from "os";
|
|
4387
4587
|
import { dirname as dirname6, join as join9, parse } from "path";
|
|
4388
4588
|
var checkCandidate = (candidate) => {
|
|
4389
|
-
if (!
|
|
4589
|
+
if (!existsSync11(candidate)) {
|
|
4390
4590
|
return null;
|
|
4391
4591
|
}
|
|
4392
|
-
const pkg = JSON.parse(
|
|
4592
|
+
const pkg = JSON.parse(readFileSync8(candidate, "utf-8"));
|
|
4393
4593
|
if (pkg.name === "@absolutejs/absolute") {
|
|
4394
4594
|
const ver = pkg.version;
|
|
4395
4595
|
return ver;
|
|
@@ -4494,17 +4694,17 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
4494
4694
|
});
|
|
4495
4695
|
|
|
4496
4696
|
// src/dev/buildHMRClient.ts
|
|
4497
|
-
import { existsSync as
|
|
4697
|
+
import { existsSync as existsSync12 } from "fs";
|
|
4498
4698
|
import { resolve as resolve12 } from "path";
|
|
4499
4699
|
var {build: bunBuild } = globalThis.Bun;
|
|
4500
4700
|
var resolveHmrClientPath = () => {
|
|
4501
4701
|
const projectRoot = process.cwd();
|
|
4502
4702
|
const fromSource = resolve12(import.meta.dir, "client/hmrClient.ts");
|
|
4503
|
-
if (
|
|
4703
|
+
if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4504
4704
|
return fromSource;
|
|
4505
4705
|
}
|
|
4506
4706
|
const fromNodeModules = resolve12(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
4507
|
-
if (
|
|
4707
|
+
if (existsSync12(fromNodeModules))
|
|
4508
4708
|
return fromNodeModules;
|
|
4509
4709
|
return resolve12(import.meta.dir, "dev/client/hmrClient.ts");
|
|
4510
4710
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
@@ -4696,8 +4896,8 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
4696
4896
|
};
|
|
4697
4897
|
|
|
4698
4898
|
// src/build/angularLinkerPlugin.ts
|
|
4699
|
-
import { existsSync as
|
|
4700
|
-
import { dirname as dirname7, join as join10, relative as
|
|
4899
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "fs";
|
|
4900
|
+
import { dirname as dirname7, join as join10, relative as relative5, resolve as resolve14 } from "path";
|
|
4701
4901
|
import { createHash } from "crypto";
|
|
4702
4902
|
var CACHE_DIR, angularLinkerPlugin;
|
|
4703
4903
|
var init_angularLinkerPlugin = __esm(() => {
|
|
@@ -4721,9 +4921,9 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4721
4921
|
}
|
|
4722
4922
|
const hash = createHash("md5").update(source).digest("hex");
|
|
4723
4923
|
const cachePath = join10(CACHE_DIR, `${hash}.js`);
|
|
4724
|
-
if (
|
|
4924
|
+
if (existsSync13(cachePath)) {
|
|
4725
4925
|
return {
|
|
4726
|
-
contents:
|
|
4926
|
+
contents: readFileSync9(cachePath, "utf-8"),
|
|
4727
4927
|
loader: "js"
|
|
4728
4928
|
};
|
|
4729
4929
|
}
|
|
@@ -4738,9 +4938,9 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4738
4938
|
linkerPlugin = mod.createEs2015LinkerPlugin({
|
|
4739
4939
|
fileSystem: {
|
|
4740
4940
|
dirname: dirname7,
|
|
4741
|
-
exists:
|
|
4742
|
-
readFile:
|
|
4743
|
-
relative:
|
|
4941
|
+
exists: existsSync13,
|
|
4942
|
+
readFile: readFileSync9,
|
|
4943
|
+
relative: relative5,
|
|
4744
4944
|
resolve: resolve14
|
|
4745
4945
|
},
|
|
4746
4946
|
linkerJitMode: false,
|
|
@@ -4781,11 +4981,11 @@ var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPath
|
|
|
4781
4981
|
const currentPaths = new Set(currentOutputPaths.map((path) => resolve15(path)));
|
|
4782
4982
|
const glob = new Glob5("**/*");
|
|
4783
4983
|
const removals = [];
|
|
4784
|
-
for (const
|
|
4785
|
-
const absolute = resolve15(buildPath,
|
|
4984
|
+
for (const relative6 of glob.scanSync({ cwd: buildPath })) {
|
|
4985
|
+
const absolute = resolve15(buildPath, relative6);
|
|
4786
4986
|
if (currentPaths.has(absolute))
|
|
4787
4987
|
continue;
|
|
4788
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
4988
|
+
if (!HASHED_FILE_PATTERN.test(relative6))
|
|
4789
4989
|
continue;
|
|
4790
4990
|
removals.push(rm2(absolute, { force: true }));
|
|
4791
4991
|
}
|
|
@@ -4843,11 +5043,11 @@ var commonAncestor = (paths, fallback) => {
|
|
|
4843
5043
|
var init_commonAncestor = () => {};
|
|
4844
5044
|
|
|
4845
5045
|
// src/utils/validateSafePath.ts
|
|
4846
|
-
import { resolve as resolve16, relative as
|
|
5046
|
+
import { resolve as resolve16, relative as relative6 } from "path";
|
|
4847
5047
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
4848
5048
|
const absoluteBase = resolve16(baseDirectory);
|
|
4849
5049
|
const absoluteTarget = resolve16(baseDirectory, targetPath);
|
|
4850
|
-
const relativePath = normalizePath(
|
|
5050
|
+
const relativePath = normalizePath(relative6(absoluteBase, absoluteTarget));
|
|
4851
5051
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
4852
5052
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
4853
5053
|
}
|
|
@@ -4916,7 +5116,7 @@ __export(exports_compileSvelte, {
|
|
|
4916
5116
|
compileSvelte: () => compileSvelte,
|
|
4917
5117
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
4918
5118
|
});
|
|
4919
|
-
import { existsSync as
|
|
5119
|
+
import { existsSync as existsSync14 } from "fs";
|
|
4920
5120
|
import { mkdir as mkdir2, stat } from "fs/promises";
|
|
4921
5121
|
import {
|
|
4922
5122
|
dirname as dirname8,
|
|
@@ -4924,7 +5124,7 @@ import {
|
|
|
4924
5124
|
basename as basename5,
|
|
4925
5125
|
extname as extname5,
|
|
4926
5126
|
resolve as resolve17,
|
|
4927
|
-
relative as
|
|
5127
|
+
relative as relative7,
|
|
4928
5128
|
sep as sep2
|
|
4929
5129
|
} from "path";
|
|
4930
5130
|
import { env as env2 } from "process";
|
|
@@ -4932,11 +5132,11 @@ var {write, file: file2, Transpiler } = globalThis.Bun;
|
|
|
4932
5132
|
var resolveDevClientDir2 = () => {
|
|
4933
5133
|
const projectRoot = process.cwd();
|
|
4934
5134
|
const fromSource = resolve17(import.meta.dir, "../dev/client");
|
|
4935
|
-
if (
|
|
5135
|
+
if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4936
5136
|
return fromSource;
|
|
4937
5137
|
}
|
|
4938
5138
|
const fromNodeModules = resolve17(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
4939
|
-
if (
|
|
5139
|
+
if (existsSync14(fromNodeModules))
|
|
4940
5140
|
return fromNodeModules;
|
|
4941
5141
|
return resolve17(import.meta.dir, "./dev/client");
|
|
4942
5142
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
@@ -5016,8 +5216,8 @@ var resolveDevClientDir2 = () => {
|
|
|
5016
5216
|
return jsPath;
|
|
5017
5217
|
return null;
|
|
5018
5218
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
5019
|
-
const toServer =
|
|
5020
|
-
const toClient =
|
|
5219
|
+
const toServer = relative7(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
5220
|
+
const toClient = relative7(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
5021
5221
|
rewrites.set(rawSpec, {
|
|
5022
5222
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
5023
5223
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -5055,8 +5255,8 @@ var resolveDevClientDir2 = () => {
|
|
|
5055
5255
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
5056
5256
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
5057
5257
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedClient) : preprocessedClient;
|
|
5058
|
-
const rawRel = dirname8(
|
|
5059
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
5258
|
+
const rawRel = dirname8(relative7(svelteRoot, src)).replace(/\\/g, "/");
|
|
5259
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative7(process.cwd(), dirname8(src)).replace(/\\/g, "/")}` : rawRel;
|
|
5060
5260
|
const baseName = basename5(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
5061
5261
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
5062
5262
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -5077,15 +5277,15 @@ var resolveDevClientDir2 = () => {
|
|
|
5077
5277
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
5078
5278
|
if (!resolved)
|
|
5079
5279
|
continue;
|
|
5080
|
-
const childRel =
|
|
5280
|
+
const childRel = relative7(svelteRoot, resolved).replace(/\\/g, "/");
|
|
5081
5281
|
if (!childRel.startsWith(".."))
|
|
5082
5282
|
continue;
|
|
5083
5283
|
const childBuilt2 = cache.get(resolved);
|
|
5084
5284
|
if (!childBuilt2)
|
|
5085
5285
|
continue;
|
|
5086
5286
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
5087
|
-
const toServer =
|
|
5088
|
-
const toClient =
|
|
5287
|
+
const toServer = relative7(ssrOutputDir, childBuilt2.ssr).replace(/\\/g, "/");
|
|
5288
|
+
const toClient = relative7(clientOutputDir, childBuilt2.client).replace(/\\/g, "/");
|
|
5089
5289
|
externalRewrites.set(origSpec, {
|
|
5090
5290
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
5091
5291
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -5120,7 +5320,7 @@ var resolveDevClientDir2 = () => {
|
|
|
5120
5320
|
}).js.code;
|
|
5121
5321
|
let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
5122
5322
|
if (mode === "client" && isDev2) {
|
|
5123
|
-
const moduleKey = `/@src/${
|
|
5323
|
+
const moduleKey = `/@src/${relative7(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
5124
5324
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
5125
5325
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
5126
5326
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -5163,10 +5363,10 @@ var resolveDevClientDir2 = () => {
|
|
|
5163
5363
|
};
|
|
5164
5364
|
const roots = await Promise.all(entryPoints.map(build2));
|
|
5165
5365
|
await Promise.all(roots.map(async ({ client: client2, hasAwaitSlot }) => {
|
|
5166
|
-
const relClientDir = dirname8(
|
|
5366
|
+
const relClientDir = dirname8(relative7(clientDir, client2));
|
|
5167
5367
|
const name = basename5(client2, extname5(client2));
|
|
5168
5368
|
const indexPath = join12(indexDir, relClientDir, `${name}.js`);
|
|
5169
|
-
const importRaw =
|
|
5369
|
+
const importRaw = relative7(dirname8(indexPath), client2).split(sep2).join("/");
|
|
5170
5370
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
5171
5371
|
const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
5172
5372
|
import "${hmrClientPath3}";
|
|
@@ -5243,7 +5443,7 @@ if (typeof window !== "undefined") {
|
|
|
5243
5443
|
return {
|
|
5244
5444
|
svelteClientPaths: roots.map(({ client: client2 }) => client2),
|
|
5245
5445
|
svelteIndexPaths: roots.map(({ client: client2 }) => {
|
|
5246
|
-
const rel = dirname8(
|
|
5446
|
+
const rel = dirname8(relative7(clientDir, client2));
|
|
5247
5447
|
return join12(indexDir, rel, basename5(client2));
|
|
5248
5448
|
}),
|
|
5249
5449
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -5273,18 +5473,18 @@ __export(exports_compileVue, {
|
|
|
5273
5473
|
compileVue: () => compileVue,
|
|
5274
5474
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
5275
5475
|
});
|
|
5276
|
-
import { existsSync as
|
|
5476
|
+
import { existsSync as existsSync15 } from "fs";
|
|
5277
5477
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
5278
|
-
import { basename as basename6, dirname as dirname9, join as join13, relative as
|
|
5478
|
+
import { basename as basename6, dirname as dirname9, join as join13, relative as relative8, resolve as resolve18 } from "path";
|
|
5279
5479
|
var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
5280
5480
|
var resolveDevClientDir3 = () => {
|
|
5281
5481
|
const projectRoot = process.cwd();
|
|
5282
5482
|
const fromSource = resolve18(import.meta.dir, "../dev/client");
|
|
5283
|
-
if (
|
|
5483
|
+
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
5284
5484
|
return fromSource;
|
|
5285
5485
|
}
|
|
5286
5486
|
const fromNodeModules = resolve18(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
5287
|
-
if (
|
|
5487
|
+
if (existsSync15(fromNodeModules))
|
|
5288
5488
|
return fromNodeModules;
|
|
5289
5489
|
return resolve18(import.meta.dir, "./dev/client");
|
|
5290
5490
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
@@ -5325,7 +5525,7 @@ var resolveDevClientDir3 = () => {
|
|
|
5325
5525
|
return "template-only";
|
|
5326
5526
|
}
|
|
5327
5527
|
return "full";
|
|
5328
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
5528
|
+
}, generateVueHmrId = (sourceFilePath, vueRootDir) => relative8(vueRootDir, sourceFilePath).replace(/\\/g, "/").replace(/\.vue$/, ""), extractImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => importPath !== undefined), toJs = (filePath) => {
|
|
5329
5529
|
if (filePath.endsWith(".vue"))
|
|
5330
5530
|
return filePath.replace(/\.vue$/, ".js");
|
|
5331
5531
|
if (filePath.endsWith(".ts"))
|
|
@@ -5352,7 +5552,7 @@ var resolveDevClientDir3 = () => {
|
|
|
5352
5552
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
5353
5553
|
if (cachedResult)
|
|
5354
5554
|
return cachedResult;
|
|
5355
|
-
const relativeFilePath =
|
|
5555
|
+
const relativeFilePath = relative8(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
5356
5556
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
5357
5557
|
const fileBaseName = basename6(sourceFilePath, ".vue");
|
|
5358
5558
|
const componentId = toKebab(fileBaseName);
|
|
@@ -5476,7 +5676,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5476
5676
|
let result2 = code;
|
|
5477
5677
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
5478
5678
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
5479
|
-
let rel =
|
|
5679
|
+
let rel = relative8(dirname9(outputPath), targetPath).replace(/\\/g, "/");
|
|
5480
5680
|
if (!rel.startsWith("."))
|
|
5481
5681
|
rel = `./${rel}`;
|
|
5482
5682
|
result2 = result2.replaceAll(bareImport, rel);
|
|
@@ -5525,7 +5725,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5525
5725
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
5526
5726
|
const entryBaseName = basename6(entryPath, ".vue");
|
|
5527
5727
|
const indexOutputFile = join13(indexOutputDir, `${entryBaseName}.js`);
|
|
5528
|
-
const clientOutputFile = join13(clientOutputDir,
|
|
5728
|
+
const clientOutputFile = join13(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
5529
5729
|
await mkdir3(dirname9(indexOutputFile), { recursive: true });
|
|
5530
5730
|
const vueHmrImports = isDev2 ? [
|
|
5531
5731
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -5533,7 +5733,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5533
5733
|
] : [];
|
|
5534
5734
|
await write2(indexOutputFile, [
|
|
5535
5735
|
...vueHmrImports,
|
|
5536
|
-
`import Comp from "${
|
|
5736
|
+
`import Comp from "${relative8(dirname9(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
5537
5737
|
'import { createSSRApp, createApp } from "vue";',
|
|
5538
5738
|
"",
|
|
5539
5739
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -5653,7 +5853,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5653
5853
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
5654
5854
|
const sourceCode = await file3(tsPath).text();
|
|
5655
5855
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
5656
|
-
const relativeJsPath =
|
|
5856
|
+
const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
5657
5857
|
const outClientPath = join13(clientOutputDir, relativeJsPath);
|
|
5658
5858
|
const outServerPath = join13(serverOutputDir, relativeJsPath);
|
|
5659
5859
|
await mkdir3(dirname9(outClientPath), { recursive: true });
|
|
@@ -6154,13 +6354,13 @@ __export(exports_compileAngular, {
|
|
|
6154
6354
|
compileAngularFile: () => compileAngularFile,
|
|
6155
6355
|
compileAngular: () => compileAngular
|
|
6156
6356
|
});
|
|
6157
|
-
import { existsSync as
|
|
6158
|
-
import { join as join14, basename as basename7, sep as sep3, dirname as dirname10, resolve as resolve19, relative as
|
|
6357
|
+
import { existsSync as existsSync16, readFileSync as readFileSync10, promises as fs } from "fs";
|
|
6358
|
+
import { join as join14, basename as basename7, sep as sep3, dirname as dirname10, resolve as resolve19, relative as relative9 } from "path";
|
|
6159
6359
|
import ts2 from "typescript";
|
|
6160
6360
|
import { createHash as createHash2 } from "crypto";
|
|
6161
6361
|
var computeConfigHash = () => {
|
|
6162
6362
|
try {
|
|
6163
|
-
const content =
|
|
6363
|
+
const content = readFileSync10("./tsconfig.json", "utf-8");
|
|
6164
6364
|
return createHash2("md5").update(content).digest("hex");
|
|
6165
6365
|
} catch {
|
|
6166
6366
|
return "";
|
|
@@ -6168,11 +6368,11 @@ var computeConfigHash = () => {
|
|
|
6168
6368
|
}, resolveDevClientDir4 = () => {
|
|
6169
6369
|
const projectRoot = process.cwd();
|
|
6170
6370
|
const fromSource = resolve19(import.meta.dir, "../dev/client");
|
|
6171
|
-
if (
|
|
6371
|
+
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
6172
6372
|
return fromSource;
|
|
6173
6373
|
}
|
|
6174
6374
|
const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
6175
|
-
if (
|
|
6375
|
+
if (existsSync16(fromNodeModules))
|
|
6176
6376
|
return fromNodeModules;
|
|
6177
6377
|
return resolve19(import.meta.dir, "./dev/client");
|
|
6178
6378
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
@@ -6251,7 +6451,7 @@ ${registrations}
|
|
|
6251
6451
|
join14(basePath, "index.mts"),
|
|
6252
6452
|
join14(basePath, "index.cts")
|
|
6253
6453
|
];
|
|
6254
|
-
return candidates.map((candidate) => resolve19(candidate)).find((candidate) =>
|
|
6454
|
+
return candidates.map((candidate) => resolve19(candidate)).find((candidate) => existsSync16(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
6255
6455
|
}, readFileForAotTransform = async (fileName, readFile4) => {
|
|
6256
6456
|
const hostSource = readFile4?.(fileName);
|
|
6257
6457
|
if (typeof hostSource === "string")
|
|
@@ -6265,7 +6465,7 @@ ${registrations}
|
|
|
6265
6465
|
if (visited.has(resolvedPath))
|
|
6266
6466
|
return;
|
|
6267
6467
|
visited.add(resolvedPath);
|
|
6268
|
-
if (!
|
|
6468
|
+
if (!existsSync16(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
6269
6469
|
return;
|
|
6270
6470
|
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
6271
6471
|
const transformed = await inlineResources(source, dirname10(resolvedPath), stylePreprocessors);
|
|
@@ -6280,7 +6480,7 @@ ${registrations}
|
|
|
6280
6480
|
await transformFile(inputPath);
|
|
6281
6481
|
return transformedSources;
|
|
6282
6482
|
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
6283
|
-
const islandMetadataExports = buildIslandMetadataExports(
|
|
6483
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync10(inputPath, "utf-8"));
|
|
6284
6484
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
6285
6485
|
const configHash = computeConfigHash();
|
|
6286
6486
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -6402,7 +6602,7 @@ ${registrations}
|
|
|
6402
6602
|
return entries.map(({ target }) => target);
|
|
6403
6603
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
6404
6604
|
const sourceEntry = resolve19(import.meta.dir, "../angular/components/index.ts");
|
|
6405
|
-
if (
|
|
6605
|
+
if (existsSync16(sourceEntry)) {
|
|
6406
6606
|
return sourceEntry.replace(/\\/g, "/");
|
|
6407
6607
|
}
|
|
6408
6608
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -6530,7 +6730,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
6530
6730
|
${fields}
|
|
6531
6731
|
`);
|
|
6532
6732
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
6533
|
-
if (!
|
|
6733
|
+
if (!existsSync16(filePath))
|
|
6534
6734
|
return null;
|
|
6535
6735
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
6536
6736
|
return escapeTemplateContent(content);
|
|
@@ -6538,7 +6738,7 @@ ${fields}
|
|
|
6538
6738
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
6539
6739
|
if (templateUrlMatch?.[1]) {
|
|
6540
6740
|
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
6541
|
-
if (!
|
|
6741
|
+
if (!existsSync16(templatePath)) {
|
|
6542
6742
|
return { deferSlots: [], source };
|
|
6543
6743
|
}
|
|
6544
6744
|
const templateRaw2 = await fs.readFile(templatePath, "utf-8");
|
|
@@ -6569,10 +6769,10 @@ ${fields}
|
|
|
6569
6769
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
6570
6770
|
if (templateUrlMatch?.[1]) {
|
|
6571
6771
|
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
6572
|
-
if (!
|
|
6772
|
+
if (!existsSync16(templatePath)) {
|
|
6573
6773
|
return { deferSlots: [], source };
|
|
6574
6774
|
}
|
|
6575
|
-
const templateRaw2 =
|
|
6775
|
+
const templateRaw2 = readFileSync10(templatePath, "utf-8");
|
|
6576
6776
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
6577
6777
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
6578
6778
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -6683,7 +6883,7 @@ ${fields}
|
|
|
6683
6883
|
let actualPath = resolved;
|
|
6684
6884
|
if (!actualPath.endsWith(".ts"))
|
|
6685
6885
|
actualPath += ".ts";
|
|
6686
|
-
if (!
|
|
6886
|
+
if (!existsSync16(actualPath))
|
|
6687
6887
|
return;
|
|
6688
6888
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
6689
6889
|
const inlined = await inlineResources(sourceCode, dirname10(actualPath), stylePreprocessors);
|
|
@@ -6707,7 +6907,7 @@ ${fields}
|
|
|
6707
6907
|
}
|
|
6708
6908
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
6709
6909
|
const cacheKey2 = actualPath;
|
|
6710
|
-
if (jitContentCache.get(cacheKey2) === contentHash &&
|
|
6910
|
+
if (jitContentCache.get(cacheKey2) === contentHash && existsSync16(targetPath)) {
|
|
6711
6911
|
allOutputs.push(targetPath);
|
|
6712
6912
|
} else {
|
|
6713
6913
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath);
|
|
@@ -6735,7 +6935,7 @@ ${fields}
|
|
|
6735
6935
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
6736
6936
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
6737
6937
|
const resolvedEntry = resolve19(entry);
|
|
6738
|
-
const relativeEntry =
|
|
6938
|
+
const relativeEntry = relative9(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
6739
6939
|
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
6740
6940
|
let outputs = await compileEntry();
|
|
6741
6941
|
const fileBase = basename7(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
@@ -6750,12 +6950,12 @@ ${fields}
|
|
|
6750
6950
|
...candidatePaths.map((file4) => resolve19(file4)),
|
|
6751
6951
|
...compiledFallbackPaths
|
|
6752
6952
|
];
|
|
6753
|
-
let candidate = normalizedCandidates.find((file4) =>
|
|
6953
|
+
let candidate = normalizedCandidates.find((file4) => existsSync16(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
6754
6954
|
if (!candidate) {
|
|
6755
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
6955
|
+
candidate = normalizedCandidates.find((file4) => existsSync16(file4) && file4.endsWith(`${sep3}${jsName}`));
|
|
6756
6956
|
}
|
|
6757
6957
|
if (!candidate) {
|
|
6758
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
6958
|
+
candidate = normalizedCandidates.find((file4) => existsSync16(file4));
|
|
6759
6959
|
}
|
|
6760
6960
|
return candidate;
|
|
6761
6961
|
};
|
|
@@ -6763,11 +6963,11 @@ ${fields}
|
|
|
6763
6963
|
if (!rawServerFile) {
|
|
6764
6964
|
rawServerFile = resolveRawServerFile([]);
|
|
6765
6965
|
}
|
|
6766
|
-
if (rawServerFile && !
|
|
6966
|
+
if (rawServerFile && !existsSync16(rawServerFile)) {
|
|
6767
6967
|
outputs = await compileEntry();
|
|
6768
6968
|
rawServerFile = resolveRawServerFile(outputs);
|
|
6769
6969
|
}
|
|
6770
|
-
if (!rawServerFile || !
|
|
6970
|
+
if (!rawServerFile || !existsSync16(rawServerFile)) {
|
|
6771
6971
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
6772
6972
|
...outputs,
|
|
6773
6973
|
...compiledFallbackPaths
|
|
@@ -6778,7 +6978,7 @@ ${fields}
|
|
|
6778
6978
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
6779
6979
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
6780
6980
|
const clientFile = join14(indexesDir, jsName);
|
|
6781
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
6981
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync16(clientFile)) {
|
|
6782
6982
|
return {
|
|
6783
6983
|
clientPath: clientFile,
|
|
6784
6984
|
indexUnchanged: true,
|
|
@@ -6812,7 +7012,7 @@ export default ${componentClassName};
|
|
|
6812
7012
|
await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
|
|
6813
7013
|
}
|
|
6814
7014
|
await fs.writeFile(rawServerFile, rewritten, "utf-8");
|
|
6815
|
-
const relativePath =
|
|
7015
|
+
const relativePath = relative9(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
6816
7016
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
6817
7017
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
6818
7018
|
import "${hmrRuntimePath}";
|
|
@@ -6977,7 +7177,7 @@ __export(exports_buildReactVendor, {
|
|
|
6977
7177
|
computeVendorPaths: () => computeVendorPaths,
|
|
6978
7178
|
buildReactVendor: () => buildReactVendor
|
|
6979
7179
|
});
|
|
6980
|
-
import { existsSync as
|
|
7180
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync6 } from "fs";
|
|
6981
7181
|
import { join as join15, resolve as resolve20 } from "path";
|
|
6982
7182
|
import { rm as rm4 } from "fs/promises";
|
|
6983
7183
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
@@ -6991,7 +7191,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
6991
7191
|
resolve20(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
6992
7192
|
];
|
|
6993
7193
|
for (const candidate of candidates) {
|
|
6994
|
-
if (
|
|
7194
|
+
if (existsSync17(candidate)) {
|
|
6995
7195
|
return candidate.replace(/\\/g, "/");
|
|
6996
7196
|
}
|
|
6997
7197
|
}
|
|
@@ -7167,11 +7367,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
7167
7367
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
7168
7368
|
return;
|
|
7169
7369
|
}
|
|
7170
|
-
const { readFileSync:
|
|
7370
|
+
const { readFileSync: readFileSync11, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
7171
7371
|
const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
7172
7372
|
for (const file4 of files) {
|
|
7173
7373
|
const filePath = join17(vendorDir, file4);
|
|
7174
|
-
const content =
|
|
7374
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
7175
7375
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
7176
7376
|
continue;
|
|
7177
7377
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -7294,14 +7494,14 @@ var init_rewriteImports = __esm(() => {
|
|
|
7294
7494
|
import {
|
|
7295
7495
|
copyFileSync,
|
|
7296
7496
|
cpSync,
|
|
7297
|
-
existsSync as
|
|
7497
|
+
existsSync as existsSync18,
|
|
7298
7498
|
mkdirSync as mkdirSync10,
|
|
7299
|
-
readFileSync as
|
|
7499
|
+
readFileSync as readFileSync11,
|
|
7300
7500
|
rmSync as rmSync2,
|
|
7301
7501
|
statSync,
|
|
7302
7502
|
writeFileSync as writeFileSync7
|
|
7303
7503
|
} from "fs";
|
|
7304
|
-
import { basename as basename8, dirname as dirname11, join as join19, relative as
|
|
7504
|
+
import { basename as basename8, dirname as dirname11, join as join19, relative as relative10, resolve as resolve21 } from "path";
|
|
7305
7505
|
import { cwd, env as env3, exit } from "process";
|
|
7306
7506
|
var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
|
|
7307
7507
|
var isDev2, collectConventionSourceFiles = (entry) => {
|
|
@@ -7417,7 +7617,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7417
7617
|
addWorkerPathIfExists(file4, relPath, workerPaths);
|
|
7418
7618
|
}
|
|
7419
7619
|
}, collectWorkerPathsFromFile = (file4, patterns, workerPaths) => {
|
|
7420
|
-
const content =
|
|
7620
|
+
const content = readFileSync11(file4, "utf-8");
|
|
7421
7621
|
for (const pattern of patterns) {
|
|
7422
7622
|
collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
|
|
7423
7623
|
}
|
|
@@ -7462,13 +7662,13 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7462
7662
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
7463
7663
|
}
|
|
7464
7664
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
7465
|
-
if (!
|
|
7665
|
+
if (!existsSync18(reactIndexesPath)) {
|
|
7466
7666
|
return;
|
|
7467
7667
|
}
|
|
7468
7668
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
7469
|
-
const pagesRel =
|
|
7669
|
+
const pagesRel = relative10(process.cwd(), resolve21(reactPagesPath)).replace(/\\/g, "/");
|
|
7470
7670
|
for (const file4 of indexFiles) {
|
|
7471
|
-
let content =
|
|
7671
|
+
let content = readFileSync11(join19(reactIndexesPath, file4), "utf-8");
|
|
7472
7672
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
7473
7673
|
writeFileSync7(join19(devIndexDir, file4), content);
|
|
7474
7674
|
}
|
|
@@ -7478,10 +7678,10 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7478
7678
|
for (const entry of sveltePageEntries) {
|
|
7479
7679
|
const name = basename8(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
7480
7680
|
const indexFile = join19(svelteIndexDir, "pages", `${name}.js`);
|
|
7481
|
-
if (!
|
|
7681
|
+
if (!existsSync18(indexFile))
|
|
7482
7682
|
continue;
|
|
7483
|
-
let content =
|
|
7484
|
-
const srcRel =
|
|
7683
|
+
let content = readFileSync11(indexFile, "utf-8");
|
|
7684
|
+
const srcRel = relative10(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
7485
7685
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
7486
7686
|
writeFileSync7(join19(devIndexDir, `${name}.svelte.js`), content);
|
|
7487
7687
|
}
|
|
@@ -7491,10 +7691,10 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7491
7691
|
for (const entry of vuePageEntries) {
|
|
7492
7692
|
const name = basename8(entry, ".vue");
|
|
7493
7693
|
const indexFile = join19(vueIndexDir, `${name}.js`);
|
|
7494
|
-
if (!
|
|
7694
|
+
if (!existsSync18(indexFile))
|
|
7495
7695
|
continue;
|
|
7496
|
-
let content =
|
|
7497
|
-
const srcRel =
|
|
7696
|
+
let content = readFileSync11(indexFile, "utf-8");
|
|
7697
|
+
const srcRel = relative10(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
7498
7698
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
7499
7699
|
writeFileSync7(join19(devIndexDir, `${name}.vue.js`), content);
|
|
7500
7700
|
}
|
|
@@ -7544,7 +7744,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7544
7744
|
}
|
|
7545
7745
|
return result;
|
|
7546
7746
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
7547
|
-
let content =
|
|
7747
|
+
let content = readFileSync11(outputPath, "utf-8");
|
|
7548
7748
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
7549
7749
|
const useNames = [];
|
|
7550
7750
|
let match;
|
|
@@ -7569,7 +7769,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7569
7769
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
7570
7770
|
const urlFileMap = new Map;
|
|
7571
7771
|
for (const srcPath of urlReferencedFiles) {
|
|
7572
|
-
const rel =
|
|
7772
|
+
const rel = relative10(projectRoot, srcPath).replace(/\\/g, "/");
|
|
7573
7773
|
const name = basename8(srcPath);
|
|
7574
7774
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
7575
7775
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -7584,7 +7784,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7584
7784
|
const output = nonReactClientOutputs.find((artifact) => basename8(artifact.path).startsWith(`${srcBase}.`));
|
|
7585
7785
|
if (!output)
|
|
7586
7786
|
continue;
|
|
7587
|
-
urlFileMap.set(basename8(srcPath), `/${
|
|
7787
|
+
urlFileMap.set(basename8(srcPath), `/${relative10(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
7588
7788
|
}
|
|
7589
7789
|
return urlFileMap;
|
|
7590
7790
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -7594,7 +7794,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7594
7794
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
7595
7795
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
7596
7796
|
for (const outputPath of outputPaths) {
|
|
7597
|
-
let content =
|
|
7797
|
+
let content = readFileSync11(outputPath, "utf-8");
|
|
7598
7798
|
let changed = false;
|
|
7599
7799
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
7600
7800
|
const targetName = basename8(relPath);
|
|
@@ -8251,7 +8451,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8251
8451
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
8252
8452
|
if (!hmrClientBundle)
|
|
8253
8453
|
return;
|
|
8254
|
-
let html =
|
|
8454
|
+
let html = readFileSync11(filePath, "utf-8");
|
|
8255
8455
|
if (html.includes("data-hmr-client"))
|
|
8256
8456
|
return;
|
|
8257
8457
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -8412,7 +8612,7 @@ var init_build = __esm(() => {
|
|
|
8412
8612
|
});
|
|
8413
8613
|
|
|
8414
8614
|
// src/dev/dependencyGraph.ts
|
|
8415
|
-
import { existsSync as
|
|
8615
|
+
import { existsSync as existsSync19, readFileSync as readFileSync12 } from "fs";
|
|
8416
8616
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
8417
8617
|
import { resolve as resolve22 } from "path";
|
|
8418
8618
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -8424,7 +8624,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8424
8624
|
if (lower.endsWith(".html") || lower.endsWith(".htm"))
|
|
8425
8625
|
return "html";
|
|
8426
8626
|
return null;
|
|
8427
|
-
},
|
|
8627
|
+
}, resolveImportPath2 = (importPath, fromFile) => {
|
|
8428
8628
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
8429
8629
|
return null;
|
|
8430
8630
|
}
|
|
@@ -8442,10 +8642,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8442
8642
|
];
|
|
8443
8643
|
for (const ext of extensions) {
|
|
8444
8644
|
const withExt = normalized + ext;
|
|
8445
|
-
if (
|
|
8645
|
+
if (existsSync19(withExt))
|
|
8446
8646
|
return withExt;
|
|
8447
8647
|
}
|
|
8448
|
-
if (
|
|
8648
|
+
if (existsSync19(normalized))
|
|
8449
8649
|
return normalized;
|
|
8450
8650
|
return null;
|
|
8451
8651
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -8460,7 +8660,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8460
8660
|
}
|
|
8461
8661
|
}, addFileToGraph = (graph, filePath) => {
|
|
8462
8662
|
const normalizedPath = resolve22(filePath);
|
|
8463
|
-
if (!
|
|
8663
|
+
if (!existsSync19(normalizedPath))
|
|
8464
8664
|
return;
|
|
8465
8665
|
const dependencies = extractDependencies(normalizedPath);
|
|
8466
8666
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -8476,7 +8676,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8476
8676
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
8477
8677
|
const processedFiles = new Set;
|
|
8478
8678
|
const glob = new Glob7("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
8479
|
-
const resolvedDirs = directories.map((dir) => resolve22(dir)).filter((dir) =>
|
|
8679
|
+
const resolvedDirs = directories.map((dir) => resolve22(dir)).filter((dir) => existsSync19(dir));
|
|
8480
8680
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
8481
8681
|
for (const file4 of allFiles) {
|
|
8482
8682
|
const fullPath = resolve22(file4);
|
|
@@ -8495,7 +8695,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8495
8695
|
const [, href] = matchLink;
|
|
8496
8696
|
if (!href)
|
|
8497
8697
|
continue;
|
|
8498
|
-
const resolvedHref =
|
|
8698
|
+
const resolvedHref = resolveImportPath2(href, filePath);
|
|
8499
8699
|
if (resolvedHref)
|
|
8500
8700
|
dependencies.push(resolvedHref);
|
|
8501
8701
|
}
|
|
@@ -8505,7 +8705,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8505
8705
|
while ((match = regex.exec(content)) !== null) {
|
|
8506
8706
|
if (!match[1])
|
|
8507
8707
|
continue;
|
|
8508
|
-
const resolved =
|
|
8708
|
+
const resolved = resolveImportPath2(match[1], filePath);
|
|
8509
8709
|
if (resolved)
|
|
8510
8710
|
dependencies.push(resolved);
|
|
8511
8711
|
}
|
|
@@ -8515,7 +8715,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8515
8715
|
while ((urlMatch = stringLiteralRegex.exec(matchContent)) !== null) {
|
|
8516
8716
|
if (!urlMatch[1])
|
|
8517
8717
|
continue;
|
|
8518
|
-
const resolved =
|
|
8718
|
+
const resolved = resolveImportPath2(urlMatch[1], filePath);
|
|
8519
8719
|
if (resolved)
|
|
8520
8720
|
dependencies.push(resolved);
|
|
8521
8721
|
}
|
|
@@ -8538,7 +8738,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8538
8738
|
const imports = transpiler4.scanImports(content);
|
|
8539
8739
|
const dependencies = [];
|
|
8540
8740
|
for (const imp of imports) {
|
|
8541
|
-
const resolved =
|
|
8741
|
+
const resolved = resolveImportPath2(imp.path, filePath);
|
|
8542
8742
|
if (resolved)
|
|
8543
8743
|
dependencies.push(resolved);
|
|
8544
8744
|
}
|
|
@@ -8548,7 +8748,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8548
8748
|
return dependencies;
|
|
8549
8749
|
}, resolveScannedImports = (imports, filePath, dependencies) => {
|
|
8550
8750
|
for (const imp of imports) {
|
|
8551
|
-
const resolved =
|
|
8751
|
+
const resolved = resolveImportPath2(imp.path, filePath);
|
|
8552
8752
|
if (resolved)
|
|
8553
8753
|
dependencies.push(resolved);
|
|
8554
8754
|
}
|
|
@@ -8573,15 +8773,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8573
8773
|
const lowerPath = filePath.toLowerCase();
|
|
8574
8774
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
8575
8775
|
if (loader === "html") {
|
|
8576
|
-
const content =
|
|
8776
|
+
const content = readFileSync12(filePath, "utf-8");
|
|
8577
8777
|
return extractHtmlDependencies(filePath, content);
|
|
8578
8778
|
}
|
|
8579
8779
|
if (loader === "tsx" || loader === "js") {
|
|
8580
|
-
const content =
|
|
8780
|
+
const content = readFileSync12(filePath, "utf-8");
|
|
8581
8781
|
return extractJsDependencies(filePath, content, loader);
|
|
8582
8782
|
}
|
|
8583
8783
|
if (isSvelteOrVue) {
|
|
8584
|
-
const content =
|
|
8784
|
+
const content = readFileSync12(filePath, "utf-8");
|
|
8585
8785
|
return extractSvelteVueDependencies(filePath, content);
|
|
8586
8786
|
}
|
|
8587
8787
|
return [];
|
|
@@ -8864,12 +9064,12 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
8864
9064
|
};
|
|
8865
9065
|
var init_pathUtils = __esm(() => {
|
|
8866
9066
|
init_commonAncestor();
|
|
8867
|
-
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less)$/i;
|
|
9067
|
+
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less|styl(?:us)?)$/i;
|
|
8868
9068
|
});
|
|
8869
9069
|
|
|
8870
9070
|
// src/dev/fileWatcher.ts
|
|
8871
9071
|
import { watch } from "fs";
|
|
8872
|
-
import { existsSync as
|
|
9072
|
+
import { existsSync as existsSync20 } from "fs";
|
|
8873
9073
|
import { join as join20, resolve as resolve24 } from "path";
|
|
8874
9074
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
8875
9075
|
try {
|
|
@@ -8901,12 +9101,12 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8901
9101
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
8902
9102
|
return;
|
|
8903
9103
|
}
|
|
8904
|
-
if (event === "rename" && !
|
|
9104
|
+
if (event === "rename" && !existsSync20(fullPath)) {
|
|
8905
9105
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
8906
9106
|
onFileChange(fullPath);
|
|
8907
9107
|
return;
|
|
8908
9108
|
}
|
|
8909
|
-
if (
|
|
9109
|
+
if (existsSync20(fullPath)) {
|
|
8910
9110
|
onFileChange(fullPath);
|
|
8911
9111
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
8912
9112
|
}
|
|
@@ -8916,7 +9116,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8916
9116
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8917
9117
|
paths.forEach((path) => {
|
|
8918
9118
|
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
8919
|
-
if (!
|
|
9119
|
+
if (!existsSync20(absolutePath)) {
|
|
8920
9120
|
return;
|
|
8921
9121
|
}
|
|
8922
9122
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -8927,7 +9127,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8927
9127
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8928
9128
|
watchPaths.forEach((path) => {
|
|
8929
9129
|
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
8930
|
-
if (!
|
|
9130
|
+
if (!existsSync20(absolutePath)) {
|
|
8931
9131
|
return;
|
|
8932
9132
|
}
|
|
8933
9133
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -9048,10 +9248,10 @@ var init_assetStore = __esm(() => {
|
|
|
9048
9248
|
});
|
|
9049
9249
|
|
|
9050
9250
|
// src/dev/fileHashTracker.ts
|
|
9051
|
-
import { readFileSync as
|
|
9251
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
9052
9252
|
var computeFileHash = (filePath) => {
|
|
9053
9253
|
try {
|
|
9054
|
-
const fileContent =
|
|
9254
|
+
const fileContent = readFileSync13(filePath);
|
|
9055
9255
|
return Number(Bun.hash(fileContent));
|
|
9056
9256
|
} catch {
|
|
9057
9257
|
return UNFOUND_INDEX;
|
|
@@ -9875,8 +10075,8 @@ __export(exports_moduleServer, {
|
|
|
9875
10075
|
createModuleServer: () => createModuleServer,
|
|
9876
10076
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
9877
10077
|
});
|
|
9878
|
-
import { existsSync as
|
|
9879
|
-
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve29, relative as
|
|
10078
|
+
import { existsSync as existsSync21, readFileSync as readFileSync14, statSync as statSync2 } from "fs";
|
|
10079
|
+
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve29, relative as relative11 } from "path";
|
|
9880
10080
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
9881
10081
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
9882
10082
|
const allExports = [];
|
|
@@ -9896,7 +10096,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
9896
10096
|
${stubs}
|
|
9897
10097
|
`;
|
|
9898
10098
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
9899
|
-
const found = extensions.find((ext) =>
|
|
10099
|
+
const found = extensions.find((ext) => existsSync21(resolve29(projectRoot, srcPath + ext)));
|
|
9900
10100
|
return found ? srcPath + found : srcPath;
|
|
9901
10101
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
9902
10102
|
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
@@ -9924,17 +10124,17 @@ ${stubs}
|
|
|
9924
10124
|
}
|
|
9925
10125
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
9926
10126
|
const absPath = resolve29(fileDir, relPath);
|
|
9927
|
-
const rel =
|
|
10127
|
+
const rel = relative11(projectRoot, absPath);
|
|
9928
10128
|
const extension = extname6(rel);
|
|
9929
10129
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
9930
10130
|
if (extname6(srcPath) === ".svelte") {
|
|
9931
|
-
srcPath =
|
|
10131
|
+
srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve29(projectRoot, srcPath)));
|
|
9932
10132
|
}
|
|
9933
10133
|
return srcUrl(srcPath, projectRoot);
|
|
9934
10134
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
9935
10135
|
try {
|
|
9936
10136
|
const target = resolvePackageImport(specifier, ["browser", "import"]) ?? Bun.resolveSync(specifier, projectRoot);
|
|
9937
|
-
return
|
|
10137
|
+
return relative11(projectRoot, target);
|
|
9938
10138
|
} catch {
|
|
9939
10139
|
return;
|
|
9940
10140
|
}
|
|
@@ -9967,20 +10167,20 @@ ${stubs}
|
|
|
9967
10167
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
9968
10168
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
9969
10169
|
if (absPath.startsWith(projectRoot)) {
|
|
9970
|
-
const rel2 =
|
|
10170
|
+
const rel2 = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
9971
10171
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
9972
10172
|
}
|
|
9973
|
-
const rel =
|
|
10173
|
+
const rel = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
9974
10174
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
9975
10175
|
});
|
|
9976
10176
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
9977
10177
|
const absPath = resolve29(fileDir, relPath);
|
|
9978
|
-
const rel =
|
|
10178
|
+
const rel = relative11(projectRoot, absPath);
|
|
9979
10179
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
9980
10180
|
});
|
|
9981
10181
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
9982
10182
|
const absPath = resolve29(fileDir, relPath);
|
|
9983
|
-
const rel =
|
|
10183
|
+
const rel = relative11(projectRoot, absPath);
|
|
9984
10184
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
9985
10185
|
});
|
|
9986
10186
|
return result;
|
|
@@ -10008,7 +10208,7 @@ ${stubs}
|
|
|
10008
10208
|
`)}
|
|
10009
10209
|
${code}`;
|
|
10010
10210
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
10011
|
-
const raw =
|
|
10211
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10012
10212
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
10013
10213
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
10014
10214
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -10019,12 +10219,12 @@ ${code}`;
|
|
|
10019
10219
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
10020
10220
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
10021
10221
|
${transpiled}`;
|
|
10022
|
-
const relPath =
|
|
10222
|
+
const relPath = relative11(projectRoot, filePath).replace(/\\/g, "/");
|
|
10023
10223
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
10024
10224
|
transpiled += buildIslandMetadataExports(raw);
|
|
10025
10225
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
10026
10226
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
10027
|
-
const raw =
|
|
10227
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10028
10228
|
const ext = extname6(filePath);
|
|
10029
10229
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
10030
10230
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -10170,17 +10370,17 @@ ${code}`;
|
|
|
10170
10370
|
if (compiled.css?.code) {
|
|
10171
10371
|
const cssPath = `${filePath}.css`;
|
|
10172
10372
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
10173
|
-
const cssUrl = srcUrl(
|
|
10373
|
+
const cssUrl = srcUrl(relative11(projectRoot, cssPath), projectRoot);
|
|
10174
10374
|
code = `import "${cssUrl}";
|
|
10175
10375
|
${code}`;
|
|
10176
10376
|
}
|
|
10177
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
10377
|
+
const moduleUrl = `${SRC_PREFIX}${relative11(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
10178
10378
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
10179
10379
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10180
10380
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
10181
10381
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
10182
10382
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10183
|
-
const raw =
|
|
10383
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10184
10384
|
if (!svelteCompiler) {
|
|
10185
10385
|
svelteCompiler = await import("svelte/compiler");
|
|
10186
10386
|
}
|
|
@@ -10238,7 +10438,7 @@ export default __script__;`;
|
|
|
10238
10438
|
return `${cssInjection}
|
|
10239
10439
|
${code}`;
|
|
10240
10440
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10241
|
-
const raw =
|
|
10441
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10242
10442
|
if (!vueCompiler) {
|
|
10243
10443
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
10244
10444
|
}
|
|
@@ -10256,7 +10456,7 @@ ${code}`;
|
|
|
10256
10456
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
10257
10457
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
10258
10458
|
const hmrBase = vueDir ? resolve29(vueDir) : projectRoot;
|
|
10259
|
-
const hmrId =
|
|
10459
|
+
const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
10260
10460
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
10261
10461
|
result += [
|
|
10262
10462
|
"",
|
|
@@ -10270,11 +10470,11 @@ ${code}`;
|
|
|
10270
10470
|
`);
|
|
10271
10471
|
return result;
|
|
10272
10472
|
}, resolveSvelteModulePath = (path) => {
|
|
10273
|
-
if (
|
|
10473
|
+
if (existsSync21(path))
|
|
10274
10474
|
return path;
|
|
10275
|
-
if (
|
|
10475
|
+
if (existsSync21(`${path}.ts`))
|
|
10276
10476
|
return `${path}.ts`;
|
|
10277
|
-
if (
|
|
10477
|
+
if (existsSync21(`${path}.js`))
|
|
10278
10478
|
return `${path}.js`;
|
|
10279
10479
|
return path;
|
|
10280
10480
|
}, jsResponse = (body) => {
|
|
@@ -10287,7 +10487,7 @@ ${code}`;
|
|
|
10287
10487
|
}
|
|
10288
10488
|
});
|
|
10289
10489
|
}, handleCssRequest = (filePath) => {
|
|
10290
|
-
const raw =
|
|
10490
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10291
10491
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10292
10492
|
return [
|
|
10293
10493
|
`const style = document.createElement('style');`,
|
|
@@ -10420,7 +10620,7 @@ export default {};
|
|
|
10420
10620
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
10421
10621
|
if (ext)
|
|
10422
10622
|
return { ext, filePath };
|
|
10423
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
10623
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync21(filePath + candidate));
|
|
10424
10624
|
if (!found)
|
|
10425
10625
|
return { ext, filePath };
|
|
10426
10626
|
const resolved = filePath + found;
|
|
@@ -10625,8 +10825,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
10625
10825
|
var init_simpleHTMXHMR = () => {};
|
|
10626
10826
|
|
|
10627
10827
|
// src/dev/rebuildTrigger.ts
|
|
10628
|
-
import { existsSync as
|
|
10629
|
-
import { basename as basename13, dirname as dirname15, relative as
|
|
10828
|
+
import { existsSync as existsSync22 } from "fs";
|
|
10829
|
+
import { basename as basename13, dirname as dirname15, relative as relative12, resolve as resolve32 } from "path";
|
|
10630
10830
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
10631
10831
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
10632
10832
|
if (pathLineCol) {
|
|
@@ -10694,7 +10894,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10694
10894
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
10695
10895
|
}
|
|
10696
10896
|
return { ...parsed, framework: detectedFw };
|
|
10697
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
10897
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync22(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
10698
10898
|
state.fileHashes.delete(filePathInSet);
|
|
10699
10899
|
try {
|
|
10700
10900
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
@@ -10712,7 +10912,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10712
10912
|
if (!dependents || dependents.size === 0) {
|
|
10713
10913
|
return;
|
|
10714
10914
|
}
|
|
10715
|
-
const dependentFiles = Array.from(dependents).filter((file4) =>
|
|
10915
|
+
const dependentFiles = Array.from(dependents).filter((file4) => existsSync22(file4));
|
|
10716
10916
|
if (dependentFiles.length === 0) {
|
|
10717
10917
|
return;
|
|
10718
10918
|
}
|
|
@@ -10728,7 +10928,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10728
10928
|
try {
|
|
10729
10929
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
10730
10930
|
affectedFiles.forEach((affectedFile) => {
|
|
10731
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
10931
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync22(affectedFile)) {
|
|
10732
10932
|
validFiles.push(affectedFile);
|
|
10733
10933
|
processedFiles.add(affectedFile);
|
|
10734
10934
|
}
|
|
@@ -10753,7 +10953,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10753
10953
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
10754
10954
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
10755
10955
|
filePathSet.forEach((filePathInSet) => {
|
|
10756
|
-
if (!
|
|
10956
|
+
if (!existsSync22(filePathInSet)) {
|
|
10757
10957
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
10758
10958
|
return;
|
|
10759
10959
|
}
|
|
@@ -10821,7 +11021,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10821
11021
|
if (framework === "unknown") {
|
|
10822
11022
|
const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
|
|
10823
11023
|
invalidate2(resolve32(filePath));
|
|
10824
|
-
const relPath =
|
|
11024
|
+
const relPath = relative12(process.cwd(), filePath);
|
|
10825
11025
|
logHmrUpdate(relPath);
|
|
10826
11026
|
return;
|
|
10827
11027
|
}
|
|
@@ -10861,7 +11061,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10861
11061
|
return componentFile;
|
|
10862
11062
|
}
|
|
10863
11063
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
10864
|
-
if (
|
|
11064
|
+
if (existsSync22(tsCounterpart)) {
|
|
10865
11065
|
return tsCounterpart;
|
|
10866
11066
|
}
|
|
10867
11067
|
if (!graph)
|
|
@@ -11007,7 +11207,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11007
11207
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
11008
11208
|
const pageName = basename13(normalized, ".tsx");
|
|
11009
11209
|
const indexPath = resolve32(reactIndexesPath, `${pageName}.tsx`);
|
|
11010
|
-
if (!
|
|
11210
|
+
if (!existsSync22(indexPath)) {
|
|
11011
11211
|
return;
|
|
11012
11212
|
}
|
|
11013
11213
|
return indexPath;
|
|
@@ -11019,7 +11219,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11019
11219
|
}
|
|
11020
11220
|
const pageName = basename13(dep, ".tsx");
|
|
11021
11221
|
const indexPath = resolve32(reactIndexesPath, `${pageName}.tsx`);
|
|
11022
|
-
if (
|
|
11222
|
+
if (existsSync22(indexPath) && !reactEntries.includes(indexPath)) {
|
|
11023
11223
|
reactEntries.push(indexPath);
|
|
11024
11224
|
}
|
|
11025
11225
|
});
|
|
@@ -11102,7 +11302,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11102
11302
|
}, getModuleUrl = async (pageFile) => {
|
|
11103
11303
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
11104
11304
|
invalidateModule2(pageFile);
|
|
11105
|
-
const rel =
|
|
11305
|
+
const rel = relative12(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
11106
11306
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
11107
11307
|
warmCache2(url);
|
|
11108
11308
|
return url;
|
|
@@ -11134,7 +11334,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11134
11334
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
11135
11335
|
if (pageModuleUrl) {
|
|
11136
11336
|
const serverDuration = Date.now() - startTime;
|
|
11137
|
-
state.lastHmrPath =
|
|
11337
|
+
state.lastHmrPath = relative12(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
11138
11338
|
state.lastHmrFramework = "react";
|
|
11139
11339
|
broadcastToClients(state, {
|
|
11140
11340
|
data: {
|
|
@@ -11598,7 +11798,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11598
11798
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
11599
11799
|
const pascalName = toPascal(baseName);
|
|
11600
11800
|
const vueRoot = config.vueDirectory;
|
|
11601
|
-
const hmrId = vueRoot ?
|
|
11801
|
+
const hmrId = vueRoot ? relative12(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
11602
11802
|
const cssKey = `${pascalName}CSS`;
|
|
11603
11803
|
const cssUrl = manifest[cssKey] || null;
|
|
11604
11804
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
@@ -12226,7 +12426,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12226
12426
|
return Array.from(specifiers).filter(isResolvable3);
|
|
12227
12427
|
}, generateEntrySource2 = (specifier) => `export * from '${specifier}';
|
|
12228
12428
|
`, rewriteVendorFiles = async (vendorDir) => {
|
|
12229
|
-
const { readdirSync: readdirSync2, readFileSync:
|
|
12429
|
+
const { readdirSync: readdirSync2, readFileSync: readFileSync15, writeFileSync: writeFileSync8 } = await import("fs");
|
|
12230
12430
|
const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
|
|
12231
12431
|
const reactPaths = Object.entries(computeVendorPaths2());
|
|
12232
12432
|
const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
|
|
@@ -12237,7 +12437,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12237
12437
|
const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
12238
12438
|
for (const file4 of files) {
|
|
12239
12439
|
const filePath = join22(vendorDir, file4);
|
|
12240
|
-
const original =
|
|
12440
|
+
const original = readFileSync15(filePath, "utf-8");
|
|
12241
12441
|
const rewritten = rewriteContent(original);
|
|
12242
12442
|
if (rewritten !== original)
|
|
12243
12443
|
writeFileSync8(filePath, rewritten);
|
|
@@ -12749,17 +12949,17 @@ __export(exports_devtoolsJson, {
|
|
|
12749
12949
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
12750
12950
|
devtoolsJson: () => devtoolsJson
|
|
12751
12951
|
});
|
|
12752
|
-
import { existsSync as
|
|
12952
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync12, readFileSync as readFileSync15, writeFileSync as writeFileSync8 } from "fs";
|
|
12753
12953
|
import { dirname as dirname17, join as join23, resolve as resolve34 } from "path";
|
|
12754
12954
|
import { Elysia as Elysia3 } from "elysia";
|
|
12755
12955
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
12756
12956
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
12757
12957
|
return uuid;
|
|
12758
12958
|
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve34(uuidCachePath ?? join23(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
12759
|
-
if (!
|
|
12959
|
+
if (!existsSync23(cachePath))
|
|
12760
12960
|
return null;
|
|
12761
12961
|
try {
|
|
12762
|
-
const value =
|
|
12962
|
+
const value = readFileSync15(cachePath, "utf-8").trim();
|
|
12763
12963
|
return isUuidV4(value) ? value : null;
|
|
12764
12964
|
} catch {
|
|
12765
12965
|
return null;
|
|
@@ -12809,13 +13009,13 @@ var exports_imageOptimizer = {};
|
|
|
12809
13009
|
__export(exports_imageOptimizer, {
|
|
12810
13010
|
imageOptimizer: () => imageOptimizer
|
|
12811
13011
|
});
|
|
12812
|
-
import { existsSync as
|
|
13012
|
+
import { existsSync as existsSync24 } from "fs";
|
|
12813
13013
|
import { resolve as resolve35 } from "path";
|
|
12814
13014
|
import { Elysia as Elysia4 } from "elysia";
|
|
12815
13015
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
12816
13016
|
try {
|
|
12817
13017
|
const resolved = validateSafePath(path, baseDir);
|
|
12818
|
-
if (
|
|
13018
|
+
if (existsSync24(resolved))
|
|
12819
13019
|
return resolved;
|
|
12820
13020
|
return null;
|
|
12821
13021
|
} catch {
|
|
@@ -13114,7 +13314,7 @@ __export(exports_prerender, {
|
|
|
13114
13314
|
prerender: () => prerender,
|
|
13115
13315
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
13116
13316
|
});
|
|
13117
|
-
import { mkdirSync as mkdirSync13, readFileSync as
|
|
13317
|
+
import { mkdirSync as mkdirSync13, readFileSync as readFileSync16 } from "fs";
|
|
13118
13318
|
import { join as join24 } from "path";
|
|
13119
13319
|
var MAX_STARTUP_ATTEMPTS = 50, STARTUP_POLL_INTERVAL_MS = 100, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
13120
13320
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
@@ -13122,7 +13322,7 @@ var MAX_STARTUP_ATTEMPTS = 50, STARTUP_POLL_INTERVAL_MS = 100, PRERENDER_BYPASS_
|
|
|
13122
13322
|
}, readTimestamp = (htmlPath) => {
|
|
13123
13323
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
13124
13324
|
try {
|
|
13125
|
-
const content =
|
|
13325
|
+
const content = readFileSync16(metaPath, "utf-8");
|
|
13126
13326
|
return Number(content) || 0;
|
|
13127
13327
|
} catch {
|
|
13128
13328
|
return 0;
|
|
@@ -13462,8 +13662,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
13462
13662
|
});
|
|
13463
13663
|
};
|
|
13464
13664
|
// src/core/prepare.ts
|
|
13465
|
-
import { existsSync as
|
|
13466
|
-
import { basename as basename14, join as join25, relative as
|
|
13665
|
+
import { existsSync as existsSync25, readdirSync as readdirSync2, readFileSync as readFileSync17 } from "fs";
|
|
13666
|
+
import { basename as basename14, join as join25, relative as relative13, resolve as resolve36 } from "path";
|
|
13467
13667
|
import { Elysia as Elysia5 } from "elysia";
|
|
13468
13668
|
|
|
13469
13669
|
// src/utils/loadConfig.ts
|
|
@@ -13640,7 +13840,7 @@ var warmPrewarmDirs = async (prewarmDirs, warmCache2, SRC_URL_PREFIX2) => {
|
|
|
13640
13840
|
for (const file4 of files) {
|
|
13641
13841
|
if (file4.includes("/node_modules/"))
|
|
13642
13842
|
continue;
|
|
13643
|
-
const rel =
|
|
13843
|
+
const rel = relative13(process.cwd(), file4).replace(/\\/g, "/");
|
|
13644
13844
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
13645
13845
|
}
|
|
13646
13846
|
};
|
|
@@ -13666,9 +13866,9 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
13666
13866
|
if (!fileName)
|
|
13667
13867
|
continue;
|
|
13668
13868
|
const srcPath = resolve36(devIndexDir, fileName);
|
|
13669
|
-
if (!
|
|
13869
|
+
if (!existsSync25(srcPath))
|
|
13670
13870
|
continue;
|
|
13671
|
-
const rel =
|
|
13871
|
+
const rel = relative13(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
13672
13872
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
13673
13873
|
}
|
|
13674
13874
|
};
|
|
@@ -13772,7 +13972,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
13772
13972
|
};
|
|
13773
13973
|
var loadPrerenderMap = (prerenderDir) => {
|
|
13774
13974
|
const map = new Map;
|
|
13775
|
-
if (!
|
|
13975
|
+
if (!existsSync25(prerenderDir))
|
|
13776
13976
|
return map;
|
|
13777
13977
|
let entries;
|
|
13778
13978
|
try {
|
|
@@ -13825,7 +14025,7 @@ var prepare = async (configOrPath) => {
|
|
|
13825
14025
|
return result;
|
|
13826
14026
|
}
|
|
13827
14027
|
stepStartedAt = performance.now();
|
|
13828
|
-
const manifest = JSON.parse(
|
|
14028
|
+
const manifest = JSON.parse(readFileSync17(`${buildDir}/manifest.json`, "utf-8"));
|
|
13829
14029
|
setCurrentIslandManifest(manifest);
|
|
13830
14030
|
if (config.islands?.registry) {
|
|
13831
14031
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -13834,8 +14034,8 @@ var prepare = async (configOrPath) => {
|
|
|
13834
14034
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
13835
14035
|
stepStartedAt = performance.now();
|
|
13836
14036
|
const conventionsPath = join25(buildDir, "conventions.json");
|
|
13837
|
-
if (
|
|
13838
|
-
const conventions2 = JSON.parse(
|
|
14037
|
+
if (existsSync25(conventionsPath)) {
|
|
14038
|
+
const conventions2 = JSON.parse(readFileSync17(conventionsPath, "utf-8"));
|
|
13839
14039
|
setConventions(conventions2);
|
|
13840
14040
|
}
|
|
13841
14041
|
recordStep("load production conventions", stepStartedAt);
|
|
@@ -13904,7 +14104,7 @@ import { argv } from "process";
|
|
|
13904
14104
|
var {env: env4 } = globalThis.Bun;
|
|
13905
14105
|
|
|
13906
14106
|
// src/dev/devCert.ts
|
|
13907
|
-
import { existsSync as
|
|
14107
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync14, readFileSync as readFileSync18, rmSync as rmSync3 } from "fs";
|
|
13908
14108
|
import { join as join26 } from "path";
|
|
13909
14109
|
var CERT_DIR = join26(process.cwd(), ".absolutejs");
|
|
13910
14110
|
var CERT_PATH = join26(CERT_DIR, "cert.pem");
|
|
@@ -13912,10 +14112,10 @@ var KEY_PATH = join26(CERT_DIR, "key.pem");
|
|
|
13912
14112
|
var CERT_VALIDITY_DAYS = 365;
|
|
13913
14113
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
13914
14114
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
13915
|
-
var certFilesExist = () =>
|
|
14115
|
+
var certFilesExist = () => existsSync26(CERT_PATH) && existsSync26(KEY_PATH);
|
|
13916
14116
|
var isCertExpired = () => {
|
|
13917
14117
|
try {
|
|
13918
|
-
const certPem =
|
|
14118
|
+
const certPem = readFileSync18(CERT_PATH, "utf-8");
|
|
13919
14119
|
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
13920
14120
|
stdin: new TextEncoder().encode(certPem)
|
|
13921
14121
|
});
|
|
@@ -14011,8 +14211,8 @@ var loadDevCert = () => {
|
|
|
14011
14211
|
return null;
|
|
14012
14212
|
try {
|
|
14013
14213
|
return {
|
|
14014
|
-
cert:
|
|
14015
|
-
key:
|
|
14214
|
+
cert: readFileSync18(paths.cert, "utf-8"),
|
|
14215
|
+
key: readFileSync18(paths.key, "utf-8")
|
|
14016
14216
|
};
|
|
14017
14217
|
} catch {
|
|
14018
14218
|
return null;
|
|
@@ -14240,7 +14440,7 @@ var jsonLd2 = (schema) => {
|
|
|
14240
14440
|
};
|
|
14241
14441
|
// src/utils/defineEnv.ts
|
|
14242
14442
|
var {env: bunEnv } = globalThis.Bun;
|
|
14243
|
-
import { existsSync as
|
|
14443
|
+
import { existsSync as existsSync27, readFileSync as readFileSync19 } from "fs";
|
|
14244
14444
|
import { resolve as resolve37 } from "path";
|
|
14245
14445
|
|
|
14246
14446
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
@@ -20277,18 +20477,18 @@ ${lines.join(`
|
|
|
20277
20477
|
var checkEnvFileSecurity = (properties) => {
|
|
20278
20478
|
const cwd2 = process.cwd();
|
|
20279
20479
|
const envPath = resolve37(cwd2, ".env");
|
|
20280
|
-
if (!
|
|
20480
|
+
if (!existsSync27(envPath))
|
|
20281
20481
|
return;
|
|
20282
20482
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
20283
20483
|
if (sensitiveKeys.length === 0)
|
|
20284
20484
|
return;
|
|
20285
|
-
const envContent =
|
|
20485
|
+
const envContent = readFileSync19(envPath, "utf-8");
|
|
20286
20486
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
20287
20487
|
if (presentKeys.length === 0)
|
|
20288
20488
|
return;
|
|
20289
20489
|
const gitignorePath = resolve37(cwd2, ".gitignore");
|
|
20290
|
-
if (
|
|
20291
|
-
const gitignore =
|
|
20490
|
+
if (existsSync27(gitignorePath)) {
|
|
20491
|
+
const gitignore = readFileSync19(gitignorePath, "utf-8");
|
|
20292
20492
|
if (gitignore.split(`
|
|
20293
20493
|
`).some((line) => line.trim() === ".env"))
|
|
20294
20494
|
return;
|
|
@@ -20495,5 +20695,5 @@ export {
|
|
|
20495
20695
|
ANGULAR_INIT_TIMEOUT_MS
|
|
20496
20696
|
};
|
|
20497
20697
|
|
|
20498
|
-
//# debugId=
|
|
20698
|
+
//# debugId=994C58D8A1A6025964756E2164756E21
|
|
20499
20699
|
//# sourceMappingURL=index.js.map
|