@absolutejs/absolute 0.19.0-beta.691 → 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 +184 -177
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +166 -159
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +409 -391
- package/dist/build.js.map +9 -9
- package/dist/index.js +450 -431
- package/dist/index.js.map +10 -10
- package/dist/islands/index.js +64 -78
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +64 -78
- 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 +70 -84
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +64 -78
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +28 -0
- package/dist/vue/index.js +64 -78
- package/dist/vue/index.js.map +3 -3
- package/package.json +7 -7
package/dist/build.js
CHANGED
|
@@ -2448,10 +2448,9 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2448
2448
|
});
|
|
2449
2449
|
|
|
2450
2450
|
// src/build/stylePreprocessor.ts
|
|
2451
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
2452
2451
|
import { readFile } from "fs/promises";
|
|
2453
2452
|
import { createRequire } from "module";
|
|
2454
|
-
import { dirname as dirname3, extname as extname3, join as join5 } from "path";
|
|
2453
|
+
import { dirname as dirname3, extname as extname3, join as join5, resolve as resolve6 } from "path";
|
|
2455
2454
|
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) => {
|
|
2456
2455
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2457
2456
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -2461,24 +2460,29 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2461
2460
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
2462
2461
|
return "less";
|
|
2463
2462
|
return null;
|
|
2464
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
}
|
|
2470
|
-
|
|
2463
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
2464
|
+
dirname3(filePath),
|
|
2465
|
+
process.cwd(),
|
|
2466
|
+
...paths.map((path) => resolve6(process.cwd(), path))
|
|
2467
|
+
], getSassOptions = (config, language) => ({
|
|
2468
|
+
...config?.sass ?? {},
|
|
2469
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
2470
|
+
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2471
|
+
${contents}` : contents, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
2471
2472
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2472
|
-
const
|
|
2473
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2473
2474
|
if (language === "scss" || language === "sass") {
|
|
2475
|
+
const options = getSassOptions(config, language);
|
|
2476
|
+
const packageName = options.implementation ?? "sass";
|
|
2474
2477
|
let sass;
|
|
2475
2478
|
try {
|
|
2476
|
-
sass = await importOptionalPeer(
|
|
2479
|
+
sass = await importOptionalPeer(packageName);
|
|
2477
2480
|
} catch {
|
|
2478
|
-
throw missingDependencyError(
|
|
2481
|
+
throw missingDependencyError(packageName, filePath);
|
|
2479
2482
|
}
|
|
2483
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2480
2484
|
const result = sass.compileString(contents, {
|
|
2481
|
-
loadPaths:
|
|
2485
|
+
loadPaths: normalizeLoadPaths(filePath, options.loadPaths),
|
|
2482
2486
|
style: "expanded",
|
|
2483
2487
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2484
2488
|
url: new URL(`file://${filePath}`)
|
|
@@ -2486,6 +2490,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2486
2490
|
return result.css;
|
|
2487
2491
|
}
|
|
2488
2492
|
if (language === "less") {
|
|
2493
|
+
const options = getLessOptions(config);
|
|
2489
2494
|
let lessModule;
|
|
2490
2495
|
try {
|
|
2491
2496
|
lessModule = await importOptionalPeer("less");
|
|
@@ -2496,14 +2501,49 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2496
2501
|
const render = less?.render;
|
|
2497
2502
|
if (!render)
|
|
2498
2503
|
throw missingDependencyError("less", filePath);
|
|
2504
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2499
2505
|
const result = await render(contents, {
|
|
2506
|
+
...options.options ?? {},
|
|
2500
2507
|
filename: filePath,
|
|
2501
|
-
paths:
|
|
2508
|
+
paths: normalizeLoadPaths(filePath, options.paths)
|
|
2502
2509
|
});
|
|
2503
2510
|
return result.css;
|
|
2504
2511
|
}
|
|
2505
|
-
return
|
|
2506
|
-
},
|
|
2512
|
+
return rawContents;
|
|
2513
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
2514
|
+
name: "absolute-style-preprocessor",
|
|
2515
|
+
setup(build) {
|
|
2516
|
+
const cssModuleSources = new Map;
|
|
2517
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2518
|
+
namespace: "absolute-style-module",
|
|
2519
|
+
path: path.slice("absolute-style-module:".length)
|
|
2520
|
+
}));
|
|
2521
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2522
|
+
const sourcePath = cssModuleSources.get(path);
|
|
2523
|
+
if (!sourcePath) {
|
|
2524
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2525
|
+
}
|
|
2526
|
+
return {
|
|
2527
|
+
contents: await compileStyleSource(sourcePath, undefined, undefined, config),
|
|
2528
|
+
loader: "css"
|
|
2529
|
+
};
|
|
2530
|
+
});
|
|
2531
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2532
|
+
if (isStyleModulePath(path)) {
|
|
2533
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2534
|
+
cssModuleSources.set(cssModulePath, path);
|
|
2535
|
+
return {
|
|
2536
|
+
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2537
|
+
loader: "js"
|
|
2538
|
+
};
|
|
2539
|
+
}
|
|
2540
|
+
return {
|
|
2541
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
2542
|
+
loader: "css"
|
|
2543
|
+
};
|
|
2544
|
+
});
|
|
2545
|
+
}
|
|
2546
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
2507
2547
|
style: async ({
|
|
2508
2548
|
attributes,
|
|
2509
2549
|
content,
|
|
@@ -2514,35 +2554,14 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2514
2554
|
return;
|
|
2515
2555
|
const path = filename ?? `style.${language}`;
|
|
2516
2556
|
return {
|
|
2517
|
-
code: await compileStyleSource(path, content, language)
|
|
2557
|
+
code: await compileStyleSource(path, content, language, config)
|
|
2518
2558
|
};
|
|
2519
2559
|
}
|
|
2520
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
2560
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
2521
2561
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2522
2562
|
return readFile(filePath, "utf-8");
|
|
2523
2563
|
}
|
|
2524
|
-
return compileStyleSource(filePath);
|
|
2525
|
-
}, compileStyleFileIfNeededSync = (filePath) => {
|
|
2526
|
-
const contents = readFileSync3(filePath, "utf-8");
|
|
2527
|
-
const language = getStyleLanguage(filePath);
|
|
2528
|
-
if (language === "scss" || language === "sass") {
|
|
2529
|
-
let sass;
|
|
2530
|
-
try {
|
|
2531
|
-
sass = requireOptionalPeerSync("sass");
|
|
2532
|
-
} catch {
|
|
2533
|
-
throw missingDependencyError("sass", filePath);
|
|
2534
|
-
}
|
|
2535
|
-
return sass.compileString(contents, {
|
|
2536
|
-
loadPaths: [dirname3(filePath), process.cwd()],
|
|
2537
|
-
style: "expanded",
|
|
2538
|
-
syntax: language === "sass" ? "indented" : "scss",
|
|
2539
|
-
url: new URL(`file://${filePath}`)
|
|
2540
|
-
}).css;
|
|
2541
|
-
}
|
|
2542
|
-
if (language === "less") {
|
|
2543
|
-
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
2544
|
-
}
|
|
2545
|
-
return contents;
|
|
2564
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2546
2565
|
};
|
|
2547
2566
|
var init_stylePreprocessor = __esm(() => {
|
|
2548
2567
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -2551,45 +2570,12 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2551
2570
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2552
2571
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2553
2572
|
requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
|
|
2554
|
-
stylePreprocessorPlugin =
|
|
2555
|
-
name: "absolute-style-preprocessor",
|
|
2556
|
-
setup(build) {
|
|
2557
|
-
const cssModuleSources = new Map;
|
|
2558
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2559
|
-
namespace: "absolute-style-module",
|
|
2560
|
-
path: path.slice("absolute-style-module:".length)
|
|
2561
|
-
}));
|
|
2562
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2563
|
-
const sourcePath = cssModuleSources.get(path);
|
|
2564
|
-
if (!sourcePath) {
|
|
2565
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2566
|
-
}
|
|
2567
|
-
return {
|
|
2568
|
-
contents: await compileStyleSource(sourcePath),
|
|
2569
|
-
loader: "css"
|
|
2570
|
-
};
|
|
2571
|
-
});
|
|
2572
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2573
|
-
if (isStyleModulePath(path)) {
|
|
2574
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2575
|
-
cssModuleSources.set(cssModulePath, path);
|
|
2576
|
-
return {
|
|
2577
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2578
|
-
loader: "js"
|
|
2579
|
-
};
|
|
2580
|
-
}
|
|
2581
|
-
return {
|
|
2582
|
-
contents: await compileStyleSource(path),
|
|
2583
|
-
loader: "css"
|
|
2584
|
-
};
|
|
2585
|
-
});
|
|
2586
|
-
}
|
|
2587
|
-
};
|
|
2573
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
2588
2574
|
});
|
|
2589
2575
|
|
|
2590
2576
|
// src/core/svelteServerModule.ts
|
|
2591
2577
|
import { mkdir, readdir as readdir2 } from "fs/promises";
|
|
2592
|
-
import { basename as basename2, dirname as dirname4, extname as extname4, join as join6, relative as relative3, resolve as
|
|
2578
|
+
import { basename as basename2, dirname as dirname4, extname as extname4, join as join6, relative as relative3, resolve as resolve7 } from "path";
|
|
2593
2579
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2594
2580
|
const importPath = relative3(dirname4(from), target).replace(/\\/g, "/");
|
|
2595
2581
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
@@ -2637,7 +2623,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2637
2623
|
if (!spec.startsWith(".")) {
|
|
2638
2624
|
return null;
|
|
2639
2625
|
}
|
|
2640
|
-
const basePath =
|
|
2626
|
+
const basePath = resolve7(dirname4(from), spec);
|
|
2641
2627
|
const candidates = [
|
|
2642
2628
|
basePath,
|
|
2643
2629
|
`${basePath}.ts`,
|
|
@@ -2669,7 +2655,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2669
2655
|
if (!spec.startsWith(".")) {
|
|
2670
2656
|
return null;
|
|
2671
2657
|
}
|
|
2672
|
-
const explicitPath =
|
|
2658
|
+
const explicitPath = resolve7(dirname4(from), spec);
|
|
2673
2659
|
if (extname4(explicitPath) === ".svelte") {
|
|
2674
2660
|
return explicitPath;
|
|
2675
2661
|
}
|
|
@@ -2975,7 +2961,7 @@ var init_staticStreaming = __esm(() => {
|
|
|
2975
2961
|
});
|
|
2976
2962
|
|
|
2977
2963
|
// src/build/staticIslandPages.ts
|
|
2978
|
-
import { readFileSync as
|
|
2964
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
2979
2965
|
var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:[\\s\\S]*?)<\\/(?:absolute-island|island)>)", ATTRIBUTE_RE_SOURCE = `([A-Za-z_:][-A-Za-z0-9_:.]*)\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, islandFrameworks, islandHydrationModes, isRecord5 = (value) => typeof value === "object" && value !== null, isIslandFramework = (value) => islandFrameworks.some((framework) => framework === value), isIslandHydrationMode = (value) => islandHydrationModes.some((mode) => mode === value), parseHtmlAttributes = (attributeString) => {
|
|
2980
2966
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
2981
2967
|
const attributes = new Map;
|
|
@@ -3104,7 +3090,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
3104
3090
|
}
|
|
3105
3091
|
return result + originalHtml.slice(nextIndex);
|
|
3106
3092
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
3107
|
-
const originalHtml =
|
|
3093
|
+
const originalHtml = readFileSync3(pagePath, "utf-8");
|
|
3108
3094
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
3109
3095
|
if (transformedHtml !== originalHtml) {
|
|
3110
3096
|
writeFileSync3(pagePath, transformedHtml);
|
|
@@ -3242,8 +3228,8 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
3242
3228
|
});
|
|
3243
3229
|
|
|
3244
3230
|
// src/utils/imageProcessing.ts
|
|
3245
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as
|
|
3246
|
-
import { join as join7, resolve as
|
|
3231
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
3232
|
+
import { join as join7, resolve as resolve8 } from "path";
|
|
3247
3233
|
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) => {
|
|
3248
3234
|
for (const size of sizes) {
|
|
3249
3235
|
if (size >= target)
|
|
@@ -3358,8 +3344,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3358
3344
|
if (!existsSync8(metaPath) || !existsSync8(dataPath))
|
|
3359
3345
|
return null;
|
|
3360
3346
|
try {
|
|
3361
|
-
const meta = JSON.parse(
|
|
3362
|
-
const buffer =
|
|
3347
|
+
const meta = JSON.parse(readFileSync4(metaPath, "utf-8"));
|
|
3348
|
+
const buffer = readFileSync4(dataPath);
|
|
3363
3349
|
return { buffer, meta };
|
|
3364
3350
|
} catch {
|
|
3365
3351
|
return null;
|
|
@@ -3369,7 +3355,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3369
3355
|
return sharpModule;
|
|
3370
3356
|
sharpLoaded = true;
|
|
3371
3357
|
try {
|
|
3372
|
-
const sharpPath =
|
|
3358
|
+
const sharpPath = resolve8(process.cwd(), "node_modules/sharp");
|
|
3373
3359
|
const mod = await import(sharpPath);
|
|
3374
3360
|
sharpModule = mod.default ?? mod;
|
|
3375
3361
|
return sharpModule;
|
|
@@ -3474,14 +3460,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
3474
3460
|
});
|
|
3475
3461
|
|
|
3476
3462
|
// src/cli/scripts/telemetry.ts
|
|
3477
|
-
import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as
|
|
3463
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
3478
3464
|
import { homedir } from "os";
|
|
3479
3465
|
import { join as join8 } from "path";
|
|
3480
3466
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
3481
3467
|
try {
|
|
3482
3468
|
if (!existsSync9(configPath))
|
|
3483
3469
|
return null;
|
|
3484
|
-
const raw =
|
|
3470
|
+
const raw = readFileSync5(configPath, "utf-8");
|
|
3485
3471
|
const config = JSON.parse(raw);
|
|
3486
3472
|
return config;
|
|
3487
3473
|
} catch {
|
|
@@ -3494,14 +3480,14 @@ var init_telemetry = __esm(() => {
|
|
|
3494
3480
|
});
|
|
3495
3481
|
|
|
3496
3482
|
// src/cli/telemetryEvent.ts
|
|
3497
|
-
import { existsSync as existsSync10, readFileSync as
|
|
3483
|
+
import { existsSync as existsSync10, readFileSync as readFileSync6 } from "fs";
|
|
3498
3484
|
import { arch, platform } from "os";
|
|
3499
3485
|
import { dirname as dirname5, join as join9, parse } from "path";
|
|
3500
3486
|
var checkCandidate = (candidate) => {
|
|
3501
3487
|
if (!existsSync10(candidate)) {
|
|
3502
3488
|
return null;
|
|
3503
3489
|
}
|
|
3504
|
-
const pkg = JSON.parse(
|
|
3490
|
+
const pkg = JSON.parse(readFileSync6(candidate, "utf-8"));
|
|
3505
3491
|
if (pkg.name === "@absolutejs/absolute") {
|
|
3506
3492
|
const ver = pkg.version;
|
|
3507
3493
|
return ver;
|
|
@@ -3607,18 +3593,18 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
3607
3593
|
|
|
3608
3594
|
// src/dev/buildHMRClient.ts
|
|
3609
3595
|
import { existsSync as existsSync11 } from "fs";
|
|
3610
|
-
import { resolve as
|
|
3596
|
+
import { resolve as resolve9 } from "path";
|
|
3611
3597
|
var {build: bunBuild } = globalThis.Bun;
|
|
3612
3598
|
var resolveHmrClientPath = () => {
|
|
3613
3599
|
const projectRoot = process.cwd();
|
|
3614
|
-
const fromSource =
|
|
3600
|
+
const fromSource = resolve9(import.meta.dir, "client/hmrClient.ts");
|
|
3615
3601
|
if (existsSync11(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3616
3602
|
return fromSource;
|
|
3617
3603
|
}
|
|
3618
|
-
const fromNodeModules =
|
|
3604
|
+
const fromNodeModules = resolve9(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
3619
3605
|
if (existsSync11(fromNodeModules))
|
|
3620
3606
|
return fromNodeModules;
|
|
3621
|
-
return
|
|
3607
|
+
return resolve9(import.meta.dir, "dev/client/hmrClient.ts");
|
|
3622
3608
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
3623
3609
|
const entryPoint = hmrClientPath2;
|
|
3624
3610
|
const result = await bunBuild({
|
|
@@ -3648,7 +3634,7 @@ var init_buildHMRClient = __esm(() => {
|
|
|
3648
3634
|
// src/build/nativeRewrite.ts
|
|
3649
3635
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
3650
3636
|
import { platform as platform2, arch as arch2 } from "os";
|
|
3651
|
-
import { resolve as
|
|
3637
|
+
import { resolve as resolve10 } from "path";
|
|
3652
3638
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
3653
3639
|
if (nativeLib !== null)
|
|
3654
3640
|
return nativeLib;
|
|
@@ -3666,7 +3652,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
3666
3652
|
if (!libPath)
|
|
3667
3653
|
return null;
|
|
3668
3654
|
try {
|
|
3669
|
-
const fullPath =
|
|
3655
|
+
const fullPath = resolve10(import.meta.dir, "../../native/packages", libPath);
|
|
3670
3656
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
3671
3657
|
nativeLib = lib.symbols;
|
|
3672
3658
|
return nativeLib;
|
|
@@ -3808,12 +3794,12 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
3808
3794
|
};
|
|
3809
3795
|
|
|
3810
3796
|
// src/build/angularLinkerPlugin.ts
|
|
3811
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as
|
|
3812
|
-
import { dirname as dirname6, join as join10, relative as relative4, resolve as
|
|
3797
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
3798
|
+
import { dirname as dirname6, join as join10, relative as relative4, resolve as resolve11 } from "path";
|
|
3813
3799
|
import { createHash } from "crypto";
|
|
3814
3800
|
var CACHE_DIR, angularLinkerPlugin;
|
|
3815
3801
|
var init_angularLinkerPlugin = __esm(() => {
|
|
3816
|
-
CACHE_DIR =
|
|
3802
|
+
CACHE_DIR = resolve11(".absolutejs", "cache", "angular-linker");
|
|
3817
3803
|
angularLinkerPlugin = {
|
|
3818
3804
|
name: "angular-linker",
|
|
3819
3805
|
setup(bld) {
|
|
@@ -3835,7 +3821,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3835
3821
|
const cachePath = join10(CACHE_DIR, `${hash}.js`);
|
|
3836
3822
|
if (existsSync12(cachePath)) {
|
|
3837
3823
|
return {
|
|
3838
|
-
contents:
|
|
3824
|
+
contents: readFileSync7(cachePath, "utf-8"),
|
|
3839
3825
|
loader: "js"
|
|
3840
3826
|
};
|
|
3841
3827
|
}
|
|
@@ -3851,9 +3837,9 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3851
3837
|
fileSystem: {
|
|
3852
3838
|
dirname: dirname6,
|
|
3853
3839
|
exists: existsSync12,
|
|
3854
|
-
readFile:
|
|
3840
|
+
readFile: readFileSync7,
|
|
3855
3841
|
relative: relative4,
|
|
3856
|
-
resolve:
|
|
3842
|
+
resolve: resolve11
|
|
3857
3843
|
},
|
|
3858
3844
|
linkerJitMode: false,
|
|
3859
3845
|
logger: {
|
|
@@ -3887,14 +3873,14 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3887
3873
|
|
|
3888
3874
|
// src/utils/cleanStaleOutputs.ts
|
|
3889
3875
|
import { rm as rm2 } from "fs/promises";
|
|
3890
|
-
import { resolve as
|
|
3876
|
+
import { resolve as resolve12 } from "path";
|
|
3891
3877
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
3892
3878
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
3893
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
3879
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve12(path)));
|
|
3894
3880
|
const glob = new Glob5("**/*");
|
|
3895
3881
|
const removals = [];
|
|
3896
3882
|
for (const relative5 of glob.scanSync({ cwd: buildPath })) {
|
|
3897
|
-
const absolute =
|
|
3883
|
+
const absolute = resolve12(buildPath, relative5);
|
|
3898
3884
|
if (currentPaths.has(absolute))
|
|
3899
3885
|
continue;
|
|
3900
3886
|
if (!HASHED_FILE_PATTERN.test(relative5))
|
|
@@ -3955,10 +3941,10 @@ var commonAncestor = (paths, fallback) => {
|
|
|
3955
3941
|
var init_commonAncestor = () => {};
|
|
3956
3942
|
|
|
3957
3943
|
// src/utils/validateSafePath.ts
|
|
3958
|
-
import { resolve as
|
|
3944
|
+
import { resolve as resolve13, relative as relative5 } from "path";
|
|
3959
3945
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
3960
|
-
const absoluteBase =
|
|
3961
|
-
const absoluteTarget =
|
|
3946
|
+
const absoluteBase = resolve13(baseDirectory);
|
|
3947
|
+
const absoluteTarget = resolve13(baseDirectory, targetPath);
|
|
3962
3948
|
const relativePath = normalizePath(relative5(absoluteBase, absoluteTarget));
|
|
3963
3949
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
3964
3950
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
@@ -4112,7 +4098,7 @@ import {
|
|
|
4112
4098
|
join as join12,
|
|
4113
4099
|
basename as basename4,
|
|
4114
4100
|
extname as extname5,
|
|
4115
|
-
resolve as
|
|
4101
|
+
resolve as resolve14,
|
|
4116
4102
|
relative as relative6,
|
|
4117
4103
|
sep as sep2
|
|
4118
4104
|
} from "path";
|
|
@@ -4120,14 +4106,14 @@ import { env } from "process";
|
|
|
4120
4106
|
var {write, file, Transpiler } = globalThis.Bun;
|
|
4121
4107
|
var resolveDevClientDir2 = () => {
|
|
4122
4108
|
const projectRoot = process.cwd();
|
|
4123
|
-
const fromSource =
|
|
4109
|
+
const fromSource = resolve14(import.meta.dir, "../dev/client");
|
|
4124
4110
|
if (existsSync13(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4125
4111
|
return fromSource;
|
|
4126
4112
|
}
|
|
4127
|
-
const fromNodeModules =
|
|
4113
|
+
const fromNodeModules = resolve14(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
4128
4114
|
if (existsSync13(fromNodeModules))
|
|
4129
4115
|
return fromNodeModules;
|
|
4130
|
-
return
|
|
4116
|
+
return resolve14(import.meta.dir, "./dev/client");
|
|
4131
4117
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
4132
4118
|
persistentCache.clear();
|
|
4133
4119
|
sourceHashCache.clear();
|
|
@@ -4157,7 +4143,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4157
4143
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
4158
4144
|
if (!spec.startsWith("."))
|
|
4159
4145
|
return null;
|
|
4160
|
-
const basePath =
|
|
4146
|
+
const basePath = resolve14(dirname7(from), spec);
|
|
4161
4147
|
const candidates = [
|
|
4162
4148
|
basePath,
|
|
4163
4149
|
`${basePath}.ts`,
|
|
@@ -4184,7 +4170,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4184
4170
|
const resolved = resolvePackageImport(spec);
|
|
4185
4171
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
4186
4172
|
}
|
|
4187
|
-
const basePath =
|
|
4173
|
+
const basePath = resolve14(dirname7(from), spec);
|
|
4188
4174
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
4189
4175
|
if (!explicit) {
|
|
4190
4176
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -4211,7 +4197,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4211
4197
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
4212
4198
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
4213
4199
|
});
|
|
4214
|
-
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false) => {
|
|
4200
|
+
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
|
|
4215
4201
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
4216
4202
|
const generatedDir = join12(svelteRoot, "generated");
|
|
4217
4203
|
const clientDir = join12(generatedDir, "client");
|
|
@@ -4239,7 +4225,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4239
4225
|
const loweredServerSource = isModule ? loweredAwaitServerSource : lowerSvelteIslandSyntax(loweredAwaitServerSource.code, "server");
|
|
4240
4226
|
const loweredClientSource = isModule ? loweredAwaitClientSource : lowerSvelteIslandSyntax(loweredAwaitClientSource.code, "client");
|
|
4241
4227
|
const transformedByLowering = loweredAwaitServerSource.transformed || loweredAwaitClientSource.transformed || loweredServerSource.transformed || loweredClientSource.transformed;
|
|
4242
|
-
const svelteStylePreprocessor = createSvelteStylePreprocessor();
|
|
4228
|
+
const svelteStylePreprocessor = createSvelteStylePreprocessor(stylePreprocessors);
|
|
4243
4229
|
const preprocessedServer = isModule ? loweredServerSource.code : (await preprocess(loweredServerSource.code, svelteStylePreprocessor)).code;
|
|
4244
4230
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
4245
4231
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
@@ -4464,18 +4450,18 @@ __export(exports_compileVue, {
|
|
|
4464
4450
|
});
|
|
4465
4451
|
import { existsSync as existsSync14 } from "fs";
|
|
4466
4452
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
4467
|
-
import { basename as basename5, dirname as dirname8, join as join13, relative as relative7, resolve as
|
|
4453
|
+
import { basename as basename5, dirname as dirname8, join as join13, relative as relative7, resolve as resolve15 } from "path";
|
|
4468
4454
|
var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
4469
4455
|
var resolveDevClientDir3 = () => {
|
|
4470
4456
|
const projectRoot = process.cwd();
|
|
4471
|
-
const fromSource =
|
|
4457
|
+
const fromSource = resolve15(import.meta.dir, "../dev/client");
|
|
4472
4458
|
if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4473
4459
|
return fromSource;
|
|
4474
4460
|
}
|
|
4475
|
-
const fromNodeModules =
|
|
4461
|
+
const fromNodeModules = resolve15(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
4476
4462
|
if (existsSync14(fromNodeModules))
|
|
4477
4463
|
return fromNodeModules;
|
|
4478
|
-
return
|
|
4464
|
+
return resolve15(import.meta.dir, "./dev/client");
|
|
4479
4465
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
4480
4466
|
scriptCache.clear();
|
|
4481
4467
|
scriptSetupCache.clear();
|
|
@@ -4537,7 +4523,7 @@ var resolveDevClientDir3 = () => {
|
|
|
4537
4523
|
].join(`
|
|
4538
4524
|
`) : nonVueLines.join(`
|
|
4539
4525
|
`);
|
|
4540
|
-
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler) => {
|
|
4526
|
+
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler, stylePreprocessors) => {
|
|
4541
4527
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
4542
4528
|
if (cachedResult)
|
|
4543
4529
|
return cachedResult;
|
|
@@ -4575,8 +4561,8 @@ var resolveDevClientDir3 = () => {
|
|
|
4575
4561
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
4576
4562
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue"));
|
|
4577
4563
|
const childBuildResults = await Promise.all([
|
|
4578
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
4579
|
-
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler))
|
|
4564
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve15(dirname8(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
4565
|
+
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
4580
4566
|
]);
|
|
4581
4567
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
4582
4568
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
@@ -4611,7 +4597,7 @@ var resolveDevClientDir3 = () => {
|
|
|
4611
4597
|
filename: sourceFilePath,
|
|
4612
4598
|
id: componentId,
|
|
4613
4599
|
scoped: styleBlock.scoped,
|
|
4614
|
-
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang) : styleBlock.content,
|
|
4600
|
+
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang, stylePreprocessors) : styleBlock.content,
|
|
4615
4601
|
trim: true
|
|
4616
4602
|
}).code));
|
|
4617
4603
|
const allCss = [
|
|
@@ -4683,14 +4669,14 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4683
4669
|
hmrId,
|
|
4684
4670
|
serverPath: serverOutputPath,
|
|
4685
4671
|
tsHelperPaths: [
|
|
4686
|
-
...helperModulePaths.map((helper) =>
|
|
4672
|
+
...helperModulePaths.map((helper) => resolve15(dirname8(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
4687
4673
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
4688
4674
|
]
|
|
4689
4675
|
};
|
|
4690
4676
|
cacheMap.set(sourceFilePath, result);
|
|
4691
4677
|
persistentBuildCache.set(sourceFilePath, result);
|
|
4692
4678
|
return result;
|
|
4693
|
-
}, compileVue = async (entryPoints, vueRootDir, isDev = false) => {
|
|
4679
|
+
}, compileVue = async (entryPoints, vueRootDir, isDev = false, stylePreprocessors) => {
|
|
4694
4680
|
const compiler = await import("@vue/compiler-sfc");
|
|
4695
4681
|
const generatedDir = join13(vueRootDir, "generated");
|
|
4696
4682
|
const clientOutputDir = join13(generatedDir, "client");
|
|
@@ -4706,11 +4692,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4706
4692
|
const buildCache = new Map;
|
|
4707
4693
|
const allTsHelperPaths = new Set;
|
|
4708
4694
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
4709
|
-
const result = await compileVueFile(
|
|
4695
|
+
const result = await compileVueFile(resolve15(entryPath), {
|
|
4710
4696
|
client: clientOutputDir,
|
|
4711
4697
|
css: cssOutputDir,
|
|
4712
4698
|
server: serverOutputDir
|
|
4713
|
-
}, buildCache, true, vueRootDir, compiler);
|
|
4699
|
+
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
4714
4700
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
4715
4701
|
const entryBaseName = basename5(entryPath, ".vue");
|
|
4716
4702
|
const indexOutputFile = join13(indexOutputDir, `${entryBaseName}.js`);
|
|
@@ -5343,27 +5329,27 @@ __export(exports_compileAngular, {
|
|
|
5343
5329
|
compileAngularFile: () => compileAngularFile,
|
|
5344
5330
|
compileAngular: () => compileAngular
|
|
5345
5331
|
});
|
|
5346
|
-
import { existsSync as existsSync15, readFileSync as
|
|
5347
|
-
import { join as join14, basename as basename6, sep as sep3, dirname as dirname9, resolve as
|
|
5332
|
+
import { existsSync as existsSync15, readFileSync as readFileSync8, promises as fs } from "fs";
|
|
5333
|
+
import { join as join14, basename as basename6, sep as sep3, dirname as dirname9, resolve as resolve16, relative as relative8 } from "path";
|
|
5348
5334
|
import ts2 from "typescript";
|
|
5349
5335
|
import { createHash as createHash2 } from "crypto";
|
|
5350
5336
|
var computeConfigHash = () => {
|
|
5351
5337
|
try {
|
|
5352
|
-
const content =
|
|
5338
|
+
const content = readFileSync8("./tsconfig.json", "utf-8");
|
|
5353
5339
|
return createHash2("md5").update(content).digest("hex");
|
|
5354
5340
|
} catch {
|
|
5355
5341
|
return "";
|
|
5356
5342
|
}
|
|
5357
5343
|
}, resolveDevClientDir4 = () => {
|
|
5358
5344
|
const projectRoot = process.cwd();
|
|
5359
|
-
const fromSource =
|
|
5345
|
+
const fromSource = resolve16(import.meta.dir, "../dev/client");
|
|
5360
5346
|
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
5361
5347
|
return fromSource;
|
|
5362
5348
|
}
|
|
5363
|
-
const fromNodeModules =
|
|
5349
|
+
const fromNodeModules = resolve16(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
5364
5350
|
if (existsSync15(fromNodeModules))
|
|
5365
5351
|
return fromNodeModules;
|
|
5366
|
-
return
|
|
5352
|
+
return resolve16(import.meta.dir, "./dev/client");
|
|
5367
5353
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
5368
5354
|
const componentClassRegex = /(?:export\s+)?class\s+(\w+Component)\s/g;
|
|
5369
5355
|
const componentNames = [];
|
|
@@ -5406,8 +5392,70 @@ ${registrations}
|
|
|
5406
5392
|
if (fileName.startsWith(outDir))
|
|
5407
5393
|
return fileName.substring(outDir.length + 1);
|
|
5408
5394
|
return fileName;
|
|
5409
|
-
},
|
|
5410
|
-
const
|
|
5395
|
+
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
5396
|
+
const sourceFile = ts2.createSourceFile(fileName, source, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TS);
|
|
5397
|
+
const specifiers = [];
|
|
5398
|
+
const addSpecifier = (node) => {
|
|
5399
|
+
if (!node || !ts2.isStringLiteralLike(node))
|
|
5400
|
+
return;
|
|
5401
|
+
const specifier = node.text;
|
|
5402
|
+
if (isRelativeModuleSpecifier(specifier))
|
|
5403
|
+
specifiers.push(specifier);
|
|
5404
|
+
};
|
|
5405
|
+
const visit = (node) => {
|
|
5406
|
+
if (ts2.isImportDeclaration(node) || ts2.isExportDeclaration(node)) {
|
|
5407
|
+
addSpecifier(node.moduleSpecifier);
|
|
5408
|
+
} else if (ts2.isCallExpression(node) && node.expression.kind === ts2.SyntaxKind.ImportKeyword) {
|
|
5409
|
+
addSpecifier(node.arguments[0]);
|
|
5410
|
+
}
|
|
5411
|
+
ts2.forEachChild(node, visit);
|
|
5412
|
+
};
|
|
5413
|
+
visit(sourceFile);
|
|
5414
|
+
return specifiers;
|
|
5415
|
+
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
5416
|
+
if (!isRelativeModuleSpecifier(specifier))
|
|
5417
|
+
return null;
|
|
5418
|
+
const basePath = resolve16(dirname9(fromFile), specifier);
|
|
5419
|
+
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
5420
|
+
`${basePath}.ts`,
|
|
5421
|
+
`${basePath}.tsx`,
|
|
5422
|
+
`${basePath}.mts`,
|
|
5423
|
+
`${basePath}.cts`,
|
|
5424
|
+
join14(basePath, "index.ts"),
|
|
5425
|
+
join14(basePath, "index.tsx"),
|
|
5426
|
+
join14(basePath, "index.mts"),
|
|
5427
|
+
join14(basePath, "index.cts")
|
|
5428
|
+
];
|
|
5429
|
+
return candidates.map((candidate) => resolve16(candidate)).find((candidate) => existsSync15(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
5430
|
+
}, readFileForAotTransform = async (fileName, readFile4) => {
|
|
5431
|
+
const hostSource = readFile4?.(fileName);
|
|
5432
|
+
if (typeof hostSource === "string")
|
|
5433
|
+
return hostSource;
|
|
5434
|
+
return fs.readFile(fileName, "utf-8");
|
|
5435
|
+
}, precomputeAotResourceTransforms = async (inputPath, readFile4, stylePreprocessors) => {
|
|
5436
|
+
const transformedSources = new Map;
|
|
5437
|
+
const visited = new Set;
|
|
5438
|
+
const transformFile = async (filePath) => {
|
|
5439
|
+
const resolvedPath = resolve16(filePath);
|
|
5440
|
+
if (visited.has(resolvedPath))
|
|
5441
|
+
return;
|
|
5442
|
+
visited.add(resolvedPath);
|
|
5443
|
+
if (!existsSync15(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
5444
|
+
return;
|
|
5445
|
+
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
5446
|
+
const transformed = await inlineResources(source, dirname9(resolvedPath), stylePreprocessors);
|
|
5447
|
+
transformedSources.set(resolvedPath, transformed.source);
|
|
5448
|
+
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
5449
|
+
await Promise.all(imports.map(async (specifier) => {
|
|
5450
|
+
const resolvedImport = resolveLocalTsImport(resolvedPath, specifier);
|
|
5451
|
+
if (resolvedImport)
|
|
5452
|
+
await transformFile(resolvedImport);
|
|
5453
|
+
}));
|
|
5454
|
+
};
|
|
5455
|
+
await transformFile(inputPath);
|
|
5456
|
+
return transformedSources;
|
|
5457
|
+
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
5458
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync8(inputPath, "utf-8"));
|
|
5411
5459
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
5412
5460
|
const configHash = computeConfigHash();
|
|
5413
5461
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -5422,7 +5470,7 @@ ${registrations}
|
|
|
5422
5470
|
} else {
|
|
5423
5471
|
const tsPath = __require.resolve("typescript");
|
|
5424
5472
|
const tsRootDir = dirname9(tsPath);
|
|
5425
|
-
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir :
|
|
5473
|
+
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve16(tsRootDir, "lib");
|
|
5426
5474
|
const config = readConfiguration("./tsconfig.json");
|
|
5427
5475
|
options = {
|
|
5428
5476
|
emitDecoratorMetadata: true,
|
|
@@ -5469,13 +5517,13 @@ ${registrations}
|
|
|
5469
5517
|
};
|
|
5470
5518
|
}
|
|
5471
5519
|
const emitted = {};
|
|
5472
|
-
const resolvedOutDir =
|
|
5520
|
+
const resolvedOutDir = resolve16(outDir);
|
|
5473
5521
|
host.writeFile = (fileName, text) => {
|
|
5474
5522
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
5475
5523
|
emitted[relativePath] = text;
|
|
5476
5524
|
};
|
|
5477
5525
|
const originalReadFile = host.readFile;
|
|
5478
|
-
const
|
|
5526
|
+
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host), stylePreprocessors);
|
|
5479
5527
|
host.readFile = (fileName) => {
|
|
5480
5528
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
5481
5529
|
if (typeof source !== "string")
|
|
@@ -5483,13 +5531,8 @@ ${registrations}
|
|
|
5483
5531
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
5484
5532
|
return source;
|
|
5485
5533
|
}
|
|
5486
|
-
const resolvedPath =
|
|
5487
|
-
|
|
5488
|
-
if (cached2 !== undefined)
|
|
5489
|
-
return cached2;
|
|
5490
|
-
const transformed = inlineResourcesSync(source, dirname9(resolvedPath)).source;
|
|
5491
|
-
aotTransformCache.set(resolvedPath, transformed);
|
|
5492
|
-
return transformed;
|
|
5534
|
+
const resolvedPath = resolve16(fileName);
|
|
5535
|
+
return aotTransformedSources.get(resolvedPath) ?? source;
|
|
5493
5536
|
};
|
|
5494
5537
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
5495
5538
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
@@ -5533,7 +5576,7 @@ ${registrations}
|
|
|
5533
5576
|
await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
|
|
5534
5577
|
return entries.map(({ target }) => target);
|
|
5535
5578
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
5536
|
-
const sourceEntry =
|
|
5579
|
+
const sourceEntry = resolve16(import.meta.dir, "../angular/components/index.ts");
|
|
5537
5580
|
if (existsSync15(sourceEntry)) {
|
|
5538
5581
|
return sourceEntry.replace(/\\/g, "/");
|
|
5539
5582
|
}
|
|
@@ -5661,10 +5704,10 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
5661
5704
|
return rewritten.replace(/export(?:\s+default)?\s+class\s+([A-Za-z_$][\w$]*)\s*{/, (match) => `${match}
|
|
5662
5705
|
${fields}
|
|
5663
5706
|
`);
|
|
5664
|
-
}, readAndEscapeFile = async (filePath) => {
|
|
5707
|
+
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
5665
5708
|
if (!existsSync15(filePath))
|
|
5666
5709
|
return null;
|
|
5667
|
-
const content = await compileStyleFileIfNeeded(filePath);
|
|
5710
|
+
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
5668
5711
|
return escapeTemplateContent(content);
|
|
5669
5712
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
5670
5713
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
@@ -5704,7 +5747,7 @@ ${fields}
|
|
|
5704
5747
|
if (!existsSync15(templatePath)) {
|
|
5705
5748
|
return { deferSlots: [], source };
|
|
5706
5749
|
}
|
|
5707
|
-
const templateRaw2 =
|
|
5750
|
+
const templateRaw2 = readFileSync8(templatePath, "utf-8");
|
|
5708
5751
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
5709
5752
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
5710
5753
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -5728,43 +5771,7 @@ ${fields}
|
|
|
5728
5771
|
deferSlots: lowered.slots,
|
|
5729
5772
|
source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
|
|
5730
5773
|
};
|
|
5731
|
-
},
|
|
5732
|
-
if (!existsSync15(filePath))
|
|
5733
|
-
return null;
|
|
5734
|
-
const content = compileStyleFileIfNeededSync(filePath);
|
|
5735
|
-
return escapeTemplateContent(content);
|
|
5736
|
-
}, inlineStyleUrlsSync = (source, fileDir) => {
|
|
5737
|
-
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
5738
|
-
if (!styleUrlsMatch?.[1])
|
|
5739
|
-
return source;
|
|
5740
|
-
const urlMatches = styleUrlsMatch[1].match(/['"]([^'"]+)['"]/g);
|
|
5741
|
-
if (!urlMatches)
|
|
5742
|
-
return source;
|
|
5743
|
-
const inlinedStyles = urlMatches.map((urlMatch) => {
|
|
5744
|
-
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
5745
|
-
return readAndEscapeFileSync(join14(fileDir, styleUrl));
|
|
5746
|
-
}).filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
5747
|
-
if (inlinedStyles.length === 0)
|
|
5748
|
-
return source;
|
|
5749
|
-
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
5750
|
-
}, inlineSingleStyleUrlSync = (source, fileDir) => {
|
|
5751
|
-
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5752
|
-
if (!styleUrlMatch?.[1])
|
|
5753
|
-
return source;
|
|
5754
|
-
const escaped = readAndEscapeFileSync(join14(fileDir, styleUrlMatch[1]));
|
|
5755
|
-
if (!escaped)
|
|
5756
|
-
return source;
|
|
5757
|
-
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
5758
|
-
}, inlineResourcesSync = (source, fileDir) => {
|
|
5759
|
-
const inlinedTemplate = inlineTemplateAndLowerDeferSync(source, fileDir);
|
|
5760
|
-
let result = inlinedTemplate.source;
|
|
5761
|
-
result = inlineStyleUrlsSync(result, fileDir);
|
|
5762
|
-
result = inlineSingleStyleUrlSync(result, fileDir);
|
|
5763
|
-
return {
|
|
5764
|
-
deferSlots: inlinedTemplate.deferSlots,
|
|
5765
|
-
source: result
|
|
5766
|
-
};
|
|
5767
|
-
}, inlineStyleUrls = async (source, fileDir) => {
|
|
5774
|
+
}, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
|
|
5768
5775
|
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
5769
5776
|
if (!styleUrlsMatch?.[1])
|
|
5770
5777
|
return source;
|
|
@@ -5773,35 +5780,35 @@ ${fields}
|
|
|
5773
5780
|
return source;
|
|
5774
5781
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
5775
5782
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
5776
|
-
return readAndEscapeFile(join14(fileDir, styleUrl));
|
|
5783
|
+
return readAndEscapeFile(join14(fileDir, styleUrl), stylePreprocessors);
|
|
5777
5784
|
});
|
|
5778
5785
|
const results = await Promise.all(stylePromises);
|
|
5779
5786
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
5780
5787
|
if (inlinedStyles.length === 0)
|
|
5781
5788
|
return source;
|
|
5782
5789
|
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
5783
|
-
}, inlineSingleStyleUrl = async (source, fileDir) => {
|
|
5790
|
+
}, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
|
|
5784
5791
|
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5785
5792
|
if (!styleUrlMatch?.[1])
|
|
5786
5793
|
return source;
|
|
5787
|
-
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]));
|
|
5794
|
+
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
5788
5795
|
if (!escaped)
|
|
5789
5796
|
return source;
|
|
5790
5797
|
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
5791
|
-
}, inlineResources = async (source, fileDir) => {
|
|
5798
|
+
}, inlineResources = async (source, fileDir, stylePreprocessors) => {
|
|
5792
5799
|
const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
|
|
5793
5800
|
let result = inlinedTemplate.source;
|
|
5794
|
-
result = await inlineStyleUrls(result, fileDir);
|
|
5795
|
-
result = await inlineSingleStyleUrl(result, fileDir);
|
|
5801
|
+
result = await inlineStyleUrls(result, fileDir, stylePreprocessors);
|
|
5802
|
+
result = await inlineSingleStyleUrl(result, fileDir, stylePreprocessors);
|
|
5796
5803
|
return {
|
|
5797
5804
|
deferSlots: inlinedTemplate.deferSlots,
|
|
5798
5805
|
source: result
|
|
5799
5806
|
};
|
|
5800
|
-
}, compileAngularFileJIT = async (inputPath, outDir, rootDir) => {
|
|
5801
|
-
const entryPath =
|
|
5807
|
+
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors) => {
|
|
5808
|
+
const entryPath = resolve16(inputPath);
|
|
5802
5809
|
const allOutputs = [];
|
|
5803
5810
|
const visited = new Set;
|
|
5804
|
-
const baseDir =
|
|
5811
|
+
const baseDir = resolve16(rootDir ?? process.cwd());
|
|
5805
5812
|
const angularTranspiler = new Bun.Transpiler({
|
|
5806
5813
|
loader: "ts",
|
|
5807
5814
|
tsconfig: JSON.stringify({
|
|
@@ -5838,13 +5845,13 @@ ${fields}
|
|
|
5838
5845
|
return `${prefix}${dots}`;
|
|
5839
5846
|
return `${prefix}../${dots}`;
|
|
5840
5847
|
});
|
|
5841
|
-
if (
|
|
5848
|
+
if (resolve16(actualPath) === entryPath) {
|
|
5842
5849
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
5843
5850
|
}
|
|
5844
5851
|
return processedContent;
|
|
5845
5852
|
};
|
|
5846
5853
|
const transpileFile = async (filePath) => {
|
|
5847
|
-
const resolved =
|
|
5854
|
+
const resolved = resolve16(filePath);
|
|
5848
5855
|
if (visited.has(resolved))
|
|
5849
5856
|
return;
|
|
5850
5857
|
visited.add(resolved);
|
|
@@ -5854,7 +5861,7 @@ ${fields}
|
|
|
5854
5861
|
if (!existsSync15(actualPath))
|
|
5855
5862
|
return;
|
|
5856
5863
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
5857
|
-
const inlined = await inlineResources(sourceCode, dirname9(actualPath));
|
|
5864
|
+
const inlined = await inlineResources(sourceCode, dirname9(actualPath), stylePreprocessors);
|
|
5858
5865
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname9(actualPath)).source;
|
|
5859
5866
|
const inputDir = dirname9(actualPath);
|
|
5860
5867
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
@@ -5886,13 +5893,13 @@ ${fields}
|
|
|
5886
5893
|
}
|
|
5887
5894
|
const inputDirForResolve = dirname9(actualPath);
|
|
5888
5895
|
await Promise.all(localImports.map((imp) => {
|
|
5889
|
-
const importPath =
|
|
5896
|
+
const importPath = resolve16(inputDirForResolve, imp);
|
|
5890
5897
|
return transpileFile(importPath);
|
|
5891
5898
|
}));
|
|
5892
5899
|
};
|
|
5893
5900
|
await transpileFile(inputPath);
|
|
5894
5901
|
return allOutputs;
|
|
5895
|
-
}, compileAngular = async (entryPoints, outRoot, hmr = false) => {
|
|
5902
|
+
}, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
|
|
5896
5903
|
const compiledParent = join14(outRoot, "generated");
|
|
5897
5904
|
if (entryPoints.length === 0) {
|
|
5898
5905
|
const emptyPaths = [];
|
|
@@ -5902,9 +5909,9 @@ ${fields}
|
|
|
5902
5909
|
const indexesDir = join14(compiledParent, "indexes");
|
|
5903
5910
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
5904
5911
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
5905
|
-
const resolvedEntry =
|
|
5912
|
+
const resolvedEntry = resolve16(entry);
|
|
5906
5913
|
const relativeEntry = relative8(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
5907
|
-
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot) : compileAngularFile(resolvedEntry, compiledRoot);
|
|
5914
|
+
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
5908
5915
|
let outputs = await compileEntry();
|
|
5909
5916
|
const fileBase = basename6(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
5910
5917
|
const jsName = `${fileBase}.js`;
|
|
@@ -5912,10 +5919,10 @@ ${fields}
|
|
|
5912
5919
|
join14(compiledRoot, relativeEntry),
|
|
5913
5920
|
join14(compiledRoot, "pages", jsName),
|
|
5914
5921
|
join14(compiledRoot, jsName)
|
|
5915
|
-
].map((file3) =>
|
|
5922
|
+
].map((file3) => resolve16(file3));
|
|
5916
5923
|
const resolveRawServerFile = (candidatePaths) => {
|
|
5917
5924
|
const normalizedCandidates = [
|
|
5918
|
-
...candidatePaths.map((file3) =>
|
|
5925
|
+
...candidatePaths.map((file3) => resolve16(file3)),
|
|
5919
5926
|
...compiledFallbackPaths
|
|
5920
5927
|
];
|
|
5921
5928
|
let candidate = normalizedCandidates.find((file3) => existsSync15(file3) && file3.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
@@ -6146,24 +6153,24 @@ __export(exports_buildReactVendor, {
|
|
|
6146
6153
|
buildReactVendor: () => buildReactVendor
|
|
6147
6154
|
});
|
|
6148
6155
|
import { existsSync as existsSync16, mkdirSync as mkdirSync6 } from "fs";
|
|
6149
|
-
import { join as join15, resolve as
|
|
6156
|
+
import { join as join15, resolve as resolve17 } from "path";
|
|
6150
6157
|
import { rm as rm4 } from "fs/promises";
|
|
6151
6158
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
6152
6159
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
6153
6160
|
const candidates = [
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6161
|
+
resolve17(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
6162
|
+
resolve17(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
6163
|
+
resolve17(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
6164
|
+
resolve17(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
6165
|
+
resolve17(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
6166
|
+
resolve17(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
6160
6167
|
];
|
|
6161
6168
|
for (const candidate of candidates) {
|
|
6162
6169
|
if (existsSync16(candidate)) {
|
|
6163
6170
|
return candidate.replace(/\\/g, "/");
|
|
6164
6171
|
}
|
|
6165
6172
|
}
|
|
6166
|
-
return (candidates[0] ??
|
|
6173
|
+
return (candidates[0] ?? resolve17(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
6167
6174
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
6168
6175
|
try {
|
|
6169
6176
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -6335,11 +6342,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
6335
6342
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
6336
6343
|
return;
|
|
6337
6344
|
}
|
|
6338
|
-
const { readFileSync:
|
|
6345
|
+
const { readFileSync: readFileSync9, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
6339
6346
|
const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
6340
6347
|
for (const file3 of files) {
|
|
6341
6348
|
const filePath = join17(vendorDir, file3);
|
|
6342
|
-
const content =
|
|
6349
|
+
const content = readFileSync9(filePath, "utf-8");
|
|
6343
6350
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
6344
6351
|
continue;
|
|
6345
6352
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -6464,12 +6471,12 @@ import {
|
|
|
6464
6471
|
cpSync,
|
|
6465
6472
|
existsSync as existsSync17,
|
|
6466
6473
|
mkdirSync as mkdirSync10,
|
|
6467
|
-
readFileSync as
|
|
6474
|
+
readFileSync as readFileSync9,
|
|
6468
6475
|
rmSync as rmSync2,
|
|
6469
6476
|
statSync,
|
|
6470
6477
|
writeFileSync as writeFileSync7
|
|
6471
6478
|
} from "fs";
|
|
6472
|
-
import { basename as basename7, dirname as dirname10, join as join19, relative as relative9, resolve as
|
|
6479
|
+
import { basename as basename7, dirname as dirname10, join as join19, relative as relative9, resolve as resolve18 } from "path";
|
|
6473
6480
|
import { cwd, env as env2, exit } from "process";
|
|
6474
6481
|
var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
|
|
6475
6482
|
var isDev, collectConventionSourceFiles = (entry) => {
|
|
@@ -6557,8 +6564,8 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6557
6564
|
}
|
|
6558
6565
|
}, resolveAbsoluteVersion = async () => {
|
|
6559
6566
|
const candidates = [
|
|
6560
|
-
|
|
6561
|
-
|
|
6567
|
+
resolve18(import.meta.dir, "..", "..", "package.json"),
|
|
6568
|
+
resolve18(import.meta.dir, "..", "package.json")
|
|
6562
6569
|
];
|
|
6563
6570
|
for (const candidate of candidates) {
|
|
6564
6571
|
const pkg = await tryReadPackageJson(candidate);
|
|
@@ -6570,7 +6577,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6570
6577
|
return;
|
|
6571
6578
|
}
|
|
6572
6579
|
}, SKIP_DIRS, addWorkerPathIfExists = (file3, relPath, workerPaths) => {
|
|
6573
|
-
const absPath =
|
|
6580
|
+
const absPath = resolve18(file3, "..", relPath);
|
|
6574
6581
|
try {
|
|
6575
6582
|
statSync(absPath);
|
|
6576
6583
|
workerPaths.add(absPath);
|
|
@@ -6585,7 +6592,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6585
6592
|
addWorkerPathIfExists(file3, relPath, workerPaths);
|
|
6586
6593
|
}
|
|
6587
6594
|
}, collectWorkerPathsFromFile = (file3, patterns, workerPaths) => {
|
|
6588
|
-
const content =
|
|
6595
|
+
const content = readFileSync9(file3, "utf-8");
|
|
6589
6596
|
for (const pattern of patterns) {
|
|
6590
6597
|
collectWorkerPathsFromContent(content, pattern, file3, workerPaths);
|
|
6591
6598
|
}
|
|
@@ -6634,35 +6641,35 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6634
6641
|
return;
|
|
6635
6642
|
}
|
|
6636
6643
|
const indexFiles = readDir(reactIndexesPath).filter((file3) => file3.endsWith(".tsx"));
|
|
6637
|
-
const pagesRel = relative9(process.cwd(),
|
|
6644
|
+
const pagesRel = relative9(process.cwd(), resolve18(reactPagesPath)).replace(/\\/g, "/");
|
|
6638
6645
|
for (const file3 of indexFiles) {
|
|
6639
|
-
let content =
|
|
6646
|
+
let content = readFileSync9(join19(reactIndexesPath, file3), "utf-8");
|
|
6640
6647
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
6641
6648
|
writeFileSync7(join19(devIndexDir, file3), content);
|
|
6642
6649
|
}
|
|
6643
6650
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
6644
6651
|
const svelteIndexDir = join19(svelteDir, "generated", "indexes");
|
|
6645
|
-
const sveltePageEntries = svelteEntries.filter((file3) =>
|
|
6652
|
+
const sveltePageEntries = svelteEntries.filter((file3) => resolve18(file3).startsWith(resolve18(sveltePagesPath)));
|
|
6646
6653
|
for (const entry of sveltePageEntries) {
|
|
6647
6654
|
const name = basename7(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
6648
6655
|
const indexFile = join19(svelteIndexDir, "pages", `${name}.js`);
|
|
6649
6656
|
if (!existsSync17(indexFile))
|
|
6650
6657
|
continue;
|
|
6651
|
-
let content =
|
|
6652
|
-
const srcRel = relative9(process.cwd(),
|
|
6658
|
+
let content = readFileSync9(indexFile, "utf-8");
|
|
6659
|
+
const srcRel = relative9(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
6653
6660
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
6654
6661
|
writeFileSync7(join19(devIndexDir, `${name}.svelte.js`), content);
|
|
6655
6662
|
}
|
|
6656
6663
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
6657
6664
|
const vueIndexDir = join19(vueDir, "generated", "indexes");
|
|
6658
|
-
const vuePageEntries = vueEntries.filter((file3) =>
|
|
6665
|
+
const vuePageEntries = vueEntries.filter((file3) => resolve18(file3).startsWith(resolve18(vuePagesPath)));
|
|
6659
6666
|
for (const entry of vuePageEntries) {
|
|
6660
6667
|
const name = basename7(entry, ".vue");
|
|
6661
6668
|
const indexFile = join19(vueIndexDir, `${name}.js`);
|
|
6662
6669
|
if (!existsSync17(indexFile))
|
|
6663
6670
|
continue;
|
|
6664
|
-
let content =
|
|
6665
|
-
const srcRel = relative9(process.cwd(),
|
|
6671
|
+
let content = readFileSync9(indexFile, "utf-8");
|
|
6672
|
+
const srcRel = relative9(process.cwd(), resolve18(entry)).replace(/\\/g, "/");
|
|
6666
6673
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
6667
6674
|
writeFileSync7(join19(devIndexDir, `${name}.vue.js`), content);
|
|
6668
6675
|
}
|
|
@@ -6675,7 +6682,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6675
6682
|
const last = allComments[allComments.length - 1];
|
|
6676
6683
|
if (!last?.[1])
|
|
6677
6684
|
return JSON.stringify(outputPath);
|
|
6678
|
-
const srcPath =
|
|
6685
|
+
const srcPath = resolve18(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
6679
6686
|
return JSON.stringify(srcPath);
|
|
6680
6687
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
6681
6688
|
let depth = 0;
|
|
@@ -6712,7 +6719,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6712
6719
|
}
|
|
6713
6720
|
return result;
|
|
6714
6721
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
6715
|
-
let content =
|
|
6722
|
+
let content = readFileSync9(outputPath, "utf-8");
|
|
6716
6723
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
6717
6724
|
const useNames = [];
|
|
6718
6725
|
let match;
|
|
@@ -6762,7 +6769,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6762
6769
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
6763
6770
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
6764
6771
|
for (const outputPath of outputPaths) {
|
|
6765
|
-
let content =
|
|
6772
|
+
let content = readFileSync9(outputPath, "utf-8");
|
|
6766
6773
|
let changed = false;
|
|
6767
6774
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
6768
6775
|
const targetName = basename7(relPath);
|
|
@@ -6787,6 +6794,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6787
6794
|
svelteDirectory,
|
|
6788
6795
|
vueDirectory,
|
|
6789
6796
|
stylesConfig,
|
|
6797
|
+
stylePreprocessors,
|
|
6790
6798
|
tailwind,
|
|
6791
6799
|
options,
|
|
6792
6800
|
incrementalFiles,
|
|
@@ -6796,6 +6804,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6796
6804
|
const projectRoot = cwd();
|
|
6797
6805
|
await resolveAbsoluteVersion();
|
|
6798
6806
|
const isIncremental = incrementalFiles && incrementalFiles.length > 0;
|
|
6807
|
+
const stylePreprocessorPlugin2 = createStylePreprocessorPlugin(stylePreprocessors);
|
|
6799
6808
|
const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
|
|
6800
6809
|
const throwOnError = options?.throwOnError === true;
|
|
6801
6810
|
const hmr = options?.injectHMR === true;
|
|
@@ -6884,13 +6893,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6884
6893
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
6885
6894
|
if (!isIncremental || !incrementalFiles)
|
|
6886
6895
|
return entryPoints;
|
|
6887
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f) =>
|
|
6896
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f) => resolve18(f)));
|
|
6888
6897
|
const matchingEntries = [];
|
|
6889
6898
|
for (const entry of entryPoints) {
|
|
6890
6899
|
const sourceFile = mapToSource(entry);
|
|
6891
6900
|
if (!sourceFile)
|
|
6892
6901
|
continue;
|
|
6893
|
-
if (!normalizedIncremental.has(
|
|
6902
|
+
if (!normalizedIncremental.has(resolve18(sourceFile)))
|
|
6894
6903
|
continue;
|
|
6895
6904
|
matchingEntries.push(entry);
|
|
6896
6905
|
}
|
|
@@ -6959,7 +6968,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6959
6968
|
}
|
|
6960
6969
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || isStylePath(f)));
|
|
6961
6970
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
6962
|
-
if (entry.startsWith(
|
|
6971
|
+
if (entry.startsWith(resolve18(reactIndexesPath))) {
|
|
6963
6972
|
const pageName = basename7(entry, ".tsx");
|
|
6964
6973
|
return join19(reactPagesPath, `${pageName}.tsx`);
|
|
6965
6974
|
}
|
|
@@ -6991,28 +7000,28 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6991
7000
|
{ vueClientPaths: islandVueClientPaths },
|
|
6992
7001
|
{ clientPaths: islandAngularClientPaths }
|
|
6993
7002
|
] = await Promise.all([
|
|
6994
|
-
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr)) : {
|
|
7003
|
+
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
6995
7004
|
svelteClientPaths: [...emptyStringArray],
|
|
6996
7005
|
svelteIndexPaths: [...emptyStringArray],
|
|
6997
7006
|
svelteServerPaths: [...emptyStringArray]
|
|
6998
7007
|
},
|
|
6999
|
-
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr)) : {
|
|
7008
|
+
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr, stylePreprocessors)) : {
|
|
7000
7009
|
vueClientPaths: [...emptyStringArray],
|
|
7001
7010
|
vueCssPaths: [...emptyStringArray],
|
|
7002
7011
|
vueIndexPaths: [...emptyStringArray],
|
|
7003
7012
|
vueServerPaths: [...emptyStringArray]
|
|
7004
7013
|
},
|
|
7005
|
-
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr)) : {
|
|
7014
|
+
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr, stylePreprocessors)) : {
|
|
7006
7015
|
clientPaths: [...emptyStringArray],
|
|
7007
7016
|
serverPaths: [...emptyStringArray]
|
|
7008
7017
|
},
|
|
7009
|
-
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr)) : {
|
|
7018
|
+
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
7010
7019
|
svelteClientPaths: [...emptyStringArray]
|
|
7011
7020
|
},
|
|
7012
|
-
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr)) : {
|
|
7021
|
+
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr, stylePreprocessors)) : {
|
|
7013
7022
|
vueClientPaths: [...emptyStringArray]
|
|
7014
7023
|
},
|
|
7015
|
-
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr)) : {
|
|
7024
|
+
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr, stylePreprocessors)) : {
|
|
7016
7025
|
clientPaths: [...emptyStringArray]
|
|
7017
7026
|
}
|
|
7018
7027
|
]);
|
|
@@ -7022,7 +7031,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7022
7031
|
const clientPath = islandSvelteClientPaths[idx];
|
|
7023
7032
|
if (!sourcePath || !clientPath)
|
|
7024
7033
|
continue;
|
|
7025
|
-
islandSvelteClientPathMap.set(
|
|
7034
|
+
islandSvelteClientPathMap.set(resolve18(sourcePath), clientPath);
|
|
7026
7035
|
}
|
|
7027
7036
|
const islandVueClientPathMap = new Map;
|
|
7028
7037
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -7030,7 +7039,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7030
7039
|
const clientPath = islandVueClientPaths[idx];
|
|
7031
7040
|
if (!sourcePath || !clientPath)
|
|
7032
7041
|
continue;
|
|
7033
|
-
islandVueClientPathMap.set(
|
|
7042
|
+
islandVueClientPathMap.set(resolve18(sourcePath), clientPath);
|
|
7034
7043
|
}
|
|
7035
7044
|
const islandAngularClientPathMap = new Map;
|
|
7036
7045
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -7038,14 +7047,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7038
7047
|
const clientPath = islandAngularClientPaths[idx];
|
|
7039
7048
|
if (!sourcePath || !clientPath)
|
|
7040
7049
|
continue;
|
|
7041
|
-
islandAngularClientPathMap.set(
|
|
7050
|
+
islandAngularClientPathMap.set(resolve18(sourcePath), clientPath);
|
|
7042
7051
|
}
|
|
7043
7052
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
7044
7053
|
const vueConventionSources = collectConventionSourceFiles(conventionsMap.vue);
|
|
7045
7054
|
if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
|
|
7046
7055
|
const [svelteConvResult, vueConvResult] = await Promise.all([
|
|
7047
|
-
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false)) : { svelteServerPaths: emptyStringArray },
|
|
7048
|
-
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false)) : { vueServerPaths: emptyStringArray }
|
|
7056
|
+
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false, stylePreprocessors)) : { svelteServerPaths: emptyStringArray },
|
|
7057
|
+
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false, stylePreprocessors)) : { vueServerPaths: emptyStringArray }
|
|
7049
7058
|
]);
|
|
7050
7059
|
const copyConventionFiles = (framework, sources, compiledPaths) => {
|
|
7051
7060
|
const destDir = join19(buildPath, "conventions", framework);
|
|
@@ -7181,7 +7190,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7181
7190
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
7182
7191
|
outdir: buildPath,
|
|
7183
7192
|
...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
|
|
7184
|
-
plugins: [
|
|
7193
|
+
plugins: [stylePreprocessorPlugin2],
|
|
7185
7194
|
root: clientRoot,
|
|
7186
7195
|
splitting: true,
|
|
7187
7196
|
target: "browser",
|
|
@@ -7239,7 +7248,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7239
7248
|
format: "esm",
|
|
7240
7249
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
7241
7250
|
outdir: serverOutDir,
|
|
7242
|
-
plugins: [
|
|
7251
|
+
plugins: [stylePreprocessorPlugin2],
|
|
7243
7252
|
root: serverRoot,
|
|
7244
7253
|
target: "bun",
|
|
7245
7254
|
throw: false,
|
|
@@ -7255,7 +7264,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7255
7264
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
7256
7265
|
outdir: buildPath,
|
|
7257
7266
|
plugins: [
|
|
7258
|
-
|
|
7267
|
+
stylePreprocessorPlugin2,
|
|
7259
7268
|
...angularDir && !isDev ? [angularLinkerPlugin] : [],
|
|
7260
7269
|
...htmlScriptPlugin ? [htmlScriptPlugin] : []
|
|
7261
7270
|
],
|
|
@@ -7274,7 +7283,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7274
7283
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
7275
7284
|
outdir: buildPath,
|
|
7276
7285
|
plugins: [
|
|
7277
|
-
|
|
7286
|
+
stylePreprocessorPlugin2,
|
|
7278
7287
|
...angularDir && !isDev ? [angularLinkerPlugin] : []
|
|
7279
7288
|
],
|
|
7280
7289
|
root: islandEntryResult.generatedRoot,
|
|
@@ -7289,7 +7298,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7289
7298
|
outdir: stylesDir ? join19(buildPath, basename7(stylesDir)) : buildPath,
|
|
7290
7299
|
root: stylesDir || clientRoot,
|
|
7291
7300
|
target: "browser",
|
|
7292
|
-
plugins: [
|
|
7301
|
+
plugins: [stylePreprocessorPlugin2],
|
|
7293
7302
|
throw: false
|
|
7294
7303
|
}) : undefined,
|
|
7295
7304
|
vueCssPaths.length > 0 ? bunBuild6({
|
|
@@ -7417,7 +7426,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7417
7426
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
7418
7427
|
if (!hmrClientBundle)
|
|
7419
7428
|
return;
|
|
7420
|
-
let html =
|
|
7429
|
+
let html = readFileSync9(filePath, "utf-8");
|
|
7421
7430
|
if (html.includes("data-hmr-client"))
|
|
7422
7431
|
return;
|
|
7423
7432
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -7578,9 +7587,9 @@ var init_build = __esm(() => {
|
|
|
7578
7587
|
});
|
|
7579
7588
|
|
|
7580
7589
|
// src/dev/dependencyGraph.ts
|
|
7581
|
-
import { existsSync as existsSync18, readFileSync as
|
|
7590
|
+
import { existsSync as existsSync18, readFileSync as readFileSync10 } from "fs";
|
|
7582
7591
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
7583
|
-
import { resolve as
|
|
7592
|
+
import { resolve as resolve19 } from "path";
|
|
7584
7593
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
7585
7594
|
const lower = filePath.toLowerCase();
|
|
7586
7595
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -7594,8 +7603,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7594
7603
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
7595
7604
|
return null;
|
|
7596
7605
|
}
|
|
7597
|
-
const fromDir =
|
|
7598
|
-
const normalized =
|
|
7606
|
+
const fromDir = resolve19(fromFile, "..");
|
|
7607
|
+
const normalized = resolve19(fromDir, importPath);
|
|
7599
7608
|
const extensions = [
|
|
7600
7609
|
".ts",
|
|
7601
7610
|
".tsx",
|
|
@@ -7625,7 +7634,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7625
7634
|
dependents.delete(normalizedPath);
|
|
7626
7635
|
}
|
|
7627
7636
|
}, addFileToGraph = (graph, filePath) => {
|
|
7628
|
-
const normalizedPath =
|
|
7637
|
+
const normalizedPath = resolve19(filePath);
|
|
7629
7638
|
if (!existsSync18(normalizedPath))
|
|
7630
7639
|
return;
|
|
7631
7640
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -7642,10 +7651,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7642
7651
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
7643
7652
|
const processedFiles = new Set;
|
|
7644
7653
|
const glob = new Glob7("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
7645
|
-
const resolvedDirs = directories.map((dir) =>
|
|
7654
|
+
const resolvedDirs = directories.map((dir) => resolve19(dir)).filter((dir) => existsSync18(dir));
|
|
7646
7655
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
7647
7656
|
for (const file3 of allFiles) {
|
|
7648
|
-
const fullPath =
|
|
7657
|
+
const fullPath = resolve19(file3);
|
|
7649
7658
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
7650
7659
|
continue;
|
|
7651
7660
|
if (processedFiles.has(fullPath))
|
|
@@ -7739,15 +7748,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7739
7748
|
const lowerPath = filePath.toLowerCase();
|
|
7740
7749
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
7741
7750
|
if (loader === "html") {
|
|
7742
|
-
const content =
|
|
7751
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
7743
7752
|
return extractHtmlDependencies(filePath, content);
|
|
7744
7753
|
}
|
|
7745
7754
|
if (loader === "tsx" || loader === "js") {
|
|
7746
|
-
const content =
|
|
7755
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
7747
7756
|
return extractJsDependencies(filePath, content, loader);
|
|
7748
7757
|
}
|
|
7749
7758
|
if (isSvelteOrVue) {
|
|
7750
|
-
const content =
|
|
7759
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
7751
7760
|
return extractSvelteVueDependencies(filePath, content);
|
|
7752
7761
|
}
|
|
7753
7762
|
return [];
|
|
@@ -7758,7 +7767,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7758
7767
|
return [];
|
|
7759
7768
|
}
|
|
7760
7769
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
7761
|
-
const normalizedPath =
|
|
7770
|
+
const normalizedPath = resolve19(changedFile);
|
|
7762
7771
|
const affected = new Set;
|
|
7763
7772
|
const toProcess = [normalizedPath];
|
|
7764
7773
|
const processNode = (current) => {
|
|
@@ -7798,7 +7807,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7798
7807
|
}
|
|
7799
7808
|
graph.dependents.delete(normalizedPath);
|
|
7800
7809
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
7801
|
-
const normalizedPath =
|
|
7810
|
+
const normalizedPath = resolve19(filePath);
|
|
7802
7811
|
removeDepsForFile(graph, normalizedPath);
|
|
7803
7812
|
removeDependentsForFile(graph, normalizedPath);
|
|
7804
7813
|
};
|
|
@@ -7841,12 +7850,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
7841
7850
|
};
|
|
7842
7851
|
|
|
7843
7852
|
// src/dev/configResolver.ts
|
|
7844
|
-
import { resolve as
|
|
7853
|
+
import { resolve as resolve20 } from "path";
|
|
7845
7854
|
var resolveBuildPaths = (config) => {
|
|
7846
7855
|
const cwd2 = process.cwd();
|
|
7847
7856
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
7848
|
-
const withDefault = (value, fallback) => normalize(
|
|
7849
|
-
const optional = (value) => value ? normalize(
|
|
7857
|
+
const withDefault = (value, fallback) => normalize(resolve20(cwd2, value ?? fallback));
|
|
7858
|
+
const optional = (value) => value ? normalize(resolve20(cwd2, value)) : undefined;
|
|
7850
7859
|
return {
|
|
7851
7860
|
angularDir: optional(config.angularDirectory),
|
|
7852
7861
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -8036,7 +8045,7 @@ var init_pathUtils = __esm(() => {
|
|
|
8036
8045
|
// src/dev/fileWatcher.ts
|
|
8037
8046
|
import { watch } from "fs";
|
|
8038
8047
|
import { existsSync as existsSync19 } from "fs";
|
|
8039
|
-
import { join as join20, resolve as
|
|
8048
|
+
import { join as join20, resolve as resolve21 } from "path";
|
|
8040
8049
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
8041
8050
|
try {
|
|
8042
8051
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -8081,7 +8090,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8081
8090
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
8082
8091
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8083
8092
|
paths.forEach((path) => {
|
|
8084
|
-
const absolutePath =
|
|
8093
|
+
const absolutePath = resolve21(path).replace(/\\/g, "/");
|
|
8085
8094
|
if (!existsSync19(absolutePath)) {
|
|
8086
8095
|
return;
|
|
8087
8096
|
}
|
|
@@ -8092,7 +8101,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8092
8101
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
8093
8102
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8094
8103
|
watchPaths.forEach((path) => {
|
|
8095
|
-
const absolutePath =
|
|
8104
|
+
const absolutePath = resolve21(path).replace(/\\/g, "/");
|
|
8096
8105
|
if (!existsSync19(absolutePath)) {
|
|
8097
8106
|
return;
|
|
8098
8107
|
}
|
|
@@ -8107,13 +8116,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
8107
8116
|
});
|
|
8108
8117
|
|
|
8109
8118
|
// src/dev/assetStore.ts
|
|
8110
|
-
import { resolve as
|
|
8119
|
+
import { resolve as resolve22 } from "path";
|
|
8111
8120
|
import { readdir as readdir3, unlink } from "fs/promises";
|
|
8112
8121
|
var mimeTypes, getMimeType = (filePath) => {
|
|
8113
8122
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
8114
8123
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
8115
8124
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
8116
|
-
const fullPath =
|
|
8125
|
+
const fullPath = resolve22(dir, entry.name);
|
|
8117
8126
|
if (entry.isDirectory()) {
|
|
8118
8127
|
return walkAndClean(fullPath);
|
|
8119
8128
|
}
|
|
@@ -8129,10 +8138,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8129
8138
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
8130
8139
|
const liveByIdentity = new Map;
|
|
8131
8140
|
for (const webPath of store.keys()) {
|
|
8132
|
-
const diskPath =
|
|
8141
|
+
const diskPath = resolve22(buildDir, webPath.slice(1));
|
|
8133
8142
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
8134
8143
|
}
|
|
8135
|
-
const absBuildDir =
|
|
8144
|
+
const absBuildDir = resolve22(buildDir);
|
|
8136
8145
|
Object.values(manifest).forEach((val) => {
|
|
8137
8146
|
if (!HASHED_FILE_RE.test(val))
|
|
8138
8147
|
return;
|
|
@@ -8150,7 +8159,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8150
8159
|
} catch {}
|
|
8151
8160
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
8152
8161
|
if (entry.isDirectory()) {
|
|
8153
|
-
return scanDir(
|
|
8162
|
+
return scanDir(resolve22(dir, entry.name), `${prefix}${entry.name}/`);
|
|
8154
8163
|
}
|
|
8155
8164
|
if (!entry.name.startsWith("chunk-")) {
|
|
8156
8165
|
return null;
|
|
@@ -8159,7 +8168,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8159
8168
|
if (store.has(webPath)) {
|
|
8160
8169
|
return null;
|
|
8161
8170
|
}
|
|
8162
|
-
return Bun.file(
|
|
8171
|
+
return Bun.file(resolve22(dir, entry.name)).bytes().then((bytes) => {
|
|
8163
8172
|
store.set(webPath, bytes);
|
|
8164
8173
|
return;
|
|
8165
8174
|
}).catch(() => {});
|
|
@@ -8184,7 +8193,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8184
8193
|
for (const webPath of newIdentities.values()) {
|
|
8185
8194
|
if (store.has(webPath))
|
|
8186
8195
|
continue;
|
|
8187
|
-
loadPromises.push(Bun.file(
|
|
8196
|
+
loadPromises.push(Bun.file(resolve22(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
8188
8197
|
store.set(webPath, bytes);
|
|
8189
8198
|
return;
|
|
8190
8199
|
}).catch(() => {}));
|
|
@@ -8214,8 +8223,8 @@ var init_assetStore = __esm(() => {
|
|
|
8214
8223
|
});
|
|
8215
8224
|
|
|
8216
8225
|
// src/islands/pageMetadata.ts
|
|
8217
|
-
import { readFileSync as
|
|
8218
|
-
import { dirname as dirname11, resolve as
|
|
8226
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
8227
|
+
import { dirname as dirname11, resolve as resolve23 } from "path";
|
|
8219
8228
|
var pagePatterns, getPageDirs = (config) => [
|
|
8220
8229
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
8221
8230
|
{ dir: config.reactDirectory, framework: "react" },
|
|
@@ -8234,15 +8243,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
8234
8243
|
const source = definition.buildReference?.source;
|
|
8235
8244
|
if (!source)
|
|
8236
8245
|
continue;
|
|
8237
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
8238
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
8246
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve23(dirname11(buildInfo.resolvedRegistryPath), source);
|
|
8247
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve23(resolvedSource));
|
|
8239
8248
|
}
|
|
8240
8249
|
return lookup;
|
|
8241
8250
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
|
|
8242
8251
|
const candidate = usage.source;
|
|
8243
|
-
return candidate ?
|
|
8252
|
+
return candidate ? resolve23(candidate) === target : false;
|
|
8244
8253
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
8245
|
-
const target =
|
|
8254
|
+
const target = resolve23(sourcePath);
|
|
8246
8255
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
8247
8256
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
8248
8257
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -8254,13 +8263,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
8254
8263
|
const pattern = pagePatterns[entry.framework];
|
|
8255
8264
|
if (!pattern)
|
|
8256
8265
|
return;
|
|
8257
|
-
const files = await scanEntryPoints(
|
|
8266
|
+
const files = await scanEntryPoints(resolve23(entry.dir), pattern);
|
|
8258
8267
|
for (const filePath of files) {
|
|
8259
|
-
const source =
|
|
8268
|
+
const source = readFileSync11(filePath, "utf-8");
|
|
8260
8269
|
const islands = extractIslandUsagesFromSource(source);
|
|
8261
|
-
pageMetadata.set(
|
|
8270
|
+
pageMetadata.set(resolve23(filePath), {
|
|
8262
8271
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
8263
|
-
pagePath:
|
|
8272
|
+
pagePath: resolve23(filePath)
|
|
8264
8273
|
});
|
|
8265
8274
|
}
|
|
8266
8275
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -8286,10 +8295,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
8286
8295
|
});
|
|
8287
8296
|
|
|
8288
8297
|
// src/dev/fileHashTracker.ts
|
|
8289
|
-
import { readFileSync as
|
|
8298
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
8290
8299
|
var computeFileHash = (filePath) => {
|
|
8291
8300
|
try {
|
|
8292
|
-
const fileContent =
|
|
8301
|
+
const fileContent = readFileSync12(filePath);
|
|
8293
8302
|
return Number(Bun.hash(fileContent));
|
|
8294
8303
|
} catch {
|
|
8295
8304
|
return UNFOUND_INDEX;
|
|
@@ -8307,9 +8316,9 @@ var init_fileHashTracker = __esm(() => {
|
|
|
8307
8316
|
});
|
|
8308
8317
|
|
|
8309
8318
|
// src/dev/reactComponentClassifier.ts
|
|
8310
|
-
import { resolve as
|
|
8319
|
+
import { resolve as resolve24 } from "path";
|
|
8311
8320
|
var classifyComponent = (filePath) => {
|
|
8312
|
-
const normalizedPath =
|
|
8321
|
+
const normalizedPath = resolve24(filePath);
|
|
8313
8322
|
if (normalizedPath.includes("/react/pages/")) {
|
|
8314
8323
|
return "server";
|
|
8315
8324
|
}
|
|
@@ -8321,7 +8330,7 @@ var classifyComponent = (filePath) => {
|
|
|
8321
8330
|
var init_reactComponentClassifier = () => {};
|
|
8322
8331
|
|
|
8323
8332
|
// src/dev/moduleMapper.ts
|
|
8324
|
-
import { basename as basename8, resolve as
|
|
8333
|
+
import { basename as basename8, resolve as resolve25 } from "path";
|
|
8325
8334
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
8326
8335
|
const modulePaths = {};
|
|
8327
8336
|
moduleKeys.forEach((key) => {
|
|
@@ -8331,7 +8340,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
8331
8340
|
});
|
|
8332
8341
|
return modulePaths;
|
|
8333
8342
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
8334
|
-
const normalizedFile =
|
|
8343
|
+
const normalizedFile = resolve25(sourceFile);
|
|
8335
8344
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
8336
8345
|
if (processedFiles.has(normalizedFile)) {
|
|
8337
8346
|
return null;
|
|
@@ -8367,7 +8376,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
8367
8376
|
});
|
|
8368
8377
|
return grouped;
|
|
8369
8378
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
8370
|
-
const normalizedFile =
|
|
8379
|
+
const normalizedFile = resolve25(sourceFile);
|
|
8371
8380
|
const fileName = basename8(normalizedFile);
|
|
8372
8381
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
8373
8382
|
const pascalName = toPascal(baseName);
|
|
@@ -9307,19 +9316,19 @@ var init_streamingSlotWarningScope = __esm(() => {
|
|
|
9307
9316
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
9308
9317
|
import { mkdir as mkdir4, symlink } from "fs/promises";
|
|
9309
9318
|
import { tmpdir } from "os";
|
|
9310
|
-
import { basename as basename10, dirname as dirname12, join as join21, resolve as
|
|
9319
|
+
import { basename as basename10, dirname as dirname12, join as join21, resolve as resolve26 } from "path";
|
|
9311
9320
|
var ssrDirty = false, lastSelector = "angular-page", isRecord7 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
|
|
9312
9321
|
if (!compilerImportPromise) {
|
|
9313
9322
|
compilerImportPromise = import("@angular/compiler");
|
|
9314
9323
|
}
|
|
9315
9324
|
return compilerImportPromise;
|
|
9316
9325
|
}, readAngularPageModule = (value) => isRecord7(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join21(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
|
|
9317
|
-
const outRoot =
|
|
9326
|
+
const outRoot = resolve26(dirname12(dirname12(outDir)));
|
|
9318
9327
|
const nodeModulesLink = join21(outRoot, "node_modules");
|
|
9319
9328
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
9320
9329
|
return;
|
|
9321
9330
|
}
|
|
9322
|
-
if (nodeModulesLink ===
|
|
9331
|
+
if (nodeModulesLink === resolve26(process.cwd(), "node_modules")) {
|
|
9323
9332
|
return;
|
|
9324
9333
|
}
|
|
9325
9334
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
@@ -9327,7 +9336,7 @@ var ssrDirty = false, lastSelector = "angular-page", isRecord7 = (value) => type
|
|
|
9327
9336
|
}
|
|
9328
9337
|
await mkdir4(outRoot, { recursive: true });
|
|
9329
9338
|
try {
|
|
9330
|
-
await symlink(
|
|
9339
|
+
await symlink(resolve26(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
9331
9340
|
} catch (error) {
|
|
9332
9341
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
9333
9342
|
throw error;
|
|
@@ -9846,8 +9855,8 @@ __export(exports_moduleServer, {
|
|
|
9846
9855
|
createModuleServer: () => createModuleServer,
|
|
9847
9856
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
9848
9857
|
});
|
|
9849
|
-
import { existsSync as existsSync20, readFileSync as
|
|
9850
|
-
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as
|
|
9858
|
+
import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as statSync2 } from "fs";
|
|
9859
|
+
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve27, relative as relative10 } from "path";
|
|
9851
9860
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
9852
9861
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
9853
9862
|
const allExports = [];
|
|
@@ -9867,7 +9876,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
9867
9876
|
${stubs}
|
|
9868
9877
|
`;
|
|
9869
9878
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
9870
|
-
const found = extensions.find((ext) => existsSync20(
|
|
9879
|
+
const found = extensions.find((ext) => existsSync20(resolve27(projectRoot, srcPath + ext)));
|
|
9871
9880
|
return found ? srcPath + found : srcPath;
|
|
9872
9881
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
9873
9882
|
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
@@ -9882,7 +9891,7 @@ ${stubs}
|
|
|
9882
9891
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
9883
9892
|
}, srcUrl = (relPath, projectRoot) => {
|
|
9884
9893
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
9885
|
-
const absPath =
|
|
9894
|
+
const absPath = resolve27(projectRoot, relPath);
|
|
9886
9895
|
const cached = mtimeCache.get(absPath);
|
|
9887
9896
|
if (cached !== undefined)
|
|
9888
9897
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -9894,12 +9903,12 @@ ${stubs}
|
|
|
9894
9903
|
return base;
|
|
9895
9904
|
}
|
|
9896
9905
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
9897
|
-
const absPath =
|
|
9906
|
+
const absPath = resolve27(fileDir, relPath);
|
|
9898
9907
|
const rel = relative10(projectRoot, absPath);
|
|
9899
9908
|
const extension = extname6(rel);
|
|
9900
9909
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
9901
9910
|
if (extname6(srcPath) === ".svelte") {
|
|
9902
|
-
srcPath = relative10(projectRoot, resolveSvelteModulePath(
|
|
9911
|
+
srcPath = relative10(projectRoot, resolveSvelteModulePath(resolve27(projectRoot, srcPath)));
|
|
9903
9912
|
}
|
|
9904
9913
|
return srcUrl(srcPath, projectRoot);
|
|
9905
9914
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -9945,12 +9954,12 @@ ${stubs}
|
|
|
9945
9954
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
9946
9955
|
});
|
|
9947
9956
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
9948
|
-
const absPath =
|
|
9957
|
+
const absPath = resolve27(fileDir, relPath);
|
|
9949
9958
|
const rel = relative10(projectRoot, absPath);
|
|
9950
9959
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
9951
9960
|
});
|
|
9952
9961
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
9953
|
-
const absPath =
|
|
9962
|
+
const absPath = resolve27(fileDir, relPath);
|
|
9954
9963
|
const rel = relative10(projectRoot, absPath);
|
|
9955
9964
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
9956
9965
|
});
|
|
@@ -9979,7 +9988,7 @@ ${stubs}
|
|
|
9979
9988
|
`)}
|
|
9980
9989
|
${code}`;
|
|
9981
9990
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
9982
|
-
const raw =
|
|
9991
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
9983
9992
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
9984
9993
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
9985
9994
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -9995,7 +10004,7 @@ ${transpiled}`;
|
|
|
9995
10004
|
transpiled += buildIslandMetadataExports(raw);
|
|
9996
10005
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
9997
10006
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
9998
|
-
const raw =
|
|
10007
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
9999
10008
|
const ext = extname6(filePath);
|
|
10000
10009
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
10001
10010
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -10150,15 +10159,15 @@ ${code}`;
|
|
|
10150
10159
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10151
10160
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
10152
10161
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
10153
|
-
}, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
|
|
10154
|
-
const raw =
|
|
10162
|
+
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10163
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10155
10164
|
if (!svelteCompiler) {
|
|
10156
10165
|
svelteCompiler = await import("svelte/compiler");
|
|
10157
10166
|
}
|
|
10158
10167
|
const isModule = filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
10159
10168
|
const loweredAwaitSource = isModule ? { code: raw, transformed: false } : lowerSvelteAwaitSlotSyntax(raw);
|
|
10160
10169
|
const loweredSource = isModule ? loweredAwaitSource : lowerSvelteIslandSyntax(loweredAwaitSource.code, "client");
|
|
10161
|
-
const source = loweredSource.code;
|
|
10170
|
+
const source = isModule ? loweredSource.code : (await svelteCompiler.preprocess(loweredSource.code, createSvelteStylePreprocessor(stylePreprocessors))).code;
|
|
10162
10171
|
const enableAsync = loweredAwaitSource.transformed || loweredSource.transformed;
|
|
10163
10172
|
const code = isModule ? compileSvelteModule(source, filePath) : compileSvelteComponent(source, filePath, projectRoot, enableAsync);
|
|
10164
10173
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
@@ -10185,16 +10194,16 @@ __script__.render = render;`;
|
|
|
10185
10194
|
code += `
|
|
10186
10195
|
export default __script__;`;
|
|
10187
10196
|
return code;
|
|
10188
|
-
}, compileVueStyles = (descriptor, filePath, componentId, code) => {
|
|
10197
|
+
}, compileVueStyles = async (descriptor, filePath, componentId, code, stylePreprocessors) => {
|
|
10189
10198
|
if (descriptor.styles.length === 0)
|
|
10190
10199
|
return code;
|
|
10191
|
-
const cssCode = descriptor.styles.map((style) => vueCompiler.compileStyle({
|
|
10200
|
+
const cssCode = (await Promise.all(descriptor.styles.map(async (style) => vueCompiler.compileStyle({
|
|
10192
10201
|
filename: filePath,
|
|
10193
10202
|
id: `data-v-${componentId}`,
|
|
10194
10203
|
scoped: style.scoped,
|
|
10195
|
-
source: style.content,
|
|
10204
|
+
source: style.lang ? await compileStyleSource(filePath, style.content, style.lang, stylePreprocessors) : style.content,
|
|
10196
10205
|
trim: true
|
|
10197
|
-
}).code).join(`
|
|
10206
|
+
}).code))).join(`
|
|
10198
10207
|
`);
|
|
10199
10208
|
const escaped = cssCode.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10200
10209
|
const hmrId = JSON.stringify(filePath);
|
|
@@ -10208,8 +10217,8 @@ export default __script__;`;
|
|
|
10208
10217
|
].join("");
|
|
10209
10218
|
return `${cssInjection}
|
|
10210
10219
|
${code}`;
|
|
10211
|
-
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10212
|
-
const raw =
|
|
10220
|
+
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10221
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10213
10222
|
if (!vueCompiler) {
|
|
10214
10223
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
10215
10224
|
}
|
|
@@ -10221,12 +10230,12 @@ ${code}`;
|
|
|
10221
10230
|
inlineTemplate: false
|
|
10222
10231
|
});
|
|
10223
10232
|
let code = compileVueTemplate(descriptor, compiledScript, filePath, componentId);
|
|
10224
|
-
code = compileVueStyles(descriptor, filePath, componentId, code);
|
|
10233
|
+
code = await compileVueStyles(descriptor, filePath, componentId, code, stylePreprocessors);
|
|
10225
10234
|
code = tsTranspiler2.transformSync(code);
|
|
10226
10235
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
10227
10236
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
10228
10237
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
10229
|
-
const hmrBase = vueDir ?
|
|
10238
|
+
const hmrBase = vueDir ? resolve27(vueDir) : projectRoot;
|
|
10230
10239
|
const hmrId = relative10(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
10231
10240
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
10232
10241
|
result += [
|
|
@@ -10258,7 +10267,7 @@ ${code}`;
|
|
|
10258
10267
|
}
|
|
10259
10268
|
});
|
|
10260
10269
|
}, handleCssRequest = (filePath) => {
|
|
10261
|
-
const raw =
|
|
10270
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10262
10271
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10263
10272
|
return [
|
|
10264
10273
|
`const style = document.createElement('style');`,
|
|
@@ -10385,7 +10394,7 @@ export default {};
|
|
|
10385
10394
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10386
10395
|
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);`);
|
|
10387
10396
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
10388
|
-
const filePath =
|
|
10397
|
+
const filePath = resolve27(projectRoot, relPath);
|
|
10389
10398
|
const ext = extname6(filePath);
|
|
10390
10399
|
if (ext === ".svelte")
|
|
10391
10400
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -10398,7 +10407,7 @@ export default {};
|
|
|
10398
10407
|
if (found === ".svelte")
|
|
10399
10408
|
return { ext: found, filePath: resolveSvelteModulePath(resolved) };
|
|
10400
10409
|
return { ext: found, filePath: resolved };
|
|
10401
|
-
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir) => {
|
|
10410
|
+
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10402
10411
|
if (ext === ".css")
|
|
10403
10412
|
return jsResponse(handleCssRequest(filePath));
|
|
10404
10413
|
const isSvelte = ext === ".svelte" || filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
@@ -10406,24 +10415,24 @@ export default {};
|
|
|
10406
10415
|
if (cached)
|
|
10407
10416
|
return jsResponse(cached);
|
|
10408
10417
|
if (isSvelte)
|
|
10409
|
-
return transformAndCacheSvelte(filePath, projectRoot, rewriter);
|
|
10418
|
+
return transformAndCacheSvelte(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10410
10419
|
if (ext === ".vue")
|
|
10411
|
-
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir);
|
|
10420
|
+
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10412
10421
|
if (!TRANSPILABLE.has(ext))
|
|
10413
10422
|
return;
|
|
10414
10423
|
const stat2 = statSync2(filePath);
|
|
10415
|
-
const resolvedVueDir = vueDir ?
|
|
10424
|
+
const resolvedVueDir = vueDir ? resolve27(vueDir) : undefined;
|
|
10416
10425
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
10417
10426
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10418
10427
|
return jsResponse(content);
|
|
10419
|
-
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter) => {
|
|
10428
|
+
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10420
10429
|
const stat2 = statSync2(filePath);
|
|
10421
|
-
const content = await transformSvelteFile(filePath, projectRoot, rewriter);
|
|
10430
|
+
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10422
10431
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10423
10432
|
return jsResponse(content);
|
|
10424
|
-
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10433
|
+
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10425
10434
|
const stat2 = statSync2(filePath);
|
|
10426
|
-
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir);
|
|
10435
|
+
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10427
10436
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10428
10437
|
return jsResponse(content);
|
|
10429
10438
|
}, transformErrorResponse = (err) => {
|
|
@@ -10433,7 +10442,7 @@ export default {};
|
|
|
10433
10442
|
status: 500
|
|
10434
10443
|
});
|
|
10435
10444
|
}, createModuleServer = (config) => {
|
|
10436
|
-
const { projectRoot, vendorPaths, frameworkDirs } = config;
|
|
10445
|
+
const { projectRoot, vendorPaths, frameworkDirs, stylePreprocessors } = config;
|
|
10437
10446
|
const rewriter = buildImportRewriter(vendorPaths);
|
|
10438
10447
|
return async (pathname) => {
|
|
10439
10448
|
if (pathname.startsWith("/@stub/"))
|
|
@@ -10443,12 +10452,12 @@ export default {};
|
|
|
10443
10452
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
10444
10453
|
return;
|
|
10445
10454
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
10446
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
10455
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve27(projectRoot, relPath));
|
|
10447
10456
|
if (virtualCssResponse)
|
|
10448
10457
|
return virtualCssResponse;
|
|
10449
10458
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
10450
10459
|
try {
|
|
10451
|
-
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue);
|
|
10460
|
+
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue, stylePreprocessors);
|
|
10452
10461
|
} catch (err) {
|
|
10453
10462
|
return transformErrorResponse(err);
|
|
10454
10463
|
}
|
|
@@ -10459,11 +10468,11 @@ export default {};
|
|
|
10459
10468
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
10460
10469
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
10461
10470
|
if (match[1])
|
|
10462
|
-
files.push(
|
|
10471
|
+
files.push(resolve27(projectRoot, match[1]));
|
|
10463
10472
|
}
|
|
10464
10473
|
return files;
|
|
10465
10474
|
}, invalidateModule = (filePath) => {
|
|
10466
|
-
const resolved =
|
|
10475
|
+
const resolved = resolve27(filePath);
|
|
10467
10476
|
invalidate(filePath);
|
|
10468
10477
|
if (resolved !== filePath)
|
|
10469
10478
|
invalidate(resolved);
|
|
@@ -10482,6 +10491,7 @@ var init_moduleServer = __esm(() => {
|
|
|
10482
10491
|
init_constants();
|
|
10483
10492
|
init_resolvePackageImport();
|
|
10484
10493
|
init_sourceMetadata();
|
|
10494
|
+
init_stylePreprocessor();
|
|
10485
10495
|
init_lowerAwaitSlotSyntax();
|
|
10486
10496
|
init_lowerIslandSyntax();
|
|
10487
10497
|
init_transformCache();
|
|
@@ -10539,11 +10549,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
10539
10549
|
__export(exports_simpleHTMLHMR, {
|
|
10540
10550
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
10541
10551
|
});
|
|
10542
|
-
import { resolve as
|
|
10552
|
+
import { resolve as resolve28 } from "path";
|
|
10543
10553
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
10544
10554
|
let htmlContent;
|
|
10545
10555
|
try {
|
|
10546
|
-
const resolvedPath =
|
|
10556
|
+
const resolvedPath = resolve28(htmlFilePath);
|
|
10547
10557
|
const file3 = Bun.file(resolvedPath);
|
|
10548
10558
|
if (!await file3.exists()) {
|
|
10549
10559
|
return null;
|
|
@@ -10569,11 +10579,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
10569
10579
|
__export(exports_simpleHTMXHMR, {
|
|
10570
10580
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
10571
10581
|
});
|
|
10572
|
-
import { resolve as
|
|
10582
|
+
import { resolve as resolve29 } from "path";
|
|
10573
10583
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
10574
10584
|
let htmlContent;
|
|
10575
10585
|
try {
|
|
10576
|
-
const resolvedPath =
|
|
10586
|
+
const resolvedPath = resolve29(htmxFilePath);
|
|
10577
10587
|
const file3 = Bun.file(resolvedPath);
|
|
10578
10588
|
if (!await file3.exists()) {
|
|
10579
10589
|
return null;
|
|
@@ -10596,7 +10606,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
10596
10606
|
|
|
10597
10607
|
// src/dev/rebuildTrigger.ts
|
|
10598
10608
|
import { existsSync as existsSync21 } from "fs";
|
|
10599
|
-
import { basename as basename13, dirname as dirname15, relative as relative11, resolve as
|
|
10609
|
+
import { basename as basename13, dirname as dirname15, relative as relative11, resolve as resolve30 } from "path";
|
|
10600
10610
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
10601
10611
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
10602
10612
|
if (pathLineCol) {
|
|
@@ -10668,7 +10678,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10668
10678
|
state.fileHashes.delete(filePathInSet);
|
|
10669
10679
|
try {
|
|
10670
10680
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
10671
|
-
const deletedPathResolved =
|
|
10681
|
+
const deletedPathResolved = resolve30(filePathInSet);
|
|
10672
10682
|
affectedFiles.forEach((affectedFile) => {
|
|
10673
10683
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
10674
10684
|
validFiles.push(affectedFile);
|
|
@@ -10712,7 +10722,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10712
10722
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
10713
10723
|
return;
|
|
10714
10724
|
}
|
|
10715
|
-
const normalizedFilePath =
|
|
10725
|
+
const normalizedFilePath = resolve30(filePathInSet);
|
|
10716
10726
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
10717
10727
|
validFiles.push(normalizedFilePath);
|
|
10718
10728
|
processedFiles.add(normalizedFilePath);
|
|
@@ -10790,7 +10800,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10790
10800
|
}
|
|
10791
10801
|
if (framework === "unknown") {
|
|
10792
10802
|
const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
|
|
10793
|
-
invalidate2(
|
|
10803
|
+
invalidate2(resolve30(filePath));
|
|
10794
10804
|
const relPath = relative11(process.cwd(), filePath);
|
|
10795
10805
|
logHmrUpdate(relPath);
|
|
10796
10806
|
return;
|
|
@@ -10836,7 +10846,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10836
10846
|
}
|
|
10837
10847
|
if (!graph)
|
|
10838
10848
|
return componentFile;
|
|
10839
|
-
const dependents = graph.dependents.get(
|
|
10849
|
+
const dependents = graph.dependents.get(resolve30(componentFile));
|
|
10840
10850
|
if (!dependents)
|
|
10841
10851
|
return componentFile;
|
|
10842
10852
|
for (const dep of dependents) {
|
|
@@ -10845,7 +10855,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10845
10855
|
}
|
|
10846
10856
|
return componentFile;
|
|
10847
10857
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
10848
|
-
const pageEntries = angularFiles.filter((file3) => file3.endsWith(".ts") &&
|
|
10858
|
+
const pageEntries = angularFiles.filter((file3) => file3.endsWith(".ts") && resolve30(file3).startsWith(angularPagesPath));
|
|
10849
10859
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
10850
10860
|
return pageEntries;
|
|
10851
10861
|
}
|
|
@@ -10854,7 +10864,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10854
10864
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
10855
10865
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
10856
10866
|
affected.forEach((file3) => {
|
|
10857
|
-
if (file3.endsWith(".ts") &&
|
|
10867
|
+
if (file3.endsWith(".ts") && resolve30(file3).startsWith(angularPagesPath)) {
|
|
10858
10868
|
resolvedPages.add(file3);
|
|
10859
10869
|
}
|
|
10860
10870
|
});
|
|
@@ -10904,7 +10914,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10904
10914
|
format: "esm",
|
|
10905
10915
|
naming: "[dir]/[name].[hash].[ext]",
|
|
10906
10916
|
outdir: buildDir,
|
|
10907
|
-
plugins: [
|
|
10917
|
+
plugins: [
|
|
10918
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
10919
|
+
],
|
|
10908
10920
|
root: clientRoot,
|
|
10909
10921
|
target: "browser",
|
|
10910
10922
|
throw: false
|
|
@@ -10945,10 +10957,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10945
10957
|
});
|
|
10946
10958
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
10947
10959
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
10948
|
-
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true);
|
|
10960
|
+
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, state.config.stylePreprocessors);
|
|
10949
10961
|
serverPaths.forEach((serverPath) => {
|
|
10950
10962
|
const fileBase = basename13(serverPath, ".js");
|
|
10951
|
-
state.manifest[toPascal(fileBase)] =
|
|
10963
|
+
state.manifest[toPascal(fileBase)] = resolve30(serverPath);
|
|
10952
10964
|
});
|
|
10953
10965
|
if (clientPaths.length > 0) {
|
|
10954
10966
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
@@ -10957,9 +10969,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10957
10969
|
const angularDir = config.angularDirectory ?? "";
|
|
10958
10970
|
const angularFiles = filesToRebuild.filter((file3) => detectFramework(file3, state.resolvedPaths) === "angular");
|
|
10959
10971
|
for (const file3 of angularFiles) {
|
|
10960
|
-
state.fileHashes.set(
|
|
10972
|
+
state.fileHashes.set(resolve30(file3), computeFileHash(file3));
|
|
10961
10973
|
}
|
|
10962
|
-
const angularPagesPath =
|
|
10974
|
+
const angularPagesPath = resolve30(angularDir, "pages");
|
|
10963
10975
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
10964
10976
|
if (pageEntries.length > 0) {
|
|
10965
10977
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
@@ -10974,7 +10986,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10974
10986
|
return manifest;
|
|
10975
10987
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
10976
10988
|
const pageName = basename13(normalized, ".tsx");
|
|
10977
|
-
const indexPath =
|
|
10989
|
+
const indexPath = resolve30(reactIndexesPath, `${pageName}.tsx`);
|
|
10978
10990
|
if (!existsSync21(indexPath)) {
|
|
10979
10991
|
return;
|
|
10980
10992
|
}
|
|
@@ -10986,13 +10998,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10986
10998
|
return;
|
|
10987
10999
|
}
|
|
10988
11000
|
const pageName = basename13(dep, ".tsx");
|
|
10989
|
-
const indexPath =
|
|
11001
|
+
const indexPath = resolve30(reactIndexesPath, `${pageName}.tsx`);
|
|
10990
11002
|
if (existsSync21(indexPath) && !reactEntries.includes(indexPath)) {
|
|
10991
11003
|
reactEntries.push(indexPath);
|
|
10992
11004
|
}
|
|
10993
11005
|
});
|
|
10994
11006
|
}, resolveReactEntryForFile = (state, file3, pagesPathResolved, reactIndexesPath, reactEntries) => {
|
|
10995
|
-
const normalized =
|
|
11007
|
+
const normalized = resolve30(file3);
|
|
10996
11008
|
if (!normalized.startsWith(pagesPathResolved)) {
|
|
10997
11009
|
resolveReactEntriesFromDeps(state, normalized, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
10998
11010
|
return;
|
|
@@ -11003,7 +11015,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11003
11015
|
}
|
|
11004
11016
|
}, collectReactEntries = (state, filesToRebuild, reactPagesPath, reactIndexesPath) => {
|
|
11005
11017
|
const reactEntries = [];
|
|
11006
|
-
const pagesPathResolved =
|
|
11018
|
+
const pagesPathResolved = resolve30(reactPagesPath);
|
|
11007
11019
|
filesToRebuild.forEach((file3) => {
|
|
11008
11020
|
resolveReactEntryForFile(state, file3, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
11009
11021
|
});
|
|
@@ -11015,7 +11027,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11015
11027
|
const { rewriteReactImports: rewriteReactImports2 } = await Promise.resolve().then(() => (init_rewriteReactImports(), exports_rewriteReactImports));
|
|
11016
11028
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11017
11029
|
const depVendorPaths = globalThis.__depVendorPaths ?? {};
|
|
11018
|
-
const refreshEntry =
|
|
11030
|
+
const refreshEntry = resolve30(reactIndexesPath, "_refresh.tsx");
|
|
11019
11031
|
if (!reactEntries.includes(refreshEntry)) {
|
|
11020
11032
|
reactEntries.push(refreshEntry);
|
|
11021
11033
|
}
|
|
@@ -11027,7 +11039,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11027
11039
|
setDevVendorPaths2(vendorPaths);
|
|
11028
11040
|
}
|
|
11029
11041
|
const { rmSync: rmSync3 } = await import("fs");
|
|
11030
|
-
rmSync3(
|
|
11042
|
+
rmSync3(resolve30(buildDir, "react", "generated", "indexes"), {
|
|
11031
11043
|
force: true,
|
|
11032
11044
|
recursive: true
|
|
11033
11045
|
});
|
|
@@ -11037,7 +11049,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11037
11049
|
jsx: { development: true },
|
|
11038
11050
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11039
11051
|
outdir: buildDir,
|
|
11040
|
-
plugins: [
|
|
11052
|
+
plugins: [
|
|
11053
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11054
|
+
],
|
|
11041
11055
|
reactFastRefresh: true,
|
|
11042
11056
|
root: clientRoot,
|
|
11043
11057
|
splitting: true,
|
|
@@ -11077,11 +11091,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11077
11091
|
if (isComponentFile2)
|
|
11078
11092
|
return primaryFile;
|
|
11079
11093
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
11080
|
-
const nearest = findNearestComponent2(
|
|
11094
|
+
const nearest = findNearestComponent2(resolve30(primaryFile));
|
|
11081
11095
|
return nearest ?? primaryFile;
|
|
11082
11096
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
11083
11097
|
for (const file3 of reactFiles) {
|
|
11084
|
-
state.fileHashes.set(
|
|
11098
|
+
state.fileHashes.set(resolve30(file3), computeFileHash(file3));
|
|
11085
11099
|
}
|
|
11086
11100
|
invalidateReactSsrCache();
|
|
11087
11101
|
const primaryFile = reactFiles.find((file3) => !file3.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -11123,8 +11137,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11123
11137
|
return state.manifest;
|
|
11124
11138
|
}, handleReactFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
11125
11139
|
const reactDir = config.reactDirectory ?? "";
|
|
11126
|
-
const reactPagesPath =
|
|
11127
|
-
const reactIndexesPath =
|
|
11140
|
+
const reactPagesPath = resolve30(reactDir, "pages");
|
|
11141
|
+
const reactIndexesPath = resolve30(reactDir, "generated", "indexes");
|
|
11128
11142
|
const { buildDir } = state.resolvedPaths;
|
|
11129
11143
|
const reactFiles = filesToRebuild.filter((file3) => detectFramework(file3, state.resolvedPaths) === "react");
|
|
11130
11144
|
if (reactFiles.length > 0) {
|
|
@@ -11187,7 +11201,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11187
11201
|
});
|
|
11188
11202
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
11189
11203
|
for (const file3 of svelteFiles) {
|
|
11190
|
-
state.fileHashes.set(
|
|
11204
|
+
state.fileHashes.set(resolve30(file3), computeFileHash(file3));
|
|
11191
11205
|
}
|
|
11192
11206
|
invalidateSvelteSsrCache();
|
|
11193
11207
|
const serverDuration = Date.now() - startTime;
|
|
@@ -11210,11 +11224,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11210
11224
|
const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
|
|
11211
11225
|
const { build: bunBuild7 } = await Promise.resolve(globalThis.Bun);
|
|
11212
11226
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11213
|
-
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true);
|
|
11227
|
+
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, state.config.stylePreprocessors);
|
|
11214
11228
|
const serverEntries = [...svelteServerPaths];
|
|
11215
11229
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
11216
|
-
const serverRoot =
|
|
11217
|
-
const serverOutDir =
|
|
11230
|
+
const serverRoot = resolve30(svelteDir, "generated", "server");
|
|
11231
|
+
const serverOutDir = resolve30(buildDir, basename13(svelteDir));
|
|
11218
11232
|
const [serverResult, clientResult] = await Promise.all([
|
|
11219
11233
|
serverEntries.length > 0 ? bunBuild7({
|
|
11220
11234
|
entrypoints: serverEntries,
|
|
@@ -11229,7 +11243,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11229
11243
|
format: "esm",
|
|
11230
11244
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11231
11245
|
outdir: serverOutDir,
|
|
11232
|
-
plugins: [
|
|
11246
|
+
plugins: [
|
|
11247
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11248
|
+
],
|
|
11233
11249
|
root: serverRoot,
|
|
11234
11250
|
target: "bun",
|
|
11235
11251
|
throw: false
|
|
@@ -11239,7 +11255,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11239
11255
|
format: "esm",
|
|
11240
11256
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11241
11257
|
outdir: buildDir,
|
|
11242
|
-
plugins: [
|
|
11258
|
+
plugins: [
|
|
11259
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11260
|
+
],
|
|
11243
11261
|
root: clientRoot,
|
|
11244
11262
|
target: "browser",
|
|
11245
11263
|
throw: false
|
|
@@ -11307,7 +11325,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11307
11325
|
});
|
|
11308
11326
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
11309
11327
|
for (const file3 of [...vueFiles, ...nonVueFiles]) {
|
|
11310
|
-
state.fileHashes.set(
|
|
11328
|
+
state.fileHashes.set(resolve30(file3), computeFileHash(file3));
|
|
11311
11329
|
}
|
|
11312
11330
|
invalidateVueSsrCache();
|
|
11313
11331
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -11402,8 +11420,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11402
11420
|
if (!buildReference?.source) {
|
|
11403
11421
|
return;
|
|
11404
11422
|
}
|
|
11405
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
11406
|
-
islandFiles.add(
|
|
11423
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve30(dirname15(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
11424
|
+
islandFiles.add(resolve30(sourcePath));
|
|
11407
11425
|
}, resolveIslandSourceFiles = async (config) => {
|
|
11408
11426
|
const registryPath = config.islands?.registry;
|
|
11409
11427
|
if (!registryPath) {
|
|
@@ -11411,7 +11429,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11411
11429
|
}
|
|
11412
11430
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
11413
11431
|
const islandFiles = new Set([
|
|
11414
|
-
|
|
11432
|
+
resolve30(buildInfo.resolvedRegistryPath)
|
|
11415
11433
|
]);
|
|
11416
11434
|
for (const definition of buildInfo.definitions) {
|
|
11417
11435
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -11422,7 +11440,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11422
11440
|
if (islandFiles.size === 0) {
|
|
11423
11441
|
return false;
|
|
11424
11442
|
}
|
|
11425
|
-
return filesToRebuild.some((file3) => islandFiles.has(
|
|
11443
|
+
return filesToRebuild.some((file3) => islandFiles.has(resolve30(file3)));
|
|
11426
11444
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
11427
11445
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
11428
11446
|
if (!shouldReload) {
|
|
@@ -11457,10 +11475,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11457
11475
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
11458
11476
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
11459
11477
|
if (isSingle) {
|
|
11460
|
-
return
|
|
11478
|
+
return resolve30(state.resolvedPaths.buildDir, "pages");
|
|
11461
11479
|
}
|
|
11462
11480
|
const dirName = framework === "html" ? basename13(config.htmlDirectory ?? "html") : basename13(config.htmxDirectory ?? "htmx");
|
|
11463
|
-
return
|
|
11481
|
+
return resolve30(state.resolvedPaths.buildDir, dirName, "pages");
|
|
11464
11482
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
11465
11483
|
try {
|
|
11466
11484
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -11499,7 +11517,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11499
11517
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
11500
11518
|
for (const pageFile of pageFilesToUpdate) {
|
|
11501
11519
|
const htmlPageName = basename13(pageFile);
|
|
11502
|
-
const builtHtmlPagePath =
|
|
11520
|
+
const builtHtmlPagePath = resolve30(outputHtmlPages, htmlPageName);
|
|
11503
11521
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
11504
11522
|
}
|
|
11505
11523
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -11564,7 +11582,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11564
11582
|
const cssKey = `${pascalName}CSS`;
|
|
11565
11583
|
const cssUrl = manifest[cssKey] || null;
|
|
11566
11584
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
11567
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
11585
|
+
const hmrMeta = vueHmrMetadata2.get(resolve30(vuePagePath));
|
|
11568
11586
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
11569
11587
|
if (changeType === "style-only") {
|
|
11570
11588
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -11801,7 +11819,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11801
11819
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
11802
11820
|
for (const htmxPageFile of pageFilesToUpdate) {
|
|
11803
11821
|
const htmxPageName = basename13(htmxPageFile);
|
|
11804
|
-
const builtHtmxPagePath =
|
|
11822
|
+
const builtHtmxPagePath = resolve30(outputHtmxPages, htmxPageName);
|
|
11805
11823
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
11806
11824
|
}
|
|
11807
11825
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -11910,7 +11928,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11910
11928
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
11911
11929
|
writeFs(destPath, html);
|
|
11912
11930
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
11913
|
-
const destPath =
|
|
11931
|
+
const destPath = resolve30(outputDir, basename13(sourceFile));
|
|
11914
11932
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
11915
11933
|
const source = await Bun.file(sourceFile).text();
|
|
11916
11934
|
await Bun.write(destPath, source);
|
|
@@ -12208,7 +12226,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12208
12226
|
return Array.from(specifiers).filter(isResolvable3);
|
|
12209
12227
|
}, generateEntrySource2 = (specifier) => `export * from '${specifier}';
|
|
12210
12228
|
`, rewriteVendorFiles = async (vendorDir) => {
|
|
12211
|
-
const { readdirSync: readdirSync2, readFileSync:
|
|
12229
|
+
const { readdirSync: readdirSync2, readFileSync: readFileSync14, writeFileSync: writeFileSync8 } = await import("fs");
|
|
12212
12230
|
const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
|
|
12213
12231
|
const reactPaths = Object.entries(computeVendorPaths2());
|
|
12214
12232
|
const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
|
|
@@ -12219,7 +12237,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12219
12237
|
const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
12220
12238
|
for (const file3 of files) {
|
|
12221
12239
|
const filePath = join22(vendorDir, file3);
|
|
12222
|
-
const original =
|
|
12240
|
+
const original = readFileSync14(filePath, "utf-8");
|
|
12223
12241
|
const rewritten = rewriteContent(original);
|
|
12224
12242
|
if (rewritten !== original)
|
|
12225
12243
|
writeFileSync8(filePath, rewritten);
|
|
@@ -12306,7 +12324,7 @@ __export(exports_devBuild, {
|
|
|
12306
12324
|
});
|
|
12307
12325
|
import { readdir as readdir5 } from "fs/promises";
|
|
12308
12326
|
import { statSync as statSync3 } from "fs";
|
|
12309
|
-
import { dirname as dirname16, resolve as
|
|
12327
|
+
import { dirname as dirname16, resolve as resolve31 } from "path";
|
|
12310
12328
|
var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
12311
12329
|
const configuredDirs = [
|
|
12312
12330
|
config.reactDirectory,
|
|
@@ -12329,7 +12347,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12329
12347
|
return Object.keys(config).length > 0 ? config : null;
|
|
12330
12348
|
}, reloadConfig = async () => {
|
|
12331
12349
|
try {
|
|
12332
|
-
const configPath2 =
|
|
12350
|
+
const configPath2 = resolve31(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
12333
12351
|
const source = await Bun.file(configPath2).text();
|
|
12334
12352
|
return parseDirectoryConfig(source);
|
|
12335
12353
|
} catch {
|
|
@@ -12409,7 +12427,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12409
12427
|
state.fileChangeQueue.clear();
|
|
12410
12428
|
}
|
|
12411
12429
|
}, handleCachedReload = async () => {
|
|
12412
|
-
const serverMtime = statSync3(
|
|
12430
|
+
const serverMtime = statSync3(resolve31(Bun.main)).mtimeMs;
|
|
12413
12431
|
const lastMtime = globalThis.__hmrServerMtime;
|
|
12414
12432
|
globalThis.__hmrServerMtime = serverMtime;
|
|
12415
12433
|
const cached = globalThis.__hmrDevResult;
|
|
@@ -12443,8 +12461,8 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12443
12461
|
return true;
|
|
12444
12462
|
}, resolveAbsoluteVersion2 = async () => {
|
|
12445
12463
|
const candidates = [
|
|
12446
|
-
|
|
12447
|
-
|
|
12464
|
+
resolve31(import.meta.dir, "..", "..", "package.json"),
|
|
12465
|
+
resolve31(import.meta.dir, "..", "package.json")
|
|
12448
12466
|
];
|
|
12449
12467
|
for (const candidate of candidates) {
|
|
12450
12468
|
const found = await tryReadPackageVersion(candidate);
|
|
@@ -12457,7 +12475,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12457
12475
|
const entries = await readdir5(vendorDir).catch(() => emptyStringArray);
|
|
12458
12476
|
await Promise.all(entries.map(async (entry) => {
|
|
12459
12477
|
const webPath = `/${framework}/vendor/${entry}`;
|
|
12460
|
-
const bytes = await Bun.file(
|
|
12478
|
+
const bytes = await Bun.file(resolve31(vendorDir, entry)).bytes();
|
|
12461
12479
|
assetStore.set(webPath, bytes);
|
|
12462
12480
|
}));
|
|
12463
12481
|
}, devBuild = async (config) => {
|
|
@@ -12521,7 +12539,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12521
12539
|
recordStep("populate asset store", stepStartedAt);
|
|
12522
12540
|
stepStartedAt = performance.now();
|
|
12523
12541
|
const buildReactVendorTask = config.reactDirectory ? buildReactVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12524
|
-
const vendorDir =
|
|
12542
|
+
const vendorDir = resolve31(state.resolvedPaths.buildDir, "react", "vendor");
|
|
12525
12543
|
await loadVendorFiles(state.assetStore, vendorDir, "react");
|
|
12526
12544
|
if (!globalThis.__reactModuleRef) {
|
|
12527
12545
|
globalThis.__reactModuleRef = await import("react");
|
|
@@ -12529,23 +12547,23 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12529
12547
|
return true;
|
|
12530
12548
|
}) : undefined;
|
|
12531
12549
|
const buildAngularVendorTask = config.angularDirectory ? buildAngularVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12532
|
-
const vendorDir =
|
|
12550
|
+
const vendorDir = resolve31(state.resolvedPaths.buildDir, "angular", "vendor");
|
|
12533
12551
|
await loadVendorFiles(state.assetStore, vendorDir, "angular");
|
|
12534
12552
|
return true;
|
|
12535
12553
|
}) : undefined;
|
|
12536
12554
|
const buildSvelteVendorTask = config.svelteDirectory ? buildSvelteVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12537
|
-
const vendorDir =
|
|
12555
|
+
const vendorDir = resolve31(state.resolvedPaths.buildDir, "svelte", "vendor");
|
|
12538
12556
|
await loadVendorFiles(state.assetStore, vendorDir, "svelte");
|
|
12539
12557
|
return true;
|
|
12540
12558
|
}) : undefined;
|
|
12541
12559
|
const buildVueVendorTask = config.vueDirectory ? buildVueVendor(state.resolvedPaths.buildDir).then(async () => {
|
|
12542
|
-
const vendorDir =
|
|
12560
|
+
const vendorDir = resolve31(state.resolvedPaths.buildDir, "vue", "vendor");
|
|
12543
12561
|
await loadVendorFiles(state.assetStore, vendorDir, "vue");
|
|
12544
12562
|
return true;
|
|
12545
12563
|
}) : undefined;
|
|
12546
12564
|
const { buildDepVendor: buildDepVendor2 } = await Promise.resolve().then(() => (init_buildDepVendor(), exports_buildDepVendor));
|
|
12547
12565
|
const buildDepVendorTask = buildDepVendor2(state.resolvedPaths.buildDir, sourceDirs).then(async (depPaths) => {
|
|
12548
|
-
const vendorDir =
|
|
12566
|
+
const vendorDir = resolve31(state.resolvedPaths.buildDir, "vendor");
|
|
12549
12567
|
await loadVendorFiles(state.assetStore, vendorDir, "vendor");
|
|
12550
12568
|
globalThis.__depVendorPaths = depPaths;
|
|
12551
12569
|
return true;
|
|
@@ -12582,7 +12600,7 @@ var FRAMEWORK_DIR_KEYS, collectDepVendorSourceDirs = (config) => {
|
|
|
12582
12600
|
manifest
|
|
12583
12601
|
};
|
|
12584
12602
|
globalThis.__hmrDevResult = result;
|
|
12585
|
-
globalThis.__hmrServerMtime = statSync3(
|
|
12603
|
+
globalThis.__hmrServerMtime = statSync3(resolve31(Bun.main)).mtimeMs;
|
|
12586
12604
|
return result;
|
|
12587
12605
|
};
|
|
12588
12606
|
var init_devBuild = __esm(() => {
|
|
@@ -12618,5 +12636,5 @@ export {
|
|
|
12618
12636
|
build
|
|
12619
12637
|
};
|
|
12620
12638
|
|
|
12621
|
-
//# debugId=
|
|
12639
|
+
//# debugId=001509E3B3F3F26364756E2164756E21
|
|
12622
12640
|
//# sourceMappingURL=build.js.map
|