@absolutejs/absolute 0.19.0-beta.690 → 0.19.0-beta.692
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 +104 -103
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +104 -103
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +258 -257
- package/dist/build.js.map +4 -4
- package/dist/index.js +299 -298
- package/dist/index.js.map +4 -4
- package/dist/islands/index.js +16 -36
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +16 -36
- package/dist/react/index.js.map +3 -3
- package/dist/svelte/index.js +21 -41
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +16 -36
- package/dist/svelte/server.js.map +3 -3
- package/dist/vue/index.js +16 -36
- package/dist/vue/index.js.map +3 -3
- package/package.json +7 -7
package/dist/build.js
CHANGED
|
@@ -2448,10 +2448,10 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2448
2448
|
});
|
|
2449
2449
|
|
|
2450
2450
|
// src/build/stylePreprocessor.ts
|
|
2451
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
2452
2451
|
import { readFile } from "fs/promises";
|
|
2453
|
-
import {
|
|
2454
|
-
|
|
2452
|
+
import { createRequire } from "module";
|
|
2453
|
+
import { dirname as dirname3, extname as extname3, join as join5 } from "path";
|
|
2454
|
+
var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
2455
2455
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2456
2456
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
2457
2457
|
return "scss";
|
|
@@ -2515,27 +2515,6 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2515
2515
|
return readFile(filePath, "utf-8");
|
|
2516
2516
|
}
|
|
2517
2517
|
return compileStyleSource(filePath);
|
|
2518
|
-
}, compileStyleFileIfNeededSync = (filePath) => {
|
|
2519
|
-
const contents = readFileSync3(filePath, "utf-8");
|
|
2520
|
-
const language = getStyleLanguage(filePath);
|
|
2521
|
-
if (language === "scss" || language === "sass") {
|
|
2522
|
-
let sass;
|
|
2523
|
-
try {
|
|
2524
|
-
sass = requireOptionalPeer("sass");
|
|
2525
|
-
} catch {
|
|
2526
|
-
throw missingDependencyError("sass", filePath);
|
|
2527
|
-
}
|
|
2528
|
-
return sass.compileString(contents, {
|
|
2529
|
-
loadPaths: [dirname3(filePath), process.cwd()],
|
|
2530
|
-
style: "expanded",
|
|
2531
|
-
syntax: language === "sass" ? "indented" : "scss",
|
|
2532
|
-
url: new URL(`file://${filePath}`)
|
|
2533
|
-
}).css;
|
|
2534
|
-
}
|
|
2535
|
-
if (language === "less") {
|
|
2536
|
-
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.`);
|
|
2537
|
-
}
|
|
2538
|
-
return contents;
|
|
2539
2518
|
};
|
|
2540
2519
|
var init_stylePreprocessor = __esm(() => {
|
|
2541
2520
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -2543,6 +2522,7 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2543
2522
|
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less)$/i;
|
|
2544
2523
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2545
2524
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2525
|
+
requireFromCwd = createRequire(join5(process.cwd(), "package.json"));
|
|
2546
2526
|
stylePreprocessorPlugin = {
|
|
2547
2527
|
name: "absolute-style-preprocessor",
|
|
2548
2528
|
setup(build) {
|
|
@@ -2581,13 +2561,13 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2581
2561
|
|
|
2582
2562
|
// src/core/svelteServerModule.ts
|
|
2583
2563
|
import { mkdir, readdir as readdir2 } from "fs/promises";
|
|
2584
|
-
import { basename as basename2, dirname as dirname4, extname as extname4, join as
|
|
2564
|
+
import { basename as basename2, dirname as dirname4, extname as extname4, join as join6, relative as relative3, resolve as resolve6 } from "path";
|
|
2585
2565
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2586
2566
|
const importPath = relative3(dirname4(from), target).replace(/\\/g, "/");
|
|
2587
2567
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2588
2568
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
2589
2569
|
for (const entry of entries) {
|
|
2590
|
-
const entryPath =
|
|
2570
|
+
const entryPath = join6(dir, entry.name);
|
|
2591
2571
|
if (entry.isDirectory())
|
|
2592
2572
|
stack.push(entryPath);
|
|
2593
2573
|
if (entry.isFile() && entry.name === targetFileName) {
|
|
@@ -2617,11 +2597,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2617
2597
|
if (cachedPath !== undefined) {
|
|
2618
2598
|
return cachedPath;
|
|
2619
2599
|
}
|
|
2620
|
-
if (!sourcePath.includes(`${
|
|
2600
|
+
if (!sourcePath.includes(`${join6(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
|
|
2621
2601
|
originalSourcePathCache.set(sourcePath, sourcePath);
|
|
2622
2602
|
return sourcePath;
|
|
2623
2603
|
}
|
|
2624
|
-
const resolvedSourcePath = await findSourceFileByBasename(
|
|
2604
|
+
const resolvedSourcePath = await findSourceFileByBasename(join6(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
|
|
2625
2605
|
const nextPath = resolvedSourcePath ?? sourcePath;
|
|
2626
2606
|
originalSourcePathCache.set(sourcePath, nextPath);
|
|
2627
2607
|
return nextPath;
|
|
@@ -2637,11 +2617,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2637
2617
|
`${basePath}.mjs`,
|
|
2638
2618
|
`${basePath}.cjs`,
|
|
2639
2619
|
`${basePath}.json`,
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2620
|
+
join6(basePath, "index.ts"),
|
|
2621
|
+
join6(basePath, "index.js"),
|
|
2622
|
+
join6(basePath, "index.mjs"),
|
|
2623
|
+
join6(basePath, "index.cjs"),
|
|
2624
|
+
join6(basePath, "index.json")
|
|
2645
2625
|
];
|
|
2646
2626
|
const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
|
|
2647
2627
|
const foundIndex = existResults.indexOf(true);
|
|
@@ -2649,7 +2629,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2649
2629
|
}, getCachedModulePath = (sourcePath) => {
|
|
2650
2630
|
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2651
2631
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2652
|
-
return
|
|
2632
|
+
return join6(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
2653
2633
|
}, resolveSvelteImport = async (spec, from) => {
|
|
2654
2634
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
2655
2635
|
const resolved = resolvePackageImport(spec);
|
|
@@ -2750,7 +2730,7 @@ var init_svelteServerModule = __esm(() => {
|
|
|
2750
2730
|
init_lowerIslandSyntax();
|
|
2751
2731
|
init_lowerAwaitSlotSyntax();
|
|
2752
2732
|
init_stylePreprocessor();
|
|
2753
|
-
serverCacheRoot =
|
|
2733
|
+
serverCacheRoot = join6(process.cwd(), ".absolutejs", "islands", "svelte");
|
|
2754
2734
|
compiledModuleCache = new Map;
|
|
2755
2735
|
originalSourcePathCache = new Map;
|
|
2756
2736
|
transpiler = new Bun.Transpiler({
|
|
@@ -2967,7 +2947,7 @@ var init_staticStreaming = __esm(() => {
|
|
|
2967
2947
|
});
|
|
2968
2948
|
|
|
2969
2949
|
// src/build/staticIslandPages.ts
|
|
2970
|
-
import { readFileSync as
|
|
2950
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
2971
2951
|
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) => {
|
|
2972
2952
|
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
2973
2953
|
const attributes = new Map;
|
|
@@ -3096,7 +3076,7 @@ var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:
|
|
|
3096
3076
|
}
|
|
3097
3077
|
return result + originalHtml.slice(nextIndex);
|
|
3098
3078
|
}, transformStaticPage = async (pagePath, registry) => {
|
|
3099
|
-
const originalHtml =
|
|
3079
|
+
const originalHtml = readFileSync3(pagePath, "utf-8");
|
|
3100
3080
|
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
3101
3081
|
if (transformedHtml !== originalHtml) {
|
|
3102
3082
|
writeFileSync3(pagePath, transformedHtml);
|
|
@@ -3234,8 +3214,8 @@ var init_scanCssEntryPoints = __esm(() => {
|
|
|
3234
3214
|
});
|
|
3235
3215
|
|
|
3236
3216
|
// src/utils/imageProcessing.ts
|
|
3237
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as
|
|
3238
|
-
import { join as
|
|
3217
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "fs";
|
|
3218
|
+
import { join as join7, resolve as resolve7 } from "path";
|
|
3239
3219
|
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) => {
|
|
3240
3220
|
for (const size of sizes) {
|
|
3241
3221
|
if (size >= target)
|
|
@@ -3288,7 +3268,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3288
3268
|
const image = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
|
|
3289
3269
|
return [...device, ...image].sort((left, right) => left - right);
|
|
3290
3270
|
}, getCacheDir = (buildDir) => {
|
|
3291
|
-
const dir =
|
|
3271
|
+
const dir = join7(buildDir, ".cache", "images");
|
|
3292
3272
|
if (!existsSync8(dir))
|
|
3293
3273
|
mkdirSync3(dir, { recursive: true });
|
|
3294
3274
|
return dir;
|
|
@@ -3345,13 +3325,13 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3345
3325
|
return toBuffer(buffer);
|
|
3346
3326
|
}
|
|
3347
3327
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
3348
|
-
const metaPath =
|
|
3349
|
-
const dataPath =
|
|
3328
|
+
const metaPath = join7(cacheDir, `${cacheKey}.meta`);
|
|
3329
|
+
const dataPath = join7(cacheDir, `${cacheKey}.data`);
|
|
3350
3330
|
if (!existsSync8(metaPath) || !existsSync8(dataPath))
|
|
3351
3331
|
return null;
|
|
3352
3332
|
try {
|
|
3353
|
-
const meta = JSON.parse(
|
|
3354
|
-
const buffer =
|
|
3333
|
+
const meta = JSON.parse(readFileSync4(metaPath, "utf-8"));
|
|
3334
|
+
const buffer = readFileSync4(dataPath);
|
|
3355
3335
|
return { buffer, meta };
|
|
3356
3336
|
} catch {
|
|
3357
3337
|
return null;
|
|
@@ -3373,8 +3353,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY = 75, OPTIMIZATIO
|
|
|
3373
3353
|
return null;
|
|
3374
3354
|
}
|
|
3375
3355
|
}, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
|
|
3376
|
-
const metaPath =
|
|
3377
|
-
const dataPath =
|
|
3356
|
+
const metaPath = join7(cacheDir, `${cacheKey}.meta`);
|
|
3357
|
+
const dataPath = join7(cacheDir, `${cacheKey}.data`);
|
|
3378
3358
|
writeFileSync4(dataPath, buffer);
|
|
3379
3359
|
writeFileSync4(metaPath, JSON.stringify(meta));
|
|
3380
3360
|
};
|
|
@@ -3466,14 +3446,14 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
3466
3446
|
});
|
|
3467
3447
|
|
|
3468
3448
|
// src/cli/scripts/telemetry.ts
|
|
3469
|
-
import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as
|
|
3449
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "fs";
|
|
3470
3450
|
import { homedir } from "os";
|
|
3471
|
-
import { join as
|
|
3451
|
+
import { join as join8 } from "path";
|
|
3472
3452
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
3473
3453
|
try {
|
|
3474
3454
|
if (!existsSync9(configPath))
|
|
3475
3455
|
return null;
|
|
3476
|
-
const raw =
|
|
3456
|
+
const raw = readFileSync5(configPath, "utf-8");
|
|
3477
3457
|
const config = JSON.parse(raw);
|
|
3478
3458
|
return config;
|
|
3479
3459
|
} catch {
|
|
@@ -3481,19 +3461,19 @@ var configDir, configPath, getTelemetryConfig = () => {
|
|
|
3481
3461
|
}
|
|
3482
3462
|
};
|
|
3483
3463
|
var init_telemetry = __esm(() => {
|
|
3484
|
-
configDir =
|
|
3485
|
-
configPath =
|
|
3464
|
+
configDir = join8(homedir(), ".absolutejs");
|
|
3465
|
+
configPath = join8(configDir, "telemetry.json");
|
|
3486
3466
|
});
|
|
3487
3467
|
|
|
3488
3468
|
// src/cli/telemetryEvent.ts
|
|
3489
|
-
import { existsSync as existsSync10, readFileSync as
|
|
3469
|
+
import { existsSync as existsSync10, readFileSync as readFileSync6 } from "fs";
|
|
3490
3470
|
import { arch, platform } from "os";
|
|
3491
|
-
import { dirname as dirname5, join as
|
|
3471
|
+
import { dirname as dirname5, join as join9, parse } from "path";
|
|
3492
3472
|
var checkCandidate = (candidate) => {
|
|
3493
3473
|
if (!existsSync10(candidate)) {
|
|
3494
3474
|
return null;
|
|
3495
3475
|
}
|
|
3496
|
-
const pkg = JSON.parse(
|
|
3476
|
+
const pkg = JSON.parse(readFileSync6(candidate, "utf-8"));
|
|
3497
3477
|
if (pkg.name === "@absolutejs/absolute") {
|
|
3498
3478
|
const ver = pkg.version;
|
|
3499
3479
|
return ver;
|
|
@@ -3508,7 +3488,7 @@ var checkCandidate = (candidate) => {
|
|
|
3508
3488
|
}, findPackageVersion = () => {
|
|
3509
3489
|
let { dir } = import.meta;
|
|
3510
3490
|
while (dir !== parse(dir).root) {
|
|
3511
|
-
const candidate =
|
|
3491
|
+
const candidate = join9(dir, "package.json");
|
|
3512
3492
|
const version = checkCandidate(candidate);
|
|
3513
3493
|
if (version) {
|
|
3514
3494
|
return version;
|
|
@@ -3800,8 +3780,8 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
3800
3780
|
};
|
|
3801
3781
|
|
|
3802
3782
|
// src/build/angularLinkerPlugin.ts
|
|
3803
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as
|
|
3804
|
-
import { dirname as dirname6, join as
|
|
3783
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync5, readFileSync as readFileSync7, writeFileSync as writeFileSync6 } from "fs";
|
|
3784
|
+
import { dirname as dirname6, join as join10, relative as relative4, resolve as resolve10 } from "path";
|
|
3805
3785
|
import { createHash } from "crypto";
|
|
3806
3786
|
var CACHE_DIR, angularLinkerPlugin;
|
|
3807
3787
|
var init_angularLinkerPlugin = __esm(() => {
|
|
@@ -3824,10 +3804,10 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3824
3804
|
return;
|
|
3825
3805
|
}
|
|
3826
3806
|
const hash = createHash("md5").update(source).digest("hex");
|
|
3827
|
-
const cachePath =
|
|
3807
|
+
const cachePath = join10(CACHE_DIR, `${hash}.js`);
|
|
3828
3808
|
if (existsSync12(cachePath)) {
|
|
3829
3809
|
return {
|
|
3830
|
-
contents:
|
|
3810
|
+
contents: readFileSync7(cachePath, "utf-8"),
|
|
3831
3811
|
loader: "js"
|
|
3832
3812
|
};
|
|
3833
3813
|
}
|
|
@@ -3843,7 +3823,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
3843
3823
|
fileSystem: {
|
|
3844
3824
|
dirname: dirname6,
|
|
3845
3825
|
exists: existsSync12,
|
|
3846
|
-
readFile:
|
|
3826
|
+
readFile: readFileSync7,
|
|
3847
3827
|
relative: relative4,
|
|
3848
3828
|
resolve: resolve10
|
|
3849
3829
|
},
|
|
@@ -3901,7 +3881,7 @@ var init_cleanStaleOutputs = __esm(() => {
|
|
|
3901
3881
|
|
|
3902
3882
|
// src/utils/cleanup.ts
|
|
3903
3883
|
import { rm as rm3 } from "fs/promises";
|
|
3904
|
-
import { join as
|
|
3884
|
+
import { join as join11 } from "path";
|
|
3905
3885
|
var cleanup = async ({
|
|
3906
3886
|
angularDir,
|
|
3907
3887
|
reactDir,
|
|
@@ -3909,19 +3889,19 @@ var cleanup = async ({
|
|
|
3909
3889
|
vueDir
|
|
3910
3890
|
}) => {
|
|
3911
3891
|
await Promise.all([
|
|
3912
|
-
angularDir ? rm3(
|
|
3892
|
+
angularDir ? rm3(join11(angularDir, "generated"), {
|
|
3913
3893
|
force: true,
|
|
3914
3894
|
recursive: true
|
|
3915
3895
|
}) : undefined,
|
|
3916
|
-
reactDir ? rm3(
|
|
3896
|
+
reactDir ? rm3(join11(reactDir, "generated"), {
|
|
3917
3897
|
force: true,
|
|
3918
3898
|
recursive: true
|
|
3919
3899
|
}) : undefined,
|
|
3920
|
-
svelteDir ? rm3(
|
|
3900
|
+
svelteDir ? rm3(join11(svelteDir, "generated"), {
|
|
3921
3901
|
force: true,
|
|
3922
3902
|
recursive: true
|
|
3923
3903
|
}) : undefined,
|
|
3924
|
-
vueDir ? rm3(
|
|
3904
|
+
vueDir ? rm3(join11(vueDir, "generated"), {
|
|
3925
3905
|
force: true,
|
|
3926
3906
|
recursive: true
|
|
3927
3907
|
}) : undefined
|
|
@@ -4101,7 +4081,7 @@ import { existsSync as existsSync13 } from "fs";
|
|
|
4101
4081
|
import { mkdir as mkdir2, stat } from "fs/promises";
|
|
4102
4082
|
import {
|
|
4103
4083
|
dirname as dirname7,
|
|
4104
|
-
join as
|
|
4084
|
+
join as join12,
|
|
4105
4085
|
basename as basename4,
|
|
4106
4086
|
extname as extname5,
|
|
4107
4087
|
resolve as resolve13,
|
|
@@ -4160,14 +4140,14 @@ var resolveDevClientDir2 = () => {
|
|
|
4160
4140
|
`${basePath}.svelte`,
|
|
4161
4141
|
`${basePath}.svelte.ts`,
|
|
4162
4142
|
`${basePath}.svelte.js`,
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4143
|
+
join12(basePath, "index.ts"),
|
|
4144
|
+
join12(basePath, "index.js"),
|
|
4145
|
+
join12(basePath, "index.mjs"),
|
|
4146
|
+
join12(basePath, "index.cjs"),
|
|
4147
|
+
join12(basePath, "index.json"),
|
|
4148
|
+
join12(basePath, "index.svelte"),
|
|
4149
|
+
join12(basePath, "index.svelte.ts"),
|
|
4150
|
+
join12(basePath, "index.svelte.js")
|
|
4171
4151
|
];
|
|
4172
4152
|
const checks = await Promise.all(candidates.map(exists));
|
|
4173
4153
|
return candidates.find((_, index) => checks[index]) ?? null;
|
|
@@ -4205,10 +4185,10 @@ var resolveDevClientDir2 = () => {
|
|
|
4205
4185
|
});
|
|
4206
4186
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false) => {
|
|
4207
4187
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
4208
|
-
const generatedDir =
|
|
4209
|
-
const clientDir =
|
|
4210
|
-
const indexDir =
|
|
4211
|
-
const serverDir =
|
|
4188
|
+
const generatedDir = join12(svelteRoot, "generated");
|
|
4189
|
+
const clientDir = join12(generatedDir, "client");
|
|
4190
|
+
const indexDir = join12(generatedDir, "indexes");
|
|
4191
|
+
const serverDir = join12(generatedDir, "server");
|
|
4212
4192
|
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir2(dir, { recursive: true })));
|
|
4213
4193
|
const dev = env.NODE_ENV !== "production";
|
|
4214
4194
|
const build = async (src) => {
|
|
@@ -4246,8 +4226,8 @@ var resolveDevClientDir2 = () => {
|
|
|
4246
4226
|
const childBuilt = await Promise.all(childSources.map((child) => build(child)));
|
|
4247
4227
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
4248
4228
|
const externalRewrites = new Map;
|
|
4249
|
-
const ssrOutputDir = dirname7(
|
|
4250
|
-
const clientOutputDir = dirname7(
|
|
4229
|
+
const ssrOutputDir = dirname7(join12(serverDir, relDir, `${baseName}.js`));
|
|
4230
|
+
const clientOutputDir = dirname7(join12(clientDir, relDir, `${baseName}.js`));
|
|
4251
4231
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
4252
4232
|
const rawSpec = importPaths[idx];
|
|
4253
4233
|
if (!rawSpec)
|
|
@@ -4313,8 +4293,8 @@ var resolveDevClientDir2 = () => {
|
|
|
4313
4293
|
code += islandMetadataExports;
|
|
4314
4294
|
return code;
|
|
4315
4295
|
};
|
|
4316
|
-
const ssrPath =
|
|
4317
|
-
const clientPath =
|
|
4296
|
+
const ssrPath = join12(serverDir, relDir, `${baseName}.js`);
|
|
4297
|
+
const clientPath = join12(clientDir, relDir, `${baseName}.js`);
|
|
4318
4298
|
await Promise.all([
|
|
4319
4299
|
mkdir2(dirname7(ssrPath), { recursive: true }),
|
|
4320
4300
|
mkdir2(dirname7(clientPath), { recursive: true })
|
|
@@ -4346,7 +4326,7 @@ var resolveDevClientDir2 = () => {
|
|
|
4346
4326
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
4347
4327
|
const relClientDir = dirname7(relative6(clientDir, client));
|
|
4348
4328
|
const name = basename4(client, extname5(client));
|
|
4349
|
-
const indexPath =
|
|
4329
|
+
const indexPath = join12(indexDir, relClientDir, `${name}.js`);
|
|
4350
4330
|
const importRaw = relative6(dirname7(indexPath), client).split(sep2).join("/");
|
|
4351
4331
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
4352
4332
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
@@ -4425,7 +4405,7 @@ if (typeof window !== "undefined") {
|
|
|
4425
4405
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
4426
4406
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
4427
4407
|
const rel = dirname7(relative6(clientDir, client));
|
|
4428
|
-
return
|
|
4408
|
+
return join12(indexDir, rel, basename4(client));
|
|
4429
4409
|
}),
|
|
4430
4410
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
4431
4411
|
};
|
|
@@ -4439,7 +4419,7 @@ var init_compileSvelte = __esm(() => {
|
|
|
4439
4419
|
init_lowerAwaitSlotSyntax();
|
|
4440
4420
|
init_renderToReadableStream();
|
|
4441
4421
|
devClientDir2 = resolveDevClientDir2();
|
|
4442
|
-
hmrClientPath3 =
|
|
4422
|
+
hmrClientPath3 = join12(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
4443
4423
|
persistentCache = new Map;
|
|
4444
4424
|
sourceHashCache = new Map;
|
|
4445
4425
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
@@ -4456,7 +4436,7 @@ __export(exports_compileVue, {
|
|
|
4456
4436
|
});
|
|
4457
4437
|
import { existsSync as existsSync14 } from "fs";
|
|
4458
4438
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
4459
|
-
import { basename as basename5, dirname as dirname8, join as
|
|
4439
|
+
import { basename as basename5, dirname as dirname8, join as join13, relative as relative7, resolve as resolve14 } from "path";
|
|
4460
4440
|
var {file: file2, write: write2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
4461
4441
|
var resolveDevClientDir3 = () => {
|
|
4462
4442
|
const projectRoot = process.cwd();
|
|
@@ -4612,7 +4592,7 @@ var resolveDevClientDir3 = () => {
|
|
|
4612
4592
|
];
|
|
4613
4593
|
let cssOutputPaths = [];
|
|
4614
4594
|
if (isEntryPoint && allCss.length) {
|
|
4615
|
-
const cssOutputFile =
|
|
4595
|
+
const cssOutputFile = join13(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
4616
4596
|
await mkdir3(dirname8(cssOutputFile), { recursive: true });
|
|
4617
4597
|
await write2(cssOutputFile, allCss.join(`
|
|
4618
4598
|
`));
|
|
@@ -4643,8 +4623,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4643
4623
|
};
|
|
4644
4624
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
4645
4625
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
4646
|
-
const clientOutputPath =
|
|
4647
|
-
const serverOutputPath =
|
|
4626
|
+
const clientOutputPath = join13(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
4627
|
+
const serverOutputPath = join13(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
4648
4628
|
const relDir = dirname8(relativeFilePath);
|
|
4649
4629
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
4650
4630
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_, prefix, dots) => {
|
|
@@ -4684,11 +4664,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4684
4664
|
return result;
|
|
4685
4665
|
}, compileVue = async (entryPoints, vueRootDir, isDev = false) => {
|
|
4686
4666
|
const compiler = await import("@vue/compiler-sfc");
|
|
4687
|
-
const generatedDir =
|
|
4688
|
-
const clientOutputDir =
|
|
4689
|
-
const indexOutputDir =
|
|
4690
|
-
const serverOutputDir =
|
|
4691
|
-
const cssOutputDir =
|
|
4667
|
+
const generatedDir = join13(vueRootDir, "generated");
|
|
4668
|
+
const clientOutputDir = join13(generatedDir, "client");
|
|
4669
|
+
const indexOutputDir = join13(generatedDir, "indexes");
|
|
4670
|
+
const serverOutputDir = join13(generatedDir, "server");
|
|
4671
|
+
const cssOutputDir = join13(generatedDir, "compiled");
|
|
4692
4672
|
await Promise.all([
|
|
4693
4673
|
mkdir3(clientOutputDir, { recursive: true }),
|
|
4694
4674
|
mkdir3(indexOutputDir, { recursive: true }),
|
|
@@ -4705,8 +4685,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4705
4685
|
}, buildCache, true, vueRootDir, compiler);
|
|
4706
4686
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
4707
4687
|
const entryBaseName = basename5(entryPath, ".vue");
|
|
4708
|
-
const indexOutputFile =
|
|
4709
|
-
const clientOutputFile =
|
|
4688
|
+
const indexOutputFile = join13(indexOutputDir, `${entryBaseName}.js`);
|
|
4689
|
+
const clientOutputFile = join13(clientOutputDir, relative7(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
4710
4690
|
await mkdir3(dirname8(indexOutputFile), { recursive: true });
|
|
4711
4691
|
const vueHmrImports = isDev ? [
|
|
4712
4692
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
@@ -4835,8 +4815,8 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
4835
4815
|
const sourceCode = await file2(tsPath).text();
|
|
4836
4816
|
const transpiledCode = transpiler3.transformSync(sourceCode);
|
|
4837
4817
|
const relativeJsPath = relative7(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
4838
|
-
const outClientPath =
|
|
4839
|
-
const outServerPath =
|
|
4818
|
+
const outClientPath = join13(clientOutputDir, relativeJsPath);
|
|
4819
|
+
const outServerPath = join13(serverOutputDir, relativeJsPath);
|
|
4840
4820
|
await mkdir3(dirname8(outClientPath), { recursive: true });
|
|
4841
4821
|
await mkdir3(dirname8(outServerPath), { recursive: true });
|
|
4842
4822
|
await write2(outClientPath, transpiledCode);
|
|
@@ -4856,7 +4836,7 @@ var init_compileVue = __esm(() => {
|
|
|
4856
4836
|
init_sourceMetadata();
|
|
4857
4837
|
init_stylePreprocessor();
|
|
4858
4838
|
devClientDir3 = resolveDevClientDir3();
|
|
4859
|
-
hmrClientPath4 =
|
|
4839
|
+
hmrClientPath4 = join13(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
4860
4840
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
4861
4841
|
scriptCache = new Map;
|
|
4862
4842
|
scriptSetupCache = new Map;
|
|
@@ -5335,13 +5315,13 @@ __export(exports_compileAngular, {
|
|
|
5335
5315
|
compileAngularFile: () => compileAngularFile,
|
|
5336
5316
|
compileAngular: () => compileAngular
|
|
5337
5317
|
});
|
|
5338
|
-
import { existsSync as existsSync15, readFileSync as
|
|
5339
|
-
import { join as
|
|
5318
|
+
import { existsSync as existsSync15, readFileSync as readFileSync8, promises as fs } from "fs";
|
|
5319
|
+
import { join as join14, basename as basename6, sep as sep3, dirname as dirname9, resolve as resolve15, relative as relative8 } from "path";
|
|
5340
5320
|
import ts2 from "typescript";
|
|
5341
5321
|
import { createHash as createHash2 } from "crypto";
|
|
5342
5322
|
var computeConfigHash = () => {
|
|
5343
5323
|
try {
|
|
5344
|
-
const content =
|
|
5324
|
+
const content = readFileSync8("./tsconfig.json", "utf-8");
|
|
5345
5325
|
return createHash2("md5").update(content).digest("hex");
|
|
5346
5326
|
} catch {
|
|
5347
5327
|
return "";
|
|
@@ -5398,8 +5378,70 @@ ${registrations}
|
|
|
5398
5378
|
if (fileName.startsWith(outDir))
|
|
5399
5379
|
return fileName.substring(outDir.length + 1);
|
|
5400
5380
|
return fileName;
|
|
5381
|
+
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
5382
|
+
const sourceFile = ts2.createSourceFile(fileName, source, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TS);
|
|
5383
|
+
const specifiers = [];
|
|
5384
|
+
const addSpecifier = (node) => {
|
|
5385
|
+
if (!node || !ts2.isStringLiteralLike(node))
|
|
5386
|
+
return;
|
|
5387
|
+
const specifier = node.text;
|
|
5388
|
+
if (isRelativeModuleSpecifier(specifier))
|
|
5389
|
+
specifiers.push(specifier);
|
|
5390
|
+
};
|
|
5391
|
+
const visit = (node) => {
|
|
5392
|
+
if (ts2.isImportDeclaration(node) || ts2.isExportDeclaration(node)) {
|
|
5393
|
+
addSpecifier(node.moduleSpecifier);
|
|
5394
|
+
} else if (ts2.isCallExpression(node) && node.expression.kind === ts2.SyntaxKind.ImportKeyword) {
|
|
5395
|
+
addSpecifier(node.arguments[0]);
|
|
5396
|
+
}
|
|
5397
|
+
ts2.forEachChild(node, visit);
|
|
5398
|
+
};
|
|
5399
|
+
visit(sourceFile);
|
|
5400
|
+
return specifiers;
|
|
5401
|
+
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
5402
|
+
if (!isRelativeModuleSpecifier(specifier))
|
|
5403
|
+
return null;
|
|
5404
|
+
const basePath = resolve15(dirname9(fromFile), specifier);
|
|
5405
|
+
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
5406
|
+
`${basePath}.ts`,
|
|
5407
|
+
`${basePath}.tsx`,
|
|
5408
|
+
`${basePath}.mts`,
|
|
5409
|
+
`${basePath}.cts`,
|
|
5410
|
+
join14(basePath, "index.ts"),
|
|
5411
|
+
join14(basePath, "index.tsx"),
|
|
5412
|
+
join14(basePath, "index.mts"),
|
|
5413
|
+
join14(basePath, "index.cts")
|
|
5414
|
+
];
|
|
5415
|
+
return candidates.map((candidate) => resolve15(candidate)).find((candidate) => existsSync15(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
5416
|
+
}, readFileForAotTransform = async (fileName, readFile4) => {
|
|
5417
|
+
const hostSource = readFile4?.(fileName);
|
|
5418
|
+
if (typeof hostSource === "string")
|
|
5419
|
+
return hostSource;
|
|
5420
|
+
return fs.readFile(fileName, "utf-8");
|
|
5421
|
+
}, precomputeAotResourceTransforms = async (inputPath, readFile4) => {
|
|
5422
|
+
const transformedSources = new Map;
|
|
5423
|
+
const visited = new Set;
|
|
5424
|
+
const transformFile = async (filePath) => {
|
|
5425
|
+
const resolvedPath = resolve15(filePath);
|
|
5426
|
+
if (visited.has(resolvedPath))
|
|
5427
|
+
return;
|
|
5428
|
+
visited.add(resolvedPath);
|
|
5429
|
+
if (!existsSync15(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
5430
|
+
return;
|
|
5431
|
+
const source = await readFileForAotTransform(resolvedPath, readFile4);
|
|
5432
|
+
const transformed = await inlineResources(source, dirname9(resolvedPath));
|
|
5433
|
+
transformedSources.set(resolvedPath, transformed.source);
|
|
5434
|
+
const imports = extractLocalImportSpecifiers(source, resolvedPath);
|
|
5435
|
+
await Promise.all(imports.map(async (specifier) => {
|
|
5436
|
+
const resolvedImport = resolveLocalTsImport(resolvedPath, specifier);
|
|
5437
|
+
if (resolvedImport)
|
|
5438
|
+
await transformFile(resolvedImport);
|
|
5439
|
+
}));
|
|
5440
|
+
};
|
|
5441
|
+
await transformFile(inputPath);
|
|
5442
|
+
return transformedSources;
|
|
5401
5443
|
}, compileAngularFile = async (inputPath, outDir) => {
|
|
5402
|
-
const islandMetadataExports = buildIslandMetadataExports(
|
|
5444
|
+
const islandMetadataExports = buildIslandMetadataExports(readFileSync8(inputPath, "utf-8"));
|
|
5403
5445
|
const { readConfiguration, performCompilation, EmitFlags } = await import("@angular/compiler-cli");
|
|
5404
5446
|
const configHash = computeConfigHash();
|
|
5405
5447
|
const cached = globalThis.__angularCompilerCache;
|
|
@@ -5447,7 +5489,7 @@ ${registrations}
|
|
|
5447
5489
|
const originalGetSourceFile = host.getSourceFile;
|
|
5448
5490
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
5449
5491
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
5450
|
-
const resolvedPath =
|
|
5492
|
+
const resolvedPath = join14(tsLibDir, fileName);
|
|
5451
5493
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
5452
5494
|
}
|
|
5453
5495
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
@@ -5467,7 +5509,7 @@ ${registrations}
|
|
|
5467
5509
|
emitted[relativePath] = text;
|
|
5468
5510
|
};
|
|
5469
5511
|
const originalReadFile = host.readFile;
|
|
5470
|
-
const
|
|
5512
|
+
const aotTransformedSources = await precomputeAotResourceTransforms(inputPath, originalReadFile?.bind(host));
|
|
5471
5513
|
host.readFile = (fileName) => {
|
|
5472
5514
|
const source = originalReadFile ? originalReadFile.call(host, fileName) : undefined;
|
|
5473
5515
|
if (typeof source !== "string")
|
|
@@ -5476,12 +5518,7 @@ ${registrations}
|
|
|
5476
5518
|
return source;
|
|
5477
5519
|
}
|
|
5478
5520
|
const resolvedPath = resolve15(fileName);
|
|
5479
|
-
|
|
5480
|
-
if (cached2 !== undefined)
|
|
5481
|
-
return cached2;
|
|
5482
|
-
const transformed = inlineResourcesSync(source, dirname9(resolvedPath)).source;
|
|
5483
|
-
aotTransformCache.set(resolvedPath, transformed);
|
|
5484
|
-
return transformed;
|
|
5521
|
+
return aotTransformedSources.get(resolvedPath) ?? source;
|
|
5485
5522
|
};
|
|
5486
5523
|
const originalGetSourceFileForCompile = host.getSourceFile;
|
|
5487
5524
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
@@ -5505,7 +5542,7 @@ ${registrations}
|
|
|
5505
5542
|
}
|
|
5506
5543
|
throwOnCompilationErrors(diagnostics);
|
|
5507
5544
|
const entries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => {
|
|
5508
|
-
const target =
|
|
5545
|
+
const target = join14(outDir, fileName);
|
|
5509
5546
|
let processedContent = content.replace(/from\s+(['"])(\.\.?\/[^'"]+)(\1)/g, (match, quote, path) => {
|
|
5510
5547
|
if (!path.match(/\.(js|ts|mjs|cjs)$/)) {
|
|
5511
5548
|
return `from ${quote}${path}.js${quote}`;
|
|
@@ -5661,7 +5698,7 @@ ${fields}
|
|
|
5661
5698
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
5662
5699
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5663
5700
|
if (templateUrlMatch?.[1]) {
|
|
5664
|
-
const templatePath =
|
|
5701
|
+
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
5665
5702
|
if (!existsSync15(templatePath)) {
|
|
5666
5703
|
return { deferSlots: [], source };
|
|
5667
5704
|
}
|
|
@@ -5692,11 +5729,11 @@ ${fields}
|
|
|
5692
5729
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
5693
5730
|
const templateUrlMatch = source.match(/templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5694
5731
|
if (templateUrlMatch?.[1]) {
|
|
5695
|
-
const templatePath =
|
|
5732
|
+
const templatePath = join14(fileDir, templateUrlMatch[1]);
|
|
5696
5733
|
if (!existsSync15(templatePath)) {
|
|
5697
5734
|
return { deferSlots: [], source };
|
|
5698
5735
|
}
|
|
5699
|
-
const templateRaw2 =
|
|
5736
|
+
const templateRaw2 = readFileSync8(templatePath, "utf-8");
|
|
5700
5737
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
5701
5738
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
5702
5739
|
const replacedSource2 = source.replace(/templateUrl\s*:\s*['"][^'"]+['"]/, `template: \`${escaped2}\``);
|
|
@@ -5720,42 +5757,6 @@ ${fields}
|
|
|
5720
5757
|
deferSlots: lowered.slots,
|
|
5721
5758
|
source: injectDeferSlotFields(replacedSource, lowered.slots, resolveAngularDeferImportSpecifier())
|
|
5722
5759
|
};
|
|
5723
|
-
}, readAndEscapeFileSync = (filePath) => {
|
|
5724
|
-
if (!existsSync15(filePath))
|
|
5725
|
-
return null;
|
|
5726
|
-
const content = compileStyleFileIfNeededSync(filePath);
|
|
5727
|
-
return escapeTemplateContent(content);
|
|
5728
|
-
}, inlineStyleUrlsSync = (source, fileDir) => {
|
|
5729
|
-
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
5730
|
-
if (!styleUrlsMatch?.[1])
|
|
5731
|
-
return source;
|
|
5732
|
-
const urlMatches = styleUrlsMatch[1].match(/['"]([^'"]+)['"]/g);
|
|
5733
|
-
if (!urlMatches)
|
|
5734
|
-
return source;
|
|
5735
|
-
const inlinedStyles = urlMatches.map((urlMatch) => {
|
|
5736
|
-
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
5737
|
-
return readAndEscapeFileSync(join13(fileDir, styleUrl));
|
|
5738
|
-
}).filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
5739
|
-
if (inlinedStyles.length === 0)
|
|
5740
|
-
return source;
|
|
5741
|
-
return source.replace(/styleUrls\s*:\s*\[[^\]]+\]/, `styles: [${inlinedStyles.join(", ")}]`);
|
|
5742
|
-
}, inlineSingleStyleUrlSync = (source, fileDir) => {
|
|
5743
|
-
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5744
|
-
if (!styleUrlMatch?.[1])
|
|
5745
|
-
return source;
|
|
5746
|
-
const escaped = readAndEscapeFileSync(join13(fileDir, styleUrlMatch[1]));
|
|
5747
|
-
if (!escaped)
|
|
5748
|
-
return source;
|
|
5749
|
-
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
5750
|
-
}, inlineResourcesSync = (source, fileDir) => {
|
|
5751
|
-
const inlinedTemplate = inlineTemplateAndLowerDeferSync(source, fileDir);
|
|
5752
|
-
let result = inlinedTemplate.source;
|
|
5753
|
-
result = inlineStyleUrlsSync(result, fileDir);
|
|
5754
|
-
result = inlineSingleStyleUrlSync(result, fileDir);
|
|
5755
|
-
return {
|
|
5756
|
-
deferSlots: inlinedTemplate.deferSlots,
|
|
5757
|
-
source: result
|
|
5758
|
-
};
|
|
5759
5760
|
}, inlineStyleUrls = async (source, fileDir) => {
|
|
5760
5761
|
const styleUrlsMatch = source.match(/styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
5761
5762
|
if (!styleUrlsMatch?.[1])
|
|
@@ -5765,7 +5766,7 @@ ${fields}
|
|
|
5765
5766
|
return source;
|
|
5766
5767
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
5767
5768
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
5768
|
-
return readAndEscapeFile(
|
|
5769
|
+
return readAndEscapeFile(join14(fileDir, styleUrl));
|
|
5769
5770
|
});
|
|
5770
5771
|
const results = await Promise.all(stylePromises);
|
|
5771
5772
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -5776,7 +5777,7 @@ ${fields}
|
|
|
5776
5777
|
const styleUrlMatch = source.match(/styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
5777
5778
|
if (!styleUrlMatch?.[1])
|
|
5778
5779
|
return source;
|
|
5779
|
-
const escaped = await readAndEscapeFile(
|
|
5780
|
+
const escaped = await readAndEscapeFile(join14(fileDir, styleUrlMatch[1]));
|
|
5780
5781
|
if (!escaped)
|
|
5781
5782
|
return source;
|
|
5782
5783
|
return source.replace(/styleUrl\s*:\s*['"][^'"]+['"]/, `styles: [\`${escaped}\`]`);
|
|
@@ -5851,8 +5852,8 @@ ${fields}
|
|
|
5851
5852
|
const inputDir = dirname9(actualPath);
|
|
5852
5853
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
5853
5854
|
const fileBase = basename6(actualPath).replace(/\.ts$/, ".js");
|
|
5854
|
-
const targetDir =
|
|
5855
|
-
const targetPath =
|
|
5855
|
+
const targetDir = join14(outDir, relativeDir);
|
|
5856
|
+
const targetPath = join14(targetDir, fileBase);
|
|
5856
5857
|
const localImports = [];
|
|
5857
5858
|
const fromRegex = /(?:from|import)\s+['"](\.\.?\/[^'"]+)['"]/g;
|
|
5858
5859
|
const dynamicImportRegex = /import\(\s*['"](\.\.?\/[^'"]+)['"]\s*\)/g;
|
|
@@ -5885,13 +5886,13 @@ ${fields}
|
|
|
5885
5886
|
await transpileFile(inputPath);
|
|
5886
5887
|
return allOutputs;
|
|
5887
5888
|
}, compileAngular = async (entryPoints, outRoot, hmr = false) => {
|
|
5888
|
-
const compiledParent =
|
|
5889
|
+
const compiledParent = join14(outRoot, "generated");
|
|
5889
5890
|
if (entryPoints.length === 0) {
|
|
5890
5891
|
const emptyPaths = [];
|
|
5891
5892
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
5892
5893
|
}
|
|
5893
5894
|
const compiledRoot = compiledParent;
|
|
5894
|
-
const indexesDir =
|
|
5895
|
+
const indexesDir = join14(compiledParent, "indexes");
|
|
5895
5896
|
await fs.mkdir(indexesDir, { recursive: true });
|
|
5896
5897
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
5897
5898
|
const resolvedEntry = resolve15(entry);
|
|
@@ -5901,9 +5902,9 @@ ${fields}
|
|
|
5901
5902
|
const fileBase = basename6(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
5902
5903
|
const jsName = `${fileBase}.js`;
|
|
5903
5904
|
const compiledFallbackPaths = [
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5905
|
+
join14(compiledRoot, relativeEntry),
|
|
5906
|
+
join14(compiledRoot, "pages", jsName),
|
|
5907
|
+
join14(compiledRoot, jsName)
|
|
5907
5908
|
].map((file3) => resolve15(file3));
|
|
5908
5909
|
const resolveRawServerFile = (candidatePaths) => {
|
|
5909
5910
|
const normalizedCandidates = [
|
|
@@ -5937,7 +5938,7 @@ ${fields}
|
|
|
5937
5938
|
const componentClassName = `${toPascal(fileBase)}Component`;
|
|
5938
5939
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
5939
5940
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
5940
|
-
const clientFile =
|
|
5941
|
+
const clientFile = join14(indexesDir, jsName);
|
|
5941
5942
|
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync15(clientFile)) {
|
|
5942
5943
|
return {
|
|
5943
5944
|
clientPath: clientFile,
|
|
@@ -6125,8 +6126,8 @@ var init_compileAngular = __esm(() => {
|
|
|
6125
6126
|
init_lowerDeferSyntax();
|
|
6126
6127
|
init_stylePreprocessor();
|
|
6127
6128
|
devClientDir4 = resolveDevClientDir4();
|
|
6128
|
-
hmrClientPath5 =
|
|
6129
|
-
hmrRuntimePath =
|
|
6129
|
+
hmrClientPath5 = join14(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
6130
|
+
hmrRuntimePath = join14(devClientDir4, "handlers", "angularRuntime.ts").replace(/\\/g, "/");
|
|
6130
6131
|
jitContentCache = new Map;
|
|
6131
6132
|
wrapperOutputCache = new Map;
|
|
6132
6133
|
});
|
|
@@ -6138,7 +6139,7 @@ __export(exports_buildReactVendor, {
|
|
|
6138
6139
|
buildReactVendor: () => buildReactVendor
|
|
6139
6140
|
});
|
|
6140
6141
|
import { existsSync as existsSync16, mkdirSync as mkdirSync6 } from "fs";
|
|
6141
|
-
import { join as
|
|
6142
|
+
import { join as join15, resolve as resolve16 } from "path";
|
|
6142
6143
|
import { rm as rm4 } from "fs/promises";
|
|
6143
6144
|
var {build: bunBuild2 } = globalThis.Bun;
|
|
6144
6145
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
@@ -6192,14 +6193,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
6192
6193
|
`)}
|
|
6193
6194
|
`;
|
|
6194
6195
|
}, buildReactVendor = async (buildDir) => {
|
|
6195
|
-
const vendorDir =
|
|
6196
|
+
const vendorDir = join15(buildDir, "react", "vendor");
|
|
6196
6197
|
mkdirSync6(vendorDir, { recursive: true });
|
|
6197
|
-
const tmpDir =
|
|
6198
|
+
const tmpDir = join15(buildDir, "_vendor_tmp");
|
|
6198
6199
|
mkdirSync6(tmpDir, { recursive: true });
|
|
6199
6200
|
const specifiers = resolveVendorSpecifiers();
|
|
6200
6201
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
6201
6202
|
const safeName = toSafeFileName(specifier);
|
|
6202
|
-
const entryPath =
|
|
6203
|
+
const entryPath = join15(tmpDir, `${safeName}.ts`);
|
|
6203
6204
|
const source = await generateEntrySource(specifier);
|
|
6204
6205
|
await Bun.write(entryPath, source);
|
|
6205
6206
|
return entryPath;
|
|
@@ -6237,17 +6238,17 @@ __export(exports_buildAngularVendor, {
|
|
|
6237
6238
|
buildAngularVendor: () => buildAngularVendor
|
|
6238
6239
|
});
|
|
6239
6240
|
import { mkdirSync as mkdirSync7 } from "fs";
|
|
6240
|
-
import { join as
|
|
6241
|
+
import { join as join16 } from "path";
|
|
6241
6242
|
import { rm as rm5 } from "fs/promises";
|
|
6242
6243
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
6243
6244
|
var angularSpecifiers, toSafeFileName2 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), buildAngularVendor = async (buildDir) => {
|
|
6244
|
-
const vendorDir =
|
|
6245
|
+
const vendorDir = join16(buildDir, "angular", "vendor");
|
|
6245
6246
|
mkdirSync7(vendorDir, { recursive: true });
|
|
6246
|
-
const tmpDir =
|
|
6247
|
+
const tmpDir = join16(buildDir, "_angular_vendor_tmp");
|
|
6247
6248
|
mkdirSync7(tmpDir, { recursive: true });
|
|
6248
6249
|
const entrypoints = await Promise.all(angularSpecifiers.map(async (specifier) => {
|
|
6249
6250
|
const safeName = toSafeFileName2(specifier);
|
|
6250
|
-
const entryPath =
|
|
6251
|
+
const entryPath = join16(tmpDir, `${safeName}.ts`);
|
|
6251
6252
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
6252
6253
|
`);
|
|
6253
6254
|
return entryPath;
|
|
@@ -6292,17 +6293,17 @@ __export(exports_buildVueVendor, {
|
|
|
6292
6293
|
buildVueVendor: () => buildVueVendor
|
|
6293
6294
|
});
|
|
6294
6295
|
import { mkdirSync as mkdirSync8 } from "fs";
|
|
6295
|
-
import { join as
|
|
6296
|
+
import { join as join17 } from "path";
|
|
6296
6297
|
import { rm as rm6 } from "fs/promises";
|
|
6297
6298
|
var {build: bunBuild4 } = globalThis.Bun;
|
|
6298
6299
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
6299
|
-
const vendorDir =
|
|
6300
|
+
const vendorDir = join17(buildDir, "vue", "vendor");
|
|
6300
6301
|
mkdirSync8(vendorDir, { recursive: true });
|
|
6301
|
-
const tmpDir =
|
|
6302
|
+
const tmpDir = join17(buildDir, "_vue_vendor_tmp");
|
|
6302
6303
|
mkdirSync8(tmpDir, { recursive: true });
|
|
6303
6304
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
6304
6305
|
const safeName = toSafeFileName3(specifier);
|
|
6305
|
-
const entryPath =
|
|
6306
|
+
const entryPath = join17(tmpDir, `${safeName}.ts`);
|
|
6306
6307
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
6307
6308
|
`);
|
|
6308
6309
|
return entryPath;
|
|
@@ -6327,11 +6328,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
6327
6328
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
6328
6329
|
return;
|
|
6329
6330
|
}
|
|
6330
|
-
const { readFileSync:
|
|
6331
|
+
const { readFileSync: readFileSync9, writeFileSync: writeFileSync7, readdirSync } = await import("fs");
|
|
6331
6332
|
const files = readdirSync(vendorDir).filter((f) => f.endsWith(".js"));
|
|
6332
6333
|
for (const file3 of files) {
|
|
6333
|
-
const filePath =
|
|
6334
|
-
const content =
|
|
6334
|
+
const filePath = join17(vendorDir, file3);
|
|
6335
|
+
const content = readFileSync9(filePath, "utf-8");
|
|
6335
6336
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
6336
6337
|
continue;
|
|
6337
6338
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -6357,7 +6358,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
6357
6358
|
buildSvelteVendor: () => buildSvelteVendor
|
|
6358
6359
|
});
|
|
6359
6360
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
6360
|
-
import { join as
|
|
6361
|
+
import { join as join18 } from "path";
|
|
6361
6362
|
import { rm as rm7 } from "fs/promises";
|
|
6362
6363
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
6363
6364
|
var svelteSpecifiers, isResolvable2 = (specifier) => {
|
|
@@ -6371,13 +6372,13 @@ var svelteSpecifiers, isResolvable2 = (specifier) => {
|
|
|
6371
6372
|
const specifiers = resolveVendorSpecifiers2();
|
|
6372
6373
|
if (specifiers.length === 0)
|
|
6373
6374
|
return;
|
|
6374
|
-
const vendorDir =
|
|
6375
|
+
const vendorDir = join18(buildDir, "svelte", "vendor");
|
|
6375
6376
|
mkdirSync9(vendorDir, { recursive: true });
|
|
6376
|
-
const tmpDir =
|
|
6377
|
+
const tmpDir = join18(buildDir, "_svelte_vendor_tmp");
|
|
6377
6378
|
mkdirSync9(tmpDir, { recursive: true });
|
|
6378
6379
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
6379
6380
|
const safeName = toSafeFileName4(specifier);
|
|
6380
|
-
const entryPath =
|
|
6381
|
+
const entryPath = join18(tmpDir, `${safeName}.ts`);
|
|
6381
6382
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
6382
6383
|
`);
|
|
6383
6384
|
return entryPath;
|
|
@@ -6456,12 +6457,12 @@ import {
|
|
|
6456
6457
|
cpSync,
|
|
6457
6458
|
existsSync as existsSync17,
|
|
6458
6459
|
mkdirSync as mkdirSync10,
|
|
6459
|
-
readFileSync as
|
|
6460
|
+
readFileSync as readFileSync9,
|
|
6460
6461
|
rmSync as rmSync2,
|
|
6461
6462
|
statSync,
|
|
6462
6463
|
writeFileSync as writeFileSync7
|
|
6463
6464
|
} from "fs";
|
|
6464
|
-
import { basename as basename7, dirname as dirname10, join as
|
|
6465
|
+
import { basename as basename7, dirname as dirname10, join as join19, relative as relative9, resolve as resolve17 } from "path";
|
|
6465
6466
|
import { cwd, env as env2, exit } from "process";
|
|
6466
6467
|
var {build: bunBuild6, Glob: Glob6 } = globalThis.Bun;
|
|
6467
6468
|
var isDev, collectConventionSourceFiles = (entry) => {
|
|
@@ -6536,8 +6537,8 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6536
6537
|
mkdirSync10(htmxDestDir, { recursive: true });
|
|
6537
6538
|
const glob = new Glob6("htmx*.min.js");
|
|
6538
6539
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
6539
|
-
const src =
|
|
6540
|
-
const dest =
|
|
6540
|
+
const src = join19(htmxDir, relPath);
|
|
6541
|
+
const dest = join19(htmxDestDir, "htmx.min.js");
|
|
6541
6542
|
copyFileSync(src, dest);
|
|
6542
6543
|
return;
|
|
6543
6544
|
}
|
|
@@ -6577,7 +6578,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6577
6578
|
addWorkerPathIfExists(file3, relPath, workerPaths);
|
|
6578
6579
|
}
|
|
6579
6580
|
}, collectWorkerPathsFromFile = (file3, patterns, workerPaths) => {
|
|
6580
|
-
const content =
|
|
6581
|
+
const content = readFileSync9(file3, "utf-8");
|
|
6581
6582
|
for (const pattern of patterns) {
|
|
6582
6583
|
collectWorkerPathsFromContent(content, pattern, file3, workerPaths);
|
|
6583
6584
|
}
|
|
@@ -6610,7 +6611,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6610
6611
|
vuePagesPath
|
|
6611
6612
|
}) => {
|
|
6612
6613
|
const { readdirSync: readDir } = await import("fs");
|
|
6613
|
-
const devIndexDir =
|
|
6614
|
+
const devIndexDir = join19(buildPath, "_src_indexes");
|
|
6614
6615
|
mkdirSync10(devIndexDir, { recursive: true });
|
|
6615
6616
|
if (reactIndexesPath && reactPagesPath) {
|
|
6616
6617
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -6628,35 +6629,35 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6628
6629
|
const indexFiles = readDir(reactIndexesPath).filter((file3) => file3.endsWith(".tsx"));
|
|
6629
6630
|
const pagesRel = relative9(process.cwd(), resolve17(reactPagesPath)).replace(/\\/g, "/");
|
|
6630
6631
|
for (const file3 of indexFiles) {
|
|
6631
|
-
let content =
|
|
6632
|
+
let content = readFileSync9(join19(reactIndexesPath, file3), "utf-8");
|
|
6632
6633
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
6633
|
-
writeFileSync7(
|
|
6634
|
+
writeFileSync7(join19(devIndexDir, file3), content);
|
|
6634
6635
|
}
|
|
6635
6636
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
6636
|
-
const svelteIndexDir =
|
|
6637
|
+
const svelteIndexDir = join19(svelteDir, "generated", "indexes");
|
|
6637
6638
|
const sveltePageEntries = svelteEntries.filter((file3) => resolve17(file3).startsWith(resolve17(sveltePagesPath)));
|
|
6638
6639
|
for (const entry of sveltePageEntries) {
|
|
6639
6640
|
const name = basename7(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
6640
|
-
const indexFile =
|
|
6641
|
+
const indexFile = join19(svelteIndexDir, "pages", `${name}.js`);
|
|
6641
6642
|
if (!existsSync17(indexFile))
|
|
6642
6643
|
continue;
|
|
6643
|
-
let content =
|
|
6644
|
+
let content = readFileSync9(indexFile, "utf-8");
|
|
6644
6645
|
const srcRel = relative9(process.cwd(), resolve17(entry)).replace(/\\/g, "/");
|
|
6645
6646
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
6646
|
-
writeFileSync7(
|
|
6647
|
+
writeFileSync7(join19(devIndexDir, `${name}.svelte.js`), content);
|
|
6647
6648
|
}
|
|
6648
6649
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
6649
|
-
const vueIndexDir =
|
|
6650
|
+
const vueIndexDir = join19(vueDir, "generated", "indexes");
|
|
6650
6651
|
const vuePageEntries = vueEntries.filter((file3) => resolve17(file3).startsWith(resolve17(vuePagesPath)));
|
|
6651
6652
|
for (const entry of vuePageEntries) {
|
|
6652
6653
|
const name = basename7(entry, ".vue");
|
|
6653
|
-
const indexFile =
|
|
6654
|
+
const indexFile = join19(vueIndexDir, `${name}.js`);
|
|
6654
6655
|
if (!existsSync17(indexFile))
|
|
6655
6656
|
continue;
|
|
6656
|
-
let content =
|
|
6657
|
+
let content = readFileSync9(indexFile, "utf-8");
|
|
6657
6658
|
const srcRel = relative9(process.cwd(), resolve17(entry)).replace(/\\/g, "/");
|
|
6658
6659
|
content = content.replace(/import\s+Comp\s+from\s+['"]([^'"]+)['"]/, `import Comp from "/@src/${srcRel}"`);
|
|
6659
|
-
writeFileSync7(
|
|
6660
|
+
writeFileSync7(join19(devIndexDir, `${name}.vue.js`), content);
|
|
6660
6661
|
}
|
|
6661
6662
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
6662
6663
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -6704,7 +6705,7 @@ var isDev, collectConventionSourceFiles = (entry) => {
|
|
|
6704
6705
|
}
|
|
6705
6706
|
return result;
|
|
6706
6707
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
6707
|
-
let content =
|
|
6708
|
+
let content = readFileSync9(outputPath, "utf-8");
|
|
6708
6709
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
6709
6710
|
const useNames = [];
|
|
6710
6711
|
let match;
|
|
@@ -6754,7 +6755,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6754
6755
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
6755
6756
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
6756
6757
|
for (const outputPath of outputPaths) {
|
|
6757
|
-
let content =
|
|
6758
|
+
let content = readFileSync9(outputPath, "utf-8");
|
|
6758
6759
|
let changed = false;
|
|
6759
6760
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
6760
6761
|
const targetName = basename7(relPath);
|
|
@@ -6804,14 +6805,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6804
6805
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
6805
6806
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
6806
6807
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
6807
|
-
const reactIndexesPath = reactDir &&
|
|
6808
|
-
const reactPagesPath = reactDir &&
|
|
6809
|
-
const htmlPagesPath = htmlDir &&
|
|
6810
|
-
const htmlScriptsPath = htmlDir &&
|
|
6811
|
-
const sveltePagesPath = svelteDir &&
|
|
6812
|
-
const vuePagesPath = vueDir &&
|
|
6813
|
-
const htmxPagesPath = htmxDir &&
|
|
6814
|
-
const angularPagesPath = angularDir &&
|
|
6808
|
+
const reactIndexesPath = reactDir && join19(reactDir, "generated", "indexes");
|
|
6809
|
+
const reactPagesPath = reactDir && join19(reactDir, "pages");
|
|
6810
|
+
const htmlPagesPath = htmlDir && join19(htmlDir, "pages");
|
|
6811
|
+
const htmlScriptsPath = htmlDir && join19(htmlDir, "scripts");
|
|
6812
|
+
const sveltePagesPath = svelteDir && join19(svelteDir, "pages");
|
|
6813
|
+
const vuePagesPath = vueDir && join19(vueDir, "pages");
|
|
6814
|
+
const htmxPagesPath = htmxDir && join19(htmxDir, "pages");
|
|
6815
|
+
const angularPagesPath = angularDir && join19(angularDir, "pages");
|
|
6815
6816
|
const frontends = [
|
|
6816
6817
|
reactDir,
|
|
6817
6818
|
htmlDir,
|
|
@@ -6848,12 +6849,12 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6848
6849
|
if (svelteDir)
|
|
6849
6850
|
serverDirMap.push({
|
|
6850
6851
|
dir: svelteDir,
|
|
6851
|
-
subdir:
|
|
6852
|
+
subdir: join19("generated", "server")
|
|
6852
6853
|
});
|
|
6853
6854
|
if (vueDir)
|
|
6854
6855
|
serverDirMap.push({
|
|
6855
6856
|
dir: vueDir,
|
|
6856
|
-
subdir:
|
|
6857
|
+
subdir: join19("generated", "server")
|
|
6857
6858
|
});
|
|
6858
6859
|
if (angularDir)
|
|
6859
6860
|
serverDirMap.push({ dir: angularDir, subdir: "generated" });
|
|
@@ -6863,8 +6864,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6863
6864
|
const [firstEntry] = serverDirMap;
|
|
6864
6865
|
if (!firstEntry)
|
|
6865
6866
|
throw new Error("Expected at least one server directory entry");
|
|
6866
|
-
serverRoot =
|
|
6867
|
-
serverOutDir =
|
|
6867
|
+
serverRoot = join19(firstEntry.dir, firstEntry.subdir);
|
|
6868
|
+
serverOutDir = join19(buildPath, basename7(firstEntry.dir));
|
|
6868
6869
|
} else if (serverDirMap.length > 1) {
|
|
6869
6870
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
6870
6871
|
serverOutDir = buildPath;
|
|
@@ -6892,7 +6893,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6892
6893
|
await generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr);
|
|
6893
6894
|
}
|
|
6894
6895
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/assets/")))) {
|
|
6895
|
-
cpSync(assetsPath,
|
|
6896
|
+
cpSync(assetsPath, join19(buildPath, "assets"), {
|
|
6896
6897
|
force: true,
|
|
6897
6898
|
recursive: true
|
|
6898
6899
|
});
|
|
@@ -6906,7 +6907,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6906
6907
|
} catch {
|
|
6907
6908
|
binPath = "tailwindcss";
|
|
6908
6909
|
}
|
|
6909
|
-
const proc = Bun.spawn(["bun", binPath, "-i", input, "-o",
|
|
6910
|
+
const proc = Bun.spawn(["bun", binPath, "-i", input, "-o", join19(buildPath, output)], { stderr: "pipe", stdout: "pipe" });
|
|
6910
6911
|
await proc.exited;
|
|
6911
6912
|
};
|
|
6912
6913
|
const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some(isStylePath)) ? compileTailwind(tailwind.input, tailwind.output) : undefined;
|
|
@@ -6953,7 +6954,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
6953
6954
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
6954
6955
|
if (entry.startsWith(resolve17(reactIndexesPath))) {
|
|
6955
6956
|
const pageName = basename7(entry, ".tsx");
|
|
6956
|
-
return
|
|
6957
|
+
return join19(reactPagesPath, `${pageName}.tsx`);
|
|
6957
6958
|
}
|
|
6958
6959
|
return null;
|
|
6959
6960
|
}) : allReactEntries;
|
|
@@ -7040,11 +7041,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7040
7041
|
vueConventionSources.length > 0 && vueDir ? Promise.resolve().then(() => (init_compileVue(), exports_compileVue)).then((mod) => mod.compileVue(vueConventionSources, vueDir, false)) : { vueServerPaths: emptyStringArray }
|
|
7041
7042
|
]);
|
|
7042
7043
|
const copyConventionFiles = (framework, sources, compiledPaths) => {
|
|
7043
|
-
const destDir =
|
|
7044
|
+
const destDir = join19(buildPath, "conventions", framework);
|
|
7044
7045
|
mkdirSync10(destDir, { recursive: true });
|
|
7045
7046
|
const destPaths = [];
|
|
7046
7047
|
for (const compiledPath of compiledPaths) {
|
|
7047
|
-
const dest =
|
|
7048
|
+
const dest = join19(destDir, basename7(compiledPath));
|
|
7048
7049
|
copyFileSync(compiledPath, dest);
|
|
7049
7050
|
destPaths.push(dest);
|
|
7050
7051
|
}
|
|
@@ -7090,7 +7091,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7090
7091
|
}
|
|
7091
7092
|
}) : {
|
|
7092
7093
|
entries: [],
|
|
7093
|
-
generatedRoot:
|
|
7094
|
+
generatedRoot: join19(buildPath, "_island_entries")
|
|
7094
7095
|
};
|
|
7095
7096
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
7096
7097
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -7125,7 +7126,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7125
7126
|
return {};
|
|
7126
7127
|
}
|
|
7127
7128
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
7128
|
-
const refreshEntry =
|
|
7129
|
+
const refreshEntry = join19(reactIndexesPath, "_refresh.tsx");
|
|
7129
7130
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
7130
7131
|
reactClientEntryPoints.push(refreshEntry);
|
|
7131
7132
|
}
|
|
@@ -7180,19 +7181,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7180
7181
|
throw: false
|
|
7181
7182
|
} : undefined;
|
|
7182
7183
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
7183
|
-
rmSync2(
|
|
7184
|
+
rmSync2(join19(buildPath, "react", "generated", "indexes"), {
|
|
7184
7185
|
force: true,
|
|
7185
7186
|
recursive: true
|
|
7186
7187
|
});
|
|
7187
7188
|
}
|
|
7188
7189
|
if (angularDir && angularClientPaths.length > 0) {
|
|
7189
|
-
rmSync2(
|
|
7190
|
+
rmSync2(join19(buildPath, "angular", "indexes"), {
|
|
7190
7191
|
force: true,
|
|
7191
7192
|
recursive: true
|
|
7192
7193
|
});
|
|
7193
7194
|
}
|
|
7194
7195
|
if (islandClientEntryPoints.length > 0) {
|
|
7195
|
-
rmSync2(
|
|
7196
|
+
rmSync2(join19(buildPath, "islands"), {
|
|
7196
7197
|
force: true,
|
|
7197
7198
|
recursive: true
|
|
7198
7199
|
});
|
|
@@ -7278,7 +7279,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7278
7279
|
globalCssEntries.length > 0 ? bunBuild6({
|
|
7279
7280
|
entrypoints: globalCssEntries,
|
|
7280
7281
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
7281
|
-
outdir: stylesDir ?
|
|
7282
|
+
outdir: stylesDir ? join19(buildPath, basename7(stylesDir)) : buildPath,
|
|
7282
7283
|
root: stylesDir || clientRoot,
|
|
7283
7284
|
target: "browser",
|
|
7284
7285
|
plugins: [stylePreprocessorPlugin],
|
|
@@ -7287,7 +7288,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7287
7288
|
vueCssPaths.length > 0 ? bunBuild6({
|
|
7288
7289
|
entrypoints: vueCssPaths,
|
|
7289
7290
|
naming: `[name].[hash].[ext]`,
|
|
7290
|
-
outdir:
|
|
7291
|
+
outdir: join19(buildPath, assetsPath ? basename7(assetsPath) : "assets", "css"),
|
|
7291
7292
|
target: "browser",
|
|
7292
7293
|
throw: false
|
|
7293
7294
|
}) : undefined
|
|
@@ -7409,7 +7410,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7409
7410
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
7410
7411
|
if (!hmrClientBundle)
|
|
7411
7412
|
return;
|
|
7412
|
-
let html =
|
|
7413
|
+
let html = readFileSync9(filePath, "utf-8");
|
|
7413
7414
|
if (html.includes("data-hmr-client"))
|
|
7414
7415
|
return;
|
|
7415
7416
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -7420,7 +7421,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7420
7421
|
const processHtmlPages = async () => {
|
|
7421
7422
|
if (!(htmlDir && htmlPagesPath))
|
|
7422
7423
|
return;
|
|
7423
|
-
const outputHtmlPages = isSingle ?
|
|
7424
|
+
const outputHtmlPages = isSingle ? join19(buildPath, "pages") : join19(buildPath, basename7(htmlDir), "pages");
|
|
7424
7425
|
mkdirSync10(outputHtmlPages, { recursive: true });
|
|
7425
7426
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
7426
7427
|
force: true,
|
|
@@ -7442,14 +7443,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7442
7443
|
const processHtmxPages = async () => {
|
|
7443
7444
|
if (!(htmxDir && htmxPagesPath))
|
|
7444
7445
|
return;
|
|
7445
|
-
const outputHtmxPages = isSingle ?
|
|
7446
|
+
const outputHtmxPages = isSingle ? join19(buildPath, "pages") : join19(buildPath, basename7(htmxDir), "pages");
|
|
7446
7447
|
mkdirSync10(outputHtmxPages, { recursive: true });
|
|
7447
7448
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
7448
7449
|
force: true,
|
|
7449
7450
|
recursive: true
|
|
7450
7451
|
});
|
|
7451
7452
|
if (shouldCopyHtmx) {
|
|
7452
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
7453
|
+
const htmxDestDir = isSingle ? buildPath : join19(buildPath, basename7(htmxDir));
|
|
7453
7454
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
7454
7455
|
}
|
|
7455
7456
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -7504,9 +7505,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
7504
7505
|
});
|
|
7505
7506
|
if (isIncremental)
|
|
7506
7507
|
return { conventions: conventionsMap, manifest };
|
|
7507
|
-
writeFileSync7(
|
|
7508
|
+
writeFileSync7(join19(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
7508
7509
|
if (Object.keys(conventionsMap).length > 0) {
|
|
7509
|
-
writeFileSync7(
|
|
7510
|
+
writeFileSync7(join19(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
7510
7511
|
}
|
|
7511
7512
|
return { conventions: conventionsMap, manifest };
|
|
7512
7513
|
};
|
|
@@ -7570,7 +7571,7 @@ var init_build = __esm(() => {
|
|
|
7570
7571
|
});
|
|
7571
7572
|
|
|
7572
7573
|
// src/dev/dependencyGraph.ts
|
|
7573
|
-
import { existsSync as existsSync18, readFileSync as
|
|
7574
|
+
import { existsSync as existsSync18, readFileSync as readFileSync10 } from "fs";
|
|
7574
7575
|
var {Glob: Glob7 } = globalThis.Bun;
|
|
7575
7576
|
import { resolve as resolve18 } from "path";
|
|
7576
7577
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -7731,15 +7732,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
7731
7732
|
const lowerPath = filePath.toLowerCase();
|
|
7732
7733
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
7733
7734
|
if (loader === "html") {
|
|
7734
|
-
const content =
|
|
7735
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
7735
7736
|
return extractHtmlDependencies(filePath, content);
|
|
7736
7737
|
}
|
|
7737
7738
|
if (loader === "tsx" || loader === "js") {
|
|
7738
|
-
const content =
|
|
7739
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
7739
7740
|
return extractJsDependencies(filePath, content, loader);
|
|
7740
7741
|
}
|
|
7741
7742
|
if (isSvelteOrVue) {
|
|
7742
|
-
const content =
|
|
7743
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
7743
7744
|
return extractSvelteVueDependencies(filePath, content);
|
|
7744
7745
|
}
|
|
7745
7746
|
return [];
|
|
@@ -8028,7 +8029,7 @@ var init_pathUtils = __esm(() => {
|
|
|
8028
8029
|
// src/dev/fileWatcher.ts
|
|
8029
8030
|
import { watch } from "fs";
|
|
8030
8031
|
import { existsSync as existsSync19 } from "fs";
|
|
8031
|
-
import { join as
|
|
8032
|
+
import { join as join20, resolve as resolve20 } from "path";
|
|
8032
8033
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
8033
8034
|
try {
|
|
8034
8035
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -8055,7 +8056,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
8055
8056
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
8056
8057
|
return;
|
|
8057
8058
|
}
|
|
8058
|
-
const fullPath =
|
|
8059
|
+
const fullPath = join20(absolutePath, filename).replace(/\\/g, "/");
|
|
8059
8060
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
8060
8061
|
return;
|
|
8061
8062
|
}
|
|
@@ -8206,7 +8207,7 @@ var init_assetStore = __esm(() => {
|
|
|
8206
8207
|
});
|
|
8207
8208
|
|
|
8208
8209
|
// src/islands/pageMetadata.ts
|
|
8209
|
-
import { readFileSync as
|
|
8210
|
+
import { readFileSync as readFileSync11 } from "fs";
|
|
8210
8211
|
import { dirname as dirname11, resolve as resolve22 } from "path";
|
|
8211
8212
|
var pagePatterns, getPageDirs = (config) => [
|
|
8212
8213
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
@@ -8248,7 +8249,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
8248
8249
|
return;
|
|
8249
8250
|
const files = await scanEntryPoints(resolve22(entry.dir), pattern);
|
|
8250
8251
|
for (const filePath of files) {
|
|
8251
|
-
const source =
|
|
8252
|
+
const source = readFileSync11(filePath, "utf-8");
|
|
8252
8253
|
const islands = extractIslandUsagesFromSource(source);
|
|
8253
8254
|
pageMetadata.set(resolve22(filePath), {
|
|
8254
8255
|
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
@@ -8278,10 +8279,10 @@ var init_pageMetadata = __esm(() => {
|
|
|
8278
8279
|
});
|
|
8279
8280
|
|
|
8280
8281
|
// src/dev/fileHashTracker.ts
|
|
8281
|
-
import { readFileSync as
|
|
8282
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
8282
8283
|
var computeFileHash = (filePath) => {
|
|
8283
8284
|
try {
|
|
8284
|
-
const fileContent =
|
|
8285
|
+
const fileContent = readFileSync12(filePath);
|
|
8285
8286
|
return Number(Bun.hash(fileContent));
|
|
8286
8287
|
} catch {
|
|
8287
8288
|
return UNFOUND_INDEX;
|
|
@@ -9299,15 +9300,15 @@ var init_streamingSlotWarningScope = __esm(() => {
|
|
|
9299
9300
|
import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
|
|
9300
9301
|
import { mkdir as mkdir4, symlink } from "fs/promises";
|
|
9301
9302
|
import { tmpdir } from "os";
|
|
9302
|
-
import { basename as basename10, dirname as dirname12, join as
|
|
9303
|
+
import { basename as basename10, dirname as dirname12, join as join21, resolve as resolve25 } from "path";
|
|
9303
9304
|
var ssrDirty = false, lastSelector = "angular-page", isRecord7 = (value) => typeof value === "object" && value !== null, isAngularComponent = (value) => typeof value === "function", compilerImportPromise = null, ensureAngularCompiler = () => {
|
|
9304
9305
|
if (!compilerImportPromise) {
|
|
9305
9306
|
compilerImportPromise = import("@angular/compiler");
|
|
9306
9307
|
}
|
|
9307
9308
|
return compilerImportPromise;
|
|
9308
|
-
}, readAngularPageModule = (value) => isRecord7(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ??
|
|
9309
|
+
}, readAngularPageModule = (value) => isRecord7(value) ? value : null, resolveAngularSsrOutDir = () => process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR ?? join21(tmpdir(), "absolutejs", "generated", "angular-ssr"), ensureAngularSsrNodeModules = async (outDir) => {
|
|
9309
9310
|
const outRoot = resolve25(dirname12(dirname12(outDir)));
|
|
9310
|
-
const nodeModulesLink =
|
|
9311
|
+
const nodeModulesLink = join21(outRoot, "node_modules");
|
|
9311
9312
|
if (process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) {
|
|
9312
9313
|
return;
|
|
9313
9314
|
}
|
|
@@ -9838,7 +9839,7 @@ __export(exports_moduleServer, {
|
|
|
9838
9839
|
createModuleServer: () => createModuleServer,
|
|
9839
9840
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
9840
9841
|
});
|
|
9841
|
-
import { existsSync as existsSync20, readFileSync as
|
|
9842
|
+
import { existsSync as existsSync20, readFileSync as readFileSync13, statSync as statSync2 } from "fs";
|
|
9842
9843
|
import { basename as basename12, dirname as dirname14, extname as extname6, resolve as resolve26, relative as relative10 } from "path";
|
|
9843
9844
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
9844
9845
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
@@ -9971,7 +9972,7 @@ ${stubs}
|
|
|
9971
9972
|
`)}
|
|
9972
9973
|
${code}`;
|
|
9973
9974
|
}, reactTranspilerOptions, reactTranspiler, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
9974
|
-
const raw =
|
|
9975
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
9975
9976
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
9976
9977
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
9977
9978
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -9987,7 +9988,7 @@ ${transpiled}`;
|
|
|
9987
9988
|
transpiled += buildIslandMetadataExports(raw);
|
|
9988
9989
|
return rewriteImports2(transpiled, filePath, projectRoot, rewriter);
|
|
9989
9990
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
9990
|
-
const raw =
|
|
9991
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
9991
9992
|
const ext = extname6(filePath);
|
|
9992
9993
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
9993
9994
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -10143,7 +10144,7 @@ ${code}`;
|
|
|
10143
10144
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
10144
10145
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
10145
10146
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter) => {
|
|
10146
|
-
const raw =
|
|
10147
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10147
10148
|
if (!svelteCompiler) {
|
|
10148
10149
|
svelteCompiler = await import("svelte/compiler");
|
|
10149
10150
|
}
|
|
@@ -10201,7 +10202,7 @@ export default __script__;`;
|
|
|
10201
10202
|
return `${cssInjection}
|
|
10202
10203
|
${code}`;
|
|
10203
10204
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir) => {
|
|
10204
|
-
const raw =
|
|
10205
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10205
10206
|
if (!vueCompiler) {
|
|
10206
10207
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
10207
10208
|
}
|
|
@@ -10250,7 +10251,7 @@ ${code}`;
|
|
|
10250
10251
|
}
|
|
10251
10252
|
});
|
|
10252
10253
|
}, handleCssRequest = (filePath) => {
|
|
10253
|
-
const raw =
|
|
10254
|
+
const raw = readFileSync13(filePath, "utf-8");
|
|
10254
10255
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
10255
10256
|
return [
|
|
10256
10257
|
`const style = document.createElement('style');`,
|
|
@@ -12160,7 +12161,7 @@ __export(exports_buildDepVendor, {
|
|
|
12160
12161
|
buildDepVendor: () => buildDepVendor
|
|
12161
12162
|
});
|
|
12162
12163
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
12163
|
-
import { join as
|
|
12164
|
+
import { join as join22 } from "path";
|
|
12164
12165
|
import { rm as rm8 } from "fs/promises";
|
|
12165
12166
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
12166
12167
|
var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g, "").replace(/-/g, "_"), isResolvable3 = (specifier) => {
|
|
@@ -12200,7 +12201,7 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12200
12201
|
return Array.from(specifiers).filter(isResolvable3);
|
|
12201
12202
|
}, generateEntrySource2 = (specifier) => `export * from '${specifier}';
|
|
12202
12203
|
`, rewriteVendorFiles = async (vendorDir) => {
|
|
12203
|
-
const { readdirSync: readdirSync2, readFileSync:
|
|
12204
|
+
const { readdirSync: readdirSync2, readFileSync: readFileSync14, writeFileSync: writeFileSync8 } = await import("fs");
|
|
12204
12205
|
const { computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
|
|
12205
12206
|
const reactPaths = Object.entries(computeVendorPaths2());
|
|
12206
12207
|
const rewriteContent = (content) => reactPaths.reduce((acc, [specifier, webPath]) => {
|
|
@@ -12210,8 +12211,8 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12210
12211
|
}, content);
|
|
12211
12212
|
const files = readdirSync2(vendorDir).filter((f) => f.endsWith(".js"));
|
|
12212
12213
|
for (const file3 of files) {
|
|
12213
|
-
const filePath =
|
|
12214
|
-
const original =
|
|
12214
|
+
const filePath = join22(vendorDir, file3);
|
|
12215
|
+
const original = readFileSync14(filePath, "utf-8");
|
|
12215
12216
|
const rewritten = rewriteContent(original);
|
|
12216
12217
|
if (rewritten !== original)
|
|
12217
12218
|
writeFileSync8(filePath, rewritten);
|
|
@@ -12220,13 +12221,13 @@ var toSafeFileName5 = (specifier) => specifier.replace(/\//g, "_").replace(/@/g,
|
|
|
12220
12221
|
const specifiers = await scanBareImports(directories);
|
|
12221
12222
|
if (specifiers.length === 0)
|
|
12222
12223
|
return {};
|
|
12223
|
-
const vendorDir =
|
|
12224
|
+
const vendorDir = join22(buildDir, "vendor");
|
|
12224
12225
|
mkdirSync11(vendorDir, { recursive: true });
|
|
12225
|
-
const tmpDir =
|
|
12226
|
+
const tmpDir = join22(buildDir, "_dep_vendor_tmp");
|
|
12226
12227
|
mkdirSync11(tmpDir, { recursive: true });
|
|
12227
12228
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
12228
12229
|
const safeName = toSafeFileName5(specifier);
|
|
12229
|
-
const entryPath =
|
|
12230
|
+
const entryPath = join22(tmpDir, `${safeName}.ts`);
|
|
12230
12231
|
const source = await generateEntrySource2(specifier);
|
|
12231
12232
|
await Bun.write(entryPath, source);
|
|
12232
12233
|
return entryPath;
|
|
@@ -12610,5 +12611,5 @@ export {
|
|
|
12610
12611
|
build
|
|
12611
12612
|
};
|
|
12612
12613
|
|
|
12613
|
-
//# debugId=
|
|
12614
|
+
//# debugId=EC4B4C99B57596EF64756E2164756E21
|
|
12614
12615
|
//# sourceMappingURL=build.js.map
|