@absolutejs/absolute 0.19.0-beta.692 → 0.19.0-beta.693
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 +122 -108
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +104 -90
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +309 -284
- package/dist/build.js.map +9 -9
- package/dist/index.js +336 -310
- package/dist/index.js.map +10 -10
- package/dist/islands/index.js +64 -50
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +64 -50
- package/dist/react/index.js.map +3 -3
- package/dist/src/build/compileAngular.d.ts +4 -3
- package/dist/src/build/compileSvelte.d.ts +2 -1
- package/dist/src/build/compileVue.d.ts +2 -1
- package/dist/src/build/stylePreprocessor.d.ts +6 -4
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -0
- package/dist/svelte/index.js +68 -54
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +64 -50
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +28 -0
- package/dist/vue/index.js +64 -50
- package/dist/vue/index.js.map +3 -3
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -2504,7 +2504,7 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2504
2504
|
// src/build/stylePreprocessor.ts
|
|
2505
2505
|
import { readFile } from "fs/promises";
|
|
2506
2506
|
import { createRequire } from "module";
|
|
2507
|
-
import { dirname as dirname2, extname, join as join3 } from "path";
|
|
2507
|
+
import { dirname as dirname2, extname, join as join3, resolve as resolve4 } from "path";
|
|
2508
2508
|
var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
2509
2509
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2510
2510
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -2514,18 +2514,29 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2514
2514
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
2515
2515
|
return "less";
|
|
2516
2516
|
return null;
|
|
2517
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
2517
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
2518
|
+
dirname2(filePath),
|
|
2519
|
+
process.cwd(),
|
|
2520
|
+
...paths.map((path) => resolve4(process.cwd(), path))
|
|
2521
|
+
], getSassOptions = (config, language) => ({
|
|
2522
|
+
...config?.sass ?? {},
|
|
2523
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
2524
|
+
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2525
|
+
${contents}` : contents, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
2518
2526
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2519
|
-
const
|
|
2527
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2520
2528
|
if (language === "scss" || language === "sass") {
|
|
2529
|
+
const options = getSassOptions(config, language);
|
|
2530
|
+
const packageName = options.implementation ?? "sass";
|
|
2521
2531
|
let sass;
|
|
2522
2532
|
try {
|
|
2523
|
-
sass = await importOptionalPeer(
|
|
2533
|
+
sass = await importOptionalPeer(packageName);
|
|
2524
2534
|
} catch {
|
|
2525
|
-
throw missingDependencyError(
|
|
2535
|
+
throw missingDependencyError(packageName, filePath);
|
|
2526
2536
|
}
|
|
2537
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2527
2538
|
const result = sass.compileString(contents, {
|
|
2528
|
-
loadPaths:
|
|
2539
|
+
loadPaths: normalizeLoadPaths(filePath, options.loadPaths),
|
|
2529
2540
|
style: "expanded",
|
|
2530
2541
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2531
2542
|
url: new URL(`file://${filePath}`)
|
|
@@ -2533,6 +2544,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2533
2544
|
return result.css;
|
|
2534
2545
|
}
|
|
2535
2546
|
if (language === "less") {
|
|
2547
|
+
const options = getLessOptions(config);
|
|
2536
2548
|
let lessModule;
|
|
2537
2549
|
try {
|
|
2538
2550
|
lessModule = await importOptionalPeer("less");
|
|
@@ -2543,14 +2555,49 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2543
2555
|
const render = less?.render;
|
|
2544
2556
|
if (!render)
|
|
2545
2557
|
throw missingDependencyError("less", filePath);
|
|
2558
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2546
2559
|
const result = await render(contents, {
|
|
2560
|
+
...options.options ?? {},
|
|
2547
2561
|
filename: filePath,
|
|
2548
|
-
paths:
|
|
2562
|
+
paths: normalizeLoadPaths(filePath, options.paths)
|
|
2549
2563
|
});
|
|
2550
2564
|
return result.css;
|
|
2551
2565
|
}
|
|
2552
|
-
return
|
|
2553
|
-
},
|
|
2566
|
+
return rawContents;
|
|
2567
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
2568
|
+
name: "absolute-style-preprocessor",
|
|
2569
|
+
setup(build) {
|
|
2570
|
+
const cssModuleSources = new Map;
|
|
2571
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2572
|
+
namespace: "absolute-style-module",
|
|
2573
|
+
path: path.slice("absolute-style-module:".length)
|
|
2574
|
+
}));
|
|
2575
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2576
|
+
const sourcePath = cssModuleSources.get(path);
|
|
2577
|
+
if (!sourcePath) {
|
|
2578
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2579
|
+
}
|
|
2580
|
+
return {
|
|
2581
|
+
contents: await compileStyleSource(sourcePath, undefined, undefined, config),
|
|
2582
|
+
loader: "css"
|
|
2583
|
+
};
|
|
2584
|
+
});
|
|
2585
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2586
|
+
if (isStyleModulePath(path)) {
|
|
2587
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2588
|
+
cssModuleSources.set(cssModulePath, path);
|
|
2589
|
+
return {
|
|
2590
|
+
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2591
|
+
loader: "js"
|
|
2592
|
+
};
|
|
2593
|
+
}
|
|
2594
|
+
return {
|
|
2595
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
2596
|
+
loader: "css"
|
|
2597
|
+
};
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
2554
2601
|
style: async ({
|
|
2555
2602
|
attributes,
|
|
2556
2603
|
content,
|
|
@@ -2561,14 +2608,14 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2561
2608
|
return;
|
|
2562
2609
|
const path = filename ?? `style.${language}`;
|
|
2563
2610
|
return {
|
|
2564
|
-
code: await compileStyleSource(path, content, language)
|
|
2611
|
+
code: await compileStyleSource(path, content, language, config)
|
|
2565
2612
|
};
|
|
2566
2613
|
}
|
|
2567
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
2614
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
2568
2615
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2569
2616
|
return readFile(filePath, "utf-8");
|
|
2570
2617
|
}
|
|
2571
|
-
return compileStyleSource(filePath);
|
|
2618
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2572
2619
|
};
|
|
2573
2620
|
var init_stylePreprocessor = __esm(() => {
|
|
2574
2621
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -2577,45 +2624,12 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2577
2624
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2578
2625
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2579
2626
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
2580
|
-
stylePreprocessorPlugin =
|
|
2581
|
-
name: "absolute-style-preprocessor",
|
|
2582
|
-
setup(build) {
|
|
2583
|
-
const cssModuleSources = new Map;
|
|
2584
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2585
|
-
namespace: "absolute-style-module",
|
|
2586
|
-
path: path.slice("absolute-style-module:".length)
|
|
2587
|
-
}));
|
|
2588
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2589
|
-
const sourcePath = cssModuleSources.get(path);
|
|
2590
|
-
if (!sourcePath) {
|
|
2591
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2592
|
-
}
|
|
2593
|
-
return {
|
|
2594
|
-
contents: await compileStyleSource(sourcePath),
|
|
2595
|
-
loader: "css"
|
|
2596
|
-
};
|
|
2597
|
-
});
|
|
2598
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2599
|
-
if (isStyleModulePath(path)) {
|
|
2600
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2601
|
-
cssModuleSources.set(cssModulePath, path);
|
|
2602
|
-
return {
|
|
2603
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2604
|
-
loader: "js"
|
|
2605
|
-
};
|
|
2606
|
-
}
|
|
2607
|
-
return {
|
|
2608
|
-
contents: await compileStyleSource(path),
|
|
2609
|
-
loader: "css"
|
|
2610
|
-
};
|
|
2611
|
-
});
|
|
2612
|
-
}
|
|
2613
|
-
};
|
|
2627
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
2614
2628
|
});
|
|
2615
2629
|
|
|
2616
2630
|
// src/core/svelteServerModule.ts
|
|
2617
2631
|
import { mkdir, readdir } from "fs/promises";
|
|
2618
|
-
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as
|
|
2632
|
+
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
2619
2633
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2620
2634
|
const importPath = relative(dirname3(from), target).replace(/\\/g, "/");
|
|
2621
2635
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
@@ -2663,7 +2677,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2663
2677
|
if (!spec.startsWith(".")) {
|
|
2664
2678
|
return null;
|
|
2665
2679
|
}
|
|
2666
|
-
const basePath =
|
|
2680
|
+
const basePath = resolve5(dirname3(from), spec);
|
|
2667
2681
|
const candidates = [
|
|
2668
2682
|
basePath,
|
|
2669
2683
|
`${basePath}.ts`,
|
|
@@ -2695,7 +2709,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2695
2709
|
if (!spec.startsWith(".")) {
|
|
2696
2710
|
return null;
|
|
2697
2711
|
}
|
|
2698
|
-
const explicitPath =
|
|
2712
|
+
const explicitPath = resolve5(dirname3(from), spec);
|
|
2699
2713
|
if (extname2(explicitPath) === ".svelte") {
|
|
2700
2714
|
return explicitPath;
|
|
2701
2715
|
}
|
|
@@ -2950,7 +2964,7 @@ import {
|
|
|
2950
2964
|
rmSync,
|
|
2951
2965
|
writeFileSync as writeFileSync2
|
|
2952
2966
|
} from "fs";
|
|
2953
|
-
import { dirname as dirname4, extname as extname3, join as join5, relative as relative2, resolve as
|
|
2967
|
+
import { dirname as dirname4, extname as extname3, join as join5, relative as relative2, resolve as resolve6 } from "path";
|
|
2954
2968
|
import ts from "typescript";
|
|
2955
2969
|
var frameworks, isRecord4 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
|
|
2956
2970
|
if (isRecord4(mod.islandRegistry))
|
|
@@ -2965,7 +2979,7 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
|
|
|
2965
2979
|
if (sourcePath.startsWith("file://")) {
|
|
2966
2980
|
return new URL(sourcePath).pathname;
|
|
2967
2981
|
}
|
|
2968
|
-
return
|
|
2982
|
+
return resolve6(dirname4(registryPath), sourcePath);
|
|
2969
2983
|
}, getObjectPropertyName = (name) => {
|
|
2970
2984
|
if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {
|
|
2971
2985
|
return name.text;
|
|
@@ -3128,7 +3142,7 @@ export default component;
|
|
|
3128
3142
|
generatedRoot
|
|
3129
3143
|
};
|
|
3130
3144
|
}, loadIslandRegistryBuildInfo = async (registryPath) => {
|
|
3131
|
-
const resolvedRegistryPath =
|
|
3145
|
+
const resolvedRegistryPath = resolve6(registryPath);
|
|
3132
3146
|
const registrySource = Bun.file(resolvedRegistryPath);
|
|
3133
3147
|
const registrySourceText = await registrySource.text();
|
|
3134
3148
|
const registryModule = await import(resolvedRegistryPath);
|
|
@@ -3475,7 +3489,7 @@ var init_sourceMetadata = __esm(() => {
|
|
|
3475
3489
|
|
|
3476
3490
|
// src/islands/pageMetadata.ts
|
|
3477
3491
|
import { readFileSync as readFileSync4 } from "fs";
|
|
3478
|
-
import { dirname as dirname5, resolve as
|
|
3492
|
+
import { dirname as dirname5, resolve as resolve9 } from "path";
|
|
3479
3493
|
var pagePatterns, getPageDirs = (config) => [
|
|
3480
3494
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
3481
3495
|
{ dir: config.reactDirectory, framework: "react" },
|
|
@@ -3494,15 +3508,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
3494
3508
|
const source = definition.buildReference?.source;
|
|
3495
3509
|
if (!source)
|
|
3496
3510
|
continue;
|
|
3497
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
3498
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
3511
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve9(dirname5(buildInfo.resolvedRegistryPath), source);
|
|
3512
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve9(resolvedSource));
|
|
3499
3513
|
}
|
|
3500
3514
|
return lookup;
|
|
3501
3515
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata2, target) => metadata2.islands.some((usage) => {
|
|
3502
3516
|
const candidate = usage.source;
|
|
3503
|
-
return candidate ?
|
|
3517
|
+
return candidate ? resolve9(candidate) === target : false;
|
|
3504
3518
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
3505
|
-
const target =
|
|
3519
|
+
const target = resolve9(sourcePath);
|
|
3506
3520
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata2) => metadataUsesSource(metadata2, target)).map((metadata2) => metadata2.pagePath);
|
|
3507
3521
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
3508
3522
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -3514,13 +3528,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
3514
3528
|
const pattern = pagePatterns[entry.framework];
|
|
3515
3529
|
if (!pattern)
|
|
3516
3530
|
return;
|
|
3517
|
-
const files = await scanEntryPoints(
|
|
3531
|
+
const files = await scanEntryPoints(resolve9(entry.dir), pattern);
|
|
3518
3532
|
for (const filePath of files) {
|
|
3519
3533
|
const source = readFileSync4(filePath, "utf-8");
|
|
3520
3534
|
const islands = extractIslandUsagesFromSource(source);
|
|
3521
|
-
pageMetadata.set(
|
|
3535
|
+
pageMetadata.set(resolve9(filePath), {
|
|
3522
3536
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
3523
|
-
pagePath:
|
|
3537
|
+
pagePath: resolve9(filePath)
|
|
3524
3538
|
});
|
|
3525
3539
|
}
|
|
3526
3540
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -3650,18 +3664,18 @@ __export(exports_generateReactIndexes, {
|
|
|
3650
3664
|
});
|
|
3651
3665
|
import { existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
|
|
3652
3666
|
import { readdir as readdir2, rm, writeFile } from "fs/promises";
|
|
3653
|
-
import { basename as basename3, join as join6, relative as relative3, resolve as
|
|
3667
|
+
import { basename as basename3, join as join6, relative as relative3, resolve as resolve10, sep } from "path";
|
|
3654
3668
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
3655
3669
|
var indexContentCache, resolveDevClientDir = () => {
|
|
3656
3670
|
const projectRoot = process.cwd();
|
|
3657
|
-
const fromSource =
|
|
3671
|
+
const fromSource = resolve10(import.meta.dir, "../dev/client");
|
|
3658
3672
|
if (existsSync5(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3659
3673
|
return fromSource;
|
|
3660
3674
|
}
|
|
3661
|
-
const fromNodeModules =
|
|
3675
|
+
const fromNodeModules = resolve10(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
3662
3676
|
if (existsSync5(fromNodeModules))
|
|
3663
3677
|
return fromNodeModules;
|
|
3664
|
-
return
|
|
3678
|
+
return resolve10(import.meta.dir, "./dev/client");
|
|
3665
3679
|
}, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
|
|
3666
3680
|
if (!existsSync5(reactIndexesDirectory)) {
|
|
3667
3681
|
mkdirSync2(reactIndexesDirectory, { recursive: true });
|
|
@@ -3689,7 +3703,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3689
3703
|
});
|
|
3690
3704
|
}));
|
|
3691
3705
|
}
|
|
3692
|
-
const pagesRelPath = relative3(
|
|
3706
|
+
const pagesRelPath = relative3(resolve10(reactIndexesDirectory), resolve10(reactPagesDirectory)).split(sep).join("/");
|
|
3693
3707
|
const promises = files.map(async (file2) => {
|
|
3694
3708
|
const fileName = basename3(file2);
|
|
3695
3709
|
const [componentName] = fileName.split(".");
|
|
@@ -3949,7 +3963,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3949
3963
|
`
|
|
3950
3964
|
// Pre-warm: import the page module from the module server`,
|
|
3951
3965
|
`// immediately so the browser caches all /@src/ URLs.`,
|
|
3952
|
-
`import('/@src/${relative3(process.cwd(),
|
|
3966
|
+
`import('/@src/${relative3(process.cwd(), resolve10(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\/g, "/")}').catch(() => {});`
|
|
3953
3967
|
] : []
|
|
3954
3968
|
].join(`
|
|
3955
3969
|
`);
|
|
@@ -4117,7 +4131,7 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
4117
4131
|
|
|
4118
4132
|
// src/utils/imageProcessing.ts
|
|
4119
4133
|
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
4120
|
-
import { join as join7, resolve as
|
|
4134
|
+
import { join as join7, resolve as resolve11 } from "path";
|
|
4121
4135
|
var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
|
|
4122
4136
|
for (const size of sizes) {
|
|
4123
4137
|
if (size >= target)
|
|
@@ -4243,7 +4257,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
4243
4257
|
return sharpModule;
|
|
4244
4258
|
sharpLoaded = true;
|
|
4245
4259
|
try {
|
|
4246
|
-
const sharpPath =
|
|
4260
|
+
const sharpPath = resolve11(process.cwd(), "node_modules/sharp");
|
|
4247
4261
|
const mod = await import(sharpPath);
|
|
4248
4262
|
sharpModule = mod.default ?? mod;
|
|
4249
4263
|
return sharpModule;
|
|
@@ -4481,18 +4495,18 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
4481
4495
|
|
|
4482
4496
|
// src/dev/buildHMRClient.ts
|
|
4483
4497
|
import { existsSync as existsSync11 } from "fs";
|
|
4484
|
-
import { resolve as
|
|
4498
|
+
import { resolve as resolve12 } from "path";
|
|
4485
4499
|
var {build: bunBuild } = globalThis.Bun;
|
|
4486
4500
|
var resolveHmrClientPath = () => {
|
|
4487
4501
|
const projectRoot = process.cwd();
|
|
4488
|
-
const fromSource =
|
|
4502
|
+
const fromSource = resolve12(import.meta.dir, "client/hmrClient.ts");
|
|
4489
4503
|
if (existsSync11(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4490
4504
|
return fromSource;
|
|
4491
4505
|
}
|
|
4492
|
-
const fromNodeModules =
|
|
4506
|
+
const fromNodeModules = resolve12(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
4493
4507
|
if (existsSync11(fromNodeModules))
|
|
4494
4508
|
return fromNodeModules;
|
|
4495
|
-
return
|
|
4509
|
+
return resolve12(import.meta.dir, "dev/client/hmrClient.ts");
|
|
4496
4510
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
4497
4511
|
const entryPoint = hmrClientPath2;
|
|
4498
4512
|
const result = await bunBuild({
|
|
@@ -4522,7 +4536,7 @@ var init_buildHMRClient = __esm(() => {
|
|
|
4522
4536
|
// src/build/nativeRewrite.ts
|
|
4523
4537
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
4524
4538
|
import { platform as platform2, arch as arch2 } from "os";
|
|
4525
|
-
import { resolve as
|
|
4539
|
+
import { resolve as resolve13 } from "path";
|
|
4526
4540
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
4527
4541
|
if (nativeLib !== null)
|
|
4528
4542
|
return nativeLib;
|
|
@@ -4540,7 +4554,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
4540
4554
|
if (!libPath)
|
|
4541
4555
|
return null;
|
|
4542
4556
|
try {
|
|
4543
|
-
const fullPath =
|
|
4557
|
+
const fullPath = resolve13(import.meta.dir, "../../native/packages", libPath);
|
|
4544
4558
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
4545
4559
|
nativeLib = lib.symbols;
|
|
4546
4560
|
return nativeLib;
|
|
@@ -4683,11 +4697,11 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
4683
4697
|
|
|
4684
4698
|
// src/build/angularLinkerPlugin.ts
|
|
4685
4699
|
import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
|
|
4686
|
-
import { dirname as dirname7, join as join10, relative as relative4, resolve as
|
|
4700
|
+
import { dirname as dirname7, join as join10, relative as relative4, resolve as resolve14 } from "path";
|
|
4687
4701
|
import { createHash } from "crypto";
|
|
4688
4702
|
var CACHE_DIR, angularLinkerPlugin;
|
|
4689
4703
|
var init_angularLinkerPlugin = __esm(() => {
|
|
4690
|
-
CACHE_DIR =
|
|
4704
|
+
CACHE_DIR = resolve14(".absolutejs", "cache", "angular-linker");
|
|
4691
4705
|
angularLinkerPlugin = {
|
|
4692
4706
|
name: "angular-linker",
|
|
4693
4707
|
setup(bld) {
|
|
@@ -4727,7 +4741,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4727
4741
|
exists: existsSync12,
|
|
4728
4742
|
readFile: readFileSync8,
|
|
4729
4743
|
relative: relative4,
|
|
4730
|
-
resolve:
|
|
4744
|
+
resolve: resolve14
|
|
4731
4745
|
},
|
|
4732
4746
|
linkerJitMode: false,
|
|
4733
4747
|
logger: {
|
|
@@ -4761,14 +4775,14 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4761
4775
|
|
|
4762
4776
|
// src/utils/cleanStaleOutputs.ts
|
|
4763
4777
|
import { rm as rm2 } from "fs/promises";
|
|
4764
|
-
import { resolve as
|
|
4778
|
+
import { resolve as resolve15 } from "path";
|
|
4765
4779
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
4766
4780
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
4767
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
4781
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve15(path)));
|
|
4768
4782
|
const glob = new Glob5("**/*");
|
|
4769
4783
|
const removals = [];
|
|
4770
4784
|
for (const relative5 of glob.scanSync({ cwd: buildPath })) {
|
|
4771
|
-
const absolute =
|
|
4785
|
+
const absolute = resolve15(buildPath, relative5);
|
|
4772
4786
|
if (currentPaths.has(absolute))
|
|
4773
4787
|
continue;
|
|
4774
4788
|
if (!HASHED_FILE_PATTERN.test(relative5))
|
|
@@ -4829,10 +4843,10 @@ var commonAncestor = (paths, fallback) => {
|
|
|
4829
4843
|
var init_commonAncestor = () => {};
|
|
4830
4844
|
|
|
4831
4845
|
// src/utils/validateSafePath.ts
|
|
4832
|
-
import { resolve as
|
|
4846
|
+
import { resolve as resolve16, relative as relative5 } from "path";
|
|
4833
4847
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
4834
|
-
const absoluteBase =
|
|
4835
|
-
const absoluteTarget =
|
|
4848
|
+
const absoluteBase = resolve16(baseDirectory);
|
|
4849
|
+
const absoluteTarget = resolve16(baseDirectory, targetPath);
|
|
4836
4850
|
const relativePath = normalizePath(relative5(absoluteBase, absoluteTarget));
|
|
4837
4851
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
4838
4852
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
@@ -4909,7 +4923,7 @@ import {
|
|
|
4909
4923
|
join as join12,
|
|
4910
4924
|
basename as basename5,
|
|
4911
4925
|
extname as extname5,
|
|
4912
|
-
resolve as
|
|
4926
|
+
resolve as resolve17,
|
|
4913
4927
|
relative as relative6,
|
|
4914
4928
|
sep as sep2
|
|
4915
4929
|
} from "path";
|
|
@@ -4917,14 +4931,14 @@ import { env as env2 } from "process";
|
|
|
4917
4931
|
var {write, file: file2, Transpiler } = globalThis.Bun;
|
|
4918
4932
|
var resolveDevClientDir2 = () => {
|
|
4919
4933
|
const projectRoot = process.cwd();
|
|
4920
|
-
const fromSource =
|
|
4934
|
+
const fromSource = resolve17(import.meta.dir, "../dev/client");
|
|
4921
4935
|
if (existsSync13(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4922
4936
|
return fromSource;
|
|
4923
4937
|
}
|
|
4924
|
-
const fromNodeModules =
|
|
4938
|
+
const fromNodeModules = resolve17(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
4925
4939
|
if (existsSync13(fromNodeModules))
|
|
4926
4940
|
return fromNodeModules;
|
|
4927
|
-
return
|
|
4941
|
+
return resolve17(import.meta.dir, "./dev/client");
|
|
4928
4942
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
4929
4943
|
persistentCache.clear();
|
|
4930
4944
|
sourceHashCache.clear();
|
|
@@ -4954,7 +4968,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4954
4968
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
4955
4969
|
if (!spec.startsWith("."))
|
|
4956
4970
|
return null;
|
|
4957
|
-
const basePath =
|
|
4971
|
+
const basePath = resolve17(dirname8(from), spec);
|
|
4958
4972
|
const candidates = [
|
|
4959
4973
|
basePath,
|
|
4960
4974
|
`${basePath}.ts`,
|
|
@@ -4981,7 +4995,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4981
4995
|
const resolved = resolvePackageImport(spec);
|
|
4982
4996
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
4983
4997
|
}
|
|
4984
|
-
const basePath =
|
|
4998
|
+
const basePath = resolve17(dirname8(from), spec);
|
|
4985
4999
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
4986
5000
|
if (!explicit) {
|
|
4987
5001
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -5008,7 +5022,7 @@ var resolveDevClientDir2 = () => {
|
|
|
5008
5022
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
5009
5023
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
5010
5024
|
});
|
|
5011
|
-
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false) => {
|
|
5025
|
+
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
|
|
5012
5026
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
5013
5027
|
const generatedDir = join12(svelteRoot, "generated");
|
|
5014
5028
|
const clientDir = join12(generatedDir, "client");
|
|
@@ -5036,7 +5050,7 @@ var resolveDevClientDir2 = () => {
|
|
|
5036
5050
|
const loweredServerSource = isModule ? loweredAwaitServerSource : lowerSvelteIslandSyntax(loweredAwaitServerSource.code, "server");
|
|
5037
5051
|
const loweredClientSource = isModule ? loweredAwaitClientSource : lowerSvelteIslandSyntax(loweredAwaitClientSource.code, "client");
|
|
5038
5052
|
const transformedByLowering = loweredAwaitServerSource.transformed || loweredAwaitClientSource.transformed || loweredServerSource.transformed || loweredClientSource.transformed;
|
|
5039
|
-
const svelteStylePreprocessor = createSvelteStylePreprocessor();
|
|
5053
|
+
const svelteStylePreprocessor = createSvelteStylePreprocessor(stylePreprocessors);
|
|
5040
5054
|
const preprocessedServer = isModule ? loweredServerSource.code : (await preprocess(loweredServerSource.code, svelteStylePreprocessor)).code;
|
|
5041
5055
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
5042
5056
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
@@ -5261,18 +5275,18 @@ __export(exports_compileVue, {
|
|
|
5261
5275
|
});
|
|
5262
5276
|
import { existsSync as existsSync14 } from "fs";
|
|
5263
5277
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
5264
|
-
import { basename as basename6, dirname as dirname9, join as join13, relative as relative7, resolve as
|
|
5278
|
+
import { basename as basename6, dirname as dirname9, join as join13, relative as relative7, resolve as resolve18 } from "path";
|
|
5265
5279
|
var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
5266
5280
|
var resolveDevClientDir3 = () => {
|
|
5267
5281
|
const projectRoot = process.cwd();
|
|
5268
|
-
const fromSource =
|
|
5282
|
+
const fromSource = resolve18(import.meta.dir, "../dev/client");
|
|
5269
5283
|
if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
5270
5284
|
return fromSource;
|
|
5271
5285
|
}
|
|
5272
|
-
const fromNodeModules =
|
|
5286
|
+
const fromNodeModules = resolve18(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
5273
5287
|
if (existsSync14(fromNodeModules))
|
|
5274
5288
|
return fromNodeModules;
|
|
5275
|
-
return
|
|
5289
|
+
return resolve18(import.meta.dir, "./dev/client");
|
|
5276
5290
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
5277
5291
|
scriptCache.clear();
|
|
5278
5292
|
scriptSetupCache.clear();
|
|
@@ -5334,7 +5348,7 @@ var resolveDevClientDir3 = () => {
|
|
|
5334
5348
|
].join(`
|
|
5335
5349
|
`) : nonVueLines.join(`
|
|
5336
5350
|
`);
|
|
5337
|
-
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler) => {
|
|
5351
|
+
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler, stylePreprocessors) => {
|
|
5338
5352
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
5339
5353
|
if (cachedResult)
|
|
5340
5354
|
return cachedResult;
|
|
@@ -5372,8 +5386,8 @@ var resolveDevClientDir3 = () => {
|
|
|
5372
5386
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
5373
5387
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue"));
|
|
5374
5388
|
const childBuildResults = await Promise.all([
|
|
5375
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
5376
|
-
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler))
|
|
5389
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve18(dirname9(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
5390
|
+
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
5377
5391
|
]);
|
|
5378
5392
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
5379
5393
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
@@ -5408,7 +5422,7 @@ var resolveDevClientDir3 = () => {
|
|
|
5408
5422
|
filename: sourceFilePath,
|
|
5409
5423
|
id: componentId,
|
|
5410
5424
|
scoped: styleBlock.scoped,
|
|
5411
|
-
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang) : styleBlock.content,
|
|
5425
|
+
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang, stylePreprocessors) : styleBlock.content,
|
|
5412
5426
|
trim: true
|
|
5413
5427
|
}).code));
|
|
5414
5428
|
const allCss = [
|
|
@@ -5480,14 +5494,14 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5480
5494
|
hmrId,
|
|
5481
5495
|
serverPath: serverOutputPath,
|
|
5482
5496
|
tsHelperPaths: [
|
|
5483
|
-
...helperModulePaths.map((helper) =>
|
|
5497
|
+
...helperModulePaths.map((helper) => resolve18(dirname9(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
5484
5498
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
5485
5499
|
]
|
|
5486
5500
|
};
|
|
5487
5501
|
cacheMap.set(sourceFilePath, result);
|
|
5488
5502
|
persistentBuildCache.set(sourceFilePath, result);
|
|
5489
5503
|
return result;
|
|
5490
|
-
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false) => {
|
|
5504
|
+
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors) => {
|
|
5491
5505
|
const compiler = await import("@vue/compiler-sfc");
|
|
5492
5506
|
const generatedDir = join13(vueRootDir, "generated");
|
|
5493
5507
|
const clientOutputDir = join13(generatedDir, "client");
|
|
@@ -5503,11 +5517,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5503
5517
|
const buildCache = new Map;
|
|
5504
5518
|
const allTsHelperPaths = new Set;
|
|
5505
5519
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
5506
|
-
const result = await compileVueFile(
|
|
5520
|
+
const result = await compileVueFile(resolve18(entryPath), {
|
|
5507
5521
|
client: clientOutputDir,
|
|
5508
5522
|
css: cssOutputDir,
|
|
5509
5523
|
server: serverOutputDir
|
|
5510
|
-
}, buildCache, true, vueRootDir, compiler);
|
|
5524
|
+
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
5511
5525
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
5512
5526
|
const entryBaseName = basename6(entryPath, ".vue");
|
|
5513
5527
|
const indexOutputFile = join13(indexOutputDir, `${entryBaseName}.js`);
|
|
@@ -6141,7 +6155,7 @@ __export(exports_compileAngular, {
|
|
|
6141
6155
|
compileAngular: () => compileAngular
|
|
6142
6156
|
});
|
|
6143
6157
|
import { existsSync as existsSync15, readFileSync as readFileSync9, promises as fs } from "fs";
|
|
6144
|
-
import { join as join14, basename as basename7, sep as sep3, dirname as dirname10, resolve as
|
|
6158
|
+
import { join as join14, basename as basename7, sep as sep3, dirname as dirname10, resolve as resolve19, relative as relative8 } from "path";
|
|
6145
6159
|
import ts2 from "typescript";
|
|
6146
6160
|
import { createHash as createHash2 } from "crypto";
|
|
6147
6161
|
var computeConfigHash = () => {
|
|
@@ -6153,14 +6167,14 @@ var computeConfigHash = () => {
|
|
|
6153
6167
|
}
|
|
6154
6168
|
}, resolveDevClientDir4 = () => {
|
|
6155
6169
|
const projectRoot = process.cwd();
|
|
6156
|
-
const fromSource =
|
|
6170
|
+
const fromSource = resolve19(import.meta.dir, "../dev/client");
|
|
6157
6171
|
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
6158
6172
|
return fromSource;
|
|
6159
6173
|
}
|
|
6160
|
-
const fromNodeModules =
|
|
6174
|
+
const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
6161
6175
|
if (existsSync15(fromNodeModules))
|
|
6162
6176
|
return fromNodeModules;
|
|
6163
|
-
return
|
|
6177
|
+
return resolve19(import.meta.dir, "./dev/client");
|
|
6164
6178
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
6165
6179
|
const componentClassRegex = /(?:export\s+)?class\s+(\w+Component)\s/g;
|
|
6166
6180
|
const componentNames = [];
|
|
@@ -6226,7 +6240,7 @@ ${registrations}
|
|
|
6226
6240
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
6227
6241
|
if (!isRelativeModuleSpecifier(specifier))
|
|
6228
6242
|
return null;
|
|
6229
|
-
const basePath =
|
|
6243
|
+
const basePath = resolve19(dirname10(fromFile), specifier);
|
|
6230
6244
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
6231
6245
|
`${basePath}.ts`,
|
|
6232
6246
|
`${basePath}.tsx`,
|
|
@@ -6237,24 +6251,24 @@ ${registrations}
|
|
|
6237
6251
|
join14(basePath, "index.mts"),
|
|
6238
6252
|
join14(basePath, "index.cts")
|
|
6239
6253
|
];
|
|
6240
|
-
return candidates.map((candidate) =>
|
|
6254
|
+
return candidates.map((candidate) => resolve19(candidate)).find((candidate) => existsSync15(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
6241
6255
|
}, readFileForAotTransform = async (fileName, readFile4) => {
|
|
6242
6256
|
const hostSource = readFile4?.(fileName);
|
|
6243
6257
|
if (typeof hostSource === "string")
|
|
6244
6258
|
return hostSource;
|
|
6245
6259
|
return fs.readFile(fileName, "utf-8");
|
|
6246
|
-
}, precomputeAotResourceTransforms = async (inputPath, readFile4) => {
|
|
6260
|
+
}, precomputeAotResourceTransforms = async (inputPath, readFile4, stylePreprocessors) => {
|
|
6247
6261
|
const transformedSources = new Map;
|
|
6248
6262
|
const visited = new Set;
|
|
6249
6263
|
const transformFile = async (filePath) => {
|
|
6250
|
-
const resolvedPath =
|
|
6264
|
+
const resolvedPath = resolve19(filePath);
|
|
6251
6265
|
if (visited.has(resolvedPath))
|
|
6252
6266
|
return;
|
|
6253
6267
|
visited.add(resolvedPath);
|
|
6254
6268
|
if (!existsSync15(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
6255
6269
|
return;
|
|
6256
6270
|
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
6257
|
-
const transformed = await inlineResources(source, dirname10(resolvedPath));
|
|
6271
|
+
const transformed = await inlineResources(source, dirname10(resolvedPath), stylePreprocessors);
|
|
6258
6272
|
transformedSources.set(resolvedPath, transformed.source);
|
|
6259
6273
|
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
6260
6274
|
await Promise.all(imports.map(async (specifier) => {
|
|
@@ -6265,7 +6279,7 @@ ${registrations}
|
|
|
6265
6279
|
};
|
|
6266
6280
|
await transformFile(inputPath);
|
|
6267
6281
|
return transformedSources;
|
|
6268
|
-
}, compileAngularFile = async (inputPath, outDir) => {
|
|
6282
|
+
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
6269
6283
|
const islandMetadataExports = buildIslandMetadataExports(readFileSync9(inputPath, "utf-8"));
|
|
6270
6284
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
6271
6285
|
const configHash = computeConfigHash();
|
|
@@ -6281,7 +6295,7 @@ ${registrations}
|
|
|
6281
6295
|
} else {
|
|
6282
6296
|
const tsPath = __require.resolve("typescript");
|
|
6283
6297
|
const tsRootDir = dirname10(tsPath);
|
|
6284
|
-
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir :
|
|
6298
|
+
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve19(tsRootDir, "lib");
|
|
6285
6299
|
const config = readConfiguration("./tsconfig.json");
|
|
6286
6300
|
options = {
|
|
6287
6301
|
emitDecoratorMetadata: true,
|
|
@@ -6328,13 +6342,13 @@ ${registrations}
|
|
|
6328
6342
|
};
|
|
6329
6343
|
}
|
|
6330
6344
|
const emitted = {};
|
|
6331
|
-
const resolvedOutDir =
|
|
6345
|
+
const resolvedOutDir = resolve19(outDir);
|
|
6332
6346
|
host.writeFile = (fileName, text) => {
|
|
6333
6347
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
6334
6348
|
emitted[relativePath] = text;
|
|
6335
6349
|
};
|
|
6336
6350
|
const originalReadFile = host.readFile;
|
|
6337
|
-
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host));
|
|
6351
|
+
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host), stylePreprocessors);
|
|
6338
6352
|
host.readFile = (fileName) => {
|
|
6339
6353
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
6340
6354
|
if (typeof source !== "string")
|
|
@@ -6342,7 +6356,7 @@ ${registrations}
|
|
|
6342
6356
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
6343
6357
|
return source;
|
|
6344
6358
|
}
|
|
6345
|
-
const resolvedPath =
|
|
6359
|
+
const resolvedPath = resolve19(fileName);
|
|
6346
6360
|
return aotTransformedSources.get(resolvedPath) ?? source;
|
|
6347
6361
|
};
|
|
6348
6362
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
@@ -6387,7 +6401,7 @@ ${registrations}
|
|
|
6387
6401
|
await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
|
|
6388
6402
|
return entries.map(({ target }) => target);
|
|
6389
6403
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
6390
|
-
const sourceEntry =
|
|
6404
|
+
const sourceEntry = resolve19(import.meta.dir, "../angular/components/index.ts");
|
|
6391
6405
|
if (existsSync15(sourceEntry)) {
|
|
6392
6406
|
return sourceEntry.replace(/\\/g, "/");
|
|
6393
6407
|
}
|
|
@@ -6515,10 +6529,10 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
6515
6529
|
return rewritten.replace(/export(?:\s+default)?\s+class\s+([A-Za-z_$][\w$]*)\s*{/, (match) => `${match}
|
|
6516
6530
|
${fields}
|
|
6517
6531
|
`);
|
|
6518
|
-
}, readAndEscapeFile = async (filePath) => {
|
|
6532
|
+
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
6519
6533
|
if (!existsSync15(filePath))
|
|
6520
6534
|
return null;
|
|
6521
|
-
const content = await compileStyleFileIfNeeded(filePath);
|
|
6535
|
+
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
6522
6536
|
return escapeTemplateContent(content);
|
|
6523
6537
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
6524
6538
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
@@ -6582,7 +6596,7 @@ ${fields}
|
|
|
6582
6596
|
deferSlots: lowered.slots,
|
|
6583
6597
|
source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
|
|
6584
6598
|
};
|
|
6585
|
-
}, inlineStyleUrls = async (source, fileDir) => {
|
|
6599
|
+
}, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
|
|
6586
6600
|
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
6587
6601
|
if (!styleUrlsMatch?.[1])
|
|
6588
6602
|
return source;
|
|
@@ -6591,35 +6605,35 @@ ${fields}
|
|
|
6591
6605
|
return source;
|
|
6592
6606
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
6593
6607
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
6594
|
-
return readAndEscapeFile(join14(fileDir, styleUrl));
|
|
6608
|
+
return readAndEscapeFile(join14(fileDir, styleUrl), stylePreprocessors);
|
|
6595
6609
|
});
|
|
6596
6610
|
const results = await Promise.all(stylePromises);
|
|
6597
6611
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
6598
6612
|
if (inlinedStyles.length === 0)
|
|
6599
6613
|
return source;
|
|
6600
6614
|
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
6601
|
-
}, inlineSingleStyleUrl = async (source, fileDir) => {
|
|
6615
|
+
}, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
|
|
6602
6616
|
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
6603
6617
|
if (!styleUrlMatch?.[1])
|
|
6604
6618
|
return source;
|
|
6605
|
-
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]));
|
|
6619
|
+
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
6606
6620
|
if (!escaped)
|
|
6607
6621
|
return source;
|
|
6608
6622
|
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
6609
|
-
}, inlineResources = async (source, fileDir) => {
|
|
6623
|
+
}, inlineResources = async (source, fileDir, stylePreprocessors) => {
|
|
6610
6624
|
const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
|
|
6611
6625
|
let result = inlinedTemplate.source;
|
|
6612
|
-
result = await inlineStyleUrls(result, fileDir);
|
|
6613
|
-
result = await inlineSingleStyleUrl(result, fileDir);
|
|
6626
|
+
result = await inlineStyleUrls(result, fileDir, stylePreprocessors);
|
|
6627
|
+
result = await inlineSingleStyleUrl(result, fileDir, stylePreprocessors);
|
|
6614
6628
|
return {
|
|
6615
6629
|
deferSlots: inlinedTemplate.deferSlots,
|
|
6616
6630
|
source: result
|
|
6617
6631
|
};
|
|
6618
|
-
}, compileAngularFileJIT = async (inputPath, outDir, rootDir) => {
|
|
6619
|
-
const entryPath =
|
|
6632
|
+
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors) => {
|
|
6633
|
+
const entryPath = resolve19(inputPath);
|
|
6620
6634
|
const allOutputs = [];
|
|
6621
6635
|
const visited = new Set;
|
|
6622
|
-
const baseDir =
|
|
6636
|
+
const baseDir = resolve19(rootDir ?? process.cwd());
|
|
6623
6637
|
const angularTranspiler = new Bun.Transpiler({
|
|
6624
6638
|
loader: "ts",
|
|
6625
6639
|
tsconfig: JSON.stringify({
|
|
@@ -6656,13 +6670,13 @@ ${fields}
|
|
|
6656
6670
|
return `${prefix}${dots}`;
|
|
6657
6671
|
return `${prefix}../${dots}`;
|
|
6658
6672
|
});
|
|
6659
|
-
if (
|
|
6673
|
+
if (resolve19(actualPath) === entryPath) {
|
|
6660
6674
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
6661
6675
|
}
|
|
6662
6676
|
return processedContent;
|
|
6663
6677
|
};
|
|
6664
6678
|
const transpileFile = async (filePath) => {
|
|
6665
|
-
const resolved =
|
|
6679
|
+
const resolved = resolve19(filePath);
|
|
6666
6680
|
if (visited.has(resolved))
|
|
6667
6681
|
return;
|
|
6668
6682
|
visited.add(resolved);
|
|
@@ -6672,7 +6686,7 @@ ${fields}
|
|
|
6672
6686
|
if (!existsSync15(actualPath))
|
|
6673
6687
|
return;
|
|
6674
6688
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
6675
|
-
const inlined = await inlineResources(sourceCode, dirname10(actualPath));
|
|
6689
|
+
const inlined = await inlineResources(sourceCode, dirname10(actualPath), stylePreprocessors);
|
|
6676
6690
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname10(actualPath)).source;
|
|
6677
6691
|
const inputDir = dirname10(actualPath);
|
|
6678
6692
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
@@ -6704,13 +6718,13 @@ ${fields}
|
|
|
6704
6718
|
}
|
|
6705
6719
|
const inputDirForResolve = dirname10(actualPath);
|
|
6706
6720
|
await Promise.all(localImports.map((imp) => {
|
|
6707
|
-
const importPath =
|
|
6721
|
+
const importPath = resolve19(inputDirForResolve, imp);
|
|
6708
6722
|
return transpileFile(importPath);
|
|
6709
6723
|
}));
|
|
6710
6724
|
};
|
|
6711
6725
|
await transpileFile(inputPath);
|
|
6712
6726
|
return allOutputs;
|
|
6713
|
-
}, compileAngular = async (entryPoints, outRoot, hmr = false) => {
|
|
6727
|
+
}, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
|
|
6714
6728
|
const compiledParent = join14(outRoot, "generated");
|
|
6715
6729
|
if (entryPoints.length === 0) {
|
|
6716
6730
|
const emptyPaths = [];
|
|
@@ -6720,9 +6734,9 @@ ${fields}
|
|
|
6720
6734
|
const indexesDir = join14(compiledParent, "indexes");
|
|
6721
6735
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
6722
6736
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
6723
|
-
const resolvedEntry =
|
|
6737
|
+
const resolvedEntry = resolve19(entry);
|
|
6724
6738
|
const relativeEntry = relative8(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
6725
|
-
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot) : compileAngularFile(resolvedEntry, compiledRoot);
|
|
6739
|
+
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
6726
6740
|
let outputs = await compileEntry();
|
|
6727
6741
|
const fileBase = basename7(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
6728
6742
|
const jsName = `${fileBase}.js`;
|
|
@@ -6730,10 +6744,10 @@ ${fields}
|
|
|
6730
6744
|
join14(compiledRoot, relativeEntry),
|
|
6731
6745
|
join14(compiledRoot, "pages", jsName),
|
|
6732
6746
|
join14(compiledRoot, jsName)
|
|
6733
|
-
].map((file4) =>
|
|
6747
|
+
].map((file4) => resolve19(file4));
|
|
6734
6748
|
const resolveRawServerFile = (candidatePaths) => {
|
|
6735
6749
|
const normalizedCandidates = [
|
|
6736
|
-
...candidatePaths.map((file4) =>
|
|
6750
|
+
...candidatePaths.map((file4) => resolve19(file4)),
|
|
6737
6751
|
...compiledFallbackPaths
|
|
6738
6752
|
];
|
|
6739
6753
|
let candidate = normalizedCandidates.find((file4) => existsSync15(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
@@ -6964,24 +6978,24 @@ __export(exports_buildReactVendor, {
|
|
|
6964
6978
|
buildReactVendor: () => buildReactVendor
|
|
6965
6979
|
});
|
|
6966
6980
|
import { existsSync as existsSync16, mkdirSync as mkdirSync6 } from "fs";
|
|
6967
|
-
import { join as join15, resolve as
|
|
6981
|
+
import { join as join15, resolve as resolve20 } from "path";
|
|
6968
6982
|
import { rm as rm4 } from "fs/promises";
|
|
6969
6983
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
6970
6984
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
6971
6985
|
const candidates = [
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6986
|
+
resolve20(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
6987
|
+
resolve20(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
6988
|
+
resolve20(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
6989
|
+
resolve20(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
6990
|
+
resolve20(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
6991
|
+
resolve20(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
6978
6992
|
];
|
|
6979
6993
|
for (const candidate of candidates) {
|
|
6980
6994
|
if (existsSync16(candidate)) {
|
|
6981
6995
|
return candidate.replace(/\\/g, "/");
|
|
6982
6996
|
}
|
|
6983
6997
|
}
|
|
6984
|
-
return (candidates[0] ??
|
|
6998
|
+
return (candidates[0] ?? resolve20(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
6985
6999
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
6986
7000
|
try {
|
|
6987
7001
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -7287,7 +7301,7 @@ import {
|
|
|
7287
7301
|
statSync,
|
|
7288
7302
|
writeFileSync as writeFileSync7
|
|
7289
7303
|
} from "fs";
|
|
7290
|
-
import { basename as basename8, dirname as dirname11, join as join19, relative as relative9, resolve as
|
|
7304
|
+
import { basename as basename8, dirname as dirname11, join as join19, relative as relative9, resolve as resolve21 } from "path";
|
|
7291
7305
|
import { cwd, env as env3, exit } from "process";
|
|
7292
7306
|
var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
|
|
7293
7307
|
var isDev2, collectConventionSourceFiles = (entry) => {
|
|
@@ -7375,8 +7389,8 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7375
7389
|
}
|
|
7376
7390
|
}, resolveAbsoluteVersion = async () => {
|
|
7377
7391
|
const candidates = [
|
|
7378
|
-
|
|
7379
|
-
|
|
7392
|
+
resolve21(import.meta.dir, "..", "..", "package.json"),
|
|
7393
|
+
resolve21(import.meta.dir, "..", "package.json")
|
|
7380
7394
|
];
|
|
7381
7395
|
for (const candidate of candidates) {
|
|
7382
7396
|
const pkg = await tryReadPackageJson(candidate);
|
|
@@ -7388,7 +7402,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7388
7402
|
return;
|
|
7389
7403
|
}
|
|
7390
7404
|
}, SKIP_DIRS, addWorkerPathIfExists = (file4, relPath, workerPaths) => {
|
|
7391
|
-
const absPath =
|
|
7405
|
+
const absPath = resolve21(file4, "..", relPath);
|
|
7392
7406
|
try {
|
|
7393
7407
|
statSync(absPath);
|
|
7394
7408
|
workerPaths.add(absPath);
|
|
@@ -7452,7 +7466,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7452
7466
|
return;
|
|
7453
7467
|
}
|
|
7454
7468
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
7455
|
-
const pagesRel = relative9(process.cwd(),
|
|
7469
|
+
const pagesRel = relative9(process.cwd(), resolve21(reactPagesPath)).replace(/\\/g, "/");
|
|
7456
7470
|
for (const file4 of indexFiles) {
|
|
7457
7471
|
let content = readFileSync10(join19(reactIndexesPath, file4), "utf-8");
|
|
7458
7472
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
@@ -7460,27 +7474,27 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7460
7474
|
}
|
|
7461
7475
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
7462
7476
|
const svelteIndexDir = join19(svelteDir, "generated", "indexes");
|
|
7463
|
-
const sveltePageEntries = svelteEntries.filter((file4) =>
|
|
7477
|
+
const sveltePageEntries = svelteEntries.filter((file4) => resolve21(file4).startsWith(resolve21(sveltePagesPath)));
|
|
7464
7478
|
for (const entry of sveltePageEntries) {
|
|
7465
7479
|
const name = basename8(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
7466
7480
|
const indexFile = join19(svelteIndexDir, "pages", `${name}.js`);
|
|
7467
7481
|
if (!existsSync17(indexFile))
|
|
7468
7482
|
continue;
|
|
7469
7483
|
let content = readFileSync10(indexFile, "utf-8");
|
|
7470
|
-
const srcRel = relative9(process.cwd(),
|
|
7484
|
+
const srcRel = relative9(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
7471
7485
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
7472
7486
|
writeFileSync7(join19(devIndexDir, `${name}.svelte.js`), content);
|
|
7473
7487
|
}
|
|
7474
7488
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
7475
7489
|
const vueIndexDir = join19(vueDir, "generated", "indexes");
|
|
7476
|
-
const vuePageEntries = vueEntries.filter((file4) =>
|
|
7490
|
+
const vuePageEntries = vueEntries.filter((file4) => resolve21(file4).startsWith(resolve21(vuePagesPath)));
|
|
7477
7491
|
for (const entry of vuePageEntries) {
|
|
7478
7492
|
const name = basename8(entry, ".vue");
|
|
7479
7493
|
const indexFile = join19(vueIndexDir, `${name}.js`);
|
|
7480
7494
|
if (!existsSync17(indexFile))
|
|
7481
7495
|
continue;
|
|
7482
7496
|
let content = readFileSync10(indexFile, "utf-8");
|
|
7483
|
-
const srcRel = relative9(process.cwd(),
|
|
7497
|
+
const srcRel = relative9(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
7484
7498
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
7485
7499
|
writeFileSync7(join19(devIndexDir, `${name}.vue.js`), content);
|
|
7486
7500
|
}
|
|
@@ -7493,7 +7507,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7493
7507
|
const last = allComments[allComments.length - 1];
|
|
7494
7508
|
if (!last?.[1])
|
|
7495
7509
|
return JSON.stringify(outputPath);
|
|
7496
|
-
const srcPath =
|
|
7510
|
+
const srcPath = resolve21(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
7497
7511
|
return JSON.stringify(srcPath);
|
|
7498
7512
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
7499
7513
|
let depth = 0;
|
|
@@ -7605,6 +7619,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7605
7619
|
svelteDirectory,
|
|
7606
7620
|
vueDirectory,
|
|
7607
7621
|
stylesConfig,
|
|
7622
|
+
stylePreprocessors,
|
|
7608
7623
|
tailwind,
|
|
7609
7624
|
options,
|
|
7610
7625
|
incrementalFiles,
|
|
@@ -7614,6 +7629,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7614
7629
|
const projectRoot = cwd();
|
|
7615
7630
|
await resolveAbsoluteVersion();
|
|
7616
7631
|
const isIncremental = incrementalFiles && incrementalFiles.length > 0;
|
|
7632
|
+
const stylePreprocessorPlugin2 = createStylePreprocessorPlugin(stylePreprocessors);
|
|
7617
7633
|
const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
|
|
7618
7634
|
const throwOnError = options?.throwOnError === true;
|
|
7619
7635
|
const hmr = options?.injectHMR === true;
|
|
@@ -7702,13 +7718,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7702
7718
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
7703
7719
|
if (!isIncremental || !incrementalFiles)
|
|
7704
7720
|
return entryPoints;
|
|
7705
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f) =>
|
|
7721
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f) => resolve21(f)));
|
|
7706
7722
|
const matchingEntries = [];
|
|
7707
7723
|
for (const entry of entryPoints) {
|
|
7708
7724
|
const sourceFile = mapToSource(entry);
|
|
7709
7725
|
if (!sourceFile)
|
|
7710
7726
|
continue;
|
|
7711
|
-
if (!normalizedIncremental.has(
|
|
7727
|
+
if (!normalizedIncremental.has(resolve21(sourceFile)))
|
|
7712
7728
|
continue;
|
|
7713
7729
|
matchingEntries.push(entry);
|
|
7714
7730
|
}
|
|
@@ -7777,7 +7793,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7777
7793
|
}
|
|
7778
7794
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || isStylePath(f)));
|
|
7779
7795
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
7780
|
-
if (entry.startsWith(
|
|
7796
|
+
if (entry.startsWith(resolve21(reactIndexesPath))) {
|
|
7781
7797
|
const pageName = basename8(entry, ".tsx");
|
|
7782
7798
|
return join19(reactPagesPath, `${pageName}.tsx`);
|
|
7783
7799
|
}
|
|
@@ -7809,28 +7825,28 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7809
7825
|
{ vueClientPaths: islandVueClientPaths },
|
|
7810
7826
|
{ clientPaths: islandAngularClientPaths }
|
|
7811
7827
|
] = await Promise.all([
|
|
7812
|
-
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr)) : {
|
|
7828
|
+
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
7813
7829
|
svelteClientPaths: [...emptyStringArray],
|
|
7814
7830
|
svelteIndexPaths: [...emptyStringArray],
|
|
7815
7831
|
svelteServerPaths: [...emptyStringArray]
|
|
7816
7832
|
},
|
|
7817
|
-
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr)) : {
|
|
7833
|
+
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr, stylePreprocessors)) : {
|
|
7818
7834
|
vueClientPaths: [...emptyStringArray],
|
|
7819
7835
|
vueCssPaths: [...emptyStringArray],
|
|
7820
7836
|
vueIndexPaths: [...emptyStringArray],
|
|
7821
7837
|
vueServerPaths: [...emptyStringArray]
|
|
7822
7838
|
},
|
|
7823
|
-
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr)) : {
|
|
7839
|
+
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr, stylePreprocessors)) : {
|
|
7824
7840
|
clientPaths: [...emptyStringArray],
|
|
7825
7841
|
serverPaths: [...emptyStringArray]
|
|
7826
7842
|
},
|
|
7827
|
-
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr)) : {
|
|
7843
|
+
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
7828
7844
|
svelteClientPaths: [...emptyStringArray]
|
|
7829
7845
|
},
|
|
7830
|
-
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr)) : {
|
|
7846
|
+
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr, stylePreprocessors)) : {
|
|
7831
7847
|
vueClientPaths: [...emptyStringArray]
|
|
7832
7848
|
},
|
|
7833
|
-
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr)) : {
|
|
7849
|
+
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr, stylePreprocessors)) : {
|
|
7834
7850
|
clientPaths: [...emptyStringArray]
|
|
7835
7851
|
}
|
|
7836
7852
|
]);
|
|
@@ -7840,7 +7856,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7840
7856
|
const clientPath = islandSvelteClientPaths[idx];
|
|
7841
7857
|
if (!sourcePath || !clientPath)
|
|
7842
7858
|
continue;
|
|
7843
|
-
islandSvelteClientPathMap.set(
|
|
7859
|
+
islandSvelteClientPathMap.set(resolve21(sourcePath), clientPath);
|
|
7844
7860
|
}
|
|
7845
7861
|
const islandVueClientPathMap = new Map;
|
|
7846
7862
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -7848,7 +7864,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7848
7864
|
const clientPath = islandVueClientPaths[idx];
|
|
7849
7865
|
if (!sourcePath || !clientPath)
|
|
7850
7866
|
continue;
|
|
7851
|
-
islandVueClientPathMap.set(
|
|
7867
|
+
islandVueClientPathMap.set(resolve21(sourcePath), clientPath);
|
|
7852
7868
|
}
|
|
7853
7869
|
const islandAngularClientPathMap = new Map;
|
|
7854
7870
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -7856,14 +7872,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7856
7872
|
const clientPath = islandAngularClientPaths[idx];
|
|
7857
7873
|
if (!sourcePath || !clientPath)
|
|
7858
7874
|
continue;
|
|
7859
|
-
islandAngularClientPathMap.set(
|
|
7875
|
+
islandAngularClientPathMap.set(resolve21(sourcePath), clientPath);
|
|
7860
7876
|
}
|
|
7861
7877
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
7862
7878
|
const vueConventionSources = collectConventionSourceFiles(conventionsMap.vue);
|
|
7863
7879
|
if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
|
|
7864
7880
|
const [svelteConvResult, vueConvResult] = await Promise.all([
|
|
7865
|
-
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false)) : { svelteServerPaths: emptyStringArray },
|
|
7866
|
-
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false)) : { vueServerPaths: emptyStringArray }
|
|
7881
|
+
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false, stylePreprocessors)) : { svelteServerPaths: emptyStringArray },
|
|
7882
|
+
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false, stylePreprocessors)) : { vueServerPaths: emptyStringArray }
|
|
7867
7883
|
]);
|
|
7868
7884
|
const copyConventionFiles = (framework, sources, compiledPaths) => {
|
|
7869
7885
|
const destDir = join19(buildPath, "conventions", framework);
|
|
@@ -7999,7 +8015,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7999
8015
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8000
8016
|
outdir: buildPath,
|
|
8001
8017
|
...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
|
|
8002
|
-
plugins: [
|
|
8018
|
+
plugins: [stylePreprocessorPlugin2],
|
|
8003
8019
|
root: clientRoot,
|
|
8004
8020
|
splitting: true,
|
|
8005
8021
|
target: "browser",
|
|
@@ -8057,7 +8073,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8057
8073
|
format: "esm",
|
|
8058
8074
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8059
8075
|
outdir: serverOutDir,
|
|
8060
|
-
plugins: [
|
|
8076
|
+
plugins: [stylePreprocessorPlugin2],
|
|
8061
8077
|
root: serverRoot,
|
|
8062
8078
|
target: "bun",
|
|
8063
8079
|
throw: false,
|
|
@@ -8073,7 +8089,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8073
8089
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8074
8090
|
outdir: buildPath,
|
|
8075
8091
|
plugins: [
|
|
8076
|
-
|
|
8092
|
+
stylePreprocessorPlugin2,
|
|
8077
8093
|
...angularDir && !isDev2 ? [angularLinkerPlugin] : [],
|
|
8078
8094
|
...htmlScriptPlugin ? [htmlScriptPlugin] : []
|
|
8079
8095
|
],
|
|
@@ -8092,7 +8108,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8092
8108
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8093
8109
|
outdir: buildPath,
|
|
8094
8110
|
plugins: [
|
|
8095
|
-
|
|
8111
|
+
stylePreprocessorPlugin2,
|
|
8096
8112
|
...angularDir && !isDev2 ? [angularLinkerPlugin] : []
|
|
8097
8113
|
],
|
|
8098
8114
|
root: islandEntryResult.generatedRoot,
|
|
@@ -8107,7 +8123,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8107
8123
|
outdir: stylesDir ? join19(buildPath, basename8(stylesDir)) : buildPath,
|
|
8108
8124
|
root: stylesDir || clientRoot,
|
|
8109
8125
|
target: "browser",
|
|
8110
|
-
plugins: [
|
|
8126
|
+
plugins: [stylePreprocessorPlugin2],
|
|
8111
8127
|
throw: false
|
|
8112
8128
|
}) : undefined,
|
|
8113
8129
|
vueCssPaths.length > 0 ? bunBuild6({
|
|
@@ -8398,7 +8414,7 @@ var init_build = __esm(() => {
|
|
|
8398
8414
|
// src/dev/dependencyGraph.ts
|
|
8399
8415
|
import { existsSync as existsSync18, readFileSync as readFileSync11 } from "fs";
|
|
8400
8416
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
8401
|
-
import { resolve as
|
|
8417
|
+
import { resolve as resolve22 } from "path";
|
|
8402
8418
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
8403
8419
|
const lower = filePath.toLowerCase();
|
|
8404
8420
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -8412,8 +8428,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8412
8428
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
8413
8429
|
return null;
|
|
8414
8430
|
}
|
|
8415
|
-
const fromDir =
|
|
8416
|
-
const normalized =
|
|
8431
|
+
const fromDir = resolve22(fromFile, "..");
|
|
8432
|
+
const normalized = resolve22(fromDir, importPath);
|
|
8417
8433
|
const extensions = [
|
|
8418
8434
|
".ts",
|
|
8419
8435
|
".tsx",
|
|
@@ -8443,7 +8459,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8443
8459
|
dependents.delete(normalizedPath);
|
|
8444
8460
|
}
|
|
8445
8461
|
}, addFileToGraph = (graph, filePath) => {
|
|
8446
|
-
const normalizedPath =
|
|
8462
|
+
const normalizedPath = resolve22(filePath);
|
|
8447
8463
|
if (!existsSync18(normalizedPath))
|
|
8448
8464
|
return;
|
|
8449
8465
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -8460,10 +8476,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8460
8476
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
8461
8477
|
const processedFiles = new Set;
|
|
8462
8478
|
const glob = new Glob7("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
8463
|
-
const resolvedDirs = directories.map((dir) =>
|
|
8479
|
+
const resolvedDirs = directories.map((dir) => resolve22(dir)).filter((dir) => existsSync18(dir));
|
|
8464
8480
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
8465
8481
|
for (const file4 of allFiles) {
|
|
8466
|
-
const fullPath =
|
|
8482
|
+
const fullPath = resolve22(file4);
|
|
8467
8483
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
8468
8484
|
continue;
|
|
8469
8485
|
if (processedFiles.has(fullPath))
|
|
@@ -8576,7 +8592,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8576
8592
|
return [];
|
|
8577
8593
|
}
|
|
8578
8594
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
8579
|
-
const normalizedPath =
|
|
8595
|
+
const normalizedPath = resolve22(changedFile);
|
|
8580
8596
|
const affected = new Set;
|
|
8581
8597
|
const toProcess = [normalizedPath];
|
|
8582
8598
|
const processNode = (current) => {
|
|
@@ -8616,7 +8632,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8616
8632
|
}
|
|
8617
8633
|
graph.dependents.delete(normalizedPath);
|
|
8618
8634
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
8619
|
-
const normalizedPath =
|
|
8635
|
+
const normalizedPath = resolve22(filePath);
|
|
8620
8636
|
removeDepsForFile(graph, normalizedPath);
|
|
8621
8637
|
removeDependentsForFile(graph, normalizedPath);
|
|
8622
8638
|
};
|
|
@@ -8659,12 +8675,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
8659
8675
|
};
|
|
8660
8676
|
|
|
8661
8677
|
// src/dev/configResolver.ts
|
|
8662
|
-
import { resolve as
|
|
8678
|
+
import { resolve as resolve23 } from "path";
|
|
8663
8679
|
var resolveBuildPaths = (config) => {
|
|
8664
8680
|
const cwd2 = process.cwd();
|
|
8665
8681
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
8666
|
-
const withDefault = (value, fallback) => normalize(
|
|
8667
|
-
const optional = (value) => value ? normalize(
|
|
8682
|
+
const withDefault = (value, fallback) => normalize(resolve23(cwd2, value ?? fallback));
|
|
8683
|
+
const optional = (value) => value ? normalize(resolve23(cwd2, value)) : undefined;
|
|
8668
8684
|
return {
|
|
8669
8685
|
angularDir: optional(config.angularDirectory),
|
|
8670
8686
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -8854,7 +8870,7 @@ var init_pathUtils = __esm(() => {
|
|
|
8854
8870
|
// src/dev/fileWatcher.ts
|
|
8855
8871
|
import { watch } from "fs";
|
|
8856
8872
|
import { existsSync as existsSync19 } from "fs";
|
|
8857
|
-
import { join as join20, resolve as
|
|
8873
|
+
import { join as join20, resolve as resolve24 } from "path";
|
|
8858
8874
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
8859
8875
|
try {
|
|
8860
8876
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -8899,7 +8915,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8899
8915
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
8900
8916
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8901
8917
|
paths.forEach((path) => {
|
|
8902
|
-
const absolutePath =
|
|
8918
|
+
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
8903
8919
|
if (!existsSync19(absolutePath)) {
|
|
8904
8920
|
return;
|
|
8905
8921
|
}
|
|
@@ -8910,7 +8926,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8910
8926
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
8911
8927
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8912
8928
|
watchPaths.forEach((path) => {
|
|
8913
|
-
const absolutePath =
|
|
8929
|
+
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
8914
8930
|
if (!existsSync19(absolutePath)) {
|
|
8915
8931
|
return;
|
|
8916
8932
|
}
|
|
@@ -8925,13 +8941,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
8925
8941
|
});
|
|
8926
8942
|
|
|
8927
8943
|
// src/dev/assetStore.ts
|
|
8928
|
-
import { resolve as
|
|
8944
|
+
import { resolve as resolve25 } from "path";
|
|
8929
8945
|
import { readdir as readdir3, unlink } from "fs/promises";
|
|
8930
8946
|
var mimeTypes, getMimeType = (filePath) => {
|
|
8931
8947
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
8932
8948
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
8933
8949
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
8934
|
-
const fullPath =
|
|
8950
|
+
const fullPath = resolve25(dir, entry.name);
|
|
8935
8951
|
if (entry.isDirectory()) {
|
|
8936
8952
|
return walkAndClean(fullPath);
|
|
8937
8953
|
}
|
|
@@ -8947,10 +8963,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8947
8963
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
8948
8964
|
const liveByIdentity = new Map;
|
|
8949
8965
|
for (const webPath of store.keys()) {
|
|
8950
|
-
const diskPath =
|
|
8966
|
+
const diskPath = resolve25(buildDir, webPath.slice(1));
|
|
8951
8967
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
8952
8968
|
}
|
|
8953
|
-
const absBuildDir =
|
|
8969
|
+
const absBuildDir = resolve25(buildDir);
|
|
8954
8970
|
Object.values(manifest).forEach((val) => {
|
|
8955
8971
|
if (!HASHED_FILE_RE.test(val))
|
|
8956
8972
|
return;
|
|
@@ -8968,7 +8984,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8968
8984
|
} catch {}
|
|
8969
8985
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
8970
8986
|
if (entry.isDirectory()) {
|
|
8971
|
-
return scanDir(
|
|
8987
|
+
return scanDir(resolve25(dir, entry.name), `${prefix}${entry.name}/`);
|
|
8972
8988
|
}
|
|
8973
8989
|
if (!entry.name.startsWith("chunk-")) {
|
|
8974
8990
|
return null;
|
|
@@ -8977,7 +8993,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8977
8993
|
if (store.has(webPath)) {
|
|
8978
8994
|
return null;
|
|
8979
8995
|
}
|
|
8980
|
-
return Bun.file(
|
|
8996
|
+
return Bun.file(resolve25(dir, entry.name)).bytes().then((bytes) => {
|
|
8981
8997
|
store.set(webPath, bytes);
|
|
8982
8998
|
return;
|
|
8983
8999
|
}).catch(() => {});
|
|
@@ -9002,7 +9018,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
9002
9018
|
for (const webPath of newIdentities.values()) {
|
|
9003
9019
|
if (store.has(webPath))
|
|
9004
9020
|
continue;
|
|
9005
|
-
loadPromises.push(Bun.file(
|
|
9021
|
+
loadPromises.push(Bun.file(resolve25(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
9006
9022
|
store.set(webPath, bytes);
|
|
9007
9023
|
return;
|
|
9008
9024
|
}).catch(() => {}));
|
|
@@ -9053,9 +9069,9 @@ var init_fileHashTracker = __esm(() => {
|
|
|
9053
9069
|
});
|
|
9054
9070
|
|
|
9055
9071
|
// src/dev/reactComponentClassifier.ts
|
|
9056
|
-
import { resolve as
|
|
9072
|
+
import { resolve as resolve26 } from "path";
|
|
9057
9073
|
var classifyComponent = (filePath) => {
|
|
9058
|
-
const normalizedPath =
|
|
9074
|
+
const normalizedPath = resolve26(filePath);
|
|
9059
9075
|
if (normalizedPath.includes("/react/pages/")) {
|
|
9060
9076
|
return "server";
|
|
9061
9077
|
}
|
|
@@ -9067,7 +9083,7 @@ var classifyComponent = (filePath) => {
|
|
|
9067
9083
|
var init_reactComponentClassifier = () => {};
|
|
9068
9084
|
|
|
9069
9085
|
// src/dev/moduleMapper.ts
|
|
9070
|
-
import { basename as basename9, resolve as
|
|
9086
|
+
import { basename as basename9, resolve as resolve27 } from "path";
|
|
9071
9087
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
9072
9088
|
const modulePaths = {};
|
|
9073
9089
|
moduleKeys.forEach((key) => {
|
|
@@ -9077,7 +9093,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
9077
9093
|
});
|
|
9078
9094
|
return modulePaths;
|
|
9079
9095
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
9080
|
-
const normalizedFile =
|
|
9096
|
+
const normalizedFile = resolve27(sourceFile);
|
|
9081
9097
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
9082
9098
|
if (processedFiles.has(normalizedFile)) {
|
|
9083
9099
|
return null;
|
|
@@ -9113,7 +9129,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
9113
9129
|
});
|
|
9114
9130
|
return grouped;
|
|
9115
9131
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
9116
|
-
const normalizedFile =
|
|
9132
|
+
const normalizedFile = resolve27(sourceFile);
|
|
9117
9133
|
const fileName = basename9(normalizedFile);
|
|
9118
9134
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
9119
9135
|
const pascalName = toPascal(baseName);
|
|
@@ -9396,19 +9412,19 @@ var escapeHtml = (str) => String(str).replace(/&/g, "&").replace(/</g, "<
|
|
|
9396
9412
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
9397
9413
|
import { mkdir as mkdir4, symlink } from "fs/promises";
|
|
9398
9414
|
import { tmpdir } from "os";
|
|
9399
|
-
import { basename as basename10, dirname as dirname12, join as join21, resolve as
|
|
9415
|
+
import { basename as basename10, dirname as dirname12, join as join21, resolve as resolve28 } from "path";
|
|
9400
9416
|
var ssrDirty2 = false, lastSelector = "angular-page", isRecord8 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
|
|
9401
9417
|
if (!compilerImportPromise) {
|
|
9402
9418
|
compilerImportPromise = import("@angular/compiler");
|
|
9403
9419
|
}
|
|
9404
9420
|
return compilerImportPromise;
|
|
9405
9421
|
}, readAngularPageModule = (value) => isRecord8(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join21(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
|
|
9406
|
-
const outRoot =
|
|
9422
|
+
const outRoot = resolve28(dirname12(dirname12(outDir)));
|
|
9407
9423
|
const nodeModulesLink = join21(outRoot, "node_modules");
|
|
9408
9424
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
9409
9425
|
return;
|
|
9410
9426
|
}
|
|
9411
|
-
if (nodeModulesLink ===
|
|
9427
|
+
if (nodeModulesLink === resolve28(process.cwd(), "node_modules")) {
|
|
9412
9428
|
return;
|
|
9413
9429
|
}
|
|
9414
9430
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
@@ -9416,7 +9432,7 @@ var ssrDirty2 = false, lastSelector = "angular-page", isRecord8 = (value) => typ
|
|
|
9416
9432
|
}
|
|
9417
9433
|
await mkdir4(outRoot, { recursive: true });
|
|
9418
9434
|
try {
|
|
9419
|
-
await symlink(
|
|
9435
|
+
await symlink(resolve28(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
9420
9436
|
} catch (error) {
|
|
9421
9437
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
9422
9438
|
throw error;
|
|
@@ -9860,7 +9876,7 @@ __export(exports_moduleServer, {
|
|
|
9860
9876
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
9861
9877
|
});
|
|
9862
9878
|
import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as statSync2 } from "fs";
|
|
9863
|
-
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as
|
|
9879
|
+
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve29, relative as relative10 } from "path";
|
|
9864
9880
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
9865
9881
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
9866
9882
|
const allExports = [];
|
|
@@ -9880,7 +9896,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
9880
9896
|
${stubs}
|
|
9881
9897
|
`;
|
|
9882
9898
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
9883
|
-
const found = extensions.find((ext) => existsSync20(
|
|
9899
|
+
const found = extensions.find((ext) => existsSync20(resolve29(projectRoot, srcPath + ext)));
|
|
9884
9900
|
return found ? srcPath + found : srcPath;
|
|
9885
9901
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
9886
9902
|
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
@@ -9895,7 +9911,7 @@ ${stubs}
|
|
|
9895
9911
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
9896
9912
|
}, srcUrl = (relPath, projectRoot) => {
|
|
9897
9913
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
9898
|
-
const absPath =
|
|
9914
|
+
const absPath = resolve29(projectRoot, relPath);
|
|
9899
9915
|
const cached = mtimeCache.get(absPath);
|
|
9900
9916
|
if (cached !== undefined)
|
|
9901
9917
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -9907,12 +9923,12 @@ ${stubs}
|
|
|
9907
9923
|
return base;
|
|
9908
9924
|
}
|
|
9909
9925
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
9910
|
-
const absPath =
|
|
9926
|
+
const absPath = resolve29(fileDir, relPath);
|
|
9911
9927
|
const rel = relative10(projectRoot, absPath);
|
|
9912
9928
|
const extension = extname6(rel);
|
|
9913
9929
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
9914
9930
|
if (extname6(srcPath) === ".svelte") {
|
|
9915
|
-
srcPath = relative10(projectRoot, resolveSvelteModulePath(
|
|
9931
|
+
srcPath = relative10(projectRoot, resolveSvelteModulePath(resolve29(projectRoot, srcPath)));
|
|
9916
9932
|
}
|
|
9917
9933
|
return srcUrl(srcPath, projectRoot);
|
|
9918
9934
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -9958,12 +9974,12 @@ ${stubs}
|
|
|
9958
9974
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
9959
9975
|
});
|
|
9960
9976
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
9961
|
-
const absPath =
|
|
9977
|
+
const absPath = resolve29(fileDir, relPath);
|
|
9962
9978
|
const rel = relative10(projectRoot, absPath);
|
|
9963
9979
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
9964
9980
|
});
|
|
9965
9981
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
9966
|
-
const absPath =
|
|
9982
|
+
const absPath = resolve29(fileDir, relPath);
|
|
9967
9983
|
const rel = relative10(projectRoot, absPath);
|
|
9968
9984
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
9969
9985
|
});
|
|
@@ -10163,7 +10179,7 @@ ${code}`;
|
|
|
10163
10179
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10164
10180
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
10165
10181
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
10166
|
-
}, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
|
|
10182
|
+
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10167
10183
|
const raw = readFileSync13(filePath, "utf-8");
|
|
10168
10184
|
if (!svelteCompiler) {
|
|
10169
10185
|
svelteCompiler = await import("svelte/compiler");
|
|
@@ -10171,7 +10187,7 @@ ${code}`;
|
|
|
10171
10187
|
const isModule = filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
10172
10188
|
const loweredAwaitSource = isModule ? { code: raw, transformed: false } : lowerSvelteAwaitSlotSyntax(raw);
|
|
10173
10189
|
const loweredSource = isModule ? loweredAwaitSource : lowerSvelteIslandSyntax(loweredAwaitSource.code, "client");
|
|
10174
|
-
const source = loweredSource.code;
|
|
10190
|
+
const source = isModule ? loweredSource.code : (await svelteCompiler.preprocess(loweredSource.code, createSvelteStylePreprocessor(stylePreprocessors))).code;
|
|
10175
10191
|
const enableAsync = loweredAwaitSource.transformed || loweredSource.transformed;
|
|
10176
10192
|
const code = isModule ? compileSvelteModule(source, filePath) : compileSvelteComponent(source, filePath, projectRoot, enableAsync);
|
|
10177
10193
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
@@ -10198,16 +10214,16 @@ __script__.render = render;`;
|
|
|
10198
10214
|
code += `
|
|
10199
10215
|
export default __script__;`;
|
|
10200
10216
|
return code;
|
|
10201
|
-
}, compileVueStyles = (descriptor, filePath, componentId, code) => {
|
|
10217
|
+
}, compileVueStyles = async (descriptor, filePath, componentId, code, stylePreprocessors) => {
|
|
10202
10218
|
if (descriptor.styles.length === 0)
|
|
10203
10219
|
return code;
|
|
10204
|
-
const cssCode = descriptor.styles.map((style) => vueCompiler.compileStyle({
|
|
10220
|
+
const cssCode = (await Promise.all(descriptor.styles.map(async (style) => vueCompiler.compileStyle({
|
|
10205
10221
|
filename: filePath,
|
|
10206
10222
|
id: `data-v-${componentId}`,
|
|
10207
10223
|
scoped: style.scoped,
|
|
10208
|
-
source: style.content,
|
|
10224
|
+
source: style.lang ? await compileStyleSource(filePath, style.content, style.lang, stylePreprocessors) : style.content,
|
|
10209
10225
|
trim: true
|
|
10210
|
-
}).code).join(`
|
|
10226
|
+
}).code))).join(`
|
|
10211
10227
|
`);
|
|
10212
10228
|
const escaped = cssCode.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10213
10229
|
const hmrId = JSON.stringify(filePath);
|
|
@@ -10221,7 +10237,7 @@ export default __script__;`;
|
|
|
10221
10237
|
].join("");
|
|
10222
10238
|
return `${cssInjection}
|
|
10223
10239
|
${code}`;
|
|
10224
|
-
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10240
|
+
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10225
10241
|
const raw = readFileSync13(filePath, "utf-8");
|
|
10226
10242
|
if (!vueCompiler) {
|
|
10227
10243
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
@@ -10234,12 +10250,12 @@ ${code}`;
|
|
|
10234
10250
|
inlineTemplate: false
|
|
10235
10251
|
});
|
|
10236
10252
|
let code = compileVueTemplate(descriptor, compiledScript, filePath, componentId);
|
|
10237
|
-
code = compileVueStyles(descriptor, filePath, componentId, code);
|
|
10253
|
+
code = await compileVueStyles(descriptor, filePath, componentId, code, stylePreprocessors);
|
|
10238
10254
|
code = tsTranspiler2.transformSync(code);
|
|
10239
10255
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
10240
10256
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
10241
10257
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
10242
|
-
const hmrBase = vueDir ?
|
|
10258
|
+
const hmrBase = vueDir ? resolve29(vueDir) : projectRoot;
|
|
10243
10259
|
const hmrId = relative10(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
10244
10260
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
10245
10261
|
result += [
|
|
@@ -10398,7 +10414,7 @@ export default {};
|
|
|
10398
10414
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10399
10415
|
return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
|
|
10400
10416
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
10401
|
-
const filePath =
|
|
10417
|
+
const filePath = resolve29(projectRoot, relPath);
|
|
10402
10418
|
const ext = extname6(filePath);
|
|
10403
10419
|
if (ext === ".svelte")
|
|
10404
10420
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -10411,7 +10427,7 @@ export default {};
|
|
|
10411
10427
|
if (found === ".svelte")
|
|
10412
10428
|
return { ext: found, filePath: resolveSvelteModulePath(resolved) };
|
|
10413
10429
|
return { ext: found, filePath: resolved };
|
|
10414
|
-
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir) => {
|
|
10430
|
+
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10415
10431
|
if (ext === ".css")
|
|
10416
10432
|
return jsResponse(handleCssRequest(filePath));
|
|
10417
10433
|
const isSvelte = ext === ".svelte" || filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
@@ -10419,24 +10435,24 @@ export default {};
|
|
|
10419
10435
|
if (cached)
|
|
10420
10436
|
return jsResponse(cached);
|
|
10421
10437
|
if (isSvelte)
|
|
10422
|
-
return transformAndCacheSvelte(filePath, projectRoot, rewriter);
|
|
10438
|
+
return transformAndCacheSvelte(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10423
10439
|
if (ext === ".vue")
|
|
10424
|
-
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir);
|
|
10440
|
+
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10425
10441
|
if (!TRANSPILABLE.has(ext))
|
|
10426
10442
|
return;
|
|
10427
10443
|
const stat2 = statSync2(filePath);
|
|
10428
|
-
const resolvedVueDir = vueDir ?
|
|
10444
|
+
const resolvedVueDir = vueDir ? resolve29(vueDir) : undefined;
|
|
10429
10445
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
10430
10446
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10431
10447
|
return jsResponse(content);
|
|
10432
|
-
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter) => {
|
|
10448
|
+
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10433
10449
|
const stat2 = statSync2(filePath);
|
|
10434
|
-
const content = await transformSvelteFile(filePath, projectRoot, rewriter);
|
|
10450
|
+
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10435
10451
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10436
10452
|
return jsResponse(content);
|
|
10437
|
-
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10453
|
+
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10438
10454
|
const stat2 = statSync2(filePath);
|
|
10439
|
-
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir);
|
|
10455
|
+
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10440
10456
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10441
10457
|
return jsResponse(content);
|
|
10442
10458
|
}, transformErrorResponse = (err) => {
|
|
@@ -10446,7 +10462,7 @@ export default {};
|
|
|
10446
10462
|
status: 500
|
|
10447
10463
|
});
|
|
10448
10464
|
}, createModuleServer = (config) => {
|
|
10449
|
-
const { projectRoot, vendorPaths, frameworkDirs } = config;
|
|
10465
|
+
const { projectRoot, vendorPaths, frameworkDirs, stylePreprocessors } = config;
|
|
10450
10466
|
const rewriter = buildImportRewriter(vendorPaths);
|
|
10451
10467
|
return async (pathname) => {
|
|
10452
10468
|
if (pathname.startsWith("/@stub/"))
|
|
@@ -10456,12 +10472,12 @@ export default {};
|
|
|
10456
10472
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
10457
10473
|
return;
|
|
10458
10474
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
10459
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
10475
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve29(projectRoot, relPath));
|
|
10460
10476
|
if (virtualCssResponse)
|
|
10461
10477
|
return virtualCssResponse;
|
|
10462
10478
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
10463
10479
|
try {
|
|
10464
|
-
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue);
|
|
10480
|
+
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue, stylePreprocessors);
|
|
10465
10481
|
} catch (err) {
|
|
10466
10482
|
return transformErrorResponse(err);
|
|
10467
10483
|
}
|
|
@@ -10472,11 +10488,11 @@ export default {};
|
|
|
10472
10488
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
10473
10489
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
10474
10490
|
if (match[1])
|
|
10475
|
-
files.push(
|
|
10491
|
+
files.push(resolve29(projectRoot, match[1]));
|
|
10476
10492
|
}
|
|
10477
10493
|
return files;
|
|
10478
10494
|
}, invalidateModule = (filePath) => {
|
|
10479
|
-
const resolved =
|
|
10495
|
+
const resolved = resolve29(filePath);
|
|
10480
10496
|
invalidate(filePath);
|
|
10481
10497
|
if (resolved !== filePath)
|
|
10482
10498
|
invalidate(resolved);
|
|
@@ -10495,6 +10511,7 @@ var init_moduleServer = __esm(() => {
|
|
|
10495
10511
|
init_constants();
|
|
10496
10512
|
init_resolvePackageImport();
|
|
10497
10513
|
init_sourceMetadata();
|
|
10514
|
+
init_stylePreprocessor();
|
|
10498
10515
|
init_lowerAwaitSlotSyntax();
|
|
10499
10516
|
init_lowerIslandSyntax();
|
|
10500
10517
|
init_transformCache();
|
|
@@ -10552,11 +10569,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
10552
10569
|
__export(exports_simpleHTMLHMR, {
|
|
10553
10570
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
10554
10571
|
});
|
|
10555
|
-
import { resolve as
|
|
10572
|
+
import { resolve as resolve30 } from "path";
|
|
10556
10573
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
10557
10574
|
let htmlContent;
|
|
10558
10575
|
try {
|
|
10559
|
-
const resolvedPath =
|
|
10576
|
+
const resolvedPath = resolve30(htmlFilePath);
|
|
10560
10577
|
const file4 = Bun.file(resolvedPath);
|
|
10561
10578
|
if (!await file4.exists()) {
|
|
10562
10579
|
return null;
|
|
@@ -10582,11 +10599,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
10582
10599
|
__export(exports_simpleHTMXHMR, {
|
|
10583
10600
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
10584
10601
|
});
|
|
10585
|
-
import { resolve as
|
|
10602
|
+
import { resolve as resolve31 } from "path";
|
|
10586
10603
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
10587
10604
|
let htmlContent;
|
|
10588
10605
|
try {
|
|
10589
|
-
const resolvedPath =
|
|
10606
|
+
const resolvedPath = resolve31(htmxFilePath);
|
|
10590
10607
|
const file4 = Bun.file(resolvedPath);
|
|
10591
10608
|
if (!await file4.exists()) {
|
|
10592
10609
|
return null;
|
|
@@ -10609,7 +10626,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
10609
10626
|
|
|
10610
10627
|
// src/dev/rebuildTrigger.ts
|
|
10611
10628
|
import { existsSync as existsSync21 } from "fs";
|
|
10612
|
-
import { basename as basename13, dirname as dirname15, relative as relative11, resolve as
|
|
10629
|
+
import { basename as basename13, dirname as dirname15, relative as relative11, resolve as resolve32 } from "path";
|
|
10613
10630
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
10614
10631
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
10615
10632
|
if (pathLineCol) {
|
|
@@ -10681,7 +10698,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10681
10698
|
state.fileHashes.delete(filePathInSet);
|
|
10682
10699
|
try {
|
|
10683
10700
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
10684
|
-
const deletedPathResolved =
|
|
10701
|
+
const deletedPathResolved = resolve32(filePathInSet);
|
|
10685
10702
|
affectedFiles.forEach((affectedFile) => {
|
|
10686
10703
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
10687
10704
|
validFiles.push(affectedFile);
|
|
@@ -10725,7 +10742,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10725
10742
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
10726
10743
|
return;
|
|
10727
10744
|
}
|
|
10728
|
-
const normalizedFilePath =
|
|
10745
|
+
const normalizedFilePath = resolve32(filePathInSet);
|
|
10729
10746
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
10730
10747
|
validFiles.push(normalizedFilePath);
|
|
10731
10748
|
processedFiles.add(normalizedFilePath);
|
|
@@ -10803,7 +10820,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10803
10820
|
}
|
|
10804
10821
|
if (framework === "unknown") {
|
|
10805
10822
|
const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
|
|
10806
|
-
invalidate2(
|
|
10823
|
+
invalidate2(resolve32(filePath));
|
|
10807
10824
|
const relPath = relative11(process.cwd(), filePath);
|
|
10808
10825
|
logHmrUpdate(relPath);
|
|
10809
10826
|
return;
|
|
@@ -10849,7 +10866,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10849
10866
|
}
|
|
10850
10867
|
if (!graph)
|
|
10851
10868
|
return componentFile;
|
|
10852
|
-
const dependents = graph.dependents.get(
|
|
10869
|
+
const dependents = graph.dependents.get(resolve32(componentFile));
|
|
10853
10870
|
if (!dependents)
|
|
10854
10871
|
return componentFile;
|
|
10855
10872
|
for (const dep of dependents) {
|
|
@@ -10858,7 +10875,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10858
10875
|
}
|
|
10859
10876
|
return componentFile;
|
|
10860
10877
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
10861
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
10878
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve32(file4).startsWith(angularPagesPath));
|
|
10862
10879
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
10863
10880
|
return pageEntries;
|
|
10864
10881
|
}
|
|
@@ -10867,7 +10884,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10867
10884
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
10868
10885
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
10869
10886
|
affected.forEach((file4) => {
|
|
10870
|
-
if (file4.endsWith(".ts") &&
|
|
10887
|
+
if (file4.endsWith(".ts") && resolve32(file4).startsWith(angularPagesPath)) {
|
|
10871
10888
|
resolvedPages.add(file4);
|
|
10872
10889
|
}
|
|
10873
10890
|
});
|
|
@@ -10917,7 +10934,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10917
10934
|
format: "esm",
|
|
10918
10935
|
naming: "[dir]/[name].[hash].[ext]",
|
|
10919
10936
|
outdir: buildDir,
|
|
10920
|
-
plugins: [
|
|
10937
|
+
plugins: [
|
|
10938
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
10939
|
+
],
|
|
10921
10940
|
root: clientRoot,
|
|
10922
10941
|
target: "browser",
|
|
10923
10942
|
throw: false
|
|
@@ -10958,10 +10977,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10958
10977
|
});
|
|
10959
10978
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
10960
10979
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
10961
|
-
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true);
|
|
10980
|
+
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, state.config.stylePreprocessors);
|
|
10962
10981
|
serverPaths.forEach((serverPath) => {
|
|
10963
10982
|
const fileBase = basename13(serverPath, ".js");
|
|
10964
|
-
state.manifest[toPascal(fileBase)] =
|
|
10983
|
+
state.manifest[toPascal(fileBase)] = resolve32(serverPath);
|
|
10965
10984
|
});
|
|
10966
10985
|
if (clientPaths.length > 0) {
|
|
10967
10986
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
@@ -10970,9 +10989,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10970
10989
|
const angularDir = config.angularDirectory ?? "";
|
|
10971
10990
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
10972
10991
|
for (const file4 of angularFiles) {
|
|
10973
|
-
state.fileHashes.set(
|
|
10992
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
10974
10993
|
}
|
|
10975
|
-
const angularPagesPath =
|
|
10994
|
+
const angularPagesPath = resolve32(angularDir, "pages");
|
|
10976
10995
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
10977
10996
|
if (pageEntries.length > 0) {
|
|
10978
10997
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
@@ -10987,7 +11006,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10987
11006
|
return manifest;
|
|
10988
11007
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
10989
11008
|
const pageName = basename13(normalized, ".tsx");
|
|
10990
|
-
const indexPath =
|
|
11009
|
+
const indexPath = resolve32(reactIndexesPath, `${pageName}.tsx`);
|
|
10991
11010
|
if (!existsSync21(indexPath)) {
|
|
10992
11011
|
return;
|
|
10993
11012
|
}
|
|
@@ -10999,13 +11018,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10999
11018
|
return;
|
|
11000
11019
|
}
|
|
11001
11020
|
const pageName = basename13(dep, ".tsx");
|
|
11002
|
-
const indexPath =
|
|
11021
|
+
const indexPath = resolve32(reactIndexesPath, `${pageName}.tsx`);
|
|
11003
11022
|
if (existsSync21(indexPath) && !reactEntries.includes(indexPath)) {
|
|
11004
11023
|
reactEntries.push(indexPath);
|
|
11005
11024
|
}
|
|
11006
11025
|
});
|
|
11007
11026
|
}, resolveReactEntryForFile = (state, file4, pagesPathResolved, reactIndexesPath, reactEntries) => {
|
|
11008
|
-
const normalized =
|
|
11027
|
+
const normalized = resolve32(file4);
|
|
11009
11028
|
if (!normalized.startsWith(pagesPathResolved)) {
|
|
11010
11029
|
resolveReactEntriesFromDeps(state, normalized, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
11011
11030
|
return;
|
|
@@ -11016,7 +11035,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11016
11035
|
}
|
|
11017
11036
|
}, collectReactEntries = (state, filesToRebuild, reactPagesPath, reactIndexesPath) => {
|
|
11018
11037
|
const reactEntries = [];
|
|
11019
|
-
const pagesPathResolved =
|
|
11038
|
+
const pagesPathResolved = resolve32(reactPagesPath);
|
|
11020
11039
|
filesToRebuild.forEach((file4) => {
|
|
11021
11040
|
resolveReactEntryForFile(state, file4, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
11022
11041
|
});
|
|
@@ -11028,7 +11047,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11028
11047
|
const { rewriteReactImports: rewriteReactImports2 } = await Promise.resolve().then(() => (init_rewriteReactImports(), exports_rewriteReactImports));
|
|
11029
11048
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11030
11049
|
const depVendorPaths = globalThis.__depVendorPaths ?? {};
|
|
11031
|
-
const refreshEntry =
|
|
11050
|
+
const refreshEntry = resolve32(reactIndexesPath, "_refresh.tsx");
|
|
11032
11051
|
if (!reactEntries.includes(refreshEntry)) {
|
|
11033
11052
|
reactEntries.push(refreshEntry);
|
|
11034
11053
|
}
|
|
@@ -11040,7 +11059,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11040
11059
|
setDevVendorPaths2(vendorPaths);
|
|
11041
11060
|
}
|
|
11042
11061
|
const { rmSync: rmSync3 } = await import("fs");
|
|
11043
|
-
rmSync3(
|
|
11062
|
+
rmSync3(resolve32(buildDir, "react", "generated", "indexes"), {
|
|
11044
11063
|
force: true,
|
|
11045
11064
|
recursive: true
|
|
11046
11065
|
});
|
|
@@ -11050,7 +11069,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11050
11069
|
jsx: { development: true },
|
|
11051
11070
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11052
11071
|
outdir: buildDir,
|
|
11053
|
-
plugins: [
|
|
11072
|
+
plugins: [
|
|
11073
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11074
|
+
],
|
|
11054
11075
|
reactFastRefresh: true,
|
|
11055
11076
|
root: clientRoot,
|
|
11056
11077
|
splitting: true,
|
|
@@ -11090,11 +11111,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11090
11111
|
if (isComponentFile2)
|
|
11091
11112
|
return primaryFile;
|
|
11092
11113
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
11093
|
-
const nearest = findNearestComponent2(
|
|
11114
|
+
const nearest = findNearestComponent2(resolve32(primaryFile));
|
|
11094
11115
|
return nearest ?? primaryFile;
|
|
11095
11116
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
11096
11117
|
for (const file4 of reactFiles) {
|
|
11097
|
-
state.fileHashes.set(
|
|
11118
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
11098
11119
|
}
|
|
11099
11120
|
invalidateReactSsrCache();
|
|
11100
11121
|
const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -11136,8 +11157,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11136
11157
|
return state.manifest;
|
|
11137
11158
|
}, handleReactFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
11138
11159
|
const reactDir = config.reactDirectory ?? "";
|
|
11139
|
-
const reactPagesPath =
|
|
11140
|
-
const reactIndexesPath =
|
|
11160
|
+
const reactPagesPath = resolve32(reactDir, "pages");
|
|
11161
|
+
const reactIndexesPath = resolve32(reactDir, "generated", "indexes");
|
|
11141
11162
|
const { buildDir } = state.resolvedPaths;
|
|
11142
11163
|
const reactFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "react");
|
|
11143
11164
|
if (reactFiles.length > 0) {
|
|
@@ -11200,7 +11221,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11200
11221
|
});
|
|
11201
11222
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
11202
11223
|
for (const file4 of svelteFiles) {
|
|
11203
|
-
state.fileHashes.set(
|
|
11224
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
11204
11225
|
}
|
|
11205
11226
|
invalidateSvelteSsrCache();
|
|
11206
11227
|
const serverDuration = Date.now() - startTime;
|
|
@@ -11223,11 +11244,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11223
11244
|
const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
|
|
11224
11245
|
const { build: bunBuild7 } = await Promise.resolve(globalThis.Bun);
|
|
11225
11246
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11226
|
-
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true);
|
|
11247
|
+
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, state.config.stylePreprocessors);
|
|
11227
11248
|
const serverEntries = [...svelteServerPaths];
|
|
11228
11249
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
11229
|
-
const serverRoot =
|
|
11230
|
-
const serverOutDir =
|
|
11250
|
+
const serverRoot = resolve32(svelteDir, "generated", "server");
|
|
11251
|
+
const serverOutDir = resolve32(buildDir, basename13(svelteDir));
|
|
11231
11252
|
const [serverResult, clientResult] = await Promise.all([
|
|
11232
11253
|
serverEntries.length > 0 ? bunBuild7({
|
|
11233
11254
|
entrypoints: serverEntries,
|
|
@@ -11242,7 +11263,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11242
11263
|
format: "esm",
|
|
11243
11264
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11244
11265
|
outdir: serverOutDir,
|
|
11245
|
-
plugins: [
|
|
11266
|
+
plugins: [
|
|
11267
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11268
|
+
],
|
|
11246
11269
|
root: serverRoot,
|
|
11247
11270
|
target: "bun",
|
|
11248
11271
|
throw: false
|
|
@@ -11252,7 +11275,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11252
11275
|
format: "esm",
|
|
11253
11276
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11254
11277
|
outdir: buildDir,
|
|
11255
|
-
plugins: [
|
|
11278
|
+
plugins: [
|
|
11279
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11280
|
+
],
|
|
11256
11281
|
root: clientRoot,
|
|
11257
11282
|
target: "browser",
|
|
11258
11283
|
throw: false
|
|
@@ -11320,7 +11345,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11320
11345
|
});
|
|
11321
11346
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
11322
11347
|
for (const file4 of [...vueFiles, ...nonVueFiles]) {
|
|
11323
|
-
state.fileHashes.set(
|
|
11348
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
11324
11349
|
}
|
|
11325
11350
|
invalidateVueSsrCache();
|
|
11326
11351
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -11415,8 +11440,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11415
11440
|
if (!buildReference?.source) {
|
|
11416
11441
|
return;
|
|
11417
11442
|
}
|
|
11418
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
11419
|
-
islandFiles.add(
|
|
11443
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve32(dirname15(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
11444
|
+
islandFiles.add(resolve32(sourcePath));
|
|
11420
11445
|
}, resolveIslandSourceFiles = async (config) => {
|
|
11421
11446
|
const registryPath = config.islands?.registry;
|
|
11422
11447
|
if (!registryPath) {
|
|
@@ -11424,7 +11449,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11424
11449
|
}
|
|
11425
11450
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
11426
11451
|
const islandFiles = new Set([
|
|
11427
|
-
|
|
11452
|
+
resolve32(buildInfo.resolvedRegistryPath)
|
|
11428
11453
|
]);
|
|
11429
11454
|
for (const definition of buildInfo.definitions) {
|
|
11430
11455
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -11435,7 +11460,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11435
11460
|
if (islandFiles.size === 0) {
|
|
11436
11461
|
return false;
|
|
11437
11462
|
}
|
|
11438
|
-
return filesToRebuild.some((file4) => islandFiles.has(
|
|
11463
|
+
return filesToRebuild.some((file4) => islandFiles.has(resolve32(file4)));
|
|
11439
11464
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
11440
11465
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
11441
11466
|
if (!shouldReload) {
|
|
@@ -11470,10 +11495,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11470
11495
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
11471
11496
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
11472
11497
|
if (isSingle) {
|
|
11473
|
-
return
|
|
11498
|
+
return resolve32(state.resolvedPaths.buildDir, "pages");
|
|
11474
11499
|
}
|
|
11475
11500
|
const dirName = framework === "html" ? basename13(config.htmlDirectory ?? "html") : basename13(config.htmxDirectory ?? "htmx");
|
|
11476
|
-
return
|
|
11501
|
+
return resolve32(state.resolvedPaths.buildDir, dirName, "pages");
|
|
11477
11502
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
11478
11503
|
try {
|
|
11479
11504
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -11512,7 +11537,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11512
11537
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
11513
11538
|
for (const pageFile of pageFilesToUpdate) {
|
|
11514
11539
|
const htmlPageName = basename13(pageFile);
|
|
11515
|
-
const builtHtmlPagePath =
|
|
11540
|
+
const builtHtmlPagePath = resolve32(outputHtmlPages, htmlPageName);
|
|
11516
11541
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
11517
11542
|
}
|
|
11518
11543
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -11577,7 +11602,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11577
11602
|
const cssKey = `${pascalName}CSS`;
|
|
11578
11603
|
const cssUrl = manifest[cssKey] || null;
|
|
11579
11604
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
11580
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
11605
|
+
const hmrMeta = vueHmrMetadata2.get(resolve32(vuePagePath));
|
|
11581
11606
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
11582
11607
|
if (changeType === "style-only") {
|
|
11583
11608
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -11814,7 +11839,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11814
11839
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
11815
11840
|
for (const htmxPageFile of pageFilesToUpdate) {
|
|
11816
11841
|
const htmxPageName = basename13(htmxPageFile);
|
|
11817
|
-
const builtHtmxPagePath =
|
|
11842
|
+
const builtHtmxPagePath = resolve32(outputHtmxPages, htmxPageName);
|
|
11818
11843
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
11819
11844
|
}
|
|
11820
11845
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -11923,7 +11948,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11923
11948
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
11924
11949
|
writeFs(destPath, html);
|
|
11925
11950
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
11926
|
-
const destPath =
|
|
11951
|
+
const destPath = resolve32(outputDir, basename13(sourceFile));
|
|
11927
11952
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
11928
11953
|
const source = await Bun.file(sourceFile).text();
|
|
11929
11954
|
await Bun.write(destPath, source);
|
|
@@ -12299,7 +12324,7 @@ __export(exports_devBuild, {
|
|
|
12299
12324
|
});
|
|
12300
12325
|
import { readdir as readdir5 } from "fs/promises";
|
|
12301
12326
|
import { statSync as statSync3 } from "fs";
|
|
12302
|
-
import { dirname as dirname16, resolve as
|
|
12327
|
+
import { dirname as dirname16, resolve as resolve33 } from "path";
|
|
12303
12328
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
12304
12329
|
const configuredDirs = [
|
|
12305
12330
|
config.reactDirectory,
|
|
@@ -12322,7 +12347,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12322
12347
|
return Object.keys(config).length > 0 ? config : null;
|
|
12323
12348
|
}, reloadConfig = async () => {
|
|
12324
12349
|
try {
|
|
12325
|
-
const configPath2 =
|
|
12350
|
+
const configPath2 = resolve33(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
12326
12351
|
const source = await Bun.file(configPath2).text();
|
|
12327
12352
|
return parseDirectoryConfig(source);
|
|
12328
12353
|
} catch {
|
|
@@ -12402,7 +12427,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12402
12427
|
state.fileChangeQueue.clear();
|
|
12403
12428
|
}
|
|
12404
12429
|
}, handleCachedReload = async () => {
|
|
12405
|
-
const serverMtime = statSync3(
|
|
12430
|
+
const serverMtime = statSync3(resolve33(Bun.main)).mtimeMs;
|
|
12406
12431
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
12407
12432
|
globalThis.__hmrServerMtime = serverMtime;
|
|
12408
12433
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -12436,8 +12461,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12436
12461
|
return true;
|
|
12437
12462
|
}, resolveAbsoluteVersion2 = async () => {
|
|
12438
12463
|
const candidates = [
|
|
12439
|
-
|
|
12440
|
-
|
|
12464
|
+
resolve33(import.meta.dir, "..", "..", "package.json"),
|
|
12465
|
+
resolve33(import.meta.dir, "..", "package.json")
|
|
12441
12466
|
];
|
|
12442
12467
|
for (const candidate of candidates) {
|
|
12443
12468
|
const found = await tryReadPackageVersion(candidate);
|
|
@@ -12450,7 +12475,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12450
12475
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
12451
12476
|
await Promise.all(entries.map(async (entry) => {
|
|
12452
12477
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
12453
|
-
const bytes = await Bun.file(
|
|
12478
|
+
const bytes = await Bun.file(resolve33(vendorDir, entry)).bytes();
|
|
12454
12479
|
assetStore.set(webPath, bytes);
|
|
12455
12480
|
}));
|
|
12456
12481
|
}, devBuild = async (config) => {
|
|
@@ -12514,7 +12539,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12514
12539
|
recordStep("populate asset store", stepStartedAt);
|
|
12515
12540
|
stepStartedAt = performance.now();
|
|
12516
12541
|
const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12517
|
-
const vendorDir =
|
|
12542
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "react", "vendor");
|
|
12518
12543
|
await loadVendorFiles(state.assetStore, vendorDir, "react");
|
|
12519
12544
|
if (!globalThis.__reactModuleRef) {
|
|
12520
12545
|
globalThis.__reactModuleRef = await import("react");
|
|
@@ -12522,23 +12547,23 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12522
12547
|
return true;
|
|
12523
12548
|
}) : undefined;
|
|
12524
12549
|
const buildAngularVendorTask = config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12525
|
-
const vendorDir =
|
|
12550
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
12526
12551
|
await loadVendorFiles(state.assetStore, vendorDir, "angular");
|
|
12527
12552
|
return true;
|
|
12528
12553
|
}) : undefined;
|
|
12529
12554
|
const buildSvelteVendorTask = config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12530
|
-
const vendorDir =
|
|
12555
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
12531
12556
|
await loadVendorFiles(state.assetStore, vendorDir, "svelte");
|
|
12532
12557
|
return true;
|
|
12533
12558
|
}) : undefined;
|
|
12534
12559
|
const buildVueVendorTask = config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12535
|
-
const vendorDir =
|
|
12560
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
12536
12561
|
await loadVendorFiles(state.assetStore, vendorDir, "vue");
|
|
12537
12562
|
return true;
|
|
12538
12563
|
}) : undefined;
|
|
12539
12564
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
12540
12565
|
const buildDepVendorTask = buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs).then(async (depPaths) => {
|
|
12541
|
-
const vendorDir =
|
|
12566
|
+
const vendorDir = resolve33(state.resolvedPaths.buildDir, "vendor");
|
|
12542
12567
|
await loadVendorFiles(state.assetStore, vendorDir, "vendor");
|
|
12543
12568
|
globalThis.__depVendorPaths = depPaths;
|
|
12544
12569
|
return true;
|
|
@@ -12575,7 +12600,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12575
12600
|
manifest
|
|
12576
12601
|
};
|
|
12577
12602
|
globalThis.__hmrDevResult = result;
|
|
12578
|
-
globalThis.__hmrServerMtime = statSync3(
|
|
12603
|
+
globalThis.__hmrServerMtime = statSync3(resolve33(Bun.main)).mtimeMs;
|
|
12579
12604
|
return result;
|
|
12580
12605
|
};
|
|
12581
12606
|
var init_devBuild = __esm(() => {
|
|
@@ -12725,12 +12750,12 @@ __export(exports_devtoolsJson, {
|
|
|
12725
12750
|
devtoolsJson: () => devtoolsJson
|
|
12726
12751
|
});
|
|
12727
12752
|
import { existsSync as existsSync22, mkdirSync as mkdirSync12, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
|
|
12728
|
-
import { dirname as dirname17, join as join23, resolve as
|
|
12753
|
+
import { dirname as dirname17, join as join23, resolve as resolve34 } from "path";
|
|
12729
12754
|
import { Elysia as Elysia3 } from "elysia";
|
|
12730
12755
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
12731
12756
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
12732
12757
|
return uuid;
|
|
12733
|
-
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) =>
|
|
12758
|
+
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve34(uuidCachePath ?? join23(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
12734
12759
|
if (!existsSync22(cachePath))
|
|
12735
12760
|
return null;
|
|
12736
12761
|
try {
|
|
@@ -12756,7 +12781,7 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
12756
12781
|
writeFileSync8(cachePath, uuid, "utf-8");
|
|
12757
12782
|
return setGlobalUuid(uuid);
|
|
12758
12783
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
12759
|
-
const rootPath =
|
|
12784
|
+
const rootPath = resolve34(options.projectRoot ?? process.cwd());
|
|
12760
12785
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
12761
12786
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
12762
12787
|
return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -12785,7 +12810,7 @@ __export(exports_imageOptimizer, {
|
|
|
12785
12810
|
imageOptimizer: () => imageOptimizer
|
|
12786
12811
|
});
|
|
12787
12812
|
import { existsSync as existsSync23 } from "fs";
|
|
12788
|
-
import { resolve as
|
|
12813
|
+
import { resolve as resolve35 } from "path";
|
|
12789
12814
|
import { Elysia as Elysia4 } from "elysia";
|
|
12790
12815
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
12791
12816
|
try {
|
|
@@ -12798,7 +12823,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
12798
12823
|
}
|
|
12799
12824
|
}, resolveLocalImage = (url, buildDir) => {
|
|
12800
12825
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
12801
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
12826
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve35(process.cwd()));
|
|
12802
12827
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
12803
12828
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
12804
12829
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -13438,11 +13463,11 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
13438
13463
|
};
|
|
13439
13464
|
// src/core/prepare.ts
|
|
13440
13465
|
import { existsSync as existsSync24, readdirSync as readdirSync2, readFileSync as readFileSync16 } from "fs";
|
|
13441
|
-
import { basename as basename14, join as join25, relative as relative12, resolve as
|
|
13466
|
+
import { basename as basename14, join as join25, relative as relative12, resolve as resolve36 } from "path";
|
|
13442
13467
|
import { Elysia as Elysia5 } from "elysia";
|
|
13443
13468
|
|
|
13444
13469
|
// src/utils/loadConfig.ts
|
|
13445
|
-
import { resolve as
|
|
13470
|
+
import { resolve as resolve7 } from "path";
|
|
13446
13471
|
var RESERVED_TOP_LEVEL_KEYS = new Set([
|
|
13447
13472
|
"assetsDirectory",
|
|
13448
13473
|
"astroDirectory",
|
|
@@ -13520,7 +13545,7 @@ var projectServiceConfig = (config, serviceName) => {
|
|
|
13520
13545
|
return serviceConfig;
|
|
13521
13546
|
};
|
|
13522
13547
|
var loadRawConfig = async (configPath) => {
|
|
13523
|
-
const resolved =
|
|
13548
|
+
const resolved = resolve7(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
13524
13549
|
const mod = await import(resolved);
|
|
13525
13550
|
const config = mod.default ?? mod.config;
|
|
13526
13551
|
if (!config) {
|
|
@@ -13548,7 +13573,7 @@ var loadConfig = async (configPath) => {
|
|
|
13548
13573
|
init_islandPageContext();
|
|
13549
13574
|
|
|
13550
13575
|
// src/core/loadIslandRegistry.ts
|
|
13551
|
-
import { resolve as
|
|
13576
|
+
import { resolve as resolve8 } from "path";
|
|
13552
13577
|
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
13553
13578
|
var resolveRegistryExport2 = (mod) => {
|
|
13554
13579
|
if (isRecord6(mod.islandRegistry))
|
|
@@ -13560,7 +13585,7 @@ var resolveRegistryExport2 = (mod) => {
|
|
|
13560
13585
|
var isRegistryModuleExport = (value) => isRecord6(value);
|
|
13561
13586
|
var isIslandRegistryInput = (value) => isRecord6(value);
|
|
13562
13587
|
var loadIslandRegistry = async (registryPath) => {
|
|
13563
|
-
const resolvedRegistryPath =
|
|
13588
|
+
const resolvedRegistryPath = resolve8(registryPath);
|
|
13564
13589
|
const importedModule = await import(resolvedRegistryPath);
|
|
13565
13590
|
if (!isRegistryModuleExport(importedModule)) {
|
|
13566
13591
|
throw new Error("Island registry module must export an object namespace.");
|
|
@@ -13604,7 +13629,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
13604
13629
|
for (const { dir, pattern } of prewarmDirs) {
|
|
13605
13630
|
const glob = new Glob9(pattern);
|
|
13606
13631
|
const matches = [
|
|
13607
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
13632
|
+
...glob.scanSync({ absolute: true, cwd: resolve36(dir) })
|
|
13608
13633
|
];
|
|
13609
13634
|
files.push(...matches);
|
|
13610
13635
|
}
|
|
@@ -13640,7 +13665,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
13640
13665
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
13641
13666
|
if (!fileName)
|
|
13642
13667
|
continue;
|
|
13643
|
-
const srcPath =
|
|
13668
|
+
const srcPath = resolve36(devIndexDir, fileName);
|
|
13644
13669
|
if (!existsSync24(srcPath))
|
|
13645
13670
|
continue;
|
|
13646
13671
|
const rel = relative12(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
@@ -13692,6 +13717,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
13692
13717
|
vue: config.vueDirectory
|
|
13693
13718
|
},
|
|
13694
13719
|
projectRoot: process.cwd(),
|
|
13720
|
+
stylePreprocessors: config.stylePreprocessors,
|
|
13695
13721
|
vendorPaths: allVendorPaths
|
|
13696
13722
|
});
|
|
13697
13723
|
setGlobalModuleServer2(moduleHandler);
|
|
@@ -13710,7 +13736,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
13710
13736
|
stepStartedAt = performance.now();
|
|
13711
13737
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
13712
13738
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
13713
|
-
const devIndexDir =
|
|
13739
|
+
const devIndexDir = resolve36(buildDir, "_src_indexes");
|
|
13714
13740
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
13715
13741
|
recordStep("configure dev plugins", stepStartedAt);
|
|
13716
13742
|
stepStartedAt = performance.now();
|
|
@@ -13790,7 +13816,7 @@ var prepare = async (configOrPath) => {
|
|
|
13790
13816
|
recordStep("load config", stepStartedAt);
|
|
13791
13817
|
const nodeEnv = process.env["NODE_ENV"];
|
|
13792
13818
|
const isDev3 = nodeEnv === "development";
|
|
13793
|
-
const buildDir =
|
|
13819
|
+
const buildDir = resolve36(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
13794
13820
|
if (isDev3) {
|
|
13795
13821
|
stepStartedAt = performance.now();
|
|
13796
13822
|
const result = await prepareDev(config, buildDir);
|
|
@@ -14215,7 +14241,7 @@ var jsonLd2 = (schema) => {
|
|
|
14215
14241
|
// src/utils/defineEnv.ts
|
|
14216
14242
|
var {env: bunEnv } = globalThis.Bun;
|
|
14217
14243
|
import { existsSync as existsSync26, readFileSync as readFileSync18 } from "fs";
|
|
14218
|
-
import { resolve as
|
|
14244
|
+
import { resolve as resolve37 } from "path";
|
|
14219
14245
|
|
|
14220
14246
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
14221
14247
|
var exports_value = {};
|
|
@@ -20250,7 +20276,7 @@ ${lines.join(`
|
|
|
20250
20276
|
};
|
|
20251
20277
|
var checkEnvFileSecurity = (properties) => {
|
|
20252
20278
|
const cwd2 = process.cwd();
|
|
20253
|
-
const envPath =
|
|
20279
|
+
const envPath = resolve37(cwd2, ".env");
|
|
20254
20280
|
if (!existsSync26(envPath))
|
|
20255
20281
|
return;
|
|
20256
20282
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
@@ -20260,7 +20286,7 @@ var checkEnvFileSecurity = (properties) => {
|
|
|
20260
20286
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
20261
20287
|
if (presentKeys.length === 0)
|
|
20262
20288
|
return;
|
|
20263
|
-
const gitignorePath =
|
|
20289
|
+
const gitignorePath = resolve37(cwd2, ".gitignore");
|
|
20264
20290
|
if (existsSync26(gitignorePath)) {
|
|
20265
20291
|
const gitignore = readFileSync18(gitignorePath, "utf-8");
|
|
20266
20292
|
if (gitignore.split(`
|
|
@@ -20469,5 +20495,5 @@ export {
|
|
|
20469
20495
|
ANGULAR_INIT_TIMEOUT_MS
|
|
20470
20496
|
};
|
|
20471
20497
|
|
|
20472
|
-
//# debugId=
|
|
20498
|
+
//# debugId=A6C7D117925B5F8264756E2164756E21
|
|
20473
20499
|
//# sourceMappingURL=index.js.map
|