@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/index.js
CHANGED
|
@@ -2502,10 +2502,9 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2502
2502
|
});
|
|
2503
2503
|
|
|
2504
2504
|
// src/build/stylePreprocessor.ts
|
|
2505
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
2506
2505
|
import { readFile } from "fs/promises";
|
|
2507
2506
|
import { createRequire } from "module";
|
|
2508
|
-
import { dirname as dirname2, extname, join as join3 } from "path";
|
|
2507
|
+
import { dirname as dirname2, extname, join as join3, resolve as resolve4 } from "path";
|
|
2509
2508
|
var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
2510
2509
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2511
2510
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -2515,24 +2514,29 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2515
2514
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
2516
2515
|
return "less";
|
|
2517
2516
|
return null;
|
|
2518
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
}
|
|
2524
|
-
|
|
2517
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
2518
|
+
dirname2(filePath),
|
|
2519
|
+
process.cwd(),
|
|
2520
|
+
...paths.map((path) => resolve4(process.cwd(), path))
|
|
2521
|
+
], getSassOptions = (config, language) => ({
|
|
2522
|
+
...config?.sass ?? {},
|
|
2523
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
2524
|
+
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2525
|
+
${contents}` : contents, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
2525
2526
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2526
|
-
const
|
|
2527
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2527
2528
|
if (language === "scss" || language === "sass") {
|
|
2529
|
+
const options = getSassOptions(config, language);
|
|
2530
|
+
const packageName = options.implementation ?? "sass";
|
|
2528
2531
|
let sass;
|
|
2529
2532
|
try {
|
|
2530
|
-
sass = await importOptionalPeer(
|
|
2533
|
+
sass = await importOptionalPeer(packageName);
|
|
2531
2534
|
} catch {
|
|
2532
|
-
throw missingDependencyError(
|
|
2535
|
+
throw missingDependencyError(packageName, filePath);
|
|
2533
2536
|
}
|
|
2537
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2534
2538
|
const result = sass.compileString(contents, {
|
|
2535
|
-
loadPaths:
|
|
2539
|
+
loadPaths: normalizeLoadPaths(filePath, options.loadPaths),
|
|
2536
2540
|
style: "expanded",
|
|
2537
2541
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2538
2542
|
url: new URL(`file://${filePath}`)
|
|
@@ -2540,6 +2544,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2540
2544
|
return result.css;
|
|
2541
2545
|
}
|
|
2542
2546
|
if (language === "less") {
|
|
2547
|
+
const options = getLessOptions(config);
|
|
2543
2548
|
let lessModule;
|
|
2544
2549
|
try {
|
|
2545
2550
|
lessModule = await importOptionalPeer("less");
|
|
@@ -2550,14 +2555,49 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2550
2555
|
const render = less?.render;
|
|
2551
2556
|
if (!render)
|
|
2552
2557
|
throw missingDependencyError("less", filePath);
|
|
2558
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2553
2559
|
const result = await render(contents, {
|
|
2560
|
+
...options.options ?? {},
|
|
2554
2561
|
filename: filePath,
|
|
2555
|
-
paths:
|
|
2562
|
+
paths: normalizeLoadPaths(filePath, options.paths)
|
|
2556
2563
|
});
|
|
2557
2564
|
return result.css;
|
|
2558
2565
|
}
|
|
2559
|
-
return
|
|
2560
|
-
},
|
|
2566
|
+
return rawContents;
|
|
2567
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
2568
|
+
name: "absolute-style-preprocessor",
|
|
2569
|
+
setup(build) {
|
|
2570
|
+
const cssModuleSources = new Map;
|
|
2571
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2572
|
+
namespace: "absolute-style-module",
|
|
2573
|
+
path: path.slice("absolute-style-module:".length)
|
|
2574
|
+
}));
|
|
2575
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2576
|
+
const sourcePath = cssModuleSources.get(path);
|
|
2577
|
+
if (!sourcePath) {
|
|
2578
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2579
|
+
}
|
|
2580
|
+
return {
|
|
2581
|
+
contents: await compileStyleSource(sourcePath, undefined, undefined, config),
|
|
2582
|
+
loader: "css"
|
|
2583
|
+
};
|
|
2584
|
+
});
|
|
2585
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2586
|
+
if (isStyleModulePath(path)) {
|
|
2587
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2588
|
+
cssModuleSources.set(cssModulePath, path);
|
|
2589
|
+
return {
|
|
2590
|
+
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2591
|
+
loader: "js"
|
|
2592
|
+
};
|
|
2593
|
+
}
|
|
2594
|
+
return {
|
|
2595
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
2596
|
+
loader: "css"
|
|
2597
|
+
};
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
2561
2601
|
style: async ({
|
|
2562
2602
|
attributes,
|
|
2563
2603
|
content,
|
|
@@ -2568,35 +2608,14 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2568
2608
|
return;
|
|
2569
2609
|
const path = filename ?? `style.${language}`;
|
|
2570
2610
|
return {
|
|
2571
|
-
code: await compileStyleSource(path, content, language)
|
|
2611
|
+
code: await compileStyleSource(path, content, language, config)
|
|
2572
2612
|
};
|
|
2573
2613
|
}
|
|
2574
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
2614
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
2575
2615
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2576
2616
|
return readFile(filePath, "utf-8");
|
|
2577
2617
|
}
|
|
2578
|
-
return compileStyleSource(filePath);
|
|
2579
|
-
}, compileStyleFileIfNeededSync = (filePath) => {
|
|
2580
|
-
const contents = readFileSync3(filePath, "utf-8");
|
|
2581
|
-
const language = getStyleLanguage(filePath);
|
|
2582
|
-
if (language === "scss" || language === "sass") {
|
|
2583
|
-
let sass;
|
|
2584
|
-
try {
|
|
2585
|
-
sass = requireOptionalPeerSync("sass");
|
|
2586
|
-
} catch {
|
|
2587
|
-
throw missingDependencyError("sass", filePath);
|
|
2588
|
-
}
|
|
2589
|
-
return sass.compileString(contents, {
|
|
2590
|
-
loadPaths: [dirname2(filePath), process.cwd()],
|
|
2591
|
-
style: "expanded",
|
|
2592
|
-
syntax: language === "sass" ? "indented" : "scss",
|
|
2593
|
-
url: new URL(`file://${filePath}`)
|
|
2594
|
-
}).css;
|
|
2595
|
-
}
|
|
2596
|
-
if (language === "less") {
|
|
2597
|
-
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.`);
|
|
2598
|
-
}
|
|
2599
|
-
return contents;
|
|
2618
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2600
2619
|
};
|
|
2601
2620
|
var init_stylePreprocessor = __esm(() => {
|
|
2602
2621
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -2605,45 +2624,12 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2605
2624
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2606
2625
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2607
2626
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
2608
|
-
stylePreprocessorPlugin =
|
|
2609
|
-
name: "absolute-style-preprocessor",
|
|
2610
|
-
setup(build) {
|
|
2611
|
-
const cssModuleSources = new Map;
|
|
2612
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2613
|
-
namespace: "absolute-style-module",
|
|
2614
|
-
path: path.slice("absolute-style-module:".length)
|
|
2615
|
-
}));
|
|
2616
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2617
|
-
const sourcePath = cssModuleSources.get(path);
|
|
2618
|
-
if (!sourcePath) {
|
|
2619
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2620
|
-
}
|
|
2621
|
-
return {
|
|
2622
|
-
contents: await compileStyleSource(sourcePath),
|
|
2623
|
-
loader: "css"
|
|
2624
|
-
};
|
|
2625
|
-
});
|
|
2626
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2627
|
-
if (isStyleModulePath(path)) {
|
|
2628
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2629
|
-
cssModuleSources.set(cssModulePath, path);
|
|
2630
|
-
return {
|
|
2631
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2632
|
-
loader: "js"
|
|
2633
|
-
};
|
|
2634
|
-
}
|
|
2635
|
-
return {
|
|
2636
|
-
contents: await compileStyleSource(path),
|
|
2637
|
-
loader: "css"
|
|
2638
|
-
};
|
|
2639
|
-
});
|
|
2640
|
-
}
|
|
2641
|
-
};
|
|
2627
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
2642
2628
|
});
|
|
2643
2629
|
|
|
2644
2630
|
// src/core/svelteServerModule.ts
|
|
2645
2631
|
import { mkdir, readdir } from "fs/promises";
|
|
2646
|
-
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as
|
|
2632
|
+
import { basename as basename2, dirname as dirname3, extname as extname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
2647
2633
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2648
2634
|
const importPath = relative(dirname3(from), target).replace(/\\/g, "/");
|
|
2649
2635
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
@@ -2691,7 +2677,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2691
2677
|
if (!spec.startsWith(".")) {
|
|
2692
2678
|
return null;
|
|
2693
2679
|
}
|
|
2694
|
-
const basePath =
|
|
2680
|
+
const basePath = resolve5(dirname3(from), spec);
|
|
2695
2681
|
const candidates = [
|
|
2696
2682
|
basePath,
|
|
2697
2683
|
`${basePath}.ts`,
|
|
@@ -2723,7 +2709,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2723
2709
|
if (!spec.startsWith(".")) {
|
|
2724
2710
|
return null;
|
|
2725
2711
|
}
|
|
2726
|
-
const explicitPath =
|
|
2712
|
+
const explicitPath = resolve5(dirname3(from), spec);
|
|
2727
2713
|
if (extname2(explicitPath) === ".svelte") {
|
|
2728
2714
|
return explicitPath;
|
|
2729
2715
|
}
|
|
@@ -2978,7 +2964,7 @@ import {
|
|
|
2978
2964
|
rmSync,
|
|
2979
2965
|
writeFileSync as writeFileSync2
|
|
2980
2966
|
} from "fs";
|
|
2981
|
-
import { dirname as dirname4, extname as extname3, join as join5, relative as relative2, resolve as
|
|
2967
|
+
import { dirname as dirname4, extname as extname3, join as join5, relative as relative2, resolve as resolve6 } from "path";
|
|
2982
2968
|
import ts from "typescript";
|
|
2983
2969
|
var frameworks, isRecord4 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
|
|
2984
2970
|
if (isRecord4(mod.islandRegistry))
|
|
@@ -2993,7 +2979,7 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
|
|
|
2993
2979
|
if (sourcePath.startsWith("file://")) {
|
|
2994
2980
|
return new URL(sourcePath).pathname;
|
|
2995
2981
|
}
|
|
2996
|
-
return
|
|
2982
|
+
return resolve6(dirname4(registryPath), sourcePath);
|
|
2997
2983
|
}, getObjectPropertyName = (name) => {
|
|
2998
2984
|
if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {
|
|
2999
2985
|
return name.text;
|
|
@@ -3156,7 +3142,7 @@ export default component;
|
|
|
3156
3142
|
generatedRoot
|
|
3157
3143
|
};
|
|
3158
3144
|
}, loadIslandRegistryBuildInfo = async (registryPath) => {
|
|
3159
|
-
const resolvedRegistryPath =
|
|
3145
|
+
const resolvedRegistryPath = resolve6(registryPath);
|
|
3160
3146
|
const registrySource = Bun.file(resolvedRegistryPath);
|
|
3161
3147
|
const registrySourceText = await registrySource.text();
|
|
3162
3148
|
const registryModule = await import(resolvedRegistryPath);
|
|
@@ -3245,7 +3231,7 @@ var init_staticStreaming = __esm(() => {
|
|
|
3245
3231
|
});
|
|
3246
3232
|
|
|
3247
3233
|
// src/build/staticIslandPages.ts
|
|
3248
|
-
import { readFileSync as
|
|
3234
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
3249
3235
|
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) => {
|
|
3250
3236
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
3251
3237
|
const attributes = new Map;
|
|
@@ -3374,7 +3360,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
3374
3360
|
}
|
|
3375
3361
|
return result + originalHtml.slice(nextIndex);
|
|
3376
3362
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
3377
|
-
const originalHtml =
|
|
3363
|
+
const originalHtml = readFileSync3(pagePath, "utf-8");
|
|
3378
3364
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
3379
3365
|
if (transformedHtml !== originalHtml) {
|
|
3380
3366
|
writeFileSync3(pagePath, transformedHtml);
|
|
@@ -3502,8 +3488,8 @@ var init_sourceMetadata = __esm(() => {
|
|
|
3502
3488
|
});
|
|
3503
3489
|
|
|
3504
3490
|
// src/islands/pageMetadata.ts
|
|
3505
|
-
import { readFileSync as
|
|
3506
|
-
import { dirname as dirname5, resolve as
|
|
3491
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
3492
|
+
import { dirname as dirname5, resolve as resolve9 } from "path";
|
|
3507
3493
|
var pagePatterns, getPageDirs = (config) => [
|
|
3508
3494
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
3509
3495
|
{ dir: config.reactDirectory, framework: "react" },
|
|
@@ -3522,15 +3508,15 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
3522
3508
|
const source = definition.buildReference?.source;
|
|
3523
3509
|
if (!source)
|
|
3524
3510
|
continue;
|
|
3525
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname :
|
|
3526
|
-
lookup.set(`${definition.framework}:${definition.component}`,
|
|
3511
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve9(dirname5(buildInfo.resolvedRegistryPath), source);
|
|
3512
|
+
lookup.set(`${definition.framework}:${definition.component}`, resolve9(resolvedSource));
|
|
3527
3513
|
}
|
|
3528
3514
|
return lookup;
|
|
3529
3515
|
}, getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map, metadataUsesSource = (metadata2, target) => metadata2.islands.some((usage) => {
|
|
3530
3516
|
const candidate = usage.source;
|
|
3531
|
-
return candidate ?
|
|
3517
|
+
return candidate ? resolve9(candidate) === target : false;
|
|
3532
3518
|
}), getPagesUsingIslandSource = (sourcePath) => {
|
|
3533
|
-
const target =
|
|
3519
|
+
const target = resolve9(sourcePath);
|
|
3534
3520
|
return [...getCurrentPageIslandMetadata().values()].filter((metadata2) => metadataUsesSource(metadata2, target)).map((metadata2) => metadata2.pagePath);
|
|
3535
3521
|
}, resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
3536
3522
|
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
@@ -3542,13 +3528,13 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
3542
3528
|
const pattern = pagePatterns[entry.framework];
|
|
3543
3529
|
if (!pattern)
|
|
3544
3530
|
return;
|
|
3545
|
-
const files = await scanEntryPoints(
|
|
3531
|
+
const files = await scanEntryPoints(resolve9(entry.dir), pattern);
|
|
3546
3532
|
for (const filePath of files) {
|
|
3547
|
-
const source =
|
|
3533
|
+
const source = readFileSync4(filePath, "utf-8");
|
|
3548
3534
|
const islands = extractIslandUsagesFromSource(source);
|
|
3549
|
-
pageMetadata.set(
|
|
3535
|
+
pageMetadata.set(resolve9(filePath), {
|
|
3550
3536
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
3551
|
-
pagePath:
|
|
3537
|
+
pagePath: resolve9(filePath)
|
|
3552
3538
|
});
|
|
3553
3539
|
}
|
|
3554
3540
|
}, loadPageIslandMetadata = async (config) => {
|
|
@@ -3678,18 +3664,18 @@ __export(exports_generateReactIndexes, {
|
|
|
3678
3664
|
});
|
|
3679
3665
|
import { existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
|
|
3680
3666
|
import { readdir as readdir2, rm, writeFile } from "fs/promises";
|
|
3681
|
-
import { basename as basename3, join as join6, relative as relative3, resolve as
|
|
3667
|
+
import { basename as basename3, join as join6, relative as relative3, resolve as resolve10, sep } from "path";
|
|
3682
3668
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
3683
3669
|
var indexContentCache, resolveDevClientDir = () => {
|
|
3684
3670
|
const projectRoot = process.cwd();
|
|
3685
|
-
const fromSource =
|
|
3671
|
+
const fromSource = resolve10(import.meta.dir, "../dev/client");
|
|
3686
3672
|
if (existsSync5(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
3687
3673
|
return fromSource;
|
|
3688
3674
|
}
|
|
3689
|
-
const fromNodeModules =
|
|
3675
|
+
const fromNodeModules = resolve10(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
3690
3676
|
if (existsSync5(fromNodeModules))
|
|
3691
3677
|
return fromNodeModules;
|
|
3692
|
-
return
|
|
3678
|
+
return resolve10(import.meta.dir, "./dev/client");
|
|
3693
3679
|
}, devClientDir, errorOverlayPath, hmrClientPath, refreshSetupPath, generateReactIndexFiles = async (reactPagesDirectory, reactIndexesDirectory, isDev2 = false) => {
|
|
3694
3680
|
if (!existsSync5(reactIndexesDirectory)) {
|
|
3695
3681
|
mkdirSync2(reactIndexesDirectory, { recursive: true });
|
|
@@ -3717,7 +3703,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3717
3703
|
});
|
|
3718
3704
|
}));
|
|
3719
3705
|
}
|
|
3720
|
-
const pagesRelPath = relative3(
|
|
3706
|
+
const pagesRelPath = relative3(resolve10(reactIndexesDirectory), resolve10(reactPagesDirectory)).split(sep).join("/");
|
|
3721
3707
|
const promises = files.map(async (file2) => {
|
|
3722
3708
|
const fileName = basename3(file2);
|
|
3723
3709
|
const [componentName] = fileName.split(".");
|
|
@@ -3977,7 +3963,7 @@ var indexContentCache, resolveDevClientDir = () => {
|
|
|
3977
3963
|
`
|
|
3978
3964
|
// Pre-warm: import the page module from the module server`,
|
|
3979
3965
|
`// immediately so the browser caches all /@src/ URLs.`,
|
|
3980
|
-
`import('/@src/${relative3(process.cwd(),
|
|
3966
|
+
`import('/@src/${relative3(process.cwd(), resolve10(reactPagesDirectory, `${componentName}.tsx`)).replace(/\\/g, "/")}').catch(() => {});`
|
|
3981
3967
|
] : []
|
|
3982
3968
|
].join(`
|
|
3983
3969
|
`);
|
|
@@ -4144,8 +4130,8 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
4144
4130
|
});
|
|
4145
4131
|
|
|
4146
4132
|
// src/utils/imageProcessing.ts
|
|
4147
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as
|
|
4148
|
-
import { join as join7, resolve as
|
|
4133
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "fs";
|
|
4134
|
+
import { join as join7, resolve as resolve11 } from "path";
|
|
4149
4135
|
var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
|
|
4150
4136
|
for (const size of sizes) {
|
|
4151
4137
|
if (size >= target)
|
|
@@ -4260,8 +4246,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
4260
4246
|
if (!existsSync8(metaPath) || !existsSync8(dataPath))
|
|
4261
4247
|
return null;
|
|
4262
4248
|
try {
|
|
4263
|
-
const meta = JSON.parse(
|
|
4264
|
-
const buffer =
|
|
4249
|
+
const meta = JSON.parse(readFileSync5(metaPath, "utf-8"));
|
|
4250
|
+
const buffer = readFileSync5(dataPath);
|
|
4265
4251
|
return { buffer, meta };
|
|
4266
4252
|
} catch {
|
|
4267
4253
|
return null;
|
|
@@ -4271,7 +4257,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
4271
4257
|
return sharpModule;
|
|
4272
4258
|
sharpLoaded = true;
|
|
4273
4259
|
try {
|
|
4274
|
-
const sharpPath =
|
|
4260
|
+
const sharpPath = resolve11(process.cwd(), "node_modules/sharp");
|
|
4275
4261
|
const mod = await import(sharpPath);
|
|
4276
4262
|
sharpModule = mod.default ?? mod;
|
|
4277
4263
|
return sharpModule;
|
|
@@ -4376,14 +4362,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
4376
4362
|
});
|
|
4377
4363
|
|
|
4378
4364
|
// src/cli/scripts/telemetry.ts
|
|
4379
|
-
import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as
|
|
4365
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as readFileSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
4380
4366
|
import { homedir } from "os";
|
|
4381
4367
|
import { join as join8 } from "path";
|
|
4382
4368
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
4383
4369
|
try {
|
|
4384
4370
|
if (!existsSync9(configPath))
|
|
4385
4371
|
return null;
|
|
4386
|
-
const raw =
|
|
4372
|
+
const raw = readFileSync6(configPath, "utf-8");
|
|
4387
4373
|
const config = JSON.parse(raw);
|
|
4388
4374
|
return config;
|
|
4389
4375
|
} catch {
|
|
@@ -4396,14 +4382,14 @@ var init_telemetry = __esm(() => {
|
|
|
4396
4382
|
});
|
|
4397
4383
|
|
|
4398
4384
|
// src/cli/telemetryEvent.ts
|
|
4399
|
-
import { existsSync as existsSync10, readFileSync as
|
|
4385
|
+
import { existsSync as existsSync10, readFileSync as readFileSync7 } from "fs";
|
|
4400
4386
|
import { arch, platform } from "os";
|
|
4401
4387
|
import { dirname as dirname6, join as join9, parse } from "path";
|
|
4402
4388
|
var checkCandidate = (candidate) => {
|
|
4403
4389
|
if (!existsSync10(candidate)) {
|
|
4404
4390
|
return null;
|
|
4405
4391
|
}
|
|
4406
|
-
const pkg = JSON.parse(
|
|
4392
|
+
const pkg = JSON.parse(readFileSync7(candidate, "utf-8"));
|
|
4407
4393
|
if (pkg.name === "@absolutejs/absolute") {
|
|
4408
4394
|
const ver = pkg.version;
|
|
4409
4395
|
return ver;
|
|
@@ -4509,18 +4495,18 @@ var init_updateAssetPaths = __esm(() => {
|
|
|
4509
4495
|
|
|
4510
4496
|
// src/dev/buildHMRClient.ts
|
|
4511
4497
|
import { existsSync as existsSync11 } from "fs";
|
|
4512
|
-
import { resolve as
|
|
4498
|
+
import { resolve as resolve12 } from "path";
|
|
4513
4499
|
var {build: bunBuild } = globalThis.Bun;
|
|
4514
4500
|
var resolveHmrClientPath = () => {
|
|
4515
4501
|
const projectRoot = process.cwd();
|
|
4516
|
-
const fromSource =
|
|
4502
|
+
const fromSource = resolve12(import.meta.dir, "client/hmrClient.ts");
|
|
4517
4503
|
if (existsSync11(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4518
4504
|
return fromSource;
|
|
4519
4505
|
}
|
|
4520
|
-
const fromNodeModules =
|
|
4506
|
+
const fromNodeModules = resolve12(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
4521
4507
|
if (existsSync11(fromNodeModules))
|
|
4522
4508
|
return fromNodeModules;
|
|
4523
|
-
return
|
|
4509
|
+
return resolve12(import.meta.dir, "dev/client/hmrClient.ts");
|
|
4524
4510
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
4525
4511
|
const entryPoint = hmrClientPath2;
|
|
4526
4512
|
const result = await bunBuild({
|
|
@@ -4550,7 +4536,7 @@ var init_buildHMRClient = __esm(() => {
|
|
|
4550
4536
|
// src/build/nativeRewrite.ts
|
|
4551
4537
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
4552
4538
|
import { platform as platform2, arch as arch2 } from "os";
|
|
4553
|
-
import { resolve as
|
|
4539
|
+
import { resolve as resolve13 } from "path";
|
|
4554
4540
|
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
4555
4541
|
if (nativeLib !== null)
|
|
4556
4542
|
return nativeLib;
|
|
@@ -4568,7 +4554,7 @@ var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
|
4568
4554
|
if (!libPath)
|
|
4569
4555
|
return null;
|
|
4570
4556
|
try {
|
|
4571
|
-
const fullPath =
|
|
4557
|
+
const fullPath = resolve13(import.meta.dir, "../../native/packages", libPath);
|
|
4572
4558
|
const lib = dlopen(fullPath, ffiDefinition);
|
|
4573
4559
|
nativeLib = lib.symbols;
|
|
4574
4560
|
return nativeLib;
|
|
@@ -4710,12 +4696,12 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
4710
4696
|
};
|
|
4711
4697
|
|
|
4712
4698
|
// src/build/angularLinkerPlugin.ts
|
|
4713
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as
|
|
4714
|
-
import { dirname as dirname7, join as join10, relative as relative4, resolve as
|
|
4699
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
|
|
4700
|
+
import { dirname as dirname7, join as join10, relative as relative4, resolve as resolve14 } from "path";
|
|
4715
4701
|
import { createHash } from "crypto";
|
|
4716
4702
|
var CACHE_DIR, angularLinkerPlugin;
|
|
4717
4703
|
var init_angularLinkerPlugin = __esm(() => {
|
|
4718
|
-
CACHE_DIR =
|
|
4704
|
+
CACHE_DIR = resolve14(".absolutejs", "cache", "angular-linker");
|
|
4719
4705
|
angularLinkerPlugin = {
|
|
4720
4706
|
name: "angular-linker",
|
|
4721
4707
|
setup(bld) {
|
|
@@ -4737,7 +4723,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4737
4723
|
const cachePath = join10(CACHE_DIR, `${hash}.js`);
|
|
4738
4724
|
if (existsSync12(cachePath)) {
|
|
4739
4725
|
return {
|
|
4740
|
-
contents:
|
|
4726
|
+
contents: readFileSync8(cachePath, "utf-8"),
|
|
4741
4727
|
loader: "js"
|
|
4742
4728
|
};
|
|
4743
4729
|
}
|
|
@@ -4753,9 +4739,9 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4753
4739
|
fileSystem: {
|
|
4754
4740
|
dirname: dirname7,
|
|
4755
4741
|
exists: existsSync12,
|
|
4756
|
-
readFile:
|
|
4742
|
+
readFile: readFileSync8,
|
|
4757
4743
|
relative: relative4,
|
|
4758
|
-
resolve:
|
|
4744
|
+
resolve: resolve14
|
|
4759
4745
|
},
|
|
4760
4746
|
linkerJitMode: false,
|
|
4761
4747
|
logger: {
|
|
@@ -4789,14 +4775,14 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
4789
4775
|
|
|
4790
4776
|
// src/utils/cleanStaleOutputs.ts
|
|
4791
4777
|
import { rm as rm2 } from "fs/promises";
|
|
4792
|
-
import { resolve as
|
|
4778
|
+
import { resolve as resolve15 } from "path";
|
|
4793
4779
|
var {Glob: Glob5 } = globalThis.Bun;
|
|
4794
4780
|
var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPaths) => {
|
|
4795
|
-
const currentPaths = new Set(currentOutputPaths.map((path) =>
|
|
4781
|
+
const currentPaths = new Set(currentOutputPaths.map((path) => resolve15(path)));
|
|
4796
4782
|
const glob = new Glob5("**/*");
|
|
4797
4783
|
const removals = [];
|
|
4798
4784
|
for (const relative5 of glob.scanSync({ cwd: buildPath })) {
|
|
4799
|
-
const absolute =
|
|
4785
|
+
const absolute = resolve15(buildPath, relative5);
|
|
4800
4786
|
if (currentPaths.has(absolute))
|
|
4801
4787
|
continue;
|
|
4802
4788
|
if (!HASHED_FILE_PATTERN.test(relative5))
|
|
@@ -4857,10 +4843,10 @@ var commonAncestor = (paths, fallback) => {
|
|
|
4857
4843
|
var init_commonAncestor = () => {};
|
|
4858
4844
|
|
|
4859
4845
|
// src/utils/validateSafePath.ts
|
|
4860
|
-
import { resolve as
|
|
4846
|
+
import { resolve as resolve16, relative as relative5 } from "path";
|
|
4861
4847
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
4862
|
-
const absoluteBase =
|
|
4863
|
-
const absoluteTarget =
|
|
4848
|
+
const absoluteBase = resolve16(baseDirectory);
|
|
4849
|
+
const absoluteTarget = resolve16(baseDirectory, targetPath);
|
|
4864
4850
|
const relativePath = normalizePath(relative5(absoluteBase, absoluteTarget));
|
|
4865
4851
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
4866
4852
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
@@ -4937,7 +4923,7 @@ import {
|
|
|
4937
4923
|
join as join12,
|
|
4938
4924
|
basename as basename5,
|
|
4939
4925
|
extname as extname5,
|
|
4940
|
-
resolve as
|
|
4926
|
+
resolve as resolve17,
|
|
4941
4927
|
relative as relative6,
|
|
4942
4928
|
sep as sep2
|
|
4943
4929
|
} from "path";
|
|
@@ -4945,14 +4931,14 @@ import { env as env2 } from "process";
|
|
|
4945
4931
|
var {write, file: file2, Transpiler } = globalThis.Bun;
|
|
4946
4932
|
var resolveDevClientDir2 = () => {
|
|
4947
4933
|
const projectRoot = process.cwd();
|
|
4948
|
-
const fromSource =
|
|
4934
|
+
const fromSource = resolve17(import.meta.dir, "../dev/client");
|
|
4949
4935
|
if (existsSync13(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
4950
4936
|
return fromSource;
|
|
4951
4937
|
}
|
|
4952
|
-
const fromNodeModules =
|
|
4938
|
+
const fromNodeModules = resolve17(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
4953
4939
|
if (existsSync13(fromNodeModules))
|
|
4954
4940
|
return fromNodeModules;
|
|
4955
|
-
return
|
|
4941
|
+
return resolve17(import.meta.dir, "./dev/client");
|
|
4956
4942
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
4957
4943
|
persistentCache.clear();
|
|
4958
4944
|
sourceHashCache.clear();
|
|
@@ -4982,7 +4968,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4982
4968
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
4983
4969
|
if (!spec.startsWith("."))
|
|
4984
4970
|
return null;
|
|
4985
|
-
const basePath =
|
|
4971
|
+
const basePath = resolve17(dirname8(from), spec);
|
|
4986
4972
|
const candidates = [
|
|
4987
4973
|
basePath,
|
|
4988
4974
|
`${basePath}.ts`,
|
|
@@ -5009,7 +4995,7 @@ var resolveDevClientDir2 = () => {
|
|
|
5009
4995
|
const resolved = resolvePackageImport(spec);
|
|
5010
4996
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
5011
4997
|
}
|
|
5012
|
-
const basePath =
|
|
4998
|
+
const basePath = resolve17(dirname8(from), spec);
|
|
5013
4999
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
5014
5000
|
if (!explicit) {
|
|
5015
5001
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -5036,7 +5022,7 @@ var resolveDevClientDir2 = () => {
|
|
|
5036
5022
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
5037
5023
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
5038
5024
|
});
|
|
5039
|
-
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false) => {
|
|
5025
|
+
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
|
|
5040
5026
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
5041
5027
|
const generatedDir = join12(svelteRoot, "generated");
|
|
5042
5028
|
const clientDir = join12(generatedDir, "client");
|
|
@@ -5064,7 +5050,7 @@ var resolveDevClientDir2 = () => {
|
|
|
5064
5050
|
const loweredServerSource = isModule ? loweredAwaitServerSource : lowerSvelteIslandSyntax(loweredAwaitServerSource.code, "server");
|
|
5065
5051
|
const loweredClientSource = isModule ? loweredAwaitClientSource : lowerSvelteIslandSyntax(loweredAwaitClientSource.code, "client");
|
|
5066
5052
|
const transformedByLowering = loweredAwaitServerSource.transformed || loweredAwaitClientSource.transformed || loweredServerSource.transformed || loweredClientSource.transformed;
|
|
5067
|
-
const svelteStylePreprocessor = createSvelteStylePreprocessor();
|
|
5053
|
+
const svelteStylePreprocessor = createSvelteStylePreprocessor(stylePreprocessors);
|
|
5068
5054
|
const preprocessedServer = isModule ? loweredServerSource.code : (await preprocess(loweredServerSource.code, svelteStylePreprocessor)).code;
|
|
5069
5055
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
5070
5056
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler2.transformSync(preprocessedServer) : preprocessedServer;
|
|
@@ -5289,18 +5275,18 @@ __export(exports_compileVue, {
|
|
|
5289
5275
|
});
|
|
5290
5276
|
import { existsSync as existsSync14 } from "fs";
|
|
5291
5277
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
5292
|
-
import { basename as basename6, dirname as dirname9, join as join13, relative as relative7, resolve as
|
|
5278
|
+
import { basename as basename6, dirname as dirname9, join as join13, relative as relative7, resolve as resolve18 } from "path";
|
|
5293
5279
|
var {file: file3, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
5294
5280
|
var resolveDevClientDir3 = () => {
|
|
5295
5281
|
const projectRoot = process.cwd();
|
|
5296
|
-
const fromSource =
|
|
5282
|
+
const fromSource = resolve18(import.meta.dir, "../dev/client");
|
|
5297
5283
|
if (existsSync14(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
5298
5284
|
return fromSource;
|
|
5299
5285
|
}
|
|
5300
|
-
const fromNodeModules =
|
|
5286
|
+
const fromNodeModules = resolve18(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
5301
5287
|
if (existsSync14(fromNodeModules))
|
|
5302
5288
|
return fromNodeModules;
|
|
5303
|
-
return
|
|
5289
|
+
return resolve18(import.meta.dir, "./dev/client");
|
|
5304
5290
|
}, devClientDir3, hmrClientPath4, transpiler3, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
5305
5291
|
scriptCache.clear();
|
|
5306
5292
|
scriptSetupCache.clear();
|
|
@@ -5362,7 +5348,7 @@ var resolveDevClientDir3 = () => {
|
|
|
5362
5348
|
].join(`
|
|
5363
5349
|
`) : nonVueLines.join(`
|
|
5364
5350
|
`);
|
|
5365
|
-
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler) => {
|
|
5351
|
+
}, compileVueFile = async (sourceFilePath, outputDirs, cacheMap, isEntryPoint, vueRootDir, compiler, stylePreprocessors) => {
|
|
5366
5352
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
5367
5353
|
if (cachedResult)
|
|
5368
5354
|
return cachedResult;
|
|
@@ -5400,8 +5386,8 @@ var resolveDevClientDir3 = () => {
|
|
|
5400
5386
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
5401
5387
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue"));
|
|
5402
5388
|
const childBuildResults = await Promise.all([
|
|
5403
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(
|
|
5404
|
-
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler))
|
|
5389
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve18(dirname9(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
5390
|
+
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
5405
5391
|
]);
|
|
5406
5392
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
5407
5393
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
@@ -5436,7 +5422,7 @@ var resolveDevClientDir3 = () => {
|
|
|
5436
5422
|
filename: sourceFilePath,
|
|
5437
5423
|
id: componentId,
|
|
5438
5424
|
scoped: styleBlock.scoped,
|
|
5439
|
-
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang) : styleBlock.content,
|
|
5425
|
+
source: styleBlock.lang ? await compileStyleSource(sourceFilePath, styleBlock.content, styleBlock.lang, stylePreprocessors) : styleBlock.content,
|
|
5440
5426
|
trim: true
|
|
5441
5427
|
}).code));
|
|
5442
5428
|
const allCss = [
|
|
@@ -5508,14 +5494,14 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5508
5494
|
hmrId,
|
|
5509
5495
|
serverPath: serverOutputPath,
|
|
5510
5496
|
tsHelperPaths: [
|
|
5511
|
-
...helperModulePaths.map((helper) =>
|
|
5497
|
+
...helperModulePaths.map((helper) => resolve18(dirname9(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
5512
5498
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
5513
5499
|
]
|
|
5514
5500
|
};
|
|
5515
5501
|
cacheMap.set(sourceFilePath, result);
|
|
5516
5502
|
persistentBuildCache.set(sourceFilePath, result);
|
|
5517
5503
|
return result;
|
|
5518
|
-
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false) => {
|
|
5504
|
+
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors) => {
|
|
5519
5505
|
const compiler = await import("@vue/compiler-sfc");
|
|
5520
5506
|
const generatedDir = join13(vueRootDir, "generated");
|
|
5521
5507
|
const clientOutputDir = join13(generatedDir, "client");
|
|
@@ -5531,11 +5517,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
5531
5517
|
const buildCache = new Map;
|
|
5532
5518
|
const allTsHelperPaths = new Set;
|
|
5533
5519
|
const compiledPages = await Promise.all(entryPoints.map(async (entryPath) => {
|
|
5534
|
-
const result = await compileVueFile(
|
|
5520
|
+
const result = await compileVueFile(resolve18(entryPath), {
|
|
5535
5521
|
client: clientOutputDir,
|
|
5536
5522
|
css: cssOutputDir,
|
|
5537
5523
|
server: serverOutputDir
|
|
5538
|
-
}, buildCache, true, vueRootDir, compiler);
|
|
5524
|
+
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
5539
5525
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
5540
5526
|
const entryBaseName = basename6(entryPath, ".vue");
|
|
5541
5527
|
const indexOutputFile = join13(indexOutputDir, `${entryBaseName}.js`);
|
|
@@ -6168,27 +6154,27 @@ __export(exports_compileAngular, {
|
|
|
6168
6154
|
compileAngularFile: () => compileAngularFile,
|
|
6169
6155
|
compileAngular: () => compileAngular
|
|
6170
6156
|
});
|
|
6171
|
-
import { existsSync as existsSync15, readFileSync as
|
|
6172
|
-
import { join as join14, basename as basename7, sep as sep3, dirname as dirname10, resolve as
|
|
6157
|
+
import { existsSync as existsSync15, readFileSync as readFileSync9, promises as fs } from "fs";
|
|
6158
|
+
import { join as join14, basename as basename7, sep as sep3, dirname as dirname10, resolve as resolve19, relative as relative8 } from "path";
|
|
6173
6159
|
import ts2 from "typescript";
|
|
6174
6160
|
import { createHash as createHash2 } from "crypto";
|
|
6175
6161
|
var computeConfigHash = () => {
|
|
6176
6162
|
try {
|
|
6177
|
-
const content =
|
|
6163
|
+
const content = readFileSync9("./tsconfig.json", "utf-8");
|
|
6178
6164
|
return createHash2("md5").update(content).digest("hex");
|
|
6179
6165
|
} catch {
|
|
6180
6166
|
return "";
|
|
6181
6167
|
}
|
|
6182
6168
|
}, resolveDevClientDir4 = () => {
|
|
6183
6169
|
const projectRoot = process.cwd();
|
|
6184
|
-
const fromSource =
|
|
6170
|
+
const fromSource = resolve19(import.meta.dir, "../dev/client");
|
|
6185
6171
|
if (existsSync15(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
6186
6172
|
return fromSource;
|
|
6187
6173
|
}
|
|
6188
|
-
const fromNodeModules =
|
|
6174
|
+
const fromNodeModules = resolve19(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
6189
6175
|
if (existsSync15(fromNodeModules))
|
|
6190
6176
|
return fromNodeModules;
|
|
6191
|
-
return
|
|
6177
|
+
return resolve19(import.meta.dir, "./dev/client");
|
|
6192
6178
|
}, devClientDir4, hmrClientPath5, hmrRuntimePath, injectHMRRegistration = (content, sourceId) => {
|
|
6193
6179
|
const componentClassRegex = /(?:export\s+)?class\s+(\w+Component)\s/g;
|
|
6194
6180
|
const componentNames = [];
|
|
@@ -6231,8 +6217,70 @@ ${registrations}
|
|
|
6231
6217
|
if (fileName.startsWith(outDir))
|
|
6232
6218
|
return fileName.substring(outDir.length + 1);
|
|
6233
6219
|
return fileName;
|
|
6234
|
-
},
|
|
6235
|
-
const
|
|
6220
|
+
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
6221
|
+
const sourceFile = ts2.createSourceFile(fileName, source, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TS);
|
|
6222
|
+
const specifiers = [];
|
|
6223
|
+
const addSpecifier = (node) => {
|
|
6224
|
+
if (!node || !ts2.isStringLiteralLike(node))
|
|
6225
|
+
return;
|
|
6226
|
+
const specifier = node.text;
|
|
6227
|
+
if (isRelativeModuleSpecifier(specifier))
|
|
6228
|
+
specifiers.push(specifier);
|
|
6229
|
+
};
|
|
6230
|
+
const visit = (node) => {
|
|
6231
|
+
if (ts2.isImportDeclaration(node) || ts2.isExportDeclaration(node)) {
|
|
6232
|
+
addSpecifier(node.moduleSpecifier);
|
|
6233
|
+
} else if (ts2.isCallExpression(node) && node.expression.kind === ts2.SyntaxKind.ImportKeyword) {
|
|
6234
|
+
addSpecifier(node.arguments[0]);
|
|
6235
|
+
}
|
|
6236
|
+
ts2.forEachChild(node, visit);
|
|
6237
|
+
};
|
|
6238
|
+
visit(sourceFile);
|
|
6239
|
+
return specifiers;
|
|
6240
|
+
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
6241
|
+
if (!isRelativeModuleSpecifier(specifier))
|
|
6242
|
+
return null;
|
|
6243
|
+
const basePath = resolve19(dirname10(fromFile), specifier);
|
|
6244
|
+
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
6245
|
+
`${basePath}.ts`,
|
|
6246
|
+
`${basePath}.tsx`,
|
|
6247
|
+
`${basePath}.mts`,
|
|
6248
|
+
`${basePath}.cts`,
|
|
6249
|
+
join14(basePath, "index.ts"),
|
|
6250
|
+
join14(basePath, "index.tsx"),
|
|
6251
|
+
join14(basePath, "index.mts"),
|
|
6252
|
+
join14(basePath, "index.cts")
|
|
6253
|
+
];
|
|
6254
|
+
return candidates.map((candidate) => resolve19(candidate)).find((candidate) => existsSync15(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
6255
|
+
}, readFileForAotTransform = async (fileName, readFile4) => {
|
|
6256
|
+
const hostSource = readFile4?.(fileName);
|
|
6257
|
+
if (typeof hostSource === "string")
|
|
6258
|
+
return hostSource;
|
|
6259
|
+
return fs.readFile(fileName, "utf-8");
|
|
6260
|
+
}, precomputeAotResourceTransforms = async (inputPath, readFile4, stylePreprocessors) => {
|
|
6261
|
+
const transformedSources = new Map;
|
|
6262
|
+
const visited = new Set;
|
|
6263
|
+
const transformFile = async (filePath) => {
|
|
6264
|
+
const resolvedPath = resolve19(filePath);
|
|
6265
|
+
if (visited.has(resolvedPath))
|
|
6266
|
+
return;
|
|
6267
|
+
visited.add(resolvedPath);
|
|
6268
|
+
if (!existsSync15(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
6269
|
+
return;
|
|
6270
|
+
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
6271
|
+
const transformed = await inlineResources(source, dirname10(resolvedPath), stylePreprocessors);
|
|
6272
|
+
transformedSources.set(resolvedPath, transformed.source);
|
|
6273
|
+
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
6274
|
+
await Promise.all(imports.map(async (specifier) => {
|
|
6275
|
+
const resolvedImport = resolveLocalTsImport(resolvedPath, specifier);
|
|
6276
|
+
if (resolvedImport)
|
|
6277
|
+
await transformFile(resolvedImport);
|
|
6278
|
+
}));
|
|
6279
|
+
};
|
|
6280
|
+
await transformFile(inputPath);
|
|
6281
|
+
return transformedSources;
|
|
6282
|
+
}, compileAngularFile = async (inputPath, outDir, stylePreprocessors) => {
|
|
6283
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync9(inputPath, "utf-8"));
|
|
6236
6284
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
6237
6285
|
const configHash = computeConfigHash();
|
|
6238
6286
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -6247,7 +6295,7 @@ ${registrations}
|
|
|
6247
6295
|
} else {
|
|
6248
6296
|
const tsPath = __require.resolve("typescript");
|
|
6249
6297
|
const tsRootDir = dirname10(tsPath);
|
|
6250
|
-
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir :
|
|
6298
|
+
tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve19(tsRootDir, "lib");
|
|
6251
6299
|
const config = readConfiguration("./tsconfig.json");
|
|
6252
6300
|
options = {
|
|
6253
6301
|
emitDecoratorMetadata: true,
|
|
@@ -6294,13 +6342,13 @@ ${registrations}
|
|
|
6294
6342
|
};
|
|
6295
6343
|
}
|
|
6296
6344
|
const emitted = {};
|
|
6297
|
-
const resolvedOutDir =
|
|
6345
|
+
const resolvedOutDir = resolve19(outDir);
|
|
6298
6346
|
host.writeFile = (fileName, text) => {
|
|
6299
6347
|
const relativePath = resolveRelativePath(fileName, resolvedOutDir, outDir);
|
|
6300
6348
|
emitted[relativePath] = text;
|
|
6301
6349
|
};
|
|
6302
6350
|
const originalReadFile = host.readFile;
|
|
6303
|
-
const
|
|
6351
|
+
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host), stylePreprocessors);
|
|
6304
6352
|
host.readFile = (fileName) => {
|
|
6305
6353
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
6306
6354
|
if (typeof source !== "string")
|
|
@@ -6308,13 +6356,8 @@ ${registrations}
|
|
|
6308
6356
|
if (!fileName.endsWith(".ts") || fileName.endsWith(".d.ts")) {
|
|
6309
6357
|
return source;
|
|
6310
6358
|
}
|
|
6311
|
-
const resolvedPath =
|
|
6312
|
-
|
|
6313
|
-
if (cached2 !== undefined)
|
|
6314
|
-
return cached2;
|
|
6315
|
-
const transformed = inlineResourcesSync(source, dirname10(resolvedPath)).source;
|
|
6316
|
-
aotTransformCache.set(resolvedPath, transformed);
|
|
6317
|
-
return transformed;
|
|
6359
|
+
const resolvedPath = resolve19(fileName);
|
|
6360
|
+
return aotTransformedSources.get(resolvedPath) ?? source;
|
|
6318
6361
|
};
|
|
6319
6362
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
6320
6363
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
@@ -6358,7 +6401,7 @@ ${registrations}
|
|
|
6358
6401
|
await Promise.all(entries.map(({ target, content }) => fs.writeFile(target, content, "utf-8")));
|
|
6359
6402
|
return entries.map(({ target }) => target);
|
|
6360
6403
|
}, jitContentCache, wrapperOutputCache, escapeTemplateContent = (content) => content.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${"), resolveAngularDeferImportSpecifier = () => {
|
|
6361
|
-
const sourceEntry =
|
|
6404
|
+
const sourceEntry = resolve19(import.meta.dir, "../angular/components/index.ts");
|
|
6362
6405
|
if (existsSync15(sourceEntry)) {
|
|
6363
6406
|
return sourceEntry.replace(/\\/g, "/");
|
|
6364
6407
|
}
|
|
@@ -6486,10 +6529,10 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
6486
6529
|
return rewritten.replace(/export(?:\s+default)?\s+class\s+([A-Za-z_$][\w$]*)\s*{/, (match) => `${match}
|
|
6487
6530
|
${fields}
|
|
6488
6531
|
`);
|
|
6489
|
-
}, readAndEscapeFile = async (filePath) => {
|
|
6532
|
+
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
6490
6533
|
if (!existsSync15(filePath))
|
|
6491
6534
|
return null;
|
|
6492
|
-
const content = await compileStyleFileIfNeeded(filePath);
|
|
6535
|
+
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
6493
6536
|
return escapeTemplateContent(content);
|
|
6494
6537
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
6495
6538
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
@@ -6529,7 +6572,7 @@ ${fields}
|
|
|
6529
6572
|
if (!existsSync15(templatePath)) {
|
|
6530
6573
|
return { deferSlots: [], source };
|
|
6531
6574
|
}
|
|
6532
|
-
const templateRaw2 =
|
|
6575
|
+
const templateRaw2 = readFileSync9(templatePath, "utf-8");
|
|
6533
6576
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
6534
6577
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
6535
6578
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -6553,43 +6596,7 @@ ${fields}
|
|
|
6553
6596
|
deferSlots: lowered.slots,
|
|
6554
6597
|
source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
|
|
6555
6598
|
};
|
|
6556
|
-
},
|
|
6557
|
-
if (!existsSync15(filePath))
|
|
6558
|
-
return null;
|
|
6559
|
-
const content = compileStyleFileIfNeededSync(filePath);
|
|
6560
|
-
return escapeTemplateContent(content);
|
|
6561
|
-
}, inlineStyleUrlsSync = (source, fileDir) => {
|
|
6562
|
-
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
6563
|
-
if (!styleUrlsMatch?.[1])
|
|
6564
|
-
return source;
|
|
6565
|
-
const urlMatches = styleUrlsMatch[1].match(/['"]([^'"]+)['"]/g);
|
|
6566
|
-
if (!urlMatches)
|
|
6567
|
-
return source;
|
|
6568
|
-
const inlinedStyles = urlMatches.map((urlMatch) => {
|
|
6569
|
-
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
6570
|
-
return readAndEscapeFileSync(join14(fileDir, styleUrl));
|
|
6571
|
-
}).filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
6572
|
-
if (inlinedStyles.length === 0)
|
|
6573
|
-
return source;
|
|
6574
|
-
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
6575
|
-
}, inlineSingleStyleUrlSync = (source, fileDir) => {
|
|
6576
|
-
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
6577
|
-
if (!styleUrlMatch?.[1])
|
|
6578
|
-
return source;
|
|
6579
|
-
const escaped = readAndEscapeFileSync(join14(fileDir, styleUrlMatch[1]));
|
|
6580
|
-
if (!escaped)
|
|
6581
|
-
return source;
|
|
6582
|
-
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
6583
|
-
}, inlineResourcesSync = (source, fileDir) => {
|
|
6584
|
-
const inlinedTemplate = inlineTemplateAndLowerDeferSync(source, fileDir);
|
|
6585
|
-
let result = inlinedTemplate.source;
|
|
6586
|
-
result = inlineStyleUrlsSync(result, fileDir);
|
|
6587
|
-
result = inlineSingleStyleUrlSync(result, fileDir);
|
|
6588
|
-
return {
|
|
6589
|
-
deferSlots: inlinedTemplate.deferSlots,
|
|
6590
|
-
source: result
|
|
6591
|
-
};
|
|
6592
|
-
}, inlineStyleUrls = async (source, fileDir) => {
|
|
6599
|
+
}, inlineStyleUrls = async (source, fileDir, stylePreprocessors) => {
|
|
6593
6600
|
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
6594
6601
|
if (!styleUrlsMatch?.[1])
|
|
6595
6602
|
return source;
|
|
@@ -6598,35 +6605,35 @@ ${fields}
|
|
|
6598
6605
|
return source;
|
|
6599
6606
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
6600
6607
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
6601
|
-
return readAndEscapeFile(join14(fileDir, styleUrl));
|
|
6608
|
+
return readAndEscapeFile(join14(fileDir, styleUrl), stylePreprocessors);
|
|
6602
6609
|
});
|
|
6603
6610
|
const results = await Promise.all(stylePromises);
|
|
6604
6611
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
6605
6612
|
if (inlinedStyles.length === 0)
|
|
6606
6613
|
return source;
|
|
6607
6614
|
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
6608
|
-
}, inlineSingleStyleUrl = async (source, fileDir) => {
|
|
6615
|
+
}, inlineSingleStyleUrl = async (source, fileDir, stylePreprocessors) => {
|
|
6609
6616
|
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
6610
6617
|
if (!styleUrlMatch?.[1])
|
|
6611
6618
|
return source;
|
|
6612
|
-
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]));
|
|
6619
|
+
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
6613
6620
|
if (!escaped)
|
|
6614
6621
|
return source;
|
|
6615
6622
|
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
6616
|
-
}, inlineResources = async (source, fileDir) => {
|
|
6623
|
+
}, inlineResources = async (source, fileDir, stylePreprocessors) => {
|
|
6617
6624
|
const inlinedTemplate = await inlineTemplateAndLowerDefer(source, fileDir);
|
|
6618
6625
|
let result = inlinedTemplate.source;
|
|
6619
|
-
result = await inlineStyleUrls(result, fileDir);
|
|
6620
|
-
result = await inlineSingleStyleUrl(result, fileDir);
|
|
6626
|
+
result = await inlineStyleUrls(result, fileDir, stylePreprocessors);
|
|
6627
|
+
result = await inlineSingleStyleUrl(result, fileDir, stylePreprocessors);
|
|
6621
6628
|
return {
|
|
6622
6629
|
deferSlots: inlinedTemplate.deferSlots,
|
|
6623
6630
|
source: result
|
|
6624
6631
|
};
|
|
6625
|
-
}, compileAngularFileJIT = async (inputPath, outDir, rootDir) => {
|
|
6626
|
-
const entryPath =
|
|
6632
|
+
}, compileAngularFileJIT = async (inputPath, outDir, rootDir, stylePreprocessors) => {
|
|
6633
|
+
const entryPath = resolve19(inputPath);
|
|
6627
6634
|
const allOutputs = [];
|
|
6628
6635
|
const visited = new Set;
|
|
6629
|
-
const baseDir =
|
|
6636
|
+
const baseDir = resolve19(rootDir ?? process.cwd());
|
|
6630
6637
|
const angularTranspiler = new Bun.Transpiler({
|
|
6631
6638
|
loader: "ts",
|
|
6632
6639
|
tsconfig: JSON.stringify({
|
|
@@ -6663,13 +6670,13 @@ ${fields}
|
|
|
6663
6670
|
return `${prefix}${dots}`;
|
|
6664
6671
|
return `${prefix}../${dots}`;
|
|
6665
6672
|
});
|
|
6666
|
-
if (
|
|
6673
|
+
if (resolve19(actualPath) === entryPath) {
|
|
6667
6674
|
processedContent += buildIslandMetadataExports(sourceCode);
|
|
6668
6675
|
}
|
|
6669
6676
|
return processedContent;
|
|
6670
6677
|
};
|
|
6671
6678
|
const transpileFile = async (filePath) => {
|
|
6672
|
-
const resolved =
|
|
6679
|
+
const resolved = resolve19(filePath);
|
|
6673
6680
|
if (visited.has(resolved))
|
|
6674
6681
|
return;
|
|
6675
6682
|
visited.add(resolved);
|
|
@@ -6679,7 +6686,7 @@ ${fields}
|
|
|
6679
6686
|
if (!existsSync15(actualPath))
|
|
6680
6687
|
return;
|
|
6681
6688
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
6682
|
-
const inlined = await inlineResources(sourceCode, dirname10(actualPath));
|
|
6689
|
+
const inlined = await inlineResources(sourceCode, dirname10(actualPath), stylePreprocessors);
|
|
6683
6690
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname10(actualPath)).source;
|
|
6684
6691
|
const inputDir = dirname10(actualPath);
|
|
6685
6692
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
@@ -6711,13 +6718,13 @@ ${fields}
|
|
|
6711
6718
|
}
|
|
6712
6719
|
const inputDirForResolve = dirname10(actualPath);
|
|
6713
6720
|
await Promise.all(localImports.map((imp) => {
|
|
6714
|
-
const importPath =
|
|
6721
|
+
const importPath = resolve19(inputDirForResolve, imp);
|
|
6715
6722
|
return transpileFile(importPath);
|
|
6716
6723
|
}));
|
|
6717
6724
|
};
|
|
6718
6725
|
await transpileFile(inputPath);
|
|
6719
6726
|
return allOutputs;
|
|
6720
|
-
}, compileAngular = async (entryPoints, outRoot, hmr = false) => {
|
|
6727
|
+
}, compileAngular = async (entryPoints, outRoot, hmr = false, stylePreprocessors) => {
|
|
6721
6728
|
const compiledParent = join14(outRoot, "generated");
|
|
6722
6729
|
if (entryPoints.length === 0) {
|
|
6723
6730
|
const emptyPaths = [];
|
|
@@ -6727,9 +6734,9 @@ ${fields}
|
|
|
6727
6734
|
const indexesDir = join14(compiledParent, "indexes");
|
|
6728
6735
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
6729
6736
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
6730
|
-
const resolvedEntry =
|
|
6737
|
+
const resolvedEntry = resolve19(entry);
|
|
6731
6738
|
const relativeEntry = relative8(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
6732
|
-
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot) : compileAngularFile(resolvedEntry, compiledRoot);
|
|
6739
|
+
const compileEntry = () => hmr ? compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors) : compileAngularFile(resolvedEntry, compiledRoot, stylePreprocessors);
|
|
6733
6740
|
let outputs = await compileEntry();
|
|
6734
6741
|
const fileBase = basename7(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
6735
6742
|
const jsName = `${fileBase}.js`;
|
|
@@ -6737,10 +6744,10 @@ ${fields}
|
|
|
6737
6744
|
join14(compiledRoot, relativeEntry),
|
|
6738
6745
|
join14(compiledRoot, "pages", jsName),
|
|
6739
6746
|
join14(compiledRoot, jsName)
|
|
6740
|
-
].map((file4) =>
|
|
6747
|
+
].map((file4) => resolve19(file4));
|
|
6741
6748
|
const resolveRawServerFile = (candidatePaths) => {
|
|
6742
6749
|
const normalizedCandidates = [
|
|
6743
|
-
...candidatePaths.map((file4) =>
|
|
6750
|
+
...candidatePaths.map((file4) => resolve19(file4)),
|
|
6744
6751
|
...compiledFallbackPaths
|
|
6745
6752
|
];
|
|
6746
6753
|
let candidate = normalizedCandidates.find((file4) => existsSync15(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
@@ -6971,24 +6978,24 @@ __export(exports_buildReactVendor, {
|
|
|
6971
6978
|
buildReactVendor: () => buildReactVendor
|
|
6972
6979
|
});
|
|
6973
6980
|
import { existsSync as existsSync16, mkdirSync as mkdirSync6 } from "fs";
|
|
6974
|
-
import { join as join15, resolve as
|
|
6981
|
+
import { join as join15, resolve as resolve20 } from "path";
|
|
6975
6982
|
import { rm as rm4 } from "fs/promises";
|
|
6976
6983
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
6977
6984
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
6978
6985
|
const candidates = [
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6986
|
+
resolve20(import.meta.dir, "react", "jsxDevRuntimeCompat.js"),
|
|
6987
|
+
resolve20(import.meta.dir, "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
6988
|
+
resolve20(import.meta.dir, "..", "react", "jsxDevRuntimeCompat.js"),
|
|
6989
|
+
resolve20(import.meta.dir, "..", "src", "react", "jsxDevRuntimeCompat.ts"),
|
|
6990
|
+
resolve20(import.meta.dir, "..", "..", "dist", "react", "jsxDevRuntimeCompat.js"),
|
|
6991
|
+
resolve20(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
6985
6992
|
];
|
|
6986
6993
|
for (const candidate of candidates) {
|
|
6987
6994
|
if (existsSync16(candidate)) {
|
|
6988
6995
|
return candidate.replace(/\\/g, "/");
|
|
6989
6996
|
}
|
|
6990
6997
|
}
|
|
6991
|
-
return (candidates[0] ??
|
|
6998
|
+
return (candidates[0] ?? resolve20(import.meta.dir, "react", "jsxDevRuntimeCompat.js")).replace(/\\/g, "/");
|
|
6992
6999
|
}, jsxDevRuntimeCompatPath, reactSpecifiers, isResolvable = (specifier) => {
|
|
6993
7000
|
try {
|
|
6994
7001
|
Bun.resolveSync(specifier, process.cwd());
|
|
@@ -7160,11 +7167,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
7160
7167
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
7161
7168
|
return;
|
|
7162
7169
|
}
|
|
7163
|
-
const { readFileSync:
|
|
7170
|
+
const { readFileSync: readFileSync10, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
7164
7171
|
const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
7165
7172
|
for (const file4 of files) {
|
|
7166
7173
|
const filePath = join17(vendorDir, file4);
|
|
7167
|
-
const content =
|
|
7174
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
7168
7175
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
7169
7176
|
continue;
|
|
7170
7177
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -7289,12 +7296,12 @@ import {
|
|
|
7289
7296
|
cpSync,
|
|
7290
7297
|
existsSync as existsSync17,
|
|
7291
7298
|
mkdirSync as mkdirSync10,
|
|
7292
|
-
readFileSync as
|
|
7299
|
+
readFileSync as readFileSync10,
|
|
7293
7300
|
rmSync as rmSync2,
|
|
7294
7301
|
statSync,
|
|
7295
7302
|
writeFileSync as writeFileSync7
|
|
7296
7303
|
} from "fs";
|
|
7297
|
-
import { basename as basename8, dirname as dirname11, join as join19, relative as relative9, resolve as
|
|
7304
|
+
import { basename as basename8, dirname as dirname11, join as join19, relative as relative9, resolve as resolve21 } from "path";
|
|
7298
7305
|
import { cwd, env as env3, exit } from "process";
|
|
7299
7306
|
var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
|
|
7300
7307
|
var isDev2, collectConventionSourceFiles = (entry) => {
|
|
@@ -7382,8 +7389,8 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7382
7389
|
}
|
|
7383
7390
|
}, resolveAbsoluteVersion = async () => {
|
|
7384
7391
|
const candidates = [
|
|
7385
|
-
|
|
7386
|
-
|
|
7392
|
+
resolve21(import.meta.dir, "..", "..", "package.json"),
|
|
7393
|
+
resolve21(import.meta.dir, "..", "package.json")
|
|
7387
7394
|
];
|
|
7388
7395
|
for (const candidate of candidates) {
|
|
7389
7396
|
const pkg = await tryReadPackageJson(candidate);
|
|
@@ -7395,7 +7402,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7395
7402
|
return;
|
|
7396
7403
|
}
|
|
7397
7404
|
}, SKIP_DIRS, addWorkerPathIfExists = (file4, relPath, workerPaths) => {
|
|
7398
|
-
const absPath =
|
|
7405
|
+
const absPath = resolve21(file4, "..", relPath);
|
|
7399
7406
|
try {
|
|
7400
7407
|
statSync(absPath);
|
|
7401
7408
|
workerPaths.add(absPath);
|
|
@@ -7410,7 +7417,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7410
7417
|
addWorkerPathIfExists(file4, relPath, workerPaths);
|
|
7411
7418
|
}
|
|
7412
7419
|
}, collectWorkerPathsFromFile = (file4, patterns, workerPaths) => {
|
|
7413
|
-
const content =
|
|
7420
|
+
const content = readFileSync10(file4, "utf-8");
|
|
7414
7421
|
for (const pattern of patterns) {
|
|
7415
7422
|
collectWorkerPathsFromContent(content, pattern, file4, workerPaths);
|
|
7416
7423
|
}
|
|
@@ -7459,35 +7466,35 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7459
7466
|
return;
|
|
7460
7467
|
}
|
|
7461
7468
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
7462
|
-
const pagesRel = relative9(process.cwd(),
|
|
7469
|
+
const pagesRel = relative9(process.cwd(), resolve21(reactPagesPath)).replace(/\\/g, "/");
|
|
7463
7470
|
for (const file4 of indexFiles) {
|
|
7464
|
-
let content =
|
|
7471
|
+
let content = readFileSync10(join19(reactIndexesPath, file4), "utf-8");
|
|
7465
7472
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
7466
7473
|
writeFileSync7(join19(devIndexDir, file4), content);
|
|
7467
7474
|
}
|
|
7468
7475
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
7469
7476
|
const svelteIndexDir = join19(svelteDir, "generated", "indexes");
|
|
7470
|
-
const sveltePageEntries = svelteEntries.filter((file4) =>
|
|
7477
|
+
const sveltePageEntries = svelteEntries.filter((file4) => resolve21(file4).startsWith(resolve21(sveltePagesPath)));
|
|
7471
7478
|
for (const entry of sveltePageEntries) {
|
|
7472
7479
|
const name = basename8(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
7473
7480
|
const indexFile = join19(svelteIndexDir, "pages", `${name}.js`);
|
|
7474
7481
|
if (!existsSync17(indexFile))
|
|
7475
7482
|
continue;
|
|
7476
|
-
let content =
|
|
7477
|
-
const srcRel = relative9(process.cwd(),
|
|
7483
|
+
let content = readFileSync10(indexFile, "utf-8");
|
|
7484
|
+
const srcRel = relative9(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
7478
7485
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
7479
7486
|
writeFileSync7(join19(devIndexDir, `${name}.svelte.js`), content);
|
|
7480
7487
|
}
|
|
7481
7488
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
7482
7489
|
const vueIndexDir = join19(vueDir, "generated", "indexes");
|
|
7483
|
-
const vuePageEntries = vueEntries.filter((file4) =>
|
|
7490
|
+
const vuePageEntries = vueEntries.filter((file4) => resolve21(file4).startsWith(resolve21(vuePagesPath)));
|
|
7484
7491
|
for (const entry of vuePageEntries) {
|
|
7485
7492
|
const name = basename8(entry, ".vue");
|
|
7486
7493
|
const indexFile = join19(vueIndexDir, `${name}.js`);
|
|
7487
7494
|
if (!existsSync17(indexFile))
|
|
7488
7495
|
continue;
|
|
7489
|
-
let content =
|
|
7490
|
-
const srcRel = relative9(process.cwd(),
|
|
7496
|
+
let content = readFileSync10(indexFile, "utf-8");
|
|
7497
|
+
const srcRel = relative9(process.cwd(), resolve21(entry)).replace(/\\/g, "/");
|
|
7491
7498
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
7492
7499
|
writeFileSync7(join19(devIndexDir, `${name}.vue.js`), content);
|
|
7493
7500
|
}
|
|
@@ -7500,7 +7507,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7500
7507
|
const last = allComments[allComments.length - 1];
|
|
7501
7508
|
if (!last?.[1])
|
|
7502
7509
|
return JSON.stringify(outputPath);
|
|
7503
|
-
const srcPath =
|
|
7510
|
+
const srcPath = resolve21(projectRoot, last[1].replace("/client/", "/").replace(/\.js$/, ".ts"));
|
|
7504
7511
|
return JSON.stringify(srcPath);
|
|
7505
7512
|
}, QUOTE_CHARS, OPEN_BRACES, CLOSE_BRACES, findFunctionExpressionEnd = (content, startPos) => {
|
|
7506
7513
|
let depth = 0;
|
|
@@ -7537,7 +7544,7 @@ var isDev2, collectConventionSourceFiles = (entry) => {
|
|
|
7537
7544
|
}
|
|
7538
7545
|
return result;
|
|
7539
7546
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
7540
|
-
let content =
|
|
7547
|
+
let content = readFileSync10(outputPath, "utf-8");
|
|
7541
7548
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
7542
7549
|
const useNames = [];
|
|
7543
7550
|
let match;
|
|
@@ -7587,7 +7594,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7587
7594
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
7588
7595
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
7589
7596
|
for (const outputPath of outputPaths) {
|
|
7590
|
-
let content =
|
|
7597
|
+
let content = readFileSync10(outputPath, "utf-8");
|
|
7591
7598
|
let changed = false;
|
|
7592
7599
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
7593
7600
|
const targetName = basename8(relPath);
|
|
@@ -7612,6 +7619,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7612
7619
|
svelteDirectory,
|
|
7613
7620
|
vueDirectory,
|
|
7614
7621
|
stylesConfig,
|
|
7622
|
+
stylePreprocessors,
|
|
7615
7623
|
tailwind,
|
|
7616
7624
|
options,
|
|
7617
7625
|
incrementalFiles,
|
|
@@ -7621,6 +7629,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7621
7629
|
const projectRoot = cwd();
|
|
7622
7630
|
await resolveAbsoluteVersion();
|
|
7623
7631
|
const isIncremental = incrementalFiles && incrementalFiles.length > 0;
|
|
7632
|
+
const stylePreprocessorPlugin2 = createStylePreprocessorPlugin(stylePreprocessors);
|
|
7624
7633
|
const normalizedIncrementalFiles = incrementalFiles?.map(normalizePath);
|
|
7625
7634
|
const throwOnError = options?.throwOnError === true;
|
|
7626
7635
|
const hmr = options?.injectHMR === true;
|
|
@@ -7709,13 +7718,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7709
7718
|
const filterToIncrementalEntries = (entryPoints, mapToSource) => {
|
|
7710
7719
|
if (!isIncremental || !incrementalFiles)
|
|
7711
7720
|
return entryPoints;
|
|
7712
|
-
const normalizedIncremental = new Set(incrementalFiles.map((f) =>
|
|
7721
|
+
const normalizedIncremental = new Set(incrementalFiles.map((f) => resolve21(f)));
|
|
7713
7722
|
const matchingEntries = [];
|
|
7714
7723
|
for (const entry of entryPoints) {
|
|
7715
7724
|
const sourceFile = mapToSource(entry);
|
|
7716
7725
|
if (!sourceFile)
|
|
7717
7726
|
continue;
|
|
7718
|
-
if (!normalizedIncremental.has(
|
|
7727
|
+
if (!normalizedIncremental.has(resolve21(sourceFile)))
|
|
7719
7728
|
continue;
|
|
7720
7729
|
matchingEntries.push(entry);
|
|
7721
7730
|
}
|
|
@@ -7784,7 +7793,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7784
7793
|
}
|
|
7785
7794
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || isStylePath(f)));
|
|
7786
7795
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
7787
|
-
if (entry.startsWith(
|
|
7796
|
+
if (entry.startsWith(resolve21(reactIndexesPath))) {
|
|
7788
7797
|
const pageName = basename8(entry, ".tsx");
|
|
7789
7798
|
return join19(reactPagesPath, `${pageName}.tsx`);
|
|
7790
7799
|
}
|
|
@@ -7816,28 +7825,28 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7816
7825
|
{ vueClientPaths: islandVueClientPaths },
|
|
7817
7826
|
{ clientPaths: islandAngularClientPaths }
|
|
7818
7827
|
] = await Promise.all([
|
|
7819
|
-
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr)) : {
|
|
7828
|
+
shouldCompileSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteEntries, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
7820
7829
|
svelteClientPaths: [...emptyStringArray],
|
|
7821
7830
|
svelteIndexPaths: [...emptyStringArray],
|
|
7822
7831
|
svelteServerPaths: [...emptyStringArray]
|
|
7823
7832
|
},
|
|
7824
|
-
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr)) : {
|
|
7833
|
+
shouldCompileVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueEntries, vueDir, hmr, stylePreprocessors)) : {
|
|
7825
7834
|
vueClientPaths: [...emptyStringArray],
|
|
7826
7835
|
vueCssPaths: [...emptyStringArray],
|
|
7827
7836
|
vueIndexPaths: [...emptyStringArray],
|
|
7828
7837
|
vueServerPaths: [...emptyStringArray]
|
|
7829
7838
|
},
|
|
7830
|
-
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr)) : {
|
|
7839
|
+
shouldCompileAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularEntries, angularDir, hmr, stylePreprocessors)) : {
|
|
7831
7840
|
clientPaths: [...emptyStringArray],
|
|
7832
7841
|
serverPaths: [...emptyStringArray]
|
|
7833
7842
|
},
|
|
7834
|
-
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr)) : {
|
|
7843
|
+
shouldCompileIslandSvelte ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(islandSvelteSources, svelteDir, new Map, hmr, stylePreprocessors)) : {
|
|
7835
7844
|
svelteClientPaths: [...emptyStringArray]
|
|
7836
7845
|
},
|
|
7837
|
-
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr)) : {
|
|
7846
|
+
shouldCompileIslandVue ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(islandVueSources, vueDir, hmr, stylePreprocessors)) : {
|
|
7838
7847
|
vueClientPaths: [...emptyStringArray]
|
|
7839
7848
|
},
|
|
7840
|
-
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr)) : {
|
|
7849
|
+
shouldCompileIslandAngular ? Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(islandAngularSources, angularDir, hmr, stylePreprocessors)) : {
|
|
7841
7850
|
clientPaths: [...emptyStringArray]
|
|
7842
7851
|
}
|
|
7843
7852
|
]);
|
|
@@ -7847,7 +7856,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7847
7856
|
const clientPath = islandSvelteClientPaths[idx];
|
|
7848
7857
|
if (!sourcePath || !clientPath)
|
|
7849
7858
|
continue;
|
|
7850
|
-
islandSvelteClientPathMap.set(
|
|
7859
|
+
islandSvelteClientPathMap.set(resolve21(sourcePath), clientPath);
|
|
7851
7860
|
}
|
|
7852
7861
|
const islandVueClientPathMap = new Map;
|
|
7853
7862
|
for (let idx = 0;idx < islandVueSources.length; idx++) {
|
|
@@ -7855,7 +7864,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7855
7864
|
const clientPath = islandVueClientPaths[idx];
|
|
7856
7865
|
if (!sourcePath || !clientPath)
|
|
7857
7866
|
continue;
|
|
7858
|
-
islandVueClientPathMap.set(
|
|
7867
|
+
islandVueClientPathMap.set(resolve21(sourcePath), clientPath);
|
|
7859
7868
|
}
|
|
7860
7869
|
const islandAngularClientPathMap = new Map;
|
|
7861
7870
|
for (let idx = 0;idx < islandAngularSources.length; idx++) {
|
|
@@ -7863,14 +7872,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7863
7872
|
const clientPath = islandAngularClientPaths[idx];
|
|
7864
7873
|
if (!sourcePath || !clientPath)
|
|
7865
7874
|
continue;
|
|
7866
|
-
islandAngularClientPathMap.set(
|
|
7875
|
+
islandAngularClientPathMap.set(resolve21(sourcePath), clientPath);
|
|
7867
7876
|
}
|
|
7868
7877
|
const svelteConventionSources = collectConventionSourceFiles(conventionsMap.svelte);
|
|
7869
7878
|
const vueConventionSources = collectConventionSourceFiles(conventionsMap.vue);
|
|
7870
7879
|
if (svelteConventionSources.length > 0 || vueConventionSources.length > 0) {
|
|
7871
7880
|
const [svelteConvResult, vueConvResult] = await Promise.all([
|
|
7872
|
-
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false)) : { svelteServerPaths: emptyStringArray },
|
|
7873
|
-
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false)) : { vueServerPaths: emptyStringArray }
|
|
7881
|
+
svelteConventionSources.length > 0 && svelteDir ? Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte)).then((mod) => mod.compileSvelte(svelteConventionSources, svelteDir, new Map, false, stylePreprocessors)) : { svelteServerPaths: emptyStringArray },
|
|
7882
|
+
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false, stylePreprocessors)) : { vueServerPaths: emptyStringArray }
|
|
7874
7883
|
]);
|
|
7875
7884
|
const copyConventionFiles = (framework, sources, compiledPaths) => {
|
|
7876
7885
|
const destDir = join19(buildPath, "conventions", framework);
|
|
@@ -8006,7 +8015,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8006
8015
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8007
8016
|
outdir: buildPath,
|
|
8008
8017
|
...hmr ? { jsx: { development: true }, reactFastRefresh: true } : {},
|
|
8009
|
-
plugins: [
|
|
8018
|
+
plugins: [stylePreprocessorPlugin2],
|
|
8010
8019
|
root: clientRoot,
|
|
8011
8020
|
splitting: true,
|
|
8012
8021
|
target: "browser",
|
|
@@ -8064,7 +8073,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8064
8073
|
format: "esm",
|
|
8065
8074
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8066
8075
|
outdir: serverOutDir,
|
|
8067
|
-
plugins: [
|
|
8076
|
+
plugins: [stylePreprocessorPlugin2],
|
|
8068
8077
|
root: serverRoot,
|
|
8069
8078
|
target: "bun",
|
|
8070
8079
|
throw: false,
|
|
@@ -8080,7 +8089,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8080
8089
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8081
8090
|
outdir: buildPath,
|
|
8082
8091
|
plugins: [
|
|
8083
|
-
|
|
8092
|
+
stylePreprocessorPlugin2,
|
|
8084
8093
|
...angularDir && !isDev2 ? [angularLinkerPlugin] : [],
|
|
8085
8094
|
...htmlScriptPlugin ? [htmlScriptPlugin] : []
|
|
8086
8095
|
],
|
|
@@ -8099,7 +8108,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8099
8108
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
8100
8109
|
outdir: buildPath,
|
|
8101
8110
|
plugins: [
|
|
8102
|
-
|
|
8111
|
+
stylePreprocessorPlugin2,
|
|
8103
8112
|
...angularDir && !isDev2 ? [angularLinkerPlugin] : []
|
|
8104
8113
|
],
|
|
8105
8114
|
root: islandEntryResult.generatedRoot,
|
|
@@ -8114,7 +8123,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8114
8123
|
outdir: stylesDir ? join19(buildPath, basename8(stylesDir)) : buildPath,
|
|
8115
8124
|
root: stylesDir || clientRoot,
|
|
8116
8125
|
target: "browser",
|
|
8117
|
-
plugins: [
|
|
8126
|
+
plugins: [stylePreprocessorPlugin2],
|
|
8118
8127
|
throw: false
|
|
8119
8128
|
}) : undefined,
|
|
8120
8129
|
vueCssPaths.length > 0 ? bunBuild6({
|
|
@@ -8242,7 +8251,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
8242
8251
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
8243
8252
|
if (!hmrClientBundle)
|
|
8244
8253
|
return;
|
|
8245
|
-
let html =
|
|
8254
|
+
let html = readFileSync10(filePath, "utf-8");
|
|
8246
8255
|
if (html.includes("data-hmr-client"))
|
|
8247
8256
|
return;
|
|
8248
8257
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -8403,9 +8412,9 @@ var init_build = __esm(() => {
|
|
|
8403
8412
|
});
|
|
8404
8413
|
|
|
8405
8414
|
// src/dev/dependencyGraph.ts
|
|
8406
|
-
import { existsSync as existsSync18, readFileSync as
|
|
8415
|
+
import { existsSync as existsSync18, readFileSync as readFileSync11 } from "fs";
|
|
8407
8416
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
8408
|
-
import { resolve as
|
|
8417
|
+
import { resolve as resolve22 } from "path";
|
|
8409
8418
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
8410
8419
|
const lower = filePath.toLowerCase();
|
|
8411
8420
|
if (lower.endsWith(".ts") || lower.endsWith(".tsx") || lower.endsWith(".jsx"))
|
|
@@ -8419,8 +8428,8 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8419
8428
|
if (!importPath.startsWith(".") && !importPath.startsWith("/")) {
|
|
8420
8429
|
return null;
|
|
8421
8430
|
}
|
|
8422
|
-
const fromDir =
|
|
8423
|
-
const normalized =
|
|
8431
|
+
const fromDir = resolve22(fromFile, "..");
|
|
8432
|
+
const normalized = resolve22(fromDir, importPath);
|
|
8424
8433
|
const extensions = [
|
|
8425
8434
|
".ts",
|
|
8426
8435
|
".tsx",
|
|
@@ -8450,7 +8459,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8450
8459
|
dependents.delete(normalizedPath);
|
|
8451
8460
|
}
|
|
8452
8461
|
}, addFileToGraph = (graph, filePath) => {
|
|
8453
|
-
const normalizedPath =
|
|
8462
|
+
const normalizedPath = resolve22(filePath);
|
|
8454
8463
|
if (!existsSync18(normalizedPath))
|
|
8455
8464
|
return;
|
|
8456
8465
|
const dependencies = extractDependencies(normalizedPath);
|
|
@@ -8467,10 +8476,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8467
8476
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
8468
8477
|
const processedFiles = new Set;
|
|
8469
8478
|
const glob = new Glob7("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
8470
|
-
const resolvedDirs = directories.map((dir) =>
|
|
8479
|
+
const resolvedDirs = directories.map((dir) => resolve22(dir)).filter((dir) => existsSync18(dir));
|
|
8471
8480
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
8472
8481
|
for (const file4 of allFiles) {
|
|
8473
|
-
const fullPath =
|
|
8482
|
+
const fullPath = resolve22(file4);
|
|
8474
8483
|
if (IGNORED_SEGMENTS.some((seg) => fullPath.includes(seg)))
|
|
8475
8484
|
continue;
|
|
8476
8485
|
if (processedFiles.has(fullPath))
|
|
@@ -8564,15 +8573,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8564
8573
|
const lowerPath = filePath.toLowerCase();
|
|
8565
8574
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
8566
8575
|
if (loader === "html") {
|
|
8567
|
-
const content =
|
|
8576
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
8568
8577
|
return extractHtmlDependencies(filePath, content);
|
|
8569
8578
|
}
|
|
8570
8579
|
if (loader === "tsx" || loader === "js") {
|
|
8571
|
-
const content =
|
|
8580
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
8572
8581
|
return extractJsDependencies(filePath, content, loader);
|
|
8573
8582
|
}
|
|
8574
8583
|
if (isSvelteOrVue) {
|
|
8575
|
-
const content =
|
|
8584
|
+
const content = readFileSync11(filePath, "utf-8");
|
|
8576
8585
|
return extractSvelteVueDependencies(filePath, content);
|
|
8577
8586
|
}
|
|
8578
8587
|
return [];
|
|
@@ -8583,7 +8592,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8583
8592
|
return [];
|
|
8584
8593
|
}
|
|
8585
8594
|
}, getAffectedFiles = (graph, changedFile) => {
|
|
8586
|
-
const normalizedPath =
|
|
8595
|
+
const normalizedPath = resolve22(changedFile);
|
|
8587
8596
|
const affected = new Set;
|
|
8588
8597
|
const toProcess = [normalizedPath];
|
|
8589
8598
|
const processNode = (current) => {
|
|
@@ -8623,7 +8632,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
8623
8632
|
}
|
|
8624
8633
|
graph.dependents.delete(normalizedPath);
|
|
8625
8634
|
}, removeFileFromGraph = (graph, filePath) => {
|
|
8626
|
-
const normalizedPath =
|
|
8635
|
+
const normalizedPath = resolve22(filePath);
|
|
8627
8636
|
removeDepsForFile(graph, normalizedPath);
|
|
8628
8637
|
removeDependentsForFile(graph, normalizedPath);
|
|
8629
8638
|
};
|
|
@@ -8666,12 +8675,12 @@ var globalVersionCounter = 0, createModuleVersionTracker = () => new Map, getNex
|
|
|
8666
8675
|
};
|
|
8667
8676
|
|
|
8668
8677
|
// src/dev/configResolver.ts
|
|
8669
|
-
import { resolve as
|
|
8678
|
+
import { resolve as resolve23 } from "path";
|
|
8670
8679
|
var resolveBuildPaths = (config) => {
|
|
8671
8680
|
const cwd2 = process.cwd();
|
|
8672
8681
|
const normalize = (path) => path.replace(/\\/g, "/");
|
|
8673
|
-
const withDefault = (value, fallback) => normalize(
|
|
8674
|
-
const optional = (value) => value ? normalize(
|
|
8682
|
+
const withDefault = (value, fallback) => normalize(resolve23(cwd2, value ?? fallback));
|
|
8683
|
+
const optional = (value) => value ? normalize(resolve23(cwd2, value)) : undefined;
|
|
8675
8684
|
return {
|
|
8676
8685
|
angularDir: optional(config.angularDirectory),
|
|
8677
8686
|
assetsDir: optional(config.assetsDirectory),
|
|
@@ -8861,7 +8870,7 @@ var init_pathUtils = __esm(() => {
|
|
|
8861
8870
|
// src/dev/fileWatcher.ts
|
|
8862
8871
|
import { watch } from "fs";
|
|
8863
8872
|
import { existsSync as existsSync19 } from "fs";
|
|
8864
|
-
import { join as join20, resolve as
|
|
8873
|
+
import { join as join20, resolve as resolve24 } from "path";
|
|
8865
8874
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
8866
8875
|
try {
|
|
8867
8876
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -8906,7 +8915,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8906
8915
|
}, addFileWatchers = (state, paths, onFileChange) => {
|
|
8907
8916
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8908
8917
|
paths.forEach((path) => {
|
|
8909
|
-
const absolutePath =
|
|
8918
|
+
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
8910
8919
|
if (!existsSync19(absolutePath)) {
|
|
8911
8920
|
return;
|
|
8912
8921
|
}
|
|
@@ -8917,7 +8926,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8917
8926
|
const watchPaths = getWatchPaths(config, state.resolvedPaths);
|
|
8918
8927
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
8919
8928
|
watchPaths.forEach((path) => {
|
|
8920
|
-
const absolutePath =
|
|
8929
|
+
const absolutePath = resolve24(path).replace(/\\/g, "/");
|
|
8921
8930
|
if (!existsSync19(absolutePath)) {
|
|
8922
8931
|
return;
|
|
8923
8932
|
}
|
|
@@ -8932,13 +8941,13 @@ var init_fileWatcher = __esm(() => {
|
|
|
8932
8941
|
});
|
|
8933
8942
|
|
|
8934
8943
|
// src/dev/assetStore.ts
|
|
8935
|
-
import { resolve as
|
|
8944
|
+
import { resolve as resolve25 } from "path";
|
|
8936
8945
|
import { readdir as readdir3, unlink } from "fs/promises";
|
|
8937
8946
|
var mimeTypes, getMimeType = (filePath) => {
|
|
8938
8947
|
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
8939
8948
|
return mimeTypes[ext] ?? "application/octet-stream";
|
|
8940
8949
|
}, HASHED_FILE_RE, stripHash = (webPath) => webPath.replace(/\.[a-z0-9]{8}(\.(js|css|mjs))$/, "$1"), processWalkEntry = (entry, dir, liveByIdentity, walkAndClean) => {
|
|
8941
|
-
const fullPath =
|
|
8950
|
+
const fullPath = resolve25(dir, entry.name);
|
|
8942
8951
|
if (entry.isDirectory()) {
|
|
8943
8952
|
return walkAndClean(fullPath);
|
|
8944
8953
|
}
|
|
@@ -8954,10 +8963,10 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8954
8963
|
}, cleanStaleAssets = async (store, manifest, buildDir) => {
|
|
8955
8964
|
const liveByIdentity = new Map;
|
|
8956
8965
|
for (const webPath of store.keys()) {
|
|
8957
|
-
const diskPath =
|
|
8966
|
+
const diskPath = resolve25(buildDir, webPath.slice(1));
|
|
8958
8967
|
liveByIdentity.set(stripHash(diskPath), diskPath);
|
|
8959
8968
|
}
|
|
8960
|
-
const absBuildDir =
|
|
8969
|
+
const absBuildDir = resolve25(buildDir);
|
|
8961
8970
|
Object.values(manifest).forEach((val) => {
|
|
8962
8971
|
if (!HASHED_FILE_RE.test(val))
|
|
8963
8972
|
return;
|
|
@@ -8975,7 +8984,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8975
8984
|
} catch {}
|
|
8976
8985
|
}, lookupAsset = (store, path) => store.get(path), processScanEntry = (entry, dir, prefix, store, scanDir) => {
|
|
8977
8986
|
if (entry.isDirectory()) {
|
|
8978
|
-
return scanDir(
|
|
8987
|
+
return scanDir(resolve25(dir, entry.name), `${prefix}${entry.name}/`);
|
|
8979
8988
|
}
|
|
8980
8989
|
if (!entry.name.startsWith("chunk-")) {
|
|
8981
8990
|
return null;
|
|
@@ -8984,7 +8993,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
8984
8993
|
if (store.has(webPath)) {
|
|
8985
8994
|
return null;
|
|
8986
8995
|
}
|
|
8987
|
-
return Bun.file(
|
|
8996
|
+
return Bun.file(resolve25(dir, entry.name)).bytes().then((bytes) => {
|
|
8988
8997
|
store.set(webPath, bytes);
|
|
8989
8998
|
return;
|
|
8990
8999
|
}).catch(() => {});
|
|
@@ -9009,7 +9018,7 @@ var mimeTypes, getMimeType = (filePath) => {
|
|
|
9009
9018
|
for (const webPath of newIdentities.values()) {
|
|
9010
9019
|
if (store.has(webPath))
|
|
9011
9020
|
continue;
|
|
9012
|
-
loadPromises.push(Bun.file(
|
|
9021
|
+
loadPromises.push(Bun.file(resolve25(buildDir, webPath.slice(1))).bytes().then((bytes) => {
|
|
9013
9022
|
store.set(webPath, bytes);
|
|
9014
9023
|
return;
|
|
9015
9024
|
}).catch(() => {}));
|
|
@@ -9039,10 +9048,10 @@ var init_assetStore = __esm(() => {
|
|
|
9039
9048
|
});
|
|
9040
9049
|
|
|
9041
9050
|
// src/dev/fileHashTracker.ts
|
|
9042
|
-
import { readFileSync as
|
|
9051
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
9043
9052
|
var computeFileHash = (filePath) => {
|
|
9044
9053
|
try {
|
|
9045
|
-
const fileContent =
|
|
9054
|
+
const fileContent = readFileSync12(filePath);
|
|
9046
9055
|
return Number(Bun.hash(fileContent));
|
|
9047
9056
|
} catch {
|
|
9048
9057
|
return UNFOUND_INDEX;
|
|
@@ -9060,9 +9069,9 @@ var init_fileHashTracker = __esm(() => {
|
|
|
9060
9069
|
});
|
|
9061
9070
|
|
|
9062
9071
|
// src/dev/reactComponentClassifier.ts
|
|
9063
|
-
import { resolve as
|
|
9072
|
+
import { resolve as resolve26 } from "path";
|
|
9064
9073
|
var classifyComponent = (filePath) => {
|
|
9065
|
-
const normalizedPath =
|
|
9074
|
+
const normalizedPath = resolve26(filePath);
|
|
9066
9075
|
if (normalizedPath.includes("/react/pages/")) {
|
|
9067
9076
|
return "server";
|
|
9068
9077
|
}
|
|
@@ -9074,7 +9083,7 @@ var classifyComponent = (filePath) => {
|
|
|
9074
9083
|
var init_reactComponentClassifier = () => {};
|
|
9075
9084
|
|
|
9076
9085
|
// src/dev/moduleMapper.ts
|
|
9077
|
-
import { basename as basename9, resolve as
|
|
9086
|
+
import { basename as basename9, resolve as resolve27 } from "path";
|
|
9078
9087
|
var buildModulePaths = (moduleKeys, manifest) => {
|
|
9079
9088
|
const modulePaths = {};
|
|
9080
9089
|
moduleKeys.forEach((key) => {
|
|
@@ -9084,7 +9093,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
9084
9093
|
});
|
|
9085
9094
|
return modulePaths;
|
|
9086
9095
|
}, processChangedFile = (sourceFile, framework, manifest, resolvedPaths, processedFiles) => {
|
|
9087
|
-
const normalizedFile =
|
|
9096
|
+
const normalizedFile = resolve27(sourceFile);
|
|
9088
9097
|
const normalizedPath = normalizedFile.replace(/\\/g, "/");
|
|
9089
9098
|
if (processedFiles.has(normalizedFile)) {
|
|
9090
9099
|
return null;
|
|
@@ -9120,7 +9129,7 @@ var buildModulePaths = (moduleKeys, manifest) => {
|
|
|
9120
9129
|
});
|
|
9121
9130
|
return grouped;
|
|
9122
9131
|
}, mapSourceFileToManifestKeys = (sourceFile, framework, resolvedPaths) => {
|
|
9123
|
-
const normalizedFile =
|
|
9132
|
+
const normalizedFile = resolve27(sourceFile);
|
|
9124
9133
|
const fileName = basename9(normalizedFile);
|
|
9125
9134
|
const baseName = fileName.replace(/\.(tsx?|jsx?|vue|svelte|css|html)$/, "");
|
|
9126
9135
|
const pascalName = toPascal(baseName);
|
|
@@ -9403,19 +9412,19 @@ var escapeHtml = (str) => String(str).replace(/&/g, "&").replace(/</g, "<
|
|
|
9403
9412
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
9404
9413
|
import { mkdir as mkdir4, symlink } from "fs/promises";
|
|
9405
9414
|
import { tmpdir } from "os";
|
|
9406
|
-
import { basename as basename10, dirname as dirname12, join as join21, resolve as
|
|
9415
|
+
import { basename as basename10, dirname as dirname12, join as join21, resolve as resolve28 } from "path";
|
|
9407
9416
|
var ssrDirty2 = false, lastSelector = "angular-page", isRecord8 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
|
|
9408
9417
|
if (!compilerImportPromise) {
|
|
9409
9418
|
compilerImportPromise = import("@angular/compiler");
|
|
9410
9419
|
}
|
|
9411
9420
|
return compilerImportPromise;
|
|
9412
9421
|
}, readAngularPageModule = (value) => isRecord8(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join21(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
|
|
9413
|
-
const outRoot =
|
|
9422
|
+
const outRoot = resolve28(dirname12(dirname12(outDir)));
|
|
9414
9423
|
const nodeModulesLink = join21(outRoot, "node_modules");
|
|
9415
9424
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
9416
9425
|
return;
|
|
9417
9426
|
}
|
|
9418
|
-
if (nodeModulesLink ===
|
|
9427
|
+
if (nodeModulesLink === resolve28(process.cwd(), "node_modules")) {
|
|
9419
9428
|
return;
|
|
9420
9429
|
}
|
|
9421
9430
|
if (await Bun.file(nodeModulesLink).exists()) {
|
|
@@ -9423,7 +9432,7 @@ var ssrDirty2 = false, lastSelector = "angular-page", isRecord8 = (value) => typ
|
|
|
9423
9432
|
}
|
|
9424
9433
|
await mkdir4(outRoot, { recursive: true });
|
|
9425
9434
|
try {
|
|
9426
|
-
await symlink(
|
|
9435
|
+
await symlink(resolve28(process.cwd(), "node_modules"), nodeModulesLink, "dir");
|
|
9427
9436
|
} catch (error) {
|
|
9428
9437
|
if (!(error instanceof Error) || !("code" in error) || error.code !== "EEXIST") {
|
|
9429
9438
|
throw error;
|
|
@@ -9866,8 +9875,8 @@ __export(exports_moduleServer, {
|
|
|
9866
9875
|
createModuleServer: () => createModuleServer,
|
|
9867
9876
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
9868
9877
|
});
|
|
9869
|
-
import { existsSync as existsSync20, readFileSync as
|
|
9870
|
-
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as
|
|
9878
|
+
import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as statSync2 } from "fs";
|
|
9879
|
+
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve29, relative as relative10 } from "path";
|
|
9871
9880
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
9872
9881
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
9873
9882
|
const allExports = [];
|
|
@@ -9887,7 +9896,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
9887
9896
|
${stubs}
|
|
9888
9897
|
`;
|
|
9889
9898
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
9890
|
-
const found = extensions.find((ext) => existsSync20(
|
|
9899
|
+
const found = extensions.find((ext) => existsSync20(resolve29(projectRoot, srcPath + ext)));
|
|
9891
9900
|
return found ? srcPath + found : srcPath;
|
|
9892
9901
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
9893
9902
|
const entries = Object.entries(vendorPaths).sort(([a], [b]) => b.length - a.length);
|
|
@@ -9902,7 +9911,7 @@ ${stubs}
|
|
|
9902
9911
|
return invalidationVersion > 0 ? `${mtime}.${invalidationVersion}` : `${mtime}`;
|
|
9903
9912
|
}, srcUrl = (relPath, projectRoot) => {
|
|
9904
9913
|
const base = `${SRC_PREFIX}${relPath.replace(/\\/g, "/")}`;
|
|
9905
|
-
const absPath =
|
|
9914
|
+
const absPath = resolve29(projectRoot, relPath);
|
|
9906
9915
|
const cached = mtimeCache.get(absPath);
|
|
9907
9916
|
if (cached !== undefined)
|
|
9908
9917
|
return `${base}?v=${buildVersion(cached, absPath)}`;
|
|
@@ -9914,12 +9923,12 @@ ${stubs}
|
|
|
9914
9923
|
return base;
|
|
9915
9924
|
}
|
|
9916
9925
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
9917
|
-
const absPath =
|
|
9926
|
+
const absPath = resolve29(fileDir, relPath);
|
|
9918
9927
|
const rel = relative10(projectRoot, absPath);
|
|
9919
9928
|
const extension = extname6(rel);
|
|
9920
9929
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
9921
9930
|
if (extname6(srcPath) === ".svelte") {
|
|
9922
|
-
srcPath = relative10(projectRoot, resolveSvelteModulePath(
|
|
9931
|
+
srcPath = relative10(projectRoot, resolveSvelteModulePath(resolve29(projectRoot, srcPath)));
|
|
9923
9932
|
}
|
|
9924
9933
|
return srcUrl(srcPath, projectRoot);
|
|
9925
9934
|
}, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -9965,12 +9974,12 @@ ${stubs}
|
|
|
9965
9974
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
9966
9975
|
});
|
|
9967
9976
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
9968
|
-
const absPath =
|
|
9977
|
+
const absPath = resolve29(fileDir, relPath);
|
|
9969
9978
|
const rel = relative10(projectRoot, absPath);
|
|
9970
9979
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
9971
9980
|
});
|
|
9972
9981
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
9973
|
-
const absPath =
|
|
9982
|
+
const absPath = resolve29(fileDir, relPath);
|
|
9974
9983
|
const rel = relative10(projectRoot, absPath);
|
|
9975
9984
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
9976
9985
|
});
|
|
@@ -9999,7 +10008,7 @@ ${stubs}
|
|
|
9999
10008
|
`)}
|
|
10000
10009
|
${code}`;
|
|
10001
10010
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
10002
|
-
const raw =
|
|
10011
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10003
10012
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
10004
10013
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
10005
10014
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -10015,7 +10024,7 @@ ${transpiled}`;
|
|
|
10015
10024
|
transpiled += buildIslandMetadataExports(raw);
|
|
10016
10025
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
10017
10026
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
10018
|
-
const raw =
|
|
10027
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10019
10028
|
const ext = extname6(filePath);
|
|
10020
10029
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
10021
10030
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -10170,15 +10179,15 @@ ${code}`;
|
|
|
10170
10179
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
10171
10180
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
10172
10181
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
10173
|
-
}, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
|
|
10174
|
-
const raw =
|
|
10182
|
+
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10183
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10175
10184
|
if (!svelteCompiler) {
|
|
10176
10185
|
svelteCompiler = await import("svelte/compiler");
|
|
10177
10186
|
}
|
|
10178
10187
|
const isModule = filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
10179
10188
|
const loweredAwaitSource = isModule ? { code: raw, transformed: false } : lowerSvelteAwaitSlotSyntax(raw);
|
|
10180
10189
|
const loweredSource = isModule ? loweredAwaitSource : lowerSvelteIslandSyntax(loweredAwaitSource.code, "client");
|
|
10181
|
-
const source = loweredSource.code;
|
|
10190
|
+
const source = isModule ? loweredSource.code : (await svelteCompiler.preprocess(loweredSource.code, createSvelteStylePreprocessor(stylePreprocessors))).code;
|
|
10182
10191
|
const enableAsync = loweredAwaitSource.transformed || loweredSource.transformed;
|
|
10183
10192
|
const code = isModule ? compileSvelteModule(source, filePath) : compileSvelteComponent(source, filePath, projectRoot, enableAsync);
|
|
10184
10193
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
@@ -10205,16 +10214,16 @@ __script__.render = render;`;
|
|
|
10205
10214
|
code += `
|
|
10206
10215
|
export default __script__;`;
|
|
10207
10216
|
return code;
|
|
10208
|
-
}, compileVueStyles = (descriptor, filePath, componentId, code) => {
|
|
10217
|
+
}, compileVueStyles = async (descriptor, filePath, componentId, code, stylePreprocessors) => {
|
|
10209
10218
|
if (descriptor.styles.length === 0)
|
|
10210
10219
|
return code;
|
|
10211
|
-
const cssCode = descriptor.styles.map((style) => vueCompiler.compileStyle({
|
|
10220
|
+
const cssCode = (await Promise.all(descriptor.styles.map(async (style) => vueCompiler.compileStyle({
|
|
10212
10221
|
filename: filePath,
|
|
10213
10222
|
id: `data-v-${componentId}`,
|
|
10214
10223
|
scoped: style.scoped,
|
|
10215
|
-
source: style.content,
|
|
10224
|
+
source: style.lang ? await compileStyleSource(filePath, style.content, style.lang, stylePreprocessors) : style.content,
|
|
10216
10225
|
trim: true
|
|
10217
|
-
}).code).join(`
|
|
10226
|
+
}).code))).join(`
|
|
10218
10227
|
`);
|
|
10219
10228
|
const escaped = cssCode.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10220
10229
|
const hmrId = JSON.stringify(filePath);
|
|
@@ -10228,8 +10237,8 @@ export default __script__;`;
|
|
|
10228
10237
|
].join("");
|
|
10229
10238
|
return `${cssInjection}
|
|
10230
10239
|
${code}`;
|
|
10231
|
-
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10232
|
-
const raw =
|
|
10240
|
+
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10241
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10233
10242
|
if (!vueCompiler) {
|
|
10234
10243
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
10235
10244
|
}
|
|
@@ -10241,12 +10250,12 @@ ${code}`;
|
|
|
10241
10250
|
inlineTemplate: false
|
|
10242
10251
|
});
|
|
10243
10252
|
let code = compileVueTemplate(descriptor, compiledScript, filePath, componentId);
|
|
10244
|
-
code = compileVueStyles(descriptor, filePath, componentId, code);
|
|
10253
|
+
code = await compileVueStyles(descriptor, filePath, componentId, code, stylePreprocessors);
|
|
10245
10254
|
code = tsTranspiler2.transformSync(code);
|
|
10246
10255
|
code = injectVueHmr(code, filePath, projectRoot, vueDir);
|
|
10247
10256
|
return rewriteImports2(code, filePath, projectRoot, rewriter);
|
|
10248
10257
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
10249
|
-
const hmrBase = vueDir ?
|
|
10258
|
+
const hmrBase = vueDir ? resolve29(vueDir) : projectRoot;
|
|
10250
10259
|
const hmrId = relative10(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
10251
10260
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
10252
10261
|
result += [
|
|
@@ -10278,7 +10287,7 @@ ${code}`;
|
|
|
10278
10287
|
}
|
|
10279
10288
|
});
|
|
10280
10289
|
}, handleCssRequest = (filePath) => {
|
|
10281
|
-
const raw =
|
|
10290
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10282
10291
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10283
10292
|
return [
|
|
10284
10293
|
`const style = document.createElement('style');`,
|
|
@@ -10405,7 +10414,7 @@ export default {};
|
|
|
10405
10414
|
const escaped = virtualCss.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10406
10415
|
return jsResponse(`var s=document.createElement('style');s.textContent=\`${escaped}\`;s.dataset.svelteHmr=${JSON.stringify(cssCheckPath)};var p=document.querySelector('style[data-svelte-hmr="${cssCheckPath}"]');if(p)p.remove();document.head.appendChild(s);`);
|
|
10407
10416
|
}, resolveSourcePath = (relPath, projectRoot) => {
|
|
10408
|
-
const filePath =
|
|
10417
|
+
const filePath = resolve29(projectRoot, relPath);
|
|
10409
10418
|
const ext = extname6(filePath);
|
|
10410
10419
|
if (ext === ".svelte")
|
|
10411
10420
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
@@ -10418,7 +10427,7 @@ export default {};
|
|
|
10418
10427
|
if (found === ".svelte")
|
|
10419
10428
|
return { ext: found, filePath: resolveSvelteModulePath(resolved) };
|
|
10420
10429
|
return { ext: found, filePath: resolved };
|
|
10421
|
-
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir) => {
|
|
10430
|
+
}, transformAndCache = async (filePath, ext, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10422
10431
|
if (ext === ".css")
|
|
10423
10432
|
return jsResponse(handleCssRequest(filePath));
|
|
10424
10433
|
const isSvelte = ext === ".svelte" || filePath.endsWith(".svelte.ts") || filePath.endsWith(".svelte.js");
|
|
@@ -10426,24 +10435,24 @@ export default {};
|
|
|
10426
10435
|
if (cached)
|
|
10427
10436
|
return jsResponse(cached);
|
|
10428
10437
|
if (isSvelte)
|
|
10429
|
-
return transformAndCacheSvelte(filePath, projectRoot, rewriter);
|
|
10438
|
+
return transformAndCacheSvelte(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10430
10439
|
if (ext === ".vue")
|
|
10431
|
-
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir);
|
|
10440
|
+
return transformAndCacheVue(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10432
10441
|
if (!TRANSPILABLE.has(ext))
|
|
10433
10442
|
return;
|
|
10434
10443
|
const stat2 = statSync2(filePath);
|
|
10435
|
-
const resolvedVueDir = vueDir ?
|
|
10444
|
+
const resolvedVueDir = vueDir ? resolve29(vueDir) : undefined;
|
|
10436
10445
|
const content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
10437
10446
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10438
10447
|
return jsResponse(content);
|
|
10439
|
-
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter) => {
|
|
10448
|
+
}, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
10440
10449
|
const stat2 = statSync2(filePath);
|
|
10441
|
-
const content = await transformSvelteFile(filePath, projectRoot, rewriter);
|
|
10450
|
+
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
10442
10451
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10443
10452
|
return jsResponse(content);
|
|
10444
|
-
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10453
|
+
}, transformAndCacheVue = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
10445
10454
|
const stat2 = statSync2(filePath);
|
|
10446
|
-
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir);
|
|
10455
|
+
const content = await transformVueFile(filePath, projectRoot, rewriter, vueDir, stylePreprocessors);
|
|
10447
10456
|
setTransformed(filePath, content, stat2.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
10448
10457
|
return jsResponse(content);
|
|
10449
10458
|
}, transformErrorResponse = (err) => {
|
|
@@ -10453,7 +10462,7 @@ export default {};
|
|
|
10453
10462
|
status: 500
|
|
10454
10463
|
});
|
|
10455
10464
|
}, createModuleServer = (config) => {
|
|
10456
|
-
const { projectRoot, vendorPaths, frameworkDirs } = config;
|
|
10465
|
+
const { projectRoot, vendorPaths, frameworkDirs, stylePreprocessors } = config;
|
|
10457
10466
|
const rewriter = buildImportRewriter(vendorPaths);
|
|
10458
10467
|
return async (pathname) => {
|
|
10459
10468
|
if (pathname.startsWith("/@stub/"))
|
|
@@ -10463,12 +10472,12 @@ export default {};
|
|
|
10463
10472
|
if (!pathname.startsWith(SRC_PREFIX))
|
|
10464
10473
|
return;
|
|
10465
10474
|
const relPath = pathname.slice(SRC_PREFIX.length);
|
|
10466
|
-
const virtualCssResponse = handleVirtualSvelteCss(
|
|
10475
|
+
const virtualCssResponse = handleVirtualSvelteCss(resolve29(projectRoot, relPath));
|
|
10467
10476
|
if (virtualCssResponse)
|
|
10468
10477
|
return virtualCssResponse;
|
|
10469
10478
|
const { filePath, ext } = resolveSourcePath(relPath, projectRoot);
|
|
10470
10479
|
try {
|
|
10471
|
-
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue);
|
|
10480
|
+
return await transformAndCache(filePath, ext, projectRoot, rewriter, frameworkDirs?.vue, stylePreprocessors);
|
|
10472
10481
|
} catch (err) {
|
|
10473
10482
|
return transformErrorResponse(err);
|
|
10474
10483
|
}
|
|
@@ -10479,11 +10488,11 @@ export default {};
|
|
|
10479
10488
|
SRC_IMPORT_RE.lastIndex = 0;
|
|
10480
10489
|
while ((match = SRC_IMPORT_RE.exec(content)) !== null) {
|
|
10481
10490
|
if (match[1])
|
|
10482
|
-
files.push(
|
|
10491
|
+
files.push(resolve29(projectRoot, match[1]));
|
|
10483
10492
|
}
|
|
10484
10493
|
return files;
|
|
10485
10494
|
}, invalidateModule = (filePath) => {
|
|
10486
|
-
const resolved =
|
|
10495
|
+
const resolved = resolve29(filePath);
|
|
10487
10496
|
invalidate(filePath);
|
|
10488
10497
|
if (resolved !== filePath)
|
|
10489
10498
|
invalidate(resolved);
|
|
@@ -10502,6 +10511,7 @@ var init_moduleServer = __esm(() => {
|
|
|
10502
10511
|
init_constants();
|
|
10503
10512
|
init_resolvePackageImport();
|
|
10504
10513
|
init_sourceMetadata();
|
|
10514
|
+
init_stylePreprocessor();
|
|
10505
10515
|
init_lowerAwaitSlotSyntax();
|
|
10506
10516
|
init_lowerIslandSyntax();
|
|
10507
10517
|
init_transformCache();
|
|
@@ -10559,11 +10569,11 @@ var exports_simpleHTMLHMR = {};
|
|
|
10559
10569
|
__export(exports_simpleHTMLHMR, {
|
|
10560
10570
|
handleHTMLUpdate: () => handleHTMLUpdate
|
|
10561
10571
|
});
|
|
10562
|
-
import { resolve as
|
|
10572
|
+
import { resolve as resolve30 } from "path";
|
|
10563
10573
|
var handleHTMLUpdate = async (htmlFilePath) => {
|
|
10564
10574
|
let htmlContent;
|
|
10565
10575
|
try {
|
|
10566
|
-
const resolvedPath =
|
|
10576
|
+
const resolvedPath = resolve30(htmlFilePath);
|
|
10567
10577
|
const file4 = Bun.file(resolvedPath);
|
|
10568
10578
|
if (!await file4.exists()) {
|
|
10569
10579
|
return null;
|
|
@@ -10589,11 +10599,11 @@ var exports_simpleHTMXHMR = {};
|
|
|
10589
10599
|
__export(exports_simpleHTMXHMR, {
|
|
10590
10600
|
handleHTMXUpdate: () => handleHTMXUpdate
|
|
10591
10601
|
});
|
|
10592
|
-
import { resolve as
|
|
10602
|
+
import { resolve as resolve31 } from "path";
|
|
10593
10603
|
var handleHTMXUpdate = async (htmxFilePath) => {
|
|
10594
10604
|
let htmlContent;
|
|
10595
10605
|
try {
|
|
10596
|
-
const resolvedPath =
|
|
10606
|
+
const resolvedPath = resolve31(htmxFilePath);
|
|
10597
10607
|
const file4 = Bun.file(resolvedPath);
|
|
10598
10608
|
if (!await file4.exists()) {
|
|
10599
10609
|
return null;
|
|
@@ -10616,7 +10626,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
10616
10626
|
|
|
10617
10627
|
// src/dev/rebuildTrigger.ts
|
|
10618
10628
|
import { existsSync as existsSync21 } from "fs";
|
|
10619
|
-
import { basename as basename13, dirname as dirname15, relative as relative11, resolve as
|
|
10629
|
+
import { basename as basename13, dirname as dirname15, relative as relative11, resolve as resolve32 } from "path";
|
|
10620
10630
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseErrorLocationFromMessage = (msg) => {
|
|
10621
10631
|
const pathLineCol = msg.match(/^([^\s:]+):(\d+)(?::(\d+))?/);
|
|
10622
10632
|
if (pathLineCol) {
|
|
@@ -10688,7 +10698,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10688
10698
|
state.fileHashes.delete(filePathInSet);
|
|
10689
10699
|
try {
|
|
10690
10700
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, filePathInSet);
|
|
10691
|
-
const deletedPathResolved =
|
|
10701
|
+
const deletedPathResolved = resolve32(filePathInSet);
|
|
10692
10702
|
affectedFiles.forEach((affectedFile) => {
|
|
10693
10703
|
if (isValidDeletedAffectedFile(affectedFile, deletedPathResolved, processedFiles)) {
|
|
10694
10704
|
validFiles.push(affectedFile);
|
|
@@ -10732,7 +10742,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10732
10742
|
if (storedHash !== undefined && storedHash === fileHash) {
|
|
10733
10743
|
return;
|
|
10734
10744
|
}
|
|
10735
|
-
const normalizedFilePath =
|
|
10745
|
+
const normalizedFilePath = resolve32(filePathInSet);
|
|
10736
10746
|
if (!processedFiles.has(normalizedFilePath)) {
|
|
10737
10747
|
validFiles.push(normalizedFilePath);
|
|
10738
10748
|
processedFiles.add(normalizedFilePath);
|
|
@@ -10810,7 +10820,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10810
10820
|
}
|
|
10811
10821
|
if (framework === "unknown") {
|
|
10812
10822
|
const { invalidate: invalidate2 } = (init_transformCache(), __toCommonJS(exports_transformCache));
|
|
10813
|
-
invalidate2(
|
|
10823
|
+
invalidate2(resolve32(filePath));
|
|
10814
10824
|
const relPath = relative11(process.cwd(), filePath);
|
|
10815
10825
|
logHmrUpdate(relPath);
|
|
10816
10826
|
return;
|
|
@@ -10856,7 +10866,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10856
10866
|
}
|
|
10857
10867
|
if (!graph)
|
|
10858
10868
|
return componentFile;
|
|
10859
|
-
const dependents = graph.dependents.get(
|
|
10869
|
+
const dependents = graph.dependents.get(resolve32(componentFile));
|
|
10860
10870
|
if (!dependents)
|
|
10861
10871
|
return componentFile;
|
|
10862
10872
|
for (const dep of dependents) {
|
|
@@ -10865,7 +10875,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10865
10875
|
}
|
|
10866
10876
|
return componentFile;
|
|
10867
10877
|
}, resolveAngularPageEntries = (state, angularFiles, angularPagesPath) => {
|
|
10868
|
-
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") &&
|
|
10878
|
+
const pageEntries = angularFiles.filter((file4) => file4.endsWith(".ts") && resolve32(file4).startsWith(angularPagesPath));
|
|
10869
10879
|
if (pageEntries.length > 0 || !state.dependencyGraph) {
|
|
10870
10880
|
return pageEntries;
|
|
10871
10881
|
}
|
|
@@ -10874,7 +10884,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10874
10884
|
const lookupFile = resolveComponentLookupFile(componentFile, state.dependencyGraph);
|
|
10875
10885
|
const affected = getAffectedFiles(state.dependencyGraph, lookupFile);
|
|
10876
10886
|
affected.forEach((file4) => {
|
|
10877
|
-
if (file4.endsWith(".ts") &&
|
|
10887
|
+
if (file4.endsWith(".ts") && resolve32(file4).startsWith(angularPagesPath)) {
|
|
10878
10888
|
resolvedPages.add(file4);
|
|
10879
10889
|
}
|
|
10880
10890
|
});
|
|
@@ -10924,7 +10934,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10924
10934
|
format: "esm",
|
|
10925
10935
|
naming: "[dir]/[name].[hash].[ext]",
|
|
10926
10936
|
outdir: buildDir,
|
|
10927
|
-
plugins: [
|
|
10937
|
+
plugins: [
|
|
10938
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
10939
|
+
],
|
|
10928
10940
|
root: clientRoot,
|
|
10929
10941
|
target: "browser",
|
|
10930
10942
|
throw: false
|
|
@@ -10965,10 +10977,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10965
10977
|
});
|
|
10966
10978
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
10967
10979
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
10968
|
-
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true);
|
|
10980
|
+
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, state.config.stylePreprocessors);
|
|
10969
10981
|
serverPaths.forEach((serverPath) => {
|
|
10970
10982
|
const fileBase = basename13(serverPath, ".js");
|
|
10971
|
-
state.manifest[toPascal(fileBase)] =
|
|
10983
|
+
state.manifest[toPascal(fileBase)] = resolve32(serverPath);
|
|
10972
10984
|
});
|
|
10973
10985
|
if (clientPaths.length > 0) {
|
|
10974
10986
|
await bundleAngularClient(state, clientPaths, state.resolvedPaths.buildDir);
|
|
@@ -10977,9 +10989,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10977
10989
|
const angularDir = config.angularDirectory ?? "";
|
|
10978
10990
|
const angularFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "angular");
|
|
10979
10991
|
for (const file4 of angularFiles) {
|
|
10980
|
-
state.fileHashes.set(
|
|
10992
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
10981
10993
|
}
|
|
10982
|
-
const angularPagesPath =
|
|
10994
|
+
const angularPagesPath = resolve32(angularDir, "pages");
|
|
10983
10995
|
const pageEntries = resolveAngularPageEntries(state, angularFiles, angularPagesPath);
|
|
10984
10996
|
if (pageEntries.length > 0) {
|
|
10985
10997
|
await compileAndBundleAngular(state, pageEntries, angularDir);
|
|
@@ -10994,7 +11006,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
10994
11006
|
return manifest;
|
|
10995
11007
|
}, resolveReactEntryForPageFile = (normalized, pagesPathResolved, reactIndexesPath) => {
|
|
10996
11008
|
const pageName = basename13(normalized, ".tsx");
|
|
10997
|
-
const indexPath =
|
|
11009
|
+
const indexPath = resolve32(reactIndexesPath, `${pageName}.tsx`);
|
|
10998
11010
|
if (!existsSync21(indexPath)) {
|
|
10999
11011
|
return;
|
|
11000
11012
|
}
|
|
@@ -11006,13 +11018,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11006
11018
|
return;
|
|
11007
11019
|
}
|
|
11008
11020
|
const pageName = basename13(dep, ".tsx");
|
|
11009
|
-
const indexPath =
|
|
11021
|
+
const indexPath = resolve32(reactIndexesPath, `${pageName}.tsx`);
|
|
11010
11022
|
if (existsSync21(indexPath) && !reactEntries.includes(indexPath)) {
|
|
11011
11023
|
reactEntries.push(indexPath);
|
|
11012
11024
|
}
|
|
11013
11025
|
});
|
|
11014
11026
|
}, resolveReactEntryForFile = (state, file4, pagesPathResolved, reactIndexesPath, reactEntries) => {
|
|
11015
|
-
const normalized =
|
|
11027
|
+
const normalized = resolve32(file4);
|
|
11016
11028
|
if (!normalized.startsWith(pagesPathResolved)) {
|
|
11017
11029
|
resolveReactEntriesFromDeps(state, normalized, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
11018
11030
|
return;
|
|
@@ -11023,7 +11035,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11023
11035
|
}
|
|
11024
11036
|
}, collectReactEntries = (state, filesToRebuild, reactPagesPath, reactIndexesPath) => {
|
|
11025
11037
|
const reactEntries = [];
|
|
11026
|
-
const pagesPathResolved =
|
|
11038
|
+
const pagesPathResolved = resolve32(reactPagesPath);
|
|
11027
11039
|
filesToRebuild.forEach((file4) => {
|
|
11028
11040
|
resolveReactEntryForFile(state, file4, pagesPathResolved, reactIndexesPath, reactEntries);
|
|
11029
11041
|
});
|
|
@@ -11035,7 +11047,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11035
11047
|
const { rewriteReactImports: rewriteReactImports2 } = await Promise.resolve().then(() => (init_rewriteReactImports(), exports_rewriteReactImports));
|
|
11036
11048
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11037
11049
|
const depVendorPaths = globalThis.__depVendorPaths ?? {};
|
|
11038
|
-
const refreshEntry =
|
|
11050
|
+
const refreshEntry = resolve32(reactIndexesPath, "_refresh.tsx");
|
|
11039
11051
|
if (!reactEntries.includes(refreshEntry)) {
|
|
11040
11052
|
reactEntries.push(refreshEntry);
|
|
11041
11053
|
}
|
|
@@ -11047,7 +11059,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11047
11059
|
setDevVendorPaths2(vendorPaths);
|
|
11048
11060
|
}
|
|
11049
11061
|
const { rmSync: rmSync3 } = await import("fs");
|
|
11050
|
-
rmSync3(
|
|
11062
|
+
rmSync3(resolve32(buildDir, "react", "generated", "indexes"), {
|
|
11051
11063
|
force: true,
|
|
11052
11064
|
recursive: true
|
|
11053
11065
|
});
|
|
@@ -11057,7 +11069,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11057
11069
|
jsx: { development: true },
|
|
11058
11070
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11059
11071
|
outdir: buildDir,
|
|
11060
|
-
plugins: [
|
|
11072
|
+
plugins: [
|
|
11073
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11074
|
+
],
|
|
11061
11075
|
reactFastRefresh: true,
|
|
11062
11076
|
root: clientRoot,
|
|
11063
11077
|
splitting: true,
|
|
@@ -11097,11 +11111,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11097
11111
|
if (isComponentFile2)
|
|
11098
11112
|
return primaryFile;
|
|
11099
11113
|
const { findNearestComponent: findNearestComponent2 } = await Promise.resolve().then(() => (init_transformCache(), exports_transformCache));
|
|
11100
|
-
const nearest = findNearestComponent2(
|
|
11114
|
+
const nearest = findNearestComponent2(resolve32(primaryFile));
|
|
11101
11115
|
return nearest ?? primaryFile;
|
|
11102
11116
|
}, handleReactModuleServerPath = async (state, reactFiles, startTime, onRebuildComplete) => {
|
|
11103
11117
|
for (const file4 of reactFiles) {
|
|
11104
|
-
state.fileHashes.set(
|
|
11118
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
11105
11119
|
}
|
|
11106
11120
|
invalidateReactSsrCache();
|
|
11107
11121
|
const primaryFile = reactFiles.find((file4) => !file4.replace(/\\/g, "/").includes("/pages/")) ?? reactFiles[0];
|
|
@@ -11143,8 +11157,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11143
11157
|
return state.manifest;
|
|
11144
11158
|
}, handleReactFastPath = async (state, config, filesToRebuild, startTime, onRebuildComplete) => {
|
|
11145
11159
|
const reactDir = config.reactDirectory ?? "";
|
|
11146
|
-
const reactPagesPath =
|
|
11147
|
-
const reactIndexesPath =
|
|
11160
|
+
const reactPagesPath = resolve32(reactDir, "pages");
|
|
11161
|
+
const reactIndexesPath = resolve32(reactDir, "generated", "indexes");
|
|
11148
11162
|
const { buildDir } = state.resolvedPaths;
|
|
11149
11163
|
const reactFiles = filesToRebuild.filter((file4) => detectFramework(file4, state.resolvedPaths) === "react");
|
|
11150
11164
|
if (reactFiles.length > 0) {
|
|
@@ -11207,7 +11221,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11207
11221
|
});
|
|
11208
11222
|
}, handleSvelteModuleServerPath = async (state, svelteFiles, startTime, onRebuildComplete) => {
|
|
11209
11223
|
for (const file4 of svelteFiles) {
|
|
11210
|
-
state.fileHashes.set(
|
|
11224
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
11211
11225
|
}
|
|
11212
11226
|
invalidateSvelteSsrCache();
|
|
11213
11227
|
const serverDuration = Date.now() - startTime;
|
|
@@ -11230,11 +11244,11 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11230
11244
|
const { compileSvelte: compileSvelte2 } = await Promise.resolve().then(() => (init_compileSvelte(), exports_compileSvelte));
|
|
11231
11245
|
const { build: bunBuild7 } = await Promise.resolve(globalThis.Bun);
|
|
11232
11246
|
const clientRoot = await computeClientRoot(state.resolvedPaths);
|
|
11233
|
-
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true);
|
|
11247
|
+
const { svelteServerPaths, svelteIndexPaths, svelteClientPaths } = await compileSvelte2(svelteFiles, svelteDir, new Map, true, state.config.stylePreprocessors);
|
|
11234
11248
|
const serverEntries = [...svelteServerPaths];
|
|
11235
11249
|
const clientEntries = [...svelteIndexPaths, ...svelteClientPaths];
|
|
11236
|
-
const serverRoot =
|
|
11237
|
-
const serverOutDir =
|
|
11250
|
+
const serverRoot = resolve32(svelteDir, "generated", "server");
|
|
11251
|
+
const serverOutDir = resolve32(buildDir, basename13(svelteDir));
|
|
11238
11252
|
const [serverResult, clientResult] = await Promise.all([
|
|
11239
11253
|
serverEntries.length > 0 ? bunBuild7({
|
|
11240
11254
|
entrypoints: serverEntries,
|
|
@@ -11249,7 +11263,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11249
11263
|
format: "esm",
|
|
11250
11264
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11251
11265
|
outdir: serverOutDir,
|
|
11252
|
-
plugins: [
|
|
11266
|
+
plugins: [
|
|
11267
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11268
|
+
],
|
|
11253
11269
|
root: serverRoot,
|
|
11254
11270
|
target: "bun",
|
|
11255
11271
|
throw: false
|
|
@@ -11259,7 +11275,9 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11259
11275
|
format: "esm",
|
|
11260
11276
|
naming: "[dir]/[name].[hash].[ext]",
|
|
11261
11277
|
outdir: buildDir,
|
|
11262
|
-
plugins: [
|
|
11278
|
+
plugins: [
|
|
11279
|
+
createStylePreprocessorPlugin(state.config.stylePreprocessors)
|
|
11280
|
+
],
|
|
11263
11281
|
root: clientRoot,
|
|
11264
11282
|
target: "browser",
|
|
11265
11283
|
throw: false
|
|
@@ -11327,7 +11345,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11327
11345
|
});
|
|
11328
11346
|
}, handleVueModuleServerPath = async (state, vueFiles, nonVueFiles, startTime, onRebuildComplete) => {
|
|
11329
11347
|
for (const file4 of [...vueFiles, ...nonVueFiles]) {
|
|
11330
|
-
state.fileHashes.set(
|
|
11348
|
+
state.fileHashes.set(resolve32(file4), computeFileHash(file4));
|
|
11331
11349
|
}
|
|
11332
11350
|
invalidateVueSsrCache();
|
|
11333
11351
|
await invalidateNonVueModules(nonVueFiles);
|
|
@@ -11422,8 +11440,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11422
11440
|
if (!buildReference?.source) {
|
|
11423
11441
|
return;
|
|
11424
11442
|
}
|
|
11425
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname :
|
|
11426
|
-
islandFiles.add(
|
|
11443
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve32(dirname15(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
11444
|
+
islandFiles.add(resolve32(sourcePath));
|
|
11427
11445
|
}, resolveIslandSourceFiles = async (config) => {
|
|
11428
11446
|
const registryPath = config.islands?.registry;
|
|
11429
11447
|
if (!registryPath) {
|
|
@@ -11431,7 +11449,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11431
11449
|
}
|
|
11432
11450
|
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
11433
11451
|
const islandFiles = new Set([
|
|
11434
|
-
|
|
11452
|
+
resolve32(buildInfo.resolvedRegistryPath)
|
|
11435
11453
|
]);
|
|
11436
11454
|
for (const definition of buildInfo.definitions) {
|
|
11437
11455
|
resolveIslandDefinitionSource(definition, buildInfo, islandFiles);
|
|
@@ -11442,7 +11460,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11442
11460
|
if (islandFiles.size === 0) {
|
|
11443
11461
|
return false;
|
|
11444
11462
|
}
|
|
11445
|
-
return filesToRebuild.some((file4) => islandFiles.has(
|
|
11463
|
+
return filesToRebuild.some((file4) => islandFiles.has(resolve32(file4)));
|
|
11446
11464
|
}, handleIslandSourceReload = async (state, config, filesToRebuild, manifest) => {
|
|
11447
11465
|
const shouldReload = await didStaticPagesNeedIslandRefresh(config, filesToRebuild);
|
|
11448
11466
|
if (!shouldReload) {
|
|
@@ -11477,10 +11495,10 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11477
11495
|
}, computeOutputPagesDir = (state, config, framework) => {
|
|
11478
11496
|
const isSingle = !config.reactDirectory && !config.svelteDirectory && !config.vueDirectory && (framework === "html" ? !config.htmxDirectory : !config.htmlDirectory);
|
|
11479
11497
|
if (isSingle) {
|
|
11480
|
-
return
|
|
11498
|
+
return resolve32(state.resolvedPaths.buildDir, "pages");
|
|
11481
11499
|
}
|
|
11482
11500
|
const dirName = framework === "html" ? basename13(config.htmlDirectory ?? "html") : basename13(config.htmxDirectory ?? "htmx");
|
|
11483
|
-
return
|
|
11501
|
+
return resolve32(state.resolvedPaths.buildDir, dirName, "pages");
|
|
11484
11502
|
}, processHtmlPageUpdate = async (state, pageFile, builtHtmlPagePath, manifest, duration) => {
|
|
11485
11503
|
try {
|
|
11486
11504
|
const { handleHTMLUpdate: handleHTMLUpdate2 } = await Promise.resolve().then(() => (init_simpleHTMLHMR(), exports_simpleHTMLHMR));
|
|
@@ -11519,7 +11537,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11519
11537
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmlPages, "*.html") : htmlPageFiles;
|
|
11520
11538
|
for (const pageFile of pageFilesToUpdate) {
|
|
11521
11539
|
const htmlPageName = basename13(pageFile);
|
|
11522
|
-
const builtHtmlPagePath =
|
|
11540
|
+
const builtHtmlPagePath = resolve32(outputHtmlPages, htmlPageName);
|
|
11523
11541
|
await processHtmlPageUpdate(state, pageFile, builtHtmlPagePath, manifest, duration);
|
|
11524
11542
|
}
|
|
11525
11543
|
}, handleVueCssOnlyUpdate = (state, vueCssFiles, manifest, duration) => {
|
|
@@ -11584,7 +11602,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11584
11602
|
const cssKey = `${pascalName}CSS`;
|
|
11585
11603
|
const cssUrl = manifest[cssKey] || null;
|
|
11586
11604
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
11587
|
-
const hmrMeta = vueHmrMetadata2.get(
|
|
11605
|
+
const hmrMeta = vueHmrMetadata2.get(resolve32(vuePagePath));
|
|
11588
11606
|
const changeType = hmrMeta?.changeType ?? "full";
|
|
11589
11607
|
if (changeType === "style-only") {
|
|
11590
11608
|
broadcastVueStyleOnly(state, vuePagePath, baseName, cssUrl, hmrId, manifest, duration);
|
|
@@ -11821,7 +11839,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11821
11839
|
const pageFilesToUpdate = shouldRefreshAllPages ? await scanEntryPoints(outputHtmxPages, "*.html") : htmxPageFiles;
|
|
11822
11840
|
for (const htmxPageFile of pageFilesToUpdate) {
|
|
11823
11841
|
const htmxPageName = basename13(htmxPageFile);
|
|
11824
|
-
const builtHtmxPagePath =
|
|
11842
|
+
const builtHtmxPagePath = resolve32(outputHtmxPages, htmxPageName);
|
|
11825
11843
|
await processHtmxPageUpdate(state, htmxPageFile, builtHtmxPagePath, manifest, duration);
|
|
11826
11844
|
}
|
|
11827
11845
|
}, collectUpdatedModulePaths = (allModuleUpdates) => {
|
|
@@ -11930,7 +11948,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
|
|
|
11930
11948
|
html = html.slice(0, bodyClose.index) + hmrScript + html.slice(bodyClose.index);
|
|
11931
11949
|
writeFs(destPath, html);
|
|
11932
11950
|
}, processMarkupFileFastPath = async (state, sourceFile, outputDir, framework, startTime, updateAssetPaths2, handleUpdate, readFs, writeFs) => {
|
|
11933
|
-
const destPath =
|
|
11951
|
+
const destPath = resolve32(outputDir, basename13(sourceFile));
|
|
11934
11952
|
const hmrScript = extractHmrScript(destPath, readFs);
|
|
11935
11953
|
const source = await Bun.file(sourceFile).text();
|
|
11936
11954
|
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 file4 of files) {
|
|
12221
12239
|
const filePath = join22(vendorDir, file4);
|
|
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 resolve33 } 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 = resolve33(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(resolve33(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
|
+
resolve33(import.meta.dir, "..", "..", "package.json"),
|
|
12465
|
+
resolve33(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(resolve33(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 = resolve33(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 = resolve33(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 = resolve33(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 = resolve33(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 = resolve33(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(resolve33(Bun.main)).mtimeMs;
|
|
12586
12604
|
return result;
|
|
12587
12605
|
};
|
|
12588
12606
|
var init_devBuild = __esm(() => {
|
|
@@ -12731,17 +12749,17 @@ __export(exports_devtoolsJson, {
|
|
|
12731
12749
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
12732
12750
|
devtoolsJson: () => devtoolsJson
|
|
12733
12751
|
});
|
|
12734
|
-
import { existsSync as existsSync22, mkdirSync as mkdirSync12, readFileSync as
|
|
12735
|
-
import { dirname as dirname17, join as join23, resolve as
|
|
12752
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync12, readFileSync as readFileSync14, writeFileSync as writeFileSync8 } from "fs";
|
|
12753
|
+
import { dirname as dirname17, join as join23, resolve as resolve34 } from "path";
|
|
12736
12754
|
import { Elysia as Elysia3 } from "elysia";
|
|
12737
12755
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
12738
12756
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
12739
12757
|
return uuid;
|
|
12740
|
-
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) =>
|
|
12758
|
+
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve34(uuidCachePath ?? join23(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
12741
12759
|
if (!existsSync22(cachePath))
|
|
12742
12760
|
return null;
|
|
12743
12761
|
try {
|
|
12744
|
-
const value =
|
|
12762
|
+
const value = readFileSync14(cachePath, "utf-8").trim();
|
|
12745
12763
|
return isUuidV4(value) ? value : null;
|
|
12746
12764
|
} catch {
|
|
12747
12765
|
return null;
|
|
@@ -12763,7 +12781,7 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
12763
12781
|
writeFileSync8(cachePath, uuid, "utf-8");
|
|
12764
12782
|
return setGlobalUuid(uuid);
|
|
12765
12783
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
12766
|
-
const rootPath =
|
|
12784
|
+
const rootPath = resolve34(options.projectRoot ?? process.cwd());
|
|
12767
12785
|
const root = options.normalizeForWindowsContainer === false ? rootPath : normalizeDevtoolsWorkspaceRoot(rootPath);
|
|
12768
12786
|
const uuid = getOrCreateUuid(buildDir, options);
|
|
12769
12787
|
return new Elysia3({ name: "absolute-devtools-json" }).get(ENDPOINT, () => ({
|
|
@@ -12792,7 +12810,7 @@ __export(exports_imageOptimizer, {
|
|
|
12792
12810
|
imageOptimizer: () => imageOptimizer
|
|
12793
12811
|
});
|
|
12794
12812
|
import { existsSync as existsSync23 } from "fs";
|
|
12795
|
-
import { resolve as
|
|
12813
|
+
import { resolve as resolve35 } from "path";
|
|
12796
12814
|
import { Elysia as Elysia4 } from "elysia";
|
|
12797
12815
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
12798
12816
|
try {
|
|
@@ -12805,7 +12823,7 @@ var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avi
|
|
|
12805
12823
|
}
|
|
12806
12824
|
}, resolveLocalImage = (url, buildDir) => {
|
|
12807
12825
|
const cleanPath = url.startsWith("/") ? url.slice(1) : url;
|
|
12808
|
-
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath,
|
|
12826
|
+
return safeResolve(cleanPath, buildDir) ?? safeResolve(cleanPath, resolve35(process.cwd()));
|
|
12809
12827
|
}, parseQueryParams = (query, allowedSizes, defaultQuality) => {
|
|
12810
12828
|
const url = typeof query["url"] === "string" ? query["url"] : undefined;
|
|
12811
12829
|
const wParam = typeof query["w"] === "string" ? query["w"] : undefined;
|
|
@@ -13096,7 +13114,7 @@ __export(exports_prerender, {
|
|
|
13096
13114
|
prerender: () => prerender,
|
|
13097
13115
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
13098
13116
|
});
|
|
13099
|
-
import { mkdirSync as mkdirSync13, readFileSync as
|
|
13117
|
+
import { mkdirSync as mkdirSync13, readFileSync as readFileSync15 } from "fs";
|
|
13100
13118
|
import { join as join24 } from "path";
|
|
13101
13119
|
var MAX_STARTUP_ATTEMPTS = 50, STARTUP_POLL_INTERVAL_MS = 100, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
13102
13120
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
@@ -13104,7 +13122,7 @@ var MAX_STARTUP_ATTEMPTS = 50, STARTUP_POLL_INTERVAL_MS = 100, PRERENDER_BYPASS_
|
|
|
13104
13122
|
}, readTimestamp = (htmlPath) => {
|
|
13105
13123
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
13106
13124
|
try {
|
|
13107
|
-
const content =
|
|
13125
|
+
const content = readFileSync15(metaPath, "utf-8");
|
|
13108
13126
|
return Number(content) || 0;
|
|
13109
13127
|
} catch {
|
|
13110
13128
|
return 0;
|
|
@@ -13444,12 +13462,12 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
13444
13462
|
});
|
|
13445
13463
|
};
|
|
13446
13464
|
// src/core/prepare.ts
|
|
13447
|
-
import { existsSync as existsSync24, readdirSync as readdirSync2, readFileSync as
|
|
13448
|
-
import { basename as basename14, join as join25, relative as relative12, resolve as
|
|
13465
|
+
import { existsSync as existsSync24, readdirSync as readdirSync2, readFileSync as readFileSync16 } from "fs";
|
|
13466
|
+
import { basename as basename14, join as join25, relative as relative12, resolve as resolve36 } from "path";
|
|
13449
13467
|
import { Elysia as Elysia5 } from "elysia";
|
|
13450
13468
|
|
|
13451
13469
|
// src/utils/loadConfig.ts
|
|
13452
|
-
import { resolve as
|
|
13470
|
+
import { resolve as resolve7 } from "path";
|
|
13453
13471
|
var RESERVED_TOP_LEVEL_KEYS = new Set([
|
|
13454
13472
|
"assetsDirectory",
|
|
13455
13473
|
"astroDirectory",
|
|
@@ -13527,7 +13545,7 @@ var projectServiceConfig = (config, serviceName) => {
|
|
|
13527
13545
|
return serviceConfig;
|
|
13528
13546
|
};
|
|
13529
13547
|
var loadRawConfig = async (configPath) => {
|
|
13530
|
-
const resolved =
|
|
13548
|
+
const resolved = resolve7(configPath ?? process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
13531
13549
|
const mod = await import(resolved);
|
|
13532
13550
|
const config = mod.default ?? mod.config;
|
|
13533
13551
|
if (!config) {
|
|
@@ -13555,7 +13573,7 @@ var loadConfig = async (configPath) => {
|
|
|
13555
13573
|
init_islandPageContext();
|
|
13556
13574
|
|
|
13557
13575
|
// src/core/loadIslandRegistry.ts
|
|
13558
|
-
import { resolve as
|
|
13576
|
+
import { resolve as resolve8 } from "path";
|
|
13559
13577
|
var isRecord6 = (value) => typeof value === "object" && value !== null;
|
|
13560
13578
|
var resolveRegistryExport2 = (mod) => {
|
|
13561
13579
|
if (isRecord6(mod.islandRegistry))
|
|
@@ -13567,7 +13585,7 @@ var resolveRegistryExport2 = (mod) => {
|
|
|
13567
13585
|
var isRegistryModuleExport = (value) => isRecord6(value);
|
|
13568
13586
|
var isIslandRegistryInput = (value) => isRecord6(value);
|
|
13569
13587
|
var loadIslandRegistry = async (registryPath) => {
|
|
13570
|
-
const resolvedRegistryPath =
|
|
13588
|
+
const resolvedRegistryPath = resolve8(registryPath);
|
|
13571
13589
|
const importedModule = await import(resolvedRegistryPath);
|
|
13572
13590
|
if (!isRegistryModuleExport(importedModule)) {
|
|
13573
13591
|
throw new Error("Island registry module must export an object namespace.");
|
|
@@ -13611,7 +13629,7 @@ var collectPrewarmFiles = async (prewarmDirs) => {
|
|
|
13611
13629
|
for (const { dir, pattern } of prewarmDirs) {
|
|
13612
13630
|
const glob = new Glob9(pattern);
|
|
13613
13631
|
const matches = [
|
|
13614
|
-
...glob.scanSync({ absolute: true, cwd:
|
|
13632
|
+
...glob.scanSync({ absolute: true, cwd: resolve36(dir) })
|
|
13615
13633
|
];
|
|
13616
13634
|
files.push(...matches);
|
|
13617
13635
|
}
|
|
@@ -13647,7 +13665,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
13647
13665
|
const fileName = resolveDevIndexFileName(manifest[key], baseName);
|
|
13648
13666
|
if (!fileName)
|
|
13649
13667
|
continue;
|
|
13650
|
-
const srcPath =
|
|
13668
|
+
const srcPath = resolve36(devIndexDir, fileName);
|
|
13651
13669
|
if (!existsSync24(srcPath))
|
|
13652
13670
|
continue;
|
|
13653
13671
|
const rel = relative12(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
@@ -13699,6 +13717,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
13699
13717
|
vue: config.vueDirectory
|
|
13700
13718
|
},
|
|
13701
13719
|
projectRoot: process.cwd(),
|
|
13720
|
+
stylePreprocessors: config.stylePreprocessors,
|
|
13702
13721
|
vendorPaths: allVendorPaths
|
|
13703
13722
|
});
|
|
13704
13723
|
setGlobalModuleServer2(moduleHandler);
|
|
@@ -13717,7 +13736,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
13717
13736
|
stepStartedAt = performance.now();
|
|
13718
13737
|
const hmrPlugin = hmr2(result.hmrState, result.manifest, moduleHandler);
|
|
13719
13738
|
const { devtoolsJson: devtoolsJson2 } = await Promise.resolve().then(() => (init_devtoolsJson(), exports_devtoolsJson));
|
|
13720
|
-
const devIndexDir =
|
|
13739
|
+
const devIndexDir = resolve36(buildDir, "_src_indexes");
|
|
13721
13740
|
patchManifestIndexes(result.manifest, devIndexDir, SRC_URL_PREFIX2);
|
|
13722
13741
|
recordStep("configure dev plugins", stepStartedAt);
|
|
13723
13742
|
stepStartedAt = performance.now();
|
|
@@ -13797,7 +13816,7 @@ var prepare = async (configOrPath) => {
|
|
|
13797
13816
|
recordStep("load config", stepStartedAt);
|
|
13798
13817
|
const nodeEnv = process.env["NODE_ENV"];
|
|
13799
13818
|
const isDev3 = nodeEnv === "development";
|
|
13800
|
-
const buildDir =
|
|
13819
|
+
const buildDir = resolve36(process.env.ABSOLUTE_BUILD_DIR ?? config.buildDirectory ?? "build");
|
|
13801
13820
|
if (isDev3) {
|
|
13802
13821
|
stepStartedAt = performance.now();
|
|
13803
13822
|
const result = await prepareDev(config, buildDir);
|
|
@@ -13806,7 +13825,7 @@ var prepare = async (configOrPath) => {
|
|
|
13806
13825
|
return result;
|
|
13807
13826
|
}
|
|
13808
13827
|
stepStartedAt = performance.now();
|
|
13809
|
-
const manifest = JSON.parse(
|
|
13828
|
+
const manifest = JSON.parse(readFileSync16(`${buildDir}/manifest.json`, "utf-8"));
|
|
13810
13829
|
setCurrentIslandManifest(manifest);
|
|
13811
13830
|
if (config.islands?.registry) {
|
|
13812
13831
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -13816,7 +13835,7 @@ var prepare = async (configOrPath) => {
|
|
|
13816
13835
|
stepStartedAt = performance.now();
|
|
13817
13836
|
const conventionsPath = join25(buildDir, "conventions.json");
|
|
13818
13837
|
if (existsSync24(conventionsPath)) {
|
|
13819
|
-
const conventions2 = JSON.parse(
|
|
13838
|
+
const conventions2 = JSON.parse(readFileSync16(conventionsPath, "utf-8"));
|
|
13820
13839
|
setConventions(conventions2);
|
|
13821
13840
|
}
|
|
13822
13841
|
recordStep("load production conventions", stepStartedAt);
|
|
@@ -13885,7 +13904,7 @@ import { argv } from "process";
|
|
|
13885
13904
|
var {env: env4 } = globalThis.Bun;
|
|
13886
13905
|
|
|
13887
13906
|
// src/dev/devCert.ts
|
|
13888
|
-
import { existsSync as existsSync25, mkdirSync as mkdirSync14, readFileSync as
|
|
13907
|
+
import { existsSync as existsSync25, mkdirSync as mkdirSync14, readFileSync as readFileSync17, rmSync as rmSync3 } from "fs";
|
|
13889
13908
|
import { join as join26 } from "path";
|
|
13890
13909
|
var CERT_DIR = join26(process.cwd(), ".absolutejs");
|
|
13891
13910
|
var CERT_PATH = join26(CERT_DIR, "cert.pem");
|
|
@@ -13896,7 +13915,7 @@ var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1
|
|
|
13896
13915
|
var certFilesExist = () => existsSync25(CERT_PATH) && existsSync25(KEY_PATH);
|
|
13897
13916
|
var isCertExpired = () => {
|
|
13898
13917
|
try {
|
|
13899
|
-
const certPem =
|
|
13918
|
+
const certPem = readFileSync17(CERT_PATH, "utf-8");
|
|
13900
13919
|
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
13901
13920
|
stdin: new TextEncoder().encode(certPem)
|
|
13902
13921
|
});
|
|
@@ -13992,8 +14011,8 @@ var loadDevCert = () => {
|
|
|
13992
14011
|
return null;
|
|
13993
14012
|
try {
|
|
13994
14013
|
return {
|
|
13995
|
-
cert:
|
|
13996
|
-
key:
|
|
14014
|
+
cert: readFileSync17(paths.cert, "utf-8"),
|
|
14015
|
+
key: readFileSync17(paths.key, "utf-8")
|
|
13997
14016
|
};
|
|
13998
14017
|
} catch {
|
|
13999
14018
|
return null;
|
|
@@ -14221,8 +14240,8 @@ var jsonLd2 = (schema) => {
|
|
|
14221
14240
|
};
|
|
14222
14241
|
// src/utils/defineEnv.ts
|
|
14223
14242
|
var {env: bunEnv } = globalThis.Bun;
|
|
14224
|
-
import { existsSync as existsSync26, readFileSync as
|
|
14225
|
-
import { resolve as
|
|
14243
|
+
import { existsSync as existsSync26, readFileSync as readFileSync18 } from "fs";
|
|
14244
|
+
import { resolve as resolve37 } from "path";
|
|
14226
14245
|
|
|
14227
14246
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
14228
14247
|
var exports_value = {};
|
|
@@ -20257,19 +20276,19 @@ ${lines.join(`
|
|
|
20257
20276
|
};
|
|
20258
20277
|
var checkEnvFileSecurity = (properties) => {
|
|
20259
20278
|
const cwd2 = process.cwd();
|
|
20260
|
-
const envPath =
|
|
20279
|
+
const envPath = resolve37(cwd2, ".env");
|
|
20261
20280
|
if (!existsSync26(envPath))
|
|
20262
20281
|
return;
|
|
20263
20282
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
20264
20283
|
if (sensitiveKeys.length === 0)
|
|
20265
20284
|
return;
|
|
20266
|
-
const envContent =
|
|
20285
|
+
const envContent = readFileSync18(envPath, "utf-8");
|
|
20267
20286
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
20268
20287
|
if (presentKeys.length === 0)
|
|
20269
20288
|
return;
|
|
20270
|
-
const gitignorePath =
|
|
20289
|
+
const gitignorePath = resolve37(cwd2, ".gitignore");
|
|
20271
20290
|
if (existsSync26(gitignorePath)) {
|
|
20272
|
-
const gitignore =
|
|
20291
|
+
const gitignore = readFileSync18(gitignorePath, "utf-8");
|
|
20273
20292
|
if (gitignore.split(`
|
|
20274
20293
|
`).some((line) => line.trim() === ".env"))
|
|
20275
20294
|
return;
|
|
@@ -20476,5 +20495,5 @@ export {
|
|
|
20476
20495
|
ANGULAR_INIT_TIMEOUT_MS
|
|
20477
20496
|
};
|
|
20478
20497
|
|
|
20479
|
-
//# debugId=
|
|
20498
|
+
//# debugId=A6C7D117925B5F8264756E2164756E21
|
|
20480
20499
|
//# sourceMappingURL=index.js.map
|