@absolutejs/absolute 0.19.0-beta.692 → 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 +354 -140
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +336 -122
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +667 -442
- package/dist/build.js.map +11 -11
- package/dist/index.js +736 -510
- package/dist/index.js.map +12 -12
- package/dist/islands/index.js +270 -56
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +270 -56
- package/dist/react/index.js.map +3 -3
- package/dist/src/build/compileAngular.d.ts +4 -3
- package/dist/src/build/compileSvelte.d.ts +2 -1
- package/dist/src/build/compileVue.d.ts +2 -1
- package/dist/src/build/stylePreprocessor.d.ts +6 -4
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -0
- package/dist/svelte/index.js +284 -70
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +275 -61
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +45 -0
- package/dist/vue/index.js +270 -56
- 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 } 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,19 +2515,214 @@ 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
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
2521
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
2522
|
+
dirname2(filePath),
|
|
2523
|
+
process.cwd(),
|
|
2524
|
+
...paths.map((path) => resolve4(process.cwd(), path))
|
|
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) => ({
|
|
2648
|
+
...config?.sass ?? {},
|
|
2649
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
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) => {
|
|
2518
2708
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2519
|
-
const
|
|
2709
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2520
2710
|
if (language === "scss" || language === "sass") {
|
|
2711
|
+
const options = getSassOptions(config, language);
|
|
2712
|
+
const packageName = options.implementation ?? "sass";
|
|
2521
2713
|
let sass;
|
|
2522
2714
|
try {
|
|
2523
|
-
sass = await importOptionalPeer(
|
|
2715
|
+
sass = await importOptionalPeer(packageName);
|
|
2524
2716
|
} catch {
|
|
2525
|
-
throw missingDependencyError(
|
|
2717
|
+
throw missingDependencyError(packageName, filePath);
|
|
2526
2718
|
}
|
|
2719
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2720
|
+
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
2527
2721
|
const result = sass.compileString(contents, {
|
|
2528
|
-
|
|
2722
|
+
importers: [
|
|
2723
|
+
createSassImporter(filePath, loadPaths, language, config)
|
|
2724
|
+
],
|
|
2725
|
+
loadPaths,
|
|
2529
2726
|
style: "expanded",
|
|
2530
2727
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2531
2728
|
url: new URL(`file://${filePath}`)
|
|
@@ -2533,6 +2730,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2533
2730
|
return result.css;
|
|
2534
2731
|
}
|
|
2535
2732
|
if (language === "less") {
|
|
2733
|
+
const options = getLessOptions(config);
|
|
2536
2734
|
let lessModule;
|
|
2537
2735
|
try {
|
|
2538
2736
|
lessModule = await importOptionalPeer("less");
|
|
@@ -2543,14 +2741,63 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2543
2741
|
const render = less?.render;
|
|
2544
2742
|
if (!render)
|
|
2545
2743
|
throw missingDependencyError("less", filePath);
|
|
2744
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2745
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
2546
2746
|
const result = await render(contents, {
|
|
2747
|
+
...options.options ?? {},
|
|
2547
2748
|
filename: filePath,
|
|
2548
|
-
paths:
|
|
2749
|
+
paths: loadPaths,
|
|
2750
|
+
plugins: [
|
|
2751
|
+
...options.options?.plugins ?? [],
|
|
2752
|
+
createLessFileManager(filePath, loadPaths, config)
|
|
2753
|
+
]
|
|
2549
2754
|
});
|
|
2550
2755
|
return result.css;
|
|
2551
2756
|
}
|
|
2552
|
-
|
|
2553
|
-
|
|
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
|
+
}
|
|
2763
|
+
return rawContents;
|
|
2764
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
2765
|
+
name: "absolute-style-preprocessor",
|
|
2766
|
+
setup(build) {
|
|
2767
|
+
const cssModuleSources = new Map;
|
|
2768
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2769
|
+
namespace: "absolute-style-module",
|
|
2770
|
+
path: path.slice("absolute-style-module:".length)
|
|
2771
|
+
}));
|
|
2772
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2773
|
+
const source = cssModuleSources.get(path);
|
|
2774
|
+
if (!source) {
|
|
2775
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2776
|
+
}
|
|
2777
|
+
return {
|
|
2778
|
+
contents: source.css,
|
|
2779
|
+
loader: "css"
|
|
2780
|
+
};
|
|
2781
|
+
});
|
|
2782
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2783
|
+
if (isStyleModulePath(path)) {
|
|
2784
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
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}`)};`;
|
|
2789
|
+
return {
|
|
2790
|
+
contents: exportSource,
|
|
2791
|
+
loader: "js"
|
|
2792
|
+
};
|
|
2793
|
+
}
|
|
2794
|
+
return {
|
|
2795
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
2796
|
+
loader: "css"
|
|
2797
|
+
};
|
|
2798
|
+
});
|
|
2799
|
+
}
|
|
2800
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
2554
2801
|
style: async ({
|
|
2555
2802
|
attributes,
|
|
2556
2803
|
content,
|
|
@@ -2561,63 +2808,30 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2561
2808
|
return;
|
|
2562
2809
|
const path = filename ?? `style.${language}`;
|
|
2563
2810
|
return {
|
|
2564
|
-
code: await compileStyleSource(path, content, language)
|
|
2811
|
+
code: await compileStyleSource(path, content, language, config)
|
|
2565
2812
|
};
|
|
2566
2813
|
}
|
|
2567
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
2814
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
2568
2815
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2569
2816
|
return readFile(filePath, "utf-8");
|
|
2570
2817
|
}
|
|
2571
|
-
return compileStyleSource(filePath);
|
|
2818
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2572
2819
|
};
|
|
2573
2820
|
var init_stylePreprocessor = __esm(() => {
|
|
2574
|
-
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
2575
|
-
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less)$/i;
|
|
2576
|
-
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;
|
|
2577
2824
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2578
2825
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2579
2826
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
2580
|
-
stylePreprocessorPlugin =
|
|
2581
|
-
name: "absolute-style-preprocessor",
|
|
2582
|
-
setup(build) {
|
|
2583
|
-
const cssModuleSources = new Map;
|
|
2584
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2585
|
-
namespace: "absolute-style-module",
|
|
2586
|
-
path: path.slice("absolute-style-module:".length)
|
|
2587
|
-
}));
|
|
2588
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2589
|
-
const sourcePath = cssModuleSources.get(path);
|
|
2590
|
-
if (!sourcePath) {
|
|
2591
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2592
|
-
}
|
|
2593
|
-
return {
|
|
2594
|
-
contents: await compileStyleSource(sourcePath),
|
|
2595
|
-
loader: "css"
|
|
2596
|
-
};
|
|
2597
|
-
});
|
|
2598
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2599
|
-
if (isStyleModulePath(path)) {
|
|
2600
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2601
|
-
cssModuleSources.set(cssModulePath, path);
|
|
2602
|
-
return {
|
|
2603
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2604
|
-
loader: "js"
|
|
2605
|
-
};
|
|
2606
|
-
}
|
|
2607
|
-
return {
|
|
2608
|
-
contents: await compileStyleSource(path),
|
|
2609
|
-
loader: "css"
|
|
2610
|
-
};
|
|
2611
|
-
});
|
|
2612
|
-
}
|
|
2613
|
-
};
|
|
2827
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
2614
2828
|
});
|
|
2615
2829
|
|
|
2616
2830
|
// src/core/svelteServerModule.ts
|
|
2617
2831
|
import { mkdir, readdir } from "fs/promises";
|
|
2618
|
-
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as
|
|
2832
|
+
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative as relative2, resolve as resolve5 } from "path";
|
|
2619
2833
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2620
|
-
const importPath =
|
|
2834
|
+
const importPath = relative2(dirname3(from), target).replace(/\\/g, "/");
|
|
2621
2835
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2622
2836
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
2623
2837
|
for (const entry of entries) {
|
|
@@ -2663,7 +2877,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2663
2877
|
if (!spec.startsWith(".")) {
|
|
2664
2878
|
return null;
|
|
2665
2879
|
}
|
|
2666
|
-
const basePath =
|
|
2880
|
+
const basePath = resolve5(dirname3(from), spec);
|
|
2667
2881
|
const candidates = [
|
|
2668
2882
|
basePath,
|
|
2669
2883
|
`${basePath}.ts`,
|
|
@@ -2681,7 +2895,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2681
2895
|
const foundIndex = existResults.indexOf(true);
|
|
2682
2896
|
return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
|
|
2683
2897
|
}, getCachedModulePath = (sourcePath) => {
|
|
2684
|
-
const relativeSourcePath =
|
|
2898
|
+
const relativeSourcePath = relative2(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2685
2899
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2686
2900
|
return join4(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
2687
2901
|
}, resolveSvelteImport = async (spec, from) => {
|
|
@@ -2695,7 +2909,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2695
2909
|
if (!spec.startsWith(".")) {
|
|
2696
2910
|
return null;
|
|
2697
2911
|
}
|
|
2698
|
-
const explicitPath =
|
|
2912
|
+
const explicitPath = resolve5(dirname3(from), spec);
|
|
2699
2913
|
if (extname2(explicitPath) === ".svelte") {
|
|
2700
2914
|
return explicitPath;
|
|
2701
2915
|
}
|
|
@@ -2950,7 +3164,7 @@ import {
|
|
|
2950
3164
|
rmSync,
|
|
2951
3165
|
writeFileSync as writeFileSync2
|
|
2952
3166
|
} from "fs";
|
|
2953
|
-
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";
|
|
2954
3168
|
import ts from "typescript";
|
|
2955
3169
|
var frameworks, isRecord4 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
|
|
2956
3170
|
if (isRecord4(mod.islandRegistry))
|
|
@@ -2959,13 +3173,13 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
|
|
|
2959
3173
|
return mod.default;
|
|
2960
3174
|
throw new Error("Island registry module must export `islandRegistry` or a default registry object.");
|
|
2961
3175
|
}, normalizeImportPath = (wrapperPath, targetPath) => {
|
|
2962
|
-
const importPath =
|
|
3176
|
+
const importPath = relative3(dirname4(wrapperPath), targetPath).replace(/\\/g, "/");
|
|
2963
3177
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2964
3178
|
}, isIdentifier = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value), resolveIslandSourcePath = (registryPath, sourcePath) => {
|
|
2965
3179
|
if (sourcePath.startsWith("file://")) {
|
|
2966
3180
|
return new URL(sourcePath).pathname;
|
|
2967
3181
|
}
|
|
2968
|
-
return
|
|
3182
|
+
return resolve6(dirname4(registryPath), sourcePath);
|
|
2969
3183
|
}, getObjectPropertyName = (name) => {
|
|
2970
3184
|
if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {
|
|
2971
3185
|
return name.text;
|
|
@@ -3128,7 +3342,7 @@ export default component;
|
|
|
3128
3342
|
generatedRoot
|
|
3129
3343
|
};
|
|
3130
3344
|
}, loadIslandRegistryBuildInfo = async (registryPath) => {
|
|
3131
|
-
const resolvedRegistryPath =
|
|
3345
|
+
const resolvedRegistryPath = resolve6(registryPath);
|
|
3132
3346
|
const registrySource = Bun.file(resolvedRegistryPath);
|
|
3133
3347
|
const registrySourceText = await registrySource.text();
|
|
3134
3348
|
const registryModule = await import(resolvedRegistryPath);
|
|
@@ -3217,7 +3431,7 @@ var init_staticStreaming = __esm(() => {
|
|
|
3217
3431
|
});
|
|
3218
3432
|
|
|
3219
3433
|
// src/build/staticIslandPages.ts
|
|
3220
|
-
import { readFileSync as
|
|
3434
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
3221
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) => {
|
|
3222
3436
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
3223
3437
|
const attributes = new Map;
|
|
@@ -3346,7 +3560,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
3346
3560
|
}
|
|
3347
3561
|
return result + originalHtml.slice(nextIndex);
|
|
3348
3562
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
3349
|
-
const originalHtml =
|
|
3563
|
+
const originalHtml = readFileSync4(pagePath, "utf-8");
|
|
3350
3564
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
3351
3565
|
if (transformedHtml !== originalHtml) {
|
|
3352
3566
|
writeFileSync3(pagePath, transformedHtml);
|
|
@@ -3382,10 +3596,10 @@ var init_staticIslandPages = __esm(() => {
|
|
|
3382
3596
|
});
|
|
3383
3597
|
|
|
3384
3598
|
// src/build/scanEntryPoints.ts
|
|
3385
|
-
import { existsSync as
|
|
3599
|
+
import { existsSync as existsSync5 } from "fs";
|
|
3386
3600
|
var {Glob } = globalThis.Bun;
|
|
3387
3601
|
var scanEntryPoints = async (dir, pattern) => {
|
|
3388
|
-
if (!
|
|
3602
|
+
if (!existsSync5(dir))
|
|
3389
3603
|
return [];
|
|
3390
3604
|
const entryPaths = [];
|
|
3391
3605
|
const glob = new Glob(pattern);
|
|
@@ -3474,8 +3688,8 @@ var init_sourceMetadata = __esm(() => {
|
|
|
3474
3688
|
});
|
|
3475
3689
|
|
|
3476
3690
|
// src/islands/pageMetadata.ts
|
|
3477
|
-
import { readFileSync as
|
|
3478
|
-
import { dirname as dirname5, resolve as
|
|
3691
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
3692
|
+
import { dirname as dirname5, resolve as resolve9 } from "path";
|
|
3479
3693
|
var pagePatterns, getPageDirs = (config) => [
|
|
3480
3694
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
3481
3695
|
{ dir: config.reactDirectory, framework: "react" },
|
|
@@ -3494,15 +3708,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
3494
3708
|
const source = definition.buildReference?.source;
|
|
3495
3709
|
if (!source)
|
|
3496
3710
|
continue;
|
|
3497
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
3498
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
3711
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve9(dirname5(buildInfo.resolvedRegistryPath), source);
|
|
3712
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve9(resolvedSource));
|
|
3499
3713
|
}
|
|
3500
3714
|
return lookup;
|
|
3501
3715
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata2, target) => metadata2.islands.some((usage) => {
|
|
3502
3716
|
const candidate = usage.source;
|
|
3503
|
-
return candidate ?
|
|
3717
|
+
return candidate ? resolve9(candidate) === target : false;
|
|
3504
3718
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
3505
|
-
const target =
|
|
3719
|
+
const target = resolve9(sourcePath);
|
|
3506
3720
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata2) => metadataUsesSource(metadata2, target)).map((metadata2) => metadata2.pagePath);
|
|
3507
3721
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
3508
3722
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -3514,13 +3728,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
3514
3728
|
const pattern = pagePatterns[entry.framework];
|
|
3515
3729
|
if (!pattern)
|
|
3516
3730
|
return;
|
|
3517
|
-
const files = await scanEntryPoints(
|
|
3731
|
+
const files = await scanEntryPoints(resolve9(entry.dir), pattern);
|
|
3518
3732
|
for (const filePath of files) {
|
|
3519
|
-
const source =
|
|
3733
|
+
const source = readFileSync5(filePath, "utf-8");
|
|
3520
3734
|
const islands = extractIslandUsagesFromSource(source);
|
|
3521
|
-
pageMetadata.set(
|
|
3735
|
+
pageMetadata.set(resolve9(filePath), {
|
|
3522
3736
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
3523
|
-
pagePath:
|
|
3737
|
+
pagePath: resolve9(filePath)
|
|
3524
3738
|
});
|
|
3525
3739
|
}
|
|
3526
3740
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -3599,9 +3813,9 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
3599
3813
|
}, generateManifest = (outputs, buildPath) => outputs.reduce((manifest, artifact) => {
|
|
3600
3814
|
const normalizedArtifactPath = normalizePath(artifact.path);
|
|
3601
3815
|
const normalizedBuildPath = normalizePath(buildPath);
|
|
3602
|
-
let
|
|
3603
|
-
|
|
3604
|
-
const segments =
|
|
3816
|
+
let relative4 = normalizedArtifactPath.startsWith(normalizedBuildPath) ? normalizedArtifactPath.slice(normalizedBuildPath.length) : normalizedArtifactPath;
|
|
3817
|
+
relative4 = relative4.replace(/^\/+/, "");
|
|
3818
|
+
const segments = relative4.split("/");
|
|
3605
3819
|
const fileWithHash = segments.pop();
|
|
3606
3820
|
if (!fileWithHash)
|
|
3607
3821
|
return manifest;
|
|
@@ -3613,15 +3827,15 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
3613
3827
|
const islandIndex = segments.findIndex((seg) => seg === "islands");
|
|
3614
3828
|
if (ext === ".css") {
|
|
3615
3829
|
const cssKey = getCssKey(pascalName, segments);
|
|
3616
|
-
if (manifest[cssKey] && manifest[cssKey] !== `/${
|
|
3617
|
-
logWarn(`Duplicate manifest key "${cssKey}" \u2014 "${manifest[cssKey]}" will be overwritten by "/${
|
|
3618
|
-
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}`;
|
|
3619
3833
|
return manifest;
|
|
3620
3834
|
}
|
|
3621
3835
|
const frameworkSegment = islandIndex > UNFOUND_INDEX ? segments[islandIndex + 1] : undefined;
|
|
3622
3836
|
if (frameworkSegment === "react" || frameworkSegment === "svelte" || frameworkSegment === "vue" || frameworkSegment === "angular") {
|
|
3623
3837
|
const manifestKey2 = getIslandManifestKey(frameworkSegment, pascalName);
|
|
3624
|
-
manifest[manifestKey2] = `/${
|
|
3838
|
+
manifest[manifestKey2] = `/${relative4}`;
|
|
3625
3839
|
return manifest;
|
|
3626
3840
|
}
|
|
3627
3841
|
const idx = segments.findIndex((seg) => seg === "indexes" || seg === "pages" || seg === "client");
|
|
@@ -3632,10 +3846,10 @@ var getManifestKey = (folder, pascalName, isClientComponent, isReact, isVue, isS
|
|
|
3632
3846
|
const isAngular = segments.some((seg) => seg === "angular");
|
|
3633
3847
|
const isClientComponent = segments.includes("client");
|
|
3634
3848
|
const manifestKey = getManifestKey(folder, pascalName, isClientComponent, isReact, isVue, isSvelte, isAngular);
|
|
3635
|
-
if (manifest[manifestKey] && manifest[manifestKey] !== `/${
|
|
3636
|
-
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.`);
|
|
3637
3851
|
}
|
|
3638
|
-
manifest[manifestKey] = `/${
|
|
3852
|
+
manifest[manifestKey] = `/${relative4}`;
|
|
3639
3853
|
return manifest;
|
|
3640
3854
|
}, {});
|
|
3641
3855
|
var init_generateManifest = __esm(() => {
|
|
@@ -3648,22 +3862,22 @@ var exports_generateReactIndexes = {};
|
|
|
3648
3862
|
__export(exports_generateReactIndexes, {
|
|
3649
3863
|
generateReactIndexFiles: () => generateReactIndexFiles
|
|
3650
3864
|
});
|
|
3651
|
-
import { existsSync as
|
|
3865
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync2 } from "fs";
|
|
3652
3866
|
import { readdir as readdir2, rm, writeFile } from "fs/promises";
|
|
3653
|
-
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";
|
|
3654
3868
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
3655
3869
|
var indexContentCache, resolveDevClientDir = () => {
|
|
3656
3870
|
const projectRoot = process.cwd();
|
|
3657
|
-
const fromSource =
|
|
3658
|
-
if (
|
|
3871
|
+
const fromSource = resolve10(import.meta.dir, "../dev/client");
|
|
3872
|
+
if (existsSync6(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3659
3873
|
return fromSource;
|
|
3660
3874
|
}
|
|
3661
|
-
const fromNodeModules =
|
|
3662
|
-
if (
|
|
3875
|
+
const fromNodeModules = resolve10(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
3876
|
+
if (existsSync6(fromNodeModules))
|
|
3663
3877
|
return fromNodeModules;
|
|
3664
|
-
return
|
|
3878
|
+
return resolve10(import.meta.dir, "./dev/client");
|
|
3665
3879
|
}, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
|
|
3666
|
-
if (!
|
|
3880
|
+
if (!existsSync6(reactIndexesDirectory)) {
|
|
3667
3881
|
mkdirSync2(reactIndexesDirectory, { recursive: true });
|
|
3668
3882
|
}
|
|
3669
3883
|
const CONVENTION_RE = /^(?:(.+)\.)?(error|loading|not-found)\.[^.]+$/;
|
|
@@ -3689,7 +3903,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3689
3903
|
});
|
|
3690
3904
|
}));
|
|
3691
3905
|
}
|
|
3692
|
-
const pagesRelPath =
|
|
3906
|
+
const pagesRelPath = relative4(resolve10(reactIndexesDirectory), resolve10(reactPagesDirectory)).split(sep).join("/");
|
|
3693
3907
|
const promises = files.map(async (file2) => {
|
|
3694
3908
|
const fileName = basename3(file2);
|
|
3695
3909
|
const [componentName] = fileName.split(".");
|
|
@@ -3949,7 +4163,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3949
4163
|
`
|
|
3950
4164
|
// Pre-warm: import the page module from the module server`,
|
|
3951
4165
|
`// immediately so the browser caches all /@src/ URLs.`,
|
|
3952
|
-
`import('/@src/${
|
|
4166
|
+
`import('/@src/${relative4(process.cwd(), resolve10(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\/g, "/")}').catch(() => {});`
|
|
3953
4167
|
] : []
|
|
3954
4168
|
].join(`
|
|
3955
4169
|
`);
|
|
@@ -3957,7 +4171,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3957
4171
|
const hasher = new Bun.CryptoHasher("md5");
|
|
3958
4172
|
hasher.update(content);
|
|
3959
4173
|
const contentHash = hasher.digest("hex");
|
|
3960
|
-
if (indexContentCache.get(indexPath) === contentHash &&
|
|
4174
|
+
if (indexContentCache.get(indexPath) === contentHash && existsSync6(indexPath)) {
|
|
3961
4175
|
return;
|
|
3962
4176
|
}
|
|
3963
4177
|
indexContentCache.set(indexPath, contentHash);
|
|
@@ -3968,7 +4182,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3968
4182
|
return;
|
|
3969
4183
|
}
|
|
3970
4184
|
const refreshPath = join6(reactIndexesDirectory, "_refresh.tsx");
|
|
3971
|
-
if (!
|
|
4185
|
+
if (!existsSync6(refreshPath)) {
|
|
3972
4186
|
await writeFile(refreshPath, `import '${refreshSetupPath}';
|
|
3973
4187
|
import 'react';
|
|
3974
4188
|
import 'react-dom/client';
|
|
@@ -4048,7 +4262,7 @@ var init_outputLogs = __esm(() => {
|
|
|
4048
4262
|
// src/build/scanConventions.ts
|
|
4049
4263
|
import { basename as basename4 } from "path";
|
|
4050
4264
|
var {Glob: Glob3 } = globalThis.Bun;
|
|
4051
|
-
import { existsSync as
|
|
4265
|
+
import { existsSync as existsSync7 } from "fs";
|
|
4052
4266
|
var CONVENTION_RE, classifyFile = (file2, pageFiles, defaults, pages) => {
|
|
4053
4267
|
const fileName = basename4(file2);
|
|
4054
4268
|
const match = CONVENTION_RE.exec(fileName);
|
|
@@ -4073,7 +4287,7 @@ var CONVENTION_RE, classifyFile = (file2, pageFiles, defaults, pages) => {
|
|
|
4073
4287
|
else if (kind === "loading")
|
|
4074
4288
|
pages[pageName].loading = file2;
|
|
4075
4289
|
}, scanConventions = async (pagesDir, pattern) => {
|
|
4076
|
-
if (!
|
|
4290
|
+
if (!existsSync7(pagesDir)) {
|
|
4077
4291
|
const pageFiles2 = [];
|
|
4078
4292
|
return { conventions: undefined, pageFiles: pageFiles2 };
|
|
4079
4293
|
}
|
|
@@ -4096,13 +4310,13 @@ var init_scanConventions = __esm(() => {
|
|
|
4096
4310
|
});
|
|
4097
4311
|
|
|
4098
4312
|
// src/build/scanCssEntryPoints.ts
|
|
4099
|
-
import { existsSync as
|
|
4313
|
+
import { existsSync as existsSync8 } from "fs";
|
|
4100
4314
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
4101
4315
|
var scanCssEntryPoints = async (dir, ignore) => {
|
|
4102
|
-
if (!
|
|
4316
|
+
if (!existsSync8(dir))
|
|
4103
4317
|
return [];
|
|
4104
4318
|
const entryPaths = [];
|
|
4105
|
-
const glob = new Glob4("**/*.{css,scss,sass,less}");
|
|
4319
|
+
const glob = new Glob4("**/*.{css,scss,sass,less,styl,stylus}");
|
|
4106
4320
|
for await (const file2 of glob.scan({ absolute: true, cwd: dir })) {
|
|
4107
4321
|
const normalized = normalizePath(file2);
|
|
4108
4322
|
if (isStyleModulePath(normalized) || ignore?.some((pattern) => normalized.includes(pattern)))
|
|
@@ -4116,8 +4330,8 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
4116
4330
|
});
|
|
4117
4331
|
|
|
4118
4332
|
// src/utils/imageProcessing.ts
|
|
4119
|
-
import { existsSync as
|
|
4120
|
-
import { join as join7, resolve as
|
|
4333
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
4334
|
+
import { join as join7, resolve as resolve11 } from "path";
|
|
4121
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) => {
|
|
4122
4336
|
for (const size of sizes) {
|
|
4123
4337
|
if (size >= target)
|
|
@@ -4171,7 +4385,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
4171
4385
|
return [...device, ...image2].sort((left, right) => left - right);
|
|
4172
4386
|
}, getCacheDir = (buildDir) => {
|
|
4173
4387
|
const dir = join7(buildDir, ".cache", "images");
|
|
4174
|
-
if (!
|
|
4388
|
+
if (!existsSync9(dir))
|
|
4175
4389
|
mkdirSync3(dir, { recursive: true });
|
|
4176
4390
|
return dir;
|
|
4177
4391
|
}, getCacheKey = (url, width, quality, format) => {
|
|
@@ -4229,11 +4443,11 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
4229
4443
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
4230
4444
|
const metaPath = join7(cacheDir, `${cacheKey}.meta`);
|
|
4231
4445
|
const dataPath = join7(cacheDir, `${cacheKey}.data`);
|
|
4232
|
-
if (!
|
|
4446
|
+
if (!existsSync9(metaPath) || !existsSync9(dataPath))
|
|
4233
4447
|
return null;
|
|
4234
4448
|
try {
|
|
4235
|
-
const meta = JSON.parse(
|
|
4236
|
-
const buffer =
|
|
4449
|
+
const meta = JSON.parse(readFileSync6(metaPath, "utf-8"));
|
|
4450
|
+
const buffer = readFileSync6(dataPath);
|
|
4237
4451
|
return { buffer, meta };
|
|
4238
4452
|
} catch {
|
|
4239
4453
|
return null;
|
|
@@ -4243,7 +4457,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
4243
4457
|
return sharpModule;
|
|
4244
4458
|
sharpLoaded = true;
|
|
4245
4459
|
try {
|
|
4246
|
-
const sharpPath =
|
|
4460
|
+
const sharpPath = resolve11(process.cwd(), "node_modules/sharp");
|
|
4247
4461
|
const mod = await import(sharpPath);
|
|
4248
4462
|
sharpModule = mod.default ?? mod;
|
|
4249
4463
|
return sharpModule;
|
|
@@ -4348,14 +4562,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
4348
4562
|
});
|
|
4349
4563
|
|
|
4350
4564
|
// src/cli/scripts/telemetry.ts
|
|
4351
|
-
import { existsSync as
|
|
4565
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
|
|
4352
4566
|
import { homedir } from "os";
|
|
4353
4567
|
import { join as join8 } from "path";
|
|
4354
4568
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
4355
4569
|
try {
|
|
4356
|
-
if (!
|
|
4570
|
+
if (!existsSync10(configPath))
|
|
4357
4571
|
return null;
|
|
4358
|
-
const raw =
|
|
4572
|
+
const raw = readFileSync7(configPath, "utf-8");
|
|
4359
4573
|
const config = JSON.parse(raw);
|
|
4360
4574
|
return config;
|
|
4361
4575
|
} catch {
|
|
@@ -4368,14 +4582,14 @@ var init_telemetry = __esm(() => {
|
|
|
4368
4582
|
});
|
|
4369
4583
|
|
|
4370
4584
|
// src/cli/telemetryEvent.ts
|
|
4371
|
-
import { existsSync as
|
|
4585
|
+
import { existsSync as existsSync11, readFileSync as readFileSync8 } from "fs";
|
|
4372
4586
|
import { arch, platform } from "os";
|
|
4373
4587
|
import { dirname as dirname6, join as join9, parse } from "path";
|
|
4374
4588
|
var checkCandidate = (candidate) => {
|
|
4375
|
-
if (!
|
|
4589
|
+
if (!existsSync11(candidate)) {
|
|
4376
4590
|
return null;
|
|
4377
4591
|
}
|
|
4378
|
-
const pkg = JSON.parse(
|
|
4592
|
+
const pkg = JSON.parse(readFileSync8(candidate, "utf-8"));
|
|
4379
4593
|
if (pkg.name === "@absolutejs/absolute") {
|
|
4380
4594
|
const ver = pkg.version;
|
|
4381
4595
|
return ver;
|
|
@@ -4480,19 +4694,19 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
4480
4694
|
});
|
|
4481
4695
|
|
|
4482
4696
|
// src/dev/buildHMRClient.ts
|
|
4483
|
-
import { existsSync as
|
|
4484
|
-
import { resolve as
|
|
4697
|
+
import { existsSync as existsSync12 } from "fs";
|
|
4698
|
+
import { resolve as resolve12 } from "path";
|
|
4485
4699
|
var {build: bunBuild } = globalThis.Bun;
|
|
4486
4700
|
var resolveHmrClientPath = () => {
|
|
4487
4701
|
const projectRoot = process.cwd();
|
|
4488
|
-
const fromSource =
|
|
4489
|
-
if (
|
|
4702
|
+
const fromSource = resolve12(import.meta.dir, "client/hmrClient.ts");
|
|
4703
|
+
if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4490
4704
|
return fromSource;
|
|
4491
4705
|
}
|
|
4492
|
-
const fromNodeModules =
|
|
4493
|
-
if (
|
|
4706
|
+
const fromNodeModules = resolve12(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
4707
|
+
if (existsSync12(fromNodeModules))
|
|
4494
4708
|
return fromNodeModules;
|
|
4495
|
-
return
|
|
4709
|
+
return resolve12(import.meta.dir, "dev/client/hmrClient.ts");
|
|
4496
4710
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
4497
4711
|
const entryPoint = hmrClientPath2;
|
|
4498
4712
|
const result = await bunBuild({
|
|
@@ -4522,7 +4736,7 @@ var init_buildHMRClient = __esm(() => {
|
|
|
4522
4736
|
// src/build/nativeRewrite.ts
|
|
4523
4737
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
4524
4738
|
import { platform as platform2, arch as arch2 } from "os";
|
|
4525
|
-
import { resolve as
|
|
4739
|
+
import { resolve as resolve13 } from "path";
|
|
4526
4740
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
4527
4741
|
if (nativeLib !== null)
|
|
4528
4742
|
return nativeLib;
|
|
@@ -4540,7 +4754,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
4540
4754
|
if (!libPath)
|
|
4541
4755
|
return null;
|
|
4542
4756
|
try {
|
|
4543
|
-
const fullPath =
|
|
4757
|
+
const fullPath = resolve13(import.meta.dir, "../../native/packages", libPath);
|
|
4544
4758
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
4545
4759
|
nativeLib = lib.symbols;
|
|
4546
4760
|
return nativeLib;
|
|
@@ -4682,12 +4896,12 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
4682
4896
|
};
|
|
4683
4897
|
|
|
4684
4898
|
// src/build/angularLinkerPlugin.ts
|
|
4685
|
-
import { existsSync as
|
|
4686
|
-
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";
|
|
4687
4901
|
import { createHash } from "crypto";
|
|
4688
4902
|
var CACHE_DIR, angularLinkerPlugin;
|
|
4689
4903
|
var init_angularLinkerPlugin = __esm(() => {
|
|
4690
|
-
CACHE_DIR =
|
|
4904
|
+
CACHE_DIR = resolve14(".absolutejs", "cache", "angular-linker");
|
|
4691
4905
|
angularLinkerPlugin = {
|
|
4692
4906
|
name: "angular-linker",
|
|
4693
4907
|
setup(bld) {
|
|
@@ -4707,9 +4921,9 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4707
4921
|
}
|
|
4708
4922
|
const hash = createHash("md5").update(source).digest("hex");
|
|
4709
4923
|
const cachePath = join10(CACHE_DIR, `${hash}.js`);
|
|
4710
|
-
if (
|
|
4924
|
+
if (existsSync13(cachePath)) {
|
|
4711
4925
|
return {
|
|
4712
|
-
contents:
|
|
4926
|
+
contents: readFileSync9(cachePath, "utf-8"),
|
|
4713
4927
|
loader: "js"
|
|
4714
4928
|
};
|
|
4715
4929
|
}
|
|
@@ -4724,10 +4938,10 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4724
4938
|
linkerPlugin = mod.createEs2015LinkerPlugin({
|
|
4725
4939
|
fileSystem: {
|
|
4726
4940
|
dirname: dirname7,
|
|
4727
|
-
exists:
|
|
4728
|
-
readFile:
|
|
4729
|
-
relative:
|
|
4730
|
-
resolve:
|
|
4941
|
+
exists: existsSync13,
|
|
4942
|
+
readFile: readFileSync9,
|
|
4943
|
+
relative: relative5,
|
|
4944
|
+
resolve: resolve14
|
|
4731
4945
|
},
|
|
4732
4946
|
linkerJitMode: false,
|
|
4733
4947
|
logger: {
|
|
@@ -4761,17 +4975,17 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4761
4975
|
|
|
4762
4976
|
// src/utils/cleanStaleOutputs.ts
|
|
4763
4977
|
import { rm as rm2 } from "fs/promises";
|
|
4764
|
-
import { resolve as
|
|
4978
|
+
import { resolve as resolve15 } from "path";
|
|
4765
4979
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
4766
4980
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
4767
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
4981
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve15(path)));
|
|
4768
4982
|
const glob = new Glob5("**/*");
|
|
4769
4983
|
const removals = [];
|
|
4770
|
-
for (const
|
|
4771
|
-
const absolute =
|
|
4984
|
+
for (const relative6 of glob.scanSync({ cwd: buildPath })) {
|
|
4985
|
+
const absolute = resolve15(buildPath, relative6);
|
|
4772
4986
|
if (currentPaths.has(absolute))
|
|
4773
4987
|
continue;
|
|
4774
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
4988
|
+
if (!HASHED_FILE_PATTERN.test(relative6))
|
|
4775
4989
|
continue;
|
|
4776
4990
|
removals.push(rm2(absolute, { force: true }));
|
|
4777
4991
|
}
|
|
@@ -4829,11 +5043,11 @@ var commonAncestor = (paths, fallback) => {
|
|
|
4829
5043
|
var init_commonAncestor = () => {};
|
|
4830
5044
|
|
|
4831
5045
|
// src/utils/validateSafePath.ts
|
|
4832
|
-
import { resolve as
|
|
5046
|
+
import { resolve as resolve16, relative as relative6 } from "path";
|
|
4833
5047
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
4834
|
-
const absoluteBase =
|
|
4835
|
-
const absoluteTarget =
|
|
4836
|
-
const relativePath = normalizePath(
|
|
5048
|
+
const absoluteBase = resolve16(baseDirectory);
|
|
5049
|
+
const absoluteTarget = resolve16(baseDirectory, targetPath);
|
|
5050
|
+
const relativePath = normalizePath(relative6(absoluteBase, absoluteTarget));
|
|
4837
5051
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
4838
5052
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
4839
5053
|
}
|
|
@@ -4902,29 +5116,29 @@ __export(exports_compileSvelte, {
|
|
|
4902
5116
|
compileSvelte: () => compileSvelte,
|
|
4903
5117
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
4904
5118
|
});
|
|
4905
|
-
import { existsSync as
|
|
5119
|
+
import { existsSync as existsSync14 } from "fs";
|
|
4906
5120
|
import { mkdir as mkdir2, stat } from "fs/promises";
|
|
4907
5121
|
import {
|
|
4908
5122
|
dirname as dirname8,
|
|
4909
5123
|
join as join12,
|
|
4910
5124
|
basename as basename5,
|
|
4911
5125
|
extname as extname5,
|
|
4912
|
-
resolve as
|
|
4913
|
-
relative as
|
|
5126
|
+
resolve as resolve17,
|
|
5127
|
+
relative as relative7,
|
|
4914
5128
|
sep as sep2
|
|
4915
5129
|
} from "path";
|
|
4916
5130
|
import { env as env2 } from "process";
|
|
4917
5131
|
var {write, file: file2, Transpiler } = globalThis.Bun;
|
|
4918
5132
|
var resolveDevClientDir2 = () => {
|
|
4919
5133
|
const projectRoot = process.cwd();
|
|
4920
|
-
const fromSource =
|
|
4921
|
-
if (
|
|
5134
|
+
const fromSource = resolve17(import.meta.dir, "../dev/client");
|
|
5135
|
+
if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4922
5136
|
return fromSource;
|
|
4923
5137
|
}
|
|
4924
|
-
const fromNodeModules =
|
|
4925
|
-
if (
|
|
5138
|
+
const fromNodeModules = resolve17(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
5139
|
+
if (existsSync14(fromNodeModules))
|
|
4926
5140
|
return fromNodeModules;
|
|
4927
|
-
return
|
|
5141
|
+
return resolve17(import.meta.dir, "./dev/client");
|
|
4928
5142
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
4929
5143
|
persistentCache.clear();
|
|
4930
5144
|
sourceHashCache.clear();
|
|
@@ -4954,7 +5168,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4954
5168
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
4955
5169
|
if (!spec.startsWith("."))
|
|
4956
5170
|
return null;
|
|
4957
|
-
const basePath =
|
|
5171
|
+
const basePath = resolve17(dirname8(from), spec);
|
|
4958
5172
|
const candidates = [
|
|
4959
5173
|
basePath,
|
|
4960
5174
|
`${basePath}.ts`,
|
|
@@ -4981,7 +5195,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4981
5195
|
const resolved = resolvePackageImport(spec);
|
|
4982
5196
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
4983
5197
|
}
|
|
4984
|
-
const basePath =
|
|
5198
|
+
const basePath = resolve17(dirname8(from), spec);
|
|
4985
5199
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
4986
5200
|
if (!explicit) {
|
|
4987
5201
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -5002,13 +5216,13 @@ var resolveDevClientDir2 = () => {
|
|
|
5002
5216
|
return jsPath;
|
|
5003
5217
|
return null;
|
|
5004
5218
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
5005
|
-
const toServer =
|
|
5006
|
-
const toClient =
|
|
5219
|
+
const toServer = relative7(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
5220
|
+
const toClient = relative7(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
5007
5221
|
rewrites.set(rawSpec, {
|
|
5008
5222
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
5009
5223
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
5010
5224
|
});
|
|
5011
|
-
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false) => {
|
|
5225
|
+
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
|
|
5012
5226
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
5013
5227
|
const generatedDir = join12(svelteRoot, "generated");
|
|
5014
5228
|
const clientDir = join12(generatedDir, "client");
|
|
@@ -5036,13 +5250,13 @@ var resolveDevClientDir2 = () => {
|
|
|
5036
5250
|
const loweredServerSource = isModule ? loweredAwaitServerSource : lowerSvelteIslandSyntax(loweredAwaitServerSource.code, "server");
|
|
5037
5251
|
const loweredClientSource = isModule ? loweredAwaitClientSource : lowerSvelteIslandSyntax(loweredAwaitClientSource.code, "client");
|
|
5038
5252
|
const transformedByLowering = loweredAwaitServerSource.transformed || loweredAwaitClientSource.transformed || loweredServerSource.transformed || loweredClientSource.transformed;
|
|
5039
|
-
const svelteStylePreprocessor = createSvelteStylePreprocessor();
|
|
5253
|
+
const svelteStylePreprocessor = createSvelteStylePreprocessor(stylePreprocessors);
|
|
5040
5254
|
const preprocessedServer = isModule ? loweredServerSource.code : (await preprocess(loweredServerSource.code, svelteStylePreprocessor)).code;
|
|
5041
5255
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
5042
5256
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
5043
5257
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedClient) : preprocessedClient;
|
|
5044
|
-
const rawRel = dirname8(
|
|
5045
|
-
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;
|
|
5046
5260
|
const baseName = basename5(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
5047
5261
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
5048
5262
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -5063,15 +5277,15 @@ var resolveDevClientDir2 = () => {
|
|
|
5063
5277
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
5064
5278
|
if (!resolved)
|
|
5065
5279
|
continue;
|
|
5066
|
-
const childRel =
|
|
5280
|
+
const childRel = relative7(svelteRoot, resolved).replace(/\\/g, "/");
|
|
5067
5281
|
if (!childRel.startsWith(".."))
|
|
5068
5282
|
continue;
|
|
5069
5283
|
const childBuilt2 = cache.get(resolved);
|
|
5070
5284
|
if (!childBuilt2)
|
|
5071
5285
|
continue;
|
|
5072
5286
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
5073
|
-
const toServer =
|
|
5074
|
-
const toClient =
|
|
5287
|
+
const toServer = relative7(ssrOutputDir, childBuilt2.ssr).replace(/\\/g, "/");
|
|
5288
|
+
const toClient = relative7(clientOutputDir, childBuilt2.client).replace(/\\/g, "/");
|
|
5075
5289
|
externalRewrites.set(origSpec, {
|
|
5076
5290
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
5077
5291
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -5106,7 +5320,7 @@ var resolveDevClientDir2 = () => {
|
|
|
5106
5320
|
}).js.code;
|
|
5107
5321
|
let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
5108
5322
|
if (mode === "client" && isDev2) {
|
|
5109
|
-
const moduleKey = `/@src/${
|
|
5323
|
+
const moduleKey = `/@src/${relative7(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
5110
5324
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
5111
5325
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
5112
5326
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -5149,10 +5363,10 @@ var resolveDevClientDir2 = () => {
|
|
|
5149
5363
|
};
|
|
5150
5364
|
const roots = await Promise.all(entryPoints.map(build2));
|
|
5151
5365
|
await Promise.all(roots.map(async ({ client: client2, hasAwaitSlot }) => {
|
|
5152
|
-
const relClientDir = dirname8(
|
|
5366
|
+
const relClientDir = dirname8(relative7(clientDir, client2));
|
|
5153
5367
|
const name = basename5(client2, extname5(client2));
|
|
5154
5368
|
const indexPath = join12(indexDir, relClientDir, `${name}.js`);
|
|
5155
|
-
const importRaw =
|
|
5369
|
+
const importRaw = relative7(dirname8(indexPath), client2).split(sep2).join("/");
|
|
5156
5370
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
5157
5371
|
const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
5158
5372
|
import "${hmrClientPath3}";
|
|
@@ -5229,7 +5443,7 @@ if (typeof window !== "undefined") {
|
|
|
5229
5443
|
return {
|
|
5230
5444
|
svelteClientPaths: roots.map(({ client: client2 }) => client2),
|
|
5231
5445
|
svelteIndexPaths: roots.map(({ client: client2 }) => {
|
|
5232
|
-
const rel = dirname8(
|
|
5446
|
+
const rel = dirname8(relative7(clientDir, client2));
|
|
5233
5447
|
return join12(indexDir, rel, basename5(client2));
|
|
5234
5448
|
}),
|
|
5235
5449
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -5259,20 +5473,20 @@ __export(exports_compileVue, {
|
|
|
5259
5473
|
compileVue: () => compileVue,
|
|
5260
5474
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
5261
5475
|
});
|
|
5262
|
-
import { existsSync as
|
|
5476
|
+
import { existsSync as existsSync15 } from "fs";
|
|
5263
5477
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
5264
|
-
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";
|
|
5265
5479
|
var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
5266
5480
|
var resolveDevClientDir3 = () => {
|
|
5267
5481
|
const projectRoot = process.cwd();
|
|
5268
|
-
const fromSource =
|
|
5269
|
-
if (
|
|
5482
|
+
const fromSource = resolve18(import.meta.dir, "../dev/client");
|
|
5483
|
+
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
5270
5484
|
return fromSource;
|
|
5271
5485
|
}
|
|
5272
|
-
const fromNodeModules =
|
|
5273
|
-
if (
|
|
5486
|
+
const fromNodeModules = resolve18(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
5487
|
+
if (existsSync15(fromNodeModules))
|
|
5274
5488
|
return fromNodeModules;
|
|
5275
|
-
return
|
|
5489
|
+
return resolve18(import.meta.dir, "./dev/client");
|
|
5276
5490
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
5277
5491
|
scriptCache.clear();
|
|
5278
5492
|
scriptSetupCache.clear();
|
|
@@ -5311,7 +5525,7 @@ var resolveDevClientDir3 = () => {
|
|
|
5311
5525
|
return "template-only";
|
|
5312
5526
|
}
|
|
5313
5527
|
return "full";
|
|
5314
|
-
}, 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) => {
|
|
5315
5529
|
if (filePath.endsWith(".vue"))
|
|
5316
5530
|
return filePath.replace(/\.vue$/, ".js");
|
|
5317
5531
|
if (filePath.endsWith(".ts"))
|
|
@@ -5334,11 +5548,11 @@ var resolveDevClientDir3 = () => {
|
|
|
5334
5548
|
].join(`
|
|
5335
5549
|
`) : nonVueLines.join(`
|
|
5336
5550
|
`);
|
|
5337
|
-
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler) => {
|
|
5551
|
+
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler, stylePreprocessors) => {
|
|
5338
5552
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
5339
5553
|
if (cachedResult)
|
|
5340
5554
|
return cachedResult;
|
|
5341
|
-
const relativeFilePath =
|
|
5555
|
+
const relativeFilePath = relative8(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
5342
5556
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
5343
5557
|
const fileBaseName = basename6(sourceFilePath, ".vue");
|
|
5344
5558
|
const componentId = toKebab(fileBaseName);
|
|
@@ -5372,8 +5586,8 @@ var resolveDevClientDir3 = () => {
|
|
|
5372
5586
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
5373
5587
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue"));
|
|
5374
5588
|
const childBuildResults = await Promise.all([
|
|
5375
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
5376
|
-
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler))
|
|
5589
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve18(dirname9(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
5590
|
+
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
5377
5591
|
]);
|
|
5378
5592
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
5379
5593
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
@@ -5408,7 +5622,7 @@ var resolveDevClientDir3 = () => {
|
|
|
5408
5622
|
filename: sourceFilePath,
|
|
5409
5623
|
id: componentId,
|
|
5410
5624
|
scoped: styleBlock.scoped,
|
|
5411
|
-
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang) : styleBlock.content,
|
|
5625
|
+
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang, stylePreprocessors) : styleBlock.content,
|
|
5412
5626
|
trim: true
|
|
5413
5627
|
}).code));
|
|
5414
5628
|
const allCss = [
|
|
@@ -5462,7 +5676,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5462
5676
|
let result2 = code;
|
|
5463
5677
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
5464
5678
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
5465
|
-
let rel =
|
|
5679
|
+
let rel = relative8(dirname9(outputPath), targetPath).replace(/\\/g, "/");
|
|
5466
5680
|
if (!rel.startsWith("."))
|
|
5467
5681
|
rel = `./${rel}`;
|
|
5468
5682
|
result2 = result2.replaceAll(bareImport, rel);
|
|
@@ -5480,14 +5694,14 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5480
5694
|
hmrId,
|
|
5481
5695
|
serverPath: serverOutputPath,
|
|
5482
5696
|
tsHelperPaths: [
|
|
5483
|
-
...helperModulePaths.map((helper) =>
|
|
5697
|
+
...helperModulePaths.map((helper) => resolve18(dirname9(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
5484
5698
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
5485
5699
|
]
|
|
5486
5700
|
};
|
|
5487
5701
|
cacheMap.set(sourceFilePath, result);
|
|
5488
5702
|
persistentBuildCache.set(sourceFilePath, result);
|
|
5489
5703
|
return result;
|
|
5490
|
-
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false) => {
|
|
5704
|
+
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors) => {
|
|
5491
5705
|
const compiler = await import("@vue/compiler-sfc");
|
|
5492
5706
|
const generatedDir = join13(vueRootDir, "generated");
|
|
5493
5707
|
const clientOutputDir = join13(generatedDir, "client");
|
|
@@ -5503,15 +5717,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5503
5717
|
const buildCache = new Map;
|
|
5504
5718
|
const allTsHelperPaths = new Set;
|
|
5505
5719
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
5506
|
-
const result = await compileVueFile(
|
|
5720
|
+
const result = await compileVueFile(resolve18(entryPath), {
|
|
5507
5721
|
client: clientOutputDir,
|
|
5508
5722
|
css: cssOutputDir,
|
|
5509
5723
|
server: serverOutputDir
|
|
5510
|
-
}, buildCache, true, vueRootDir, compiler);
|
|
5724
|
+
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
5511
5725
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
5512
5726
|
const entryBaseName = basename6(entryPath, ".vue");
|
|
5513
5727
|
const indexOutputFile = join13(indexOutputDir, `${entryBaseName}.js`);
|
|
5514
|
-
const clientOutputFile = join13(clientOutputDir,
|
|
5728
|
+
const clientOutputFile = join13(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
5515
5729
|
await mkdir3(dirname9(indexOutputFile), { recursive: true });
|
|
5516
5730
|
const vueHmrImports = isDev2 ? [
|
|
5517
5731
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -5519,7 +5733,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5519
5733
|
] : [];
|
|
5520
5734
|
await write2(indexOutputFile, [
|
|
5521
5735
|
...vueHmrImports,
|
|
5522
|
-
`import Comp from "${
|
|
5736
|
+
`import Comp from "${relative8(dirname9(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
5523
5737
|
'import { createSSRApp, createApp } from "vue";',
|
|
5524
5738
|
"",
|
|
5525
5739
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -5639,7 +5853,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5639
5853
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
5640
5854
|
const sourceCode = await file3(tsPath).text();
|
|
5641
5855
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
5642
|
-
const relativeJsPath =
|
|
5856
|
+
const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
5643
5857
|
const outClientPath = join13(clientOutputDir, relativeJsPath);
|
|
5644
5858
|
const outServerPath = join13(serverOutputDir, relativeJsPath);
|
|
5645
5859
|
await mkdir3(dirname9(outClientPath), { recursive: true });
|
|
@@ -6140,27 +6354,27 @@ __export(exports_compileAngular, {
|
|
|
6140
6354
|
compileAngularFile: () => compileAngularFile,
|
|
6141
6355
|
compileAngular: () => compileAngular
|
|
6142
6356
|
});
|
|
6143
|
-
import { existsSync as
|
|
6144
|
-
import { join as join14, basename as basename7, sep as sep3, dirname as dirname10, resolve 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";
|
|
6145
6359
|
import ts2 from "typescript";
|
|
6146
6360
|
import { createHash as createHash2 } from "crypto";
|
|
6147
6361
|
var computeConfigHash = () => {
|
|
6148
6362
|
try {
|
|
6149
|
-
const content =
|
|
6363
|
+
const content = readFileSync10("./tsconfig.json", "utf-8");
|
|
6150
6364
|
return createHash2("md5").update(content).digest("hex");
|
|
6151
6365
|
} catch {
|
|
6152
6366
|
return "";
|
|
6153
6367
|
}
|
|
6154
6368
|
}, resolveDevClientDir4 = () => {
|
|
6155
6369
|
const projectRoot = process.cwd();
|
|
6156
|
-
const fromSource =
|
|
6157
|
-
if (
|
|
6370
|
+
const fromSource = resolve19(import.meta.dir, "../dev/client");
|
|
6371
|
+
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
6158
6372
|
return fromSource;
|
|
6159
6373
|
}
|
|
6160
|
-
const fromNodeModules =
|
|
6161
|
-
if (
|
|
6374
|
+
const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
6375
|
+
if (existsSync16(fromNodeModules))
|
|
6162
6376
|
return fromNodeModules;
|
|
6163
|
-
return
|
|
6377
|
+
return resolve19(import.meta.dir, "./dev/client");
|
|
6164
6378
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
6165
6379
|
const componentClassRegex = /(?:export\s+)?class\s+(\w+Component)\s/g;
|
|
6166
6380
|
const componentNames = [];
|
|
@@ -6226,7 +6440,7 @@ ${registrations}
|
|
|
6226
6440
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
6227
6441
|
if (!isRelativeModuleSpecifier(specifier))
|
|
6228
6442
|
return null;
|
|
6229
|
-
const basePath =
|
|
6443
|
+
const basePath = resolve19(dirname10(fromFile), specifier);
|
|
6230
6444
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
6231
6445
|
`${basePath}.ts`,
|
|
6232
6446
|
`${basePath}.tsx`,
|
|
@@ -6237,24 +6451,24 @@ ${registrations}
|
|
|
6237
6451
|
join14(basePath, "index.mts"),
|
|
6238
6452
|
join14(basePath, "index.cts")
|
|
6239
6453
|
];
|
|
6240
|
-
return candidates.map((candidate) =>
|
|
6454
|
+
return candidates.map((candidate) => resolve19(candidate)).find((candidate) => existsSync16(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
6241
6455
|
}, readFileForAotTransform = async (fileName, readFile4) => {
|
|
6242
6456
|
const hostSource = readFile4?.(fileName);
|
|
6243
6457
|
if (typeof hostSource === "string")
|
|
6244
6458
|
return hostSource;
|
|
6245
6459
|
return fs.readFile(fileName, "utf-8");
|
|
6246
|
-
}, precomputeAotResourceTransforms = async (inputPath, readFile4) => {
|
|
6460
|
+
}, precomputeAotResourceTransforms = async (inputPath, readFile4, stylePreprocessors) => {
|
|
6247
6461
|
const transformedSources = new Map;
|
|
6248
6462
|
const visited = new Set;
|
|
6249
6463
|
const transformFile = async (filePath) => {
|
|
6250
|
-
const resolvedPath =
|
|
6464
|
+
const resolvedPath = resolve19(filePath);
|
|
6251
6465
|
if (visited.has(resolvedPath))
|
|
6252
6466
|
return;
|
|
6253
6467
|
visited.add(resolvedPath);
|
|
6254
|
-
if (!
|
|
6468
|
+
if (!existsSync16(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
6255
6469
|
return;
|
|
6256
6470
|
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
6257
|
-
const transformed = await inlineResources(source, dirname10(resolvedPath));
|
|
6471
|
+
const transformed = await inlineResources(source, dirname10(resolvedPath), stylePreprocessors);
|
|
6258
6472
|
transformedSources.set(resolvedPath, transformed.source);
|
|
6259
6473
|
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
6260
6474
|
await Promise.all(imports.map(async (specifier) => {
|
|
@@ -6265,8 +6479,8 @@ ${registrations}
|
|
|
6265
6479
|
};
|
|
6266
6480
|
await transformFile(inputPath);
|
|
6267
6481
|
return transformedSources;
|
|
6268
|
-
}, compileAngularFile = async (inputPath, outDir) => {
|
|
6269
|
-
const islandMetadataExports = buildIslandMetadataExports(
|
|
6482
|
+
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
6483
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync10(inputPath, "utf-8"));
|
|
6270
6484
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
6271
6485
|
const configHash = computeConfigHash();
|
|
6272
6486
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -6281,7 +6495,7 @@ ${registrations}
|
|
|
6281
6495
|
} else {
|
|
6282
6496
|
const tsPath = __require.resolve("typescript");
|
|
6283
6497
|
const tsRootDir = dirname10(tsPath);
|
|
6284
|
-
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir :
|
|
6498
|
+
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve19(tsRootDir, "lib");
|
|
6285
6499
|
const config = readConfiguration("./tsconfig.json");
|
|
6286
6500
|
options = {
|
|
6287
6501
|
emitDecoratorMetadata: true,
|
|
@@ -6328,13 +6542,13 @@ ${registrations}
|
|
|
6328
6542
|
};
|
|
6329
6543
|
}
|
|
6330
6544
|
const emitted = {};
|
|
6331
|
-
const resolvedOutDir =
|
|
6545
|
+
const resolvedOutDir = resolve19(outDir);
|
|
6332
6546
|
host.writeFile = (fileName, text) => {
|
|
6333
6547
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
6334
6548
|
emitted[relativePath] = text;
|
|
6335
6549
|
};
|
|
6336
6550
|
const originalReadFile = host.readFile;
|
|
6337
|
-
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host));
|
|
6551
|
+
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host), stylePreprocessors);
|
|
6338
6552
|
host.readFile = (fileName) => {
|
|
6339
6553
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
6340
6554
|
if (typeof source !== "string")
|
|
@@ -6342,7 +6556,7 @@ ${registrations}
|
|
|
6342
6556
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
6343
6557
|
return source;
|
|
6344
6558
|
}
|
|
6345
|
-
const resolvedPath =
|
|
6559
|
+
const resolvedPath = resolve19(fileName);
|
|
6346
6560
|
return aotTransformedSources.get(resolvedPath) ?? source;
|
|
6347
6561
|
};
|
|
6348
6562
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
@@ -6387,8 +6601,8 @@ ${registrations}
|
|
|
6387
6601
|
await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
|
|
6388
6602
|
return entries.map(({ target }) => target);
|
|
6389
6603
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
6390
|
-
const sourceEntry =
|
|
6391
|
-
if (
|
|
6604
|
+
const sourceEntry = resolve19(import.meta.dir, "../angular/components/index.ts");
|
|
6605
|
+
if (existsSync16(sourceEntry)) {
|
|
6392
6606
|
return sourceEntry.replace(/\\/g, "/");
|
|
6393
6607
|
}
|
|
6394
6608
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -6515,16 +6729,16 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
6515
6729
|
return rewritten.replace(/export(?:\s+default)?\s+class\s+([A-Za-z_$][\w$]*)\s*{/, (match) => `${match}
|
|
6516
6730
|
${fields}
|
|
6517
6731
|
`);
|
|
6518
|
-
}, readAndEscapeFile = async (filePath) => {
|
|
6519
|
-
if (!
|
|
6732
|
+
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
6733
|
+
if (!existsSync16(filePath))
|
|
6520
6734
|
return null;
|
|
6521
|
-
const content = await compileStyleFileIfNeeded(filePath);
|
|
6735
|
+
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
6522
6736
|
return escapeTemplateContent(content);
|
|
6523
6737
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
6524
6738
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
6525
6739
|
if (templateUrlMatch?.[1]) {
|
|
6526
6740
|
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
6527
|
-
if (!
|
|
6741
|
+
if (!existsSync16(templatePath)) {
|
|
6528
6742
|
return { deferSlots: [], source };
|
|
6529
6743
|
}
|
|
6530
6744
|
const templateRaw2 = await fs.readFile(templatePath, "utf-8");
|
|
@@ -6555,10 +6769,10 @@ ${fields}
|
|
|
6555
6769
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
6556
6770
|
if (templateUrlMatch?.[1]) {
|
|
6557
6771
|
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
6558
|
-
if (!
|
|
6772
|
+
if (!existsSync16(templatePath)) {
|
|
6559
6773
|
return { deferSlots: [], source };
|
|
6560
6774
|
}
|
|
6561
|
-
const templateRaw2 =
|
|
6775
|
+
const templateRaw2 = readFileSync10(templatePath, "utf-8");
|
|
6562
6776
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
6563
6777
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
6564
6778
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -6582,7 +6796,7 @@ ${fields}
|
|
|
6582
6796
|
deferSlots: lowered.slots,
|
|
6583
6797
|
source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
|
|
6584
6798
|
};
|
|
6585
|
-
}, inlineStyleUrls = async (source, fileDir) => {
|
|
6799
|
+
}, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
|
|
6586
6800
|
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
6587
6801
|
if (!styleUrlsMatch?.[1])
|
|
6588
6802
|
return source;
|
|
@@ -6591,35 +6805,35 @@ ${fields}
|
|
|
6591
6805
|
return source;
|
|
6592
6806
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
6593
6807
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
6594
|
-
return readAndEscapeFile(join14(fileDir, styleUrl));
|
|
6808
|
+
return readAndEscapeFile(join14(fileDir, styleUrl), stylePreprocessors);
|
|
6595
6809
|
});
|
|
6596
6810
|
const results = await Promise.all(stylePromises);
|
|
6597
6811
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
6598
6812
|
if (inlinedStyles.length === 0)
|
|
6599
6813
|
return source;
|
|
6600
6814
|
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
6601
|
-
}, inlineSingleStyleUrl = async (source, fileDir) => {
|
|
6815
|
+
}, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
|
|
6602
6816
|
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
6603
6817
|
if (!styleUrlMatch?.[1])
|
|
6604
6818
|
return source;
|
|
6605
|
-
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]));
|
|
6819
|
+
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
6606
6820
|
if (!escaped)
|
|
6607
6821
|
return source;
|
|
6608
6822
|
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
6609
|
-
}, inlineResources = async (source, fileDir) => {
|
|
6823
|
+
}, inlineResources = async (source, fileDir, stylePreprocessors) => {
|
|
6610
6824
|
const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
|
|
6611
6825
|
let result = inlinedTemplate.source;
|
|
6612
|
-
result = await inlineStyleUrls(result, fileDir);
|
|
6613
|
-
result = await inlineSingleStyleUrl(result, fileDir);
|
|
6826
|
+
result = await inlineStyleUrls(result, fileDir, stylePreprocessors);
|
|
6827
|
+
result = await inlineSingleStyleUrl(result, fileDir, stylePreprocessors);
|
|
6614
6828
|
return {
|
|
6615
6829
|
deferSlots: inlinedTemplate.deferSlots,
|
|
6616
6830
|
source: result
|
|
6617
6831
|
};
|
|
6618
|
-
}, compileAngularFileJIT = async (inputPath, outDir, rootDir) => {
|
|
6619
|
-
const entryPath =
|
|
6832
|
+
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors) => {
|
|
6833
|
+
const entryPath = resolve19(inputPath);
|
|
6620
6834
|
const allOutputs = [];
|
|
6621
6835
|
const visited = new Set;
|
|
6622
|
-
const baseDir =
|
|
6836
|
+
const baseDir = resolve19(rootDir ?? process.cwd());
|
|
6623
6837
|
const angularTranspiler = new Bun.Transpiler({
|
|
6624
6838
|
loader: "ts",
|
|
6625
6839
|
tsconfig: JSON.stringify({
|
|
@@ -6656,23 +6870,23 @@ ${fields}
|
|
|
6656
6870
|
return `${prefix}${dots}`;
|
|
6657
6871
|
return `${prefix}../${dots}`;
|
|
6658
6872
|
});
|
|
6659
|
-
if (
|
|
6873
|
+
if (resolve19(actualPath) === entryPath) {
|
|
6660
6874
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
6661
6875
|
}
|
|
6662
6876
|
return processedContent;
|
|
6663
6877
|
};
|
|
6664
6878
|
const transpileFile = async (filePath) => {
|
|
6665
|
-
const resolved =
|
|
6879
|
+
const resolved = resolve19(filePath);
|
|
6666
6880
|
if (visited.has(resolved))
|
|
6667
6881
|
return;
|
|
6668
6882
|
visited.add(resolved);
|
|
6669
6883
|
let actualPath = resolved;
|
|
6670
6884
|
if (!actualPath.endsWith(".ts"))
|
|
6671
6885
|
actualPath += ".ts";
|
|
6672
|
-
if (!
|
|
6886
|
+
if (!existsSync16(actualPath))
|
|
6673
6887
|
return;
|
|
6674
6888
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
6675
|
-
const inlined = await inlineResources(sourceCode, dirname10(actualPath));
|
|
6889
|
+
const inlined = await inlineResources(sourceCode, dirname10(actualPath), stylePreprocessors);
|
|
6676
6890
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname10(actualPath)).source;
|
|
6677
6891
|
const inputDir = dirname10(actualPath);
|
|
6678
6892
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
@@ -6693,7 +6907,7 @@ ${fields}
|
|
|
6693
6907
|
}
|
|
6694
6908
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
6695
6909
|
const cacheKey2 = actualPath;
|
|
6696
|
-
if (jitContentCache.get(cacheKey2) === contentHash &&
|
|
6910
|
+
if (jitContentCache.get(cacheKey2) === contentHash && existsSync16(targetPath)) {
|
|
6697
6911
|
allOutputs.push(targetPath);
|
|
6698
6912
|
} else {
|
|
6699
6913
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath);
|
|
@@ -6704,13 +6918,13 @@ ${fields}
|
|
|
6704
6918
|
}
|
|
6705
6919
|
const inputDirForResolve = dirname10(actualPath);
|
|
6706
6920
|
await Promise.all(localImports.map((imp) => {
|
|
6707
|
-
const importPath =
|
|
6921
|
+
const importPath = resolve19(inputDirForResolve, imp);
|
|
6708
6922
|
return transpileFile(importPath);
|
|
6709
6923
|
}));
|
|
6710
6924
|
};
|
|
6711
6925
|
await transpileFile(inputPath);
|
|
6712
6926
|
return allOutputs;
|
|
6713
|
-
}, compileAngular = async (entryPoints, outRoot, hmr = false) => {
|
|
6927
|
+
}, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
|
|
6714
6928
|
const compiledParent = join14(outRoot, "generated");
|
|
6715
6929
|
if (entryPoints.length === 0) {
|
|
6716
6930
|
const emptyPaths = [];
|
|
@@ -6720,9 +6934,9 @@ ${fields}
|
|
|
6720
6934
|
const indexesDir = join14(compiledParent, "indexes");
|
|
6721
6935
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
6722
6936
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
6723
|
-
const resolvedEntry =
|
|
6724
|
-
const relativeEntry =
|
|
6725
|
-
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot) : compileAngularFile(resolvedEntry, compiledRoot);
|
|
6937
|
+
const resolvedEntry = resolve19(entry);
|
|
6938
|
+
const relativeEntry = relative9(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
6939
|
+
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
6726
6940
|
let outputs = await compileEntry();
|
|
6727
6941
|
const fileBase = basename7(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
6728
6942
|
const jsName = `${fileBase}.js`;
|
|
@@ -6730,18 +6944,18 @@ ${fields}
|
|
|
6730
6944
|
join14(compiledRoot, relativeEntry),
|
|
6731
6945
|
join14(compiledRoot, "pages", jsName),
|
|
6732
6946
|
join14(compiledRoot, jsName)
|
|
6733
|
-
].map((file4) =>
|
|
6947
|
+
].map((file4) => resolve19(file4));
|
|
6734
6948
|
const resolveRawServerFile = (candidatePaths) => {
|
|
6735
6949
|
const normalizedCandidates = [
|
|
6736
|
-
...candidatePaths.map((file4) =>
|
|
6950
|
+
...candidatePaths.map((file4) => resolve19(file4)),
|
|
6737
6951
|
...compiledFallbackPaths
|
|
6738
6952
|
];
|
|
6739
|
-
let candidate = normalizedCandidates.find((file4) =>
|
|
6953
|
+
let candidate = normalizedCandidates.find((file4) => existsSync16(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
6740
6954
|
if (!candidate) {
|
|
6741
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
6955
|
+
candidate = normalizedCandidates.find((file4) => existsSync16(file4) && file4.endsWith(`${sep3}${jsName}`));
|
|
6742
6956
|
}
|
|
6743
6957
|
if (!candidate) {
|
|
6744
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
6958
|
+
candidate = normalizedCandidates.find((file4) => existsSync16(file4));
|
|
6745
6959
|
}
|
|
6746
6960
|
return candidate;
|
|
6747
6961
|
};
|
|
@@ -6749,11 +6963,11 @@ ${fields}
|
|
|
6749
6963
|
if (!rawServerFile) {
|
|
6750
6964
|
rawServerFile = resolveRawServerFile([]);
|
|
6751
6965
|
}
|
|
6752
|
-
if (rawServerFile && !
|
|
6966
|
+
if (rawServerFile && !existsSync16(rawServerFile)) {
|
|
6753
6967
|
outputs = await compileEntry();
|
|
6754
6968
|
rawServerFile = resolveRawServerFile(outputs);
|
|
6755
6969
|
}
|
|
6756
|
-
if (!rawServerFile || !
|
|
6970
|
+
if (!rawServerFile || !existsSync16(rawServerFile)) {
|
|
6757
6971
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
6758
6972
|
...outputs,
|
|
6759
6973
|
...compiledFallbackPaths
|
|
@@ -6764,7 +6978,7 @@ ${fields}
|
|
|
6764
6978
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
6765
6979
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
6766
6980
|
const clientFile = join14(indexesDir, jsName);
|
|
6767
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
6981
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync16(clientFile)) {
|
|
6768
6982
|
return {
|
|
6769
6983
|
clientPath: clientFile,
|
|
6770
6984
|
indexUnchanged: true,
|
|
@@ -6798,7 +7012,7 @@ export default ${componentClassName};
|
|
|
6798
7012
|
await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
|
|
6799
7013
|
}
|
|
6800
7014
|
await fs.writeFile(rawServerFile, rewritten, "utf-8");
|
|
6801
|
-
const relativePath =
|
|
7015
|
+
const relativePath = relative9(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
6802
7016
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
6803
7017
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
6804
7018
|
import "${hmrRuntimePath}";
|
|
@@ -6963,25 +7177,25 @@ __export(exports_buildReactVendor, {
|
|
|
6963
7177
|
computeVendorPaths: () => computeVendorPaths,
|
|
6964
7178
|
buildReactVendor: () => buildReactVendor
|
|
6965
7179
|
});
|
|
6966
|
-
import { existsSync as
|
|
6967
|
-
import { join as join15, resolve as
|
|
7180
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync6 } from "fs";
|
|
7181
|
+
import { join as join15, resolve as resolve20 } from "path";
|
|
6968
7182
|
import { rm as rm4 } from "fs/promises";
|
|
6969
7183
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
6970
7184
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
6971
7185
|
const candidates = [
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
7186
|
+
resolve20(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
7187
|
+
resolve20(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
7188
|
+
resolve20(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
7189
|
+
resolve20(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
7190
|
+
resolve20(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
7191
|
+
resolve20(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
6978
7192
|
];
|
|
6979
7193
|
for (const candidate of candidates) {
|
|
6980
|
-
if (
|
|
7194
|
+
if (existsSync17(candidate)) {
|
|
6981
7195
|
return candidate.replace(/\\/g, "/");
|
|
6982
7196
|
}
|
|
6983
7197
|
}
|
|
6984
|
-
return (candidates[0] ??
|
|
7198
|
+
return (candidates[0] ?? resolve20(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
6985
7199
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
6986
7200
|
try {
|
|
6987
7201
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -7153,11 +7367,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
7153
7367
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
7154
7368
|
return;
|
|
7155
7369
|
}
|
|
7156
|
-
const { readFileSync:
|
|
7370
|
+
const { readFileSync: readFileSync11, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
7157
7371
|
const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
7158
7372
|
for (const file4 of files) {
|
|
7159
7373
|
const filePath = join17(vendorDir, file4);
|
|
7160
|
-
const content =
|
|
7374
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
7161
7375
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
7162
7376
|
continue;
|
|
7163
7377
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -7280,14 +7494,14 @@ var init_rewriteImports = __esm(() => {
|
|
|
7280
7494
|
import {
|
|
7281
7495
|
copyFileSync,
|
|
7282
7496
|
cpSync,
|
|
7283
|
-
existsSync as
|
|
7497
|
+
existsSync as existsSync18,
|
|
7284
7498
|
mkdirSync as mkdirSync10,
|
|
7285
|
-
readFileSync as
|
|
7499
|
+
readFileSync as readFileSync11,
|
|
7286
7500
|
rmSync as rmSync2,
|
|
7287
7501
|
statSync,
|
|
7288
7502
|
writeFileSync as writeFileSync7
|
|
7289
7503
|
} from "fs";
|
|
7290
|
-
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";
|
|
7291
7505
|
import { cwd, env as env3, exit } from "process";
|
|
7292
7506
|
var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
|
|
7293
7507
|
var isDev2, collectConventionSourceFiles = (entry) => {
|
|
@@ -7375,8 +7589,8 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7375
7589
|
}
|
|
7376
7590
|
}, resolveAbsoluteVersion = async () => {
|
|
7377
7591
|
const candidates = [
|
|
7378
|
-
|
|
7379
|
-
|
|
7592
|
+
resolve21(import.meta.dir, "..", "..", "package.json"),
|
|
7593
|
+
resolve21(import.meta.dir, "..", "package.json")
|
|
7380
7594
|
];
|
|
7381
7595
|
for (const candidate of candidates) {
|
|
7382
7596
|
const pkg = await tryReadPackageJson(candidate);
|
|
@@ -7388,7 +7602,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7388
7602
|
return;
|
|
7389
7603
|
}
|
|
7390
7604
|
}, SKIP_DIRS, addWorkerPathIfExists = (file4, relPath, workerPaths) => {
|
|
7391
|
-
const absPath =
|
|
7605
|
+
const absPath = resolve21(file4, "..", relPath);
|
|
7392
7606
|
try {
|
|
7393
7607
|
statSync(absPath);
|
|
7394
7608
|
workerPaths.add(absPath);
|
|
@@ -7403,7 +7617,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7403
7617
|
addWorkerPathIfExists(file4, relPath, workerPaths);
|
|
7404
7618
|
}
|
|
7405
7619
|
}, collectWorkerPathsFromFile = (file4, patterns, workerPaths) => {
|
|
7406
|
-
const content =
|
|
7620
|
+
const content = readFileSync11(file4, "utf-8");
|
|
7407
7621
|
for (const pattern of patterns) {
|
|
7408
7622
|
collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
|
|
7409
7623
|
}
|
|
@@ -7448,39 +7662,39 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7448
7662
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
7449
7663
|
}
|
|
7450
7664
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
7451
|
-
if (!
|
|
7665
|
+
if (!existsSync18(reactIndexesPath)) {
|
|
7452
7666
|
return;
|
|
7453
7667
|
}
|
|
7454
7668
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
7455
|
-
const pagesRel =
|
|
7669
|
+
const pagesRel = relative10(process.cwd(), resolve21(reactPagesPath)).replace(/\\/g, "/");
|
|
7456
7670
|
for (const file4 of indexFiles) {
|
|
7457
|
-
let content =
|
|
7671
|
+
let content = readFileSync11(join19(reactIndexesPath, file4), "utf-8");
|
|
7458
7672
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
7459
7673
|
writeFileSync7(join19(devIndexDir, file4), content);
|
|
7460
7674
|
}
|
|
7461
7675
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
7462
7676
|
const svelteIndexDir = join19(svelteDir, "generated", "indexes");
|
|
7463
|
-
const sveltePageEntries = svelteEntries.filter((file4) =>
|
|
7677
|
+
const sveltePageEntries = svelteEntries.filter((file4) => resolve21(file4).startsWith(resolve21(sveltePagesPath)));
|
|
7464
7678
|
for (const entry of sveltePageEntries) {
|
|
7465
7679
|
const name = basename8(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
7466
7680
|
const indexFile = join19(svelteIndexDir, "pages", `${name}.js`);
|
|
7467
|
-
if (!
|
|
7681
|
+
if (!existsSync18(indexFile))
|
|
7468
7682
|
continue;
|
|
7469
|
-
let content =
|
|
7470
|
-
const srcRel =
|
|
7683
|
+
let content = readFileSync11(indexFile, "utf-8");
|
|
7684
|
+
const srcRel = relative10(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
7471
7685
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
7472
7686
|
writeFileSync7(join19(devIndexDir, `${name}.svelte.js`), content);
|
|
7473
7687
|
}
|
|
7474
7688
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
7475
7689
|
const vueIndexDir = join19(vueDir, "generated", "indexes");
|
|
7476
|
-
const vuePageEntries = vueEntries.filter((file4) =>
|
|
7690
|
+
const vuePageEntries = vueEntries.filter((file4) => resolve21(file4).startsWith(resolve21(vuePagesPath)));
|
|
7477
7691
|
for (const entry of vuePageEntries) {
|
|
7478
7692
|
const name = basename8(entry, ".vue");
|
|
7479
7693
|
const indexFile = join19(vueIndexDir, `${name}.js`);
|
|
7480
|
-
if (!
|
|
7694
|
+
if (!existsSync18(indexFile))
|
|
7481
7695
|
continue;
|
|
7482
|
-
let content =
|
|
7483
|
-
const srcRel =
|
|
7696
|
+
let content = readFileSync11(indexFile, "utf-8");
|
|
7697
|
+
const srcRel = relative10(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
7484
7698
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
7485
7699
|
writeFileSync7(join19(devIndexDir, `${name}.vue.js`), content);
|
|
7486
7700
|
}
|
|
@@ -7493,7 +7707,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7493
7707
|
const last = allComments[allComments.length - 1];
|
|
7494
7708
|
if (!last?.[1])
|
|
7495
7709
|
return JSON.stringify(outputPath);
|
|
7496
|
-
const srcPath =
|
|
7710
|
+
const srcPath = resolve21(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
7497
7711
|
return JSON.stringify(srcPath);
|
|
7498
7712
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
7499
7713
|
let depth = 0;
|
|
@@ -7530,7 +7744,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7530
7744
|
}
|
|
7531
7745
|
return result;
|
|
7532
7746
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
7533
|
-
let content =
|
|
7747
|
+
let content = readFileSync11(outputPath, "utf-8");
|
|
7534
7748
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
7535
7749
|
const useNames = [];
|
|
7536
7750
|
let match;
|
|
@@ -7555,7 +7769,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7555
7769
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
7556
7770
|
const urlFileMap = new Map;
|
|
7557
7771
|
for (const srcPath of urlReferencedFiles) {
|
|
7558
|
-
const rel =
|
|
7772
|
+
const rel = relative10(projectRoot, srcPath).replace(/\\/g, "/");
|
|
7559
7773
|
const name = basename8(srcPath);
|
|
7560
7774
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
7561
7775
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -7570,7 +7784,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7570
7784
|
const output = nonReactClientOutputs.find((artifact) => basename8(artifact.path).startsWith(`${srcBase}.`));
|
|
7571
7785
|
if (!output)
|
|
7572
7786
|
continue;
|
|
7573
|
-
urlFileMap.set(basename8(srcPath), `/${
|
|
7787
|
+
urlFileMap.set(basename8(srcPath), `/${relative10(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
7574
7788
|
}
|
|
7575
7789
|
return urlFileMap;
|
|
7576
7790
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -7580,7 +7794,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7580
7794
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
7581
7795
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
7582
7796
|
for (const outputPath of outputPaths) {
|
|
7583
|
-
let content =
|
|
7797
|
+
let content = readFileSync11(outputPath, "utf-8");
|
|
7584
7798
|
let changed = false;
|
|
7585
7799
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
7586
7800
|
const targetName = basename8(relPath);
|
|
@@ -7605,6 +7819,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7605
7819
|
svelteDirectory,
|
|
7606
7820
|
vueDirectory,
|
|
7607
7821
|
stylesConfig,
|
|
7822
|
+
stylePreprocessors,
|
|
7608
7823
|
tailwind,
|
|
7609
7824
|
options,
|
|
7610
7825
|
incrementalFiles,
|
|
@@ -7614,6 +7829,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7614
7829
|
const projectRoot = cwd();
|
|
7615
7830
|
await resolveAbsoluteVersion();
|
|
7616
7831
|
const isIncremental = incrementalFiles && incrementalFiles.length > 0;
|
|
7832
|
+
const stylePreprocessorPlugin2 = createStylePreprocessorPlugin(stylePreprocessors);
|
|
7617
7833
|
const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
|
|
7618
7834
|
const throwOnError = options?.throwOnError === true;
|
|
7619
7835
|
const hmr = options?.injectHMR === true;
|
|
@@ -7702,13 +7918,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7702
7918
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
7703
7919
|
if (!isIncremental || !incrementalFiles)
|
|
7704
7920
|
return entryPoints;
|
|
7705
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f) =>
|
|
7921
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f) => resolve21(f)));
|
|
7706
7922
|
const matchingEntries = [];
|
|
7707
7923
|
for (const entry of entryPoints) {
|
|
7708
7924
|
const sourceFile = mapToSource(entry);
|
|
7709
7925
|
if (!sourceFile)
|
|
7710
7926
|
continue;
|
|
7711
|
-
if (!normalizedIncremental.has(
|
|
7927
|
+
if (!normalizedIncremental.has(resolve21(sourceFile)))
|
|
7712
7928
|
continue;
|
|
7713
7929
|
matchingEntries.push(entry);
|
|
7714
7930
|
}
|
|
@@ -7777,7 +7993,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7777
7993
|
}
|
|
7778
7994
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || isStylePath(f)));
|
|
7779
7995
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
7780
|
-
if (entry.startsWith(
|
|
7996
|
+
if (entry.startsWith(resolve21(reactIndexesPath))) {
|
|
7781
7997
|
const pageName = basename8(entry, ".tsx");
|
|
7782
7998
|
return join19(reactPagesPath, `${pageName}.tsx`);
|
|
7783
7999
|
}
|
|
@@ -7809,28 +8025,28 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7809
8025
|
{ vueClientPaths: islandVueClientPaths },
|
|
7810
8026
|
{ clientPaths: islandAngularClientPaths }
|
|
7811
8027
|
] = await Promise.all([
|
|
7812
|
-
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr)) : {
|
|
8028
|
+
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
7813
8029
|
svelteClientPaths: [...emptyStringArray],
|
|
7814
8030
|
svelteIndexPaths: [...emptyStringArray],
|
|
7815
8031
|
svelteServerPaths: [...emptyStringArray]
|
|
7816
8032
|
},
|
|
7817
|
-
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr)) : {
|
|
8033
|
+
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr, stylePreprocessors)) : {
|
|
7818
8034
|
vueClientPaths: [...emptyStringArray],
|
|
7819
8035
|
vueCssPaths: [...emptyStringArray],
|
|
7820
8036
|
vueIndexPaths: [...emptyStringArray],
|
|
7821
8037
|
vueServerPaths: [...emptyStringArray]
|
|
7822
8038
|
},
|
|
7823
|
-
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr)) : {
|
|
8039
|
+
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr, stylePreprocessors)) : {
|
|
7824
8040
|
clientPaths: [...emptyStringArray],
|
|
7825
8041
|
serverPaths: [...emptyStringArray]
|
|
7826
8042
|
},
|
|
7827
|
-
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr)) : {
|
|
8043
|
+
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
7828
8044
|
svelteClientPaths: [...emptyStringArray]
|
|
7829
8045
|
},
|
|
7830
|
-
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr)) : {
|
|
8046
|
+
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr, stylePreprocessors)) : {
|
|
7831
8047
|
vueClientPaths: [...emptyStringArray]
|
|
7832
8048
|
},
|
|
7833
|
-
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr)) : {
|
|
8049
|
+
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr, stylePreprocessors)) : {
|
|
7834
8050
|
clientPaths: [...emptyStringArray]
|
|
7835
8051
|
}
|
|
7836
8052
|
]);
|
|
@@ -7840,7 +8056,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7840
8056
|
const clientPath = islandSvelteClientPaths[idx];
|
|
7841
8057
|
if (!sourcePath || !clientPath)
|
|
7842
8058
|
continue;
|
|
7843
|
-
islandSvelteClientPathMap.set(
|
|
8059
|
+
islandSvelteClientPathMap.set(resolve21(sourcePath), clientPath);
|
|
7844
8060
|
}
|
|
7845
8061
|
const islandVueClientPathMap = new Map;
|
|
7846
8062
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -7848,7 +8064,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7848
8064
|
const clientPath = islandVueClientPaths[idx];
|
|
7849
8065
|
if (!sourcePath || !clientPath)
|
|
7850
8066
|
continue;
|
|
7851
|
-
islandVueClientPathMap.set(
|
|
8067
|
+
islandVueClientPathMap.set(resolve21(sourcePath), clientPath);
|
|
7852
8068
|
}
|
|
7853
8069
|
const islandAngularClientPathMap = new Map;
|
|
7854
8070
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -7856,14 +8072,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7856
8072
|
const clientPath = islandAngularClientPaths[idx];
|
|
7857
8073
|
if (!sourcePath || !clientPath)
|
|
7858
8074
|
continue;
|
|
7859
|
-
islandAngularClientPathMap.set(
|
|
8075
|
+
islandAngularClientPathMap.set(resolve21(sourcePath), clientPath);
|
|
7860
8076
|
}
|
|
7861
8077
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
7862
8078
|
const vueConventionSources = collectConventionSourceFiles(conventionsMap.vue);
|
|
7863
8079
|
if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
|
|
7864
8080
|
const [svelteConvResult, vueConvResult] = await Promise.all([
|
|
7865
|
-
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false)) : { svelteServerPaths: emptyStringArray },
|
|
7866
|
-
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false)) : { vueServerPaths: emptyStringArray }
|
|
8081
|
+
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false, stylePreprocessors)) : { svelteServerPaths: emptyStringArray },
|
|
8082
|
+
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false, stylePreprocessors)) : { vueServerPaths: emptyStringArray }
|
|
7867
8083
|
]);
|
|
7868
8084
|
const copyConventionFiles = (framework, sources, compiledPaths) => {
|
|
7869
8085
|
const destDir = join19(buildPath, "conventions", framework);
|
|
@@ -7999,7 +8215,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7999
8215
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8000
8216
|
outdir: buildPath,
|
|
8001
8217
|
...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
|
|
8002
|
-
plugins: [
|
|
8218
|
+
plugins: [stylePreprocessorPlugin2],
|
|
8003
8219
|
root: clientRoot,
|
|
8004
8220
|
splitting: true,
|
|
8005
8221
|
target: "browser",
|
|
@@ -8057,7 +8273,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8057
8273
|
format: "esm",
|
|
8058
8274
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8059
8275
|
outdir: serverOutDir,
|
|
8060
|
-
plugins: [
|
|
8276
|
+
plugins: [stylePreprocessorPlugin2],
|
|
8061
8277
|
root: serverRoot,
|
|
8062
8278
|
target: "bun",
|
|
8063
8279
|
throw: false,
|
|
@@ -8073,7 +8289,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8073
8289
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8074
8290
|
outdir: buildPath,
|
|
8075
8291
|
plugins: [
|
|
8076
|
-
|
|
8292
|
+
stylePreprocessorPlugin2,
|
|
8077
8293
|
...angularDir && !isDev2 ? [angularLinkerPlugin] : [],
|
|
8078
8294
|
...htmlScriptPlugin ? [htmlScriptPlugin] : []
|
|
8079
8295
|
],
|
|
@@ -8092,7 +8308,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8092
8308
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8093
8309
|
outdir: buildPath,
|
|
8094
8310
|
plugins: [
|
|
8095
|
-
|
|
8311
|
+
stylePreprocessorPlugin2,
|
|
8096
8312
|
...angularDir && !isDev2 ? [angularLinkerPlugin] : []
|
|
8097
8313
|
],
|
|
8098
8314
|
root: islandEntryResult.generatedRoot,
|
|
@@ -8107,7 +8323,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8107
8323
|
outdir: stylesDir ? join19(buildPath, basename8(stylesDir)) : buildPath,
|
|
8108
8324
|
root: stylesDir || clientRoot,
|
|
8109
8325
|
target: "browser",
|
|
8110
|
-
plugins: [
|
|
8326
|
+
plugins: [stylePreprocessorPlugin2],
|
|
8111
8327
|
throw: false
|
|
8112
8328
|
}) : undefined,
|
|
8113
8329
|
vueCssPaths.length > 0 ? bunBuild6({
|
|
@@ -8235,7 +8451,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8235
8451
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
8236
8452
|
if (!hmrClientBundle)
|
|
8237
8453
|
return;
|
|
8238
|
-
let html =
|
|
8454
|
+
let html = readFileSync11(filePath, "utf-8");
|
|
8239
8455
|
if (html.includes("data-hmr-client"))
|
|
8240
8456
|
return;
|
|
8241
8457
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -8396,9 +8612,9 @@ var init_build = __esm(() => {
|
|
|
8396
8612
|
});
|
|
8397
8613
|
|
|
8398
8614
|
// src/dev/dependencyGraph.ts
|
|
8399
|
-
import { existsSync as
|
|
8615
|
+
import { existsSync as existsSync19, readFileSync as readFileSync12 } from "fs";
|
|
8400
8616
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
8401
|
-
import { resolve as
|
|
8617
|
+
import { resolve as resolve22 } from "path";
|
|
8402
8618
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
8403
8619
|
const lower = filePath.toLowerCase();
|
|
8404
8620
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -8408,12 +8624,12 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8408
8624
|
if (lower.endsWith(".html") || lower.endsWith(".htm"))
|
|
8409
8625
|
return "html";
|
|
8410
8626
|
return null;
|
|
8411
|
-
},
|
|
8627
|
+
}, resolveImportPath2 = (importPath, fromFile) => {
|
|
8412
8628
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
8413
8629
|
return null;
|
|
8414
8630
|
}
|
|
8415
|
-
const fromDir =
|
|
8416
|
-
const normalized =
|
|
8631
|
+
const fromDir = resolve22(fromFile, "..");
|
|
8632
|
+
const normalized = resolve22(fromDir, importPath);
|
|
8417
8633
|
const extensions = [
|
|
8418
8634
|
".ts",
|
|
8419
8635
|
".tsx",
|
|
@@ -8426,10 +8642,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8426
8642
|
];
|
|
8427
8643
|
for (const ext of extensions) {
|
|
8428
8644
|
const withExt = normalized + ext;
|
|
8429
|
-
if (
|
|
8645
|
+
if (existsSync19(withExt))
|
|
8430
8646
|
return withExt;
|
|
8431
8647
|
}
|
|
8432
|
-
if (
|
|
8648
|
+
if (existsSync19(normalized))
|
|
8433
8649
|
return normalized;
|
|
8434
8650
|
return null;
|
|
8435
8651
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -8443,8 +8659,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8443
8659
|
dependents.delete(normalizedPath);
|
|
8444
8660
|
}
|
|
8445
8661
|
}, addFileToGraph = (graph, filePath) => {
|
|
8446
|
-
const normalizedPath =
|
|
8447
|
-
if (!
|
|
8662
|
+
const normalizedPath = resolve22(filePath);
|
|
8663
|
+
if (!existsSync19(normalizedPath))
|
|
8448
8664
|
return;
|
|
8449
8665
|
const dependencies = extractDependencies(normalizedPath);
|
|
8450
8666
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -8460,10 +8676,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8460
8676
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
8461
8677
|
const processedFiles = new Set;
|
|
8462
8678
|
const glob = new Glob7("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
8463
|
-
const resolvedDirs = directories.map((dir) =>
|
|
8679
|
+
const resolvedDirs = directories.map((dir) => resolve22(dir)).filter((dir) => existsSync19(dir));
|
|
8464
8680
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
8465
8681
|
for (const file4 of allFiles) {
|
|
8466
|
-
const fullPath =
|
|
8682
|
+
const fullPath = resolve22(file4);
|
|
8467
8683
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
8468
8684
|
continue;
|
|
8469
8685
|
if (processedFiles.has(fullPath))
|
|
@@ -8479,7 +8695,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8479
8695
|
const [, href] = matchLink;
|
|
8480
8696
|
if (!href)
|
|
8481
8697
|
continue;
|
|
8482
|
-
const resolvedHref =
|
|
8698
|
+
const resolvedHref = resolveImportPath2(href, filePath);
|
|
8483
8699
|
if (resolvedHref)
|
|
8484
8700
|
dependencies.push(resolvedHref);
|
|
8485
8701
|
}
|
|
@@ -8489,7 +8705,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8489
8705
|
while ((match = regex.exec(content)) !== null) {
|
|
8490
8706
|
if (!match[1])
|
|
8491
8707
|
continue;
|
|
8492
|
-
const resolved =
|
|
8708
|
+
const resolved = resolveImportPath2(match[1], filePath);
|
|
8493
8709
|
if (resolved)
|
|
8494
8710
|
dependencies.push(resolved);
|
|
8495
8711
|
}
|
|
@@ -8499,7 +8715,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8499
8715
|
while ((urlMatch = stringLiteralRegex.exec(matchContent)) !== null) {
|
|
8500
8716
|
if (!urlMatch[1])
|
|
8501
8717
|
continue;
|
|
8502
|
-
const resolved =
|
|
8718
|
+
const resolved = resolveImportPath2(urlMatch[1], filePath);
|
|
8503
8719
|
if (resolved)
|
|
8504
8720
|
dependencies.push(resolved);
|
|
8505
8721
|
}
|
|
@@ -8522,7 +8738,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8522
8738
|
const imports = transpiler4.scanImports(content);
|
|
8523
8739
|
const dependencies = [];
|
|
8524
8740
|
for (const imp of imports) {
|
|
8525
|
-
const resolved =
|
|
8741
|
+
const resolved = resolveImportPath2(imp.path, filePath);
|
|
8526
8742
|
if (resolved)
|
|
8527
8743
|
dependencies.push(resolved);
|
|
8528
8744
|
}
|
|
@@ -8532,7 +8748,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8532
8748
|
return dependencies;
|
|
8533
8749
|
}, resolveScannedImports = (imports, filePath, dependencies) => {
|
|
8534
8750
|
for (const imp of imports) {
|
|
8535
|
-
const resolved =
|
|
8751
|
+
const resolved = resolveImportPath2(imp.path, filePath);
|
|
8536
8752
|
if (resolved)
|
|
8537
8753
|
dependencies.push(resolved);
|
|
8538
8754
|
}
|
|
@@ -8557,15 +8773,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8557
8773
|
const lowerPath = filePath.toLowerCase();
|
|
8558
8774
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
8559
8775
|
if (loader === "html") {
|
|
8560
|
-
const content =
|
|
8776
|
+
const content = readFileSync12(filePath, "utf-8");
|
|
8561
8777
|
return extractHtmlDependencies(filePath, content);
|
|
8562
8778
|
}
|
|
8563
8779
|
if (loader === "tsx" || loader === "js") {
|
|
8564
|
-
const content =
|
|
8780
|
+
const content = readFileSync12(filePath, "utf-8");
|
|
8565
8781
|
return extractJsDependencies(filePath, content, loader);
|
|
8566
8782
|
}
|
|
8567
8783
|
if (isSvelteOrVue) {
|
|
8568
|
-
const content =
|
|
8784
|
+
const content = readFileSync12(filePath, "utf-8");
|
|
8569
8785
|
return extractSvelteVueDependencies(filePath, content);
|
|
8570
8786
|
}
|
|
8571
8787
|
return [];
|
|
@@ -8576,7 +8792,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8576
8792
|
return [];
|
|
8577
8793
|
}
|
|
8578
8794
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
8579
|
-
const normalizedPath =
|
|
8795
|
+
const normalizedPath = resolve22(changedFile);
|
|
8580
8796
|
const affected = new Set;
|
|
8581
8797
|
const toProcess = [normalizedPath];
|
|
8582
8798
|
const processNode = (current) => {
|
|
@@ -8616,7 +8832,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8616
8832
|
}
|
|
8617
8833
|
graph.dependents.delete(normalizedPath);
|
|
8618
8834
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
8619
|
-
const normalizedPath =
|
|
8835
|
+
const normalizedPath = resolve22(filePath);
|
|
8620
8836
|
removeDepsForFile(graph, normalizedPath);
|
|
8621
8837
|
removeDependentsForFile(graph, normalizedPath);
|
|
8622
8838
|
};
|
|
@@ -8659,12 +8875,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
8659
8875
|
};
|
|
8660
8876
|
|
|
8661
8877
|
// src/dev/configResolver.ts
|
|
8662
|
-
import { resolve as
|
|
8878
|
+
import { resolve as resolve23 } from "path";
|
|
8663
8879
|
var resolveBuildPaths = (config) => {
|
|
8664
8880
|
const cwd2 = process.cwd();
|
|
8665
8881
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
8666
|
-
const withDefault = (value, fallback) => normalize(
|
|
8667
|
-
const optional = (value) => value ? normalize(
|
|
8882
|
+
const withDefault = (value, fallback) => normalize(resolve23(cwd2, value ?? fallback));
|
|
8883
|
+
const optional = (value) => value ? normalize(resolve23(cwd2, value)) : undefined;
|
|
8668
8884
|
return {
|
|
8669
8885
|
angularDir: optional(config.angularDirectory),
|
|
8670
8886
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -8848,13 +9064,13 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
8848
9064
|
};
|
|
8849
9065
|
var init_pathUtils = __esm(() => {
|
|
8850
9066
|
init_commonAncestor();
|
|
8851
|
-
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less)$/i;
|
|
9067
|
+
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less|styl(?:us)?)$/i;
|
|
8852
9068
|
});
|
|
8853
9069
|
|
|
8854
9070
|
// src/dev/fileWatcher.ts
|
|
8855
9071
|
import { watch } from "fs";
|
|
8856
|
-
import { existsSync as
|
|
8857
|
-
import { join as join20, resolve as
|
|
9072
|
+
import { existsSync as existsSync20 } from "fs";
|
|
9073
|
+
import { join as join20, resolve as resolve24 } from "path";
|
|
8858
9074
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
8859
9075
|
try {
|
|
8860
9076
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -8885,12 +9101,12 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8885
9101
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
8886
9102
|
return;
|
|
8887
9103
|
}
|
|
8888
|
-
if (event === "rename" && !
|
|
9104
|
+
if (event === "rename" && !existsSync20(fullPath)) {
|
|
8889
9105
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
8890
9106
|
onFileChange(fullPath);
|
|
8891
9107
|
return;
|
|
8892
9108
|
}
|
|
8893
|
-
if (
|
|
9109
|
+
if (existsSync20(fullPath)) {
|
|
8894
9110
|
onFileChange(fullPath);
|
|
8895
9111
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
8896
9112
|
}
|
|
@@ -8899,8 +9115,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8899
9115
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
8900
9116
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8901
9117
|
paths.forEach((path) => {
|
|
8902
|
-
const absolutePath =
|
|
8903
|
-
if (!
|
|
9118
|
+
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
9119
|
+
if (!existsSync20(absolutePath)) {
|
|
8904
9120
|
return;
|
|
8905
9121
|
}
|
|
8906
9122
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -8910,8 +9126,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8910
9126
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
8911
9127
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8912
9128
|
watchPaths.forEach((path) => {
|
|
8913
|
-
const absolutePath =
|
|
8914
|
-
if (!
|
|
9129
|
+
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
9130
|
+
if (!existsSync20(absolutePath)) {
|
|
8915
9131
|
return;
|
|
8916
9132
|
}
|
|
8917
9133
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -8925,13 +9141,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
8925
9141
|
});
|
|
8926
9142
|
|
|
8927
9143
|
// src/dev/assetStore.ts
|
|
8928
|
-
import { resolve as
|
|
9144
|
+
import { resolve as resolve25 } from "path";
|
|
8929
9145
|
import { readdir as readdir3, unlink } from "fs/promises";
|
|
8930
9146
|
var mimeTypes, getMimeType = (filePath) => {
|
|
8931
9147
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
8932
9148
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
8933
9149
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
8934
|
-
const fullPath =
|
|
9150
|
+
const fullPath = resolve25(dir, entry.name);
|
|
8935
9151
|
if (entry.isDirectory()) {
|
|
8936
9152
|
return walkAndClean(fullPath);
|
|
8937
9153
|
}
|
|
@@ -8947,10 +9163,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8947
9163
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
8948
9164
|
const liveByIdentity = new Map;
|
|
8949
9165
|
for (const webPath of store.keys()) {
|
|
8950
|
-
const diskPath =
|
|
9166
|
+
const diskPath = resolve25(buildDir, webPath.slice(1));
|
|
8951
9167
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
8952
9168
|
}
|
|
8953
|
-
const absBuildDir =
|
|
9169
|
+
const absBuildDir = resolve25(buildDir);
|
|
8954
9170
|
Object.values(manifest).forEach((val) => {
|
|
8955
9171
|
if (!HASHED_FILE_RE.test(val))
|
|
8956
9172
|
return;
|
|
@@ -8968,7 +9184,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8968
9184
|
} catch {}
|
|
8969
9185
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
8970
9186
|
if (entry.isDirectory()) {
|
|
8971
|
-
return scanDir(
|
|
9187
|
+
return scanDir(resolve25(dir, entry.name), `${prefix}${entry.name}/`);
|
|
8972
9188
|
}
|
|
8973
9189
|
if (!entry.name.startsWith("chunk-")) {
|
|
8974
9190
|
return null;
|
|
@@ -8977,7 +9193,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8977
9193
|
if (store.has(webPath)) {
|
|
8978
9194
|
return null;
|
|
8979
9195
|
}
|
|
8980
|
-
return Bun.file(
|
|
9196
|
+
return Bun.file(resolve25(dir, entry.name)).bytes().then((bytes) => {
|
|
8981
9197
|
store.set(webPath, bytes);
|
|
8982
9198
|
return;
|
|
8983
9199
|
}).catch(() => {});
|
|
@@ -9002,7 +9218,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
9002
9218
|
for (const webPath of newIdentities.values()) {
|
|
9003
9219
|
if (store.has(webPath))
|
|
9004
9220
|
continue;
|
|
9005
|
-
loadPromises.push(Bun.file(
|
|
9221
|
+
loadPromises.push(Bun.file(resolve25(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
9006
9222
|
store.set(webPath, bytes);
|
|
9007
9223
|
return;
|
|
9008
9224
|
}).catch(() => {}));
|
|
@@ -9032,10 +9248,10 @@ var init_assetStore = __esm(() => {
|
|
|
9032
9248
|
});
|
|
9033
9249
|
|
|
9034
9250
|
// src/dev/fileHashTracker.ts
|
|
9035
|
-
import { readFileSync as
|
|
9251
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
9036
9252
|
var computeFileHash = (filePath) => {
|
|
9037
9253
|
try {
|
|
9038
|
-
const fileContent =
|
|
9254
|
+
const fileContent = readFileSync13(filePath);
|
|
9039
9255
|
return Number(Bun.hash(fileContent));
|
|
9040
9256
|
} catch {
|
|
9041
9257
|
return UNFOUND_INDEX;
|
|
@@ -9053,9 +9269,9 @@ var init_fileHashTracker = __esm(() => {
|
|
|
9053
9269
|
});
|
|
9054
9270
|
|
|
9055
9271
|
// src/dev/reactComponentClassifier.ts
|
|
9056
|
-
import { resolve as
|
|
9272
|
+
import { resolve as resolve26 } from "path";
|
|
9057
9273
|
var classifyComponent = (filePath) => {
|
|
9058
|
-
const normalizedPath =
|
|
9274
|
+
const normalizedPath = resolve26(filePath);
|
|
9059
9275
|
if (normalizedPath.includes("/react/pages/")) {
|
|
9060
9276
|
return "server";
|
|
9061
9277
|
}
|
|
@@ -9067,7 +9283,7 @@ var classifyComponent = (filePath) => {
|
|
|
9067
9283
|
var init_reactComponentClassifier = () => {};
|
|
9068
9284
|
|
|
9069
9285
|
// src/dev/moduleMapper.ts
|
|
9070
|
-
import { basename as basename9, resolve as
|
|
9286
|
+
import { basename as basename9, resolve as resolve27 } from "path";
|
|
9071
9287
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
9072
9288
|
const modulePaths = {};
|
|
9073
9289
|
moduleKeys.forEach((key) => {
|
|
@@ -9077,7 +9293,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
9077
9293
|
});
|
|
9078
9294
|
return modulePaths;
|
|
9079
9295
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
9080
|
-
const normalizedFile =
|
|
9296
|
+
const normalizedFile = resolve27(sourceFile);
|
|
9081
9297
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
9082
9298
|
if (processedFiles.has(normalizedFile)) {
|
|
9083
9299
|
return null;
|
|
@@ -9113,7 +9329,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
9113
9329
|
});
|
|
9114
9330
|
return grouped;
|
|
9115
9331
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
9116
|
-
const normalizedFile =
|
|
9332
|
+
const normalizedFile = resolve27(sourceFile);
|
|
9117
9333
|
const fileName = basename9(normalizedFile);
|
|
9118
9334
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
9119
9335
|
const pascalName = toPascal(baseName);
|
|
@@ -9396,19 +9612,19 @@ var escapeHtml = (str) => String(str).replace(/&/g, "&").replace(/</g, "<
|
|
|
9396
9612
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
9397
9613
|
import { mkdir as mkdir4, symlink } from "fs/promises";
|
|
9398
9614
|
import { tmpdir } from "os";
|
|
9399
|
-
import { basename as basename10, dirname as dirname12, join as join21, resolve as
|
|
9615
|
+
import { basename as basename10, dirname as dirname12, join as join21, resolve as resolve28 } from "path";
|
|
9400
9616
|
var ssrDirty2 = false, lastSelector = "angular-page", isRecord8 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
|
|
9401
9617
|
if (!compilerImportPromise) {
|
|
9402
9618
|
compilerImportPromise = import("@angular/compiler");
|
|
9403
9619
|
}
|
|
9404
9620
|
return compilerImportPromise;
|
|
9405
9621
|
}, readAngularPageModule = (value) => isRecord8(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join21(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
|
|
9406
|
-
const outRoot =
|
|
9622
|
+
const outRoot = resolve28(dirname12(dirname12(outDir)));
|
|
9407
9623
|
const nodeModulesLink = join21(outRoot, "node_modules");
|
|
9408
9624
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
9409
9625
|
return;
|
|
9410
9626
|
}
|
|
9411
|
-
if (nodeModulesLink ===
|
|
9627
|
+
if (nodeModulesLink === resolve28(process.cwd(), "node_modules")) {
|
|
9412
9628
|
return;
|
|
9413
9629
|
}
|
|
9414
9630
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
@@ -9416,7 +9632,7 @@ var ssrDirty2 = false, lastSelector = "angular-page", isRecord8 = (value) => typ
|
|
|
9416
9632
|
}
|
|
9417
9633
|
await mkdir4(outRoot, { recursive: true });
|
|
9418
9634
|
try {
|
|
9419
|
-
await symlink(
|
|
9635
|
+
await symlink(resolve28(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
9420
9636
|
} catch (error) {
|
|
9421
9637
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
9422
9638
|
throw error;
|
|
@@ -9859,8 +10075,8 @@ __export(exports_moduleServer, {
|
|
|
9859
10075
|
createModuleServer: () => createModuleServer,
|
|
9860
10076
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
9861
10077
|
});
|
|
9862
|
-
import { existsSync as
|
|
9863
|
-
import { basename as basename12, dirname as dirname14, extname as extname6, resolve 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";
|
|
9864
10080
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
9865
10081
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
9866
10082
|
const allExports = [];
|
|
@@ -9880,7 +10096,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
9880
10096
|
${stubs}
|
|
9881
10097
|
`;
|
|
9882
10098
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
9883
|
-
const found = extensions.find((ext) =>
|
|
10099
|
+
const found = extensions.find((ext) => existsSync21(resolve29(projectRoot, srcPath + ext)));
|
|
9884
10100
|
return found ? srcPath + found : srcPath;
|
|
9885
10101
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
9886
10102
|
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
@@ -9895,7 +10111,7 @@ ${stubs}
|
|
|
9895
10111
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
9896
10112
|
}, srcUrl = (relPath, projectRoot) => {
|
|
9897
10113
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
9898
|
-
const absPath =
|
|
10114
|
+
const absPath = resolve29(projectRoot, relPath);
|
|
9899
10115
|
const cached = mtimeCache.get(absPath);
|
|
9900
10116
|
if (cached !== undefined)
|
|
9901
10117
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -9907,18 +10123,18 @@ ${stubs}
|
|
|
9907
10123
|
return base;
|
|
9908
10124
|
}
|
|
9909
10125
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
9910
|
-
const absPath =
|
|
9911
|
-
const rel =
|
|
10126
|
+
const absPath = resolve29(fileDir, relPath);
|
|
10127
|
+
const rel = relative11(projectRoot, absPath);
|
|
9912
10128
|
const extension = extname6(rel);
|
|
9913
10129
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
9914
10130
|
if (extname6(srcPath) === ".svelte") {
|
|
9915
|
-
srcPath =
|
|
10131
|
+
srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve29(projectRoot, srcPath)));
|
|
9916
10132
|
}
|
|
9917
10133
|
return srcUrl(srcPath, projectRoot);
|
|
9918
10134
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
9919
10135
|
try {
|
|
9920
10136
|
const target = resolvePackageImport(specifier, ["browser", "import"]) ?? Bun.resolveSync(specifier, projectRoot);
|
|
9921
|
-
return
|
|
10137
|
+
return relative11(projectRoot, target);
|
|
9922
10138
|
} catch {
|
|
9923
10139
|
return;
|
|
9924
10140
|
}
|
|
@@ -9951,20 +10167,20 @@ ${stubs}
|
|
|
9951
10167
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
9952
10168
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
9953
10169
|
if (absPath.startsWith(projectRoot)) {
|
|
9954
|
-
const rel2 =
|
|
10170
|
+
const rel2 = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
9955
10171
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
9956
10172
|
}
|
|
9957
|
-
const rel =
|
|
10173
|
+
const rel = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
9958
10174
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
9959
10175
|
});
|
|
9960
10176
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
9961
|
-
const absPath =
|
|
9962
|
-
const rel =
|
|
10177
|
+
const absPath = resolve29(fileDir, relPath);
|
|
10178
|
+
const rel = relative11(projectRoot, absPath);
|
|
9963
10179
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
9964
10180
|
});
|
|
9965
10181
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
9966
|
-
const absPath =
|
|
9967
|
-
const rel =
|
|
10182
|
+
const absPath = resolve29(fileDir, relPath);
|
|
10183
|
+
const rel = relative11(projectRoot, absPath);
|
|
9968
10184
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
9969
10185
|
});
|
|
9970
10186
|
return result;
|
|
@@ -9992,7 +10208,7 @@ ${stubs}
|
|
|
9992
10208
|
`)}
|
|
9993
10209
|
${code}`;
|
|
9994
10210
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
9995
|
-
const raw =
|
|
10211
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
9996
10212
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
9997
10213
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
9998
10214
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -10003,12 +10219,12 @@ ${code}`;
|
|
|
10003
10219
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
10004
10220
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
10005
10221
|
${transpiled}`;
|
|
10006
|
-
const relPath =
|
|
10222
|
+
const relPath = relative11(projectRoot, filePath).replace(/\\/g, "/");
|
|
10007
10223
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
10008
10224
|
transpiled += buildIslandMetadataExports(raw);
|
|
10009
10225
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
10010
10226
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
10011
|
-
const raw =
|
|
10227
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10012
10228
|
const ext = extname6(filePath);
|
|
10013
10229
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
10014
10230
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -10154,24 +10370,24 @@ ${code}`;
|
|
|
10154
10370
|
if (compiled.css?.code) {
|
|
10155
10371
|
const cssPath = `${filePath}.css`;
|
|
10156
10372
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
10157
|
-
const cssUrl = srcUrl(
|
|
10373
|
+
const cssUrl = srcUrl(relative11(projectRoot, cssPath), projectRoot);
|
|
10158
10374
|
code = `import "${cssUrl}";
|
|
10159
10375
|
${code}`;
|
|
10160
10376
|
}
|
|
10161
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
10377
|
+
const moduleUrl = `${SRC_PREFIX}${relative11(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
10162
10378
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
10163
10379
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10164
10380
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
10165
10381
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
10166
|
-
}, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
|
|
10167
|
-
const raw =
|
|
10382
|
+
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10383
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10168
10384
|
if (!svelteCompiler) {
|
|
10169
10385
|
svelteCompiler = await import("svelte/compiler");
|
|
10170
10386
|
}
|
|
10171
10387
|
const isModule = filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
10172
10388
|
const loweredAwaitSource = isModule ? { code: raw, transformed: false } : lowerSvelteAwaitSlotSyntax(raw);
|
|
10173
10389
|
const loweredSource = isModule ? loweredAwaitSource : lowerSvelteIslandSyntax(loweredAwaitSource.code, "client");
|
|
10174
|
-
const source = loweredSource.code;
|
|
10390
|
+
const source = isModule ? loweredSource.code : (await svelteCompiler.preprocess(loweredSource.code, createSvelteStylePreprocessor(stylePreprocessors))).code;
|
|
10175
10391
|
const enableAsync = loweredAwaitSource.transformed || loweredSource.transformed;
|
|
10176
10392
|
const code = isModule ? compileSvelteModule(source, filePath) : compileSvelteComponent(source, filePath, projectRoot, enableAsync);
|
|
10177
10393
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
@@ -10198,16 +10414,16 @@ __script__.render = render;`;
|
|
|
10198
10414
|
code += `
|
|
10199
10415
|
export default __script__;`;
|
|
10200
10416
|
return code;
|
|
10201
|
-
}, compileVueStyles = (descriptor, filePath, componentId, code) => {
|
|
10417
|
+
}, compileVueStyles = async (descriptor, filePath, componentId, code, stylePreprocessors) => {
|
|
10202
10418
|
if (descriptor.styles.length === 0)
|
|
10203
10419
|
return code;
|
|
10204
|
-
const cssCode = descriptor.styles.map((style) => vueCompiler.compileStyle({
|
|
10420
|
+
const cssCode = (await Promise.all(descriptor.styles.map(async (style) => vueCompiler.compileStyle({
|
|
10205
10421
|
filename: filePath,
|
|
10206
10422
|
id: `data-v-${componentId}`,
|
|
10207
10423
|
scoped: style.scoped,
|
|
10208
|
-
source: style.content,
|
|
10424
|
+
source: style.lang ? await compileStyleSource(filePath, style.content, style.lang, stylePreprocessors) : style.content,
|
|
10209
10425
|
trim: true
|
|
10210
|
-
}).code).join(`
|
|
10426
|
+
}).code))).join(`
|
|
10211
10427
|
`);
|
|
10212
10428
|
const escaped = cssCode.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10213
10429
|
const hmrId = JSON.stringify(filePath);
|
|
@@ -10221,8 +10437,8 @@ export default __script__;`;
|
|
|
10221
10437
|
].join("");
|
|
10222
10438
|
return `${cssInjection}
|
|
10223
10439
|
${code}`;
|
|
10224
|
-
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10225
|
-
const raw =
|
|
10440
|
+
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10441
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10226
10442
|
if (!vueCompiler) {
|
|
10227
10443
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
10228
10444
|
}
|
|
@@ -10234,13 +10450,13 @@ ${code}`;
|
|
|
10234
10450
|
inlineTemplate: false
|
|
10235
10451
|
});
|
|
10236
10452
|
let code = compileVueTemplate(descriptor, compiledScript, filePath, componentId);
|
|
10237
|
-
code = compileVueStyles(descriptor, filePath, componentId, code);
|
|
10453
|
+
code = await compileVueStyles(descriptor, filePath, componentId, code, stylePreprocessors);
|
|
10238
10454
|
code = tsTranspiler2.transformSync(code);
|
|
10239
10455
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
10240
10456
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
10241
10457
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
10242
|
-
const hmrBase = vueDir ?
|
|
10243
|
-
const hmrId =
|
|
10458
|
+
const hmrBase = vueDir ? resolve29(vueDir) : projectRoot;
|
|
10459
|
+
const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
10244
10460
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
10245
10461
|
result += [
|
|
10246
10462
|
"",
|
|
@@ -10254,11 +10470,11 @@ ${code}`;
|
|
|
10254
10470
|
`);
|
|
10255
10471
|
return result;
|
|
10256
10472
|
}, resolveSvelteModulePath = (path) => {
|
|
10257
|
-
if (
|
|
10473
|
+
if (existsSync21(path))
|
|
10258
10474
|
return path;
|
|
10259
|
-
if (
|
|
10475
|
+
if (existsSync21(`${path}.ts`))
|
|
10260
10476
|
return `${path}.ts`;
|
|
10261
|
-
if (
|
|
10477
|
+
if (existsSync21(`${path}.js`))
|
|
10262
10478
|
return `${path}.js`;
|
|
10263
10479
|
return path;
|
|
10264
10480
|
}, jsResponse = (body) => {
|
|
@@ -10271,7 +10487,7 @@ ${code}`;
|
|
|
10271
10487
|
}
|
|
10272
10488
|
});
|
|
10273
10489
|
}, handleCssRequest = (filePath) => {
|
|
10274
|
-
const raw =
|
|
10490
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10275
10491
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10276
10492
|
return [
|
|
10277
10493
|
`const style = document.createElement('style');`,
|
|
@@ -10398,20 +10614,20 @@ export default {};
|
|
|
10398
10614
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10399
10615
|
return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
|
|
10400
10616
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
10401
|
-
const filePath =
|
|
10617
|
+
const filePath = resolve29(projectRoot, relPath);
|
|
10402
10618
|
const ext = extname6(filePath);
|
|
10403
10619
|
if (ext === ".svelte")
|
|
10404
10620
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
10405
10621
|
if (ext)
|
|
10406
10622
|
return { ext, filePath };
|
|
10407
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
10623
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync21(filePath + candidate));
|
|
10408
10624
|
if (!found)
|
|
10409
10625
|
return { ext, filePath };
|
|
10410
10626
|
const resolved = filePath + found;
|
|
10411
10627
|
if (found === ".svelte")
|
|
10412
10628
|
return { ext: found, filePath: resolveSvelteModulePath(resolved) };
|
|
10413
10629
|
return { ext: found, filePath: resolved };
|
|
10414
|
-
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir) => {
|
|
10630
|
+
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10415
10631
|
if (ext === ".css")
|
|
10416
10632
|
return jsResponse(handleCssRequest(filePath));
|
|
10417
10633
|
const isSvelte = ext === ".svelte" || filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
@@ -10419,24 +10635,24 @@ export default {};
|
|
|
10419
10635
|
if (cached)
|
|
10420
10636
|
return jsResponse(cached);
|
|
10421
10637
|
if (isSvelte)
|
|
10422
|
-
return transformAndCacheSvelte(filePath, projectRoot, rewriter);
|
|
10638
|
+
return transformAndCacheSvelte(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10423
10639
|
if (ext === ".vue")
|
|
10424
|
-
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir);
|
|
10640
|
+
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10425
10641
|
if (!TRANSPILABLE.has(ext))
|
|
10426
10642
|
return;
|
|
10427
10643
|
const stat2 = statSync2(filePath);
|
|
10428
|
-
const resolvedVueDir = vueDir ?
|
|
10644
|
+
const resolvedVueDir = vueDir ? resolve29(vueDir) : undefined;
|
|
10429
10645
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
10430
10646
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10431
10647
|
return jsResponse(content);
|
|
10432
|
-
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter) => {
|
|
10648
|
+
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10433
10649
|
const stat2 = statSync2(filePath);
|
|
10434
|
-
const content = await transformSvelteFile(filePath, projectRoot, rewriter);
|
|
10650
|
+
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10435
10651
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10436
10652
|
return jsResponse(content);
|
|
10437
|
-
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10653
|
+
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10438
10654
|
const stat2 = statSync2(filePath);
|
|
10439
|
-
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir);
|
|
10655
|
+
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10440
10656
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10441
10657
|
return jsResponse(content);
|
|
10442
10658
|
}, transformErrorResponse = (err) => {
|
|
@@ -10446,7 +10662,7 @@ export default {};
|
|
|
10446
10662
|
status: 500
|
|
10447
10663
|
});
|
|
10448
10664
|
}, createModuleServer = (config) => {
|
|
10449
|
-
const { projectRoot, vendorPaths, frameworkDirs } = config;
|
|
10665
|
+
const { projectRoot, vendorPaths, frameworkDirs, stylePreprocessors } = config;
|
|
10450
10666
|
const rewriter = buildImportRewriter(vendorPaths);
|
|
10451
10667
|
return async (pathname) => {
|
|
10452
10668
|
if (pathname.startsWith("/@stub/"))
|
|
@@ -10456,12 +10672,12 @@ export default {};
|
|
|
10456
10672
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
10457
10673
|
return;
|
|
10458
10674
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
10459
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
10675
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve29(projectRoot, relPath));
|
|
10460
10676
|
if (virtualCssResponse)
|
|
10461
10677
|
return virtualCssResponse;
|
|
10462
10678
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
10463
10679
|
try {
|
|
10464
|
-
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue);
|
|
10680
|
+
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue, stylePreprocessors);
|
|
10465
10681
|
} catch (err) {
|
|
10466
10682
|
return transformErrorResponse(err);
|
|
10467
10683
|
}
|
|
@@ -10472,11 +10688,11 @@ export default {};
|
|
|
10472
10688
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
10473
10689
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
10474
10690
|
if (match[1])
|
|
10475
|
-
files.push(
|
|
10691
|
+
files.push(resolve29(projectRoot, match[1]));
|
|
10476
10692
|
}
|
|
10477
10693
|
return files;
|
|
10478
10694
|
}, invalidateModule = (filePath) => {
|
|
10479
|
-
const resolved =
|
|
10695
|
+
const resolved = resolve29(filePath);
|
|
10480
10696
|
invalidate(filePath);
|
|
10481
10697
|
if (resolved !== filePath)
|
|
10482
10698
|
invalidate(resolved);
|
|
@@ -10495,6 +10711,7 @@ var init_moduleServer = __esm(() => {
|
|
|
10495
10711
|
init_constants();
|
|
10496
10712
|
init_resolvePackageImport();
|
|
10497
10713
|
init_sourceMetadata();
|
|
10714
|
+
init_stylePreprocessor();
|
|
10498
10715
|
init_lowerAwaitSlotSyntax();
|
|
10499
10716
|
init_lowerIslandSyntax();
|
|
10500
10717
|
init_transformCache();
|
|
@@ -10552,11 +10769,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
10552
10769
|
__export(exports_simpleHTMLHMR, {
|
|
10553
10770
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
10554
10771
|
});
|
|
10555
|
-
import { resolve as
|
|
10772
|
+
import { resolve as resolve30 } from "path";
|
|
10556
10773
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
10557
10774
|
let htmlContent;
|
|
10558
10775
|
try {
|
|
10559
|
-
const resolvedPath =
|
|
10776
|
+
const resolvedPath = resolve30(htmlFilePath);
|
|
10560
10777
|
const file4 = Bun.file(resolvedPath);
|
|
10561
10778
|
if (!await file4.exists()) {
|
|
10562
10779
|
return null;
|
|
@@ -10582,11 +10799,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
10582
10799
|
__export(exports_simpleHTMXHMR, {
|
|
10583
10800
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
10584
10801
|
});
|
|
10585
|
-
import { resolve as
|
|
10802
|
+
import { resolve as resolve31 } from "path";
|
|
10586
10803
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
10587
10804
|
let htmlContent;
|
|
10588
10805
|
try {
|
|
10589
|
-
const resolvedPath =
|
|
10806
|
+
const resolvedPath = resolve31(htmxFilePath);
|
|
10590
10807
|
const file4 = Bun.file(resolvedPath);
|
|
10591
10808
|
if (!await file4.exists()) {
|
|
10592
10809
|
return null;
|
|
@@ -10608,8 +10825,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
10608
10825
|
var init_simpleHTMXHMR = () => {};
|
|
10609
10826
|
|
|
10610
10827
|
// src/dev/rebuildTrigger.ts
|
|
10611
|
-
import { existsSync as
|
|
10612
|
-
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";
|
|
10613
10830
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
10614
10831
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
10615
10832
|
if (pathLineCol) {
|
|
@@ -10677,11 +10894,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10677
10894
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
10678
10895
|
}
|
|
10679
10896
|
return { ...parsed, framework: detectedFw };
|
|
10680
|
-
}, 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) => {
|
|
10681
10898
|
state.fileHashes.delete(filePathInSet);
|
|
10682
10899
|
try {
|
|
10683
10900
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
10684
|
-
const deletedPathResolved =
|
|
10901
|
+
const deletedPathResolved = resolve32(filePathInSet);
|
|
10685
10902
|
affectedFiles.forEach((affectedFile) => {
|
|
10686
10903
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
10687
10904
|
validFiles.push(affectedFile);
|
|
@@ -10695,7 +10912,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10695
10912
|
if (!dependents || dependents.size === 0) {
|
|
10696
10913
|
return;
|
|
10697
10914
|
}
|
|
10698
|
-
const dependentFiles = Array.from(dependents).filter((file4) =>
|
|
10915
|
+
const dependentFiles = Array.from(dependents).filter((file4) => existsSync22(file4));
|
|
10699
10916
|
if (dependentFiles.length === 0) {
|
|
10700
10917
|
return;
|
|
10701
10918
|
}
|
|
@@ -10711,7 +10928,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10711
10928
|
try {
|
|
10712
10929
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
10713
10930
|
affectedFiles.forEach((affectedFile) => {
|
|
10714
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
10931
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync22(affectedFile)) {
|
|
10715
10932
|
validFiles.push(affectedFile);
|
|
10716
10933
|
processedFiles.add(affectedFile);
|
|
10717
10934
|
}
|
|
@@ -10725,7 +10942,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10725
10942
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
10726
10943
|
return;
|
|
10727
10944
|
}
|
|
10728
|
-
const normalizedFilePath =
|
|
10945
|
+
const normalizedFilePath = resolve32(filePathInSet);
|
|
10729
10946
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
10730
10947
|
validFiles.push(normalizedFilePath);
|
|
10731
10948
|
processedFiles.add(normalizedFilePath);
|
|
@@ -10736,7 +10953,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10736
10953
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
10737
10954
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
10738
10955
|
filePathSet.forEach((filePathInSet) => {
|
|
10739
|
-
if (!
|
|
10956
|
+
if (!existsSync22(filePathInSet)) {
|
|
10740
10957
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
10741
10958
|
return;
|
|
10742
10959
|
}
|
|
@@ -10803,8 +11020,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10803
11020
|
}
|
|
10804
11021
|
if (framework === "unknown") {
|
|
10805
11022
|
const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
|
|
10806
|
-
invalidate2(
|
|
10807
|
-
const relPath =
|
|
11023
|
+
invalidate2(resolve32(filePath));
|
|
11024
|
+
const relPath = relative12(process.cwd(), filePath);
|
|
10808
11025
|
logHmrUpdate(relPath);
|
|
10809
11026
|
return;
|
|
10810
11027
|
}
|
|
@@ -10844,12 +11061,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10844
11061
|
return componentFile;
|
|
10845
11062
|
}
|
|
10846
11063
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
10847
|
-
if (
|
|
11064
|
+
if (existsSync22(tsCounterpart)) {
|
|
10848
11065
|
return tsCounterpart;
|
|
10849
11066
|
}
|
|
10850
11067
|
if (!graph)
|
|
10851
11068
|
return componentFile;
|
|
10852
|
-
const dependents = graph.dependents.get(
|
|
11069
|
+
const dependents = graph.dependents.get(resolve32(componentFile));
|
|
10853
11070
|
if (!dependents)
|
|
10854
11071
|
return componentFile;
|
|
10855
11072
|
for (const dep of dependents) {
|
|
@@ -10858,7 +11075,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10858
11075
|
}
|
|
10859
11076
|
return componentFile;
|
|
10860
11077
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
10861
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
11078
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve32(file4).startsWith(angularPagesPath));
|
|
10862
11079
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
10863
11080
|
return pageEntries;
|
|
10864
11081
|
}
|
|
@@ -10867,7 +11084,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10867
11084
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
10868
11085
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
10869
11086
|
affected.forEach((file4) => {
|
|
10870
|
-
if (file4.endsWith(".ts") &&
|
|
11087
|
+
if (file4.endsWith(".ts") && resolve32(file4).startsWith(angularPagesPath)) {
|
|
10871
11088
|
resolvedPages.add(file4);
|
|
10872
11089
|
}
|
|
10873
11090
|
});
|
|
@@ -10917,7 +11134,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10917
11134
|
format: "esm",
|
|
10918
11135
|
naming: "[dir]/[name].[hash].[ext]",
|
|
10919
11136
|
outdir: buildDir,
|
|
10920
|
-
plugins: [
|
|
11137
|
+
plugins: [
|
|
11138
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11139
|
+
],
|
|
10921
11140
|
root: clientRoot,
|
|
10922
11141
|
target: "browser",
|
|
10923
11142
|
throw: false
|
|
@@ -10958,10 +11177,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10958
11177
|
});
|
|
10959
11178
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
10960
11179
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
10961
|
-
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true);
|
|
11180
|
+
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, state.config.stylePreprocessors);
|
|
10962
11181
|
serverPaths.forEach((serverPath) => {
|
|
10963
11182
|
const fileBase = basename13(serverPath, ".js");
|
|
10964
|
-
state.manifest[toPascal(fileBase)] =
|
|
11183
|
+
state.manifest[toPascal(fileBase)] = resolve32(serverPath);
|
|
10965
11184
|
});
|
|
10966
11185
|
if (clientPaths.length > 0) {
|
|
10967
11186
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
@@ -10970,9 +11189,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10970
11189
|
const angularDir = config.angularDirectory ?? "";
|
|
10971
11190
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
10972
11191
|
for (const file4 of angularFiles) {
|
|
10973
|
-
state.fileHashes.set(
|
|
11192
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
10974
11193
|
}
|
|
10975
|
-
const angularPagesPath =
|
|
11194
|
+
const angularPagesPath = resolve32(angularDir, "pages");
|
|
10976
11195
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
10977
11196
|
if (pageEntries.length > 0) {
|
|
10978
11197
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
@@ -10987,8 +11206,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10987
11206
|
return manifest;
|
|
10988
11207
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
10989
11208
|
const pageName = basename13(normalized, ".tsx");
|
|
10990
|
-
const indexPath =
|
|
10991
|
-
if (!
|
|
11209
|
+
const indexPath = resolve32(reactIndexesPath, `${pageName}.tsx`);
|
|
11210
|
+
if (!existsSync22(indexPath)) {
|
|
10992
11211
|
return;
|
|
10993
11212
|
}
|
|
10994
11213
|
return indexPath;
|
|
@@ -10999,13 +11218,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10999
11218
|
return;
|
|
11000
11219
|
}
|
|
11001
11220
|
const pageName = basename13(dep, ".tsx");
|
|
11002
|
-
const indexPath =
|
|
11003
|
-
if (
|
|
11221
|
+
const indexPath = resolve32(reactIndexesPath, `${pageName}.tsx`);
|
|
11222
|
+
if (existsSync22(indexPath) && !reactEntries.includes(indexPath)) {
|
|
11004
11223
|
reactEntries.push(indexPath);
|
|
11005
11224
|
}
|
|
11006
11225
|
});
|
|
11007
11226
|
}, resolveReactEntryForFile = (state, file4, pagesPathResolved, reactIndexesPath, reactEntries) => {
|
|
11008
|
-
const normalized =
|
|
11227
|
+
const normalized = resolve32(file4);
|
|
11009
11228
|
if (!normalized.startsWith(pagesPathResolved)) {
|
|
11010
11229
|
resolveReactEntriesFromDeps(state, normalized, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
11011
11230
|
return;
|
|
@@ -11016,7 +11235,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11016
11235
|
}
|
|
11017
11236
|
}, collectReactEntries = (state, filesToRebuild, reactPagesPath, reactIndexesPath) => {
|
|
11018
11237
|
const reactEntries = [];
|
|
11019
|
-
const pagesPathResolved =
|
|
11238
|
+
const pagesPathResolved = resolve32(reactPagesPath);
|
|
11020
11239
|
filesToRebuild.forEach((file4) => {
|
|
11021
11240
|
resolveReactEntryForFile(state, file4, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
11022
11241
|
});
|
|
@@ -11028,7 +11247,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11028
11247
|
const { rewriteReactImports: rewriteReactImports2 } = await Promise.resolve().then(() => (init_rewriteReactImports(), exports_rewriteReactImports));
|
|
11029
11248
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11030
11249
|
const depVendorPaths = globalThis.__depVendorPaths ?? {};
|
|
11031
|
-
const refreshEntry =
|
|
11250
|
+
const refreshEntry = resolve32(reactIndexesPath, "_refresh.tsx");
|
|
11032
11251
|
if (!reactEntries.includes(refreshEntry)) {
|
|
11033
11252
|
reactEntries.push(refreshEntry);
|
|
11034
11253
|
}
|
|
@@ -11040,7 +11259,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11040
11259
|
setDevVendorPaths2(vendorPaths);
|
|
11041
11260
|
}
|
|
11042
11261
|
const { rmSync: rmSync3 } = await import("fs");
|
|
11043
|
-
rmSync3(
|
|
11262
|
+
rmSync3(resolve32(buildDir, "react", "generated", "indexes"), {
|
|
11044
11263
|
force: true,
|
|
11045
11264
|
recursive: true
|
|
11046
11265
|
});
|
|
@@ -11050,7 +11269,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11050
11269
|
jsx: { development: true },
|
|
11051
11270
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11052
11271
|
outdir: buildDir,
|
|
11053
|
-
plugins: [
|
|
11272
|
+
plugins: [
|
|
11273
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11274
|
+
],
|
|
11054
11275
|
reactFastRefresh: true,
|
|
11055
11276
|
root: clientRoot,
|
|
11056
11277
|
splitting: true,
|
|
@@ -11081,7 +11302,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11081
11302
|
}, getModuleUrl = async (pageFile) => {
|
|
11082
11303
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
11083
11304
|
invalidateModule2(pageFile);
|
|
11084
|
-
const rel =
|
|
11305
|
+
const rel = relative12(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
11085
11306
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
11086
11307
|
warmCache2(url);
|
|
11087
11308
|
return url;
|
|
@@ -11090,11 +11311,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11090
11311
|
if (isComponentFile2)
|
|
11091
11312
|
return primaryFile;
|
|
11092
11313
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
11093
|
-
const nearest = findNearestComponent2(
|
|
11314
|
+
const nearest = findNearestComponent2(resolve32(primaryFile));
|
|
11094
11315
|
return nearest ?? primaryFile;
|
|
11095
11316
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
11096
11317
|
for (const file4 of reactFiles) {
|
|
11097
|
-
state.fileHashes.set(
|
|
11318
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
11098
11319
|
}
|
|
11099
11320
|
invalidateReactSsrCache();
|
|
11100
11321
|
const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -11113,7 +11334,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11113
11334
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
11114
11335
|
if (pageModuleUrl) {
|
|
11115
11336
|
const serverDuration = Date.now() - startTime;
|
|
11116
|
-
state.lastHmrPath =
|
|
11337
|
+
state.lastHmrPath = relative12(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
11117
11338
|
state.lastHmrFramework = "react";
|
|
11118
11339
|
broadcastToClients(state, {
|
|
11119
11340
|
data: {
|
|
@@ -11136,8 +11357,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11136
11357
|
return state.manifest;
|
|
11137
11358
|
}, handleReactFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
11138
11359
|
const reactDir = config.reactDirectory ?? "";
|
|
11139
|
-
const reactPagesPath =
|
|
11140
|
-
const reactIndexesPath =
|
|
11360
|
+
const reactPagesPath = resolve32(reactDir, "pages");
|
|
11361
|
+
const reactIndexesPath = resolve32(reactDir, "generated", "indexes");
|
|
11141
11362
|
const { buildDir } = state.resolvedPaths;
|
|
11142
11363
|
const reactFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "react");
|
|
11143
11364
|
if (reactFiles.length > 0) {
|
|
@@ -11200,7 +11421,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11200
11421
|
});
|
|
11201
11422
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
11202
11423
|
for (const file4 of svelteFiles) {
|
|
11203
|
-
state.fileHashes.set(
|
|
11424
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
11204
11425
|
}
|
|
11205
11426
|
invalidateSvelteSsrCache();
|
|
11206
11427
|
const serverDuration = Date.now() - startTime;
|
|
@@ -11223,11 +11444,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11223
11444
|
const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
|
|
11224
11445
|
const { build: bunBuild7 } = await Promise.resolve(globalThis.Bun);
|
|
11225
11446
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11226
|
-
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true);
|
|
11447
|
+
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, state.config.stylePreprocessors);
|
|
11227
11448
|
const serverEntries = [...svelteServerPaths];
|
|
11228
11449
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
11229
|
-
const serverRoot =
|
|
11230
|
-
const serverOutDir =
|
|
11450
|
+
const serverRoot = resolve32(svelteDir, "generated", "server");
|
|
11451
|
+
const serverOutDir = resolve32(buildDir, basename13(svelteDir));
|
|
11231
11452
|
const [serverResult, clientResult] = await Promise.all([
|
|
11232
11453
|
serverEntries.length > 0 ? bunBuild7({
|
|
11233
11454
|
entrypoints: serverEntries,
|
|
@@ -11242,7 +11463,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11242
11463
|
format: "esm",
|
|
11243
11464
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11244
11465
|
outdir: serverOutDir,
|
|
11245
|
-
plugins: [
|
|
11466
|
+
plugins: [
|
|
11467
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11468
|
+
],
|
|
11246
11469
|
root: serverRoot,
|
|
11247
11470
|
target: "bun",
|
|
11248
11471
|
throw: false
|
|
@@ -11252,7 +11475,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11252
11475
|
format: "esm",
|
|
11253
11476
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11254
11477
|
outdir: buildDir,
|
|
11255
|
-
plugins: [
|
|
11478
|
+
plugins: [
|
|
11479
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11480
|
+
],
|
|
11256
11481
|
root: clientRoot,
|
|
11257
11482
|
target: "browser",
|
|
11258
11483
|
throw: false
|
|
@@ -11320,7 +11545,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11320
11545
|
});
|
|
11321
11546
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
11322
11547
|
for (const file4 of [...vueFiles, ...nonVueFiles]) {
|
|
11323
|
-
state.fileHashes.set(
|
|
11548
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
11324
11549
|
}
|
|
11325
11550
|
invalidateVueSsrCache();
|
|
11326
11551
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -11415,8 +11640,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11415
11640
|
if (!buildReference?.source) {
|
|
11416
11641
|
return;
|
|
11417
11642
|
}
|
|
11418
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
11419
|
-
islandFiles.add(
|
|
11643
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve32(dirname15(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
11644
|
+
islandFiles.add(resolve32(sourcePath));
|
|
11420
11645
|
}, resolveIslandSourceFiles = async (config) => {
|
|
11421
11646
|
const registryPath = config.islands?.registry;
|
|
11422
11647
|
if (!registryPath) {
|
|
@@ -11424,7 +11649,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11424
11649
|
}
|
|
11425
11650
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
11426
11651
|
const islandFiles = new Set([
|
|
11427
|
-
|
|
11652
|
+
resolve32(buildInfo.resolvedRegistryPath)
|
|
11428
11653
|
]);
|
|
11429
11654
|
for (const definition of buildInfo.definitions) {
|
|
11430
11655
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -11435,7 +11660,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11435
11660
|
if (islandFiles.size === 0) {
|
|
11436
11661
|
return false;
|
|
11437
11662
|
}
|
|
11438
|
-
return filesToRebuild.some((file4) => islandFiles.has(
|
|
11663
|
+
return filesToRebuild.some((file4) => islandFiles.has(resolve32(file4)));
|
|
11439
11664
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
11440
11665
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
11441
11666
|
if (!shouldReload) {
|
|
@@ -11470,10 +11695,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11470
11695
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
11471
11696
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
11472
11697
|
if (isSingle) {
|
|
11473
|
-
return
|
|
11698
|
+
return resolve32(state.resolvedPaths.buildDir, "pages");
|
|
11474
11699
|
}
|
|
11475
11700
|
const dirName = framework === "html" ? basename13(config.htmlDirectory ?? "html") : basename13(config.htmxDirectory ?? "htmx");
|
|
11476
|
-
return
|
|
11701
|
+
return resolve32(state.resolvedPaths.buildDir, dirName, "pages");
|
|
11477
11702
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
11478
11703
|
try {
|
|
11479
11704
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -11512,7 +11737,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11512
11737
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
11513
11738
|
for (const pageFile of pageFilesToUpdate) {
|
|
11514
11739
|
const htmlPageName = basename13(pageFile);
|
|
11515
|
-
const builtHtmlPagePath =
|
|
11740
|
+
const builtHtmlPagePath = resolve32(outputHtmlPages, htmlPageName);
|
|
11516
11741
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
11517
11742
|
}
|
|
11518
11743
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -11573,11 +11798,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11573
11798
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
11574
11799
|
const pascalName = toPascal(baseName);
|
|
11575
11800
|
const vueRoot = config.vueDirectory;
|
|
11576
|
-
const hmrId = vueRoot ?
|
|
11801
|
+
const hmrId = vueRoot ? relative12(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
11577
11802
|
const cssKey = `${pascalName}CSS`;
|
|
11578
11803
|
const cssUrl = manifest[cssKey] || null;
|
|
11579
11804
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
11580
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
11805
|
+
const hmrMeta = vueHmrMetadata2.get(resolve32(vuePagePath));
|
|
11581
11806
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
11582
11807
|
if (changeType === "style-only") {
|
|
11583
11808
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -11814,7 +12039,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11814
12039
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
11815
12040
|
for (const htmxPageFile of pageFilesToUpdate) {
|
|
11816
12041
|
const htmxPageName = basename13(htmxPageFile);
|
|
11817
|
-
const builtHtmxPagePath =
|
|
12042
|
+
const builtHtmxPagePath = resolve32(outputHtmxPages, htmxPageName);
|
|
11818
12043
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
11819
12044
|
}
|
|
11820
12045
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -11923,7 +12148,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11923
12148
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
11924
12149
|
writeFs(destPath, html);
|
|
11925
12150
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
11926
|
-
const destPath =
|
|
12151
|
+
const destPath = resolve32(outputDir, basename13(sourceFile));
|
|
11927
12152
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
11928
12153
|
const source = await Bun.file(sourceFile).text();
|
|
11929
12154
|
await Bun.write(destPath, source);
|
|
@@ -12201,7 +12426,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12201
12426
|
return Array.from(specifiers).filter(isResolvable3);
|
|
12202
12427
|
}, generateEntrySource2 = (specifier) => `export * from '${specifier}';
|
|
12203
12428
|
`, rewriteVendorFiles = async (vendorDir) => {
|
|
12204
|
-
const { readdirSync: readdirSync2, readFileSync:
|
|
12429
|
+
const { readdirSync: readdirSync2, readFileSync: readFileSync15, writeFileSync: writeFileSync8 } = await import("fs");
|
|
12205
12430
|
const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
|
|
12206
12431
|
const reactPaths = Object.entries(computeVendorPaths2());
|
|
12207
12432
|
const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
|
|
@@ -12212,7 +12437,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12212
12437
|
const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
12213
12438
|
for (const file4 of files) {
|
|
12214
12439
|
const filePath = join22(vendorDir, file4);
|
|
12215
|
-
const original =
|
|
12440
|
+
const original = readFileSync15(filePath, "utf-8");
|
|
12216
12441
|
const rewritten = rewriteContent(original);
|
|
12217
12442
|
if (rewritten !== original)
|
|
12218
12443
|
writeFileSync8(filePath, rewritten);
|
|
@@ -12299,7 +12524,7 @@ __export(exports_devBuild, {
|
|
|
12299
12524
|
});
|
|
12300
12525
|
import { readdir as readdir5 } from "fs/promises";
|
|
12301
12526
|
import { statSync as statSync3 } from "fs";
|
|
12302
|
-
import { dirname as dirname16, resolve as
|
|
12527
|
+
import { dirname as dirname16, resolve as resolve33 } from "path";
|
|
12303
12528
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
12304
12529
|
const configuredDirs = [
|
|
12305
12530
|
config.reactDirectory,
|
|
@@ -12322,7 +12547,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12322
12547
|
return Object.keys(config).length > 0 ? config : null;
|
|
12323
12548
|
}, reloadConfig = async () => {
|
|
12324
12549
|
try {
|
|
12325
|
-
const configPath2 =
|
|
12550
|
+
const configPath2 = resolve33(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
12326
12551
|
const source = await Bun.file(configPath2).text();
|
|
12327
12552
|
return parseDirectoryConfig(source);
|
|
12328
12553
|
} catch {
|
|
@@ -12402,7 +12627,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12402
12627
|
state.fileChangeQueue.clear();
|
|
12403
12628
|
}
|
|
12404
12629
|
}, handleCachedReload = async () => {
|
|
12405
|
-
const serverMtime = statSync3(
|
|
12630
|
+
const serverMtime = statSync3(resolve33(Bun.main)).mtimeMs;
|
|
12406
12631
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
12407
12632
|
globalThis.__hmrServerMtime = serverMtime;
|
|
12408
12633
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -12436,8 +12661,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12436
12661
|
return true;
|
|
12437
12662
|
}, resolveAbsoluteVersion2 = async () => {
|
|
12438
12663
|
const candidates = [
|
|
12439
|
-
|
|
12440
|
-
|
|
12664
|
+
resolve33(import.meta.dir, "..", "..", "package.json"),
|
|
12665
|
+
resolve33(import.meta.dir, "..", "package.json")
|
|
12441
12666
|
];
|
|
12442
12667
|
for (const candidate of candidates) {
|
|
12443
12668
|
const found = await tryReadPackageVersion(candidate);
|
|
@@ -12450,7 +12675,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12450
12675
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
12451
12676
|
await Promise.all(entries.map(async (entry) => {
|
|
12452
12677
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
12453
|
-
const bytes = await Bun.file(
|
|
12678
|
+
const bytes = await Bun.file(resolve33(vendorDir, entry)).bytes();
|
|
12454
12679
|
assetStore.set(webPath, bytes);
|
|
12455
12680
|
}));
|
|
12456
12681
|
}, devBuild = async (config) => {
|
|
@@ -12514,7 +12739,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12514
12739
|
recordStep("populate asset store", stepStartedAt);
|
|
12515
12740
|
stepStartedAt = performance.now();
|
|
12516
12741
|
const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12517
|
-
const vendorDir =
|
|
12742
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "react", "vendor");
|
|
12518
12743
|
await loadVendorFiles(state.assetStore, vendorDir, "react");
|
|
12519
12744
|
if (!globalThis.__reactModuleRef) {
|
|
12520
12745
|
globalThis.__reactModuleRef = await import("react");
|
|
@@ -12522,23 +12747,23 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12522
12747
|
return true;
|
|
12523
12748
|
}) : undefined;
|
|
12524
12749
|
const buildAngularVendorTask = config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12525
|
-
const vendorDir =
|
|
12750
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
12526
12751
|
await loadVendorFiles(state.assetStore, vendorDir, "angular");
|
|
12527
12752
|
return true;
|
|
12528
12753
|
}) : undefined;
|
|
12529
12754
|
const buildSvelteVendorTask = config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12530
|
-
const vendorDir =
|
|
12755
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
12531
12756
|
await loadVendorFiles(state.assetStore, vendorDir, "svelte");
|
|
12532
12757
|
return true;
|
|
12533
12758
|
}) : undefined;
|
|
12534
12759
|
const buildVueVendorTask = config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12535
|
-
const vendorDir =
|
|
12760
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
12536
12761
|
await loadVendorFiles(state.assetStore, vendorDir, "vue");
|
|
12537
12762
|
return true;
|
|
12538
12763
|
}) : undefined;
|
|
12539
12764
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
12540
12765
|
const buildDepVendorTask = buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs).then(async (depPaths) => {
|
|
12541
|
-
const vendorDir =
|
|
12766
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "vendor");
|
|
12542
12767
|
await loadVendorFiles(state.assetStore, vendorDir, "vendor");
|
|
12543
12768
|
globalThis.__depVendorPaths = depPaths;
|
|
12544
12769
|
return true;
|
|
@@ -12575,7 +12800,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12575
12800
|
manifest
|
|
12576
12801
|
};
|
|
12577
12802
|
globalThis.__hmrDevResult = result;
|
|
12578
|
-
globalThis.__hmrServerMtime = statSync3(
|
|
12803
|
+
globalThis.__hmrServerMtime = statSync3(resolve33(Bun.main)).mtimeMs;
|
|
12579
12804
|
return result;
|
|
12580
12805
|
};
|
|
12581
12806
|
var init_devBuild = __esm(() => {
|
|
@@ -12724,17 +12949,17 @@ __export(exports_devtoolsJson, {
|
|
|
12724
12949
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
12725
12950
|
devtoolsJson: () => devtoolsJson
|
|
12726
12951
|
});
|
|
12727
|
-
import { existsSync as
|
|
12728
|
-
import { dirname as dirname17, join as join23, resolve as
|
|
12952
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync12, readFileSync as readFileSync15, writeFileSync as writeFileSync8 } from "fs";
|
|
12953
|
+
import { dirname as dirname17, join as join23, resolve as resolve34 } from "path";
|
|
12729
12954
|
import { Elysia as Elysia3 } from "elysia";
|
|
12730
12955
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
12731
12956
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
12732
12957
|
return uuid;
|
|
12733
|
-
}, 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) =>
|
|
12734
|
-
if (!
|
|
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) => {
|
|
12959
|
+
if (!existsSync23(cachePath))
|
|
12735
12960
|
return null;
|
|
12736
12961
|
try {
|
|
12737
|
-
const value =
|
|
12962
|
+
const value = readFileSync15(cachePath, "utf-8").trim();
|
|
12738
12963
|
return isUuidV4(value) ? value : null;
|
|
12739
12964
|
} catch {
|
|
12740
12965
|
return null;
|
|
@@ -12756,7 +12981,7 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
12756
12981
|
writeFileSync8(cachePath, uuid, "utf-8");
|
|
12757
12982
|
return setGlobalUuid(uuid);
|
|
12758
12983
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
12759
|
-
const rootPath =
|
|
12984
|
+
const rootPath = resolve34(options.projectRoot ?? process.cwd());
|
|
12760
12985
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
12761
12986
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
12762
12987
|
return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -12784,13 +13009,13 @@ var exports_imageOptimizer = {};
|
|
|
12784
13009
|
__export(exports_imageOptimizer, {
|
|
12785
13010
|
imageOptimizer: () => imageOptimizer
|
|
12786
13011
|
});
|
|
12787
|
-
import { existsSync as
|
|
12788
|
-
import { resolve as
|
|
13012
|
+
import { existsSync as existsSync24 } from "fs";
|
|
13013
|
+
import { resolve as resolve35 } from "path";
|
|
12789
13014
|
import { Elysia as Elysia4 } from "elysia";
|
|
12790
13015
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
12791
13016
|
try {
|
|
12792
13017
|
const resolved = validateSafePath(path, baseDir);
|
|
12793
|
-
if (
|
|
13018
|
+
if (existsSync24(resolved))
|
|
12794
13019
|
return resolved;
|
|
12795
13020
|
return null;
|
|
12796
13021
|
} catch {
|
|
@@ -12798,7 +13023,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
12798
13023
|
}
|
|
12799
13024
|
}, resolveLocalImage = (url, buildDir) => {
|
|
12800
13025
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
12801
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
13026
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve35(process.cwd()));
|
|
12802
13027
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
12803
13028
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
12804
13029
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -13089,7 +13314,7 @@ __export(exports_prerender, {
|
|
|
13089
13314
|
prerender: () => prerender,
|
|
13090
13315
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
13091
13316
|
});
|
|
13092
|
-
import { mkdirSync as mkdirSync13, readFileSync as
|
|
13317
|
+
import { mkdirSync as mkdirSync13, readFileSync as readFileSync16 } from "fs";
|
|
13093
13318
|
import { join as join24 } from "path";
|
|
13094
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) => {
|
|
13095
13320
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
@@ -13097,7 +13322,7 @@ var MAX_STARTUP_ATTEMPTS = 50, STARTUP_POLL_INTERVAL_MS = 100, PRERENDER_BYPASS_
|
|
|
13097
13322
|
}, readTimestamp = (htmlPath) => {
|
|
13098
13323
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
13099
13324
|
try {
|
|
13100
|
-
const content =
|
|
13325
|
+
const content = readFileSync16(metaPath, "utf-8");
|
|
13101
13326
|
return Number(content) || 0;
|
|
13102
13327
|
} catch {
|
|
13103
13328
|
return 0;
|
|
@@ -13437,12 +13662,12 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
13437
13662
|
});
|
|
13438
13663
|
};
|
|
13439
13664
|
// src/core/prepare.ts
|
|
13440
|
-
import { existsSync as
|
|
13441
|
-
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";
|
|
13442
13667
|
import { Elysia as Elysia5 } from "elysia";
|
|
13443
13668
|
|
|
13444
13669
|
// src/utils/loadConfig.ts
|
|
13445
|
-
import { resolve as
|
|
13670
|
+
import { resolve as resolve7 } from "path";
|
|
13446
13671
|
var RESERVED_TOP_LEVEL_KEYS = new Set([
|
|
13447
13672
|
"assetsDirectory",
|
|
13448
13673
|
"astroDirectory",
|
|
@@ -13520,7 +13745,7 @@ var projectServiceConfig = (config, serviceName) => {
|
|
|
13520
13745
|
return serviceConfig;
|
|
13521
13746
|
};
|
|
13522
13747
|
var loadRawConfig = async (configPath) => {
|
|
13523
|
-
const resolved =
|
|
13748
|
+
const resolved = resolve7(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
13524
13749
|
const mod = await import(resolved);
|
|
13525
13750
|
const config = mod.default ?? mod.config;
|
|
13526
13751
|
if (!config) {
|
|
@@ -13548,7 +13773,7 @@ var loadConfig = async (configPath) => {
|
|
|
13548
13773
|
init_islandPageContext();
|
|
13549
13774
|
|
|
13550
13775
|
// src/core/loadIslandRegistry.ts
|
|
13551
|
-
import { resolve as
|
|
13776
|
+
import { resolve as resolve8 } from "path";
|
|
13552
13777
|
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
13553
13778
|
var resolveRegistryExport2 = (mod) => {
|
|
13554
13779
|
if (isRecord6(mod.islandRegistry))
|
|
@@ -13560,7 +13785,7 @@ var resolveRegistryExport2 = (mod) => {
|
|
|
13560
13785
|
var isRegistryModuleExport = (value) => isRecord6(value);
|
|
13561
13786
|
var isIslandRegistryInput = (value) => isRecord6(value);
|
|
13562
13787
|
var loadIslandRegistry = async (registryPath) => {
|
|
13563
|
-
const resolvedRegistryPath =
|
|
13788
|
+
const resolvedRegistryPath = resolve8(registryPath);
|
|
13564
13789
|
const importedModule = await import(resolvedRegistryPath);
|
|
13565
13790
|
if (!isRegistryModuleExport(importedModule)) {
|
|
13566
13791
|
throw new Error("Island registry module must export an object namespace.");
|
|
@@ -13604,7 +13829,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
13604
13829
|
for (const { dir, pattern } of prewarmDirs) {
|
|
13605
13830
|
const glob = new Glob9(pattern);
|
|
13606
13831
|
const matches = [
|
|
13607
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
13832
|
+
...glob.scanSync({ absolute: true, cwd: resolve36(dir) })
|
|
13608
13833
|
];
|
|
13609
13834
|
files.push(...matches);
|
|
13610
13835
|
}
|
|
@@ -13615,7 +13840,7 @@ var warmPrewarmDirs = async (prewarmDirs, warmCache2, SRC_URL_PREFIX2) => {
|
|
|
13615
13840
|
for (const file4 of files) {
|
|
13616
13841
|
if (file4.includes("/node_modules/"))
|
|
13617
13842
|
continue;
|
|
13618
|
-
const rel =
|
|
13843
|
+
const rel = relative13(process.cwd(), file4).replace(/\\/g, "/");
|
|
13619
13844
|
warmCache2(`${SRC_URL_PREFIX2}${rel}`);
|
|
13620
13845
|
}
|
|
13621
13846
|
};
|
|
@@ -13640,10 +13865,10 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
13640
13865
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
13641
13866
|
if (!fileName)
|
|
13642
13867
|
continue;
|
|
13643
|
-
const srcPath =
|
|
13644
|
-
if (!
|
|
13868
|
+
const srcPath = resolve36(devIndexDir, fileName);
|
|
13869
|
+
if (!existsSync25(srcPath))
|
|
13645
13870
|
continue;
|
|
13646
|
-
const rel =
|
|
13871
|
+
const rel = relative13(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
13647
13872
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
13648
13873
|
}
|
|
13649
13874
|
};
|
|
@@ -13692,6 +13917,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
13692
13917
|
vue: config.vueDirectory
|
|
13693
13918
|
},
|
|
13694
13919
|
projectRoot: process.cwd(),
|
|
13920
|
+
stylePreprocessors: config.stylePreprocessors,
|
|
13695
13921
|
vendorPaths: allVendorPaths
|
|
13696
13922
|
});
|
|
13697
13923
|
setGlobalModuleServer2(moduleHandler);
|
|
@@ -13710,7 +13936,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
13710
13936
|
stepStartedAt = performance.now();
|
|
13711
13937
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
13712
13938
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
13713
|
-
const devIndexDir =
|
|
13939
|
+
const devIndexDir = resolve36(buildDir, "_src_indexes");
|
|
13714
13940
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
13715
13941
|
recordStep("configure dev plugins", stepStartedAt);
|
|
13716
13942
|
stepStartedAt = performance.now();
|
|
@@ -13746,7 +13972,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
13746
13972
|
};
|
|
13747
13973
|
var loadPrerenderMap = (prerenderDir) => {
|
|
13748
13974
|
const map = new Map;
|
|
13749
|
-
if (!
|
|
13975
|
+
if (!existsSync25(prerenderDir))
|
|
13750
13976
|
return map;
|
|
13751
13977
|
let entries;
|
|
13752
13978
|
try {
|
|
@@ -13790,7 +14016,7 @@ var prepare = async (configOrPath) => {
|
|
|
13790
14016
|
recordStep("load config", stepStartedAt);
|
|
13791
14017
|
const nodeEnv = process.env["NODE_ENV"];
|
|
13792
14018
|
const isDev3 = nodeEnv === "development";
|
|
13793
|
-
const buildDir =
|
|
14019
|
+
const buildDir = resolve36(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
13794
14020
|
if (isDev3) {
|
|
13795
14021
|
stepStartedAt = performance.now();
|
|
13796
14022
|
const result = await prepareDev(config, buildDir);
|
|
@@ -13799,7 +14025,7 @@ var prepare = async (configOrPath) => {
|
|
|
13799
14025
|
return result;
|
|
13800
14026
|
}
|
|
13801
14027
|
stepStartedAt = performance.now();
|
|
13802
|
-
const manifest = JSON.parse(
|
|
14028
|
+
const manifest = JSON.parse(readFileSync17(`${buildDir}/manifest.json`, "utf-8"));
|
|
13803
14029
|
setCurrentIslandManifest(manifest);
|
|
13804
14030
|
if (config.islands?.registry) {
|
|
13805
14031
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -13808,8 +14034,8 @@ var prepare = async (configOrPath) => {
|
|
|
13808
14034
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
13809
14035
|
stepStartedAt = performance.now();
|
|
13810
14036
|
const conventionsPath = join25(buildDir, "conventions.json");
|
|
13811
|
-
if (
|
|
13812
|
-
const conventions2 = JSON.parse(
|
|
14037
|
+
if (existsSync25(conventionsPath)) {
|
|
14038
|
+
const conventions2 = JSON.parse(readFileSync17(conventionsPath, "utf-8"));
|
|
13813
14039
|
setConventions(conventions2);
|
|
13814
14040
|
}
|
|
13815
14041
|
recordStep("load production conventions", stepStartedAt);
|
|
@@ -13878,7 +14104,7 @@ import { argv } from "process";
|
|
|
13878
14104
|
var {env: env4 } = globalThis.Bun;
|
|
13879
14105
|
|
|
13880
14106
|
// src/dev/devCert.ts
|
|
13881
|
-
import { existsSync as
|
|
14107
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync14, readFileSync as readFileSync18, rmSync as rmSync3 } from "fs";
|
|
13882
14108
|
import { join as join26 } from "path";
|
|
13883
14109
|
var CERT_DIR = join26(process.cwd(), ".absolutejs");
|
|
13884
14110
|
var CERT_PATH = join26(CERT_DIR, "cert.pem");
|
|
@@ -13886,10 +14112,10 @@ var KEY_PATH = join26(CERT_DIR, "key.pem");
|
|
|
13886
14112
|
var CERT_VALIDITY_DAYS = 365;
|
|
13887
14113
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
13888
14114
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
13889
|
-
var certFilesExist = () =>
|
|
14115
|
+
var certFilesExist = () => existsSync26(CERT_PATH) && existsSync26(KEY_PATH);
|
|
13890
14116
|
var isCertExpired = () => {
|
|
13891
14117
|
try {
|
|
13892
|
-
const certPem =
|
|
14118
|
+
const certPem = readFileSync18(CERT_PATH, "utf-8");
|
|
13893
14119
|
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
13894
14120
|
stdin: new TextEncoder().encode(certPem)
|
|
13895
14121
|
});
|
|
@@ -13985,8 +14211,8 @@ var loadDevCert = () => {
|
|
|
13985
14211
|
return null;
|
|
13986
14212
|
try {
|
|
13987
14213
|
return {
|
|
13988
|
-
cert:
|
|
13989
|
-
key:
|
|
14214
|
+
cert: readFileSync18(paths.cert, "utf-8"),
|
|
14215
|
+
key: readFileSync18(paths.key, "utf-8")
|
|
13990
14216
|
};
|
|
13991
14217
|
} catch {
|
|
13992
14218
|
return null;
|
|
@@ -14214,8 +14440,8 @@ var jsonLd2 = (schema) => {
|
|
|
14214
14440
|
};
|
|
14215
14441
|
// src/utils/defineEnv.ts
|
|
14216
14442
|
var {env: bunEnv } = globalThis.Bun;
|
|
14217
|
-
import { existsSync as
|
|
14218
|
-
import { resolve as
|
|
14443
|
+
import { existsSync as existsSync27, readFileSync as readFileSync19 } from "fs";
|
|
14444
|
+
import { resolve as resolve37 } from "path";
|
|
14219
14445
|
|
|
14220
14446
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
14221
14447
|
var exports_value = {};
|
|
@@ -20250,19 +20476,19 @@ ${lines.join(`
|
|
|
20250
20476
|
};
|
|
20251
20477
|
var checkEnvFileSecurity = (properties) => {
|
|
20252
20478
|
const cwd2 = process.cwd();
|
|
20253
|
-
const envPath =
|
|
20254
|
-
if (!
|
|
20479
|
+
const envPath = resolve37(cwd2, ".env");
|
|
20480
|
+
if (!existsSync27(envPath))
|
|
20255
20481
|
return;
|
|
20256
20482
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
20257
20483
|
if (sensitiveKeys.length === 0)
|
|
20258
20484
|
return;
|
|
20259
|
-
const envContent =
|
|
20485
|
+
const envContent = readFileSync19(envPath, "utf-8");
|
|
20260
20486
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
20261
20487
|
if (presentKeys.length === 0)
|
|
20262
20488
|
return;
|
|
20263
|
-
const gitignorePath =
|
|
20264
|
-
if (
|
|
20265
|
-
const gitignore =
|
|
20489
|
+
const gitignorePath = resolve37(cwd2, ".gitignore");
|
|
20490
|
+
if (existsSync27(gitignorePath)) {
|
|
20491
|
+
const gitignore = readFileSync19(gitignorePath, "utf-8");
|
|
20266
20492
|
if (gitignore.split(`
|
|
20267
20493
|
`).some((line) => line.trim() === ".env"))
|
|
20268
20494
|
return;
|
|
@@ -20469,5 +20695,5 @@ export {
|
|
|
20469
20695
|
ANGULAR_INIT_TIMEOUT_MS
|
|
20470
20696
|
};
|
|
20471
20697
|
|
|
20472
|
-
//# debugId=
|
|
20698
|
+
//# debugId=994C58D8A1A6025964756E2164756E21
|
|
20473
20699
|
//# sourceMappingURL=index.js.map
|