@absolutejs/absolute 0.19.0-beta.693 → 0.19.0-beta.695
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 +377 -53
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +377 -53
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +539 -208
- package/dist/build.js.map +7 -7
- package/dist/cli/index.js +1 -0
- package/dist/index.js +2004 -1828
- package/dist/index.js.map +28 -35
- package/dist/islands/index.js +349 -25
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +354 -25
- package/dist/react/index.js.map +3 -3
- package/dist/react/server.js +6 -1
- package/dist/react/server.js.map +2 -2
- package/dist/src/build/stylePreprocessor.d.ts +2 -1
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/core/pageHandlers.d.ts +2 -1
- package/dist/svelte/index.js +359 -35
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +354 -30
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +30 -0
- package/dist/vue/index.js +349 -25
- package/dist/vue/index.js.map +3 -3
- package/package.json +16 -7
package/dist/build.js
CHANGED
|
@@ -2448,10 +2448,27 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2448
2448
|
});
|
|
2449
2449
|
|
|
2450
2450
|
// src/build/stylePreprocessor.ts
|
|
2451
|
+
var exports_stylePreprocessor = {};
|
|
2452
|
+
__export(exports_stylePreprocessor, {
|
|
2453
|
+
stylePreprocessorPlugin: () => stylePreprocessorPlugin,
|
|
2454
|
+
isStylePath: () => isStylePath,
|
|
2455
|
+
isStyleModulePath: () => isStyleModulePath,
|
|
2456
|
+
isPreprocessableStylePath: () => isPreprocessableStylePath,
|
|
2457
|
+
getStyleBaseName: () => getStyleBaseName,
|
|
2458
|
+
getCssOutputExtension: () => getCssOutputExtension,
|
|
2459
|
+
createSvelteStylePreprocessor: () => createSvelteStylePreprocessor,
|
|
2460
|
+
createStyleTransformConfig: () => createStyleTransformConfig,
|
|
2461
|
+
createStylePreprocessorPlugin: () => createStylePreprocessorPlugin,
|
|
2462
|
+
compileStyleSource: () => compileStyleSource,
|
|
2463
|
+
compileStyleFileIfNeededSync: () => compileStyleFileIfNeededSync,
|
|
2464
|
+
compileStyleFileIfNeeded: () => compileStyleFileIfNeeded
|
|
2465
|
+
});
|
|
2466
|
+
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
|
|
2451
2467
|
import { readFile } from "fs/promises";
|
|
2452
2468
|
import { createRequire } from "module";
|
|
2453
|
-
import { dirname as dirname3, extname as extname3, join as join5, resolve as resolve6 } from "path";
|
|
2454
|
-
|
|
2469
|
+
import { dirname as dirname3, extname as extname3, isAbsolute, join as join5, relative as relative3, resolve as resolve6 } from "path";
|
|
2470
|
+
import { fileURLToPath } from "url";
|
|
2471
|
+
var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
2455
2472
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2456
2473
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
2457
2474
|
return "scss";
|
|
@@ -2459,16 +2476,266 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2459
2476
|
return "sass";
|
|
2460
2477
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
2461
2478
|
return "less";
|
|
2479
|
+
if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
|
|
2480
|
+
return "stylus";
|
|
2462
2481
|
return null;
|
|
2463
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
2482
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), requireOptionalPeerSync = (specifier) => {
|
|
2483
|
+
try {
|
|
2484
|
+
return requireFromCwd(specifier);
|
|
2485
|
+
} catch {
|
|
2486
|
+
return requireOptionalPeer(specifier);
|
|
2487
|
+
}
|
|
2488
|
+
}, normalizeLoadPaths = (filePath, paths = []) => [
|
|
2464
2489
|
dirname3(filePath),
|
|
2465
2490
|
process.cwd(),
|
|
2466
2491
|
...paths.map((path) => resolve6(process.cwd(), path))
|
|
2467
|
-
],
|
|
2492
|
+
], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
|
|
2493
|
+
pattern,
|
|
2494
|
+
replacements: Array.isArray(value) ? value : [value]
|
|
2495
|
+
})), readTsconfigAliases = () => {
|
|
2496
|
+
const cwd = process.cwd();
|
|
2497
|
+
if (tsconfigAliasCache?.cwd === cwd)
|
|
2498
|
+
return tsconfigAliasCache;
|
|
2499
|
+
const tsconfigPath = resolve6(cwd, "tsconfig.json");
|
|
2500
|
+
const empty = { aliases: [], baseUrl: cwd, cwd };
|
|
2501
|
+
if (!existsSync5(tsconfigPath)) {
|
|
2502
|
+
tsconfigAliasCache = empty;
|
|
2503
|
+
return empty;
|
|
2504
|
+
}
|
|
2505
|
+
try {
|
|
2506
|
+
const parsed = JSON.parse(stripJsonComments(readFileSync3(tsconfigPath, "utf-8")));
|
|
2507
|
+
const compilerOptions = parsed.compilerOptions ?? {};
|
|
2508
|
+
const baseUrl = resolve6(cwd, compilerOptions.baseUrl ?? ".");
|
|
2509
|
+
tsconfigAliasCache = {
|
|
2510
|
+
aliases: normalizeAliasEntries(compilerOptions.paths),
|
|
2511
|
+
baseUrl,
|
|
2512
|
+
cwd
|
|
2513
|
+
};
|
|
2514
|
+
} catch {
|
|
2515
|
+
tsconfigAliasCache = empty;
|
|
2516
|
+
}
|
|
2517
|
+
return tsconfigAliasCache;
|
|
2518
|
+
}, getAliasEntries = (config) => {
|
|
2519
|
+
const tsconfig = readTsconfigAliases();
|
|
2520
|
+
return {
|
|
2521
|
+
aliases: [...normalizeAliasEntries(config?.aliases), ...tsconfig.aliases],
|
|
2522
|
+
baseUrl: tsconfig.baseUrl
|
|
2523
|
+
};
|
|
2524
|
+
}, aliasPatternToRegExp = (pattern) => new RegExp(`^${pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("(.+)")}$`), resolveAliasTargets = (specifier, config) => {
|
|
2525
|
+
const { aliases, baseUrl } = getAliasEntries(config);
|
|
2526
|
+
const targets = [];
|
|
2527
|
+
for (const alias of aliases) {
|
|
2528
|
+
const match = specifier.match(aliasPatternToRegExp(alias.pattern));
|
|
2529
|
+
if (!match)
|
|
2530
|
+
continue;
|
|
2531
|
+
const wildcard = match[1] ?? "";
|
|
2532
|
+
for (const replacement of alias.replacements) {
|
|
2533
|
+
targets.push(resolve6(baseUrl, replacement.replace("*", wildcard)));
|
|
2534
|
+
}
|
|
2535
|
+
}
|
|
2536
|
+
return targets;
|
|
2537
|
+
}, getLanguageExtensions = (language) => {
|
|
2538
|
+
if (language === "less")
|
|
2539
|
+
return [".less", ".css"];
|
|
2540
|
+
if (language === "stylus")
|
|
2541
|
+
return [".styl", ".stylus", ".css"];
|
|
2542
|
+
return [".scss", ".sass", ".css"];
|
|
2543
|
+
}, getCandidatePaths = (basePath, language) => {
|
|
2544
|
+
const ext = extname3(basePath);
|
|
2545
|
+
const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
|
|
2546
|
+
`${basePath}${extension}`,
|
|
2547
|
+
join5(basePath, `index${extension}`)
|
|
2548
|
+
]);
|
|
2549
|
+
if (language === "scss" || language === "sass") {
|
|
2550
|
+
return paths.flatMap((path) => {
|
|
2551
|
+
const dir = dirname3(path);
|
|
2552
|
+
const base = path.slice(dir.length + 1);
|
|
2553
|
+
return [path, join5(dir, `_${base}`)];
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
return paths;
|
|
2557
|
+
}, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
|
|
2558
|
+
const rawCandidates = [
|
|
2559
|
+
...resolveAliasTargets(specifier, config),
|
|
2560
|
+
isAbsolute(specifier) ? specifier : resolve6(fromDirectory, specifier),
|
|
2561
|
+
...loadPaths.map((path) => resolve6(path, specifier))
|
|
2562
|
+
];
|
|
2563
|
+
for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
|
|
2564
|
+
if (existsSync5(candidate))
|
|
2565
|
+
return candidate;
|
|
2566
|
+
}
|
|
2567
|
+
return null;
|
|
2568
|
+
}, isExternalCssUrl = (url) => /^(?:[a-z][a-z0-9+.-]*:|\/\/|#|\/)/i.test(url), splitCssUrl = (url) => {
|
|
2569
|
+
const markerIndex = url.search(/[?#]/);
|
|
2570
|
+
if (markerIndex === -1)
|
|
2571
|
+
return { marker: "", path: url };
|
|
2572
|
+
return {
|
|
2573
|
+
marker: url.slice(markerIndex),
|
|
2574
|
+
path: url.slice(0, markerIndex)
|
|
2575
|
+
};
|
|
2576
|
+
}, rebaseCssUrls = (contents, sourceFile, entryFile) => {
|
|
2577
|
+
const sourceDir = dirname3(sourceFile);
|
|
2578
|
+
const entryDir = dirname3(entryFile);
|
|
2579
|
+
if (sourceDir === entryDir)
|
|
2580
|
+
return contents;
|
|
2581
|
+
return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
|
|
2582
|
+
const trimmedUrl = rawUrl.trim();
|
|
2583
|
+
if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
|
|
2584
|
+
return match;
|
|
2585
|
+
const { marker, path } = splitCssUrl(trimmedUrl);
|
|
2586
|
+
const rebased = relative3(entryDir, resolve6(sourceDir, path)).replace(/\\/g, "/");
|
|
2587
|
+
const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
|
|
2588
|
+
const nextQuote = quote || '"';
|
|
2589
|
+
return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
|
|
2590
|
+
});
|
|
2591
|
+
}, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
|
|
2592
|
+
if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
|
|
2593
|
+
return match;
|
|
2594
|
+
const resolved = resolveImportPath(specifier, dirname3(sourceFile), loadPaths, language, config);
|
|
2595
|
+
return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
|
|
2596
|
+
}), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
|
|
2597
|
+
const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
|
|
2598
|
+
return language ? rewriteAliasedStyleImports(rebased, sourceFile, loadPaths, language, config) : rebased;
|
|
2599
|
+
}, extractCssModuleExports = (css) => {
|
|
2600
|
+
const exports = {};
|
|
2601
|
+
const nextCss = css.replace(/:export\s*\{([^}]*)\}/g, (_, body) => {
|
|
2602
|
+
for (const declaration of body.split(";")) {
|
|
2603
|
+
const separator = declaration.indexOf(":");
|
|
2604
|
+
if (separator === -1)
|
|
2605
|
+
continue;
|
|
2606
|
+
const key = declaration.slice(0, separator).trim();
|
|
2607
|
+
const value = declaration.slice(separator + 1).trim();
|
|
2608
|
+
if (key && value)
|
|
2609
|
+
exports[key] = value;
|
|
2610
|
+
}
|
|
2611
|
+
return "";
|
|
2612
|
+
});
|
|
2613
|
+
return { css: nextCss, exports };
|
|
2614
|
+
}, getSassOptions = (config, language) => ({
|
|
2468
2615
|
...config?.sass ?? {},
|
|
2469
2616
|
...language === "scss" ? config?.scss ?? {} : {}
|
|
2470
|
-
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2471
|
-
${contents}` : contents,
|
|
2617
|
+
}), getLessOptions = (config) => config?.less ?? {}, getStylusOptions = (config) => config?.stylus ?? {}, createStyleTransformConfig = (stylePreprocessors, postcss) => postcss === undefined ? stylePreprocessors : { ...stylePreprocessors ?? {}, postcss }, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2618
|
+
${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
2619
|
+
if (mod && typeof mod === "object" && "default" in mod) {
|
|
2620
|
+
return mod.default ?? mod;
|
|
2621
|
+
}
|
|
2622
|
+
return mod;
|
|
2623
|
+
}, loadPostcssConfigFile = async (configPath) => {
|
|
2624
|
+
const resolved = resolve6(process.cwd(), configPath);
|
|
2625
|
+
const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
|
|
2626
|
+
const config = normalizePostcssModule(loaded);
|
|
2627
|
+
const value = typeof config === "function" ? await config({
|
|
2628
|
+
cwd: process.cwd(),
|
|
2629
|
+
env: "development"
|
|
2630
|
+
}) : config;
|
|
2631
|
+
return normalizePostcssModule(value) ?? {};
|
|
2632
|
+
}, normalizePostcssPlugins = (plugins) => {
|
|
2633
|
+
if (!plugins)
|
|
2634
|
+
return [];
|
|
2635
|
+
if (Array.isArray(plugins))
|
|
2636
|
+
return plugins.filter(Boolean);
|
|
2637
|
+
const resolved = [];
|
|
2638
|
+
for (const [specifier, options] of Object.entries(plugins)) {
|
|
2639
|
+
if (options === false)
|
|
2640
|
+
continue;
|
|
2641
|
+
const mod = normalizePostcssModule(requireOptionalPeerSync(specifier));
|
|
2642
|
+
const plugin = typeof mod === "function" ? mod(options === true ? undefined : options) : mod;
|
|
2643
|
+
if (plugin)
|
|
2644
|
+
resolved.push(plugin);
|
|
2645
|
+
}
|
|
2646
|
+
return resolved;
|
|
2647
|
+
}, resolvePostcssConfig = async (config) => {
|
|
2648
|
+
const inlineConfig = config?.postcss;
|
|
2649
|
+
if (!inlineConfig)
|
|
2650
|
+
return null;
|
|
2651
|
+
const fileConfig = inlineConfig.config ? await loadPostcssConfigFile(inlineConfig.config) : {};
|
|
2652
|
+
const plugins = [
|
|
2653
|
+
...normalizePostcssPlugins(fileConfig.plugins),
|
|
2654
|
+
...normalizePostcssPlugins(inlineConfig.plugins)
|
|
2655
|
+
];
|
|
2656
|
+
if (plugins.length === 0)
|
|
2657
|
+
return null;
|
|
2658
|
+
return {
|
|
2659
|
+
options: {
|
|
2660
|
+
...fileConfig.options ?? {},
|
|
2661
|
+
...inlineConfig.options ?? {}
|
|
2662
|
+
},
|
|
2663
|
+
plugins
|
|
2664
|
+
};
|
|
2665
|
+
}, runPostcss = async (css, filePath, config) => {
|
|
2666
|
+
const postcssConfig = await resolvePostcssConfig(config);
|
|
2667
|
+
if (!postcssConfig)
|
|
2668
|
+
return css;
|
|
2669
|
+
let postcssModule;
|
|
2670
|
+
try {
|
|
2671
|
+
postcssModule = await importOptionalPeer("postcss");
|
|
2672
|
+
} catch {
|
|
2673
|
+
throw missingDependencyError("postcss", filePath);
|
|
2674
|
+
}
|
|
2675
|
+
const postcss = postcssModule.default ?? postcssModule;
|
|
2676
|
+
const result = await postcss(postcssConfig.plugins).process(css, {
|
|
2677
|
+
from: filePath,
|
|
2678
|
+
map: false,
|
|
2679
|
+
...postcssConfig.options
|
|
2680
|
+
});
|
|
2681
|
+
return result.css;
|
|
2682
|
+
}, createSassImporter = (entryFile, loadPaths, language, config) => ({
|
|
2683
|
+
canonicalize(specifier, options) {
|
|
2684
|
+
const fromDirectory = options.containingUrl ? dirname3(fileURLToPath(options.containingUrl)) : dirname3(entryFile);
|
|
2685
|
+
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
2686
|
+
return resolved ? new URL(`file://${resolved}`) : null;
|
|
2687
|
+
},
|
|
2688
|
+
load(canonicalUrl) {
|
|
2689
|
+
const filePath = fileURLToPath(canonicalUrl);
|
|
2690
|
+
const fileLanguage = getStyleLanguage(filePath);
|
|
2691
|
+
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
2692
|
+
return null;
|
|
2693
|
+
return {
|
|
2694
|
+
contents: preprocessLoadedStyle(readFileSync3(filePath, "utf-8"), filePath, entryFile, loadPaths, language, config),
|
|
2695
|
+
syntax: filePath.endsWith(".sass") ? "indented" : "scss"
|
|
2696
|
+
};
|
|
2697
|
+
}
|
|
2698
|
+
}), createLessFileManager = (entryFile, loadPaths, config) => ({
|
|
2699
|
+
install(less, pluginManager) {
|
|
2700
|
+
const baseManager = new less.FileManager;
|
|
2701
|
+
const manager = Object.create(baseManager);
|
|
2702
|
+
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve6(currentDirectory), loadPaths, "less", config));
|
|
2703
|
+
manager.loadFile = async (filename, currentDirectory) => {
|
|
2704
|
+
const resolved = resolveImportPath(filename, resolve6(currentDirectory), loadPaths, "less", config);
|
|
2705
|
+
if (!resolved) {
|
|
2706
|
+
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
2707
|
+
}
|
|
2708
|
+
return {
|
|
2709
|
+
contents: preprocessLoadedStyle(await readFile(resolved, "utf-8"), resolved, entryFile, loadPaths, "less", config),
|
|
2710
|
+
filename: resolved
|
|
2711
|
+
};
|
|
2712
|
+
};
|
|
2713
|
+
pluginManager.addFileManager(manager);
|
|
2714
|
+
}
|
|
2715
|
+
}), renderStylus = async (contents, filePath, loadPaths, options) => {
|
|
2716
|
+
let stylus;
|
|
2717
|
+
try {
|
|
2718
|
+
const stylusModule = await importOptionalPeer("stylus");
|
|
2719
|
+
stylus = stylusModule.default ?? stylusModule;
|
|
2720
|
+
} catch {
|
|
2721
|
+
throw missingDependencyError("stylus", filePath);
|
|
2722
|
+
}
|
|
2723
|
+
return new Promise((resolveCss, reject) => {
|
|
2724
|
+
const renderer = stylus(contents);
|
|
2725
|
+
renderer.set("filename", filePath);
|
|
2726
|
+
for (const [key, value] of Object.entries(options.options ?? {})) {
|
|
2727
|
+
renderer.set(key, value);
|
|
2728
|
+
}
|
|
2729
|
+
for (const path of loadPaths)
|
|
2730
|
+
renderer.include(path);
|
|
2731
|
+
renderer.render((error, css) => {
|
|
2732
|
+
if (error)
|
|
2733
|
+
reject(error);
|
|
2734
|
+
else
|
|
2735
|
+
resolveCss(css ?? "");
|
|
2736
|
+
});
|
|
2737
|
+
});
|
|
2738
|
+
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
2472
2739
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2473
2740
|
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2474
2741
|
if (language === "scss" || language === "sass") {
|
|
@@ -2481,13 +2748,17 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
2481
2748
|
throw missingDependencyError(packageName, filePath);
|
|
2482
2749
|
}
|
|
2483
2750
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2751
|
+
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
2484
2752
|
const result = sass.compileString(contents, {
|
|
2485
|
-
|
|
2753
|
+
importers: [
|
|
2754
|
+
createSassImporter(filePath, loadPaths, language, config)
|
|
2755
|
+
],
|
|
2756
|
+
loadPaths,
|
|
2486
2757
|
style: "expanded",
|
|
2487
2758
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2488
2759
|
url: new URL(`file://${filePath}`)
|
|
2489
2760
|
});
|
|
2490
|
-
return result.css;
|
|
2761
|
+
return runPostcss(result.css, filePath, config);
|
|
2491
2762
|
}
|
|
2492
2763
|
if (language === "less") {
|
|
2493
2764
|
const options = getLessOptions(config);
|
|
@@ -2502,14 +2773,25 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
2502
2773
|
if (!render)
|
|
2503
2774
|
throw missingDependencyError("less", filePath);
|
|
2504
2775
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2776
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
2505
2777
|
const result = await render(contents, {
|
|
2506
2778
|
...options.options ?? {},
|
|
2507
2779
|
filename: filePath,
|
|
2508
|
-
paths:
|
|
2780
|
+
paths: loadPaths,
|
|
2781
|
+
plugins: [
|
|
2782
|
+
...options.options?.plugins ?? [],
|
|
2783
|
+
createLessFileManager(filePath, loadPaths, config)
|
|
2784
|
+
]
|
|
2509
2785
|
});
|
|
2510
|
-
return result.css;
|
|
2786
|
+
return runPostcss(result.css, filePath, config);
|
|
2511
2787
|
}
|
|
2512
|
-
|
|
2788
|
+
if (language === "stylus") {
|
|
2789
|
+
const options = getStylusOptions(config);
|
|
2790
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
2791
|
+
const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
|
|
2792
|
+
return runPostcss(await renderStylus(contents, filePath, loadPaths, options), filePath, config);
|
|
2793
|
+
}
|
|
2794
|
+
return runPostcss(rawContents, filePath, config);
|
|
2513
2795
|
}, createStylePreprocessorPlugin = (config) => ({
|
|
2514
2796
|
name: "absolute-style-preprocessor",
|
|
2515
2797
|
setup(build) {
|
|
@@ -2519,21 +2801,24 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
2519
2801
|
path: path.slice("absolute-style-module:".length)
|
|
2520
2802
|
}));
|
|
2521
2803
|
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2522
|
-
const
|
|
2523
|
-
if (!
|
|
2804
|
+
const source = cssModuleSources.get(path);
|
|
2805
|
+
if (!source) {
|
|
2524
2806
|
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2525
2807
|
}
|
|
2526
2808
|
return {
|
|
2527
|
-
contents:
|
|
2809
|
+
contents: source.css,
|
|
2528
2810
|
loader: "css"
|
|
2529
2811
|
};
|
|
2530
2812
|
});
|
|
2531
2813
|
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2532
2814
|
if (isStyleModulePath(path)) {
|
|
2533
2815
|
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2534
|
-
|
|
2816
|
+
const compiled = await compileStyleSource(path, undefined, undefined, config);
|
|
2817
|
+
const { css, exports } = extractCssModuleExports(compiled);
|
|
2818
|
+
cssModuleSources.set(cssModulePath, { css, exports });
|
|
2819
|
+
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}`)};`;
|
|
2535
2820
|
return {
|
|
2536
|
-
contents:
|
|
2821
|
+
contents: exportSource,
|
|
2537
2822
|
loader: "js"
|
|
2538
2823
|
};
|
|
2539
2824
|
}
|
|
@@ -2542,6 +2827,10 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
2542
2827
|
loader: "css"
|
|
2543
2828
|
};
|
|
2544
2829
|
});
|
|
2830
|
+
build.onLoad({ filter: CSS_EXTENSION_PATTERN }, async ({ path }) => ({
|
|
2831
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
2832
|
+
loader: "css"
|
|
2833
|
+
}));
|
|
2545
2834
|
}
|
|
2546
2835
|
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
2547
2836
|
style: async ({
|
|
@@ -2559,14 +2848,49 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
2559
2848
|
}
|
|
2560
2849
|
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
2561
2850
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2562
|
-
return readFile(filePath, "utf-8");
|
|
2851
|
+
return runPostcss(await readFile(filePath, "utf-8"), filePath, config);
|
|
2563
2852
|
}
|
|
2564
2853
|
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2565
|
-
}
|
|
2854
|
+
}, compileStyleFileIfNeededSync = (filePath, config) => {
|
|
2855
|
+
const rawContents = readFileSync3(filePath, "utf-8");
|
|
2856
|
+
const language = getStyleLanguage(filePath);
|
|
2857
|
+
if (config?.postcss) {
|
|
2858
|
+
throw new Error(`Unable to compile ${filePath}: PostCSS preprocessing is async-only.`);
|
|
2859
|
+
}
|
|
2860
|
+
if (language === "scss" || language === "sass") {
|
|
2861
|
+
const options = getSassOptions(config, language);
|
|
2862
|
+
const packageName = options.implementation ?? "sass";
|
|
2863
|
+
let sass;
|
|
2864
|
+
try {
|
|
2865
|
+
sass = requireOptionalPeerSync(packageName);
|
|
2866
|
+
} catch {
|
|
2867
|
+
throw missingDependencyError(packageName, filePath);
|
|
2868
|
+
}
|
|
2869
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2870
|
+
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
2871
|
+
return sass.compileString(contents, {
|
|
2872
|
+
importers: [
|
|
2873
|
+
createSassImporter(filePath, loadPaths, language, config)
|
|
2874
|
+
],
|
|
2875
|
+
loadPaths,
|
|
2876
|
+
style: "expanded",
|
|
2877
|
+
syntax: language === "sass" ? "indented" : "scss",
|
|
2878
|
+
url: new URL(`file://${filePath}`)
|
|
2879
|
+
}).css;
|
|
2880
|
+
}
|
|
2881
|
+
if (language === "less") {
|
|
2882
|
+
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
2883
|
+
}
|
|
2884
|
+
if (language === "stylus") {
|
|
2885
|
+
throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
2886
|
+
}
|
|
2887
|
+
return rawContents;
|
|
2888
|
+
}, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname3(filePath);
|
|
2566
2889
|
var init_stylePreprocessor = __esm(() => {
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2890
|
+
CSS_EXTENSION_PATTERN = /\.css$/i;
|
|
2891
|
+
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2892
|
+
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2893
|
+
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
2570
2894
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2571
2895
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2572
2896
|
requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
|
|
@@ -2575,9 +2899,9 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2575
2899
|
|
|
2576
2900
|
// src/core/svelteServerModule.ts
|
|
2577
2901
|
import { mkdir, readdir as readdir2 } from "fs/promises";
|
|
2578
|
-
import { basename as basename2, dirname as dirname4, extname as extname4, join as join6, relative as
|
|
2902
|
+
import { basename as basename2, dirname as dirname4, extname as extname4, join as join6, relative as relative4, resolve as resolve7 } from "path";
|
|
2579
2903
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2580
|
-
const importPath =
|
|
2904
|
+
const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
|
|
2581
2905
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2582
2906
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
2583
2907
|
for (const entry of entries) {
|
|
@@ -2641,7 +2965,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2641
2965
|
const foundIndex = existResults.indexOf(true);
|
|
2642
2966
|
return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
|
|
2643
2967
|
}, getCachedModulePath = (sourcePath) => {
|
|
2644
|
-
const relativeSourcePath =
|
|
2968
|
+
const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2645
2969
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2646
2970
|
return join6(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
2647
2971
|
}, resolveSvelteImport = async (spec, from) => {
|
|
@@ -2961,7 +3285,7 @@ var init_staticStreaming = __esm(() => {
|
|
|
2961
3285
|
});
|
|
2962
3286
|
|
|
2963
3287
|
// src/build/staticIslandPages.ts
|
|
2964
|
-
import { readFileSync as
|
|
3288
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
2965
3289
|
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) => {
|
|
2966
3290
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
2967
3291
|
const attributes = new Map;
|
|
@@ -3090,7 +3414,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
3090
3414
|
}
|
|
3091
3415
|
return result + originalHtml.slice(nextIndex);
|
|
3092
3416
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
3093
|
-
const originalHtml =
|
|
3417
|
+
const originalHtml = readFileSync4(pagePath, "utf-8");
|
|
3094
3418
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
3095
3419
|
if (transformedHtml !== originalHtml) {
|
|
3096
3420
|
writeFileSync3(pagePath, transformedHtml);
|
|
@@ -3143,10 +3467,10 @@ var init_outputLogs = __esm(() => {
|
|
|
3143
3467
|
});
|
|
3144
3468
|
|
|
3145
3469
|
// src/build/scanEntryPoints.ts
|
|
3146
|
-
import { existsSync as
|
|
3470
|
+
import { existsSync as existsSync6 } from "fs";
|
|
3147
3471
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
3148
3472
|
var scanEntryPoints = async (dir, pattern) => {
|
|
3149
|
-
if (!
|
|
3473
|
+
if (!existsSync6(dir))
|
|
3150
3474
|
return [];
|
|
3151
3475
|
const entryPaths = [];
|
|
3152
3476
|
const glob = new Glob2(pattern);
|
|
@@ -3160,7 +3484,7 @@ var init_scanEntryPoints = () => {};
|
|
|
3160
3484
|
// src/build/scanConventions.ts
|
|
3161
3485
|
import { basename as basename3 } from "path";
|
|
3162
3486
|
var {Glob: Glob3 } = globalThis.Bun;
|
|
3163
|
-
import { existsSync as
|
|
3487
|
+
import { existsSync as existsSync7 } from "fs";
|
|
3164
3488
|
var CONVENTION_RE, classifyFile = (file, pageFiles, defaults, pages) => {
|
|
3165
3489
|
const fileName = basename3(file);
|
|
3166
3490
|
const match = CONVENTION_RE.exec(fileName);
|
|
@@ -3185,7 +3509,7 @@ var CONVENTION_RE, classifyFile = (file, pageFiles, defaults, pages) => {
|
|
|
3185
3509
|
else if (kind === "loading")
|
|
3186
3510
|
pages[pageName].loading = file;
|
|
3187
3511
|
}, scanConventions = async (pagesDir, pattern) => {
|
|
3188
|
-
if (!
|
|
3512
|
+
if (!existsSync7(pagesDir)) {
|
|
3189
3513
|
const pageFiles2 = [];
|
|
3190
3514
|
return { conventions: undefined, pageFiles: pageFiles2 };
|
|
3191
3515
|
}
|
|
@@ -3208,13 +3532,13 @@ var init_scanConventions = __esm(() => {
|
|
|
3208
3532
|
});
|
|
3209
3533
|
|
|
3210
3534
|
// src/build/scanCssEntryPoints.ts
|
|
3211
|
-
import { existsSync as
|
|
3535
|
+
import { existsSync as existsSync8 } from "fs";
|
|
3212
3536
|
var {Glob: Glob4 } = globalThis.Bun;
|
|
3213
3537
|
var scanCssEntryPoints = async (dir, ignore) => {
|
|
3214
|
-
if (!
|
|
3538
|
+
if (!existsSync8(dir))
|
|
3215
3539
|
return [];
|
|
3216
3540
|
const entryPaths = [];
|
|
3217
|
-
const glob = new Glob4("**/*.{css,scss,sass,less}");
|
|
3541
|
+
const glob = new Glob4("**/*.{css,scss,sass,less,styl,stylus}");
|
|
3218
3542
|
for await (const file of glob.scan({ absolute: true, cwd: dir })) {
|
|
3219
3543
|
const normalized = normalizePath(file);
|
|
3220
3544
|
if (isStyleModulePath(normalized) || ignore?.some((pattern) => normalized.includes(pattern)))
|
|
@@ -3228,7 +3552,7 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
3228
3552
|
});
|
|
3229
3553
|
|
|
3230
3554
|
// src/utils/imageProcessing.ts
|
|
3231
|
-
import { existsSync as
|
|
3555
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
3232
3556
|
import { join as join7, resolve as resolve8 } from "path";
|
|
3233
3557
|
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) => {
|
|
3234
3558
|
for (const size of sizes) {
|
|
@@ -3283,7 +3607,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3283
3607
|
return [...device, ...image].sort((left, right) => left - right);
|
|
3284
3608
|
}, getCacheDir = (buildDir) => {
|
|
3285
3609
|
const dir = join7(buildDir, ".cache", "images");
|
|
3286
|
-
if (!
|
|
3610
|
+
if (!existsSync9(dir))
|
|
3287
3611
|
mkdirSync3(dir, { recursive: true });
|
|
3288
3612
|
return dir;
|
|
3289
3613
|
}, getCacheKey = (url, width, quality, format) => {
|
|
@@ -3341,11 +3665,11 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3341
3665
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
3342
3666
|
const metaPath = join7(cacheDir, `${cacheKey}.meta`);
|
|
3343
3667
|
const dataPath = join7(cacheDir, `${cacheKey}.data`);
|
|
3344
|
-
if (!
|
|
3668
|
+
if (!existsSync9(metaPath) || !existsSync9(dataPath))
|
|
3345
3669
|
return null;
|
|
3346
3670
|
try {
|
|
3347
|
-
const meta = JSON.parse(
|
|
3348
|
-
const buffer =
|
|
3671
|
+
const meta = JSON.parse(readFileSync5(metaPath, "utf-8"));
|
|
3672
|
+
const buffer = readFileSync5(dataPath);
|
|
3349
3673
|
return { buffer, meta };
|
|
3350
3674
|
} catch {
|
|
3351
3675
|
return null;
|
|
@@ -3460,14 +3784,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
3460
3784
|
});
|
|
3461
3785
|
|
|
3462
3786
|
// src/cli/scripts/telemetry.ts
|
|
3463
|
-
import { existsSync as
|
|
3787
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
3464
3788
|
import { homedir } from "os";
|
|
3465
3789
|
import { join as join8 } from "path";
|
|
3466
3790
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
3467
3791
|
try {
|
|
3468
|
-
if (!
|
|
3792
|
+
if (!existsSync10(configPath))
|
|
3469
3793
|
return null;
|
|
3470
|
-
const raw =
|
|
3794
|
+
const raw = readFileSync6(configPath, "utf-8");
|
|
3471
3795
|
const config = JSON.parse(raw);
|
|
3472
3796
|
return config;
|
|
3473
3797
|
} catch {
|
|
@@ -3480,14 +3804,14 @@ var init_telemetry = __esm(() => {
|
|
|
3480
3804
|
});
|
|
3481
3805
|
|
|
3482
3806
|
// src/cli/telemetryEvent.ts
|
|
3483
|
-
import { existsSync as
|
|
3807
|
+
import { existsSync as existsSync11, readFileSync as readFileSync7 } from "fs";
|
|
3484
3808
|
import { arch, platform } from "os";
|
|
3485
3809
|
import { dirname as dirname5, join as join9, parse } from "path";
|
|
3486
3810
|
var checkCandidate = (candidate) => {
|
|
3487
|
-
if (!
|
|
3811
|
+
if (!existsSync11(candidate)) {
|
|
3488
3812
|
return null;
|
|
3489
3813
|
}
|
|
3490
|
-
const pkg = JSON.parse(
|
|
3814
|
+
const pkg = JSON.parse(readFileSync7(candidate, "utf-8"));
|
|
3491
3815
|
if (pkg.name === "@absolutejs/absolute") {
|
|
3492
3816
|
const ver = pkg.version;
|
|
3493
3817
|
return ver;
|
|
@@ -3592,17 +3916,17 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
3592
3916
|
});
|
|
3593
3917
|
|
|
3594
3918
|
// src/dev/buildHMRClient.ts
|
|
3595
|
-
import { existsSync as
|
|
3919
|
+
import { existsSync as existsSync12 } from "fs";
|
|
3596
3920
|
import { resolve as resolve9 } from "path";
|
|
3597
3921
|
var {build: bunBuild } = globalThis.Bun;
|
|
3598
3922
|
var resolveHmrClientPath = () => {
|
|
3599
3923
|
const projectRoot = process.cwd();
|
|
3600
3924
|
const fromSource = resolve9(import.meta.dir, "client/hmrClient.ts");
|
|
3601
|
-
if (
|
|
3925
|
+
if (existsSync12(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3602
3926
|
return fromSource;
|
|
3603
3927
|
}
|
|
3604
3928
|
const fromNodeModules = resolve9(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
3605
|
-
if (
|
|
3929
|
+
if (existsSync12(fromNodeModules))
|
|
3606
3930
|
return fromNodeModules;
|
|
3607
3931
|
return resolve9(import.meta.dir, "dev/client/hmrClient.ts");
|
|
3608
3932
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
@@ -3794,8 +4118,8 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
3794
4118
|
};
|
|
3795
4119
|
|
|
3796
4120
|
// src/build/angularLinkerPlugin.ts
|
|
3797
|
-
import { existsSync as
|
|
3798
|
-
import { dirname as dirname6, join as join10, relative as
|
|
4121
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
|
|
4122
|
+
import { dirname as dirname6, join as join10, relative as relative5, resolve as resolve11 } from "path";
|
|
3799
4123
|
import { createHash } from "crypto";
|
|
3800
4124
|
var CACHE_DIR, angularLinkerPlugin;
|
|
3801
4125
|
var init_angularLinkerPlugin = __esm(() => {
|
|
@@ -3819,9 +4143,9 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3819
4143
|
}
|
|
3820
4144
|
const hash = createHash("md5").update(source).digest("hex");
|
|
3821
4145
|
const cachePath = join10(CACHE_DIR, `${hash}.js`);
|
|
3822
|
-
if (
|
|
4146
|
+
if (existsSync13(cachePath)) {
|
|
3823
4147
|
return {
|
|
3824
|
-
contents:
|
|
4148
|
+
contents: readFileSync8(cachePath, "utf-8"),
|
|
3825
4149
|
loader: "js"
|
|
3826
4150
|
};
|
|
3827
4151
|
}
|
|
@@ -3836,9 +4160,9 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3836
4160
|
linkerPlugin = mod.createEs2015LinkerPlugin({
|
|
3837
4161
|
fileSystem: {
|
|
3838
4162
|
dirname: dirname6,
|
|
3839
|
-
exists:
|
|
3840
|
-
readFile:
|
|
3841
|
-
relative:
|
|
4163
|
+
exists: existsSync13,
|
|
4164
|
+
readFile: readFileSync8,
|
|
4165
|
+
relative: relative5,
|
|
3842
4166
|
resolve: resolve11
|
|
3843
4167
|
},
|
|
3844
4168
|
linkerJitMode: false,
|
|
@@ -3879,11 +4203,11 @@ var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPath
|
|
|
3879
4203
|
const currentPaths = new Set(currentOutputPaths.map((path) => resolve12(path)));
|
|
3880
4204
|
const glob = new Glob5("**/*");
|
|
3881
4205
|
const removals = [];
|
|
3882
|
-
for (const
|
|
3883
|
-
const absolute = resolve12(buildPath,
|
|
4206
|
+
for (const relative6 of glob.scanSync({ cwd: buildPath })) {
|
|
4207
|
+
const absolute = resolve12(buildPath, relative6);
|
|
3884
4208
|
if (currentPaths.has(absolute))
|
|
3885
4209
|
continue;
|
|
3886
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
4210
|
+
if (!HASHED_FILE_PATTERN.test(relative6))
|
|
3887
4211
|
continue;
|
|
3888
4212
|
removals.push(rm2(absolute, { force: true }));
|
|
3889
4213
|
}
|
|
@@ -3941,11 +4265,11 @@ var commonAncestor = (paths, fallback) => {
|
|
|
3941
4265
|
var init_commonAncestor = () => {};
|
|
3942
4266
|
|
|
3943
4267
|
// src/utils/validateSafePath.ts
|
|
3944
|
-
import { resolve as resolve13, relative as
|
|
4268
|
+
import { resolve as resolve13, relative as relative6 } from "path";
|
|
3945
4269
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
3946
4270
|
const absoluteBase = resolve13(baseDirectory);
|
|
3947
4271
|
const absoluteTarget = resolve13(baseDirectory, targetPath);
|
|
3948
|
-
const relativePath = normalizePath(
|
|
4272
|
+
const relativePath = normalizePath(relative6(absoluteBase, absoluteTarget));
|
|
3949
4273
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
3950
4274
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
3951
4275
|
}
|
|
@@ -4091,7 +4415,7 @@ __export(exports_compileSvelte, {
|
|
|
4091
4415
|
compileSvelte: () => compileSvelte,
|
|
4092
4416
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
4093
4417
|
});
|
|
4094
|
-
import { existsSync as
|
|
4418
|
+
import { existsSync as existsSync14 } from "fs";
|
|
4095
4419
|
import { mkdir as mkdir2, stat } from "fs/promises";
|
|
4096
4420
|
import {
|
|
4097
4421
|
dirname as dirname7,
|
|
@@ -4099,7 +4423,7 @@ import {
|
|
|
4099
4423
|
basename as basename4,
|
|
4100
4424
|
extname as extname5,
|
|
4101
4425
|
resolve as resolve14,
|
|
4102
|
-
relative as
|
|
4426
|
+
relative as relative7,
|
|
4103
4427
|
sep as sep2
|
|
4104
4428
|
} from "path";
|
|
4105
4429
|
import { env } from "process";
|
|
@@ -4107,11 +4431,11 @@ var {write, file, Transpiler } = globalThis.Bun;
|
|
|
4107
4431
|
var resolveDevClientDir2 = () => {
|
|
4108
4432
|
const projectRoot = process.cwd();
|
|
4109
4433
|
const fromSource = resolve14(import.meta.dir, "../dev/client");
|
|
4110
|
-
if (
|
|
4434
|
+
if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4111
4435
|
return fromSource;
|
|
4112
4436
|
}
|
|
4113
4437
|
const fromNodeModules = resolve14(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
4114
|
-
if (
|
|
4438
|
+
if (existsSync14(fromNodeModules))
|
|
4115
4439
|
return fromNodeModules;
|
|
4116
4440
|
return resolve14(import.meta.dir, "./dev/client");
|
|
4117
4441
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
@@ -4191,8 +4515,8 @@ var resolveDevClientDir2 = () => {
|
|
|
4191
4515
|
return jsPath;
|
|
4192
4516
|
return null;
|
|
4193
4517
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
4194
|
-
const toServer =
|
|
4195
|
-
const toClient =
|
|
4518
|
+
const toServer = relative7(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
4519
|
+
const toClient = relative7(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
4196
4520
|
rewrites.set(rawSpec, {
|
|
4197
4521
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
4198
4522
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -4230,8 +4554,8 @@ var resolveDevClientDir2 = () => {
|
|
|
4230
4554
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
4231
4555
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
4232
4556
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedClient) : preprocessedClient;
|
|
4233
|
-
const rawRel = dirname7(
|
|
4234
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
4557
|
+
const rawRel = dirname7(relative7(svelteRoot, src)).replace(/\\/g, "/");
|
|
4558
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative7(process.cwd(), dirname7(src)).replace(/\\/g, "/")}` : rawRel;
|
|
4235
4559
|
const baseName = basename4(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
4236
4560
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
4237
4561
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -4252,15 +4576,15 @@ var resolveDevClientDir2 = () => {
|
|
|
4252
4576
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
4253
4577
|
if (!resolved)
|
|
4254
4578
|
continue;
|
|
4255
|
-
const childRel =
|
|
4579
|
+
const childRel = relative7(svelteRoot, resolved).replace(/\\/g, "/");
|
|
4256
4580
|
if (!childRel.startsWith(".."))
|
|
4257
4581
|
continue;
|
|
4258
4582
|
const childBuilt2 = cache.get(resolved);
|
|
4259
4583
|
if (!childBuilt2)
|
|
4260
4584
|
continue;
|
|
4261
4585
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
4262
|
-
const toServer =
|
|
4263
|
-
const toClient =
|
|
4586
|
+
const toServer = relative7(ssrOutputDir, childBuilt2.ssr).replace(/\\/g, "/");
|
|
4587
|
+
const toClient = relative7(clientOutputDir, childBuilt2.client).replace(/\\/g, "/");
|
|
4264
4588
|
externalRewrites.set(origSpec, {
|
|
4265
4589
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
4266
4590
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -4295,7 +4619,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4295
4619
|
}).js.code;
|
|
4296
4620
|
let code = compiled.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
4297
4621
|
if (mode === "client" && isDev) {
|
|
4298
|
-
const moduleKey = `/@src/${
|
|
4622
|
+
const moduleKey = `/@src/${relative7(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
4299
4623
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
4300
4624
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
4301
4625
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -4338,10 +4662,10 @@ var resolveDevClientDir2 = () => {
|
|
|
4338
4662
|
};
|
|
4339
4663
|
const roots = await Promise.all(entryPoints.map(build));
|
|
4340
4664
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
4341
|
-
const relClientDir = dirname7(
|
|
4665
|
+
const relClientDir = dirname7(relative7(clientDir, client));
|
|
4342
4666
|
const name = basename4(client, extname5(client));
|
|
4343
4667
|
const indexPath = join12(indexDir, relClientDir, `${name}.js`);
|
|
4344
|
-
const importRaw =
|
|
4668
|
+
const importRaw = relative7(dirname7(indexPath), client).split(sep2).join("/");
|
|
4345
4669
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
4346
4670
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
4347
4671
|
import "${hmrClientPath3}";
|
|
@@ -4418,7 +4742,7 @@ if (typeof window !== "undefined") {
|
|
|
4418
4742
|
return {
|
|
4419
4743
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
4420
4744
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
4421
|
-
const rel = dirname7(
|
|
4745
|
+
const rel = dirname7(relative7(clientDir, client));
|
|
4422
4746
|
return join12(indexDir, rel, basename4(client));
|
|
4423
4747
|
}),
|
|
4424
4748
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
@@ -4448,18 +4772,18 @@ __export(exports_compileVue, {
|
|
|
4448
4772
|
compileVue: () => compileVue,
|
|
4449
4773
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
4450
4774
|
});
|
|
4451
|
-
import { existsSync as
|
|
4775
|
+
import { existsSync as existsSync15 } from "fs";
|
|
4452
4776
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
4453
|
-
import { basename as basename5, dirname as dirname8, join as join13, relative as
|
|
4777
|
+
import { basename as basename5, dirname as dirname8, join as join13, relative as relative8, resolve as resolve15 } from "path";
|
|
4454
4778
|
var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
4455
4779
|
var resolveDevClientDir3 = () => {
|
|
4456
4780
|
const projectRoot = process.cwd();
|
|
4457
4781
|
const fromSource = resolve15(import.meta.dir, "../dev/client");
|
|
4458
|
-
if (
|
|
4782
|
+
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4459
4783
|
return fromSource;
|
|
4460
4784
|
}
|
|
4461
4785
|
const fromNodeModules = resolve15(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
4462
|
-
if (
|
|
4786
|
+
if (existsSync15(fromNodeModules))
|
|
4463
4787
|
return fromNodeModules;
|
|
4464
4788
|
return resolve15(import.meta.dir, "./dev/client");
|
|
4465
4789
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
@@ -4500,7 +4824,7 @@ var resolveDevClientDir3 = () => {
|
|
|
4500
4824
|
return "template-only";
|
|
4501
4825
|
}
|
|
4502
4826
|
return "full";
|
|
4503
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
4827
|
+
}, 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) => {
|
|
4504
4828
|
if (filePath.endsWith(".vue"))
|
|
4505
4829
|
return filePath.replace(/\.vue$/, ".js");
|
|
4506
4830
|
if (filePath.endsWith(".ts"))
|
|
@@ -4527,7 +4851,7 @@ var resolveDevClientDir3 = () => {
|
|
|
4527
4851
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
4528
4852
|
if (cachedResult)
|
|
4529
4853
|
return cachedResult;
|
|
4530
|
-
const relativeFilePath =
|
|
4854
|
+
const relativeFilePath = relative8(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
4531
4855
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
4532
4856
|
const fileBaseName = basename5(sourceFilePath, ".vue");
|
|
4533
4857
|
const componentId = toKebab(fileBaseName);
|
|
@@ -4651,7 +4975,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4651
4975
|
let result2 = code;
|
|
4652
4976
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
4653
4977
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
4654
|
-
let rel =
|
|
4978
|
+
let rel = relative8(dirname8(outputPath), targetPath).replace(/\\/g, "/");
|
|
4655
4979
|
if (!rel.startsWith("."))
|
|
4656
4980
|
rel = `./${rel}`;
|
|
4657
4981
|
result2 = result2.replaceAll(bareImport, rel);
|
|
@@ -4700,7 +5024,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4700
5024
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
4701
5025
|
const entryBaseName = basename5(entryPath, ".vue");
|
|
4702
5026
|
const indexOutputFile = join13(indexOutputDir, `${entryBaseName}.js`);
|
|
4703
|
-
const clientOutputFile = join13(clientOutputDir,
|
|
5027
|
+
const clientOutputFile = join13(clientOutputDir, relative8(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
4704
5028
|
await mkdir3(dirname8(indexOutputFile), { recursive: true });
|
|
4705
5029
|
const vueHmrImports = isDev ? [
|
|
4706
5030
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -4708,7 +5032,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4708
5032
|
] : [];
|
|
4709
5033
|
await write2(indexOutputFile, [
|
|
4710
5034
|
...vueHmrImports,
|
|
4711
|
-
`import Comp from "${
|
|
5035
|
+
`import Comp from "${relative8(dirname8(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
4712
5036
|
'import { createSSRApp, createApp } from "vue";',
|
|
4713
5037
|
"",
|
|
4714
5038
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -4828,7 +5152,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4828
5152
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
4829
5153
|
const sourceCode = await file2(tsPath).text();
|
|
4830
5154
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
4831
|
-
const relativeJsPath =
|
|
5155
|
+
const relativeJsPath = relative8(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
4832
5156
|
const outClientPath = join13(clientOutputDir, relativeJsPath);
|
|
4833
5157
|
const outServerPath = join13(serverOutputDir, relativeJsPath);
|
|
4834
5158
|
await mkdir3(dirname8(outClientPath), { recursive: true });
|
|
@@ -5329,13 +5653,13 @@ __export(exports_compileAngular, {
|
|
|
5329
5653
|
compileAngularFile: () => compileAngularFile,
|
|
5330
5654
|
compileAngular: () => compileAngular
|
|
5331
5655
|
});
|
|
5332
|
-
import { existsSync as
|
|
5333
|
-
import { join as join14, basename as basename6, sep as sep3, dirname as dirname9, resolve as resolve16, relative as
|
|
5656
|
+
import { existsSync as existsSync16, readFileSync as readFileSync9, promises as fs } from "fs";
|
|
5657
|
+
import { join as join14, basename as basename6, sep as sep3, dirname as dirname9, resolve as resolve16, relative as relative9 } from "path";
|
|
5334
5658
|
import ts2 from "typescript";
|
|
5335
5659
|
import { createHash as createHash2 } from "crypto";
|
|
5336
5660
|
var computeConfigHash = () => {
|
|
5337
5661
|
try {
|
|
5338
|
-
const content =
|
|
5662
|
+
const content = readFileSync9("./tsconfig.json", "utf-8");
|
|
5339
5663
|
return createHash2("md5").update(content).digest("hex");
|
|
5340
5664
|
} catch {
|
|
5341
5665
|
return "";
|
|
@@ -5343,11 +5667,11 @@ var computeConfigHash = () => {
|
|
|
5343
5667
|
}, resolveDevClientDir4 = () => {
|
|
5344
5668
|
const projectRoot = process.cwd();
|
|
5345
5669
|
const fromSource = resolve16(import.meta.dir, "../dev/client");
|
|
5346
|
-
if (
|
|
5670
|
+
if (existsSync16(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
5347
5671
|
return fromSource;
|
|
5348
5672
|
}
|
|
5349
5673
|
const fromNodeModules = resolve16(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
5350
|
-
if (
|
|
5674
|
+
if (existsSync16(fromNodeModules))
|
|
5351
5675
|
return fromNodeModules;
|
|
5352
5676
|
return resolve16(import.meta.dir, "./dev/client");
|
|
5353
5677
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
@@ -5426,7 +5750,7 @@ ${registrations}
|
|
|
5426
5750
|
join14(basePath, "index.mts"),
|
|
5427
5751
|
join14(basePath, "index.cts")
|
|
5428
5752
|
];
|
|
5429
|
-
return candidates.map((candidate) => resolve16(candidate)).find((candidate) =>
|
|
5753
|
+
return candidates.map((candidate) => resolve16(candidate)).find((candidate) => existsSync16(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
5430
5754
|
}, readFileForAotTransform = async (fileName, readFile4) => {
|
|
5431
5755
|
const hostSource = readFile4?.(fileName);
|
|
5432
5756
|
if (typeof hostSource === "string")
|
|
@@ -5440,7 +5764,7 @@ ${registrations}
|
|
|
5440
5764
|
if (visited.has(resolvedPath))
|
|
5441
5765
|
return;
|
|
5442
5766
|
visited.add(resolvedPath);
|
|
5443
|
-
if (!
|
|
5767
|
+
if (!existsSync16(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
5444
5768
|
return;
|
|
5445
5769
|
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
5446
5770
|
const transformed = await inlineResources(source, dirname9(resolvedPath), stylePreprocessors);
|
|
@@ -5455,7 +5779,7 @@ ${registrations}
|
|
|
5455
5779
|
await transformFile(inputPath);
|
|
5456
5780
|
return transformedSources;
|
|
5457
5781
|
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
5458
|
-
const islandMetadataExports = buildIslandMetadataExports(
|
|
5782
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync9(inputPath, "utf-8"));
|
|
5459
5783
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
5460
5784
|
const configHash = computeConfigHash();
|
|
5461
5785
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -5577,7 +5901,7 @@ ${registrations}
|
|
|
5577
5901
|
return entries.map(({ target }) => target);
|
|
5578
5902
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
5579
5903
|
const sourceEntry = resolve16(import.meta.dir, "../angular/components/index.ts");
|
|
5580
|
-
if (
|
|
5904
|
+
if (existsSync16(sourceEntry)) {
|
|
5581
5905
|
return sourceEntry.replace(/\\/g, "/");
|
|
5582
5906
|
}
|
|
5583
5907
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -5705,7 +6029,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
5705
6029
|
${fields}
|
|
5706
6030
|
`);
|
|
5707
6031
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
5708
|
-
if (!
|
|
6032
|
+
if (!existsSync16(filePath))
|
|
5709
6033
|
return null;
|
|
5710
6034
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
5711
6035
|
return escapeTemplateContent(content);
|
|
@@ -5713,7 +6037,7 @@ ${fields}
|
|
|
5713
6037
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5714
6038
|
if (templateUrlMatch?.[1]) {
|
|
5715
6039
|
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
5716
|
-
if (!
|
|
6040
|
+
if (!existsSync16(templatePath)) {
|
|
5717
6041
|
return { deferSlots: [], source };
|
|
5718
6042
|
}
|
|
5719
6043
|
const templateRaw2 = await fs.readFile(templatePath, "utf-8");
|
|
@@ -5744,10 +6068,10 @@ ${fields}
|
|
|
5744
6068
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5745
6069
|
if (templateUrlMatch?.[1]) {
|
|
5746
6070
|
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
5747
|
-
if (!
|
|
6071
|
+
if (!existsSync16(templatePath)) {
|
|
5748
6072
|
return { deferSlots: [], source };
|
|
5749
6073
|
}
|
|
5750
|
-
const templateRaw2 =
|
|
6074
|
+
const templateRaw2 = readFileSync9(templatePath, "utf-8");
|
|
5751
6075
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
5752
6076
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
5753
6077
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -5858,7 +6182,7 @@ ${fields}
|
|
|
5858
6182
|
let actualPath = resolved;
|
|
5859
6183
|
if (!actualPath.endsWith(".ts"))
|
|
5860
6184
|
actualPath += ".ts";
|
|
5861
|
-
if (!
|
|
6185
|
+
if (!existsSync16(actualPath))
|
|
5862
6186
|
return;
|
|
5863
6187
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
5864
6188
|
const inlined = await inlineResources(sourceCode, dirname9(actualPath), stylePreprocessors);
|
|
@@ -5882,7 +6206,7 @@ ${fields}
|
|
|
5882
6206
|
}
|
|
5883
6207
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
5884
6208
|
const cacheKey2 = actualPath;
|
|
5885
|
-
if (jitContentCache.get(cacheKey2) === contentHash &&
|
|
6209
|
+
if (jitContentCache.get(cacheKey2) === contentHash && existsSync16(targetPath)) {
|
|
5886
6210
|
allOutputs.push(targetPath);
|
|
5887
6211
|
} else {
|
|
5888
6212
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath);
|
|
@@ -5910,7 +6234,7 @@ ${fields}
|
|
|
5910
6234
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
5911
6235
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
5912
6236
|
const resolvedEntry = resolve16(entry);
|
|
5913
|
-
const relativeEntry =
|
|
6237
|
+
const relativeEntry = relative9(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
5914
6238
|
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
5915
6239
|
let outputs = await compileEntry();
|
|
5916
6240
|
const fileBase = basename6(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
@@ -5925,12 +6249,12 @@ ${fields}
|
|
|
5925
6249
|
...candidatePaths.map((file3) => resolve16(file3)),
|
|
5926
6250
|
...compiledFallbackPaths
|
|
5927
6251
|
];
|
|
5928
|
-
let candidate = normalizedCandidates.find((file3) =>
|
|
6252
|
+
let candidate = normalizedCandidates.find((file3) => existsSync16(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
5929
6253
|
if (!candidate) {
|
|
5930
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
6254
|
+
candidate = normalizedCandidates.find((file3) => existsSync16(file3) && file3.endsWith(`${sep3}${jsName}`));
|
|
5931
6255
|
}
|
|
5932
6256
|
if (!candidate) {
|
|
5933
|
-
candidate = normalizedCandidates.find((file3) =>
|
|
6257
|
+
candidate = normalizedCandidates.find((file3) => existsSync16(file3));
|
|
5934
6258
|
}
|
|
5935
6259
|
return candidate;
|
|
5936
6260
|
};
|
|
@@ -5938,11 +6262,11 @@ ${fields}
|
|
|
5938
6262
|
if (!rawServerFile) {
|
|
5939
6263
|
rawServerFile = resolveRawServerFile([]);
|
|
5940
6264
|
}
|
|
5941
|
-
if (rawServerFile && !
|
|
6265
|
+
if (rawServerFile && !existsSync16(rawServerFile)) {
|
|
5942
6266
|
outputs = await compileEntry();
|
|
5943
6267
|
rawServerFile = resolveRawServerFile(outputs);
|
|
5944
6268
|
}
|
|
5945
|
-
if (!rawServerFile || !
|
|
6269
|
+
if (!rawServerFile || !existsSync16(rawServerFile)) {
|
|
5946
6270
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
5947
6271
|
...outputs,
|
|
5948
6272
|
...compiledFallbackPaths
|
|
@@ -5953,7 +6277,7 @@ ${fields}
|
|
|
5953
6277
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
5954
6278
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
5955
6279
|
const clientFile = join14(indexesDir, jsName);
|
|
5956
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
6280
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync16(clientFile)) {
|
|
5957
6281
|
return {
|
|
5958
6282
|
clientPath: clientFile,
|
|
5959
6283
|
indexUnchanged: true,
|
|
@@ -5987,7 +6311,7 @@ export default ${componentClassName};
|
|
|
5987
6311
|
await fs.writeFile(ssrDepsFile, ssrDepsContent, "utf-8");
|
|
5988
6312
|
}
|
|
5989
6313
|
await fs.writeFile(rawServerFile, rewritten, "utf-8");
|
|
5990
|
-
const relativePath =
|
|
6314
|
+
const relativePath = relative9(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
5991
6315
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
5992
6316
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
5993
6317
|
import "${hmrRuntimePath}";
|
|
@@ -6152,7 +6476,7 @@ __export(exports_buildReactVendor, {
|
|
|
6152
6476
|
computeVendorPaths: () => computeVendorPaths,
|
|
6153
6477
|
buildReactVendor: () => buildReactVendor
|
|
6154
6478
|
});
|
|
6155
|
-
import { existsSync as
|
|
6479
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync6 } from "fs";
|
|
6156
6480
|
import { join as join15, resolve as resolve17 } from "path";
|
|
6157
6481
|
import { rm as rm4 } from "fs/promises";
|
|
6158
6482
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
@@ -6166,7 +6490,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
6166
6490
|
resolve17(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
6167
6491
|
];
|
|
6168
6492
|
for (const candidate of candidates) {
|
|
6169
|
-
if (
|
|
6493
|
+
if (existsSync17(candidate)) {
|
|
6170
6494
|
return candidate.replace(/\\/g, "/");
|
|
6171
6495
|
}
|
|
6172
6496
|
}
|
|
@@ -6342,11 +6666,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
6342
6666
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
6343
6667
|
return;
|
|
6344
6668
|
}
|
|
6345
|
-
const { readFileSync:
|
|
6669
|
+
const { readFileSync: readFileSync10, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
6346
6670
|
const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
6347
6671
|
for (const file3 of files) {
|
|
6348
6672
|
const filePath = join17(vendorDir, file3);
|
|
6349
|
-
const content =
|
|
6673
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
6350
6674
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
6351
6675
|
continue;
|
|
6352
6676
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -6469,14 +6793,14 @@ var init_rewriteImports = __esm(() => {
|
|
|
6469
6793
|
import {
|
|
6470
6794
|
copyFileSync,
|
|
6471
6795
|
cpSync,
|
|
6472
|
-
existsSync as
|
|
6796
|
+
existsSync as existsSync18,
|
|
6473
6797
|
mkdirSync as mkdirSync10,
|
|
6474
|
-
readFileSync as
|
|
6798
|
+
readFileSync as readFileSync10,
|
|
6475
6799
|
rmSync as rmSync2,
|
|
6476
6800
|
statSync,
|
|
6477
6801
|
writeFileSync as writeFileSync7
|
|
6478
6802
|
} from "fs";
|
|
6479
|
-
import { basename as basename7, dirname as dirname10, join as join19, relative as
|
|
6803
|
+
import { basename as basename7, dirname as dirname10, join as join19, relative as relative10, resolve as resolve18 } from "path";
|
|
6480
6804
|
import { cwd, env as env2, exit } from "process";
|
|
6481
6805
|
var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
|
|
6482
6806
|
var isDev, collectConventionSourceFiles = (entry) => {
|
|
@@ -6592,7 +6916,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6592
6916
|
addWorkerPathIfExists(file3, relPath, workerPaths);
|
|
6593
6917
|
}
|
|
6594
6918
|
}, collectWorkerPathsFromFile = (file3, patterns, workerPaths) => {
|
|
6595
|
-
const content =
|
|
6919
|
+
const content = readFileSync10(file3, "utf-8");
|
|
6596
6920
|
for (const pattern of patterns) {
|
|
6597
6921
|
collectWorkerPathsFromContent(content, pattern, file3, workerPaths);
|
|
6598
6922
|
}
|
|
@@ -6637,13 +6961,13 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6637
6961
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
6638
6962
|
}
|
|
6639
6963
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
6640
|
-
if (!
|
|
6964
|
+
if (!existsSync18(reactIndexesPath)) {
|
|
6641
6965
|
return;
|
|
6642
6966
|
}
|
|
6643
6967
|
const indexFiles = readDir(reactIndexesPath).filter((file3) => file3.endsWith(".tsx"));
|
|
6644
|
-
const pagesRel =
|
|
6968
|
+
const pagesRel = relative10(process.cwd(), resolve18(reactPagesPath)).replace(/\\/g, "/");
|
|
6645
6969
|
for (const file3 of indexFiles) {
|
|
6646
|
-
let content =
|
|
6970
|
+
let content = readFileSync10(join19(reactIndexesPath, file3), "utf-8");
|
|
6647
6971
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
6648
6972
|
writeFileSync7(join19(devIndexDir, file3), content);
|
|
6649
6973
|
}
|
|
@@ -6653,10 +6977,10 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6653
6977
|
for (const entry of sveltePageEntries) {
|
|
6654
6978
|
const name = basename7(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
6655
6979
|
const indexFile = join19(svelteIndexDir, "pages", `${name}.js`);
|
|
6656
|
-
if (!
|
|
6980
|
+
if (!existsSync18(indexFile))
|
|
6657
6981
|
continue;
|
|
6658
|
-
let content =
|
|
6659
|
-
const srcRel =
|
|
6982
|
+
let content = readFileSync10(indexFile, "utf-8");
|
|
6983
|
+
const srcRel = relative10(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
6660
6984
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
6661
6985
|
writeFileSync7(join19(devIndexDir, `${name}.svelte.js`), content);
|
|
6662
6986
|
}
|
|
@@ -6666,10 +6990,10 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6666
6990
|
for (const entry of vuePageEntries) {
|
|
6667
6991
|
const name = basename7(entry, ".vue");
|
|
6668
6992
|
const indexFile = join19(vueIndexDir, `${name}.js`);
|
|
6669
|
-
if (!
|
|
6993
|
+
if (!existsSync18(indexFile))
|
|
6670
6994
|
continue;
|
|
6671
|
-
let content =
|
|
6672
|
-
const srcRel =
|
|
6995
|
+
let content = readFileSync10(indexFile, "utf-8");
|
|
6996
|
+
const srcRel = relative10(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
6673
6997
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
6674
6998
|
writeFileSync7(join19(devIndexDir, `${name}.vue.js`), content);
|
|
6675
6999
|
}
|
|
@@ -6719,7 +7043,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6719
7043
|
}
|
|
6720
7044
|
return result;
|
|
6721
7045
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
6722
|
-
let content =
|
|
7046
|
+
let content = readFileSync10(outputPath, "utf-8");
|
|
6723
7047
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
6724
7048
|
const useNames = [];
|
|
6725
7049
|
let match;
|
|
@@ -6744,7 +7068,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6744
7068
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
6745
7069
|
const urlFileMap = new Map;
|
|
6746
7070
|
for (const srcPath of urlReferencedFiles) {
|
|
6747
|
-
const rel =
|
|
7071
|
+
const rel = relative10(projectRoot, srcPath).replace(/\\/g, "/");
|
|
6748
7072
|
const name = basename7(srcPath);
|
|
6749
7073
|
const mtime = Math.round(statSync(srcPath).mtimeMs);
|
|
6750
7074
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -6759,7 +7083,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6759
7083
|
const output = nonReactClientOutputs.find((artifact) => basename7(artifact.path).startsWith(`${srcBase}.`));
|
|
6760
7084
|
if (!output)
|
|
6761
7085
|
continue;
|
|
6762
|
-
urlFileMap.set(basename7(srcPath), `/${
|
|
7086
|
+
urlFileMap.set(basename7(srcPath), `/${relative10(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
6763
7087
|
}
|
|
6764
7088
|
return urlFileMap;
|
|
6765
7089
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -6769,7 +7093,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6769
7093
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
6770
7094
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
6771
7095
|
for (const outputPath of outputPaths) {
|
|
6772
|
-
let content =
|
|
7096
|
+
let content = readFileSync10(outputPath, "utf-8");
|
|
6773
7097
|
let changed = false;
|
|
6774
7098
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
6775
7099
|
const targetName = basename7(relPath);
|
|
@@ -6795,6 +7119,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6795
7119
|
vueDirectory,
|
|
6796
7120
|
stylesConfig,
|
|
6797
7121
|
stylePreprocessors,
|
|
7122
|
+
postcss,
|
|
6798
7123
|
tailwind,
|
|
6799
7124
|
options,
|
|
6800
7125
|
incrementalFiles,
|
|
@@ -6804,7 +7129,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6804
7129
|
const projectRoot = cwd();
|
|
6805
7130
|
await resolveAbsoluteVersion();
|
|
6806
7131
|
const isIncremental = incrementalFiles && incrementalFiles.length > 0;
|
|
6807
|
-
const
|
|
7132
|
+
const styleTransformConfig = createStyleTransformConfig(stylePreprocessors, postcss);
|
|
7133
|
+
const stylePreprocessorPlugin2 = createStylePreprocessorPlugin(styleTransformConfig);
|
|
6808
7134
|
const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
|
|
6809
7135
|
const throwOnError = options?.throwOnError === true;
|
|
6810
7136
|
const hmr = options?.injectHMR === true;
|
|
@@ -7000,28 +7326,28 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7000
7326
|
{ vueClientPaths: islandVueClientPaths },
|
|
7001
7327
|
{ clientPaths: islandAngularClientPaths }
|
|
7002
7328
|
] = await Promise.all([
|
|
7003
|
-
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr,
|
|
7329
|
+
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr, styleTransformConfig)) : {
|
|
7004
7330
|
svelteClientPaths: [...emptyStringArray],
|
|
7005
7331
|
svelteIndexPaths: [...emptyStringArray],
|
|
7006
7332
|
svelteServerPaths: [...emptyStringArray]
|
|
7007
7333
|
},
|
|
7008
|
-
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr,
|
|
7334
|
+
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr, styleTransformConfig)) : {
|
|
7009
7335
|
vueClientPaths: [...emptyStringArray],
|
|
7010
7336
|
vueCssPaths: [...emptyStringArray],
|
|
7011
7337
|
vueIndexPaths: [...emptyStringArray],
|
|
7012
7338
|
vueServerPaths: [...emptyStringArray]
|
|
7013
7339
|
},
|
|
7014
|
-
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr,
|
|
7340
|
+
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr, styleTransformConfig)) : {
|
|
7015
7341
|
clientPaths: [...emptyStringArray],
|
|
7016
7342
|
serverPaths: [...emptyStringArray]
|
|
7017
7343
|
},
|
|
7018
|
-
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr,
|
|
7344
|
+
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr, styleTransformConfig)) : {
|
|
7019
7345
|
svelteClientPaths: [...emptyStringArray]
|
|
7020
7346
|
},
|
|
7021
|
-
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr,
|
|
7347
|
+
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr, styleTransformConfig)) : {
|
|
7022
7348
|
vueClientPaths: [...emptyStringArray]
|
|
7023
7349
|
},
|
|
7024
|
-
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr,
|
|
7350
|
+
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr, styleTransformConfig)) : {
|
|
7025
7351
|
clientPaths: [...emptyStringArray]
|
|
7026
7352
|
}
|
|
7027
7353
|
]);
|
|
@@ -7053,8 +7379,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7053
7379
|
const vueConventionSources = collectConventionSourceFiles(conventionsMap.vue);
|
|
7054
7380
|
if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
|
|
7055
7381
|
const [svelteConvResult, vueConvResult] = await Promise.all([
|
|
7056
|
-
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false,
|
|
7057
|
-
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false,
|
|
7382
|
+
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false, styleTransformConfig)) : { svelteServerPaths: emptyStringArray },
|
|
7383
|
+
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false, styleTransformConfig)) : { vueServerPaths: emptyStringArray }
|
|
7058
7384
|
]);
|
|
7059
7385
|
const copyConventionFiles = (framework, sources, compiledPaths) => {
|
|
7060
7386
|
const destDir = join19(buildPath, "conventions", framework);
|
|
@@ -7426,7 +7752,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7426
7752
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
7427
7753
|
if (!hmrClientBundle)
|
|
7428
7754
|
return;
|
|
7429
|
-
let html =
|
|
7755
|
+
let html = readFileSync10(filePath, "utf-8");
|
|
7430
7756
|
if (html.includes("data-hmr-client"))
|
|
7431
7757
|
return;
|
|
7432
7758
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -7587,7 +7913,7 @@ var init_build = __esm(() => {
|
|
|
7587
7913
|
});
|
|
7588
7914
|
|
|
7589
7915
|
// src/dev/dependencyGraph.ts
|
|
7590
|
-
import { existsSync as
|
|
7916
|
+
import { existsSync as existsSync19, readFileSync as readFileSync11 } from "fs";
|
|
7591
7917
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
7592
7918
|
import { resolve as resolve19 } from "path";
|
|
7593
7919
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -7599,7 +7925,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7599
7925
|
if (lower.endsWith(".html") || lower.endsWith(".htm"))
|
|
7600
7926
|
return "html";
|
|
7601
7927
|
return null;
|
|
7602
|
-
},
|
|
7928
|
+
}, resolveImportPath2 = (importPath, fromFile) => {
|
|
7603
7929
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
7604
7930
|
return null;
|
|
7605
7931
|
}
|
|
@@ -7617,10 +7943,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7617
7943
|
];
|
|
7618
7944
|
for (const ext of extensions) {
|
|
7619
7945
|
const withExt = normalized + ext;
|
|
7620
|
-
if (
|
|
7946
|
+
if (existsSync19(withExt))
|
|
7621
7947
|
return withExt;
|
|
7622
7948
|
}
|
|
7623
|
-
if (
|
|
7949
|
+
if (existsSync19(normalized))
|
|
7624
7950
|
return normalized;
|
|
7625
7951
|
return null;
|
|
7626
7952
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -7635,7 +7961,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7635
7961
|
}
|
|
7636
7962
|
}, addFileToGraph = (graph, filePath) => {
|
|
7637
7963
|
const normalizedPath = resolve19(filePath);
|
|
7638
|
-
if (!
|
|
7964
|
+
if (!existsSync19(normalizedPath))
|
|
7639
7965
|
return;
|
|
7640
7966
|
const dependencies = extractDependencies(normalizedPath);
|
|
7641
7967
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -7651,7 +7977,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7651
7977
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
7652
7978
|
const processedFiles = new Set;
|
|
7653
7979
|
const glob = new Glob7("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
7654
|
-
const resolvedDirs = directories.map((dir) => resolve19(dir)).filter((dir) =>
|
|
7980
|
+
const resolvedDirs = directories.map((dir) => resolve19(dir)).filter((dir) => existsSync19(dir));
|
|
7655
7981
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
7656
7982
|
for (const file3 of allFiles) {
|
|
7657
7983
|
const fullPath = resolve19(file3);
|
|
@@ -7670,7 +7996,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7670
7996
|
const [, href] = matchLink;
|
|
7671
7997
|
if (!href)
|
|
7672
7998
|
continue;
|
|
7673
|
-
const resolvedHref =
|
|
7999
|
+
const resolvedHref = resolveImportPath2(href, filePath);
|
|
7674
8000
|
if (resolvedHref)
|
|
7675
8001
|
dependencies.push(resolvedHref);
|
|
7676
8002
|
}
|
|
@@ -7680,7 +8006,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7680
8006
|
while ((match = regex.exec(content)) !== null) {
|
|
7681
8007
|
if (!match[1])
|
|
7682
8008
|
continue;
|
|
7683
|
-
const resolved =
|
|
8009
|
+
const resolved = resolveImportPath2(match[1], filePath);
|
|
7684
8010
|
if (resolved)
|
|
7685
8011
|
dependencies.push(resolved);
|
|
7686
8012
|
}
|
|
@@ -7690,7 +8016,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7690
8016
|
while ((urlMatch = stringLiteralRegex.exec(matchContent)) !== null) {
|
|
7691
8017
|
if (!urlMatch[1])
|
|
7692
8018
|
continue;
|
|
7693
|
-
const resolved =
|
|
8019
|
+
const resolved = resolveImportPath2(urlMatch[1], filePath);
|
|
7694
8020
|
if (resolved)
|
|
7695
8021
|
dependencies.push(resolved);
|
|
7696
8022
|
}
|
|
@@ -7713,7 +8039,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7713
8039
|
const imports = transpiler4.scanImports(content);
|
|
7714
8040
|
const dependencies = [];
|
|
7715
8041
|
for (const imp of imports) {
|
|
7716
|
-
const resolved =
|
|
8042
|
+
const resolved = resolveImportPath2(imp.path, filePath);
|
|
7717
8043
|
if (resolved)
|
|
7718
8044
|
dependencies.push(resolved);
|
|
7719
8045
|
}
|
|
@@ -7723,7 +8049,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7723
8049
|
return dependencies;
|
|
7724
8050
|
}, resolveScannedImports = (imports, filePath, dependencies) => {
|
|
7725
8051
|
for (const imp of imports) {
|
|
7726
|
-
const resolved =
|
|
8052
|
+
const resolved = resolveImportPath2(imp.path, filePath);
|
|
7727
8053
|
if (resolved)
|
|
7728
8054
|
dependencies.push(resolved);
|
|
7729
8055
|
}
|
|
@@ -7748,15 +8074,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7748
8074
|
const lowerPath = filePath.toLowerCase();
|
|
7749
8075
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
7750
8076
|
if (loader === "html") {
|
|
7751
|
-
const content =
|
|
8077
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
7752
8078
|
return extractHtmlDependencies(filePath, content);
|
|
7753
8079
|
}
|
|
7754
8080
|
if (loader === "tsx" || loader === "js") {
|
|
7755
|
-
const content =
|
|
8081
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
7756
8082
|
return extractJsDependencies(filePath, content, loader);
|
|
7757
8083
|
}
|
|
7758
8084
|
if (isSvelteOrVue) {
|
|
7759
|
-
const content =
|
|
8085
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
7760
8086
|
return extractSvelteVueDependencies(filePath, content);
|
|
7761
8087
|
}
|
|
7762
8088
|
return [];
|
|
@@ -8039,12 +8365,12 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
8039
8365
|
};
|
|
8040
8366
|
var init_pathUtils = __esm(() => {
|
|
8041
8367
|
init_commonAncestor();
|
|
8042
|
-
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less)$/i;
|
|
8368
|
+
STYLE_EXTENSION_PATTERN2 = /\.(css|s[ac]ss|less|styl(?:us)?)$/i;
|
|
8043
8369
|
});
|
|
8044
8370
|
|
|
8045
8371
|
// src/dev/fileWatcher.ts
|
|
8046
8372
|
import { watch } from "fs";
|
|
8047
|
-
import { existsSync as
|
|
8373
|
+
import { existsSync as existsSync20 } from "fs";
|
|
8048
8374
|
import { join as join20, resolve as resolve21 } from "path";
|
|
8049
8375
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
8050
8376
|
try {
|
|
@@ -8076,12 +8402,12 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8076
8402
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
8077
8403
|
return;
|
|
8078
8404
|
}
|
|
8079
|
-
if (event === "rename" && !
|
|
8405
|
+
if (event === "rename" && !existsSync20(fullPath)) {
|
|
8080
8406
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
8081
8407
|
onFileChange(fullPath);
|
|
8082
8408
|
return;
|
|
8083
8409
|
}
|
|
8084
|
-
if (
|
|
8410
|
+
if (existsSync20(fullPath)) {
|
|
8085
8411
|
onFileChange(fullPath);
|
|
8086
8412
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
8087
8413
|
}
|
|
@@ -8091,7 +8417,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8091
8417
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8092
8418
|
paths.forEach((path) => {
|
|
8093
8419
|
const absolutePath = resolve21(path).replace(/\\/g, "/");
|
|
8094
|
-
if (!
|
|
8420
|
+
if (!existsSync20(absolutePath)) {
|
|
8095
8421
|
return;
|
|
8096
8422
|
}
|
|
8097
8423
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -8102,7 +8428,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8102
8428
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8103
8429
|
watchPaths.forEach((path) => {
|
|
8104
8430
|
const absolutePath = resolve21(path).replace(/\\/g, "/");
|
|
8105
|
-
if (!
|
|
8431
|
+
if (!existsSync20(absolutePath)) {
|
|
8106
8432
|
return;
|
|
8107
8433
|
}
|
|
8108
8434
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -8223,7 +8549,7 @@ var init_assetStore = __esm(() => {
|
|
|
8223
8549
|
});
|
|
8224
8550
|
|
|
8225
8551
|
// src/islands/pageMetadata.ts
|
|
8226
|
-
import { readFileSync as
|
|
8552
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
8227
8553
|
import { dirname as dirname11, resolve as resolve23 } from "path";
|
|
8228
8554
|
var pagePatterns, getPageDirs = (config) => [
|
|
8229
8555
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
@@ -8265,7 +8591,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
8265
8591
|
return;
|
|
8266
8592
|
const files = await scanEntryPoints(resolve23(entry.dir), pattern);
|
|
8267
8593
|
for (const filePath of files) {
|
|
8268
|
-
const source =
|
|
8594
|
+
const source = readFileSync12(filePath, "utf-8");
|
|
8269
8595
|
const islands = extractIslandUsagesFromSource(source);
|
|
8270
8596
|
pageMetadata.set(resolve23(filePath), {
|
|
8271
8597
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
@@ -8295,10 +8621,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
8295
8621
|
});
|
|
8296
8622
|
|
|
8297
8623
|
// src/dev/fileHashTracker.ts
|
|
8298
|
-
import { readFileSync as
|
|
8624
|
+
import { readFileSync as readFileSync13 } from "fs";
|
|
8299
8625
|
var computeFileHash = (filePath) => {
|
|
8300
8626
|
try {
|
|
8301
|
-
const fileContent =
|
|
8627
|
+
const fileContent = readFileSync13(filePath);
|
|
8302
8628
|
return Number(Bun.hash(fileContent));
|
|
8303
8629
|
} catch {
|
|
8304
8630
|
return UNFOUND_INDEX;
|
|
@@ -9452,6 +9778,11 @@ var init_pageHandler = __esm(() => {
|
|
|
9452
9778
|
});
|
|
9453
9779
|
|
|
9454
9780
|
// src/react/pageHandler.ts
|
|
9781
|
+
var exports_pageHandler = {};
|
|
9782
|
+
__export(exports_pageHandler, {
|
|
9783
|
+
invalidateReactSsrCache: () => invalidateReactSsrCache,
|
|
9784
|
+
handleReactPageRequest: () => handleReactPageRequest
|
|
9785
|
+
});
|
|
9455
9786
|
var ssrDirty2 = false, buildRefreshSetup = () => {
|
|
9456
9787
|
if (false) {}
|
|
9457
9788
|
return "window.__REFRESH_BUFFER__=[];" + "window.$RefreshReg$=function(t,i){window.__REFRESH_BUFFER__.push([t,i])};" + "window.$RefreshSig$=function(){return function(t){return t}};";
|
|
@@ -9855,8 +10186,8 @@ __export(exports_moduleServer, {
|
|
|
9855
10186
|
createModuleServer: () => createModuleServer,
|
|
9856
10187
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
9857
10188
|
});
|
|
9858
|
-
import { existsSync as
|
|
9859
|
-
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve27, relative as
|
|
10189
|
+
import { existsSync as existsSync21, readFileSync as readFileSync14, statSync as statSync2 } from "fs";
|
|
10190
|
+
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve27, relative as relative11 } from "path";
|
|
9860
10191
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
9861
10192
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
9862
10193
|
const allExports = [];
|
|
@@ -9876,7 +10207,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
9876
10207
|
${stubs}
|
|
9877
10208
|
`;
|
|
9878
10209
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
9879
|
-
const found = extensions.find((ext) =>
|
|
10210
|
+
const found = extensions.find((ext) => existsSync21(resolve27(projectRoot, srcPath + ext)));
|
|
9880
10211
|
return found ? srcPath + found : srcPath;
|
|
9881
10212
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
9882
10213
|
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
@@ -9904,17 +10235,17 @@ ${stubs}
|
|
|
9904
10235
|
}
|
|
9905
10236
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
9906
10237
|
const absPath = resolve27(fileDir, relPath);
|
|
9907
|
-
const rel =
|
|
10238
|
+
const rel = relative11(projectRoot, absPath);
|
|
9908
10239
|
const extension = extname6(rel);
|
|
9909
10240
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
9910
10241
|
if (extname6(srcPath) === ".svelte") {
|
|
9911
|
-
srcPath =
|
|
10242
|
+
srcPath = relative11(projectRoot, resolveSvelteModulePath(resolve27(projectRoot, srcPath)));
|
|
9912
10243
|
}
|
|
9913
10244
|
return srcUrl(srcPath, projectRoot);
|
|
9914
10245
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
9915
10246
|
try {
|
|
9916
10247
|
const target = resolvePackageImport(specifier, ["browser", "import"]) ?? Bun.resolveSync(specifier, projectRoot);
|
|
9917
|
-
return
|
|
10248
|
+
return relative11(projectRoot, target);
|
|
9918
10249
|
} catch {
|
|
9919
10250
|
return;
|
|
9920
10251
|
}
|
|
@@ -9947,20 +10278,20 @@ ${stubs}
|
|
|
9947
10278
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
9948
10279
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, (_match, prefix, absPath, _ext, suffix) => {
|
|
9949
10280
|
if (absPath.startsWith(projectRoot)) {
|
|
9950
|
-
const rel2 =
|
|
10281
|
+
const rel2 = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
9951
10282
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
9952
10283
|
}
|
|
9953
|
-
const rel =
|
|
10284
|
+
const rel = relative11(projectRoot, absPath).replace(/\\/g, "/");
|
|
9954
10285
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
9955
10286
|
});
|
|
9956
10287
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
9957
10288
|
const absPath = resolve27(fileDir, relPath);
|
|
9958
|
-
const rel =
|
|
10289
|
+
const rel = relative11(projectRoot, absPath);
|
|
9959
10290
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
9960
10291
|
});
|
|
9961
10292
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
9962
10293
|
const absPath = resolve27(fileDir, relPath);
|
|
9963
|
-
const rel =
|
|
10294
|
+
const rel = relative11(projectRoot, absPath);
|
|
9964
10295
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
9965
10296
|
});
|
|
9966
10297
|
return result;
|
|
@@ -9988,7 +10319,7 @@ ${stubs}
|
|
|
9988
10319
|
`)}
|
|
9989
10320
|
${code}`;
|
|
9990
10321
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
9991
|
-
const raw =
|
|
10322
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
9992
10323
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
9993
10324
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
9994
10325
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -9999,12 +10330,12 @@ ${code}`;
|
|
|
9999
10330
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
10000
10331
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
10001
10332
|
${transpiled}`;
|
|
10002
|
-
const relPath =
|
|
10333
|
+
const relPath = relative11(projectRoot, filePath).replace(/\\/g, "/");
|
|
10003
10334
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
10004
10335
|
transpiled += buildIslandMetadataExports(raw);
|
|
10005
10336
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
10006
10337
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
10007
|
-
const raw =
|
|
10338
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10008
10339
|
const ext = extname6(filePath);
|
|
10009
10340
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
10010
10341
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -10150,17 +10481,17 @@ ${code}`;
|
|
|
10150
10481
|
if (compiled.css?.code) {
|
|
10151
10482
|
const cssPath = `${filePath}.css`;
|
|
10152
10483
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
10153
|
-
const cssUrl = srcUrl(
|
|
10484
|
+
const cssUrl = srcUrl(relative11(projectRoot, cssPath), projectRoot);
|
|
10154
10485
|
code = `import "${cssUrl}";
|
|
10155
10486
|
${code}`;
|
|
10156
10487
|
}
|
|
10157
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
10488
|
+
const moduleUrl = `${SRC_PREFIX}${relative11(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
10158
10489
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
10159
10490
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10160
10491
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
10161
10492
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
10162
10493
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10163
|
-
const raw =
|
|
10494
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10164
10495
|
if (!svelteCompiler) {
|
|
10165
10496
|
svelteCompiler = await import("svelte/compiler");
|
|
10166
10497
|
}
|
|
@@ -10218,7 +10549,7 @@ export default __script__;`;
|
|
|
10218
10549
|
return `${cssInjection}
|
|
10219
10550
|
${code}`;
|
|
10220
10551
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10221
|
-
const raw =
|
|
10552
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10222
10553
|
if (!vueCompiler) {
|
|
10223
10554
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
10224
10555
|
}
|
|
@@ -10236,7 +10567,7 @@ ${code}`;
|
|
|
10236
10567
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
10237
10568
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
10238
10569
|
const hmrBase = vueDir ? resolve27(vueDir) : projectRoot;
|
|
10239
|
-
const hmrId =
|
|
10570
|
+
const hmrId = relative11(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
10240
10571
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
10241
10572
|
result += [
|
|
10242
10573
|
"",
|
|
@@ -10250,11 +10581,11 @@ ${code}`;
|
|
|
10250
10581
|
`);
|
|
10251
10582
|
return result;
|
|
10252
10583
|
}, resolveSvelteModulePath = (path) => {
|
|
10253
|
-
if (
|
|
10584
|
+
if (existsSync21(path))
|
|
10254
10585
|
return path;
|
|
10255
|
-
if (
|
|
10586
|
+
if (existsSync21(`${path}.ts`))
|
|
10256
10587
|
return `${path}.ts`;
|
|
10257
|
-
if (
|
|
10588
|
+
if (existsSync21(`${path}.js`))
|
|
10258
10589
|
return `${path}.js`;
|
|
10259
10590
|
return path;
|
|
10260
10591
|
}, jsResponse = (body) => {
|
|
@@ -10267,7 +10598,7 @@ ${code}`;
|
|
|
10267
10598
|
}
|
|
10268
10599
|
});
|
|
10269
10600
|
}, handleCssRequest = (filePath) => {
|
|
10270
|
-
const raw =
|
|
10601
|
+
const raw = readFileSync14(filePath, "utf-8");
|
|
10271
10602
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10272
10603
|
return [
|
|
10273
10604
|
`const style = document.createElement('style');`,
|
|
@@ -10400,7 +10731,7 @@ export default {};
|
|
|
10400
10731
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
10401
10732
|
if (ext)
|
|
10402
10733
|
return { ext, filePath };
|
|
10403
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
10734
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync21(filePath + candidate));
|
|
10404
10735
|
if (!found)
|
|
10405
10736
|
return { ext, filePath };
|
|
10406
10737
|
const resolved = filePath + found;
|
|
@@ -10605,9 +10936,9 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
10605
10936
|
var init_simpleHTMXHMR = () => {};
|
|
10606
10937
|
|
|
10607
10938
|
// src/dev/rebuildTrigger.ts
|
|
10608
|
-
import { existsSync as
|
|
10609
|
-
import { basename as basename13, dirname as dirname15, relative as
|
|
10610
|
-
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
10939
|
+
import { existsSync as existsSync22 } from "fs";
|
|
10940
|
+
import { basename as basename13, dirname as dirname15, relative as relative12, resolve as resolve30 } from "path";
|
|
10941
|
+
var moduleServerPromise, getModuleServer = () => moduleServerPromise, getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), parseErrorLocationFromMessage = (msg) => {
|
|
10611
10942
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
10612
10943
|
if (pathLineCol) {
|
|
10613
10944
|
const [, file3, lineStr, colStr] = pathLineCol;
|
|
@@ -10674,7 +11005,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10674
11005
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
10675
11006
|
}
|
|
10676
11007
|
return { ...parsed, framework: detectedFw };
|
|
10677
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
11008
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync22(affectedFile), collectDeletedFileAffected = (state, filePathInSet, processedFiles, validFiles) => {
|
|
10678
11009
|
state.fileHashes.delete(filePathInSet);
|
|
10679
11010
|
try {
|
|
10680
11011
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
@@ -10692,7 +11023,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10692
11023
|
if (!dependents || dependents.size === 0) {
|
|
10693
11024
|
return;
|
|
10694
11025
|
}
|
|
10695
|
-
const dependentFiles = Array.from(dependents).filter((file3) =>
|
|
11026
|
+
const dependentFiles = Array.from(dependents).filter((file3) => existsSync22(file3));
|
|
10696
11027
|
if (dependentFiles.length === 0) {
|
|
10697
11028
|
return;
|
|
10698
11029
|
}
|
|
@@ -10708,7 +11039,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10708
11039
|
try {
|
|
10709
11040
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
10710
11041
|
affectedFiles.forEach((affectedFile) => {
|
|
10711
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
11042
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync22(affectedFile)) {
|
|
10712
11043
|
validFiles.push(affectedFile);
|
|
10713
11044
|
processedFiles.add(affectedFile);
|
|
10714
11045
|
}
|
|
@@ -10733,7 +11064,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10733
11064
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
10734
11065
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
10735
11066
|
filePathSet.forEach((filePathInSet) => {
|
|
10736
|
-
if (!
|
|
11067
|
+
if (!existsSync22(filePathInSet)) {
|
|
10737
11068
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
10738
11069
|
return;
|
|
10739
11070
|
}
|
|
@@ -10801,7 +11132,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10801
11132
|
if (framework === "unknown") {
|
|
10802
11133
|
const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
|
|
10803
11134
|
invalidate2(resolve30(filePath));
|
|
10804
|
-
const relPath =
|
|
11135
|
+
const relPath = relative12(process.cwd(), filePath);
|
|
10805
11136
|
logHmrUpdate(relPath);
|
|
10806
11137
|
return;
|
|
10807
11138
|
}
|
|
@@ -10841,7 +11172,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10841
11172
|
return componentFile;
|
|
10842
11173
|
}
|
|
10843
11174
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
10844
|
-
if (
|
|
11175
|
+
if (existsSync22(tsCounterpart)) {
|
|
10845
11176
|
return tsCounterpart;
|
|
10846
11177
|
}
|
|
10847
11178
|
if (!graph)
|
|
@@ -10915,7 +11246,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10915
11246
|
naming: "[dir]/[name].[hash].[ext]",
|
|
10916
11247
|
outdir: buildDir,
|
|
10917
11248
|
plugins: [
|
|
10918
|
-
createStylePreprocessorPlugin(state.config
|
|
11249
|
+
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
10919
11250
|
],
|
|
10920
11251
|
root: clientRoot,
|
|
10921
11252
|
target: "browser",
|
|
@@ -10957,7 +11288,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10957
11288
|
});
|
|
10958
11289
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
10959
11290
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
10960
|
-
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, state.config
|
|
11291
|
+
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, getStyleTransformConfig(state.config));
|
|
10961
11292
|
serverPaths.forEach((serverPath) => {
|
|
10962
11293
|
const fileBase = basename13(serverPath, ".js");
|
|
10963
11294
|
state.manifest[toPascal(fileBase)] = resolve30(serverPath);
|
|
@@ -10987,7 +11318,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10987
11318
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
10988
11319
|
const pageName = basename13(normalized, ".tsx");
|
|
10989
11320
|
const indexPath = resolve30(reactIndexesPath, `${pageName}.tsx`);
|
|
10990
|
-
if (!
|
|
11321
|
+
if (!existsSync22(indexPath)) {
|
|
10991
11322
|
return;
|
|
10992
11323
|
}
|
|
10993
11324
|
return indexPath;
|
|
@@ -10999,7 +11330,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10999
11330
|
}
|
|
11000
11331
|
const pageName = basename13(dep, ".tsx");
|
|
11001
11332
|
const indexPath = resolve30(reactIndexesPath, `${pageName}.tsx`);
|
|
11002
|
-
if (
|
|
11333
|
+
if (existsSync22(indexPath) && !reactEntries.includes(indexPath)) {
|
|
11003
11334
|
reactEntries.push(indexPath);
|
|
11004
11335
|
}
|
|
11005
11336
|
});
|
|
@@ -11050,7 +11381,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11050
11381
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11051
11382
|
outdir: buildDir,
|
|
11052
11383
|
plugins: [
|
|
11053
|
-
createStylePreprocessorPlugin(state.config
|
|
11384
|
+
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
11054
11385
|
],
|
|
11055
11386
|
reactFastRefresh: true,
|
|
11056
11387
|
root: clientRoot,
|
|
@@ -11082,7 +11413,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11082
11413
|
}, getModuleUrl = async (pageFile) => {
|
|
11083
11414
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
11084
11415
|
invalidateModule2(pageFile);
|
|
11085
|
-
const rel =
|
|
11416
|
+
const rel = relative12(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
11086
11417
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
11087
11418
|
warmCache2(url);
|
|
11088
11419
|
return url;
|
|
@@ -11114,7 +11445,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11114
11445
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
11115
11446
|
if (pageModuleUrl) {
|
|
11116
11447
|
const serverDuration = Date.now() - startTime;
|
|
11117
|
-
state.lastHmrPath =
|
|
11448
|
+
state.lastHmrPath = relative12(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
11118
11449
|
state.lastHmrFramework = "react";
|
|
11119
11450
|
broadcastToClients(state, {
|
|
11120
11451
|
data: {
|
|
@@ -11224,7 +11555,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11224
11555
|
const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
|
|
11225
11556
|
const { build: bunBuild7 } = await Promise.resolve(globalThis.Bun);
|
|
11226
11557
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11227
|
-
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, state.config
|
|
11558
|
+
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, getStyleTransformConfig(state.config));
|
|
11228
11559
|
const serverEntries = [...svelteServerPaths];
|
|
11229
11560
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
11230
11561
|
const serverRoot = resolve30(svelteDir, "generated", "server");
|
|
@@ -11244,7 +11575,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11244
11575
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11245
11576
|
outdir: serverOutDir,
|
|
11246
11577
|
plugins: [
|
|
11247
|
-
createStylePreprocessorPlugin(state.config
|
|
11578
|
+
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
11248
11579
|
],
|
|
11249
11580
|
root: serverRoot,
|
|
11250
11581
|
target: "bun",
|
|
@@ -11256,7 +11587,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11256
11587
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11257
11588
|
outdir: buildDir,
|
|
11258
11589
|
plugins: [
|
|
11259
|
-
createStylePreprocessorPlugin(state.config
|
|
11590
|
+
createStylePreprocessorPlugin(getStyleTransformConfig(state.config))
|
|
11260
11591
|
],
|
|
11261
11592
|
root: clientRoot,
|
|
11262
11593
|
target: "browser",
|
|
@@ -11578,7 +11909,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11578
11909
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
11579
11910
|
const pascalName = toPascal(baseName);
|
|
11580
11911
|
const vueRoot = config.vueDirectory;
|
|
11581
|
-
const hmrId = vueRoot ?
|
|
11912
|
+
const hmrId = vueRoot ? relative12(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
11582
11913
|
const cssKey = `${pascalName}CSS`;
|
|
11583
11914
|
const cssUrl = manifest[cssKey] || null;
|
|
11584
11915
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
@@ -12226,7 +12557,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12226
12557
|
return Array.from(specifiers).filter(isResolvable3);
|
|
12227
12558
|
}, generateEntrySource2 = (specifier) => `export * from '${specifier}';
|
|
12228
12559
|
`, rewriteVendorFiles = async (vendorDir) => {
|
|
12229
|
-
const { readdirSync: readdirSync2, readFileSync:
|
|
12560
|
+
const { readdirSync: readdirSync2, readFileSync: readFileSync15, writeFileSync: writeFileSync8 } = await import("fs");
|
|
12230
12561
|
const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
|
|
12231
12562
|
const reactPaths = Object.entries(computeVendorPaths2());
|
|
12232
12563
|
const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
|
|
@@ -12237,7 +12568,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12237
12568
|
const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
12238
12569
|
for (const file3 of files) {
|
|
12239
12570
|
const filePath = join22(vendorDir, file3);
|
|
12240
|
-
const original =
|
|
12571
|
+
const original = readFileSync15(filePath, "utf-8");
|
|
12241
12572
|
const rewritten = rewriteContent(original);
|
|
12242
12573
|
if (rewritten !== original)
|
|
12243
12574
|
writeFileSync8(filePath, rewritten);
|
|
@@ -12636,5 +12967,5 @@ export {
|
|
|
12636
12967
|
build
|
|
12637
12968
|
};
|
|
12638
12969
|
|
|
12639
|
-
//# debugId=
|
|
12970
|
+
//# debugId=FC044B4AB3E004F164756E2164756E21
|
|
12640
12971
|
//# sourceMappingURL=build.js.map
|