@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/build.js
CHANGED
|
@@ -2448,10 +2448,12 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2448
2448
|
});
|
|
2449
2449
|
|
|
2450
2450
|
// src/build/stylePreprocessor.ts
|
|
2451
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
|
|
2451
2452
|
import { readFile } from "fs/promises";
|
|
2452
2453
|
import { createRequire } from "module";
|
|
2453
|
-
import { dirname as dirname3, extname as extname3, join as join5 } from "path";
|
|
2454
|
-
|
|
2454
|
+
import { dirname as dirname3, extname as extname3, isAbsolute, join as join5, relative as relative3, resolve as resolve6 } from "path";
|
|
2455
|
+
import { fileURLToPath } from "url";
|
|
2456
|
+
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) => {
|
|
2455
2457
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2456
2458
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
2457
2459
|
return "scss";
|
|
@@ -2459,19 +2461,214 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2459
2461
|
return "sass";
|
|
2460
2462
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
2461
2463
|
return "less";
|
|
2464
|
+
if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
|
|
2465
|
+
return "stylus";
|
|
2462
2466
|
return null;
|
|
2463
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
2467
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
2468
|
+
dirname3(filePath),
|
|
2469
|
+
process.cwd(),
|
|
2470
|
+
...paths.map((path) => resolve6(process.cwd(), path))
|
|
2471
|
+
], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
|
|
2472
|
+
pattern,
|
|
2473
|
+
replacements: Array.isArray(value) ? value : [value]
|
|
2474
|
+
})), readTsconfigAliases = () => {
|
|
2475
|
+
const cwd = process.cwd();
|
|
2476
|
+
if (tsconfigAliasCache?.cwd === cwd)
|
|
2477
|
+
return tsconfigAliasCache;
|
|
2478
|
+
const tsconfigPath = resolve6(cwd, "tsconfig.json");
|
|
2479
|
+
const empty = { aliases: [], baseUrl: cwd, cwd };
|
|
2480
|
+
if (!existsSync5(tsconfigPath)) {
|
|
2481
|
+
tsconfigAliasCache = empty;
|
|
2482
|
+
return empty;
|
|
2483
|
+
}
|
|
2484
|
+
try {
|
|
2485
|
+
const parsed = JSON.parse(stripJsonComments(readFileSync3(tsconfigPath, "utf-8")));
|
|
2486
|
+
const compilerOptions = parsed.compilerOptions ?? {};
|
|
2487
|
+
const baseUrl = resolve6(cwd, compilerOptions.baseUrl ?? ".");
|
|
2488
|
+
tsconfigAliasCache = {
|
|
2489
|
+
aliases: normalizeAliasEntries(compilerOptions.paths),
|
|
2490
|
+
baseUrl,
|
|
2491
|
+
cwd
|
|
2492
|
+
};
|
|
2493
|
+
} catch {
|
|
2494
|
+
tsconfigAliasCache = empty;
|
|
2495
|
+
}
|
|
2496
|
+
return tsconfigAliasCache;
|
|
2497
|
+
}, getAliasEntries = (config) => {
|
|
2498
|
+
const tsconfig = readTsconfigAliases();
|
|
2499
|
+
return {
|
|
2500
|
+
aliases: [...normalizeAliasEntries(config?.aliases), ...tsconfig.aliases],
|
|
2501
|
+
baseUrl: tsconfig.baseUrl
|
|
2502
|
+
};
|
|
2503
|
+
}, aliasPatternToRegExp = (pattern) => new RegExp(`^${pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("(.+)")}$`), resolveAliasTargets = (specifier, config) => {
|
|
2504
|
+
const { aliases, baseUrl } = getAliasEntries(config);
|
|
2505
|
+
const targets = [];
|
|
2506
|
+
for (const alias of aliases) {
|
|
2507
|
+
const match = specifier.match(aliasPatternToRegExp(alias.pattern));
|
|
2508
|
+
if (!match)
|
|
2509
|
+
continue;
|
|
2510
|
+
const wildcard = match[1] ?? "";
|
|
2511
|
+
for (const replacement of alias.replacements) {
|
|
2512
|
+
targets.push(resolve6(baseUrl, replacement.replace("*", wildcard)));
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
return targets;
|
|
2516
|
+
}, getLanguageExtensions = (language) => {
|
|
2517
|
+
if (language === "less")
|
|
2518
|
+
return [".less", ".css"];
|
|
2519
|
+
if (language === "stylus")
|
|
2520
|
+
return [".styl", ".stylus", ".css"];
|
|
2521
|
+
return [".scss", ".sass", ".css"];
|
|
2522
|
+
}, getCandidatePaths = (basePath, language) => {
|
|
2523
|
+
const ext = extname3(basePath);
|
|
2524
|
+
const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
|
|
2525
|
+
`${basePath}${extension}`,
|
|
2526
|
+
join5(basePath, `index${extension}`)
|
|
2527
|
+
]);
|
|
2528
|
+
if (language === "scss" || language === "sass") {
|
|
2529
|
+
return paths.flatMap((path) => {
|
|
2530
|
+
const dir = dirname3(path);
|
|
2531
|
+
const base = path.slice(dir.length + 1);
|
|
2532
|
+
return [path, join5(dir, `_${base}`)];
|
|
2533
|
+
});
|
|
2534
|
+
}
|
|
2535
|
+
return paths;
|
|
2536
|
+
}, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
|
|
2537
|
+
const rawCandidates = [
|
|
2538
|
+
...resolveAliasTargets(specifier, config),
|
|
2539
|
+
isAbsolute(specifier) ? specifier : resolve6(fromDirectory, specifier),
|
|
2540
|
+
...loadPaths.map((path) => resolve6(path, specifier))
|
|
2541
|
+
];
|
|
2542
|
+
for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
|
|
2543
|
+
if (existsSync5(candidate))
|
|
2544
|
+
return candidate;
|
|
2545
|
+
}
|
|
2546
|
+
return null;
|
|
2547
|
+
}, isExternalCssUrl = (url) => /^(?:[a-z][a-z0-9+.-]*:|\/\/|#|\/)/i.test(url), splitCssUrl = (url) => {
|
|
2548
|
+
const markerIndex = url.search(/[?#]/);
|
|
2549
|
+
if (markerIndex === -1)
|
|
2550
|
+
return { marker: "", path: url };
|
|
2551
|
+
return {
|
|
2552
|
+
marker: url.slice(markerIndex),
|
|
2553
|
+
path: url.slice(0, markerIndex)
|
|
2554
|
+
};
|
|
2555
|
+
}, rebaseCssUrls = (contents, sourceFile, entryFile) => {
|
|
2556
|
+
const sourceDir = dirname3(sourceFile);
|
|
2557
|
+
const entryDir = dirname3(entryFile);
|
|
2558
|
+
if (sourceDir === entryDir)
|
|
2559
|
+
return contents;
|
|
2560
|
+
return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
|
|
2561
|
+
const trimmedUrl = rawUrl.trim();
|
|
2562
|
+
if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
|
|
2563
|
+
return match;
|
|
2564
|
+
const { marker, path } = splitCssUrl(trimmedUrl);
|
|
2565
|
+
const rebased = relative3(entryDir, resolve6(sourceDir, path)).replace(/\\/g, "/");
|
|
2566
|
+
const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
|
|
2567
|
+
const nextQuote = quote || '"';
|
|
2568
|
+
return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
|
|
2569
|
+
});
|
|
2570
|
+
}, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
|
|
2571
|
+
if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
|
|
2572
|
+
return match;
|
|
2573
|
+
const resolved = resolveImportPath(specifier, dirname3(sourceFile), loadPaths, language, config);
|
|
2574
|
+
return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
|
|
2575
|
+
}), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
|
|
2576
|
+
const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
|
|
2577
|
+
return language ? rewriteAliasedStyleImports(rebased, sourceFile, loadPaths, language, config) : rebased;
|
|
2578
|
+
}, extractCssModuleExports = (css) => {
|
|
2579
|
+
const exports = {};
|
|
2580
|
+
const nextCss = css.replace(/:export\s*\{([^}]*)\}/g, (_, body) => {
|
|
2581
|
+
for (const declaration of body.split(";")) {
|
|
2582
|
+
const separator = declaration.indexOf(":");
|
|
2583
|
+
if (separator === -1)
|
|
2584
|
+
continue;
|
|
2585
|
+
const key = declaration.slice(0, separator).trim();
|
|
2586
|
+
const value = declaration.slice(separator + 1).trim();
|
|
2587
|
+
if (key && value)
|
|
2588
|
+
exports[key] = value;
|
|
2589
|
+
}
|
|
2590
|
+
return "";
|
|
2591
|
+
});
|
|
2592
|
+
return { css: nextCss, exports };
|
|
2593
|
+
}, getSassOptions = (config, language) => ({
|
|
2594
|
+
...config?.sass ?? {},
|
|
2595
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
2596
|
+
}), getLessOptions = (config) => config?.less ?? {}, getStylusOptions = (config) => config?.stylus ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2597
|
+
${contents}` : contents, createSassImporter = (entryFile, loadPaths, language, config) => ({
|
|
2598
|
+
canonicalize(specifier, options) {
|
|
2599
|
+
const fromDirectory = options.containingUrl ? dirname3(fileURLToPath(options.containingUrl)) : dirname3(entryFile);
|
|
2600
|
+
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
2601
|
+
return resolved ? new URL(`file://${resolved}`) : null;
|
|
2602
|
+
},
|
|
2603
|
+
load(canonicalUrl) {
|
|
2604
|
+
const filePath = fileURLToPath(canonicalUrl);
|
|
2605
|
+
const fileLanguage = getStyleLanguage(filePath);
|
|
2606
|
+
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
2607
|
+
return null;
|
|
2608
|
+
return {
|
|
2609
|
+
contents: preprocessLoadedStyle(readFileSync3(filePath, "utf-8"), filePath, entryFile, loadPaths, language, config),
|
|
2610
|
+
syntax: filePath.endsWith(".sass") ? "indented" : "scss"
|
|
2611
|
+
};
|
|
2612
|
+
}
|
|
2613
|
+
}), createLessFileManager = (entryFile, loadPaths, config) => ({
|
|
2614
|
+
install(less, pluginManager) {
|
|
2615
|
+
const baseManager = new less.FileManager;
|
|
2616
|
+
const manager = Object.create(baseManager);
|
|
2617
|
+
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve6(currentDirectory), loadPaths, "less", config));
|
|
2618
|
+
manager.loadFile = async (filename, currentDirectory) => {
|
|
2619
|
+
const resolved = resolveImportPath(filename, resolve6(currentDirectory), loadPaths, "less", config);
|
|
2620
|
+
if (!resolved) {
|
|
2621
|
+
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
2622
|
+
}
|
|
2623
|
+
return {
|
|
2624
|
+
contents: preprocessLoadedStyle(await readFile(resolved, "utf-8"), resolved, entryFile, loadPaths, "less", config),
|
|
2625
|
+
filename: resolved
|
|
2626
|
+
};
|
|
2627
|
+
};
|
|
2628
|
+
pluginManager.addFileManager(manager);
|
|
2629
|
+
}
|
|
2630
|
+
}), renderStylus = async (contents, filePath, loadPaths, options) => {
|
|
2631
|
+
let stylus;
|
|
2632
|
+
try {
|
|
2633
|
+
const stylusModule = await importOptionalPeer("stylus");
|
|
2634
|
+
stylus = stylusModule.default ?? stylusModule;
|
|
2635
|
+
} catch {
|
|
2636
|
+
throw missingDependencyError("stylus", filePath);
|
|
2637
|
+
}
|
|
2638
|
+
return new Promise((resolveCss, reject) => {
|
|
2639
|
+
const renderer = stylus(contents);
|
|
2640
|
+
renderer.set("filename", filePath);
|
|
2641
|
+
for (const [key, value] of Object.entries(options.options ?? {})) {
|
|
2642
|
+
renderer.set(key, value);
|
|
2643
|
+
}
|
|
2644
|
+
for (const path of loadPaths)
|
|
2645
|
+
renderer.include(path);
|
|
2646
|
+
renderer.render((error, css) => {
|
|
2647
|
+
if (error)
|
|
2648
|
+
reject(error);
|
|
2649
|
+
else
|
|
2650
|
+
resolveCss(css ?? "");
|
|
2651
|
+
});
|
|
2652
|
+
});
|
|
2653
|
+
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
2464
2654
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2465
|
-
const
|
|
2655
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2466
2656
|
if (language === "scss" || language === "sass") {
|
|
2657
|
+
const options = getSassOptions(config, language);
|
|
2658
|
+
const packageName = options.implementation ?? "sass";
|
|
2467
2659
|
let sass;
|
|
2468
2660
|
try {
|
|
2469
|
-
sass = await importOptionalPeer(
|
|
2661
|
+
sass = await importOptionalPeer(packageName);
|
|
2470
2662
|
} catch {
|
|
2471
|
-
throw missingDependencyError(
|
|
2663
|
+
throw missingDependencyError(packageName, filePath);
|
|
2472
2664
|
}
|
|
2665
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2666
|
+
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
2473
2667
|
const result = sass.compileString(contents, {
|
|
2474
|
-
|
|
2668
|
+
importers: [
|
|
2669
|
+
createSassImporter(filePath, loadPaths, language, config)
|
|
2670
|
+
],
|
|
2671
|
+
loadPaths,
|
|
2475
2672
|
style: "expanded",
|
|
2476
2673
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2477
2674
|
url: new URL(`file://${filePath}`)
|
|
@@ -2479,6 +2676,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2479
2676
|
return result.css;
|
|
2480
2677
|
}
|
|
2481
2678
|
if (language === "less") {
|
|
2679
|
+
const options = getLessOptions(config);
|
|
2482
2680
|
let lessModule;
|
|
2483
2681
|
try {
|
|
2484
2682
|
lessModule = await importOptionalPeer("less");
|
|
@@ -2489,14 +2687,63 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2489
2687
|
const render = less?.render;
|
|
2490
2688
|
if (!render)
|
|
2491
2689
|
throw missingDependencyError("less", filePath);
|
|
2690
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2691
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
2492
2692
|
const result = await render(contents, {
|
|
2693
|
+
...options.options ?? {},
|
|
2493
2694
|
filename: filePath,
|
|
2494
|
-
paths:
|
|
2695
|
+
paths: loadPaths,
|
|
2696
|
+
plugins: [
|
|
2697
|
+
...options.options?.plugins ?? [],
|
|
2698
|
+
createLessFileManager(filePath, loadPaths, config)
|
|
2699
|
+
]
|
|
2495
2700
|
});
|
|
2496
2701
|
return result.css;
|
|
2497
2702
|
}
|
|
2498
|
-
|
|
2499
|
-
|
|
2703
|
+
if (language === "stylus") {
|
|
2704
|
+
const options = getStylusOptions(config);
|
|
2705
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
2706
|
+
const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
|
|
2707
|
+
return renderStylus(contents, filePath, loadPaths, options);
|
|
2708
|
+
}
|
|
2709
|
+
return rawContents;
|
|
2710
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
2711
|
+
name: "absolute-style-preprocessor",
|
|
2712
|
+
setup(build) {
|
|
2713
|
+
const cssModuleSources = new Map;
|
|
2714
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2715
|
+
namespace: "absolute-style-module",
|
|
2716
|
+
path: path.slice("absolute-style-module:".length)
|
|
2717
|
+
}));
|
|
2718
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2719
|
+
const source = cssModuleSources.get(path);
|
|
2720
|
+
if (!source) {
|
|
2721
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2722
|
+
}
|
|
2723
|
+
return {
|
|
2724
|
+
contents: source.css,
|
|
2725
|
+
loader: "css"
|
|
2726
|
+
};
|
|
2727
|
+
});
|
|
2728
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2729
|
+
if (isStyleModulePath(path)) {
|
|
2730
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2731
|
+
const compiled = await compileStyleSource(path, undefined, undefined, config);
|
|
2732
|
+
const { css, exports } = extractCssModuleExports(compiled);
|
|
2733
|
+
cssModuleSources.set(cssModulePath, { css, exports });
|
|
2734
|
+
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}`)};`;
|
|
2735
|
+
return {
|
|
2736
|
+
contents: exportSource,
|
|
2737
|
+
loader: "js"
|
|
2738
|
+
};
|
|
2739
|
+
}
|
|
2740
|
+
return {
|
|
2741
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
2742
|
+
loader: "css"
|
|
2743
|
+
};
|
|
2744
|
+
});
|
|
2745
|
+
}
|
|
2746
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
2500
2747
|
style: async ({
|
|
2501
2748
|
attributes,
|
|
2502
2749
|
content,
|
|
@@ -2507,63 +2754,30 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2507
2754
|
return;
|
|
2508
2755
|
const path = filename ?? `style.${language}`;
|
|
2509
2756
|
return {
|
|
2510
|
-
code: await compileStyleSource(path, content, language)
|
|
2757
|
+
code: await compileStyleSource(path, content, language, config)
|
|
2511
2758
|
};
|
|
2512
2759
|
}
|
|
2513
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
2760
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
2514
2761
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2515
2762
|
return readFile(filePath, "utf-8");
|
|
2516
2763
|
}
|
|
2517
|
-
return compileStyleSource(filePath);
|
|
2764
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2518
2765
|
};
|
|
2519
2766
|
var init_stylePreprocessor = __esm(() => {
|
|
2520
|
-
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
2521
|
-
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less)$/i;
|
|
2522
|
-
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less)$/i;
|
|
2767
|
+
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2768
|
+
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2769
|
+
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2523
2770
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2524
2771
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2525
2772
|
requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
|
|
2526
|
-
stylePreprocessorPlugin =
|
|
2527
|
-
name: "absolute-style-preprocessor",
|
|
2528
|
-
setup(build) {
|
|
2529
|
-
const cssModuleSources = new Map;
|
|
2530
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2531
|
-
namespace: "absolute-style-module",
|
|
2532
|
-
path: path.slice("absolute-style-module:".length)
|
|
2533
|
-
}));
|
|
2534
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2535
|
-
const sourcePath = cssModuleSources.get(path);
|
|
2536
|
-
if (!sourcePath) {
|
|
2537
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2538
|
-
}
|
|
2539
|
-
return {
|
|
2540
|
-
contents: await compileStyleSource(sourcePath),
|
|
2541
|
-
loader: "css"
|
|
2542
|
-
};
|
|
2543
|
-
});
|
|
2544
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2545
|
-
if (isStyleModulePath(path)) {
|
|
2546
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2547
|
-
cssModuleSources.set(cssModulePath, path);
|
|
2548
|
-
return {
|
|
2549
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2550
|
-
loader: "js"
|
|
2551
|
-
};
|
|
2552
|
-
}
|
|
2553
|
-
return {
|
|
2554
|
-
contents: await compileStyleSource(path),
|
|
2555
|
-
loader: "css"
|
|
2556
|
-
};
|
|
2557
|
-
});
|
|
2558
|
-
}
|
|
2559
|
-
};
|
|
2773
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
2560
2774
|
});
|
|
2561
2775
|
|
|
2562
2776
|
// src/core/svelteServerModule.ts
|
|
2563
2777
|
import { mkdir, readdir as readdir2 } from "fs/promises";
|
|
2564
|
-
import { basename as basename2, dirname as dirname4, extname as extname4, join as join6, relative as
|
|
2778
|
+
import { basename as basename2, dirname as dirname4, extname as extname4, join as join6, relative as relative4, resolve as resolve7 } from "path";
|
|
2565
2779
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2566
|
-
const importPath =
|
|
2780
|
+
const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
|
|
2567
2781
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2568
2782
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
2569
2783
|
for (const entry of entries) {
|
|
@@ -2609,7 +2823,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2609
2823
|
if (!spec.startsWith(".")) {
|
|
2610
2824
|
return null;
|
|
2611
2825
|
}
|
|
2612
|
-
const basePath =
|
|
2826
|
+
const basePath = resolve7(dirname4(from), spec);
|
|
2613
2827
|
const candidates = [
|
|
2614
2828
|
basePath,
|
|
2615
2829
|
`${basePath}.ts`,
|
|
@@ -2627,7 +2841,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2627
2841
|
const foundIndex = existResults.indexOf(true);
|
|
2628
2842
|
return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
|
|
2629
2843
|
}, getCachedModulePath = (sourcePath) => {
|
|
2630
|
-
const relativeSourcePath =
|
|
2844
|
+
const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2631
2845
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2632
2846
|
return join6(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
2633
2847
|
}, resolveSvelteImport = async (spec, from) => {
|
|
@@ -2641,7 +2855,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2641
2855
|
if (!spec.startsWith(".")) {
|
|
2642
2856
|
return null;
|
|
2643
2857
|
}
|
|
2644
|
-
const explicitPath =
|
|
2858
|
+
const explicitPath = resolve7(dirname4(from), spec);
|
|
2645
2859
|
if (extname4(explicitPath) === ".svelte") {
|
|
2646
2860
|
return explicitPath;
|
|
2647
2861
|
}
|
|
@@ -2947,7 +3161,7 @@ var init_staticStreaming = __esm(() => {
|
|
|
2947
3161
|
});
|
|
2948
3162
|
|
|
2949
3163
|
// src/build/staticIslandPages.ts
|
|
2950
|
-
import { readFileSync as
|
|
3164
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
2951
3165
|
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) => {
|
|
2952
3166
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
2953
3167
|
const attributes = new Map;
|
|
@@ -3076,7 +3290,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
3076
3290
|
}
|
|
3077
3291
|
return result + originalHtml.slice(nextIndex);
|
|
3078
3292
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
3079
|
-
const originalHtml =
|
|
3293
|
+
const originalHtml = readFileSync4(pagePath, "utf-8");
|
|
3080
3294
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
3081
3295
|
if (transformedHtml !== originalHtml) {
|
|
3082
3296
|
writeFileSync3(pagePath, transformedHtml);
|
|
@@ -3129,10 +3343,10 @@ var init_outputLogs = __esm(() => {
|
|
|
3129
3343
|
});
|
|
3130
3344
|
|
|
3131
3345
|
// src/build/scanEntryPoints.ts
|
|
3132
|
-
import { existsSync as
|
|
3346
|
+
import { existsSync as existsSync6 } from "fs";
|
|
3133
3347
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
3134
3348
|
var scanEntryPoints = async (dir, pattern) => {
|
|
3135
|
-
if (!
|
|
3349
|
+
if (!existsSync6(dir))
|
|
3136
3350
|
return [];
|
|
3137
3351
|
const entryPaths = [];
|
|
3138
3352
|
const glob = new Glob2(pattern);
|
|
@@ -3146,7 +3360,7 @@ var init_scanEntryPoints = () => {};
|
|
|
3146
3360
|
// src/build/scanConventions.ts
|
|
3147
3361
|
import { basename as basename3 } from "path";
|
|
3148
3362
|
var {Glob: Glob3 } = globalThis.Bun;
|
|
3149
|
-
import { existsSync as
|
|
3363
|
+
import { existsSync as existsSync7 } from "fs";
|
|
3150
3364
|
var CONVENTION_RE, classifyFile = (file, pageFiles, defaults, pages) => {
|
|
3151
3365
|
const fileName = basename3(file);
|
|
3152
3366
|
const match = CONVENTION_RE.exec(fileName);
|
|
@@ -3171,7 +3385,7 @@ var CONVENTION_RE, classifyFile = (file, pageFiles, defaults, pages) => {
|
|
|
3171
3385
|
else if (kind === "loading")
|
|
3172
3386
|
pages[pageName].loading = file;
|
|
3173
3387
|
}, scanConventions = async (pagesDir, pattern) => {
|
|
3174
|
-
if (!
|
|
3388
|
+
if (!existsSync7(pagesDir)) {
|
|
3175
3389
|
const pageFiles2 = [];
|
|
3176
3390
|
return { conventions: undefined, pageFiles: pageFiles2 };
|
|
3177
3391
|
}
|
|
@@ -3194,13 +3408,13 @@ var init_scanConventions = __esm(() => {
|
|
|
3194
3408
|
});
|
|
3195
3409
|
|
|
3196
3410
|
// src/build/scanCssEntryPoints.ts
|
|
3197
|
-
import { existsSync as
|
|
3411
|
+
import { existsSync as existsSync8 } from "fs";
|
|
3198
3412
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
3199
3413
|
var scanCssEntryPoints = async (dir, ignore) => {
|
|
3200
|
-
if (!
|
|
3414
|
+
if (!existsSync8(dir))
|
|
3201
3415
|
return [];
|
|
3202
3416
|
const entryPaths = [];
|
|
3203
|
-
const glob = new Glob4("**/*.{css,scss,sass,less}");
|
|
3417
|
+
const glob = new Glob4("**/*.{css,scss,sass,less,styl,stylus}");
|
|
3204
3418
|
for await (const file of glob.scan({ absolute: true, cwd: dir })) {
|
|
3205
3419
|
const normalized = normalizePath(file);
|
|
3206
3420
|
if (isStyleModulePath(normalized) || ignore?.some((pattern) => normalized.includes(pattern)))
|
|
@@ -3214,8 +3428,8 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
3214
3428
|
});
|
|
3215
3429
|
|
|
3216
3430
|
// src/utils/imageProcessing.ts
|
|
3217
|
-
import { existsSync as
|
|
3218
|
-
import { join as join7, resolve as
|
|
3431
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
3432
|
+
import { join as join7, resolve as resolve8 } from "path";
|
|
3219
3433
|
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) => {
|
|
3220
3434
|
for (const size of sizes) {
|
|
3221
3435
|
if (size >= target)
|
|
@@ -3269,7 +3483,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3269
3483
|
return [...device, ...image].sort((left, right) => left - right);
|
|
3270
3484
|
}, getCacheDir = (buildDir) => {
|
|
3271
3485
|
const dir = join7(buildDir, ".cache", "images");
|
|
3272
|
-
if (!
|
|
3486
|
+
if (!existsSync9(dir))
|
|
3273
3487
|
mkdirSync3(dir, { recursive: true });
|
|
3274
3488
|
return dir;
|
|
3275
3489
|
}, getCacheKey = (url, width, quality, format) => {
|
|
@@ -3327,11 +3541,11 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3327
3541
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
3328
3542
|
const metaPath = join7(cacheDir, `${cacheKey}.meta`);
|
|
3329
3543
|
const dataPath = join7(cacheDir, `${cacheKey}.data`);
|
|
3330
|
-
if (!
|
|
3544
|
+
if (!existsSync9(metaPath) || !existsSync9(dataPath))
|
|
3331
3545
|
return null;
|
|
3332
3546
|
try {
|
|
3333
|
-
const meta = JSON.parse(
|
|
3334
|
-
const buffer =
|
|
3547
|
+
const meta = JSON.parse(readFileSync5(metaPath, "utf-8"));
|
|
3548
|
+
const buffer = readFileSync5(dataPath);
|
|
3335
3549
|
return { buffer, meta };
|
|
3336
3550
|
} catch {
|
|
3337
3551
|
return null;
|
|
@@ -3341,7 +3555,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3341
3555
|
return sharpModule;
|
|
3342
3556
|
sharpLoaded = true;
|
|
3343
3557
|
try {
|
|
3344
|
-
const sharpPath =
|
|
3558
|
+
const sharpPath = resolve8(process.cwd(), "node_modules/sharp");
|
|
3345
3559
|
const mod = await import(sharpPath);
|
|
3346
3560
|
sharpModule = mod.default ?? mod;
|
|
3347
3561
|
return sharpModule;
|
|
@@ -3446,14 +3660,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
3446
3660
|
});
|
|
3447
3661
|
|
|
3448
3662
|
// src/cli/scripts/telemetry.ts
|
|
3449
|
-
import { existsSync as
|
|
3663
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
3450
3664
|
import { homedir } from "os";
|
|
3451
3665
|
import { join as join8 } from "path";
|
|
3452
3666
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
3453
3667
|
try {
|
|
3454
|
-
if (!
|
|
3668
|
+
if (!existsSync10(configPath))
|
|
3455
3669
|
return null;
|
|
3456
|
-
const raw =
|
|
3670
|
+
const raw = readFileSync6(configPath, "utf-8");
|
|
3457
3671
|
const config = JSON.parse(raw);
|
|
3458
3672
|
return config;
|
|
3459
3673
|
} catch {
|
|
@@ -3466,14 +3680,14 @@ var init_telemetry = __esm(() => {
|
|
|
3466
3680
|
});
|
|
3467
3681
|
|
|
3468
3682
|
// src/cli/telemetryEvent.ts
|
|
3469
|
-
import { existsSync as
|
|
3683
|
+
import { existsSync as existsSync11, readFileSync as readFileSync7 } from "fs";
|
|
3470
3684
|
import { arch, platform } from "os";
|
|
3471
3685
|
import { dirname as dirname5, join as join9, parse } from "path";
|
|
3472
3686
|
var checkCandidate = (candidate) => {
|
|
3473
|
-
if (!
|
|
3687
|
+
if (!existsSync11(candidate)) {
|
|
3474
3688
|
return null;
|
|
3475
3689
|
}
|
|
3476
|
-
const pkg = JSON.parse(
|
|
3690
|
+
const pkg = JSON.parse(readFileSync7(candidate, "utf-8"));
|
|
3477
3691
|
if (pkg.name === "@absolutejs/absolute") {
|
|
3478
3692
|
const ver = pkg.version;
|
|
3479
3693
|
return ver;
|
|
@@ -3578,19 +3792,19 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
3578
3792
|
});
|
|
3579
3793
|
|
|
3580
3794
|
// src/dev/buildHMRClient.ts
|
|
3581
|
-
import { existsSync as
|
|
3582
|
-
import { resolve as
|
|
3795
|
+
import { existsSync as existsSync12 } from "fs";
|
|
3796
|
+
import { resolve as resolve9 } from "path";
|
|
3583
3797
|
var {build: bunBuild } = globalThis.Bun;
|
|
3584
3798
|
var resolveHmrClientPath = () => {
|
|
3585
3799
|
const projectRoot = process.cwd();
|
|
3586
|
-
const fromSource =
|
|
3587
|
-
if (
|
|
3800
|
+
const fromSource = resolve9(import.meta.dir, "client/hmrClient.ts");
|
|
3801
|
+
if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3588
3802
|
return fromSource;
|
|
3589
3803
|
}
|
|
3590
|
-
const fromNodeModules =
|
|
3591
|
-
if (
|
|
3804
|
+
const fromNodeModules = resolve9(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
3805
|
+
if (existsSync12(fromNodeModules))
|
|
3592
3806
|
return fromNodeModules;
|
|
3593
|
-
return
|
|
3807
|
+
return resolve9(import.meta.dir, "dev/client/hmrClient.ts");
|
|
3594
3808
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
3595
3809
|
const entryPoint = hmrClientPath2;
|
|
3596
3810
|
const result = await bunBuild({
|
|
@@ -3620,7 +3834,7 @@ var init_buildHMRClient = __esm(() => {
|
|
|
3620
3834
|
// src/build/nativeRewrite.ts
|
|
3621
3835
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
3622
3836
|
import { platform as platform2, arch as arch2 } from "os";
|
|
3623
|
-
import { resolve as
|
|
3837
|
+
import { resolve as resolve10 } from "path";
|
|
3624
3838
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
3625
3839
|
if (nativeLib !== null)
|
|
3626
3840
|
return nativeLib;
|
|
@@ -3638,7 +3852,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
3638
3852
|
if (!libPath)
|
|
3639
3853
|
return null;
|
|
3640
3854
|
try {
|
|
3641
|
-
const fullPath =
|
|
3855
|
+
const fullPath = resolve10(import.meta.dir, "../../native/packages", libPath);
|
|
3642
3856
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
3643
3857
|
nativeLib = lib.symbols;
|
|
3644
3858
|
return nativeLib;
|
|
@@ -3780,12 +3994,12 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
3780
3994
|
};
|
|
3781
3995
|
|
|
3782
3996
|
// src/build/angularLinkerPlugin.ts
|
|
3783
|
-
import { existsSync as
|
|
3784
|
-
import { dirname as dirname6, join as join10, relative as
|
|
3997
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
|
|
3998
|
+
import { dirname as dirname6, join as join10, relative as relative5, resolve as resolve11 } from "path";
|
|
3785
3999
|
import { createHash } from "crypto";
|
|
3786
4000
|
var CACHE_DIR, angularLinkerPlugin;
|
|
3787
4001
|
var init_angularLinkerPlugin = __esm(() => {
|
|
3788
|
-
CACHE_DIR =
|
|
4002
|
+
CACHE_DIR = resolve11(".absolutejs", "cache", "angular-linker");
|
|
3789
4003
|
angularLinkerPlugin = {
|
|
3790
4004
|
name: "angular-linker",
|
|
3791
4005
|
setup(bld) {
|
|
@@ -3805,9 +4019,9 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3805
4019
|
}
|
|
3806
4020
|
const hash = createHash("md5").update(source).digest("hex");
|
|
3807
4021
|
const cachePath = join10(CACHE_DIR, `${hash}.js`);
|
|
3808
|
-
if (
|
|
4022
|
+
if (existsSync13(cachePath)) {
|
|
3809
4023
|
return {
|
|
3810
|
-
contents:
|
|
4024
|
+
contents: readFileSync8(cachePath, "utf-8"),
|
|
3811
4025
|
loader: "js"
|
|
3812
4026
|
};
|
|
3813
4027
|
}
|
|
@@ -3822,10 +4036,10 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3822
4036
|
linkerPlugin = mod.createEs2015LinkerPlugin({
|
|
3823
4037
|
fileSystem: {
|
|
3824
4038
|
dirname: dirname6,
|
|
3825
|
-
exists:
|
|
3826
|
-
readFile:
|
|
3827
|
-
relative:
|
|
3828
|
-
resolve:
|
|
4039
|
+
exists: existsSync13,
|
|
4040
|
+
readFile: readFileSync8,
|
|
4041
|
+
relative: relative5,
|
|
4042
|
+
resolve: resolve11
|
|
3829
4043
|
},
|
|
3830
4044
|
linkerJitMode: false,
|
|
3831
4045
|
logger: {
|
|
@@ -3859,17 +4073,17 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3859
4073
|
|
|
3860
4074
|
// src/utils/cleanStaleOutputs.ts
|
|
3861
4075
|
import { rm as rm2 } from "fs/promises";
|
|
3862
|
-
import { resolve as
|
|
4076
|
+
import { resolve as resolve12 } from "path";
|
|
3863
4077
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
3864
4078
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
3865
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
4079
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve12(path)));
|
|
3866
4080
|
const glob = new Glob5("**/*");
|
|
3867
4081
|
const removals = [];
|
|
3868
|
-
for (const
|
|
3869
|
-
const absolute =
|
|
4082
|
+
for (const relative6 of glob.scanSync({ cwd: buildPath })) {
|
|
4083
|
+
const absolute = resolve12(buildPath, relative6);
|
|
3870
4084
|
if (currentPaths.has(absolute))
|
|
3871
4085
|
continue;
|
|
3872
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
4086
|
+
if (!HASHED_FILE_PATTERN.test(relative6))
|
|
3873
4087
|
continue;
|
|
3874
4088
|
removals.push(rm2(absolute, { force: true }));
|
|
3875
4089
|
}
|
|
@@ -3927,11 +4141,11 @@ var commonAncestor = (paths, fallback) => {
|
|
|
3927
4141
|
var init_commonAncestor = () => {};
|
|
3928
4142
|
|
|
3929
4143
|
// src/utils/validateSafePath.ts
|
|
3930
|
-
import { resolve as
|
|
4144
|
+
import { resolve as resolve13, relative as relative6 } from "path";
|
|
3931
4145
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
3932
|
-
const absoluteBase =
|
|
3933
|
-
const absoluteTarget =
|
|
3934
|
-
const relativePath = normalizePath(
|
|
4146
|
+
const absoluteBase = resolve13(baseDirectory);
|
|
4147
|
+
const absoluteTarget = resolve13(baseDirectory, targetPath);
|
|
4148
|
+
const relativePath = normalizePath(relative6(absoluteBase, absoluteTarget));
|
|
3935
4149
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
3936
4150
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
3937
4151
|
}
|
|
@@ -4077,29 +4291,29 @@ __export(exports_compileSvelte, {
|
|
|
4077
4291
|
compileSvelte: () => compileSvelte,
|
|
4078
4292
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
4079
4293
|
});
|
|
4080
|
-
import { existsSync as
|
|
4294
|
+
import { existsSync as existsSync14 } from "fs";
|
|
4081
4295
|
import { mkdir as mkdir2, stat } from "fs/promises";
|
|
4082
4296
|
import {
|
|
4083
4297
|
dirname as dirname7,
|
|
4084
4298
|
join as join12,
|
|
4085
4299
|
basename as basename4,
|
|
4086
4300
|
extname as extname5,
|
|
4087
|
-
resolve as
|
|
4088
|
-
relative as
|
|
4301
|
+
resolve as resolve14,
|
|
4302
|
+
relative as relative7,
|
|
4089
4303
|
sep as sep2
|
|
4090
4304
|
} from "path";
|
|
4091
4305
|
import { env } from "process";
|
|
4092
4306
|
var {write, file, Transpiler } = globalThis.Bun;
|
|
4093
4307
|
var resolveDevClientDir2 = () => {
|
|
4094
4308
|
const projectRoot = process.cwd();
|
|
4095
|
-
const fromSource =
|
|
4096
|
-
if (
|
|
4309
|
+
const fromSource = resolve14(import.meta.dir, "../dev/client");
|
|
4310
|
+
if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4097
4311
|
return fromSource;
|
|
4098
4312
|
}
|
|
4099
|
-
const fromNodeModules =
|
|
4100
|
-
if (
|
|
4313
|
+
const fromNodeModules = resolve14(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
4314
|
+
if (existsSync14(fromNodeModules))
|
|
4101
4315
|
return fromNodeModules;
|
|
4102
|
-
return
|
|
4316
|
+
return resolve14(import.meta.dir, "./dev/client");
|
|
4103
4317
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
4104
4318
|
persistentCache.clear();
|
|
4105
4319
|
sourceHashCache.clear();
|
|
@@ -4129,7 +4343,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4129
4343
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
4130
4344
|
if (!spec.startsWith("."))
|
|
4131
4345
|
return null;
|
|
4132
|
-
const basePath =
|
|
4346
|
+
const basePath = resolve14(dirname7(from), spec);
|
|
4133
4347
|
const candidates = [
|
|
4134
4348
|
basePath,
|
|
4135
4349
|
`${basePath}.ts`,
|
|
@@ -4156,7 +4370,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4156
4370
|
const resolved = resolvePackageImport(spec);
|
|
4157
4371
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
4158
4372
|
}
|
|
4159
|
-
const basePath =
|
|
4373
|
+
const basePath = resolve14(dirname7(from), spec);
|
|
4160
4374
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
4161
4375
|
if (!explicit) {
|
|
4162
4376
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -4177,13 +4391,13 @@ var resolveDevClientDir2 = () => {
|
|
|
4177
4391
|
return jsPath;
|
|
4178
4392
|
return null;
|
|
4179
4393
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
4180
|
-
const toServer =
|
|
4181
|
-
const toClient =
|
|
4394
|
+
const toServer = relative7(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
4395
|
+
const toClient = relative7(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
4182
4396
|
rewrites.set(rawSpec, {
|
|
4183
4397
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
4184
4398
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
4185
4399
|
});
|
|
4186
|
-
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false) => {
|
|
4400
|
+
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
|
|
4187
4401
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
4188
4402
|
const generatedDir = join12(svelteRoot, "generated");
|
|
4189
4403
|
const clientDir = join12(generatedDir, "client");
|
|
@@ -4211,13 +4425,13 @@ var resolveDevClientDir2 = () => {
|
|
|
4211
4425
|
const loweredServerSource = isModule ? loweredAwaitServerSource : lowerSvelteIslandSyntax(loweredAwaitServerSource.code, "server");
|
|
4212
4426
|
const loweredClientSource = isModule ? loweredAwaitClientSource : lowerSvelteIslandSyntax(loweredAwaitClientSource.code, "client");
|
|
4213
4427
|
const transformedByLowering = loweredAwaitServerSource.transformed || loweredAwaitClientSource.transformed || loweredServerSource.transformed || loweredClientSource.transformed;
|
|
4214
|
-
const svelteStylePreprocessor = createSvelteStylePreprocessor();
|
|
4428
|
+
const svelteStylePreprocessor = createSvelteStylePreprocessor(stylePreprocessors);
|
|
4215
4429
|
const preprocessedServer = isModule ? loweredServerSource.code : (await preprocess(loweredServerSource.code, svelteStylePreprocessor)).code;
|
|
4216
4430
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
4217
4431
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
4218
4432
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedClient) : preprocessedClient;
|
|
4219
|
-
const rawRel = dirname7(
|
|
4220
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
4433
|
+
const rawRel = dirname7(relative7(svelteRoot, src)).replace(/\\/g, "/");
|
|
4434
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative7(process.cwd(), dirname7(src)).replace(/\\/g, "/")}` : rawRel;
|
|
4221
4435
|
const baseName = basename4(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
4222
4436
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
4223
4437
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -4238,15 +4452,15 @@ var resolveDevClientDir2 = () => {
|
|
|
4238
4452
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
4239
4453
|
if (!resolved)
|
|
4240
4454
|
continue;
|
|
4241
|
-
const childRel =
|
|
4455
|
+
const childRel = relative7(svelteRoot, resolved).replace(/\\/g, "/");
|
|
4242
4456
|
if (!childRel.startsWith(".."))
|
|
4243
4457
|
continue;
|
|
4244
4458
|
const childBuilt2 = cache.get(resolved);
|
|
4245
4459
|
if (!childBuilt2)
|
|
4246
4460
|
continue;
|
|
4247
4461
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
4248
|
-
const toServer =
|
|
4249
|
-
const toClient =
|
|
4462
|
+
const toServer = relative7(ssrOutputDir, childBuilt2.ssr).replace(/\\/g, "/");
|
|
4463
|
+
const toClient = relative7(clientOutputDir, childBuilt2.client).replace(/\\/g, "/");
|
|
4250
4464
|
externalRewrites.set(origSpec, {
|
|
4251
4465
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
4252
4466
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -4281,7 +4495,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4281
4495
|
}).js.code;
|
|
4282
4496
|
let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
4283
4497
|
if (mode === "client" && isDev) {
|
|
4284
|
-
const moduleKey = `/@src/${
|
|
4498
|
+
const moduleKey = `/@src/${relative7(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
4285
4499
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
4286
4500
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
4287
4501
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -4324,10 +4538,10 @@ var resolveDevClientDir2 = () => {
|
|
|
4324
4538
|
};
|
|
4325
4539
|
const roots = await Promise.all(entryPoints.map(build));
|
|
4326
4540
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
4327
|
-
const relClientDir = dirname7(
|
|
4541
|
+
const relClientDir = dirname7(relative7(clientDir, client));
|
|
4328
4542
|
const name = basename4(client, extname5(client));
|
|
4329
4543
|
const indexPath = join12(indexDir, relClientDir, `${name}.js`);
|
|
4330
|
-
const importRaw =
|
|
4544
|
+
const importRaw = relative7(dirname7(indexPath), client).split(sep2).join("/");
|
|
4331
4545
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
4332
4546
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
4333
4547
|
import "${hmrClientPath3}";
|
|
@@ -4404,7 +4618,7 @@ if (typeof window !== "undefined") {
|
|
|
4404
4618
|
return {
|
|
4405
4619
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
4406
4620
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
4407
|
-
const rel = dirname7(
|
|
4621
|
+
const rel = dirname7(relative7(clientDir, client));
|
|
4408
4622
|
return join12(indexDir, rel, basename4(client));
|
|
4409
4623
|
}),
|
|
4410
4624
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -4434,20 +4648,20 @@ __export(exports_compileVue, {
|
|
|
4434
4648
|
compileVue: () => compileVue,
|
|
4435
4649
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
4436
4650
|
});
|
|
4437
|
-
import { existsSync as
|
|
4651
|
+
import { existsSync as existsSync15 } from "fs";
|
|
4438
4652
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
4439
|
-
import { basename as basename5, dirname as dirname8, join as join13, relative as
|
|
4653
|
+
import { basename as basename5, dirname as dirname8, join as join13, relative as relative8, resolve as resolve15 } from "path";
|
|
4440
4654
|
var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
4441
4655
|
var resolveDevClientDir3 = () => {
|
|
4442
4656
|
const projectRoot = process.cwd();
|
|
4443
|
-
const fromSource =
|
|
4444
|
-
if (
|
|
4657
|
+
const fromSource = resolve15(import.meta.dir, "../dev/client");
|
|
4658
|
+
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4445
4659
|
return fromSource;
|
|
4446
4660
|
}
|
|
4447
|
-
const fromNodeModules =
|
|
4448
|
-
if (
|
|
4661
|
+
const fromNodeModules = resolve15(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
4662
|
+
if (existsSync15(fromNodeModules))
|
|
4449
4663
|
return fromNodeModules;
|
|
4450
|
-
return
|
|
4664
|
+
return resolve15(import.meta.dir, "./dev/client");
|
|
4451
4665
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
4452
4666
|
scriptCache.clear();
|
|
4453
4667
|
scriptSetupCache.clear();
|
|
@@ -4486,7 +4700,7 @@ var resolveDevClientDir3 = () => {
|
|
|
4486
4700
|
return "template-only";
|
|
4487
4701
|
}
|
|
4488
4702
|
return "full";
|
|
4489
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
4703
|
+
}, 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) => {
|
|
4490
4704
|
if (filePath.endsWith(".vue"))
|
|
4491
4705
|
return filePath.replace(/\.vue$/, ".js");
|
|
4492
4706
|
if (filePath.endsWith(".ts"))
|
|
@@ -4509,11 +4723,11 @@ var resolveDevClientDir3 = () => {
|
|
|
4509
4723
|
].join(`
|
|
4510
4724
|
`) : nonVueLines.join(`
|
|
4511
4725
|
`);
|
|
4512
|
-
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler) => {
|
|
4726
|
+
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler, stylePreprocessors) => {
|
|
4513
4727
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
4514
4728
|
if (cachedResult)
|
|
4515
4729
|
return cachedResult;
|
|
4516
|
-
const relativeFilePath =
|
|
4730
|
+
const relativeFilePath = relative8(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
4517
4731
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
4518
4732
|
const fileBaseName = basename5(sourceFilePath, ".vue");
|
|
4519
4733
|
const componentId = toKebab(fileBaseName);
|
|
@@ -4547,8 +4761,8 @@ var resolveDevClientDir3 = () => {
|
|
|
4547
4761
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
4548
4762
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue"));
|
|
4549
4763
|
const childBuildResults = await Promise.all([
|
|
4550
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
4551
|
-
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler))
|
|
4764
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve15(dirname8(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
4765
|
+
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
4552
4766
|
]);
|
|
4553
4767
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
4554
4768
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
@@ -4583,7 +4797,7 @@ var resolveDevClientDir3 = () => {
|
|
|
4583
4797
|
filename: sourceFilePath,
|
|
4584
4798
|
id: componentId,
|
|
4585
4799
|
scoped: styleBlock.scoped,
|
|
4586
|
-
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang) : styleBlock.content,
|
|
4800
|
+
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang, stylePreprocessors) : styleBlock.content,
|
|
4587
4801
|
trim: true
|
|
4588
4802
|
}).code));
|
|
4589
4803
|
const allCss = [
|
|
@@ -4637,7 +4851,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4637
4851
|
let result2 = code;
|
|
4638
4852
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
4639
4853
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
4640
|
-
let rel =
|
|
4854
|
+
let rel = relative8(dirname8(outputPath), targetPath).replace(/\\/g, "/");
|
|
4641
4855
|
if (!rel.startsWith("."))
|
|
4642
4856
|
rel = `./${rel}`;
|
|
4643
4857
|
result2 = result2.replaceAll(bareImport, rel);
|
|
@@ -4655,14 +4869,14 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4655
4869
|
hmrId,
|
|
4656
4870
|
serverPath: serverOutputPath,
|
|
4657
4871
|
tsHelperPaths: [
|
|
4658
|
-
...helperModulePaths.map((helper) =>
|
|
4872
|
+
...helperModulePaths.map((helper) => resolve15(dirname8(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
4659
4873
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
4660
4874
|
]
|
|
4661
4875
|
};
|
|
4662
4876
|
cacheMap.set(sourceFilePath, result);
|
|
4663
4877
|
persistentBuildCache.set(sourceFilePath, result);
|
|
4664
4878
|
return result;
|
|
4665
|
-
}, compileVue = async (entryPoints, vueRootDir, isDev = false) => {
|
|
4879
|
+
}, compileVue = async (entryPoints, vueRootDir, isDev = false, stylePreprocessors) => {
|
|
4666
4880
|
const compiler = await import("@vue/compiler-sfc");
|
|
4667
4881
|
const generatedDir = join13(vueRootDir, "generated");
|
|
4668
4882
|
const clientOutputDir = join13(generatedDir, "client");
|
|
@@ -4678,15 +4892,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4678
4892
|
const buildCache = new Map;
|
|
4679
4893
|
const allTsHelperPaths = new Set;
|
|
4680
4894
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
4681
|
-
const result = await compileVueFile(
|
|
4895
|
+
const result = await compileVueFile(resolve15(entryPath), {
|
|
4682
4896
|
client: clientOutputDir,
|
|
4683
4897
|
css: cssOutputDir,
|
|
4684
4898
|
server: serverOutputDir
|
|
4685
|
-
}, buildCache, true, vueRootDir, compiler);
|
|
4899
|
+
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
4686
4900
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
4687
4901
|
const entryBaseName = basename5(entryPath, ".vue");
|
|
4688
4902
|
const indexOutputFile = join13(indexOutputDir, `${entryBaseName}.js`);
|
|
4689
|
-
const clientOutputFile = join13(clientOutputDir,
|
|
4903
|
+
const clientOutputFile = join13(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
4690
4904
|
await mkdir3(dirname8(indexOutputFile), { recursive: true });
|
|
4691
4905
|
const vueHmrImports = isDev ? [
|
|
4692
4906
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -4694,7 +4908,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4694
4908
|
] : [];
|
|
4695
4909
|
await write2(indexOutputFile, [
|
|
4696
4910
|
...vueHmrImports,
|
|
4697
|
-
`import Comp from "${
|
|
4911
|
+
`import Comp from "${relative8(dirname8(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
4698
4912
|
'import { createSSRApp, createApp } from "vue";',
|
|
4699
4913
|
"",
|
|
4700
4914
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -4814,7 +5028,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4814
5028
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
4815
5029
|
const sourceCode = await file2(tsPath).text();
|
|
4816
5030
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
4817
|
-
const relativeJsPath =
|
|
5031
|
+
const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
4818
5032
|
const outClientPath = join13(clientOutputDir, relativeJsPath);
|
|
4819
5033
|
const outServerPath = join13(serverOutputDir, relativeJsPath);
|
|
4820
5034
|
await mkdir3(dirname8(outClientPath), { recursive: true });
|
|
@@ -5315,27 +5529,27 @@ __export(exports_compileAngular, {
|
|
|
5315
5529
|
compileAngularFile: () => compileAngularFile,
|
|
5316
5530
|
compileAngular: () => compileAngular
|
|
5317
5531
|
});
|
|
5318
|
-
import { existsSync as
|
|
5319
|
-
import { join as join14, basename as basename6, sep as sep3, dirname as dirname9, resolve as
|
|
5532
|
+
import { existsSync as existsSync16, readFileSync as readFileSync9, promises as fs } from "fs";
|
|
5533
|
+
import { join as join14, basename as basename6, sep as sep3, dirname as dirname9, resolve as resolve16, relative as relative9 } from "path";
|
|
5320
5534
|
import ts2 from "typescript";
|
|
5321
5535
|
import { createHash as createHash2 } from "crypto";
|
|
5322
5536
|
var computeConfigHash = () => {
|
|
5323
5537
|
try {
|
|
5324
|
-
const content =
|
|
5538
|
+
const content = readFileSync9("./tsconfig.json", "utf-8");
|
|
5325
5539
|
return createHash2("md5").update(content).digest("hex");
|
|
5326
5540
|
} catch {
|
|
5327
5541
|
return "";
|
|
5328
5542
|
}
|
|
5329
5543
|
}, resolveDevClientDir4 = () => {
|
|
5330
5544
|
const projectRoot = process.cwd();
|
|
5331
|
-
const fromSource =
|
|
5332
|
-
if (
|
|
5545
|
+
const fromSource = resolve16(import.meta.dir, "../dev/client");
|
|
5546
|
+
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
5333
5547
|
return fromSource;
|
|
5334
5548
|
}
|
|
5335
|
-
const fromNodeModules =
|
|
5336
|
-
if (
|
|
5549
|
+
const fromNodeModules = resolve16(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
5550
|
+
if (existsSync16(fromNodeModules))
|
|
5337
5551
|
return fromNodeModules;
|
|
5338
|
-
return
|
|
5552
|
+
return resolve16(import.meta.dir, "./dev/client");
|
|
5339
5553
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
5340
5554
|
const componentClassRegex = /(?:export\s+)?class\s+(\w+Component)\s/g;
|
|
5341
5555
|
const componentNames = [];
|
|
@@ -5401,7 +5615,7 @@ ${registrations}
|
|
|
5401
5615
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
5402
5616
|
if (!isRelativeModuleSpecifier(specifier))
|
|
5403
5617
|
return null;
|
|
5404
|
-
const basePath =
|
|
5618
|
+
const basePath = resolve16(dirname9(fromFile), specifier);
|
|
5405
5619
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
5406
5620
|
`${basePath}.ts`,
|
|
5407
5621
|
`${basePath}.tsx`,
|
|
@@ -5412,24 +5626,24 @@ ${registrations}
|
|
|
5412
5626
|
join14(basePath, "index.mts"),
|
|
5413
5627
|
join14(basePath, "index.cts")
|
|
5414
5628
|
];
|
|
5415
|
-
return candidates.map((candidate) =>
|
|
5629
|
+
return candidates.map((candidate) => resolve16(candidate)).find((candidate) => existsSync16(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
5416
5630
|
}, readFileForAotTransform = async (fileName, readFile4) => {
|
|
5417
5631
|
const hostSource = readFile4?.(fileName);
|
|
5418
5632
|
if (typeof hostSource === "string")
|
|
5419
5633
|
return hostSource;
|
|
5420
5634
|
return fs.readFile(fileName, "utf-8");
|
|
5421
|
-
}, precomputeAotResourceTransforms = async (inputPath, readFile4) => {
|
|
5635
|
+
}, precomputeAotResourceTransforms = async (inputPath, readFile4, stylePreprocessors) => {
|
|
5422
5636
|
const transformedSources = new Map;
|
|
5423
5637
|
const visited = new Set;
|
|
5424
5638
|
const transformFile = async (filePath) => {
|
|
5425
|
-
const resolvedPath =
|
|
5639
|
+
const resolvedPath = resolve16(filePath);
|
|
5426
5640
|
if (visited.has(resolvedPath))
|
|
5427
5641
|
return;
|
|
5428
5642
|
visited.add(resolvedPath);
|
|
5429
|
-
if (!
|
|
5643
|
+
if (!existsSync16(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
5430
5644
|
return;
|
|
5431
5645
|
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
5432
|
-
const transformed = await inlineResources(source, dirname9(resolvedPath));
|
|
5646
|
+
const transformed = await inlineResources(source, dirname9(resolvedPath), stylePreprocessors);
|
|
5433
5647
|
transformedSources.set(resolvedPath, transformed.source);
|
|
5434
5648
|
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
5435
5649
|
await Promise.all(imports.map(async (specifier) => {
|
|
@@ -5440,8 +5654,8 @@ ${registrations}
|
|
|
5440
5654
|
};
|
|
5441
5655
|
await transformFile(inputPath);
|
|
5442
5656
|
return transformedSources;
|
|
5443
|
-
}, compileAngularFile = async (inputPath, outDir) => {
|
|
5444
|
-
const islandMetadataExports = buildIslandMetadataExports(
|
|
5657
|
+
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
5658
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync9(inputPath, "utf-8"));
|
|
5445
5659
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
5446
5660
|
const configHash = computeConfigHash();
|
|
5447
5661
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -5456,7 +5670,7 @@ ${registrations}
|
|
|
5456
5670
|
} else {
|
|
5457
5671
|
const tsPath = __require.resolve("typescript");
|
|
5458
5672
|
const tsRootDir = dirname9(tsPath);
|
|
5459
|
-
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir :
|
|
5673
|
+
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve16(tsRootDir, "lib");
|
|
5460
5674
|
const config = readConfiguration("./tsconfig.json");
|
|
5461
5675
|
options = {
|
|
5462
5676
|
emitDecoratorMetadata: true,
|
|
@@ -5503,13 +5717,13 @@ ${registrations}
|
|
|
5503
5717
|
};
|
|
5504
5718
|
}
|
|
5505
5719
|
const emitted = {};
|
|
5506
|
-
const resolvedOutDir =
|
|
5720
|
+
const resolvedOutDir = resolve16(outDir);
|
|
5507
5721
|
host.writeFile = (fileName, text) => {
|
|
5508
5722
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
5509
5723
|
emitted[relativePath] = text;
|
|
5510
5724
|
};
|
|
5511
5725
|
const originalReadFile = host.readFile;
|
|
5512
|
-
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host));
|
|
5726
|
+
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host), stylePreprocessors);
|
|
5513
5727
|
host.readFile = (fileName) => {
|
|
5514
5728
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
5515
5729
|
if (typeof source !== "string")
|
|
@@ -5517,7 +5731,7 @@ ${registrations}
|
|
|
5517
5731
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
5518
5732
|
return source;
|
|
5519
5733
|
}
|
|
5520
|
-
const resolvedPath =
|
|
5734
|
+
const resolvedPath = resolve16(fileName);
|
|
5521
5735
|
return aotTransformedSources.get(resolvedPath) ?? source;
|
|
5522
5736
|
};
|
|
5523
5737
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
@@ -5562,8 +5776,8 @@ ${registrations}
|
|
|
5562
5776
|
await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
|
|
5563
5777
|
return entries.map(({ target }) => target);
|
|
5564
5778
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
5565
|
-
const sourceEntry =
|
|
5566
|
-
if (
|
|
5779
|
+
const sourceEntry = resolve16(import.meta.dir, "../angular/components/index.ts");
|
|
5780
|
+
if (existsSync16(sourceEntry)) {
|
|
5567
5781
|
return sourceEntry.replace(/\\/g, "/");
|
|
5568
5782
|
}
|
|
5569
5783
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -5690,16 +5904,16 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
5690
5904
|
return rewritten.replace(/export(?:\s+default)?\s+class\s+([A-Za-z_$][\w$]*)\s*{/, (match) => `${match}
|
|
5691
5905
|
${fields}
|
|
5692
5906
|
`);
|
|
5693
|
-
}, readAndEscapeFile = async (filePath) => {
|
|
5694
|
-
if (!
|
|
5907
|
+
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
5908
|
+
if (!existsSync16(filePath))
|
|
5695
5909
|
return null;
|
|
5696
|
-
const content = await compileStyleFileIfNeeded(filePath);
|
|
5910
|
+
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
5697
5911
|
return escapeTemplateContent(content);
|
|
5698
5912
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
5699
5913
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5700
5914
|
if (templateUrlMatch?.[1]) {
|
|
5701
5915
|
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
5702
|
-
if (!
|
|
5916
|
+
if (!existsSync16(templatePath)) {
|
|
5703
5917
|
return { deferSlots: [], source };
|
|
5704
5918
|
}
|
|
5705
5919
|
const templateRaw2 = await fs.readFile(templatePath, "utf-8");
|
|
@@ -5730,10 +5944,10 @@ ${fields}
|
|
|
5730
5944
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5731
5945
|
if (templateUrlMatch?.[1]) {
|
|
5732
5946
|
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
5733
|
-
if (!
|
|
5947
|
+
if (!existsSync16(templatePath)) {
|
|
5734
5948
|
return { deferSlots: [], source };
|
|
5735
5949
|
}
|
|
5736
|
-
const templateRaw2 =
|
|
5950
|
+
const templateRaw2 = readFileSync9(templatePath, "utf-8");
|
|
5737
5951
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
5738
5952
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
5739
5953
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -5757,7 +5971,7 @@ ${fields}
|
|
|
5757
5971
|
deferSlots: lowered.slots,
|
|
5758
5972
|
source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
|
|
5759
5973
|
};
|
|
5760
|
-
}, inlineStyleUrls = async (source, fileDir) => {
|
|
5974
|
+
}, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
|
|
5761
5975
|
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
5762
5976
|
if (!styleUrlsMatch?.[1])
|
|
5763
5977
|
return source;
|
|
@@ -5766,35 +5980,35 @@ ${fields}
|
|
|
5766
5980
|
return source;
|
|
5767
5981
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
5768
5982
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
5769
|
-
return readAndEscapeFile(join14(fileDir, styleUrl));
|
|
5983
|
+
return readAndEscapeFile(join14(fileDir, styleUrl), stylePreprocessors);
|
|
5770
5984
|
});
|
|
5771
5985
|
const results = await Promise.all(stylePromises);
|
|
5772
5986
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
5773
5987
|
if (inlinedStyles.length === 0)
|
|
5774
5988
|
return source;
|
|
5775
5989
|
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
5776
|
-
}, inlineSingleStyleUrl = async (source, fileDir) => {
|
|
5990
|
+
}, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
|
|
5777
5991
|
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5778
5992
|
if (!styleUrlMatch?.[1])
|
|
5779
5993
|
return source;
|
|
5780
|
-
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]));
|
|
5994
|
+
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
5781
5995
|
if (!escaped)
|
|
5782
5996
|
return source;
|
|
5783
5997
|
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
5784
|
-
}, inlineResources = async (source, fileDir) => {
|
|
5998
|
+
}, inlineResources = async (source, fileDir, stylePreprocessors) => {
|
|
5785
5999
|
const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
|
|
5786
6000
|
let result = inlinedTemplate.source;
|
|
5787
|
-
result = await inlineStyleUrls(result, fileDir);
|
|
5788
|
-
result = await inlineSingleStyleUrl(result, fileDir);
|
|
6001
|
+
result = await inlineStyleUrls(result, fileDir, stylePreprocessors);
|
|
6002
|
+
result = await inlineSingleStyleUrl(result, fileDir, stylePreprocessors);
|
|
5789
6003
|
return {
|
|
5790
6004
|
deferSlots: inlinedTemplate.deferSlots,
|
|
5791
6005
|
source: result
|
|
5792
6006
|
};
|
|
5793
|
-
}, compileAngularFileJIT = async (inputPath, outDir, rootDir) => {
|
|
5794
|
-
const entryPath =
|
|
6007
|
+
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors) => {
|
|
6008
|
+
const entryPath = resolve16(inputPath);
|
|
5795
6009
|
const allOutputs = [];
|
|
5796
6010
|
const visited = new Set;
|
|
5797
|
-
const baseDir =
|
|
6011
|
+
const baseDir = resolve16(rootDir ?? process.cwd());
|
|
5798
6012
|
const angularTranspiler = new Bun.Transpiler({
|
|
5799
6013
|
loader: "ts",
|
|
5800
6014
|
tsconfig: JSON.stringify({
|
|
@@ -5831,23 +6045,23 @@ ${fields}
|
|
|
5831
6045
|
return `${prefix}${dots}`;
|
|
5832
6046
|
return `${prefix}../${dots}`;
|
|
5833
6047
|
});
|
|
5834
|
-
if (
|
|
6048
|
+
if (resolve16(actualPath) === entryPath) {
|
|
5835
6049
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
5836
6050
|
}
|
|
5837
6051
|
return processedContent;
|
|
5838
6052
|
};
|
|
5839
6053
|
const transpileFile = async (filePath) => {
|
|
5840
|
-
const resolved =
|
|
6054
|
+
const resolved = resolve16(filePath);
|
|
5841
6055
|
if (visited.has(resolved))
|
|
5842
6056
|
return;
|
|
5843
6057
|
visited.add(resolved);
|
|
5844
6058
|
let actualPath = resolved;
|
|
5845
6059
|
if (!actualPath.endsWith(".ts"))
|
|
5846
6060
|
actualPath += ".ts";
|
|
5847
|
-
if (!
|
|
6061
|
+
if (!existsSync16(actualPath))
|
|
5848
6062
|
return;
|
|
5849
6063
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
5850
|
-
const inlined = await inlineResources(sourceCode, dirname9(actualPath));
|
|
6064
|
+
const inlined = await inlineResources(sourceCode, dirname9(actualPath), stylePreprocessors);
|
|
5851
6065
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname9(actualPath)).source;
|
|
5852
6066
|
const inputDir = dirname9(actualPath);
|
|
5853
6067
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
@@ -5868,7 +6082,7 @@ ${fields}
|
|
|
5868
6082
|
}
|
|
5869
6083
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
5870
6084
|
const cacheKey2 = actualPath;
|
|
5871
|
-
if (jitContentCache.get(cacheKey2) === contentHash &&
|
|
6085
|
+
if (jitContentCache.get(cacheKey2) === contentHash && existsSync16(targetPath)) {
|
|
5872
6086
|
allOutputs.push(targetPath);
|
|
5873
6087
|
} else {
|
|
5874
6088
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath);
|
|
@@ -5879,13 +6093,13 @@ ${fields}
|
|
|
5879
6093
|
}
|
|
5880
6094
|
const inputDirForResolve = dirname9(actualPath);
|
|
5881
6095
|
await Promise.all(localImports.map((imp) => {
|
|
5882
|
-
const importPath =
|
|
6096
|
+
const importPath = resolve16(inputDirForResolve, imp);
|
|
5883
6097
|
return transpileFile(importPath);
|
|
5884
6098
|
}));
|
|
5885
6099
|
};
|
|
5886
6100
|
await transpileFile(inputPath);
|
|
5887
6101
|
return allOutputs;
|
|
5888
|
-
}, compileAngular = async (entryPoints, outRoot, hmr = false) => {
|
|
6102
|
+
}, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
|
|
5889
6103
|
const compiledParent = join14(outRoot, "generated");
|
|
5890
6104
|
if (entryPoints.length === 0) {
|
|
5891
6105
|
const emptyPaths = [];
|
|
@@ -5895,9 +6109,9 @@ ${fields}
|
|
|
5895
6109
|
const indexesDir = join14(compiledParent, "indexes");
|
|
5896
6110
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
5897
6111
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
5898
|
-
const resolvedEntry =
|
|
5899
|
-
const relativeEntry =
|
|
5900
|
-
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot) : compileAngularFile(resolvedEntry, compiledRoot);
|
|
6112
|
+
const resolvedEntry = resolve16(entry);
|
|
6113
|
+
const relativeEntry = relative9(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
6114
|
+
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
5901
6115
|
let outputs = await compileEntry();
|
|
5902
6116
|
const fileBase = basename6(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
5903
6117
|
const jsName = `${fileBase}.js`;
|
|
@@ -5905,18 +6119,18 @@ ${fields}
|
|
|
5905
6119
|
join14(compiledRoot, relativeEntry),
|
|
5906
6120
|
join14(compiledRoot, "pages", jsName),
|
|
5907
6121
|
join14(compiledRoot, jsName)
|
|
5908
|
-
].map((file3) =>
|
|
6122
|
+
].map((file3) => resolve16(file3));
|
|
5909
6123
|
const resolveRawServerFile = (candidatePaths) => {
|
|
5910
6124
|
const normalizedCandidates = [
|
|
5911
|
-
...candidatePaths.map((file3) =>
|
|
6125
|
+
...candidatePaths.map((file3) => resolve16(file3)),
|
|
5912
6126
|
...compiledFallbackPaths
|
|
5913
6127
|
];
|
|
5914
|
-
let candidate = normalizedCandidates.find((file3) =>
|
|
6128
|
+
let candidate = normalizedCandidates.find((file3) => existsSync16(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
5915
6129
|
if (!candidate) {
|
|
5916
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
6130
|
+
candidate = normalizedCandidates.find((file3) => existsSync16(file3) && file3.endsWith(`${sep3}${jsName}`));
|
|
5917
6131
|
}
|
|
5918
6132
|
if (!candidate) {
|
|
5919
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
6133
|
+
candidate = normalizedCandidates.find((file3) => existsSync16(file3));
|
|
5920
6134
|
}
|
|
5921
6135
|
return candidate;
|
|
5922
6136
|
};
|
|
@@ -5924,11 +6138,11 @@ ${fields}
|
|
|
5924
6138
|
if (!rawServerFile) {
|
|
5925
6139
|
rawServerFile = resolveRawServerFile([]);
|
|
5926
6140
|
}
|
|
5927
|
-
if (rawServerFile && !
|
|
6141
|
+
if (rawServerFile && !existsSync16(rawServerFile)) {
|
|
5928
6142
|
outputs = await compileEntry();
|
|
5929
6143
|
rawServerFile = resolveRawServerFile(outputs);
|
|
5930
6144
|
}
|
|
5931
|
-
if (!rawServerFile || !
|
|
6145
|
+
if (!rawServerFile || !existsSync16(rawServerFile)) {
|
|
5932
6146
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
5933
6147
|
...outputs,
|
|
5934
6148
|
...compiledFallbackPaths
|
|
@@ -5939,7 +6153,7 @@ ${fields}
|
|
|
5939
6153
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
5940
6154
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
5941
6155
|
const clientFile = join14(indexesDir, jsName);
|
|
5942
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
6156
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync16(clientFile)) {
|
|
5943
6157
|
return {
|
|
5944
6158
|
clientPath: clientFile,
|
|
5945
6159
|
indexUnchanged: true,
|
|
@@ -5973,7 +6187,7 @@ export default ${componentClassName};
|
|
|
5973
6187
|
await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
|
|
5974
6188
|
}
|
|
5975
6189
|
await fs.writeFile(rawServerFile, rewritten, "utf-8");
|
|
5976
|
-
const relativePath =
|
|
6190
|
+
const relativePath = relative9(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
5977
6191
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
5978
6192
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
5979
6193
|
import "${hmrRuntimePath}";
|
|
@@ -6138,25 +6352,25 @@ __export(exports_buildReactVendor, {
|
|
|
6138
6352
|
computeVendorPaths: () => computeVendorPaths,
|
|
6139
6353
|
buildReactVendor: () => buildReactVendor
|
|
6140
6354
|
});
|
|
6141
|
-
import { existsSync as
|
|
6142
|
-
import { join as join15, resolve as
|
|
6355
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync6 } from "fs";
|
|
6356
|
+
import { join as join15, resolve as resolve17 } from "path";
|
|
6143
6357
|
import { rm as rm4 } from "fs/promises";
|
|
6144
6358
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
6145
6359
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
6146
6360
|
const candidates = [
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6361
|
+
resolve17(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
6362
|
+
resolve17(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
6363
|
+
resolve17(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
6364
|
+
resolve17(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
6365
|
+
resolve17(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
6366
|
+
resolve17(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
6153
6367
|
];
|
|
6154
6368
|
for (const candidate of candidates) {
|
|
6155
|
-
if (
|
|
6369
|
+
if (existsSync17(candidate)) {
|
|
6156
6370
|
return candidate.replace(/\\/g, "/");
|
|
6157
6371
|
}
|
|
6158
6372
|
}
|
|
6159
|
-
return (candidates[0] ??
|
|
6373
|
+
return (candidates[0] ?? resolve17(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
6160
6374
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
6161
6375
|
try {
|
|
6162
6376
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -6328,11 +6542,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
6328
6542
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
6329
6543
|
return;
|
|
6330
6544
|
}
|
|
6331
|
-
const { readFileSync:
|
|
6545
|
+
const { readFileSync: readFileSync10, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
6332
6546
|
const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
6333
6547
|
for (const file3 of files) {
|
|
6334
6548
|
const filePath = join17(vendorDir, file3);
|
|
6335
|
-
const content =
|
|
6549
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
6336
6550
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
6337
6551
|
continue;
|
|
6338
6552
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -6455,14 +6669,14 @@ var init_rewriteImports = __esm(() => {
|
|
|
6455
6669
|
import {
|
|
6456
6670
|
copyFileSync,
|
|
6457
6671
|
cpSync,
|
|
6458
|
-
existsSync as
|
|
6672
|
+
existsSync as existsSync18,
|
|
6459
6673
|
mkdirSync as mkdirSync10,
|
|
6460
|
-
readFileSync as
|
|
6674
|
+
readFileSync as readFileSync10,
|
|
6461
6675
|
rmSync as rmSync2,
|
|
6462
6676
|
statSync,
|
|
6463
6677
|
writeFileSync as writeFileSync7
|
|
6464
6678
|
} from "fs";
|
|
6465
|
-
import { basename as basename7, dirname as dirname10, join as join19, relative as
|
|
6679
|
+
import { basename as basename7, dirname as dirname10, join as join19, relative as relative10, resolve as resolve18 } from "path";
|
|
6466
6680
|
import { cwd, env as env2, exit } from "process";
|
|
6467
6681
|
var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
|
|
6468
6682
|
var isDev, collectConventionSourceFiles = (entry) => {
|
|
@@ -6550,8 +6764,8 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6550
6764
|
}
|
|
6551
6765
|
}, resolveAbsoluteVersion = async () => {
|
|
6552
6766
|
const candidates = [
|
|
6553
|
-
|
|
6554
|
-
|
|
6767
|
+
resolve18(import.meta.dir, "..", "..", "package.json"),
|
|
6768
|
+
resolve18(import.meta.dir, "..", "package.json")
|
|
6555
6769
|
];
|
|
6556
6770
|
for (const candidate of candidates) {
|
|
6557
6771
|
const pkg = await tryReadPackageJson(candidate);
|
|
@@ -6563,7 +6777,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6563
6777
|
return;
|
|
6564
6778
|
}
|
|
6565
6779
|
}, SKIP_DIRS, addWorkerPathIfExists = (file3, relPath, workerPaths) => {
|
|
6566
|
-
const absPath =
|
|
6780
|
+
const absPath = resolve18(file3, "..", relPath);
|
|
6567
6781
|
try {
|
|
6568
6782
|
statSync(absPath);
|
|
6569
6783
|
workerPaths.add(absPath);
|
|
@@ -6578,7 +6792,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6578
6792
|
addWorkerPathIfExists(file3, relPath, workerPaths);
|
|
6579
6793
|
}
|
|
6580
6794
|
}, collectWorkerPathsFromFile = (file3, patterns, workerPaths) => {
|
|
6581
|
-
const content =
|
|
6795
|
+
const content = readFileSync10(file3, "utf-8");
|
|
6582
6796
|
for (const pattern of patterns) {
|
|
6583
6797
|
collectWorkerPathsFromContent(content, pattern, file3, workerPaths);
|
|
6584
6798
|
}
|
|
@@ -6623,39 +6837,39 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6623
6837
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
6624
6838
|
}
|
|
6625
6839
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
6626
|
-
if (!
|
|
6840
|
+
if (!existsSync18(reactIndexesPath)) {
|
|
6627
6841
|
return;
|
|
6628
6842
|
}
|
|
6629
6843
|
const indexFiles = readDir(reactIndexesPath).filter((file3) => file3.endsWith(".tsx"));
|
|
6630
|
-
const pagesRel =
|
|
6844
|
+
const pagesRel = relative10(process.cwd(), resolve18(reactPagesPath)).replace(/\\/g, "/");
|
|
6631
6845
|
for (const file3 of indexFiles) {
|
|
6632
|
-
let content =
|
|
6846
|
+
let content = readFileSync10(join19(reactIndexesPath, file3), "utf-8");
|
|
6633
6847
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
6634
6848
|
writeFileSync7(join19(devIndexDir, file3), content);
|
|
6635
6849
|
}
|
|
6636
6850
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
6637
6851
|
const svelteIndexDir = join19(svelteDir, "generated", "indexes");
|
|
6638
|
-
const sveltePageEntries = svelteEntries.filter((file3) =>
|
|
6852
|
+
const sveltePageEntries = svelteEntries.filter((file3) => resolve18(file3).startsWith(resolve18(sveltePagesPath)));
|
|
6639
6853
|
for (const entry of sveltePageEntries) {
|
|
6640
6854
|
const name = basename7(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
6641
6855
|
const indexFile = join19(svelteIndexDir, "pages", `${name}.js`);
|
|
6642
|
-
if (!
|
|
6856
|
+
if (!existsSync18(indexFile))
|
|
6643
6857
|
continue;
|
|
6644
|
-
let content =
|
|
6645
|
-
const srcRel =
|
|
6858
|
+
let content = readFileSync10(indexFile, "utf-8");
|
|
6859
|
+
const srcRel = relative10(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
6646
6860
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
6647
6861
|
writeFileSync7(join19(devIndexDir, `${name}.svelte.js`), content);
|
|
6648
6862
|
}
|
|
6649
6863
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
6650
6864
|
const vueIndexDir = join19(vueDir, "generated", "indexes");
|
|
6651
|
-
const vuePageEntries = vueEntries.filter((file3) =>
|
|
6865
|
+
const vuePageEntries = vueEntries.filter((file3) => resolve18(file3).startsWith(resolve18(vuePagesPath)));
|
|
6652
6866
|
for (const entry of vuePageEntries) {
|
|
6653
6867
|
const name = basename7(entry, ".vue");
|
|
6654
6868
|
const indexFile = join19(vueIndexDir, `${name}.js`);
|
|
6655
|
-
if (!
|
|
6869
|
+
if (!existsSync18(indexFile))
|
|
6656
6870
|
continue;
|
|
6657
|
-
let content =
|
|
6658
|
-
const srcRel =
|
|
6871
|
+
let content = readFileSync10(indexFile, "utf-8");
|
|
6872
|
+
const srcRel = relative10(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
6659
6873
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
6660
6874
|
writeFileSync7(join19(devIndexDir, `${name}.vue.js`), content);
|
|
6661
6875
|
}
|
|
@@ -6668,7 +6882,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6668
6882
|
const last = allComments[allComments.length - 1];
|
|
6669
6883
|
if (!last?.[1])
|
|
6670
6884
|
return JSON.stringify(outputPath);
|
|
6671
|
-
const srcPath =
|
|
6885
|
+
const srcPath = resolve18(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
6672
6886
|
return JSON.stringify(srcPath);
|
|
6673
6887
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
6674
6888
|
let depth = 0;
|
|
@@ -6705,7 +6919,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6705
6919
|
}
|
|
6706
6920
|
return result;
|
|
6707
6921
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
6708
|
-
let content =
|
|
6922
|
+
let content = readFileSync10(outputPath, "utf-8");
|
|
6709
6923
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
6710
6924
|
const useNames = [];
|
|
6711
6925
|
let match;
|
|
@@ -6730,7 +6944,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6730
6944
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
6731
6945
|
const urlFileMap = new Map;
|
|
6732
6946
|
for (const srcPath of urlReferencedFiles) {
|
|
6733
|
-
const rel =
|
|
6947
|
+
const rel = relative10(projectRoot, srcPath).replace(/\\/g, "/");
|
|
6734
6948
|
const name = basename7(srcPath);
|
|
6735
6949
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
6736
6950
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -6745,7 +6959,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6745
6959
|
const output = nonReactClientOutputs.find((artifact) => basename7(artifact.path).startsWith(`${srcBase}.`));
|
|
6746
6960
|
if (!output)
|
|
6747
6961
|
continue;
|
|
6748
|
-
urlFileMap.set(basename7(srcPath), `/${
|
|
6962
|
+
urlFileMap.set(basename7(srcPath), `/${relative10(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
6749
6963
|
}
|
|
6750
6964
|
return urlFileMap;
|
|
6751
6965
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -6755,7 +6969,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6755
6969
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
6756
6970
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
6757
6971
|
for (const outputPath of outputPaths) {
|
|
6758
|
-
let content =
|
|
6972
|
+
let content = readFileSync10(outputPath, "utf-8");
|
|
6759
6973
|
let changed = false;
|
|
6760
6974
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
6761
6975
|
const targetName = basename7(relPath);
|
|
@@ -6780,6 +6994,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6780
6994
|
svelteDirectory,
|
|
6781
6995
|
vueDirectory,
|
|
6782
6996
|
stylesConfig,
|
|
6997
|
+
stylePreprocessors,
|
|
6783
6998
|
tailwind,
|
|
6784
6999
|
options,
|
|
6785
7000
|
incrementalFiles,
|
|
@@ -6789,6 +7004,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6789
7004
|
const projectRoot = cwd();
|
|
6790
7005
|
await resolveAbsoluteVersion();
|
|
6791
7006
|
const isIncremental = incrementalFiles && incrementalFiles.length > 0;
|
|
7007
|
+
const stylePreprocessorPlugin2 = createStylePreprocessorPlugin(stylePreprocessors);
|
|
6792
7008
|
const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
|
|
6793
7009
|
const throwOnError = options?.throwOnError === true;
|
|
6794
7010
|
const hmr = options?.injectHMR === true;
|
|
@@ -6877,13 +7093,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6877
7093
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
6878
7094
|
if (!isIncremental || !incrementalFiles)
|
|
6879
7095
|
return entryPoints;
|
|
6880
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f) =>
|
|
7096
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f) => resolve18(f)));
|
|
6881
7097
|
const matchingEntries = [];
|
|
6882
7098
|
for (const entry of entryPoints) {
|
|
6883
7099
|
const sourceFile = mapToSource(entry);
|
|
6884
7100
|
if (!sourceFile)
|
|
6885
7101
|
continue;
|
|
6886
|
-
if (!normalizedIncremental.has(
|
|
7102
|
+
if (!normalizedIncremental.has(resolve18(sourceFile)))
|
|
6887
7103
|
continue;
|
|
6888
7104
|
matchingEntries.push(entry);
|
|
6889
7105
|
}
|
|
@@ -6952,7 +7168,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6952
7168
|
}
|
|
6953
7169
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || isStylePath(f)));
|
|
6954
7170
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
6955
|
-
if (entry.startsWith(
|
|
7171
|
+
if (entry.startsWith(resolve18(reactIndexesPath))) {
|
|
6956
7172
|
const pageName = basename7(entry, ".tsx");
|
|
6957
7173
|
return join19(reactPagesPath, `${pageName}.tsx`);
|
|
6958
7174
|
}
|
|
@@ -6984,28 +7200,28 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6984
7200
|
{ vueClientPaths: islandVueClientPaths },
|
|
6985
7201
|
{ clientPaths: islandAngularClientPaths }
|
|
6986
7202
|
] = await Promise.all([
|
|
6987
|
-
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr)) : {
|
|
7203
|
+
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
6988
7204
|
svelteClientPaths: [...emptyStringArray],
|
|
6989
7205
|
svelteIndexPaths: [...emptyStringArray],
|
|
6990
7206
|
svelteServerPaths: [...emptyStringArray]
|
|
6991
7207
|
},
|
|
6992
|
-
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr)) : {
|
|
7208
|
+
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr, stylePreprocessors)) : {
|
|
6993
7209
|
vueClientPaths: [...emptyStringArray],
|
|
6994
7210
|
vueCssPaths: [...emptyStringArray],
|
|
6995
7211
|
vueIndexPaths: [...emptyStringArray],
|
|
6996
7212
|
vueServerPaths: [...emptyStringArray]
|
|
6997
7213
|
},
|
|
6998
|
-
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr)) : {
|
|
7214
|
+
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr, stylePreprocessors)) : {
|
|
6999
7215
|
clientPaths: [...emptyStringArray],
|
|
7000
7216
|
serverPaths: [...emptyStringArray]
|
|
7001
7217
|
},
|
|
7002
|
-
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr)) : {
|
|
7218
|
+
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
7003
7219
|
svelteClientPaths: [...emptyStringArray]
|
|
7004
7220
|
},
|
|
7005
|
-
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr)) : {
|
|
7221
|
+
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr, stylePreprocessors)) : {
|
|
7006
7222
|
vueClientPaths: [...emptyStringArray]
|
|
7007
7223
|
},
|
|
7008
|
-
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr)) : {
|
|
7224
|
+
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr, stylePreprocessors)) : {
|
|
7009
7225
|
clientPaths: [...emptyStringArray]
|
|
7010
7226
|
}
|
|
7011
7227
|
]);
|
|
@@ -7015,7 +7231,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7015
7231
|
const clientPath = islandSvelteClientPaths[idx];
|
|
7016
7232
|
if (!sourcePath || !clientPath)
|
|
7017
7233
|
continue;
|
|
7018
|
-
islandSvelteClientPathMap.set(
|
|
7234
|
+
islandSvelteClientPathMap.set(resolve18(sourcePath), clientPath);
|
|
7019
7235
|
}
|
|
7020
7236
|
const islandVueClientPathMap = new Map;
|
|
7021
7237
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -7023,7 +7239,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7023
7239
|
const clientPath = islandVueClientPaths[idx];
|
|
7024
7240
|
if (!sourcePath || !clientPath)
|
|
7025
7241
|
continue;
|
|
7026
|
-
islandVueClientPathMap.set(
|
|
7242
|
+
islandVueClientPathMap.set(resolve18(sourcePath), clientPath);
|
|
7027
7243
|
}
|
|
7028
7244
|
const islandAngularClientPathMap = new Map;
|
|
7029
7245
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -7031,14 +7247,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7031
7247
|
const clientPath = islandAngularClientPaths[idx];
|
|
7032
7248
|
if (!sourcePath || !clientPath)
|
|
7033
7249
|
continue;
|
|
7034
|
-
islandAngularClientPathMap.set(
|
|
7250
|
+
islandAngularClientPathMap.set(resolve18(sourcePath), clientPath);
|
|
7035
7251
|
}
|
|
7036
7252
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
7037
7253
|
const vueConventionSources = collectConventionSourceFiles(conventionsMap.vue);
|
|
7038
7254
|
if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
|
|
7039
7255
|
const [svelteConvResult, vueConvResult] = await Promise.all([
|
|
7040
|
-
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false)) : { svelteServerPaths: emptyStringArray },
|
|
7041
|
-
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false)) : { vueServerPaths: emptyStringArray }
|
|
7256
|
+
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false, stylePreprocessors)) : { svelteServerPaths: emptyStringArray },
|
|
7257
|
+
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false, stylePreprocessors)) : { vueServerPaths: emptyStringArray }
|
|
7042
7258
|
]);
|
|
7043
7259
|
const copyConventionFiles = (framework, sources, compiledPaths) => {
|
|
7044
7260
|
const destDir = join19(buildPath, "conventions", framework);
|
|
@@ -7174,7 +7390,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7174
7390
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
7175
7391
|
outdir: buildPath,
|
|
7176
7392
|
...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
|
|
7177
|
-
plugins: [
|
|
7393
|
+
plugins: [stylePreprocessorPlugin2],
|
|
7178
7394
|
root: clientRoot,
|
|
7179
7395
|
splitting: true,
|
|
7180
7396
|
target: "browser",
|
|
@@ -7232,7 +7448,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7232
7448
|
format: "esm",
|
|
7233
7449
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
7234
7450
|
outdir: serverOutDir,
|
|
7235
|
-
plugins: [
|
|
7451
|
+
plugins: [stylePreprocessorPlugin2],
|
|
7236
7452
|
root: serverRoot,
|
|
7237
7453
|
target: "bun",
|
|
7238
7454
|
throw: false,
|
|
@@ -7248,7 +7464,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7248
7464
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
7249
7465
|
outdir: buildPath,
|
|
7250
7466
|
plugins: [
|
|
7251
|
-
|
|
7467
|
+
stylePreprocessorPlugin2,
|
|
7252
7468
|
...angularDir && !isDev ? [angularLinkerPlugin] : [],
|
|
7253
7469
|
...htmlScriptPlugin ? [htmlScriptPlugin] : []
|
|
7254
7470
|
],
|
|
@@ -7267,7 +7483,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7267
7483
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
7268
7484
|
outdir: buildPath,
|
|
7269
7485
|
plugins: [
|
|
7270
|
-
|
|
7486
|
+
stylePreprocessorPlugin2,
|
|
7271
7487
|
...angularDir && !isDev ? [angularLinkerPlugin] : []
|
|
7272
7488
|
],
|
|
7273
7489
|
root: islandEntryResult.generatedRoot,
|
|
@@ -7282,7 +7498,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7282
7498
|
outdir: stylesDir ? join19(buildPath, basename7(stylesDir)) : buildPath,
|
|
7283
7499
|
root: stylesDir || clientRoot,
|
|
7284
7500
|
target: "browser",
|
|
7285
|
-
plugins: [
|
|
7501
|
+
plugins: [stylePreprocessorPlugin2],
|
|
7286
7502
|
throw: false
|
|
7287
7503
|
}) : undefined,
|
|
7288
7504
|
vueCssPaths.length > 0 ? bunBuild6({
|
|
@@ -7410,7 +7626,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7410
7626
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
7411
7627
|
if (!hmrClientBundle)
|
|
7412
7628
|
return;
|
|
7413
|
-
let html =
|
|
7629
|
+
let html = readFileSync10(filePath, "utf-8");
|
|
7414
7630
|
if (html.includes("data-hmr-client"))
|
|
7415
7631
|
return;
|
|
7416
7632
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -7571,9 +7787,9 @@ var init_build = __esm(() => {
|
|
|
7571
7787
|
});
|
|
7572
7788
|
|
|
7573
7789
|
// src/dev/dependencyGraph.ts
|
|
7574
|
-
import { existsSync as
|
|
7790
|
+
import { existsSync as existsSync19, readFileSync as readFileSync11 } from "fs";
|
|
7575
7791
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
7576
|
-
import { resolve as
|
|
7792
|
+
import { resolve as resolve19 } from "path";
|
|
7577
7793
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
7578
7794
|
const lower = filePath.toLowerCase();
|
|
7579
7795
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -7583,12 +7799,12 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7583
7799
|
if (lower.endsWith(".html") || lower.endsWith(".htm"))
|
|
7584
7800
|
return "html";
|
|
7585
7801
|
return null;
|
|
7586
|
-
},
|
|
7802
|
+
}, resolveImportPath2 = (importPath, fromFile) => {
|
|
7587
7803
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
7588
7804
|
return null;
|
|
7589
7805
|
}
|
|
7590
|
-
const fromDir =
|
|
7591
|
-
const normalized =
|
|
7806
|
+
const fromDir = resolve19(fromFile, "..");
|
|
7807
|
+
const normalized = resolve19(fromDir, importPath);
|
|
7592
7808
|
const extensions = [
|
|
7593
7809
|
".ts",
|
|
7594
7810
|
".tsx",
|
|
@@ -7601,10 +7817,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7601
7817
|
];
|
|
7602
7818
|
for (const ext of extensions) {
|
|
7603
7819
|
const withExt = normalized + ext;
|
|
7604
|
-
if (
|
|
7820
|
+
if (existsSync19(withExt))
|
|
7605
7821
|
return withExt;
|
|
7606
7822
|
}
|
|
7607
|
-
if (
|
|
7823
|
+
if (existsSync19(normalized))
|
|
7608
7824
|
return normalized;
|
|
7609
7825
|
return null;
|
|
7610
7826
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -7618,8 +7834,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7618
7834
|
dependents.delete(normalizedPath);
|
|
7619
7835
|
}
|
|
7620
7836
|
}, addFileToGraph = (graph, filePath) => {
|
|
7621
|
-
const normalizedPath =
|
|
7622
|
-
if (!
|
|
7837
|
+
const normalizedPath = resolve19(filePath);
|
|
7838
|
+
if (!existsSync19(normalizedPath))
|
|
7623
7839
|
return;
|
|
7624
7840
|
const dependencies = extractDependencies(normalizedPath);
|
|
7625
7841
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -7635,10 +7851,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7635
7851
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
7636
7852
|
const processedFiles = new Set;
|
|
7637
7853
|
const glob = new Glob7("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
7638
|
-
const resolvedDirs = directories.map((dir) =>
|
|
7854
|
+
const resolvedDirs = directories.map((dir) => resolve19(dir)).filter((dir) => existsSync19(dir));
|
|
7639
7855
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
7640
7856
|
for (const file3 of allFiles) {
|
|
7641
|
-
const fullPath =
|
|
7857
|
+
const fullPath = resolve19(file3);
|
|
7642
7858
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
7643
7859
|
continue;
|
|
7644
7860
|
if (processedFiles.has(fullPath))
|
|
@@ -7654,7 +7870,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7654
7870
|
const [, href] = matchLink;
|
|
7655
7871
|
if (!href)
|
|
7656
7872
|
continue;
|
|
7657
|
-
const resolvedHref =
|
|
7873
|
+
const resolvedHref = resolveImportPath2(href, filePath);
|
|
7658
7874
|
if (resolvedHref)
|
|
7659
7875
|
dependencies.push(resolvedHref);
|
|
7660
7876
|
}
|
|
@@ -7664,7 +7880,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7664
7880
|
while ((match = regex.exec(content)) !== null) {
|
|
7665
7881
|
if (!match[1])
|
|
7666
7882
|
continue;
|
|
7667
|
-
const resolved =
|
|
7883
|
+
const resolved = resolveImportPath2(match[1], filePath);
|
|
7668
7884
|
if (resolved)
|
|
7669
7885
|
dependencies.push(resolved);
|
|
7670
7886
|
}
|
|
@@ -7674,7 +7890,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7674
7890
|
while ((urlMatch = stringLiteralRegex.exec(matchContent)) !== null) {
|
|
7675
7891
|
if (!urlMatch[1])
|
|
7676
7892
|
continue;
|
|
7677
|
-
const resolved =
|
|
7893
|
+
const resolved = resolveImportPath2(urlMatch[1], filePath);
|
|
7678
7894
|
if (resolved)
|
|
7679
7895
|
dependencies.push(resolved);
|
|
7680
7896
|
}
|
|
@@ -7697,7 +7913,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7697
7913
|
const imports = transpiler4.scanImports(content);
|
|
7698
7914
|
const dependencies = [];
|
|
7699
7915
|
for (const imp of imports) {
|
|
7700
|
-
const resolved =
|
|
7916
|
+
const resolved = resolveImportPath2(imp.path, filePath);
|
|
7701
7917
|
if (resolved)
|
|
7702
7918
|
dependencies.push(resolved);
|
|
7703
7919
|
}
|
|
@@ -7707,7 +7923,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7707
7923
|
return dependencies;
|
|
7708
7924
|
}, resolveScannedImports = (imports, filePath, dependencies) => {
|
|
7709
7925
|
for (const imp of imports) {
|
|
7710
|
-
const resolved =
|
|
7926
|
+
const resolved = resolveImportPath2(imp.path, filePath);
|
|
7711
7927
|
if (resolved)
|
|
7712
7928
|
dependencies.push(resolved);
|
|
7713
7929
|
}
|
|
@@ -7732,15 +7948,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7732
7948
|
const lowerPath = filePath.toLowerCase();
|
|
7733
7949
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
7734
7950
|
if (loader === "html") {
|
|
7735
|
-
const content =
|
|
7951
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
7736
7952
|
return extractHtmlDependencies(filePath, content);
|
|
7737
7953
|
}
|
|
7738
7954
|
if (loader === "tsx" || loader === "js") {
|
|
7739
|
-
const content =
|
|
7955
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
7740
7956
|
return extractJsDependencies(filePath, content, loader);
|
|
7741
7957
|
}
|
|
7742
7958
|
if (isSvelteOrVue) {
|
|
7743
|
-
const content =
|
|
7959
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
7744
7960
|
return extractSvelteVueDependencies(filePath, content);
|
|
7745
7961
|
}
|
|
7746
7962
|
return [];
|
|
@@ -7751,7 +7967,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7751
7967
|
return [];
|
|
7752
7968
|
}
|
|
7753
7969
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
7754
|
-
const normalizedPath =
|
|
7970
|
+
const normalizedPath = resolve19(changedFile);
|
|
7755
7971
|
const affected = new Set;
|
|
7756
7972
|
const toProcess = [normalizedPath];
|
|
7757
7973
|
const processNode = (current) => {
|
|
@@ -7791,7 +8007,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7791
8007
|
}
|
|
7792
8008
|
graph.dependents.delete(normalizedPath);
|
|
7793
8009
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
7794
|
-
const normalizedPath =
|
|
8010
|
+
const normalizedPath = resolve19(filePath);
|
|
7795
8011
|
removeDepsForFile(graph, normalizedPath);
|
|
7796
8012
|
removeDependentsForFile(graph, normalizedPath);
|
|
7797
8013
|
};
|
|
@@ -7834,12 +8050,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
7834
8050
|
};
|
|
7835
8051
|
|
|
7836
8052
|
// src/dev/configResolver.ts
|
|
7837
|
-
import { resolve as
|
|
8053
|
+
import { resolve as resolve20 } from "path";
|
|
7838
8054
|
var resolveBuildPaths = (config) => {
|
|
7839
8055
|
const cwd2 = process.cwd();
|
|
7840
8056
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
7841
|
-
const withDefault = (value, fallback) => normalize(
|
|
7842
|
-
const optional = (value) => value ? normalize(
|
|
8057
|
+
const withDefault = (value, fallback) => normalize(resolve20(cwd2, value ?? fallback));
|
|
8058
|
+
const optional = (value) => value ? normalize(resolve20(cwd2, value)) : undefined;
|
|
7843
8059
|
return {
|
|
7844
8060
|
angularDir: optional(config.angularDirectory),
|
|
7845
8061
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -8023,13 +8239,13 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
8023
8239
|
};
|
|
8024
8240
|
var init_pathUtils = __esm(() => {
|
|
8025
8241
|
init_commonAncestor();
|
|
8026
|
-
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less)$/i;
|
|
8242
|
+
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less|styl(?:us)?)$/i;
|
|
8027
8243
|
});
|
|
8028
8244
|
|
|
8029
8245
|
// src/dev/fileWatcher.ts
|
|
8030
8246
|
import { watch } from "fs";
|
|
8031
|
-
import { existsSync as
|
|
8032
|
-
import { join as join20, resolve as
|
|
8247
|
+
import { existsSync as existsSync20 } from "fs";
|
|
8248
|
+
import { join as join20, resolve as resolve21 } from "path";
|
|
8033
8249
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
8034
8250
|
try {
|
|
8035
8251
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -8060,12 +8276,12 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8060
8276
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
8061
8277
|
return;
|
|
8062
8278
|
}
|
|
8063
|
-
if (event === "rename" && !
|
|
8279
|
+
if (event === "rename" && !existsSync20(fullPath)) {
|
|
8064
8280
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
8065
8281
|
onFileChange(fullPath);
|
|
8066
8282
|
return;
|
|
8067
8283
|
}
|
|
8068
|
-
if (
|
|
8284
|
+
if (existsSync20(fullPath)) {
|
|
8069
8285
|
onFileChange(fullPath);
|
|
8070
8286
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
8071
8287
|
}
|
|
@@ -8074,8 +8290,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8074
8290
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
8075
8291
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8076
8292
|
paths.forEach((path) => {
|
|
8077
|
-
const absolutePath =
|
|
8078
|
-
if (!
|
|
8293
|
+
const absolutePath = resolve21(path).replace(/\\/g, "/");
|
|
8294
|
+
if (!existsSync20(absolutePath)) {
|
|
8079
8295
|
return;
|
|
8080
8296
|
}
|
|
8081
8297
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -8085,8 +8301,8 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8085
8301
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
8086
8302
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8087
8303
|
watchPaths.forEach((path) => {
|
|
8088
|
-
const absolutePath =
|
|
8089
|
-
if (!
|
|
8304
|
+
const absolutePath = resolve21(path).replace(/\\/g, "/");
|
|
8305
|
+
if (!existsSync20(absolutePath)) {
|
|
8090
8306
|
return;
|
|
8091
8307
|
}
|
|
8092
8308
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -8100,13 +8316,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
8100
8316
|
});
|
|
8101
8317
|
|
|
8102
8318
|
// src/dev/assetStore.ts
|
|
8103
|
-
import { resolve as
|
|
8319
|
+
import { resolve as resolve22 } from "path";
|
|
8104
8320
|
import { readdir as readdir3, unlink } from "fs/promises";
|
|
8105
8321
|
var mimeTypes, getMimeType = (filePath) => {
|
|
8106
8322
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
8107
8323
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
8108
8324
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
8109
|
-
const fullPath =
|
|
8325
|
+
const fullPath = resolve22(dir, entry.name);
|
|
8110
8326
|
if (entry.isDirectory()) {
|
|
8111
8327
|
return walkAndClean(fullPath);
|
|
8112
8328
|
}
|
|
@@ -8122,10 +8338,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8122
8338
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
8123
8339
|
const liveByIdentity = new Map;
|
|
8124
8340
|
for (const webPath of store.keys()) {
|
|
8125
|
-
const diskPath =
|
|
8341
|
+
const diskPath = resolve22(buildDir, webPath.slice(1));
|
|
8126
8342
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
8127
8343
|
}
|
|
8128
|
-
const absBuildDir =
|
|
8344
|
+
const absBuildDir = resolve22(buildDir);
|
|
8129
8345
|
Object.values(manifest).forEach((val) => {
|
|
8130
8346
|
if (!HASHED_FILE_RE.test(val))
|
|
8131
8347
|
return;
|
|
@@ -8143,7 +8359,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8143
8359
|
} catch {}
|
|
8144
8360
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
8145
8361
|
if (entry.isDirectory()) {
|
|
8146
|
-
return scanDir(
|
|
8362
|
+
return scanDir(resolve22(dir, entry.name), `${prefix}${entry.name}/`);
|
|
8147
8363
|
}
|
|
8148
8364
|
if (!entry.name.startsWith("chunk-")) {
|
|
8149
8365
|
return null;
|
|
@@ -8152,7 +8368,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8152
8368
|
if (store.has(webPath)) {
|
|
8153
8369
|
return null;
|
|
8154
8370
|
}
|
|
8155
|
-
return Bun.file(
|
|
8371
|
+
return Bun.file(resolve22(dir, entry.name)).bytes().then((bytes) => {
|
|
8156
8372
|
store.set(webPath, bytes);
|
|
8157
8373
|
return;
|
|
8158
8374
|
}).catch(() => {});
|
|
@@ -8177,7 +8393,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8177
8393
|
for (const webPath of newIdentities.values()) {
|
|
8178
8394
|
if (store.has(webPath))
|
|
8179
8395
|
continue;
|
|
8180
|
-
loadPromises.push(Bun.file(
|
|
8396
|
+
loadPromises.push(Bun.file(resolve22(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
8181
8397
|
store.set(webPath, bytes);
|
|
8182
8398
|
return;
|
|
8183
8399
|
}).catch(() => {}));
|
|
@@ -8207,8 +8423,8 @@ var init_assetStore = __esm(() => {
|
|
|
8207
8423
|
});
|
|
8208
8424
|
|
|
8209
8425
|
// src/islands/pageMetadata.ts
|
|
8210
|
-
import { readFileSync as
|
|
8211
|
-
import { dirname as dirname11, resolve as
|
|
8426
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
8427
|
+
import { dirname as dirname11, resolve as resolve23 } from "path";
|
|
8212
8428
|
var pagePatterns, getPageDirs = (config) => [
|
|
8213
8429
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
8214
8430
|
{ dir: config.reactDirectory, framework: "react" },
|
|
@@ -8227,15 +8443,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
8227
8443
|
const source = definition.buildReference?.source;
|
|
8228
8444
|
if (!source)
|
|
8229
8445
|
continue;
|
|
8230
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
8231
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
8446
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve23(dirname11(buildInfo.resolvedRegistryPath), source);
|
|
8447
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve23(resolvedSource));
|
|
8232
8448
|
}
|
|
8233
8449
|
return lookup;
|
|
8234
8450
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
|
|
8235
8451
|
const candidate = usage.source;
|
|
8236
|
-
return candidate ?
|
|
8452
|
+
return candidate ? resolve23(candidate) === target : false;
|
|
8237
8453
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
8238
|
-
const target =
|
|
8454
|
+
const target = resolve23(sourcePath);
|
|
8239
8455
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
8240
8456
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
8241
8457
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -8247,13 +8463,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
8247
8463
|
const pattern = pagePatterns[entry.framework];
|
|
8248
8464
|
if (!pattern)
|
|
8249
8465
|
return;
|
|
8250
|
-
const files = await scanEntryPoints(
|
|
8466
|
+
const files = await scanEntryPoints(resolve23(entry.dir), pattern);
|
|
8251
8467
|
for (const filePath of files) {
|
|
8252
|
-
const source =
|
|
8468
|
+
const source = readFileSync12(filePath, "utf-8");
|
|
8253
8469
|
const islands = extractIslandUsagesFromSource(source);
|
|
8254
|
-
pageMetadata.set(
|
|
8470
|
+
pageMetadata.set(resolve23(filePath), {
|
|
8255
8471
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
8256
|
-
pagePath:
|
|
8472
|
+
pagePath: resolve23(filePath)
|
|
8257
8473
|
});
|
|
8258
8474
|
}
|
|
8259
8475
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -8279,10 +8495,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
8279
8495
|
});
|
|
8280
8496
|
|
|
8281
8497
|
// src/dev/fileHashTracker.ts
|
|
8282
|
-
import { readFileSync as
|
|
8498
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
8283
8499
|
var computeFileHash = (filePath) => {
|
|
8284
8500
|
try {
|
|
8285
|
-
const fileContent =
|
|
8501
|
+
const fileContent = readFileSync13(filePath);
|
|
8286
8502
|
return Number(Bun.hash(fileContent));
|
|
8287
8503
|
} catch {
|
|
8288
8504
|
return UNFOUND_INDEX;
|
|
@@ -8300,9 +8516,9 @@ var init_fileHashTracker = __esm(() => {
|
|
|
8300
8516
|
});
|
|
8301
8517
|
|
|
8302
8518
|
// src/dev/reactComponentClassifier.ts
|
|
8303
|
-
import { resolve as
|
|
8519
|
+
import { resolve as resolve24 } from "path";
|
|
8304
8520
|
var classifyComponent = (filePath) => {
|
|
8305
|
-
const normalizedPath =
|
|
8521
|
+
const normalizedPath = resolve24(filePath);
|
|
8306
8522
|
if (normalizedPath.includes("/react/pages/")) {
|
|
8307
8523
|
return "server";
|
|
8308
8524
|
}
|
|
@@ -8314,7 +8530,7 @@ var classifyComponent = (filePath) => {
|
|
|
8314
8530
|
var init_reactComponentClassifier = () => {};
|
|
8315
8531
|
|
|
8316
8532
|
// src/dev/moduleMapper.ts
|
|
8317
|
-
import { basename as basename8, resolve as
|
|
8533
|
+
import { basename as basename8, resolve as resolve25 } from "path";
|
|
8318
8534
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
8319
8535
|
const modulePaths = {};
|
|
8320
8536
|
moduleKeys.forEach((key) => {
|
|
@@ -8324,7 +8540,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
8324
8540
|
});
|
|
8325
8541
|
return modulePaths;
|
|
8326
8542
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
8327
|
-
const normalizedFile =
|
|
8543
|
+
const normalizedFile = resolve25(sourceFile);
|
|
8328
8544
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
8329
8545
|
if (processedFiles.has(normalizedFile)) {
|
|
8330
8546
|
return null;
|
|
@@ -8360,7 +8576,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
8360
8576
|
});
|
|
8361
8577
|
return grouped;
|
|
8362
8578
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
8363
|
-
const normalizedFile =
|
|
8579
|
+
const normalizedFile = resolve25(sourceFile);
|
|
8364
8580
|
const fileName = basename8(normalizedFile);
|
|
8365
8581
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
8366
8582
|
const pascalName = toPascal(baseName);
|
|
@@ -9300,19 +9516,19 @@ var init_streamingSlotWarningScope = __esm(() => {
|
|
|
9300
9516
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
9301
9517
|
import { mkdir as mkdir4, symlink } from "fs/promises";
|
|
9302
9518
|
import { tmpdir } from "os";
|
|
9303
|
-
import { basename as basename10, dirname as dirname12, join as join21, resolve as
|
|
9519
|
+
import { basename as basename10, dirname as dirname12, join as join21, resolve as resolve26 } from "path";
|
|
9304
9520
|
var ssrDirty = false, lastSelector = "angular-page", isRecord7 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
|
|
9305
9521
|
if (!compilerImportPromise) {
|
|
9306
9522
|
compilerImportPromise = import("@angular/compiler");
|
|
9307
9523
|
}
|
|
9308
9524
|
return compilerImportPromise;
|
|
9309
9525
|
}, readAngularPageModule = (value) => isRecord7(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join21(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
|
|
9310
|
-
const outRoot =
|
|
9526
|
+
const outRoot = resolve26(dirname12(dirname12(outDir)));
|
|
9311
9527
|
const nodeModulesLink = join21(outRoot, "node_modules");
|
|
9312
9528
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
9313
9529
|
return;
|
|
9314
9530
|
}
|
|
9315
|
-
if (nodeModulesLink ===
|
|
9531
|
+
if (nodeModulesLink === resolve26(process.cwd(), "node_modules")) {
|
|
9316
9532
|
return;
|
|
9317
9533
|
}
|
|
9318
9534
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
@@ -9320,7 +9536,7 @@ var ssrDirty = false, lastSelector = "angular-page", isRecord7 = (value) => type
|
|
|
9320
9536
|
}
|
|
9321
9537
|
await mkdir4(outRoot, { recursive: true });
|
|
9322
9538
|
try {
|
|
9323
|
-
await symlink(
|
|
9539
|
+
await symlink(resolve26(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
9324
9540
|
} catch (error) {
|
|
9325
9541
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
9326
9542
|
throw error;
|
|
@@ -9839,8 +10055,8 @@ __export(exports_moduleServer, {
|
|
|
9839
10055
|
createModuleServer: () => createModuleServer,
|
|
9840
10056
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
9841
10057
|
});
|
|
9842
|
-
import { existsSync as
|
|
9843
|
-
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as
|
|
10058
|
+
import { existsSync as existsSync21, readFileSync as readFileSync14, statSync as statSync2 } from "fs";
|
|
10059
|
+
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve27, relative as relative11 } from "path";
|
|
9844
10060
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
9845
10061
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
9846
10062
|
const allExports = [];
|
|
@@ -9860,7 +10076,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
9860
10076
|
${stubs}
|
|
9861
10077
|
`;
|
|
9862
10078
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
9863
|
-
const found = extensions.find((ext) =>
|
|
10079
|
+
const found = extensions.find((ext) => existsSync21(resolve27(projectRoot, srcPath + ext)));
|
|
9864
10080
|
return found ? srcPath + found : srcPath;
|
|
9865
10081
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
9866
10082
|
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
@@ -9875,7 +10091,7 @@ ${stubs}
|
|
|
9875
10091
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
9876
10092
|
}, srcUrl = (relPath, projectRoot) => {
|
|
9877
10093
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
9878
|
-
const absPath =
|
|
10094
|
+
const absPath = resolve27(projectRoot, relPath);
|
|
9879
10095
|
const cached = mtimeCache.get(absPath);
|
|
9880
10096
|
if (cached !== undefined)
|
|
9881
10097
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -9887,18 +10103,18 @@ ${stubs}
|
|
|
9887
10103
|
return base;
|
|
9888
10104
|
}
|
|
9889
10105
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
9890
|
-
const absPath =
|
|
9891
|
-
const rel =
|
|
10106
|
+
const absPath = resolve27(fileDir, relPath);
|
|
10107
|
+
const rel = relative11(projectRoot, absPath);
|
|
9892
10108
|
const extension = extname6(rel);
|
|
9893
10109
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
9894
10110
|
if (extname6(srcPath) === ".svelte") {
|
|
9895
|
-
srcPath =
|
|
10111
|
+
srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve27(projectRoot, srcPath)));
|
|
9896
10112
|
}
|
|
9897
10113
|
return srcUrl(srcPath, projectRoot);
|
|
9898
10114
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
9899
10115
|
try {
|
|
9900
10116
|
const target = resolvePackageImport(specifier, ["browser", "import"]) ?? Bun.resolveSync(specifier, projectRoot);
|
|
9901
|
-
return
|
|
10117
|
+
return relative11(projectRoot, target);
|
|
9902
10118
|
} catch {
|
|
9903
10119
|
return;
|
|
9904
10120
|
}
|
|
@@ -9931,20 +10147,20 @@ ${stubs}
|
|
|
9931
10147
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
9932
10148
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
9933
10149
|
if (absPath.startsWith(projectRoot)) {
|
|
9934
|
-
const rel2 =
|
|
10150
|
+
const rel2 = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
9935
10151
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
9936
10152
|
}
|
|
9937
|
-
const rel =
|
|
10153
|
+
const rel = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
9938
10154
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
9939
10155
|
});
|
|
9940
10156
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
9941
|
-
const absPath =
|
|
9942
|
-
const rel =
|
|
10157
|
+
const absPath = resolve27(fileDir, relPath);
|
|
10158
|
+
const rel = relative11(projectRoot, absPath);
|
|
9943
10159
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
9944
10160
|
});
|
|
9945
10161
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
9946
|
-
const absPath =
|
|
9947
|
-
const rel =
|
|
10162
|
+
const absPath = resolve27(fileDir, relPath);
|
|
10163
|
+
const rel = relative11(projectRoot, absPath);
|
|
9948
10164
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
9949
10165
|
});
|
|
9950
10166
|
return result;
|
|
@@ -9972,7 +10188,7 @@ ${stubs}
|
|
|
9972
10188
|
`)}
|
|
9973
10189
|
${code}`;
|
|
9974
10190
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
9975
|
-
const raw =
|
|
10191
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
9976
10192
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
9977
10193
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
9978
10194
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -9983,12 +10199,12 @@ ${code}`;
|
|
|
9983
10199
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
9984
10200
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
9985
10201
|
${transpiled}`;
|
|
9986
|
-
const relPath =
|
|
10202
|
+
const relPath = relative11(projectRoot, filePath).replace(/\\/g, "/");
|
|
9987
10203
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
9988
10204
|
transpiled += buildIslandMetadataExports(raw);
|
|
9989
10205
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
9990
10206
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
9991
|
-
const raw =
|
|
10207
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
9992
10208
|
const ext = extname6(filePath);
|
|
9993
10209
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
9994
10210
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -10134,24 +10350,24 @@ ${code}`;
|
|
|
10134
10350
|
if (compiled.css?.code) {
|
|
10135
10351
|
const cssPath = `${filePath}.css`;
|
|
10136
10352
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
10137
|
-
const cssUrl = srcUrl(
|
|
10353
|
+
const cssUrl = srcUrl(relative11(projectRoot, cssPath), projectRoot);
|
|
10138
10354
|
code = `import "${cssUrl}";
|
|
10139
10355
|
${code}`;
|
|
10140
10356
|
}
|
|
10141
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
10357
|
+
const moduleUrl = `${SRC_PREFIX}${relative11(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
10142
10358
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
10143
10359
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10144
10360
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
10145
10361
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
10146
|
-
}, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
|
|
10147
|
-
const raw =
|
|
10362
|
+
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10363
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10148
10364
|
if (!svelteCompiler) {
|
|
10149
10365
|
svelteCompiler = await import("svelte/compiler");
|
|
10150
10366
|
}
|
|
10151
10367
|
const isModule = filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
10152
10368
|
const loweredAwaitSource = isModule ? { code: raw, transformed: false } : lowerSvelteAwaitSlotSyntax(raw);
|
|
10153
10369
|
const loweredSource = isModule ? loweredAwaitSource : lowerSvelteIslandSyntax(loweredAwaitSource.code, "client");
|
|
10154
|
-
const source = loweredSource.code;
|
|
10370
|
+
const source = isModule ? loweredSource.code : (await svelteCompiler.preprocess(loweredSource.code, createSvelteStylePreprocessor(stylePreprocessors))).code;
|
|
10155
10371
|
const enableAsync = loweredAwaitSource.transformed || loweredSource.transformed;
|
|
10156
10372
|
const code = isModule ? compileSvelteModule(source, filePath) : compileSvelteComponent(source, filePath, projectRoot, enableAsync);
|
|
10157
10373
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
@@ -10178,16 +10394,16 @@ __script__.render = render;`;
|
|
|
10178
10394
|
code += `
|
|
10179
10395
|
export default __script__;`;
|
|
10180
10396
|
return code;
|
|
10181
|
-
}, compileVueStyles = (descriptor, filePath, componentId, code) => {
|
|
10397
|
+
}, compileVueStyles = async (descriptor, filePath, componentId, code, stylePreprocessors) => {
|
|
10182
10398
|
if (descriptor.styles.length === 0)
|
|
10183
10399
|
return code;
|
|
10184
|
-
const cssCode = descriptor.styles.map((style) => vueCompiler.compileStyle({
|
|
10400
|
+
const cssCode = (await Promise.all(descriptor.styles.map(async (style) => vueCompiler.compileStyle({
|
|
10185
10401
|
filename: filePath,
|
|
10186
10402
|
id: `data-v-${componentId}`,
|
|
10187
10403
|
scoped: style.scoped,
|
|
10188
|
-
source: style.content,
|
|
10404
|
+
source: style.lang ? await compileStyleSource(filePath, style.content, style.lang, stylePreprocessors) : style.content,
|
|
10189
10405
|
trim: true
|
|
10190
|
-
}).code).join(`
|
|
10406
|
+
}).code))).join(`
|
|
10191
10407
|
`);
|
|
10192
10408
|
const escaped = cssCode.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10193
10409
|
const hmrId = JSON.stringify(filePath);
|
|
@@ -10201,8 +10417,8 @@ export default __script__;`;
|
|
|
10201
10417
|
].join("");
|
|
10202
10418
|
return `${cssInjection}
|
|
10203
10419
|
${code}`;
|
|
10204
|
-
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10205
|
-
const raw =
|
|
10420
|
+
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10421
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10206
10422
|
if (!vueCompiler) {
|
|
10207
10423
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
10208
10424
|
}
|
|
@@ -10214,13 +10430,13 @@ ${code}`;
|
|
|
10214
10430
|
inlineTemplate: false
|
|
10215
10431
|
});
|
|
10216
10432
|
let code = compileVueTemplate(descriptor, compiledScript, filePath, componentId);
|
|
10217
|
-
code = compileVueStyles(descriptor, filePath, componentId, code);
|
|
10433
|
+
code = await compileVueStyles(descriptor, filePath, componentId, code, stylePreprocessors);
|
|
10218
10434
|
code = tsTranspiler2.transformSync(code);
|
|
10219
10435
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
10220
10436
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
10221
10437
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
10222
|
-
const hmrBase = vueDir ?
|
|
10223
|
-
const hmrId =
|
|
10438
|
+
const hmrBase = vueDir ? resolve27(vueDir) : projectRoot;
|
|
10439
|
+
const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
10224
10440
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
10225
10441
|
result += [
|
|
10226
10442
|
"",
|
|
@@ -10234,11 +10450,11 @@ ${code}`;
|
|
|
10234
10450
|
`);
|
|
10235
10451
|
return result;
|
|
10236
10452
|
}, resolveSvelteModulePath = (path) => {
|
|
10237
|
-
if (
|
|
10453
|
+
if (existsSync21(path))
|
|
10238
10454
|
return path;
|
|
10239
|
-
if (
|
|
10455
|
+
if (existsSync21(`${path}.ts`))
|
|
10240
10456
|
return `${path}.ts`;
|
|
10241
|
-
if (
|
|
10457
|
+
if (existsSync21(`${path}.js`))
|
|
10242
10458
|
return `${path}.js`;
|
|
10243
10459
|
return path;
|
|
10244
10460
|
}, jsResponse = (body) => {
|
|
@@ -10251,7 +10467,7 @@ ${code}`;
|
|
|
10251
10467
|
}
|
|
10252
10468
|
});
|
|
10253
10469
|
}, handleCssRequest = (filePath) => {
|
|
10254
|
-
const raw =
|
|
10470
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10255
10471
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10256
10472
|
return [
|
|
10257
10473
|
`const style = document.createElement('style');`,
|
|
@@ -10378,20 +10594,20 @@ export default {};
|
|
|
10378
10594
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10379
10595
|
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);`);
|
|
10380
10596
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
10381
|
-
const filePath =
|
|
10597
|
+
const filePath = resolve27(projectRoot, relPath);
|
|
10382
10598
|
const ext = extname6(filePath);
|
|
10383
10599
|
if (ext === ".svelte")
|
|
10384
10600
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
10385
10601
|
if (ext)
|
|
10386
10602
|
return { ext, filePath };
|
|
10387
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
10603
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync21(filePath + candidate));
|
|
10388
10604
|
if (!found)
|
|
10389
10605
|
return { ext, filePath };
|
|
10390
10606
|
const resolved = filePath + found;
|
|
10391
10607
|
if (found === ".svelte")
|
|
10392
10608
|
return { ext: found, filePath: resolveSvelteModulePath(resolved) };
|
|
10393
10609
|
return { ext: found, filePath: resolved };
|
|
10394
|
-
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir) => {
|
|
10610
|
+
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10395
10611
|
if (ext === ".css")
|
|
10396
10612
|
return jsResponse(handleCssRequest(filePath));
|
|
10397
10613
|
const isSvelte = ext === ".svelte" || filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
@@ -10399,24 +10615,24 @@ export default {};
|
|
|
10399
10615
|
if (cached)
|
|
10400
10616
|
return jsResponse(cached);
|
|
10401
10617
|
if (isSvelte)
|
|
10402
|
-
return transformAndCacheSvelte(filePath, projectRoot, rewriter);
|
|
10618
|
+
return transformAndCacheSvelte(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10403
10619
|
if (ext === ".vue")
|
|
10404
|
-
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir);
|
|
10620
|
+
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10405
10621
|
if (!TRANSPILABLE.has(ext))
|
|
10406
10622
|
return;
|
|
10407
10623
|
const stat2 = statSync2(filePath);
|
|
10408
|
-
const resolvedVueDir = vueDir ?
|
|
10624
|
+
const resolvedVueDir = vueDir ? resolve27(vueDir) : undefined;
|
|
10409
10625
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
10410
10626
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10411
10627
|
return jsResponse(content);
|
|
10412
|
-
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter) => {
|
|
10628
|
+
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10413
10629
|
const stat2 = statSync2(filePath);
|
|
10414
|
-
const content = await transformSvelteFile(filePath, projectRoot, rewriter);
|
|
10630
|
+
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10415
10631
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10416
10632
|
return jsResponse(content);
|
|
10417
|
-
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10633
|
+
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10418
10634
|
const stat2 = statSync2(filePath);
|
|
10419
|
-
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir);
|
|
10635
|
+
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10420
10636
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10421
10637
|
return jsResponse(content);
|
|
10422
10638
|
}, transformErrorResponse = (err) => {
|
|
@@ -10426,7 +10642,7 @@ export default {};
|
|
|
10426
10642
|
status: 500
|
|
10427
10643
|
});
|
|
10428
10644
|
}, createModuleServer = (config) => {
|
|
10429
|
-
const { projectRoot, vendorPaths, frameworkDirs } = config;
|
|
10645
|
+
const { projectRoot, vendorPaths, frameworkDirs, stylePreprocessors } = config;
|
|
10430
10646
|
const rewriter = buildImportRewriter(vendorPaths);
|
|
10431
10647
|
return async (pathname) => {
|
|
10432
10648
|
if (pathname.startsWith("/@stub/"))
|
|
@@ -10436,12 +10652,12 @@ export default {};
|
|
|
10436
10652
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
10437
10653
|
return;
|
|
10438
10654
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
10439
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
10655
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve27(projectRoot, relPath));
|
|
10440
10656
|
if (virtualCssResponse)
|
|
10441
10657
|
return virtualCssResponse;
|
|
10442
10658
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
10443
10659
|
try {
|
|
10444
|
-
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue);
|
|
10660
|
+
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue, stylePreprocessors);
|
|
10445
10661
|
} catch (err) {
|
|
10446
10662
|
return transformErrorResponse(err);
|
|
10447
10663
|
}
|
|
@@ -10452,11 +10668,11 @@ export default {};
|
|
|
10452
10668
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
10453
10669
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
10454
10670
|
if (match[1])
|
|
10455
|
-
files.push(
|
|
10671
|
+
files.push(resolve27(projectRoot, match[1]));
|
|
10456
10672
|
}
|
|
10457
10673
|
return files;
|
|
10458
10674
|
}, invalidateModule = (filePath) => {
|
|
10459
|
-
const resolved =
|
|
10675
|
+
const resolved = resolve27(filePath);
|
|
10460
10676
|
invalidate(filePath);
|
|
10461
10677
|
if (resolved !== filePath)
|
|
10462
10678
|
invalidate(resolved);
|
|
@@ -10475,6 +10691,7 @@ var init_moduleServer = __esm(() => {
|
|
|
10475
10691
|
init_constants();
|
|
10476
10692
|
init_resolvePackageImport();
|
|
10477
10693
|
init_sourceMetadata();
|
|
10694
|
+
init_stylePreprocessor();
|
|
10478
10695
|
init_lowerAwaitSlotSyntax();
|
|
10479
10696
|
init_lowerIslandSyntax();
|
|
10480
10697
|
init_transformCache();
|
|
@@ -10532,11 +10749,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
10532
10749
|
__export(exports_simpleHTMLHMR, {
|
|
10533
10750
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
10534
10751
|
});
|
|
10535
|
-
import { resolve as
|
|
10752
|
+
import { resolve as resolve28 } from "path";
|
|
10536
10753
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
10537
10754
|
let htmlContent;
|
|
10538
10755
|
try {
|
|
10539
|
-
const resolvedPath =
|
|
10756
|
+
const resolvedPath = resolve28(htmlFilePath);
|
|
10540
10757
|
const file3 = Bun.file(resolvedPath);
|
|
10541
10758
|
if (!await file3.exists()) {
|
|
10542
10759
|
return null;
|
|
@@ -10562,11 +10779,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
10562
10779
|
__export(exports_simpleHTMXHMR, {
|
|
10563
10780
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
10564
10781
|
});
|
|
10565
|
-
import { resolve as
|
|
10782
|
+
import { resolve as resolve29 } from "path";
|
|
10566
10783
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
10567
10784
|
let htmlContent;
|
|
10568
10785
|
try {
|
|
10569
|
-
const resolvedPath =
|
|
10786
|
+
const resolvedPath = resolve29(htmxFilePath);
|
|
10570
10787
|
const file3 = Bun.file(resolvedPath);
|
|
10571
10788
|
if (!await file3.exists()) {
|
|
10572
10789
|
return null;
|
|
@@ -10588,8 +10805,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
10588
10805
|
var init_simpleHTMXHMR = () => {};
|
|
10589
10806
|
|
|
10590
10807
|
// src/dev/rebuildTrigger.ts
|
|
10591
|
-
import { existsSync as
|
|
10592
|
-
import { basename as basename13, dirname as dirname15, relative as
|
|
10808
|
+
import { existsSync as existsSync22 } from "fs";
|
|
10809
|
+
import { basename as basename13, dirname as dirname15, relative as relative12, resolve as resolve30 } from "path";
|
|
10593
10810
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
10594
10811
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
10595
10812
|
if (pathLineCol) {
|
|
@@ -10657,11 +10874,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10657
10874
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
10658
10875
|
}
|
|
10659
10876
|
return { ...parsed, framework: detectedFw };
|
|
10660
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
10877
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync22(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
10661
10878
|
state.fileHashes.delete(filePathInSet);
|
|
10662
10879
|
try {
|
|
10663
10880
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
10664
|
-
const deletedPathResolved =
|
|
10881
|
+
const deletedPathResolved = resolve30(filePathInSet);
|
|
10665
10882
|
affectedFiles.forEach((affectedFile) => {
|
|
10666
10883
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
10667
10884
|
validFiles.push(affectedFile);
|
|
@@ -10675,7 +10892,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10675
10892
|
if (!dependents || dependents.size === 0) {
|
|
10676
10893
|
return;
|
|
10677
10894
|
}
|
|
10678
|
-
const dependentFiles = Array.from(dependents).filter((file3) =>
|
|
10895
|
+
const dependentFiles = Array.from(dependents).filter((file3) => existsSync22(file3));
|
|
10679
10896
|
if (dependentFiles.length === 0) {
|
|
10680
10897
|
return;
|
|
10681
10898
|
}
|
|
@@ -10691,7 +10908,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10691
10908
|
try {
|
|
10692
10909
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
10693
10910
|
affectedFiles.forEach((affectedFile) => {
|
|
10694
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
10911
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync22(affectedFile)) {
|
|
10695
10912
|
validFiles.push(affectedFile);
|
|
10696
10913
|
processedFiles.add(affectedFile);
|
|
10697
10914
|
}
|
|
@@ -10705,7 +10922,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10705
10922
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
10706
10923
|
return;
|
|
10707
10924
|
}
|
|
10708
|
-
const normalizedFilePath =
|
|
10925
|
+
const normalizedFilePath = resolve30(filePathInSet);
|
|
10709
10926
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
10710
10927
|
validFiles.push(normalizedFilePath);
|
|
10711
10928
|
processedFiles.add(normalizedFilePath);
|
|
@@ -10716,7 +10933,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10716
10933
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
10717
10934
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
10718
10935
|
filePathSet.forEach((filePathInSet) => {
|
|
10719
|
-
if (!
|
|
10936
|
+
if (!existsSync22(filePathInSet)) {
|
|
10720
10937
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
10721
10938
|
return;
|
|
10722
10939
|
}
|
|
@@ -10783,8 +11000,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10783
11000
|
}
|
|
10784
11001
|
if (framework === "unknown") {
|
|
10785
11002
|
const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
|
|
10786
|
-
invalidate2(
|
|
10787
|
-
const relPath =
|
|
11003
|
+
invalidate2(resolve30(filePath));
|
|
11004
|
+
const relPath = relative12(process.cwd(), filePath);
|
|
10788
11005
|
logHmrUpdate(relPath);
|
|
10789
11006
|
return;
|
|
10790
11007
|
}
|
|
@@ -10824,12 +11041,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10824
11041
|
return componentFile;
|
|
10825
11042
|
}
|
|
10826
11043
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
10827
|
-
if (
|
|
11044
|
+
if (existsSync22(tsCounterpart)) {
|
|
10828
11045
|
return tsCounterpart;
|
|
10829
11046
|
}
|
|
10830
11047
|
if (!graph)
|
|
10831
11048
|
return componentFile;
|
|
10832
|
-
const dependents = graph.dependents.get(
|
|
11049
|
+
const dependents = graph.dependents.get(resolve30(componentFile));
|
|
10833
11050
|
if (!dependents)
|
|
10834
11051
|
return componentFile;
|
|
10835
11052
|
for (const dep of dependents) {
|
|
@@ -10838,7 +11055,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10838
11055
|
}
|
|
10839
11056
|
return componentFile;
|
|
10840
11057
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
10841
|
-
const pageEntries = angularFiles.filter((file3) => file3.endsWith(".ts") &&
|
|
11058
|
+
const pageEntries = angularFiles.filter((file3) => file3.endsWith(".ts") && resolve30(file3).startsWith(angularPagesPath));
|
|
10842
11059
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
10843
11060
|
return pageEntries;
|
|
10844
11061
|
}
|
|
@@ -10847,7 +11064,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10847
11064
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
10848
11065
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
10849
11066
|
affected.forEach((file3) => {
|
|
10850
|
-
if (file3.endsWith(".ts") &&
|
|
11067
|
+
if (file3.endsWith(".ts") && resolve30(file3).startsWith(angularPagesPath)) {
|
|
10851
11068
|
resolvedPages.add(file3);
|
|
10852
11069
|
}
|
|
10853
11070
|
});
|
|
@@ -10897,7 +11114,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10897
11114
|
format: "esm",
|
|
10898
11115
|
naming: "[dir]/[name].[hash].[ext]",
|
|
10899
11116
|
outdir: buildDir,
|
|
10900
|
-
plugins: [
|
|
11117
|
+
plugins: [
|
|
11118
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11119
|
+
],
|
|
10901
11120
|
root: clientRoot,
|
|
10902
11121
|
target: "browser",
|
|
10903
11122
|
throw: false
|
|
@@ -10938,10 +11157,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10938
11157
|
});
|
|
10939
11158
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
10940
11159
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
10941
|
-
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true);
|
|
11160
|
+
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, state.config.stylePreprocessors);
|
|
10942
11161
|
serverPaths.forEach((serverPath) => {
|
|
10943
11162
|
const fileBase = basename13(serverPath, ".js");
|
|
10944
|
-
state.manifest[toPascal(fileBase)] =
|
|
11163
|
+
state.manifest[toPascal(fileBase)] = resolve30(serverPath);
|
|
10945
11164
|
});
|
|
10946
11165
|
if (clientPaths.length > 0) {
|
|
10947
11166
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
@@ -10950,9 +11169,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10950
11169
|
const angularDir = config.angularDirectory ?? "";
|
|
10951
11170
|
const angularFiles = filesToRebuild.filter((file3) => detectFramework(file3, state.resolvedPaths) === "angular");
|
|
10952
11171
|
for (const file3 of angularFiles) {
|
|
10953
|
-
state.fileHashes.set(
|
|
11172
|
+
state.fileHashes.set(resolve30(file3), computeFileHash(file3));
|
|
10954
11173
|
}
|
|
10955
|
-
const angularPagesPath =
|
|
11174
|
+
const angularPagesPath = resolve30(angularDir, "pages");
|
|
10956
11175
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
10957
11176
|
if (pageEntries.length > 0) {
|
|
10958
11177
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
@@ -10967,8 +11186,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10967
11186
|
return manifest;
|
|
10968
11187
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
10969
11188
|
const pageName = basename13(normalized, ".tsx");
|
|
10970
|
-
const indexPath =
|
|
10971
|
-
if (!
|
|
11189
|
+
const indexPath = resolve30(reactIndexesPath, `${pageName}.tsx`);
|
|
11190
|
+
if (!existsSync22(indexPath)) {
|
|
10972
11191
|
return;
|
|
10973
11192
|
}
|
|
10974
11193
|
return indexPath;
|
|
@@ -10979,13 +11198,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10979
11198
|
return;
|
|
10980
11199
|
}
|
|
10981
11200
|
const pageName = basename13(dep, ".tsx");
|
|
10982
|
-
const indexPath =
|
|
10983
|
-
if (
|
|
11201
|
+
const indexPath = resolve30(reactIndexesPath, `${pageName}.tsx`);
|
|
11202
|
+
if (existsSync22(indexPath) && !reactEntries.includes(indexPath)) {
|
|
10984
11203
|
reactEntries.push(indexPath);
|
|
10985
11204
|
}
|
|
10986
11205
|
});
|
|
10987
11206
|
}, resolveReactEntryForFile = (state, file3, pagesPathResolved, reactIndexesPath, reactEntries) => {
|
|
10988
|
-
const normalized =
|
|
11207
|
+
const normalized = resolve30(file3);
|
|
10989
11208
|
if (!normalized.startsWith(pagesPathResolved)) {
|
|
10990
11209
|
resolveReactEntriesFromDeps(state, normalized, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
10991
11210
|
return;
|
|
@@ -10996,7 +11215,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10996
11215
|
}
|
|
10997
11216
|
}, collectReactEntries = (state, filesToRebuild, reactPagesPath, reactIndexesPath) => {
|
|
10998
11217
|
const reactEntries = [];
|
|
10999
|
-
const pagesPathResolved =
|
|
11218
|
+
const pagesPathResolved = resolve30(reactPagesPath);
|
|
11000
11219
|
filesToRebuild.forEach((file3) => {
|
|
11001
11220
|
resolveReactEntryForFile(state, file3, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
11002
11221
|
});
|
|
@@ -11008,7 +11227,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11008
11227
|
const { rewriteReactImports: rewriteReactImports2 } = await Promise.resolve().then(() => (init_rewriteReactImports(), exports_rewriteReactImports));
|
|
11009
11228
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11010
11229
|
const depVendorPaths = globalThis.__depVendorPaths ?? {};
|
|
11011
|
-
const refreshEntry =
|
|
11230
|
+
const refreshEntry = resolve30(reactIndexesPath, "_refresh.tsx");
|
|
11012
11231
|
if (!reactEntries.includes(refreshEntry)) {
|
|
11013
11232
|
reactEntries.push(refreshEntry);
|
|
11014
11233
|
}
|
|
@@ -11020,7 +11239,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11020
11239
|
setDevVendorPaths2(vendorPaths);
|
|
11021
11240
|
}
|
|
11022
11241
|
const { rmSync: rmSync3 } = await import("fs");
|
|
11023
|
-
rmSync3(
|
|
11242
|
+
rmSync3(resolve30(buildDir, "react", "generated", "indexes"), {
|
|
11024
11243
|
force: true,
|
|
11025
11244
|
recursive: true
|
|
11026
11245
|
});
|
|
@@ -11030,7 +11249,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11030
11249
|
jsx: { development: true },
|
|
11031
11250
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11032
11251
|
outdir: buildDir,
|
|
11033
|
-
plugins: [
|
|
11252
|
+
plugins: [
|
|
11253
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11254
|
+
],
|
|
11034
11255
|
reactFastRefresh: true,
|
|
11035
11256
|
root: clientRoot,
|
|
11036
11257
|
splitting: true,
|
|
@@ -11061,7 +11282,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11061
11282
|
}, getModuleUrl = async (pageFile) => {
|
|
11062
11283
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
11063
11284
|
invalidateModule2(pageFile);
|
|
11064
|
-
const rel =
|
|
11285
|
+
const rel = relative12(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
11065
11286
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
11066
11287
|
warmCache2(url);
|
|
11067
11288
|
return url;
|
|
@@ -11070,11 +11291,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11070
11291
|
if (isComponentFile2)
|
|
11071
11292
|
return primaryFile;
|
|
11072
11293
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
11073
|
-
const nearest = findNearestComponent2(
|
|
11294
|
+
const nearest = findNearestComponent2(resolve30(primaryFile));
|
|
11074
11295
|
return nearest ?? primaryFile;
|
|
11075
11296
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
11076
11297
|
for (const file3 of reactFiles) {
|
|
11077
|
-
state.fileHashes.set(
|
|
11298
|
+
state.fileHashes.set(resolve30(file3), computeFileHash(file3));
|
|
11078
11299
|
}
|
|
11079
11300
|
invalidateReactSsrCache();
|
|
11080
11301
|
const primaryFile = reactFiles.find((file3) => !file3.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -11093,7 +11314,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11093
11314
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
11094
11315
|
if (pageModuleUrl) {
|
|
11095
11316
|
const serverDuration = Date.now() - startTime;
|
|
11096
|
-
state.lastHmrPath =
|
|
11317
|
+
state.lastHmrPath = relative12(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
11097
11318
|
state.lastHmrFramework = "react";
|
|
11098
11319
|
broadcastToClients(state, {
|
|
11099
11320
|
data: {
|
|
@@ -11116,8 +11337,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11116
11337
|
return state.manifest;
|
|
11117
11338
|
}, handleReactFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
11118
11339
|
const reactDir = config.reactDirectory ?? "";
|
|
11119
|
-
const reactPagesPath =
|
|
11120
|
-
const reactIndexesPath =
|
|
11340
|
+
const reactPagesPath = resolve30(reactDir, "pages");
|
|
11341
|
+
const reactIndexesPath = resolve30(reactDir, "generated", "indexes");
|
|
11121
11342
|
const { buildDir } = state.resolvedPaths;
|
|
11122
11343
|
const reactFiles = filesToRebuild.filter((file3) => detectFramework(file3, state.resolvedPaths) === "react");
|
|
11123
11344
|
if (reactFiles.length > 0) {
|
|
@@ -11180,7 +11401,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11180
11401
|
});
|
|
11181
11402
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
11182
11403
|
for (const file3 of svelteFiles) {
|
|
11183
|
-
state.fileHashes.set(
|
|
11404
|
+
state.fileHashes.set(resolve30(file3), computeFileHash(file3));
|
|
11184
11405
|
}
|
|
11185
11406
|
invalidateSvelteSsrCache();
|
|
11186
11407
|
const serverDuration = Date.now() - startTime;
|
|
@@ -11203,11 +11424,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11203
11424
|
const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
|
|
11204
11425
|
const { build: bunBuild7 } = await Promise.resolve(globalThis.Bun);
|
|
11205
11426
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11206
|
-
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true);
|
|
11427
|
+
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, state.config.stylePreprocessors);
|
|
11207
11428
|
const serverEntries = [...svelteServerPaths];
|
|
11208
11429
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
11209
|
-
const serverRoot =
|
|
11210
|
-
const serverOutDir =
|
|
11430
|
+
const serverRoot = resolve30(svelteDir, "generated", "server");
|
|
11431
|
+
const serverOutDir = resolve30(buildDir, basename13(svelteDir));
|
|
11211
11432
|
const [serverResult, clientResult] = await Promise.all([
|
|
11212
11433
|
serverEntries.length > 0 ? bunBuild7({
|
|
11213
11434
|
entrypoints: serverEntries,
|
|
@@ -11222,7 +11443,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11222
11443
|
format: "esm",
|
|
11223
11444
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11224
11445
|
outdir: serverOutDir,
|
|
11225
|
-
plugins: [
|
|
11446
|
+
plugins: [
|
|
11447
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11448
|
+
],
|
|
11226
11449
|
root: serverRoot,
|
|
11227
11450
|
target: "bun",
|
|
11228
11451
|
throw: false
|
|
@@ -11232,7 +11455,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11232
11455
|
format: "esm",
|
|
11233
11456
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11234
11457
|
outdir: buildDir,
|
|
11235
|
-
plugins: [
|
|
11458
|
+
plugins: [
|
|
11459
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11460
|
+
],
|
|
11236
11461
|
root: clientRoot,
|
|
11237
11462
|
target: "browser",
|
|
11238
11463
|
throw: false
|
|
@@ -11300,7 +11525,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11300
11525
|
});
|
|
11301
11526
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
11302
11527
|
for (const file3 of [...vueFiles, ...nonVueFiles]) {
|
|
11303
|
-
state.fileHashes.set(
|
|
11528
|
+
state.fileHashes.set(resolve30(file3), computeFileHash(file3));
|
|
11304
11529
|
}
|
|
11305
11530
|
invalidateVueSsrCache();
|
|
11306
11531
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -11395,8 +11620,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11395
11620
|
if (!buildReference?.source) {
|
|
11396
11621
|
return;
|
|
11397
11622
|
}
|
|
11398
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
11399
|
-
islandFiles.add(
|
|
11623
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve30(dirname15(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
11624
|
+
islandFiles.add(resolve30(sourcePath));
|
|
11400
11625
|
}, resolveIslandSourceFiles = async (config) => {
|
|
11401
11626
|
const registryPath = config.islands?.registry;
|
|
11402
11627
|
if (!registryPath) {
|
|
@@ -11404,7 +11629,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11404
11629
|
}
|
|
11405
11630
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
11406
11631
|
const islandFiles = new Set([
|
|
11407
|
-
|
|
11632
|
+
resolve30(buildInfo.resolvedRegistryPath)
|
|
11408
11633
|
]);
|
|
11409
11634
|
for (const definition of buildInfo.definitions) {
|
|
11410
11635
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -11415,7 +11640,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11415
11640
|
if (islandFiles.size === 0) {
|
|
11416
11641
|
return false;
|
|
11417
11642
|
}
|
|
11418
|
-
return filesToRebuild.some((file3) => islandFiles.has(
|
|
11643
|
+
return filesToRebuild.some((file3) => islandFiles.has(resolve30(file3)));
|
|
11419
11644
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
11420
11645
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
11421
11646
|
if (!shouldReload) {
|
|
@@ -11450,10 +11675,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11450
11675
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
11451
11676
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
11452
11677
|
if (isSingle) {
|
|
11453
|
-
return
|
|
11678
|
+
return resolve30(state.resolvedPaths.buildDir, "pages");
|
|
11454
11679
|
}
|
|
11455
11680
|
const dirName = framework === "html" ? basename13(config.htmlDirectory ?? "html") : basename13(config.htmxDirectory ?? "htmx");
|
|
11456
|
-
return
|
|
11681
|
+
return resolve30(state.resolvedPaths.buildDir, dirName, "pages");
|
|
11457
11682
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
11458
11683
|
try {
|
|
11459
11684
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -11492,7 +11717,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11492
11717
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
11493
11718
|
for (const pageFile of pageFilesToUpdate) {
|
|
11494
11719
|
const htmlPageName = basename13(pageFile);
|
|
11495
|
-
const builtHtmlPagePath =
|
|
11720
|
+
const builtHtmlPagePath = resolve30(outputHtmlPages, htmlPageName);
|
|
11496
11721
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
11497
11722
|
}
|
|
11498
11723
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -11553,11 +11778,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11553
11778
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
11554
11779
|
const pascalName = toPascal(baseName);
|
|
11555
11780
|
const vueRoot = config.vueDirectory;
|
|
11556
|
-
const hmrId = vueRoot ?
|
|
11781
|
+
const hmrId = vueRoot ? relative12(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
11557
11782
|
const cssKey = `${pascalName}CSS`;
|
|
11558
11783
|
const cssUrl = manifest[cssKey] || null;
|
|
11559
11784
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
11560
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
11785
|
+
const hmrMeta = vueHmrMetadata2.get(resolve30(vuePagePath));
|
|
11561
11786
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
11562
11787
|
if (changeType === "style-only") {
|
|
11563
11788
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -11794,7 +12019,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11794
12019
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
11795
12020
|
for (const htmxPageFile of pageFilesToUpdate) {
|
|
11796
12021
|
const htmxPageName = basename13(htmxPageFile);
|
|
11797
|
-
const builtHtmxPagePath =
|
|
12022
|
+
const builtHtmxPagePath = resolve30(outputHtmxPages, htmxPageName);
|
|
11798
12023
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
11799
12024
|
}
|
|
11800
12025
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -11903,7 +12128,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11903
12128
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
11904
12129
|
writeFs(destPath, html);
|
|
11905
12130
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
11906
|
-
const destPath =
|
|
12131
|
+
const destPath = resolve30(outputDir, basename13(sourceFile));
|
|
11907
12132
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
11908
12133
|
const source = await Bun.file(sourceFile).text();
|
|
11909
12134
|
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 file3 of files) {
|
|
12214
12439
|
const filePath = join22(vendorDir, file3);
|
|
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 resolve31 } 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 = resolve31(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(resolve31(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
|
+
resolve31(import.meta.dir, "..", "..", "package.json"),
|
|
12665
|
+
resolve31(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(resolve31(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 = resolve31(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 = resolve31(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 = resolve31(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 = resolve31(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 = resolve31(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(resolve31(Bun.main)).mtimeMs;
|
|
12579
12804
|
return result;
|
|
12580
12805
|
};
|
|
12581
12806
|
var init_devBuild = __esm(() => {
|
|
@@ -12611,5 +12836,5 @@ export {
|
|
|
12611
12836
|
build
|
|
12612
12837
|
};
|
|
12613
12838
|
|
|
12614
|
-
//# debugId=
|
|
12839
|
+
//# debugId=E51CE14B6945493364756E2164756E21
|
|
12615
12840
|
//# sourceMappingURL=build.js.map
|