@absolutejs/absolute 0.19.0-beta.1022 → 0.19.0-beta.1024
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/browser.js +13 -17
- package/dist/angular/browser.js.map +3 -3
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +595 -267
- package/dist/angular/index.js.map +11 -8
- package/dist/angular/server.js +577 -249
- package/dist/angular/server.js.map +11 -8
- package/dist/build.js +865 -755
- package/dist/build.js.map +12 -11
- package/dist/cli/config/server.js +49 -42
- package/dist/client/index.js +34 -20
- package/dist/client/index.js.map +6 -6
- package/dist/index.js +922 -805
- package/dist/index.js.map +13 -12
- package/dist/islands/index.js +416 -95
- package/dist/islands/index.js.map +10 -7
- package/dist/react/browser.js +13 -17
- package/dist/react/browser.js.map +3 -3
- package/dist/react/index.js +484 -156
- package/dist/react/index.js.map +12 -9
- package/dist/react/server.js +69 -62
- package/dist/react/server.js.map +5 -5
- package/dist/src/client/preserveIslandMarkup.d.ts +4 -1
- package/dist/src/core/angularServerModule.d.ts +1 -0
- package/dist/svelte/index.js +389 -61
- package/dist/svelte/index.js.map +11 -8
- package/dist/svelte/server.js +50 -43
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/angular.d.ts +3 -0
- package/dist/types/globals.d.ts +0 -1
- package/dist/vue/browser.js +13 -17
- package/dist/vue/browser.js.map +3 -3
- package/dist/vue/index.js +477 -153
- package/dist/vue/index.js.map +12 -9
- package/dist/vue/server.js +50 -43
- package/dist/vue/server.js.map +3 -3
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -2038,9 +2038,12 @@ var initDominoAdapter = (platformServer) => {
|
|
|
2038
2038
|
return {
|
|
2039
2039
|
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
2040
2040
|
bootstrapApplication: platformBrowser.bootstrapApplication,
|
|
2041
|
+
Component: core.Component,
|
|
2041
2042
|
DomSanitizer: platformBrowser.DomSanitizer,
|
|
2042
2043
|
ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
|
|
2043
2044
|
inject: core.inject,
|
|
2045
|
+
InjectionToken: core.InjectionToken,
|
|
2046
|
+
NgComponentOutlet: common.NgComponentOutlet,
|
|
2044
2047
|
provideClientHydration: platformBrowser.provideClientHydration,
|
|
2045
2048
|
provideServerRendering: platformServer.provideServerRendering,
|
|
2046
2049
|
provideZonelessChangeDetection: core.provideZonelessChangeDetection,
|
|
@@ -2296,9 +2299,8 @@ var angularIslandSelector = "abs-angular-island", isAngularComponent = (value) =
|
|
|
2296
2299
|
const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
|
|
2297
2300
|
return `${componentName}:${JSON.stringify(props)}`;
|
|
2298
2301
|
}, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
|
|
2299
|
-
const { Component, InjectionToken, inject } = await import("@angular/core");
|
|
2300
|
-
const { NgComponentOutlet } = await import("@angular/common");
|
|
2301
2302
|
const deps = await getAngularDeps();
|
|
2303
|
+
const { Component, InjectionToken, NgComponentOutlet, inject } = deps;
|
|
2302
2304
|
const selector = getAngularIslandSelector(islandId);
|
|
2303
2305
|
const propsToken = new InjectionToken(`${wrapperKey}:props`);
|
|
2304
2306
|
|
|
@@ -2404,7 +2406,15 @@ var init_islands2 = __esm(() => {
|
|
|
2404
2406
|
var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
|
|
2405
2407
|
const { renderAngularIslandToHtml: renderAngularIslandToHtml2 } = await Promise.resolve().then(() => (init_islands2(), exports_islands));
|
|
2406
2408
|
return renderAngularIslandToHtml2(component, props, islandId);
|
|
2407
|
-
}, renderAngularIslandToHtml2,
|
|
2409
|
+
}, renderAngularIslandToHtml2, LEADING_HOISTED_RESOURCE_RE, stripLeadingHoistedResources = (html) => {
|
|
2410
|
+
let result = html;
|
|
2411
|
+
let match = LEADING_HOISTED_RESOURCE_RE.exec(result);
|
|
2412
|
+
while (match) {
|
|
2413
|
+
result = result.slice(match[0].length);
|
|
2414
|
+
match = LEADING_HOISTED_RESOURCE_RE.exec(result);
|
|
2415
|
+
}
|
|
2416
|
+
return result.trimStart();
|
|
2417
|
+
}, renderReactIslandToHtml = (component, props) => import("react").then(({ createElement }) => import("react-dom/server").then(({ renderToString }) => stripLeadingHoistedResources(renderToString(createElement(component, props))))), renderSvelteIslandToHtml = (component, props) => import("svelte/server").then(({ render }) => {
|
|
2408
2418
|
const { body } = render(component, { props });
|
|
2409
2419
|
return body;
|
|
2410
2420
|
}), renderVueIslandToHtml = (component, props) => import("vue").then(({ createSSRApp, h: createVueVNode }) => {
|
|
@@ -2415,10 +2425,311 @@ var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
|
|
|
2415
2425
|
});
|
|
2416
2426
|
var init_islandSsr = __esm(() => {
|
|
2417
2427
|
renderAngularIslandToHtml2 = renderAngularIslandToHtmlInternal;
|
|
2428
|
+
LEADING_HOISTED_RESOURCE_RE = /^\s*(?:<link\b[^>]*\/?>|<meta\b[^>]*\/?>|<title\b[^>]*>[\s\S]*?<\/title>|<style\b[^>]*>[\s\S]*?<\/style>|<script\b[^>]*>[\s\S]*?<\/script>)/i;
|
|
2429
|
+
});
|
|
2430
|
+
|
|
2431
|
+
// src/build/nativeRewrite.ts
|
|
2432
|
+
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
2433
|
+
import { platform, arch } from "os";
|
|
2434
|
+
import { resolve as resolve5 } from "path";
|
|
2435
|
+
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
2436
|
+
if (nativeLib !== null)
|
|
2437
|
+
return nativeLib;
|
|
2438
|
+
const osPlatform = platform();
|
|
2439
|
+
const cpu = arch();
|
|
2440
|
+
const platformMap = {
|
|
2441
|
+
"darwin-arm64": "darwin-arm64/fast_ops.dylib",
|
|
2442
|
+
"darwin-x64": "darwin-x64/fast_ops.dylib",
|
|
2443
|
+
"linux-arm64": "linux-arm64/fast_ops.so",
|
|
2444
|
+
"linux-x64": "linux-x64/fast_ops.so",
|
|
2445
|
+
"win32-arm64": "windows-arm64/fast_ops.dll",
|
|
2446
|
+
"win32-x64": "windows-x64/fast_ops.dll"
|
|
2447
|
+
};
|
|
2448
|
+
const libPath = platformMap[`${osPlatform}-${cpu}`];
|
|
2449
|
+
if (!libPath)
|
|
2450
|
+
return null;
|
|
2451
|
+
try {
|
|
2452
|
+
const fullPath = resolve5(import.meta.dir, "../../native/packages", libPath);
|
|
2453
|
+
const lib = dlopen(fullPath, ffiDefinition);
|
|
2454
|
+
nativeLib = lib.symbols;
|
|
2455
|
+
return nativeLib;
|
|
2456
|
+
} catch {
|
|
2457
|
+
return null;
|
|
2458
|
+
}
|
|
2459
|
+
}, nativeRewriteImports = (content, replacements) => {
|
|
2460
|
+
const lib = loadNative();
|
|
2461
|
+
if (!lib)
|
|
2462
|
+
return null;
|
|
2463
|
+
const jsonStr = JSON.stringify(replacements);
|
|
2464
|
+
const contentBuf = Buffer.from(content);
|
|
2465
|
+
const jsonBuf = Buffer.from(jsonStr);
|
|
2466
|
+
const outBuf = Buffer.alloc(content.length * 2);
|
|
2467
|
+
const outLenBuf = new BigUint64Array([BigInt(outBuf.length)]);
|
|
2468
|
+
const result = lib.rewrite_imports(ptr(contentBuf), contentBuf.length, ptr(jsonBuf), jsonBuf.length, ptr(outBuf), ptr(new Uint8Array(outLenBuf.buffer)));
|
|
2469
|
+
if (result < 0)
|
|
2470
|
+
return null;
|
|
2471
|
+
if (result === 0)
|
|
2472
|
+
return content;
|
|
2473
|
+
const outLen = Number(outLenBuf[0]);
|
|
2474
|
+
return outBuf.subarray(0, outLen).toString("utf-8");
|
|
2475
|
+
};
|
|
2476
|
+
var init_nativeRewrite = __esm(() => {
|
|
2477
|
+
ffiDefinition = {
|
|
2478
|
+
rewrite_imports: {
|
|
2479
|
+
args: [
|
|
2480
|
+
FFIType.ptr,
|
|
2481
|
+
FFIType.u64,
|
|
2482
|
+
FFIType.ptr,
|
|
2483
|
+
FFIType.u64,
|
|
2484
|
+
FFIType.ptr,
|
|
2485
|
+
FFIType.ptr
|
|
2486
|
+
],
|
|
2487
|
+
returns: FFIType.i32
|
|
2488
|
+
}
|
|
2489
|
+
};
|
|
2490
|
+
});
|
|
2491
|
+
|
|
2492
|
+
// src/build/rewriteImportsPlugin.ts
|
|
2493
|
+
var exports_rewriteImportsPlugin = {};
|
|
2494
|
+
__export(exports_rewriteImportsPlugin, {
|
|
2495
|
+
rewriteVendorDirectories: () => rewriteVendorDirectories,
|
|
2496
|
+
rewriteImportsInContent: () => rewriteImportsInContent,
|
|
2497
|
+
rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
|
|
2498
|
+
rewriteBuildOutputs: () => rewriteBuildOutputs,
|
|
2499
|
+
jsRewriteImports: () => jsRewriteImports,
|
|
2500
|
+
fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
|
|
2501
|
+
buildWithImportRewrite: () => buildWithImportRewrite
|
|
2502
|
+
});
|
|
2503
|
+
import { readdir as readdir2 } from "fs/promises";
|
|
2504
|
+
import { join as join4 } from "path";
|
|
2505
|
+
var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
2506
|
+
let result = content;
|
|
2507
|
+
for (const [specifier, webPath] of replacements) {
|
|
2508
|
+
const escaped = escapeRegex(specifier);
|
|
2509
|
+
const fromRegex = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
|
|
2510
|
+
const sideEffectRegex = new RegExp(`(import\\s*["'])${escaped}(["'])`, "g");
|
|
2511
|
+
const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])${escaped}(["']\\s*\\))`, "g");
|
|
2512
|
+
result = result.replace(fromRegex, `$1${webPath}$2`);
|
|
2513
|
+
result = result.replace(sideEffectRegex, `$1${webPath}$2`);
|
|
2514
|
+
result = result.replace(dynamicRegex, `$1${webPath}$2`);
|
|
2515
|
+
}
|
|
2516
|
+
return result;
|
|
2517
|
+
}, rewriteImportsInContent = (content, vendorPaths) => {
|
|
2518
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
2519
|
+
return content;
|
|
2520
|
+
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
2521
|
+
const native = nativeRewriteImports(content, replacements);
|
|
2522
|
+
return native ?? jsRewriteImports(content, replacements);
|
|
2523
|
+
}, fixMissingReExportNamespacesInContent = (content) => {
|
|
2524
|
+
const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
|
|
2525
|
+
REEXPORT_PATTERN.lastIndex = 0;
|
|
2526
|
+
const missing = [];
|
|
2527
|
+
let match;
|
|
2528
|
+
while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
|
|
2529
|
+
const ident = match[1];
|
|
2530
|
+
if (!ident)
|
|
2531
|
+
continue;
|
|
2532
|
+
const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
|
|
2533
|
+
if (nsImportRe.test(content))
|
|
2534
|
+
continue;
|
|
2535
|
+
const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
|
|
2536
|
+
if (declRe.test(content))
|
|
2537
|
+
continue;
|
|
2538
|
+
const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
|
|
2539
|
+
if (namedImportRe.test(content))
|
|
2540
|
+
continue;
|
|
2541
|
+
const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
|
|
2542
|
+
let pathMatch;
|
|
2543
|
+
let sourcePath;
|
|
2544
|
+
while ((pathMatch = importPathRe.exec(content)) !== null) {
|
|
2545
|
+
const p = pathMatch[1];
|
|
2546
|
+
if (!p)
|
|
2547
|
+
continue;
|
|
2548
|
+
const base = p.split("/").pop()?.replace(/\.[mc]?js$/, "");
|
|
2549
|
+
if (!base)
|
|
2550
|
+
continue;
|
|
2551
|
+
const normalized = base.startsWith("_") ? base.slice(1) : base;
|
|
2552
|
+
if (normalized === ident || normalized.endsWith(`_${ident}`)) {
|
|
2553
|
+
sourcePath = p;
|
|
2554
|
+
break;
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
if (sourcePath)
|
|
2558
|
+
missing.push({ ident, path: sourcePath });
|
|
2559
|
+
}
|
|
2560
|
+
if (missing.length === 0)
|
|
2561
|
+
return content;
|
|
2562
|
+
const seen = new Set;
|
|
2563
|
+
const unique = missing.filter((entry) => {
|
|
2564
|
+
if (seen.has(entry.ident))
|
|
2565
|
+
return false;
|
|
2566
|
+
seen.add(entry.ident);
|
|
2567
|
+
return true;
|
|
2568
|
+
});
|
|
2569
|
+
const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
|
|
2570
|
+
`);
|
|
2571
|
+
return `${inserts}
|
|
2572
|
+
${content}`;
|
|
2573
|
+
}, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
|
|
2574
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
2575
|
+
return;
|
|
2576
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
2577
|
+
let original;
|
|
2578
|
+
try {
|
|
2579
|
+
original = await artifact.text();
|
|
2580
|
+
} catch (err) {
|
|
2581
|
+
const code = err.code;
|
|
2582
|
+
if (code === "ENOENT")
|
|
2583
|
+
return;
|
|
2584
|
+
throw err;
|
|
2585
|
+
}
|
|
2586
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
2587
|
+
if (rewritten === original)
|
|
2588
|
+
return;
|
|
2589
|
+
try {
|
|
2590
|
+
await Bun.write(artifact.path, rewritten);
|
|
2591
|
+
} catch (err) {
|
|
2592
|
+
const code = err.code;
|
|
2593
|
+
if (code === "ENOENT")
|
|
2594
|
+
return;
|
|
2595
|
+
throw err;
|
|
2596
|
+
}
|
|
2597
|
+
}));
|
|
2598
|
+
}, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
|
|
2599
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
2600
|
+
const vendorPaths = resolveVendorPaths(artifact);
|
|
2601
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
2602
|
+
return;
|
|
2603
|
+
let original;
|
|
2604
|
+
try {
|
|
2605
|
+
original = await artifact.text();
|
|
2606
|
+
} catch (err) {
|
|
2607
|
+
const code = err.code;
|
|
2608
|
+
if (code === "ENOENT")
|
|
2609
|
+
return;
|
|
2610
|
+
throw err;
|
|
2611
|
+
}
|
|
2612
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
2613
|
+
if (rewritten === original)
|
|
2614
|
+
return;
|
|
2615
|
+
try {
|
|
2616
|
+
await Bun.write(artifact.path, rewritten);
|
|
2617
|
+
} catch (err) {
|
|
2618
|
+
const code = err.code;
|
|
2619
|
+
if (code === "ENOENT")
|
|
2620
|
+
return;
|
|
2621
|
+
throw err;
|
|
2622
|
+
}
|
|
2623
|
+
}));
|
|
2624
|
+
}, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
|
|
2625
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
2626
|
+
return;
|
|
2627
|
+
const allFiles = [];
|
|
2628
|
+
for (const dir of vendorDirs) {
|
|
2629
|
+
try {
|
|
2630
|
+
const entries = await readdir2(dir);
|
|
2631
|
+
for (const entry of entries) {
|
|
2632
|
+
if (entry.endsWith(".js"))
|
|
2633
|
+
allFiles.push(join4(dir, entry));
|
|
2634
|
+
}
|
|
2635
|
+
} catch {}
|
|
2636
|
+
}
|
|
2637
|
+
await Promise.all(allFiles.map(async (filePath) => {
|
|
2638
|
+
let original;
|
|
2639
|
+
try {
|
|
2640
|
+
original = await Bun.file(filePath).text();
|
|
2641
|
+
} catch (err) {
|
|
2642
|
+
const code = err.code;
|
|
2643
|
+
if (code === "ENOENT")
|
|
2644
|
+
return;
|
|
2645
|
+
throw err;
|
|
2646
|
+
}
|
|
2647
|
+
let next = rewriteImportsInContent(original, vendorPaths);
|
|
2648
|
+
next = fixMissingReExportNamespacesInContent(next);
|
|
2649
|
+
if (next === original)
|
|
2650
|
+
return;
|
|
2651
|
+
try {
|
|
2652
|
+
await Bun.write(filePath, next);
|
|
2653
|
+
} catch (err) {
|
|
2654
|
+
const code = err.code;
|
|
2655
|
+
if (code === "ENOENT")
|
|
2656
|
+
return;
|
|
2657
|
+
throw err;
|
|
2658
|
+
}
|
|
2659
|
+
}));
|
|
2660
|
+
}, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
|
|
2661
|
+
const result = await pendingBuild;
|
|
2662
|
+
if (result.outputs.length > 0) {
|
|
2663
|
+
await rewriteBuildOutputs(result.outputs, vendorPaths);
|
|
2664
|
+
}
|
|
2665
|
+
return result;
|
|
2666
|
+
};
|
|
2667
|
+
var init_rewriteImportsPlugin = __esm(() => {
|
|
2668
|
+
init_nativeRewrite();
|
|
2669
|
+
});
|
|
2670
|
+
|
|
2671
|
+
// src/core/angularServerModule.ts
|
|
2672
|
+
import { mkdir } from "fs/promises";
|
|
2673
|
+
import { dirname as dirname2, join as join5, relative as relative3 } from "path";
|
|
2674
|
+
var serverCacheRoot, compiledModuleCache, ANGULAR_SPECIFIER_RE, getCachedModulePath = (sourcePath) => {
|
|
2675
|
+
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2676
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2677
|
+
return join5(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
2678
|
+
}, collectVendorPaths = (code) => {
|
|
2679
|
+
const vendorPaths = {};
|
|
2680
|
+
if (!isProductionRuntime()) {
|
|
2681
|
+
return vendorPaths;
|
|
2682
|
+
}
|
|
2683
|
+
const specifiers = new Set([...code.matchAll(ANGULAR_SPECIFIER_RE)].map((match) => match[1]));
|
|
2684
|
+
specifiers.forEach((specifier) => {
|
|
2685
|
+
if (!specifier)
|
|
2686
|
+
return;
|
|
2687
|
+
const resolved = resolveAngularRuntimePath(specifier);
|
|
2688
|
+
if (resolved === specifier)
|
|
2689
|
+
return;
|
|
2690
|
+
vendorPaths[specifier] = resolved;
|
|
2691
|
+
});
|
|
2692
|
+
return vendorPaths;
|
|
2693
|
+
}, buildAngularServerModule = async (sourcePath) => {
|
|
2694
|
+
const result = await Bun.build({
|
|
2695
|
+
entrypoints: [sourcePath],
|
|
2696
|
+
format: "esm",
|
|
2697
|
+
packages: "external",
|
|
2698
|
+
target: "bun",
|
|
2699
|
+
throw: false
|
|
2700
|
+
});
|
|
2701
|
+
const entry = result.outputs.find((output) => output.kind === "entry-point");
|
|
2702
|
+
if (!result.success || !entry) {
|
|
2703
|
+
const message = result.logs.map((log2) => String(log2)).join(`
|
|
2704
|
+
`);
|
|
2705
|
+
throw new Error(`Failed to compile Angular island server module for "${sourcePath}":
|
|
2706
|
+
${message}`);
|
|
2707
|
+
}
|
|
2708
|
+
const code = await entry.text();
|
|
2709
|
+
const rewritten = rewriteImportsInContent(code, collectVendorPaths(code));
|
|
2710
|
+
const modulePath = getCachedModulePath(sourcePath);
|
|
2711
|
+
await mkdir(dirname2(modulePath), { recursive: true });
|
|
2712
|
+
await Bun.write(modulePath, rewritten);
|
|
2713
|
+
return modulePath;
|
|
2714
|
+
}, compileAngularServerModule = (sourcePath) => {
|
|
2715
|
+
const cached = compiledModuleCache.get(sourcePath);
|
|
2716
|
+
if (cached) {
|
|
2717
|
+
return cached;
|
|
2718
|
+
}
|
|
2719
|
+
const compiledModulePromise = buildAngularServerModule(sourcePath);
|
|
2720
|
+
compiledModuleCache.set(sourcePath, compiledModulePromise);
|
|
2721
|
+
return compiledModulePromise;
|
|
2722
|
+
};
|
|
2723
|
+
var init_angularServerModule = __esm(() => {
|
|
2724
|
+
init_resolveAngularPackage();
|
|
2725
|
+
init_rewriteImportsPlugin();
|
|
2726
|
+
serverCacheRoot = join5(process.cwd(), ".absolutejs", "islands", "angular");
|
|
2727
|
+
compiledModuleCache = new Map;
|
|
2728
|
+
ANGULAR_SPECIFIER_RE = /["'](@angular\/[^"']+)["']/g;
|
|
2418
2729
|
});
|
|
2419
2730
|
|
|
2420
2731
|
// src/build/resolvePackageImport.ts
|
|
2421
|
-
import { resolve as
|
|
2732
|
+
import { resolve as resolve6, join as join6 } from "path";
|
|
2422
2733
|
import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
|
|
2423
2734
|
var resolveExportPath = (entry, conditions) => {
|
|
2424
2735
|
if (typeof entry === "string")
|
|
@@ -2440,11 +2751,11 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
2440
2751
|
const packageName = isScoped ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
2441
2752
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
2442
2753
|
const exportKey = subpath ? `./${subpath}` : ".";
|
|
2443
|
-
const currentPackageJsonPath =
|
|
2754
|
+
const currentPackageJsonPath = resolve6(process.cwd(), "package.json");
|
|
2444
2755
|
const currentPackageJson = existsSync3(currentPackageJsonPath) ? JSON.parse(readFileSync2(currentPackageJsonPath, "utf-8")) : null;
|
|
2445
2756
|
const currentPackageDir = currentPackageJson?.name === packageName ? process.cwd() : null;
|
|
2446
|
-
const packageDir = currentPackageDir ??
|
|
2447
|
-
const packageJsonPath =
|
|
2757
|
+
const packageDir = currentPackageDir ?? resolve6(process.cwd(), "node_modules", packageName ?? "");
|
|
2758
|
+
const packageJsonPath = join6(packageDir, "package.json");
|
|
2448
2759
|
if (!existsSync3(packageJsonPath))
|
|
2449
2760
|
return null;
|
|
2450
2761
|
try {
|
|
@@ -2459,12 +2770,12 @@ var resolveExportPath = (entry, conditions) => {
|
|
|
2459
2770
|
if (!importPath)
|
|
2460
2771
|
return null;
|
|
2461
2772
|
if (currentPackageDir && importPath.startsWith("./dist/")) {
|
|
2462
|
-
const sourceCandidate =
|
|
2773
|
+
const sourceCandidate = resolve6(packageDir, importPath.replace(/^\.\/dist\//, "./src/"));
|
|
2463
2774
|
if (existsSync3(sourceCandidate)) {
|
|
2464
2775
|
return sourceCandidate;
|
|
2465
2776
|
}
|
|
2466
2777
|
}
|
|
2467
|
-
const resolved =
|
|
2778
|
+
const resolved = resolve6(packageDir, importPath);
|
|
2468
2779
|
return existsSync3(resolved) ? resolved : null;
|
|
2469
2780
|
} catch {
|
|
2470
2781
|
return null;
|
|
@@ -2621,12 +2932,12 @@ import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
|
|
|
2621
2932
|
import { readFile } from "fs/promises";
|
|
2622
2933
|
import { createRequire } from "module";
|
|
2623
2934
|
import {
|
|
2624
|
-
dirname as
|
|
2935
|
+
dirname as dirname3,
|
|
2625
2936
|
extname as extname3,
|
|
2626
2937
|
isAbsolute,
|
|
2627
|
-
join as
|
|
2628
|
-
relative as
|
|
2629
|
-
resolve as
|
|
2938
|
+
join as join7,
|
|
2939
|
+
relative as relative4,
|
|
2940
|
+
resolve as resolve7
|
|
2630
2941
|
} from "path";
|
|
2631
2942
|
import { fileURLToPath, pathToFileURL } from "url";
|
|
2632
2943
|
var CSS_EXTENSION_PATTERN, STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
@@ -2662,9 +2973,9 @@ ${message}`);
|
|
|
2662
2973
|
return requireOptionalPeer(specifier);
|
|
2663
2974
|
}
|
|
2664
2975
|
}, normalizeLoadPaths = (filePath, paths = []) => [
|
|
2665
|
-
|
|
2976
|
+
dirname3(filePath),
|
|
2666
2977
|
process.cwd(),
|
|
2667
|
-
...paths.map((path) =>
|
|
2978
|
+
...paths.map((path) => resolve7(process.cwd(), path))
|
|
2668
2979
|
], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
|
|
2669
2980
|
pattern,
|
|
2670
2981
|
replacements: Array.isArray(value) ? value : [value]
|
|
@@ -2672,7 +2983,7 @@ ${message}`);
|
|
|
2672
2983
|
const cwd = process.cwd();
|
|
2673
2984
|
if (tsconfigAliasCache?.cwd === cwd)
|
|
2674
2985
|
return tsconfigAliasCache;
|
|
2675
|
-
const tsconfigPath =
|
|
2986
|
+
const tsconfigPath = resolve7(cwd, "tsconfig.json");
|
|
2676
2987
|
const empty = { aliases: [], baseUrl: cwd, cwd };
|
|
2677
2988
|
if (!existsSync4(tsconfigPath)) {
|
|
2678
2989
|
tsconfigAliasCache = empty;
|
|
@@ -2681,7 +2992,7 @@ ${message}`);
|
|
|
2681
2992
|
try {
|
|
2682
2993
|
const parsed = JSON.parse(stripJsonComments(readFileSync3(tsconfigPath, "utf-8")));
|
|
2683
2994
|
const compilerOptions = parsed.compilerOptions ?? {};
|
|
2684
|
-
const baseUrl =
|
|
2995
|
+
const baseUrl = resolve7(cwd, compilerOptions.baseUrl ?? ".");
|
|
2685
2996
|
tsconfigAliasCache = {
|
|
2686
2997
|
aliases: normalizeAliasEntries(compilerOptions.paths),
|
|
2687
2998
|
baseUrl,
|
|
@@ -2709,7 +3020,7 @@ ${message}`);
|
|
|
2709
3020
|
continue;
|
|
2710
3021
|
const wildcard = match[1] ?? "";
|
|
2711
3022
|
for (const replacement of alias.replacements) {
|
|
2712
|
-
targets.push(
|
|
3023
|
+
targets.push(resolve7(baseUrl, replacement.replace("*", wildcard)));
|
|
2713
3024
|
}
|
|
2714
3025
|
}
|
|
2715
3026
|
return targets;
|
|
@@ -2723,21 +3034,21 @@ ${message}`);
|
|
|
2723
3034
|
const ext = extname3(basePath);
|
|
2724
3035
|
const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
|
|
2725
3036
|
`${basePath}${extension}`,
|
|
2726
|
-
|
|
3037
|
+
join7(basePath, `index${extension}`)
|
|
2727
3038
|
]);
|
|
2728
3039
|
if (language === "scss" || language === "sass") {
|
|
2729
3040
|
return paths.flatMap((path) => {
|
|
2730
|
-
const dir =
|
|
3041
|
+
const dir = dirname3(path);
|
|
2731
3042
|
const base = path.slice(dir.length + 1);
|
|
2732
|
-
return [path,
|
|
3043
|
+
return [path, join7(dir, `_${base}`)];
|
|
2733
3044
|
});
|
|
2734
3045
|
}
|
|
2735
3046
|
return paths;
|
|
2736
3047
|
}, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
|
|
2737
3048
|
const rawCandidates = [
|
|
2738
3049
|
...resolveAliasTargets(specifier, config),
|
|
2739
|
-
isAbsolute(specifier) ? specifier :
|
|
2740
|
-
...loadPaths.map((path) =>
|
|
3050
|
+
isAbsolute(specifier) ? specifier : resolve7(fromDirectory, specifier),
|
|
3051
|
+
...loadPaths.map((path) => resolve7(path, specifier))
|
|
2741
3052
|
];
|
|
2742
3053
|
for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
|
|
2743
3054
|
if (existsSync4(candidate))
|
|
@@ -2753,8 +3064,8 @@ ${message}`);
|
|
|
2753
3064
|
path: url.slice(0, markerIndex)
|
|
2754
3065
|
};
|
|
2755
3066
|
}, rebaseCssUrls = (contents, sourceFile, entryFile) => {
|
|
2756
|
-
const sourceDir =
|
|
2757
|
-
const entryDir =
|
|
3067
|
+
const sourceDir = dirname3(sourceFile);
|
|
3068
|
+
const entryDir = dirname3(entryFile);
|
|
2758
3069
|
if (sourceDir === entryDir)
|
|
2759
3070
|
return contents;
|
|
2760
3071
|
return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
|
|
@@ -2762,7 +3073,7 @@ ${message}`);
|
|
|
2762
3073
|
if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
|
|
2763
3074
|
return match;
|
|
2764
3075
|
const { marker, path } = splitCssUrl(trimmedUrl);
|
|
2765
|
-
const rebased =
|
|
3076
|
+
const rebased = relative4(entryDir, resolve7(sourceDir, path)).replace(/\\/g, "/");
|
|
2766
3077
|
const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
|
|
2767
3078
|
const nextQuote = quote || '"';
|
|
2768
3079
|
return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
|
|
@@ -2770,7 +3081,7 @@ ${message}`);
|
|
|
2770
3081
|
}, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
|
|
2771
3082
|
if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
|
|
2772
3083
|
return match;
|
|
2773
|
-
const resolved = resolveImportPath(specifier,
|
|
3084
|
+
const resolved = resolveImportPath(specifier, dirname3(sourceFile), loadPaths, language, config);
|
|
2774
3085
|
return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
|
|
2775
3086
|
}), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
|
|
2776
3087
|
const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
|
|
@@ -2800,7 +3111,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2800
3111
|
}
|
|
2801
3112
|
return mod;
|
|
2802
3113
|
}, loadPostcssConfigFile = async (configPath) => {
|
|
2803
|
-
const resolved =
|
|
3114
|
+
const resolved = resolve7(process.cwd(), configPath);
|
|
2804
3115
|
const loaded = resolved.endsWith(".cjs") || resolved.endsWith(".cts") ? requireOptionalPeerSync(resolved) : await importOptionalPeer(`${new URL(`file://${resolved}`).href}?t=${Date.now()}`);
|
|
2805
3116
|
const config = normalizePostcssModule(loaded);
|
|
2806
3117
|
const value = typeof config === "function" ? await config({
|
|
@@ -2860,9 +3171,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2860
3171
|
return result.css;
|
|
2861
3172
|
}, createSassImporter = (entryFile, loadPaths, language, config, deps) => ({
|
|
2862
3173
|
canonicalize(specifier, options) {
|
|
2863
|
-
const fromDirectory = options.containingUrl ?
|
|
3174
|
+
const fromDirectory = options.containingUrl ? dirname3(fileURLToPath(options.containingUrl)) : dirname3(entryFile);
|
|
2864
3175
|
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
2865
|
-
return resolved ? new URL(pathToFileURL(
|
|
3176
|
+
return resolved ? new URL(pathToFileURL(resolve7(resolved)).href) : null;
|
|
2866
3177
|
},
|
|
2867
3178
|
load(canonicalUrl) {
|
|
2868
3179
|
const filePath = fileURLToPath(canonicalUrl);
|
|
@@ -2879,9 +3190,9 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2879
3190
|
install(less, pluginManager) {
|
|
2880
3191
|
const baseManager = new less.FileManager;
|
|
2881
3192
|
const manager = Object.create(baseManager);
|
|
2882
|
-
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename,
|
|
3193
|
+
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve7(currentDirectory), loadPaths, "less", config));
|
|
2883
3194
|
manager.loadFile = async (filename, currentDirectory) => {
|
|
2884
|
-
const resolved = resolveImportPath(filename,
|
|
3195
|
+
const resolved = resolveImportPath(filename, resolve7(currentDirectory), loadPaths, "less", config);
|
|
2885
3196
|
if (!resolved) {
|
|
2886
3197
|
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
2887
3198
|
}
|
|
@@ -2918,29 +3229,29 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2918
3229
|
const stylusDeps = renderer.deps?.();
|
|
2919
3230
|
if (Array.isArray(stylusDeps)) {
|
|
2920
3231
|
for (const dep of stylusDeps)
|
|
2921
|
-
deps.add(
|
|
3232
|
+
deps.add(resolve7(dep));
|
|
2922
3233
|
}
|
|
2923
3234
|
}
|
|
2924
3235
|
resolveCss(css ?? "");
|
|
2925
3236
|
});
|
|
2926
3237
|
});
|
|
2927
3238
|
}, styleDependencyGraph, styleOutputHashes, recordStyleDeps = (entry, deps) => {
|
|
2928
|
-
const key =
|
|
3239
|
+
const key = resolve7(entry);
|
|
2929
3240
|
const stripped = new Set;
|
|
2930
3241
|
for (const dep of deps) {
|
|
2931
|
-
const resolved =
|
|
3242
|
+
const resolved = resolve7(dep);
|
|
2932
3243
|
if (resolved !== key)
|
|
2933
3244
|
stripped.add(resolved);
|
|
2934
3245
|
}
|
|
2935
3246
|
styleDependencyGraph.set(key, stripped);
|
|
2936
3247
|
}, addStyleImporter = (importerPath, stylePath) => {
|
|
2937
|
-
const key =
|
|
2938
|
-
const target =
|
|
3248
|
+
const key = resolve7(importerPath);
|
|
3249
|
+
const target = resolve7(stylePath);
|
|
2939
3250
|
const deps = styleDependencyGraph.get(key) ?? new Set;
|
|
2940
3251
|
deps.add(target);
|
|
2941
3252
|
styleDependencyGraph.set(key, deps);
|
|
2942
3253
|
}, findStyleEntriesImporting = (changedPath) => {
|
|
2943
|
-
const target =
|
|
3254
|
+
const target = resolve7(changedPath);
|
|
2944
3255
|
const importers = [];
|
|
2945
3256
|
for (const [entry, deps] of styleDependencyGraph) {
|
|
2946
3257
|
if (deps.has(target))
|
|
@@ -2948,13 +3259,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2948
3259
|
}
|
|
2949
3260
|
return importers;
|
|
2950
3261
|
}, recordStyleOutput = (entry, css) => {
|
|
2951
|
-
const key =
|
|
3262
|
+
const key = resolve7(entry);
|
|
2952
3263
|
const hash = createHash("sha1").update(css).digest("hex");
|
|
2953
3264
|
const previous = styleOutputHashes.get(key);
|
|
2954
3265
|
styleOutputHashes.set(key, hash);
|
|
2955
3266
|
return previous !== hash;
|
|
2956
3267
|
}, forgetStyleEntry = (entry) => {
|
|
2957
|
-
const key =
|
|
3268
|
+
const key = resolve7(entry);
|
|
2958
3269
|
styleDependencyGraph.delete(key);
|
|
2959
3270
|
styleOutputHashes.delete(key);
|
|
2960
3271
|
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
@@ -2980,7 +3291,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2980
3291
|
loadPaths,
|
|
2981
3292
|
style: "expanded",
|
|
2982
3293
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2983
|
-
url: new URL(pathToFileURL(
|
|
3294
|
+
url: new URL(pathToFileURL(resolve7(filePath)).href)
|
|
2984
3295
|
});
|
|
2985
3296
|
const css = await runPostcss(result.css, filePath, config);
|
|
2986
3297
|
const loadedUrls = result.loadedUrls ?? [];
|
|
@@ -2988,7 +3299,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
2988
3299
|
if (url.protocol !== "file:")
|
|
2989
3300
|
continue;
|
|
2990
3301
|
const dep = fileURLToPath(url);
|
|
2991
|
-
if (
|
|
3302
|
+
if (resolve7(dep) === resolve7(filePath))
|
|
2992
3303
|
continue;
|
|
2993
3304
|
deps.add(dep);
|
|
2994
3305
|
}
|
|
@@ -3109,7 +3420,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3109
3420
|
const start = match.index ?? 0;
|
|
3110
3421
|
const end = start + match[0].length;
|
|
3111
3422
|
parts.push(content.slice(cursor, start));
|
|
3112
|
-
const fullPath = isAbsolute(importPath) ? importPath :
|
|
3423
|
+
const fullPath = isAbsolute(importPath) ? importPath : resolve7(baseDir, importPath);
|
|
3113
3424
|
if (visited.has(fullPath) || !existsSync4(fullPath)) {
|
|
3114
3425
|
parts.push(visited.has(fullPath) ? "" : match[0]);
|
|
3115
3426
|
cursor = end;
|
|
@@ -3118,7 +3429,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3118
3429
|
const nextVisited = new Set(visited);
|
|
3119
3430
|
nextVisited.add(fullPath);
|
|
3120
3431
|
const imported = await readFile(fullPath, "utf-8");
|
|
3121
|
-
parts.push(await resolveCssImportsAsync(imported,
|
|
3432
|
+
parts.push(await resolveCssImportsAsync(imported, dirname3(fullPath), nextVisited));
|
|
3122
3433
|
cursor = end;
|
|
3123
3434
|
}
|
|
3124
3435
|
parts.push(content.slice(cursor));
|
|
@@ -3127,13 +3438,13 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3127
3438
|
if (!isPreprocessableStylePath(filePath)) {
|
|
3128
3439
|
const raw = await readFile(filePath, "utf-8");
|
|
3129
3440
|
const processed = await runPostcss(raw, filePath, config);
|
|
3130
|
-
return resolveCssImportsAsync(processed,
|
|
3441
|
+
return resolveCssImportsAsync(processed, dirname3(filePath), new Set([filePath]));
|
|
3131
3442
|
}
|
|
3132
3443
|
const compiled = await compileStyleSource(filePath, undefined, undefined, config);
|
|
3133
|
-
return resolveCssImportsAsync(compiled,
|
|
3444
|
+
return resolveCssImportsAsync(compiled, dirname3(filePath), new Set([filePath]));
|
|
3134
3445
|
}, resolveCssImportsSync = (content, baseDir, visited) => {
|
|
3135
3446
|
return content.replace(CSS_IMPORT_PATTERN, (match, importPath) => {
|
|
3136
|
-
const fullPath = isAbsolute(importPath) ? importPath :
|
|
3447
|
+
const fullPath = isAbsolute(importPath) ? importPath : resolve7(baseDir, importPath);
|
|
3137
3448
|
if (visited.has(fullPath))
|
|
3138
3449
|
return "";
|
|
3139
3450
|
if (!existsSync4(fullPath))
|
|
@@ -3141,7 +3452,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3141
3452
|
const nextVisited = new Set(visited);
|
|
3142
3453
|
nextVisited.add(fullPath);
|
|
3143
3454
|
const imported = readFileSync3(fullPath, "utf-8");
|
|
3144
|
-
return resolveCssImportsSync(imported,
|
|
3455
|
+
return resolveCssImportsSync(imported, dirname3(fullPath), nextVisited);
|
|
3145
3456
|
});
|
|
3146
3457
|
}, compileStyleFileIfNeededSync = (filePath, config) => {
|
|
3147
3458
|
const rawContents = readFileSync3(filePath, "utf-8");
|
|
@@ -3167,18 +3478,18 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3167
3478
|
loadPaths,
|
|
3168
3479
|
style: "expanded",
|
|
3169
3480
|
syntax: language === "sass" ? "indented" : "scss",
|
|
3170
|
-
url: new URL(pathToFileURL(
|
|
3481
|
+
url: new URL(pathToFileURL(resolve7(filePath)).href)
|
|
3171
3482
|
});
|
|
3172
3483
|
const loadedUrls = result.loadedUrls ?? [];
|
|
3173
3484
|
for (const url of loadedUrls) {
|
|
3174
3485
|
if (url.protocol !== "file:")
|
|
3175
3486
|
continue;
|
|
3176
3487
|
const dep = fileURLToPath(url);
|
|
3177
|
-
if (
|
|
3488
|
+
if (resolve7(dep) === resolve7(filePath))
|
|
3178
3489
|
continue;
|
|
3179
3490
|
addStyleImporter(filePath, dep);
|
|
3180
3491
|
}
|
|
3181
|
-
return resolveCssImportsSync(result.css,
|
|
3492
|
+
return resolveCssImportsSync(result.css, dirname3(filePath), new Set([filePath]));
|
|
3182
3493
|
}
|
|
3183
3494
|
if (language === "less") {
|
|
3184
3495
|
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.`);
|
|
@@ -3186,7 +3497,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
|
|
|
3186
3497
|
if (language === "stylus") {
|
|
3187
3498
|
throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
3188
3499
|
}
|
|
3189
|
-
return resolveCssImportsSync(rawContents,
|
|
3500
|
+
return resolveCssImportsSync(rawContents, dirname3(filePath), new Set([filePath]));
|
|
3190
3501
|
}, getCssOutputExtension = (filePath) => isPreprocessableStylePath(filePath) ? ".css" : extname3(filePath);
|
|
3191
3502
|
var init_stylePreprocessor = __esm(() => {
|
|
3192
3503
|
CSS_EXTENSION_PATTERN = /\.css$/i;
|
|
@@ -3195,7 +3506,7 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
3195
3506
|
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
3196
3507
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
3197
3508
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
3198
|
-
requireFromCwd = createRequire(
|
|
3509
|
+
requireFromCwd = createRequire(join7(process.cwd(), "package.json"));
|
|
3199
3510
|
styleDependencyGraph = new Map;
|
|
3200
3511
|
styleOutputHashes = new Map;
|
|
3201
3512
|
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
@@ -3203,14 +3514,14 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
3203
3514
|
});
|
|
3204
3515
|
|
|
3205
3516
|
// src/core/svelteServerModule.ts
|
|
3206
|
-
import { mkdir, readdir as
|
|
3207
|
-
import { basename as basename2, dirname as
|
|
3208
|
-
var
|
|
3209
|
-
const importPath =
|
|
3517
|
+
import { mkdir as mkdir2, readdir as readdir3 } from "fs/promises";
|
|
3518
|
+
import { basename as basename2, dirname as dirname4, extname as extname4, join as join8, relative as relative5, resolve as resolve8 } from "path";
|
|
3519
|
+
var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
3520
|
+
const importPath = relative5(dirname4(from), target).replace(/\\/g, "/");
|
|
3210
3521
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
3211
3522
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
3212
3523
|
for (const entry of entries) {
|
|
3213
|
-
const entryPath =
|
|
3524
|
+
const entryPath = join8(dir, entry.name);
|
|
3214
3525
|
if (entry.isDirectory())
|
|
3215
3526
|
stack.push(entryPath);
|
|
3216
3527
|
if (entry.isFile() && entry.name === targetFileName) {
|
|
@@ -3224,7 +3535,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3224
3535
|
const nextStack = [];
|
|
3225
3536
|
const dirEntries = await Promise.all(dirs.map(async (dir) => ({
|
|
3226
3537
|
dir,
|
|
3227
|
-
entries: await
|
|
3538
|
+
entries: await readdir3(dir, {
|
|
3228
3539
|
encoding: "utf-8",
|
|
3229
3540
|
withFileTypes: true
|
|
3230
3541
|
})
|
|
@@ -3240,11 +3551,11 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3240
3551
|
if (cachedPath !== undefined) {
|
|
3241
3552
|
return cachedPath;
|
|
3242
3553
|
}
|
|
3243
|
-
if (!sourcePath.includes(`${
|
|
3554
|
+
if (!sourcePath.includes(`${join8(process.cwd(), "build")}${process.platform === "win32" ? "" : "/"}`) && !sourcePath.includes("/build/")) {
|
|
3244
3555
|
originalSourcePathCache.set(sourcePath, sourcePath);
|
|
3245
3556
|
return sourcePath;
|
|
3246
3557
|
}
|
|
3247
|
-
const resolvedSourcePath = await findSourceFileByBasename(
|
|
3558
|
+
const resolvedSourcePath = await findSourceFileByBasename(join8(process.cwd(), "src"), normalizeBuiltSvelteFileName(sourcePath));
|
|
3248
3559
|
const nextPath = resolvedSourcePath ?? sourcePath;
|
|
3249
3560
|
originalSourcePathCache.set(sourcePath, nextPath);
|
|
3250
3561
|
return nextPath;
|
|
@@ -3252,7 +3563,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3252
3563
|
if (!spec.startsWith(".")) {
|
|
3253
3564
|
return null;
|
|
3254
3565
|
}
|
|
3255
|
-
const basePath =
|
|
3566
|
+
const basePath = resolve8(dirname4(from), spec);
|
|
3256
3567
|
const candidates = [
|
|
3257
3568
|
basePath,
|
|
3258
3569
|
`${basePath}.ts`,
|
|
@@ -3260,19 +3571,19 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3260
3571
|
`${basePath}.mjs`,
|
|
3261
3572
|
`${basePath}.cjs`,
|
|
3262
3573
|
`${basePath}.json`,
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3574
|
+
join8(basePath, "index.ts"),
|
|
3575
|
+
join8(basePath, "index.js"),
|
|
3576
|
+
join8(basePath, "index.mjs"),
|
|
3577
|
+
join8(basePath, "index.cjs"),
|
|
3578
|
+
join8(basePath, "index.json")
|
|
3268
3579
|
];
|
|
3269
3580
|
const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
|
|
3270
3581
|
const foundIndex = existResults.indexOf(true);
|
|
3271
3582
|
return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
|
|
3272
|
-
},
|
|
3273
|
-
const relativeSourcePath =
|
|
3583
|
+
}, getCachedModulePath2 = (sourcePath) => {
|
|
3584
|
+
const relativeSourcePath = relative5(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
3274
3585
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
3275
|
-
return
|
|
3586
|
+
return join8(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
3276
3587
|
}, resolveSvelteImport = async (spec, from) => {
|
|
3277
3588
|
if (!spec.startsWith(".") && !spec.startsWith("/")) {
|
|
3278
3589
|
const resolved = resolvePackageImport(spec);
|
|
@@ -3284,7 +3595,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3284
3595
|
if (!spec.startsWith(".")) {
|
|
3285
3596
|
return null;
|
|
3286
3597
|
}
|
|
3287
|
-
const explicitPath =
|
|
3598
|
+
const explicitPath = resolve8(dirname4(from), spec);
|
|
3288
3599
|
if (extname4(explicitPath) === ".svelte") {
|
|
3289
3600
|
return explicitPath;
|
|
3290
3601
|
}
|
|
@@ -3304,7 +3615,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3304
3615
|
}
|
|
3305
3616
|
await Bun.write(path, content);
|
|
3306
3617
|
}, compileSvelteServerModule = async (sourcePath) => {
|
|
3307
|
-
const cachedModulePath =
|
|
3618
|
+
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
3308
3619
|
if (cachedModulePath) {
|
|
3309
3620
|
return cachedModulePath;
|
|
3310
3621
|
}
|
|
@@ -3343,7 +3654,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3343
3654
|
continue;
|
|
3344
3655
|
if (resolvedChildModules[index])
|
|
3345
3656
|
continue;
|
|
3346
|
-
rewrittenModulePaths.set(spec, ensureRelativeImportPath(
|
|
3657
|
+
rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), resolvedModuleImport));
|
|
3347
3658
|
}
|
|
3348
3659
|
for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
|
|
3349
3660
|
transpiled = transpiled.replaceAll(spec, resolvedModuleImport);
|
|
@@ -3357,15 +3668,15 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
3357
3668
|
generate: "server"
|
|
3358
3669
|
}).js.code;
|
|
3359
3670
|
for (const [spec, compiledChildPath] of childModulePaths) {
|
|
3360
|
-
compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(
|
|
3671
|
+
compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
|
|
3361
3672
|
}
|
|
3362
3673
|
for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
|
|
3363
3674
|
compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
|
|
3364
3675
|
}
|
|
3365
|
-
const compiledModulePath =
|
|
3366
|
-
await
|
|
3676
|
+
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
3677
|
+
await mkdir2(dirname4(compiledModulePath), { recursive: true });
|
|
3367
3678
|
await writeIfChanged(compiledModulePath, compiledCode);
|
|
3368
|
-
|
|
3679
|
+
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
3369
3680
|
return compiledModulePath;
|
|
3370
3681
|
};
|
|
3371
3682
|
var init_svelteServerModule = __esm(() => {
|
|
@@ -3373,8 +3684,8 @@ var init_svelteServerModule = __esm(() => {
|
|
|
3373
3684
|
init_lowerIslandSyntax();
|
|
3374
3685
|
init_lowerAwaitSlotSyntax();
|
|
3375
3686
|
init_stylePreprocessor();
|
|
3376
|
-
|
|
3377
|
-
|
|
3687
|
+
serverCacheRoot2 = join8(process.cwd(), ".absolutejs", "islands", "svelte");
|
|
3688
|
+
compiledModuleCache2 = new Map;
|
|
3378
3689
|
originalSourcePathCache = new Map;
|
|
3379
3690
|
transpiler = new Bun.Transpiler({
|
|
3380
3691
|
loader: "ts",
|
|
@@ -3384,16 +3695,16 @@ var init_svelteServerModule = __esm(() => {
|
|
|
3384
3695
|
|
|
3385
3696
|
// src/core/vueServerModule.ts
|
|
3386
3697
|
import { existsSync as existsSync5, readFileSync as readFileSync4, realpathSync } from "fs";
|
|
3387
|
-
import { mkdir as
|
|
3388
|
-
import { dirname as
|
|
3698
|
+
import { mkdir as mkdir3 } from "fs/promises";
|
|
3699
|
+
import { dirname as dirname5, join as join9, relative as relative6, resolve as resolve9 } from "path";
|
|
3389
3700
|
var {Transpiler } = globalThis.Bun;
|
|
3390
|
-
var ISLAND_COMPONENT_ID_LENGTH = 8,
|
|
3391
|
-
const importPath =
|
|
3701
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
3702
|
+
const importPath = relative6(dirname5(from), target).replace(/\\/g, "/");
|
|
3392
3703
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
3393
|
-
},
|
|
3394
|
-
const relativeSourcePath =
|
|
3704
|
+
}, getCachedModulePath3 = (sourcePath) => {
|
|
3705
|
+
const relativeSourcePath = relative6(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
3395
3706
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
3396
|
-
return
|
|
3707
|
+
return join9(serverCacheRoot3, `${normalizedSourcePath}.server.js`);
|
|
3397
3708
|
}, writeIfChanged2 = async (path, content) => {
|
|
3398
3709
|
const targetFile = Bun.file(path);
|
|
3399
3710
|
if (await targetFile.exists()) {
|
|
@@ -3420,7 +3731,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
3420
3731
|
`) : nonVueLines.join(`
|
|
3421
3732
|
`);
|
|
3422
3733
|
}, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
|
|
3423
|
-
const cachedModulePath =
|
|
3734
|
+
const cachedModulePath = compiledModuleCache3.get(sourcePath);
|
|
3424
3735
|
if (cachedModulePath)
|
|
3425
3736
|
return cachedModulePath;
|
|
3426
3737
|
const compiler = await import("@vue/compiler-sfc");
|
|
@@ -3453,7 +3764,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
3453
3764
|
}).code : "const ssrRender = () => {};";
|
|
3454
3765
|
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
3455
3766
|
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
3456
|
-
compiledPath: await compileVueServerModule(
|
|
3767
|
+
compiledPath: await compileVueServerModule(resolve9(dirname5(sourcePath), relativeImport)),
|
|
3457
3768
|
spec: relativeImport
|
|
3458
3769
|
})));
|
|
3459
3770
|
const strippedScript = stripExports(compiledScript.content);
|
|
@@ -3465,20 +3776,20 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
3465
3776
|
"export default script;"
|
|
3466
3777
|
].join(`
|
|
3467
3778
|
`));
|
|
3468
|
-
const compiledModulePath =
|
|
3779
|
+
const compiledModulePath = getCachedModulePath3(sourcePath);
|
|
3469
3780
|
let rewritten = assembled;
|
|
3470
3781
|
for (const child of compiledChildren) {
|
|
3471
3782
|
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
3472
3783
|
}
|
|
3473
|
-
await
|
|
3784
|
+
await mkdir3(dirname5(compiledModulePath), { recursive: true });
|
|
3474
3785
|
await writeIfChanged2(compiledModulePath, rewritten);
|
|
3475
|
-
|
|
3786
|
+
compiledModuleCache3.set(sourcePath, compiledModulePath);
|
|
3476
3787
|
return compiledModulePath;
|
|
3477
3788
|
};
|
|
3478
3789
|
var init_vueServerModule = __esm(() => {
|
|
3479
3790
|
init_constants();
|
|
3480
|
-
|
|
3481
|
-
|
|
3791
|
+
serverCacheRoot3 = join9(process.cwd(), ".absolutejs", "islands", "vue");
|
|
3792
|
+
compiledModuleCache3 = new Map;
|
|
3482
3793
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
3483
3794
|
});
|
|
3484
3795
|
|
|
@@ -3573,8 +3884,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
3573
3884
|
throw new Error("Resolved Vue island is not a valid Vue component.");
|
|
3574
3885
|
}
|
|
3575
3886
|
return resolvedComponent;
|
|
3887
|
+
}, loadAngularServerBuildComponent = async (buildReferencePath, exportName) => {
|
|
3888
|
+
const serverModulePath = await compileAngularServerModule(buildReferencePath);
|
|
3889
|
+
const loadedModule = await import(serverModulePath);
|
|
3890
|
+
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
3891
|
+
return loadedModule[exportName];
|
|
3892
|
+
}
|
|
3893
|
+
return "default" in loadedModule ? loadedModule.default : loadedModule;
|
|
3576
3894
|
}, resolveAngularServerIslandComponent = async (component) => {
|
|
3577
|
-
const
|
|
3895
|
+
const buildReference = getIslandBuildReference(component);
|
|
3896
|
+
const buildReferencePath = buildReference?.source ? resolveBuildReferencePath(buildReference.source, import.meta.url) : null;
|
|
3897
|
+
const resolvedComponent = buildReferencePath ? await loadAngularServerBuildComponent(buildReferencePath, buildReference?.export) : await resolveServerIslandComponent(component);
|
|
3578
3898
|
if (!isAngularServerIslandComponent(resolvedComponent)) {
|
|
3579
3899
|
throw new Error("Resolved Angular island is not a valid Angular component.");
|
|
3580
3900
|
}
|
|
@@ -3630,6 +3950,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
3630
3950
|
};
|
|
3631
3951
|
var init_renderIslandMarkup = __esm(() => {
|
|
3632
3952
|
init_islandSsr();
|
|
3953
|
+
init_angularServerModule();
|
|
3633
3954
|
init_svelteServerModule();
|
|
3634
3955
|
init_vueServerModule();
|
|
3635
3956
|
init_islandMarkupAttributes();
|
|
@@ -3953,7 +4274,7 @@ var init_scanConventions = __esm(() => {
|
|
|
3953
4274
|
|
|
3954
4275
|
// src/build/scanRouteRegistrations.ts
|
|
3955
4276
|
import { readdirSync, readFileSync as readFileSync6 } from "fs";
|
|
3956
|
-
import { join as
|
|
4277
|
+
import { join as join10 } from "path";
|
|
3957
4278
|
import ts2 from "typescript";
|
|
3958
4279
|
var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePath) => {
|
|
3959
4280
|
if (filePath.endsWith(".tsx"))
|
|
@@ -3990,9 +4311,9 @@ var ELYSIA_ROUTE_METHODS, SKIP_DIRS, SOURCE_EXTENSIONS, getScriptKind = (filePat
|
|
|
3990
4311
|
continue;
|
|
3991
4312
|
if (entry.name.startsWith("."))
|
|
3992
4313
|
continue;
|
|
3993
|
-
stack.push(
|
|
4314
|
+
stack.push(join10(dir, entry.name));
|
|
3994
4315
|
} else if (entry.isFile() && hasSourceExtension(entry.name)) {
|
|
3995
|
-
out.push(
|
|
4316
|
+
out.push(join10(dir, entry.name));
|
|
3996
4317
|
}
|
|
3997
4318
|
}
|
|
3998
4319
|
}
|
|
@@ -4182,7 +4503,7 @@ var init_devRouteRegistrationCallsite = __esm(() => {
|
|
|
4182
4503
|
|
|
4183
4504
|
// src/angular/staticAnalyzeSpaRoutes.ts
|
|
4184
4505
|
import { existsSync as existsSync8, promises as fs } from "fs";
|
|
4185
|
-
import { join as
|
|
4506
|
+
import { join as join11 } from "path";
|
|
4186
4507
|
import ts3 from "typescript";
|
|
4187
4508
|
var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN.test(seg) || seg === "**"), importsSymbolFrom = (sf, localName, moduleSpecifier) => {
|
|
4188
4509
|
for (const statement of sf.statements) {
|
|
@@ -4380,7 +4701,7 @@ var DYNAMIC_SEGMENT_PATTERN, pathHasDynamic = (path) => path.split("/").some((se
|
|
|
4380
4701
|
continue;
|
|
4381
4702
|
if (item.name.startsWith("."))
|
|
4382
4703
|
continue;
|
|
4383
|
-
const full =
|
|
4704
|
+
const full = join11(dir, item.name);
|
|
4384
4705
|
if (item.isDirectory()) {
|
|
4385
4706
|
await walkTsFiles(full, out);
|
|
4386
4707
|
} else if (item.isFile() && item.name.endsWith(".ts") && !item.name.endsWith(".d.ts")) {
|
|
@@ -4410,7 +4731,7 @@ var init_staticAnalyzeSpaRoutes = __esm(() => {
|
|
|
4410
4731
|
|
|
4411
4732
|
// src/react/staticAnalyzeSpaRoutes.ts
|
|
4412
4733
|
import { existsSync as existsSync9, promises as fs2 } from "fs";
|
|
4413
|
-
import { join as
|
|
4734
|
+
import { join as join12 } from "path";
|
|
4414
4735
|
import ts4 from "typescript";
|
|
4415
4736
|
var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN2.test(seg) || seg === "**"), readStringLiteral2 = (expression) => {
|
|
4416
4737
|
if (ts4.isStringLiteral(expression) || ts4.isNoSubstitutionTemplateLiteral(expression)) {
|
|
@@ -4590,7 +4911,7 @@ var DYNAMIC_SEGMENT_PATTERN2, pathHasDynamic2 = (path) => path.split("/").some((
|
|
|
4590
4911
|
for (const item of items) {
|
|
4591
4912
|
if (item.name === "node_modules" || item.name.startsWith("."))
|
|
4592
4913
|
continue;
|
|
4593
|
-
const full =
|
|
4914
|
+
const full = join12(dir, item.name);
|
|
4594
4915
|
if (item.isDirectory()) {
|
|
4595
4916
|
await walkSourceFiles(full, out);
|
|
4596
4917
|
} else if (item.isFile() && (item.name.endsWith(".tsx") || item.name.endsWith(".ts") || item.name.endsWith(".jsx") || item.name.endsWith(".js")) && !item.name.endsWith(".d.ts")) {
|
|
@@ -4620,7 +4941,7 @@ var init_staticAnalyzeSpaRoutes2 = __esm(() => {
|
|
|
4620
4941
|
|
|
4621
4942
|
// src/svelte/staticAnalyzeSpaRoutes.ts
|
|
4622
4943
|
import { existsSync as existsSync10, promises as fs3 } from "fs";
|
|
4623
|
-
import { join as
|
|
4944
|
+
import { join as join13 } from "path";
|
|
4624
4945
|
var DYNAMIC_SEGMENT_PATTERN3, pathHasDynamic3 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN3.test(seg) || seg === "**"), joinSegments3 = (parent, child) => {
|
|
4625
4946
|
if (!child)
|
|
4626
4947
|
return parent;
|
|
@@ -4692,7 +5013,7 @@ var DYNAMIC_SEGMENT_PATTERN3, pathHasDynamic3 = (path) => path.split("/").some((
|
|
|
4692
5013
|
for (const item of items) {
|
|
4693
5014
|
if (item.name === "node_modules" || item.name.startsWith("."))
|
|
4694
5015
|
continue;
|
|
4695
|
-
const full =
|
|
5016
|
+
const full = join13(dir, item.name);
|
|
4696
5017
|
if (item.isDirectory()) {
|
|
4697
5018
|
await walkSvelteFiles(full, out);
|
|
4698
5019
|
} else if (item.isFile() && item.name.endsWith(".svelte")) {
|
|
@@ -4724,7 +5045,7 @@ var init_staticAnalyzeSpaRoutes3 = __esm(() => {
|
|
|
4724
5045
|
|
|
4725
5046
|
// src/vue/staticAnalyzeSpaRoutes.ts
|
|
4726
5047
|
import { existsSync as existsSync11, promises as fs4 } from "fs";
|
|
4727
|
-
import { join as
|
|
5048
|
+
import { join as join14 } from "path";
|
|
4728
5049
|
import ts5 from "typescript";
|
|
4729
5050
|
var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((seg) => DYNAMIC_SEGMENT_PATTERN4.test(seg) || seg === "**"), readStringLiteral3 = (expression) => {
|
|
4730
5051
|
if (ts5.isStringLiteral(expression) || ts5.isNoSubstitutionTemplateLiteral(expression)) {
|
|
@@ -4930,7 +5251,7 @@ var DYNAMIC_SEGMENT_PATTERN4, pathHasDynamic4 = (path) => path.split("/").some((
|
|
|
4930
5251
|
for (const item of items) {
|
|
4931
5252
|
if (item.name === "node_modules" || item.name.startsWith("."))
|
|
4932
5253
|
continue;
|
|
4933
|
-
const full =
|
|
5254
|
+
const full = join14(dir, item.name);
|
|
4934
5255
|
if (item.isDirectory()) {
|
|
4935
5256
|
await walkSourceFiles2(full, out);
|
|
4936
5257
|
} else if (item.isFile() && (item.name.endsWith(".ts") || item.name.endsWith(".js") || item.name.endsWith(".vue")) && !item.name.endsWith(".d.ts")) {
|
|
@@ -10101,7 +10422,7 @@ __export(exports_tailwindCompiler, {
|
|
|
10101
10422
|
import { createHash as createHash2 } from "crypto";
|
|
10102
10423
|
import { existsSync as existsSync13, readFileSync as readFileSync7 } from "fs";
|
|
10103
10424
|
import { readFile as readFile2, stat } from "fs/promises";
|
|
10104
|
-
import { dirname as
|
|
10425
|
+
import { dirname as dirname6, isAbsolute as isAbsolute2, resolve as resolve10 } from "path";
|
|
10105
10426
|
var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async () => {
|
|
10106
10427
|
if (cachedTailwindCompile)
|
|
10107
10428
|
return cachedTailwindCompile;
|
|
@@ -10132,7 +10453,7 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
10132
10453
|
} catch {
|
|
10133
10454
|
return Bun.resolveSync(id, base);
|
|
10134
10455
|
}
|
|
10135
|
-
const pkgDir =
|
|
10456
|
+
const pkgDir = dirname6(pkgJsonPath);
|
|
10136
10457
|
let pkg = {};
|
|
10137
10458
|
try {
|
|
10138
10459
|
pkg = JSON.parse(readFileSync7(pkgJsonPath, "utf-8"));
|
|
@@ -10148,23 +10469,23 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
10148
10469
|
"dist/index.css"
|
|
10149
10470
|
].filter((entry) => typeof entry === "string");
|
|
10150
10471
|
for (const candidate of candidates) {
|
|
10151
|
-
const candidatePath =
|
|
10472
|
+
const candidatePath = resolve10(pkgDir, candidate);
|
|
10152
10473
|
if (existsSync13(candidatePath))
|
|
10153
10474
|
return candidatePath;
|
|
10154
10475
|
}
|
|
10155
10476
|
return Bun.resolveSync(id, base);
|
|
10156
10477
|
}, createLoadStylesheet = (deps) => async (id, base) => {
|
|
10157
|
-
const path = id.startsWith(".") || isAbsolute2(id) ?
|
|
10478
|
+
const path = id.startsWith(".") || isAbsolute2(id) ? resolve10(base, id) : resolveBareCssImport(id, base);
|
|
10158
10479
|
const content = await readFile2(path, "utf-8");
|
|
10159
10480
|
await recordDependency(deps, path);
|
|
10160
|
-
return { base:
|
|
10481
|
+
return { base: dirname6(path), content, path };
|
|
10161
10482
|
}, loadModule = async (id, base, _kind) => {
|
|
10162
|
-
const path = id.startsWith(".") || isAbsolute2(id) ?
|
|
10483
|
+
const path = id.startsWith(".") || isAbsolute2(id) ? resolve10(base, id) : Bun.resolveSync(id, base);
|
|
10163
10484
|
const module = await import(path);
|
|
10164
|
-
return { base:
|
|
10485
|
+
return { base: dirname6(path), module, path };
|
|
10165
10486
|
}, buildCompilerEntry = async (cssPath, extraSources = []) => {
|
|
10166
10487
|
const compile = await loadTailwindCompile();
|
|
10167
|
-
const absPath =
|
|
10488
|
+
const absPath = resolve10(cssPath);
|
|
10168
10489
|
const userCss = await readFile2(absPath, "utf-8");
|
|
10169
10490
|
const cssMtimeMs = (await stat(absPath)).mtimeMs;
|
|
10170
10491
|
const cssDependencies = new Map;
|
|
@@ -10174,7 +10495,7 @@ var compilerCache, cachedTailwindCompile = null, loadTailwindCompile = async ()
|
|
|
10174
10495
|
const css = sourceDirectives ? `${sourceDirectives}
|
|
10175
10496
|
${userCss}` : userCss;
|
|
10176
10497
|
const compiler = await compile(css, {
|
|
10177
|
-
base:
|
|
10498
|
+
base: dirname6(absPath),
|
|
10178
10499
|
loadModule,
|
|
10179
10500
|
loadStylesheet: createLoadStylesheet(cssDependencies)
|
|
10180
10501
|
});
|
|
@@ -10197,11 +10518,11 @@ ${userCss}` : userCss;
|
|
|
10197
10518
|
}, hashCss = (css) => createHash2("sha1").update(css).digest("hex"), fileMatchesSources = (file, sources) => {
|
|
10198
10519
|
if (sources.length === 0)
|
|
10199
10520
|
return true;
|
|
10200
|
-
const absFile =
|
|
10521
|
+
const absFile = resolve10(file);
|
|
10201
10522
|
for (const source of sources) {
|
|
10202
10523
|
if (source.negated)
|
|
10203
10524
|
continue;
|
|
10204
|
-
const absolutePattern =
|
|
10525
|
+
const absolutePattern = resolve10(source.base, source.pattern);
|
|
10205
10526
|
if (!/[*?{[]/.test(absolutePattern)) {
|
|
10206
10527
|
if (absolutePattern === absFile)
|
|
10207
10528
|
return true;
|
|
@@ -10246,7 +10567,7 @@ ${userCss}` : userCss;
|
|
|
10246
10567
|
const seen = new Set;
|
|
10247
10568
|
const collected = [];
|
|
10248
10569
|
const scans = sources.filter((source) => !source.negated).map(async (source) => {
|
|
10249
|
-
const absolutePattern =
|
|
10570
|
+
const absolutePattern = resolve10(source.base, source.pattern);
|
|
10250
10571
|
const { glob: relativePattern, root } = splitGlobAtFirstMeta(absolutePattern);
|
|
10251
10572
|
if (!relativePattern) {
|
|
10252
10573
|
try {
|
|
@@ -10258,12 +10579,12 @@ ${userCss}` : userCss;
|
|
|
10258
10579
|
}
|
|
10259
10580
|
const glob = new Bun.Glob(relativePattern);
|
|
10260
10581
|
const matches = [];
|
|
10261
|
-
for await (const
|
|
10582
|
+
for await (const relative7 of glob.scan({
|
|
10262
10583
|
absolute: false,
|
|
10263
10584
|
cwd: root,
|
|
10264
10585
|
onlyFiles: true
|
|
10265
10586
|
})) {
|
|
10266
|
-
matches.push(
|
|
10587
|
+
matches.push(resolve10(root, relative7));
|
|
10267
10588
|
}
|
|
10268
10589
|
return matches;
|
|
10269
10590
|
});
|
|
@@ -10295,7 +10616,7 @@ ${userCss}` : userCss;
|
|
|
10295
10616
|
const results = await Promise.all(checks);
|
|
10296
10617
|
return results.some(Boolean);
|
|
10297
10618
|
}, getCompilerEntry = async (cssPath, extraSources = []) => {
|
|
10298
|
-
const key =
|
|
10619
|
+
const key = resolve10(cssPath);
|
|
10299
10620
|
const cached = compilerCache.get(key);
|
|
10300
10621
|
if (cached && !await isCompilerStale(cached))
|
|
10301
10622
|
return cached;
|
|
@@ -10308,14 +10629,14 @@ ${userCss}` : userCss;
|
|
|
10308
10629
|
compilerCache.clear();
|
|
10309
10630
|
return;
|
|
10310
10631
|
}
|
|
10311
|
-
compilerCache.delete(
|
|
10632
|
+
compilerCache.delete(resolve10(cssPath));
|
|
10312
10633
|
}, incrementalTailwindBuild = async (tailwind, buildPath, changedFiles, styleTransformConfig, extraSources = []) => {
|
|
10313
10634
|
const startedAt = performance.now();
|
|
10314
10635
|
const entry = await getCompilerEntry(tailwind.input, extraSources);
|
|
10315
10636
|
const inputAbs = entry.cssPath;
|
|
10316
10637
|
const filesToRescan = [];
|
|
10317
10638
|
for (const file of changedFiles) {
|
|
10318
|
-
const abs =
|
|
10639
|
+
const abs = resolve10(file);
|
|
10319
10640
|
if (abs === inputAbs)
|
|
10320
10641
|
continue;
|
|
10321
10642
|
if (!fileMatchesSources(abs, entry.sources))
|
|
@@ -10324,7 +10645,7 @@ ${userCss}` : userCss;
|
|
|
10324
10645
|
}
|
|
10325
10646
|
await Promise.all(filesToRescan.map((file) => ingestFile(entry, file)));
|
|
10326
10647
|
const rawCss = entry.compiler.build([...entry.candidateCounts.keys()]);
|
|
10327
|
-
const outputPath =
|
|
10648
|
+
const outputPath = resolve10(buildPath, tailwind.output);
|
|
10328
10649
|
const finalCss = await compileStyleSource(outputPath, rawCss, "css", styleTransformConfig);
|
|
10329
10650
|
const hash = hashCss(finalCss);
|
|
10330
10651
|
const durationMs = performance.now() - startedAt;
|
|
@@ -10351,8 +10672,8 @@ __export(exports_compileTailwind, {
|
|
|
10351
10672
|
compileTailwindConfig: () => compileTailwindConfig,
|
|
10352
10673
|
compileTailwind: () => compileTailwind
|
|
10353
10674
|
});
|
|
10354
|
-
import { mkdir as
|
|
10355
|
-
import { dirname as
|
|
10675
|
+
import { mkdir as mkdir4 } from "fs/promises";
|
|
10676
|
+
import { dirname as dirname7, join as join15, resolve as resolve11 } from "path";
|
|
10356
10677
|
var computeFrameworkTailwindSources = (config) => {
|
|
10357
10678
|
const cwd = process.cwd();
|
|
10358
10679
|
const dirs = [
|
|
@@ -10368,12 +10689,12 @@ var computeFrameworkTailwindSources = (config) => {
|
|
|
10368
10689
|
for (const [dir, glob] of dirs) {
|
|
10369
10690
|
if (!dir)
|
|
10370
10691
|
continue;
|
|
10371
|
-
out.push(`${
|
|
10692
|
+
out.push(`${resolve11(cwd, dir)}/${glob}`);
|
|
10372
10693
|
}
|
|
10373
10694
|
return out;
|
|
10374
10695
|
}, TAILWIND_CANDIDATE_EXTENSION_PATTERN, isTailwindCandidate = (filePath) => TAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath), compileTailwind = async (input, output, buildPath, styleTransformConfig, extraSources = [], changedFiles = []) => {
|
|
10375
|
-
const outputPath =
|
|
10376
|
-
await
|
|
10696
|
+
const outputPath = join15(buildPath, output);
|
|
10697
|
+
await mkdir4(dirname7(outputPath), { recursive: true });
|
|
10377
10698
|
await incrementalTailwindBuild({ input, output }, buildPath, changedFiles, styleTransformConfig, extraSources);
|
|
10378
10699
|
}, compileTailwindConfig = async (tailwind, buildPath, styleTransformConfig, extraSources = [], changedFiles = []) => compileTailwind(tailwind.input, tailwind.output, buildPath, styleTransformConfig, extraSources, changedFiles);
|
|
10379
10700
|
var init_compileTailwind = __esm(() => {
|
|
@@ -10383,7 +10704,7 @@ var init_compileTailwind = __esm(() => {
|
|
|
10383
10704
|
|
|
10384
10705
|
// src/utils/imageProcessing.ts
|
|
10385
10706
|
import { existsSync as existsSync14, mkdirSync as mkdirSync3, readFileSync as readFileSync8, writeFileSync as writeFileSync3 } from "fs";
|
|
10386
|
-
import { join as
|
|
10707
|
+
import { join as join16, resolve as resolve12 } from "path";
|
|
10387
10708
|
var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_ENDPOINT = "/_absolute/image", BLUR_DEVIATION = 20, sharpModule = undefined, sharpLoaded = false, sharpWarned = false, snapToSize = (target, sizes) => {
|
|
10388
10709
|
for (const size of sizes) {
|
|
10389
10710
|
if (size >= target)
|
|
@@ -10433,7 +10754,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
10433
10754
|
const image = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
|
|
10434
10755
|
return [...device, ...image].sort((left, right) => left - right);
|
|
10435
10756
|
}, getCacheDir = (buildDir) => {
|
|
10436
|
-
const dir =
|
|
10757
|
+
const dir = join16(buildDir, ".cache", "images");
|
|
10437
10758
|
if (!existsSync14(dir))
|
|
10438
10759
|
mkdirSync3(dir, { recursive: true });
|
|
10439
10760
|
return dir;
|
|
@@ -10514,8 +10835,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
10514
10835
|
throw err;
|
|
10515
10836
|
}
|
|
10516
10837
|
}, readFromCache = (cacheDir, cacheKey) => {
|
|
10517
|
-
const metaPath =
|
|
10518
|
-
const dataPath =
|
|
10838
|
+
const metaPath = join16(cacheDir, `${cacheKey}.meta`);
|
|
10839
|
+
const dataPath = join16(cacheDir, `${cacheKey}.data`);
|
|
10519
10840
|
if (!existsSync14(metaPath) || !existsSync14(dataPath))
|
|
10520
10841
|
return null;
|
|
10521
10842
|
try {
|
|
@@ -10530,7 +10851,7 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
10530
10851
|
return sharpModule;
|
|
10531
10852
|
sharpLoaded = true;
|
|
10532
10853
|
try {
|
|
10533
|
-
const sharpPath =
|
|
10854
|
+
const sharpPath = resolve12(process.cwd(), "node_modules/sharp");
|
|
10534
10855
|
const mod = await import(sharpPath);
|
|
10535
10856
|
sharpModule = mod.default ?? mod;
|
|
10536
10857
|
return sharpModule;
|
|
@@ -10542,8 +10863,8 @@ var DEFAULT_DEVICE_SIZES, DEFAULT_IMAGE_SIZES, DEFAULT_QUALITY, OPTIMIZATION_END
|
|
|
10542
10863
|
return null;
|
|
10543
10864
|
}
|
|
10544
10865
|
}, writeToCache = (cacheDir, cacheKey, buffer, meta) => {
|
|
10545
|
-
const metaPath =
|
|
10546
|
-
const dataPath =
|
|
10866
|
+
const metaPath = join16(cacheDir, `${cacheKey}.meta`);
|
|
10867
|
+
const dataPath = join16(cacheDir, `${cacheKey}.data`);
|
|
10547
10868
|
writeFileSync3(dataPath, buffer);
|
|
10548
10869
|
writeFileSync3(metaPath, JSON.stringify(meta));
|
|
10549
10870
|
};
|
|
@@ -10631,7 +10952,7 @@ var init_optimizeHtmlImages = __esm(() => {
|
|
|
10631
10952
|
// src/cli/scripts/telemetry.ts
|
|
10632
10953
|
import { existsSync as existsSync15, mkdirSync as mkdirSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "fs";
|
|
10633
10954
|
import { homedir } from "os";
|
|
10634
|
-
import { join as
|
|
10955
|
+
import { join as join17 } from "path";
|
|
10635
10956
|
var configDir, configPath, getTelemetryConfig = () => {
|
|
10636
10957
|
try {
|
|
10637
10958
|
if (!existsSync15(configPath))
|
|
@@ -10644,14 +10965,14 @@ var configDir, configPath, getTelemetryConfig = () => {
|
|
|
10644
10965
|
}
|
|
10645
10966
|
};
|
|
10646
10967
|
var init_telemetry = __esm(() => {
|
|
10647
|
-
configDir =
|
|
10648
|
-
configPath =
|
|
10968
|
+
configDir = join17(homedir(), ".absolutejs");
|
|
10969
|
+
configPath = join17(configDir, "telemetry.json");
|
|
10649
10970
|
});
|
|
10650
10971
|
|
|
10651
10972
|
// src/cli/telemetryEvent.ts
|
|
10652
10973
|
import { existsSync as existsSync16, readFileSync as readFileSync10 } from "fs";
|
|
10653
|
-
import { arch, platform } from "os";
|
|
10654
|
-
import { dirname as
|
|
10974
|
+
import { arch as arch2, platform as platform2 } from "os";
|
|
10975
|
+
import { dirname as dirname8, join as join18, parse } from "path";
|
|
10655
10976
|
var checkCandidate = (candidate) => {
|
|
10656
10977
|
if (!existsSync16(candidate)) {
|
|
10657
10978
|
return null;
|
|
@@ -10671,12 +10992,12 @@ var checkCandidate = (candidate) => {
|
|
|
10671
10992
|
}, findPackageVersion = () => {
|
|
10672
10993
|
let { dir } = import.meta;
|
|
10673
10994
|
while (dir !== parse(dir).root) {
|
|
10674
|
-
const candidate =
|
|
10995
|
+
const candidate = join18(dir, "package.json");
|
|
10675
10996
|
const version = checkCandidate(candidate);
|
|
10676
10997
|
if (version) {
|
|
10677
10998
|
return version;
|
|
10678
10999
|
}
|
|
10679
|
-
dir =
|
|
11000
|
+
dir = dirname8(dir);
|
|
10680
11001
|
}
|
|
10681
11002
|
return "unknown";
|
|
10682
11003
|
}, sendTelemetryEvent = (event, payload) => {
|
|
@@ -10688,10 +11009,10 @@ var checkCandidate = (candidate) => {
|
|
|
10688
11009
|
return;
|
|
10689
11010
|
const body = {
|
|
10690
11011
|
anonymousId: config.anonymousId,
|
|
10691
|
-
arch:
|
|
11012
|
+
arch: arch2(),
|
|
10692
11013
|
bunVersion: Bun.version,
|
|
10693
11014
|
event,
|
|
10694
|
-
os:
|
|
11015
|
+
os: platform2(),
|
|
10695
11016
|
payload,
|
|
10696
11017
|
timestamp: new Date().toISOString(),
|
|
10697
11018
|
version: getVersion()
|
|
@@ -10769,107 +11090,46 @@ __export(exports_buildHMRClient, {
|
|
|
10769
11090
|
buildHMRClient: () => buildHMRClient
|
|
10770
11091
|
});
|
|
10771
11092
|
import { existsSync as existsSync17 } from "fs";
|
|
10772
|
-
import { resolve as
|
|
11093
|
+
import { resolve as resolve13 } from "path";
|
|
10773
11094
|
var {build: bunBuild } = globalThis.Bun;
|
|
10774
11095
|
var resolveHmrClientPath = () => {
|
|
10775
11096
|
const projectRoot = process.cwd();
|
|
10776
|
-
const fromSource =
|
|
11097
|
+
const fromSource = resolve13(import.meta.dir, "client/hmrClient.ts");
|
|
10777
11098
|
if (existsSync17(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
10778
11099
|
return fromSource;
|
|
10779
11100
|
}
|
|
10780
|
-
const fromNodeModules =
|
|
11101
|
+
const fromNodeModules = resolve13(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client/hmrClient.ts");
|
|
10781
11102
|
if (existsSync17(fromNodeModules))
|
|
10782
11103
|
return fromNodeModules;
|
|
10783
|
-
return
|
|
11104
|
+
return resolve13(import.meta.dir, "dev/client/hmrClient.ts");
|
|
10784
11105
|
}, hmrClientPath2, buildHMRClient = async () => {
|
|
10785
11106
|
const entryPoint = hmrClientPath2;
|
|
10786
|
-
const result = await bunBuild({
|
|
10787
|
-
entrypoints: [entryPoint],
|
|
10788
|
-
format: "iife",
|
|
10789
|
-
minify: false,
|
|
10790
|
-
target: "browser"
|
|
10791
|
-
});
|
|
10792
|
-
if (!result.success) {
|
|
10793
|
-
console.error("Failed to build HMR client:", result.logs);
|
|
10794
|
-
sendTelemetryEvent("hmr:client-build-failed", {
|
|
10795
|
-
logCount: result.logs.length,
|
|
10796
|
-
message: result.logs.map((log2) => log2.message).join("; ")
|
|
10797
|
-
});
|
|
10798
|
-
return "// HMR client build failed";
|
|
10799
|
-
}
|
|
10800
|
-
const [firstOutput] = result.outputs;
|
|
10801
|
-
if (!firstOutput)
|
|
10802
|
-
return "// HMR client build failed";
|
|
10803
|
-
return firstOutput.text();
|
|
10804
|
-
};
|
|
10805
|
-
var init_buildHMRClient = __esm(() => {
|
|
10806
|
-
init_telemetryEvent();
|
|
10807
|
-
hmrClientPath2 = resolveHmrClientPath();
|
|
10808
|
-
});
|
|
10809
|
-
|
|
10810
|
-
// src/build/nativeRewrite.ts
|
|
10811
|
-
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
10812
|
-
import { platform as platform2, arch as arch2 } from "os";
|
|
10813
|
-
import { resolve as resolve13 } from "path";
|
|
10814
|
-
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
10815
|
-
if (nativeLib !== null)
|
|
10816
|
-
return nativeLib;
|
|
10817
|
-
const osPlatform = platform2();
|
|
10818
|
-
const cpu = arch2();
|
|
10819
|
-
const platformMap = {
|
|
10820
|
-
"darwin-arm64": "darwin-arm64/fast_ops.dylib",
|
|
10821
|
-
"darwin-x64": "darwin-x64/fast_ops.dylib",
|
|
10822
|
-
"linux-arm64": "linux-arm64/fast_ops.so",
|
|
10823
|
-
"linux-x64": "linux-x64/fast_ops.so",
|
|
10824
|
-
"win32-arm64": "windows-arm64/fast_ops.dll",
|
|
10825
|
-
"win32-x64": "windows-x64/fast_ops.dll"
|
|
10826
|
-
};
|
|
10827
|
-
const libPath = platformMap[`${osPlatform}-${cpu}`];
|
|
10828
|
-
if (!libPath)
|
|
10829
|
-
return null;
|
|
10830
|
-
try {
|
|
10831
|
-
const fullPath = resolve13(import.meta.dir, "../../native/packages", libPath);
|
|
10832
|
-
const lib = dlopen(fullPath, ffiDefinition);
|
|
10833
|
-
nativeLib = lib.symbols;
|
|
10834
|
-
return nativeLib;
|
|
10835
|
-
} catch {
|
|
10836
|
-
return null;
|
|
11107
|
+
const result = await bunBuild({
|
|
11108
|
+
entrypoints: [entryPoint],
|
|
11109
|
+
format: "iife",
|
|
11110
|
+
minify: false,
|
|
11111
|
+
target: "browser"
|
|
11112
|
+
});
|
|
11113
|
+
if (!result.success) {
|
|
11114
|
+
console.error("Failed to build HMR client:", result.logs);
|
|
11115
|
+
sendTelemetryEvent("hmr:client-build-failed", {
|
|
11116
|
+
logCount: result.logs.length,
|
|
11117
|
+
message: result.logs.map((log2) => log2.message).join("; ")
|
|
11118
|
+
});
|
|
11119
|
+
return "// HMR client build failed";
|
|
10837
11120
|
}
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
const jsonStr = JSON.stringify(replacements);
|
|
10843
|
-
const contentBuf = Buffer.from(content);
|
|
10844
|
-
const jsonBuf = Buffer.from(jsonStr);
|
|
10845
|
-
const outBuf = Buffer.alloc(content.length * 2);
|
|
10846
|
-
const outLenBuf = new BigUint64Array([BigInt(outBuf.length)]);
|
|
10847
|
-
const result = lib.rewrite_imports(ptr(contentBuf), contentBuf.length, ptr(jsonBuf), jsonBuf.length, ptr(outBuf), ptr(new Uint8Array(outLenBuf.buffer)));
|
|
10848
|
-
if (result < 0)
|
|
10849
|
-
return null;
|
|
10850
|
-
if (result === 0)
|
|
10851
|
-
return content;
|
|
10852
|
-
const outLen = Number(outLenBuf[0]);
|
|
10853
|
-
return outBuf.subarray(0, outLen).toString("utf-8");
|
|
11121
|
+
const [firstOutput] = result.outputs;
|
|
11122
|
+
if (!firstOutput)
|
|
11123
|
+
return "// HMR client build failed";
|
|
11124
|
+
return firstOutput.text();
|
|
10854
11125
|
};
|
|
10855
|
-
var
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
args: [
|
|
10859
|
-
FFIType.ptr,
|
|
10860
|
-
FFIType.u64,
|
|
10861
|
-
FFIType.ptr,
|
|
10862
|
-
FFIType.u64,
|
|
10863
|
-
FFIType.ptr,
|
|
10864
|
-
FFIType.ptr
|
|
10865
|
-
],
|
|
10866
|
-
returns: FFIType.i32
|
|
10867
|
-
}
|
|
10868
|
-
};
|
|
11126
|
+
var init_buildHMRClient = __esm(() => {
|
|
11127
|
+
init_telemetryEvent();
|
|
11128
|
+
hmrClientPath2 = resolveHmrClientPath();
|
|
10869
11129
|
});
|
|
10870
11130
|
|
|
10871
11131
|
// src/build/rewriteReactImports.ts
|
|
10872
|
-
var
|
|
11132
|
+
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), rewriterCache, cacheKey = (vendorPaths) => {
|
|
10873
11133
|
const entries = Object.entries(vendorPaths).sort(([left], [right]) => left.localeCompare(right));
|
|
10874
11134
|
let key = "";
|
|
10875
11135
|
for (const [k2, v2] of entries) {
|
|
@@ -10883,7 +11143,7 @@ var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), rewriterC
|
|
|
10883
11143
|
return cached;
|
|
10884
11144
|
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
10885
11145
|
const lookup = new Map(replacements);
|
|
10886
|
-
const alt = replacements.map(([spec]) =>
|
|
11146
|
+
const alt = replacements.map(([spec]) => escapeRegex2(spec)).join("|");
|
|
10887
11147
|
const fromRegex = new RegExp(`(from\\s*["'])(${alt})(["'])`, "g");
|
|
10888
11148
|
const sideEffectRegex = new RegExp(`(import\\s*["'])(${alt})(["']\\s*;?)`, "g");
|
|
10889
11149
|
const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])(${alt})(["']\\s*\\))`, "g");
|
|
@@ -10974,7 +11234,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
10974
11234
|
|
|
10975
11235
|
// src/build/angularLinkerPlugin.ts
|
|
10976
11236
|
import { existsSync as existsSync18, mkdirSync as mkdirSync5, readFileSync as readFileSync11, writeFileSync as writeFileSync5 } from "fs";
|
|
10977
|
-
import { dirname as
|
|
11237
|
+
import { dirname as dirname9, join as join19, relative as relative7, resolve as resolve14 } from "path";
|
|
10978
11238
|
import { createHash as createHash3 } from "crypto";
|
|
10979
11239
|
var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
10980
11240
|
name: "angular-linker",
|
|
@@ -10982,7 +11242,7 @@ var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linker
|
|
|
10982
11242
|
let needsLinking;
|
|
10983
11243
|
let babelTransform;
|
|
10984
11244
|
let linkerPlugin;
|
|
10985
|
-
const cacheDir =
|
|
11245
|
+
const cacheDir = join19(CACHE_ROOT, linkerJitMode ? "jit" : "aot");
|
|
10986
11246
|
bld.onLoad({ filter: ANGULAR_LINKER_CANDIDATE_RE }, async (args) => {
|
|
10987
11247
|
const source = await Bun.file(args.path).text();
|
|
10988
11248
|
if (!needsLinking) {
|
|
@@ -10995,7 +11255,7 @@ var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linker
|
|
|
10995
11255
|
return;
|
|
10996
11256
|
}
|
|
10997
11257
|
const hash = createHash3("md5").update(source).digest("hex");
|
|
10998
|
-
const cachePath =
|
|
11258
|
+
const cachePath = join19(cacheDir, `${hash}.js`);
|
|
10999
11259
|
if (existsSync18(cachePath)) {
|
|
11000
11260
|
return {
|
|
11001
11261
|
contents: readFileSync11(cachePath, "utf-8"),
|
|
@@ -11012,10 +11272,10 @@ var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linker
|
|
|
11012
11272
|
const mod = await import(linkerSpecifier);
|
|
11013
11273
|
linkerPlugin = mod.createEs2015LinkerPlugin({
|
|
11014
11274
|
fileSystem: {
|
|
11015
|
-
dirname:
|
|
11275
|
+
dirname: dirname9,
|
|
11016
11276
|
exists: existsSync18,
|
|
11017
11277
|
readFile: readFileSync11,
|
|
11018
|
-
relative:
|
|
11278
|
+
relative: relative7,
|
|
11019
11279
|
resolve: resolve14
|
|
11020
11280
|
},
|
|
11021
11281
|
linkerJitMode,
|
|
@@ -11054,7 +11314,7 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
11054
11314
|
|
|
11055
11315
|
// src/build/externalAssetPlugin.ts
|
|
11056
11316
|
import { copyFileSync, existsSync as existsSync19, mkdirSync as mkdirSync6, statSync } from "fs";
|
|
11057
|
-
import { basename as basename4, dirname as
|
|
11317
|
+
import { basename as basename4, dirname as dirname10, join as join20, resolve as resolve15 } from "path";
|
|
11058
11318
|
var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
11059
11319
|
name: "absolute-external-asset",
|
|
11060
11320
|
setup(bld) {
|
|
@@ -11069,7 +11329,7 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
11069
11329
|
return;
|
|
11070
11330
|
urlPattern.lastIndex = 0;
|
|
11071
11331
|
let match;
|
|
11072
|
-
const sourceDir =
|
|
11332
|
+
const sourceDir = dirname10(args.path);
|
|
11073
11333
|
while ((match = urlPattern.exec(source)) !== null) {
|
|
11074
11334
|
const relPath = match[1];
|
|
11075
11335
|
if (!relPath)
|
|
@@ -11079,10 +11339,10 @@ var createExternalAssetPlugin = (outDir, userSourceRoots = []) => ({
|
|
|
11079
11339
|
continue;
|
|
11080
11340
|
if (!statSync(assetPath).isFile())
|
|
11081
11341
|
continue;
|
|
11082
|
-
const targetPath =
|
|
11342
|
+
const targetPath = join20(outDir, basename4(assetPath));
|
|
11083
11343
|
if (existsSync19(targetPath))
|
|
11084
11344
|
continue;
|
|
11085
|
-
mkdirSync6(
|
|
11345
|
+
mkdirSync6(dirname10(targetPath), { recursive: true });
|
|
11086
11346
|
copyFileSync(assetPath, targetPath);
|
|
11087
11347
|
}
|
|
11088
11348
|
return;
|
|
@@ -11290,7 +11550,7 @@ __export(exports_hmrInjectionPlugin, {
|
|
|
11290
11550
|
applyAngularHmrInjection: () => applyAngularHmrInjection
|
|
11291
11551
|
});
|
|
11292
11552
|
import { readFile as readFile5 } from "fs/promises";
|
|
11293
|
-
import { relative as
|
|
11553
|
+
import { relative as relative8, resolve as resolve16 } from "path";
|
|
11294
11554
|
var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames = (jsSource) => {
|
|
11295
11555
|
const names = new Set;
|
|
11296
11556
|
IMPORT_RE.lastIndex = 0;
|
|
@@ -11470,9 +11730,9 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
|
|
|
11470
11730
|
}
|
|
11471
11731
|
if (classNames.length === 0)
|
|
11472
11732
|
return;
|
|
11473
|
-
const relFromGenRoot =
|
|
11733
|
+
const relFromGenRoot = relative8(generatedAngularRoot, componentJsAbsPath).replace(/\\/g, "/");
|
|
11474
11734
|
const userTsPath = resolve16(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
|
|
11475
|
-
const projectRel =
|
|
11735
|
+
const projectRel = relative8(projectRoot, userTsPath).replace(/\\/g, "/");
|
|
11476
11736
|
const tail = classNames.map((className) => {
|
|
11477
11737
|
const id = `${projectRel}@${className}`;
|
|
11478
11738
|
return buildHmrTail(className, JSON.stringify(id));
|
|
@@ -11512,11 +11772,11 @@ var HASHED_FILE_PATTERN, cleanStaleOutputs = async (buildPath, currentOutputPath
|
|
|
11512
11772
|
const currentPaths = new Set(currentOutputPaths.map((path) => resolve17(path)));
|
|
11513
11773
|
const glob = new Glob5("**/*");
|
|
11514
11774
|
const removals = [];
|
|
11515
|
-
for (const
|
|
11516
|
-
const absolute = resolve17(buildPath,
|
|
11775
|
+
for (const relative9 of glob.scanSync({ cwd: buildPath })) {
|
|
11776
|
+
const absolute = resolve17(buildPath, relative9);
|
|
11517
11777
|
if (currentPaths.has(absolute))
|
|
11518
11778
|
continue;
|
|
11519
|
-
if (!HASHED_FILE_PATTERN.test(
|
|
11779
|
+
if (!HASHED_FILE_PATTERN.test(relative9))
|
|
11520
11780
|
continue;
|
|
11521
11781
|
removals.push(rm2(absolute, { force: true }));
|
|
11522
11782
|
}
|
|
@@ -11532,20 +11792,20 @@ __export(exports_generatedDir, {
|
|
|
11532
11792
|
getGeneratedRoot: () => getGeneratedRoot,
|
|
11533
11793
|
getFrameworkGeneratedDir: () => getFrameworkGeneratedDir
|
|
11534
11794
|
});
|
|
11535
|
-
import { join as
|
|
11536
|
-
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) =>
|
|
11795
|
+
import { join as join21 } from "path";
|
|
11796
|
+
var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getGeneratedRoot = (projectRoot = process.cwd()) => join21(projectRoot, ABSOLUTE_CACHE_DIR_NAME, GENERATED_DIR_NAME), getFrameworkGeneratedDir = (framework, projectRoot = process.cwd()) => join21(getGeneratedRoot(projectRoot), framework);
|
|
11537
11797
|
var init_generatedDir = () => {};
|
|
11538
11798
|
|
|
11539
11799
|
// src/utils/cleanup.ts
|
|
11540
11800
|
import { rm as rm3 } from "fs/promises";
|
|
11541
|
-
import { join as
|
|
11801
|
+
import { join as join22 } from "path";
|
|
11542
11802
|
var removeIfExists = (path) => rm3(path, { force: true, recursive: true }), cleanFramework = (framework, frameworkDir, skipGenerated = false) => {
|
|
11543
11803
|
const tasks = [];
|
|
11544
11804
|
if (!skipGenerated) {
|
|
11545
11805
|
tasks.push(removeIfExists(getFrameworkGeneratedDir(framework)));
|
|
11546
11806
|
}
|
|
11547
11807
|
if (frameworkDir)
|
|
11548
|
-
tasks.push(removeIfExists(
|
|
11808
|
+
tasks.push(removeIfExists(join22(frameworkDir, "generated")));
|
|
11549
11809
|
return Promise.all(tasks);
|
|
11550
11810
|
}, cleanup = async ({
|
|
11551
11811
|
angularDir,
|
|
@@ -11584,7 +11844,7 @@ var init_commonAncestor = () => {};
|
|
|
11584
11844
|
|
|
11585
11845
|
// src/utils/buildDirectoryLock.ts
|
|
11586
11846
|
import { mkdirSync as mkdirSync7, unlinkSync, writeFileSync as writeFileSync6, readFileSync as readFileSync12 } from "fs";
|
|
11587
|
-
import { dirname as
|
|
11847
|
+
import { dirname as dirname11, join as join23 } from "path";
|
|
11588
11848
|
var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandlersRegistered = false, registerExitHandlersOnce = () => {
|
|
11589
11849
|
if (exitHandlersRegistered)
|
|
11590
11850
|
return;
|
|
@@ -11610,7 +11870,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
11610
11870
|
releaseAllSync();
|
|
11611
11871
|
throw err;
|
|
11612
11872
|
});
|
|
11613
|
-
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) =>
|
|
11873
|
+
}, isAlreadyExistsError = (error) => error instanceof Error && ("code" in error) && error.code === "EEXIST", lockPathForBuildDirectory = (buildDirectory) => join23(dirname11(buildDirectory), ".absolutejs", "build.lock"), readHeldLockEnv = () => new Set((process.env[HELD_LOCKS_ENV] ?? "").split(`
|
|
11614
11874
|
`).filter((entry) => entry.length > 0)), writeHeldLockEnv = (locks) => {
|
|
11615
11875
|
if (locks.size === 0) {
|
|
11616
11876
|
delete process.env[HELD_LOCKS_ENV];
|
|
@@ -11627,7 +11887,7 @@ var heldLocks, HELD_LOCKS_ENV = "ABSOLUTE_HELD_BUILD_DIRECTORY_LOCKS", exitHandl
|
|
|
11627
11887
|
locks.delete(buildDirectory);
|
|
11628
11888
|
writeHeldLockEnv(locks);
|
|
11629
11889
|
}, writeLockFileSync = (lockPath, metadata) => {
|
|
11630
|
-
mkdirSync7(
|
|
11890
|
+
mkdirSync7(dirname11(lockPath), { recursive: true });
|
|
11631
11891
|
writeFileSync6(lockPath, JSON.stringify(metadata, null, 2), { flag: "wx" });
|
|
11632
11892
|
}, readLockMetadata = (lockPath) => {
|
|
11633
11893
|
try {
|
|
@@ -11747,11 +12007,11 @@ var init_buildDirectoryLock = __esm(() => {
|
|
|
11747
12007
|
});
|
|
11748
12008
|
|
|
11749
12009
|
// src/utils/validateSafePath.ts
|
|
11750
|
-
import { resolve as resolve18, relative as
|
|
12010
|
+
import { resolve as resolve18, relative as relative9 } from "path";
|
|
11751
12011
|
var validateSafePath = (targetPath, baseDirectory) => {
|
|
11752
12012
|
const absoluteBase = resolve18(baseDirectory);
|
|
11753
12013
|
const absoluteTarget = resolve18(baseDirectory, targetPath);
|
|
11754
|
-
const relativePath = normalizePath(
|
|
12014
|
+
const relativePath = normalizePath(relative9(absoluteBase, absoluteTarget));
|
|
11755
12015
|
if (relativePath.startsWith("../") || relativePath === "..") {
|
|
11756
12016
|
throw new Error(`Unsafe path: ${targetPath}`);
|
|
11757
12017
|
}
|
|
@@ -11765,7 +12025,7 @@ __export(exports_scanVueSsrOnlyPages, {
|
|
|
11765
12025
|
scanVueSsrOnlyPages: () => scanVueSsrOnlyPages
|
|
11766
12026
|
});
|
|
11767
12027
|
import { readdirSync as readdirSync2, readFileSync as readFileSync13 } from "fs";
|
|
11768
|
-
import { join as
|
|
12028
|
+
import { join as join24 } from "path";
|
|
11769
12029
|
import ts7 from "typescript";
|
|
11770
12030
|
var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind2 = (filePath) => {
|
|
11771
12031
|
if (filePath.endsWith(".tsx"))
|
|
@@ -11798,9 +12058,9 @@ var SKIP_DIRS2, SOURCE_EXTENSIONS2, getScriptKind2 = (filePath) => {
|
|
|
11798
12058
|
continue;
|
|
11799
12059
|
if (entry.name.startsWith("."))
|
|
11800
12060
|
continue;
|
|
11801
|
-
stack.push(
|
|
12061
|
+
stack.push(join24(dir, entry.name));
|
|
11802
12062
|
} else if (entry.isFile() && hasSourceExtension2(entry.name)) {
|
|
11803
|
-
out.push(
|
|
12063
|
+
out.push(join24(dir, entry.name));
|
|
11804
12064
|
}
|
|
11805
12065
|
}
|
|
11806
12066
|
}
|
|
@@ -11912,7 +12172,7 @@ var init_scanVueSsrOnlyPages = __esm(() => {
|
|
|
11912
12172
|
|
|
11913
12173
|
// src/build/scanAngularHandlerCalls.ts
|
|
11914
12174
|
import { readdirSync as readdirSync3, readFileSync as readFileSync14 } from "fs";
|
|
11915
|
-
import { join as
|
|
12175
|
+
import { join as join25 } from "path";
|
|
11916
12176
|
import ts8 from "typescript";
|
|
11917
12177
|
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind3 = (filePath) => {
|
|
11918
12178
|
if (filePath.endsWith(".tsx"))
|
|
@@ -11945,9 +12205,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind3 = (fil
|
|
|
11945
12205
|
continue;
|
|
11946
12206
|
if (entry.name.startsWith("."))
|
|
11947
12207
|
continue;
|
|
11948
|
-
stack.push(
|
|
12208
|
+
stack.push(join25(dir, entry.name));
|
|
11949
12209
|
} else if (entry.isFile() && hasSourceExtension3(entry.name)) {
|
|
11950
|
-
out.push(
|
|
12210
|
+
out.push(join25(dir, entry.name));
|
|
11951
12211
|
}
|
|
11952
12212
|
}
|
|
11953
12213
|
}
|
|
@@ -12062,7 +12322,7 @@ var init_scanAngularHandlerCalls = __esm(() => {
|
|
|
12062
12322
|
|
|
12063
12323
|
// src/build/scanAngularPageRoutes.ts
|
|
12064
12324
|
import { readdirSync as readdirSync4, readFileSync as readFileSync15 } from "fs";
|
|
12065
|
-
import { basename as basename6, join as
|
|
12325
|
+
import { basename as basename6, join as join26 } from "path";
|
|
12066
12326
|
import ts9 from "typescript";
|
|
12067
12327
|
var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
12068
12328
|
const idx = filePath.lastIndexOf(".");
|
|
@@ -12102,9 +12362,9 @@ var SOURCE_EXTENSIONS4, SKIP_DIRS4, hasSourceExtension4 = (filePath) => {
|
|
|
12102
12362
|
continue;
|
|
12103
12363
|
if (entry.name.startsWith("."))
|
|
12104
12364
|
continue;
|
|
12105
|
-
stack.push(
|
|
12365
|
+
stack.push(join26(dir, entry.name));
|
|
12106
12366
|
} else if (entry.isFile() && isPageFile(entry.name)) {
|
|
12107
|
-
out.push(
|
|
12367
|
+
out.push(join26(dir, entry.name));
|
|
12108
12368
|
}
|
|
12109
12369
|
}
|
|
12110
12370
|
}
|
|
@@ -12181,7 +12441,7 @@ __export(exports_parseAngularConfigImports, {
|
|
|
12181
12441
|
parseAngularProvidersImport: () => parseAngularProvidersImport
|
|
12182
12442
|
});
|
|
12183
12443
|
import { existsSync as existsSync20, readFileSync as readFileSync16 } from "fs";
|
|
12184
|
-
import { dirname as
|
|
12444
|
+
import { dirname as dirname12, isAbsolute as isAbsolute3, join as join27 } from "path";
|
|
12185
12445
|
import ts10 from "typescript";
|
|
12186
12446
|
var findDefineConfigCall = (sf) => {
|
|
12187
12447
|
let result = null;
|
|
@@ -12236,15 +12496,15 @@ var findDefineConfigCall = (sf) => {
|
|
|
12236
12496
|
}, resolveConfigPath = (projectRoot) => {
|
|
12237
12497
|
const envOverride = process.env.ABSOLUTE_CONFIG;
|
|
12238
12498
|
if (envOverride) {
|
|
12239
|
-
const resolved = isAbsolute3(envOverride) ? envOverride :
|
|
12499
|
+
const resolved = isAbsolute3(envOverride) ? envOverride : join27(projectRoot, envOverride);
|
|
12240
12500
|
if (existsSync20(resolved))
|
|
12241
12501
|
return resolved;
|
|
12242
12502
|
}
|
|
12243
12503
|
const candidates = [
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12504
|
+
join27(projectRoot, "absolute.config.ts"),
|
|
12505
|
+
join27(projectRoot, "absolute.config.mts"),
|
|
12506
|
+
join27(projectRoot, "absolute.config.js"),
|
|
12507
|
+
join27(projectRoot, "absolute.config.mjs")
|
|
12248
12508
|
];
|
|
12249
12509
|
for (const candidate of candidates) {
|
|
12250
12510
|
if (existsSync20(candidate))
|
|
@@ -12276,8 +12536,8 @@ var findDefineConfigCall = (sf) => {
|
|
|
12276
12536
|
const importInfo = findImportForBinding(sf, binding);
|
|
12277
12537
|
if (!importInfo)
|
|
12278
12538
|
return null;
|
|
12279
|
-
const configDir2 =
|
|
12280
|
-
const absolutePath = importInfo.source.startsWith(".") ?
|
|
12539
|
+
const configDir2 = dirname12(configPath2);
|
|
12540
|
+
const absolutePath = importInfo.source.startsWith(".") ? join27(configDir2, importInfo.source).replace(/\.[cm]?[tj]sx?$/, "") : isAbsolute3(importInfo.source) ? importInfo.source.replace(/\.[cm]?[tj]sx?$/, "") : importInfo.source;
|
|
12281
12541
|
return {
|
|
12282
12542
|
absolutePath,
|
|
12283
12543
|
bindingName: binding,
|
|
@@ -12426,14 +12686,14 @@ __export(exports_compileSvelte, {
|
|
|
12426
12686
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
12427
12687
|
});
|
|
12428
12688
|
import { existsSync as existsSync21 } from "fs";
|
|
12429
|
-
import { mkdir as
|
|
12689
|
+
import { mkdir as mkdir5, stat as stat2 } from "fs/promises";
|
|
12430
12690
|
import {
|
|
12431
|
-
dirname as
|
|
12432
|
-
join as
|
|
12691
|
+
dirname as dirname13,
|
|
12692
|
+
join as join28,
|
|
12433
12693
|
basename as basename7,
|
|
12434
12694
|
extname as extname5,
|
|
12435
12695
|
resolve as resolve19,
|
|
12436
|
-
relative as
|
|
12696
|
+
relative as relative10,
|
|
12437
12697
|
sep as sep2
|
|
12438
12698
|
} from "path";
|
|
12439
12699
|
import { env } from "process";
|
|
@@ -12477,7 +12737,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12477
12737
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
12478
12738
|
if (!spec.startsWith("."))
|
|
12479
12739
|
return null;
|
|
12480
|
-
const basePath = resolve19(
|
|
12740
|
+
const basePath = resolve19(dirname13(from), spec);
|
|
12481
12741
|
const candidates = [
|
|
12482
12742
|
basePath,
|
|
12483
12743
|
`${basePath}.ts`,
|
|
@@ -12488,14 +12748,14 @@ var resolveDevClientDir2 = () => {
|
|
|
12488
12748
|
`${basePath}.svelte`,
|
|
12489
12749
|
`${basePath}.svelte.ts`,
|
|
12490
12750
|
`${basePath}.svelte.js`,
|
|
12491
|
-
|
|
12492
|
-
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
|
|
12496
|
-
|
|
12497
|
-
|
|
12498
|
-
|
|
12751
|
+
join28(basePath, "index.ts"),
|
|
12752
|
+
join28(basePath, "index.js"),
|
|
12753
|
+
join28(basePath, "index.mjs"),
|
|
12754
|
+
join28(basePath, "index.cjs"),
|
|
12755
|
+
join28(basePath, "index.json"),
|
|
12756
|
+
join28(basePath, "index.svelte"),
|
|
12757
|
+
join28(basePath, "index.svelte.ts"),
|
|
12758
|
+
join28(basePath, "index.svelte.js")
|
|
12499
12759
|
];
|
|
12500
12760
|
const checks = await Promise.all(candidates.map(exists));
|
|
12501
12761
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -12504,7 +12764,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12504
12764
|
const resolved = resolvePackageImport(spec);
|
|
12505
12765
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
12506
12766
|
}
|
|
12507
|
-
const basePath = resolve19(
|
|
12767
|
+
const basePath = resolve19(dirname13(from), spec);
|
|
12508
12768
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
12509
12769
|
if (!explicit) {
|
|
12510
12770
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -12525,8 +12785,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12525
12785
|
return jsPath;
|
|
12526
12786
|
return null;
|
|
12527
12787
|
}, addModuleRewrite = (rewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir) => {
|
|
12528
|
-
const toServer =
|
|
12529
|
-
const toClient =
|
|
12788
|
+
const toServer = relative10(ssrOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
12789
|
+
const toClient = relative10(clientOutputDir, resolvedModule).replace(/\\/g, "/");
|
|
12530
12790
|
rewrites.set(rawSpec, {
|
|
12531
12791
|
client: toClient.startsWith(".") || toClient.startsWith("/") ? toClient : `./${toClient}`,
|
|
12532
12792
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -12534,10 +12794,10 @@ var resolveDevClientDir2 = () => {
|
|
|
12534
12794
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev = false, stylePreprocessors) => {
|
|
12535
12795
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
12536
12796
|
const generatedDir = getFrameworkGeneratedDir("svelte");
|
|
12537
|
-
const clientDir =
|
|
12538
|
-
const indexDir =
|
|
12539
|
-
const serverDir =
|
|
12540
|
-
await Promise.all([clientDir, indexDir, serverDir].map((dir) =>
|
|
12797
|
+
const clientDir = join28(generatedDir, "client");
|
|
12798
|
+
const indexDir = join28(generatedDir, "indexes");
|
|
12799
|
+
const serverDir = join28(generatedDir, "server");
|
|
12800
|
+
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir5(dir, { recursive: true })));
|
|
12541
12801
|
const dev = env.NODE_ENV !== "production";
|
|
12542
12802
|
const build = async (src) => {
|
|
12543
12803
|
const memoized = cache.get(src);
|
|
@@ -12564,8 +12824,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12564
12824
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
12565
12825
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
|
|
12566
12826
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
|
|
12567
|
-
const rawRel =
|
|
12568
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${
|
|
12827
|
+
const rawRel = dirname13(relative10(svelteRoot, src)).replace(/\\/g, "/");
|
|
12828
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative10(process.cwd(), dirname13(src)).replace(/\\/g, "/")}` : rawRel;
|
|
12569
12829
|
const baseName = basename7(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
12570
12830
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
12571
12831
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -12574,8 +12834,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12574
12834
|
const childBuilt = await Promise.all(childSources.map((child) => build(child)));
|
|
12575
12835
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
12576
12836
|
const externalRewrites = new Map;
|
|
12577
|
-
const ssrOutputDir =
|
|
12578
|
-
const clientOutputDir =
|
|
12837
|
+
const ssrOutputDir = dirname13(join28(serverDir, relDir, `${baseName}.js`));
|
|
12838
|
+
const clientOutputDir = dirname13(join28(clientDir, relDir, `${baseName}.js`));
|
|
12579
12839
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
12580
12840
|
const rawSpec = importPaths[idx];
|
|
12581
12841
|
if (!rawSpec)
|
|
@@ -12586,15 +12846,15 @@ var resolveDevClientDir2 = () => {
|
|
|
12586
12846
|
addModuleRewrite(externalRewrites, rawSpec, resolvedModule, ssrOutputDir, clientOutputDir);
|
|
12587
12847
|
if (!resolved)
|
|
12588
12848
|
continue;
|
|
12589
|
-
const childRel =
|
|
12849
|
+
const childRel = relative10(svelteRoot, resolved).replace(/\\/g, "/");
|
|
12590
12850
|
if (!childRel.startsWith(".."))
|
|
12591
12851
|
continue;
|
|
12592
12852
|
const childBuilt2 = cache.get(resolved);
|
|
12593
12853
|
if (!childBuilt2)
|
|
12594
12854
|
continue;
|
|
12595
12855
|
const origSpec = rawSpec.replace(/\.svelte(?:\.(?:ts|js))?$/, ".js");
|
|
12596
|
-
const toServer =
|
|
12597
|
-
const toClient =
|
|
12856
|
+
const toServer = relative10(ssrOutputDir, childBuilt2.ssr).replace(/\\/g, "/");
|
|
12857
|
+
const toClient = relative10(clientOutputDir, childBuilt2.client).replace(/\\/g, "/");
|
|
12598
12858
|
externalRewrites.set(origSpec, {
|
|
12599
12859
|
client: toClient.startsWith(".") ? toClient : `./${toClient}`,
|
|
12600
12860
|
server: toServer.startsWith(".") ? toServer : `./${toServer}`
|
|
@@ -12628,7 +12888,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12628
12888
|
}).js;
|
|
12629
12889
|
let code = compiledJs.code.replace(/\.svelte(?:\.(?:ts|js))?(['"])/g, ".js$1");
|
|
12630
12890
|
if (mode === "client" && isDev) {
|
|
12631
|
-
const moduleKey = `/@src/${
|
|
12891
|
+
const moduleKey = `/@src/${relative10(process.cwd(), src).replace(/\\/g, "/")}`;
|
|
12632
12892
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
12633
12893
|
if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
12634
12894
|
var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleKey)}] = cb; };`);
|
|
@@ -12640,11 +12900,11 @@ var resolveDevClientDir2 = () => {
|
|
|
12640
12900
|
code += islandMetadataExports;
|
|
12641
12901
|
return { code, map: compiledJs.map };
|
|
12642
12902
|
};
|
|
12643
|
-
const ssrPath =
|
|
12644
|
-
const clientPath =
|
|
12903
|
+
const ssrPath = join28(serverDir, relDir, `${baseName}.js`);
|
|
12904
|
+
const clientPath = join28(clientDir, relDir, `${baseName}.js`);
|
|
12645
12905
|
await Promise.all([
|
|
12646
|
-
|
|
12647
|
-
|
|
12906
|
+
mkdir5(dirname13(ssrPath), { recursive: true }),
|
|
12907
|
+
mkdir5(dirname13(clientPath), { recursive: true })
|
|
12648
12908
|
]);
|
|
12649
12909
|
const inlineMap = (map) => map ? `
|
|
12650
12910
|
//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
|
|
@@ -12677,10 +12937,10 @@ var resolveDevClientDir2 = () => {
|
|
|
12677
12937
|
};
|
|
12678
12938
|
const roots = await Promise.all(entryPoints.map(build));
|
|
12679
12939
|
await Promise.all(roots.map(async ({ client, hasAwaitSlot }) => {
|
|
12680
|
-
const relClientDir =
|
|
12940
|
+
const relClientDir = dirname13(relative10(clientDir, client));
|
|
12681
12941
|
const name = basename7(client, extname5(client));
|
|
12682
|
-
const indexPath =
|
|
12683
|
-
const importRaw =
|
|
12942
|
+
const indexPath = join28(indexDir, relClientDir, `${name}.js`);
|
|
12943
|
+
const importRaw = relative10(dirname13(indexPath), client).split(sep2).join("/");
|
|
12684
12944
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
12685
12945
|
const hmrImports = isDev ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
12686
12946
|
import "${hmrClientPath3}";
|
|
@@ -12751,14 +13011,14 @@ if (typeof window !== "undefined") {
|
|
|
12751
13011
|
setTimeout(releaseStreamingSlots, 0);
|
|
12752
13012
|
}
|
|
12753
13013
|
}`;
|
|
12754
|
-
await
|
|
13014
|
+
await mkdir5(dirname13(indexPath), { recursive: true });
|
|
12755
13015
|
return write2(indexPath, bootstrap);
|
|
12756
13016
|
}));
|
|
12757
13017
|
return {
|
|
12758
13018
|
svelteClientPaths: roots.map(({ client }) => client),
|
|
12759
13019
|
svelteIndexPaths: roots.map(({ client }) => {
|
|
12760
|
-
const rel =
|
|
12761
|
-
return
|
|
13020
|
+
const rel = dirname13(relative10(clientDir, client));
|
|
13021
|
+
return join28(indexDir, rel, basename7(client));
|
|
12762
13022
|
}),
|
|
12763
13023
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
12764
13024
|
};
|
|
@@ -12773,7 +13033,7 @@ var init_compileSvelte = __esm(() => {
|
|
|
12773
13033
|
init_lowerAwaitSlotSyntax();
|
|
12774
13034
|
init_renderToReadableStream();
|
|
12775
13035
|
devClientDir2 = resolveDevClientDir2();
|
|
12776
|
-
hmrClientPath3 =
|
|
13036
|
+
hmrClientPath3 = join28(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
12777
13037
|
persistentCache = new Map;
|
|
12778
13038
|
sourceHashCache = new Map;
|
|
12779
13039
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
@@ -13185,13 +13445,13 @@ __export(exports_compileVue, {
|
|
|
13185
13445
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
13186
13446
|
});
|
|
13187
13447
|
import { existsSync as existsSync22, readFileSync as readFileSync18, realpathSync as realpathSync2 } from "fs";
|
|
13188
|
-
import { mkdir as
|
|
13448
|
+
import { mkdir as mkdir6 } from "fs/promises";
|
|
13189
13449
|
import {
|
|
13190
13450
|
basename as basename8,
|
|
13191
|
-
dirname as
|
|
13451
|
+
dirname as dirname14,
|
|
13192
13452
|
isAbsolute as isAbsolute4,
|
|
13193
|
-
join as
|
|
13194
|
-
relative as
|
|
13453
|
+
join as join29,
|
|
13454
|
+
relative as relative11,
|
|
13195
13455
|
resolve as resolve20
|
|
13196
13456
|
} from "path";
|
|
13197
13457
|
var {file: file2, write: write3, Transpiler: Transpiler3 } = globalThis.Bun;
|
|
@@ -13243,14 +13503,14 @@ var resolveDevClientDir3 = () => {
|
|
|
13243
13503
|
return "template-only";
|
|
13244
13504
|
}
|
|
13245
13505
|
return "full";
|
|
13246
|
-
}, generateVueHmrId = (sourceFilePath, vueRootDir) =>
|
|
13506
|
+
}, generateVueHmrId = (sourceFilePath, vueRootDir) => relative11(vueRootDir, sourceFilePath).replace(/\\/g, "/").replace(/\.vue$/, ""), extractImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => importPath !== undefined), inlineCssImports = (cssContent, cssFilePath, visited = new Set) => {
|
|
13247
13507
|
const resolved = realpathSync2(cssFilePath);
|
|
13248
13508
|
if (visited.has(resolved))
|
|
13249
13509
|
return "";
|
|
13250
13510
|
visited.add(resolved);
|
|
13251
13511
|
const importRegex = /@import\s+(?:url\(\s*)?(['"])(\.{1,2}\/[^'"]+)\1\s*\)?\s*;?/g;
|
|
13252
13512
|
return cssContent.replace(importRegex, (match, _quote, relPath) => {
|
|
13253
|
-
const importedPath = resolve20(
|
|
13513
|
+
const importedPath = resolve20(dirname14(cssFilePath), relPath);
|
|
13254
13514
|
if (!existsSync22(importedPath))
|
|
13255
13515
|
return match;
|
|
13256
13516
|
const importedContent = readFileSync18(importedPath, "utf-8");
|
|
@@ -13307,7 +13567,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13307
13567
|
const cachedResult = cacheMap.get(sourceFilePath);
|
|
13308
13568
|
if (cachedResult)
|
|
13309
13569
|
return cachedResult;
|
|
13310
|
-
const relativeFilePath =
|
|
13570
|
+
const relativeFilePath = relative11(vueRootDir, sourceFilePath).replace(/\\/g, "/");
|
|
13311
13571
|
const relativeWithoutExtension = relativeFilePath.replace(/\.vue$/, "");
|
|
13312
13572
|
const fileBaseName = basename8(sourceFilePath, ".vue");
|
|
13313
13573
|
const componentId = toKebab(fileBaseName);
|
|
@@ -13346,12 +13606,12 @@ var resolveDevClientDir3 = () => {
|
|
|
13346
13606
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
13347
13607
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
13348
13608
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
13349
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute4(path)) && isStylePath(path)).map((path) => isAbsolute4(path) ? path : resolve20(
|
|
13609
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute4(path)) && isStylePath(path)).map((path) => isAbsolute4(path) ? path : resolve20(dirname14(sourceFilePath), path));
|
|
13350
13610
|
for (const stylePath of stylePathsImported) {
|
|
13351
13611
|
addStyleImporter(sourceFilePath, stylePath);
|
|
13352
13612
|
}
|
|
13353
13613
|
const childBuildResults = await Promise.all([
|
|
13354
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve20(
|
|
13614
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve20(dirname14(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
13355
13615
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
13356
13616
|
]);
|
|
13357
13617
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -13366,7 +13626,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13366
13626
|
sourceMap: true
|
|
13367
13627
|
}) : { bindings: {}, content: "export default {};", map: undefined };
|
|
13368
13628
|
const strippedScript = stripExports2(compiledScript.content);
|
|
13369
|
-
const sourceDir =
|
|
13629
|
+
const sourceDir = dirname14(sourceFilePath);
|
|
13370
13630
|
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
|
|
13371
13631
|
const packageImportRewrites = new Map;
|
|
13372
13632
|
for (const [bareImport, absolutePath] of packageComponentPaths) {
|
|
@@ -13411,8 +13671,8 @@ var resolveDevClientDir3 = () => {
|
|
|
13411
13671
|
];
|
|
13412
13672
|
let cssOutputPaths = [];
|
|
13413
13673
|
if (isEntryPoint && allCss.length) {
|
|
13414
|
-
const cssOutputFile =
|
|
13415
|
-
await
|
|
13674
|
+
const cssOutputFile = join29(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
13675
|
+
await mkdir6(dirname14(cssOutputFile), { recursive: true });
|
|
13416
13676
|
await write3(cssOutputFile, allCss.join(`
|
|
13417
13677
|
`));
|
|
13418
13678
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -13442,21 +13702,21 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13442
13702
|
};
|
|
13443
13703
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
13444
13704
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
13445
|
-
const clientOutputPath =
|
|
13446
|
-
const serverOutputPath =
|
|
13705
|
+
const clientOutputPath = join29(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
13706
|
+
const serverOutputPath = join29(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
13447
13707
|
const rewritePackageImports = (code, outputPath, mode) => {
|
|
13448
13708
|
let result2 = code;
|
|
13449
13709
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
13450
13710
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
13451
|
-
let rel =
|
|
13711
|
+
let rel = relative11(dirname14(outputPath), targetPath).replace(/\\/g, "/");
|
|
13452
13712
|
if (!rel.startsWith("."))
|
|
13453
13713
|
rel = `./${rel}`;
|
|
13454
13714
|
result2 = result2.replaceAll(bareImport, rel);
|
|
13455
13715
|
}
|
|
13456
13716
|
return result2;
|
|
13457
13717
|
};
|
|
13458
|
-
await
|
|
13459
|
-
await
|
|
13718
|
+
await mkdir6(dirname14(clientOutputPath), { recursive: true });
|
|
13719
|
+
await mkdir6(dirname14(serverOutputPath), { recursive: true });
|
|
13460
13720
|
const clientFinal = rewritePackageImports(clientCode, clientOutputPath, "client");
|
|
13461
13721
|
const serverFinal = rewritePackageImports(serverCode, serverOutputPath, "server");
|
|
13462
13722
|
const inlineSourceMapFor = (finalContent) => {
|
|
@@ -13479,7 +13739,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13479
13739
|
serverPath: serverOutputPath,
|
|
13480
13740
|
spaRoutes: spaRoutes.length > 0 ? spaRoutes : undefined,
|
|
13481
13741
|
tsHelperPaths: [
|
|
13482
|
-
...helperModulePaths.map((helper) => resolveHelperTsPath(
|
|
13742
|
+
...helperModulePaths.map((helper) => resolveHelperTsPath(dirname14(sourceFilePath), helper)),
|
|
13483
13743
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
13484
13744
|
]
|
|
13485
13745
|
};
|
|
@@ -13489,15 +13749,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13489
13749
|
}, compileVue = async (entryPoints, vueRootDir, isDev = false, stylePreprocessors, ssrOnlyEntries) => {
|
|
13490
13750
|
const compiler = await import("@vue/compiler-sfc");
|
|
13491
13751
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
13492
|
-
const clientOutputDir =
|
|
13493
|
-
const indexOutputDir =
|
|
13494
|
-
const serverOutputDir =
|
|
13495
|
-
const cssOutputDir =
|
|
13752
|
+
const clientOutputDir = join29(generatedDir, "client");
|
|
13753
|
+
const indexOutputDir = join29(generatedDir, "indexes");
|
|
13754
|
+
const serverOutputDir = join29(generatedDir, "server");
|
|
13755
|
+
const cssOutputDir = join29(generatedDir, "compiled");
|
|
13496
13756
|
await Promise.all([
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13757
|
+
mkdir6(clientOutputDir, { recursive: true }),
|
|
13758
|
+
mkdir6(indexOutputDir, { recursive: true }),
|
|
13759
|
+
mkdir6(serverOutputDir, { recursive: true }),
|
|
13760
|
+
mkdir6(cssOutputDir, { recursive: true })
|
|
13501
13761
|
]);
|
|
13502
13762
|
const buildCache = new Map;
|
|
13503
13763
|
const allTsHelperPaths = new Set;
|
|
@@ -13520,16 +13780,16 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13520
13780
|
};
|
|
13521
13781
|
}
|
|
13522
13782
|
const entryBaseName = basename8(entryPath, ".vue");
|
|
13523
|
-
const indexOutputFile =
|
|
13524
|
-
const clientOutputFile =
|
|
13525
|
-
await
|
|
13783
|
+
const indexOutputFile = join29(indexOutputDir, `${entryBaseName}.js`);
|
|
13784
|
+
const clientOutputFile = join29(clientOutputDir, relative11(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
13785
|
+
await mkdir6(dirname14(indexOutputFile), { recursive: true });
|
|
13526
13786
|
const vueHmrImports = isDev ? [
|
|
13527
13787
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
13528
13788
|
`import "${hmrClientPath4}";`
|
|
13529
13789
|
] : [];
|
|
13530
13790
|
await write3(indexOutputFile, [
|
|
13531
13791
|
...vueHmrImports,
|
|
13532
|
-
`import Comp, * as PageModule from "${
|
|
13792
|
+
`import Comp, * as PageModule from "${relative11(dirname14(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
13533
13793
|
'import { createSSRApp, createApp } from "vue";',
|
|
13534
13794
|
"",
|
|
13535
13795
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -13678,7 +13938,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13678
13938
|
if (!tsPath)
|
|
13679
13939
|
continue;
|
|
13680
13940
|
const sourceCode = await file2(tsPath).text();
|
|
13681
|
-
const helperDir =
|
|
13941
|
+
const helperDir = dirname14(tsPath);
|
|
13682
13942
|
for (const dep of extractImports(sourceCode)) {
|
|
13683
13943
|
if (!dep.startsWith(".") || isStylePath(dep) || dep.endsWith(".vue")) {
|
|
13684
13944
|
continue;
|
|
@@ -13695,11 +13955,11 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13695
13955
|
await Promise.all(Array.from(allTsHelperPaths).map(async (tsPath) => {
|
|
13696
13956
|
const sourceCode = await file2(tsPath).text();
|
|
13697
13957
|
const transpiledCode = transpiler4.transformSync(sourceCode);
|
|
13698
|
-
const relativeJsPath =
|
|
13699
|
-
const outClientPath =
|
|
13700
|
-
const outServerPath =
|
|
13701
|
-
await
|
|
13702
|
-
await
|
|
13958
|
+
const relativeJsPath = relative11(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
13959
|
+
const outClientPath = join29(clientOutputDir, relativeJsPath);
|
|
13960
|
+
const outServerPath = join29(serverOutputDir, relativeJsPath);
|
|
13961
|
+
await mkdir6(dirname14(outClientPath), { recursive: true });
|
|
13962
|
+
await mkdir6(dirname14(outServerPath), { recursive: true });
|
|
13703
13963
|
await write3(outClientPath, transpiledCode);
|
|
13704
13964
|
await write3(outServerPath, transpiledCode);
|
|
13705
13965
|
}));
|
|
@@ -13729,7 +13989,7 @@ var init_compileVue = __esm(() => {
|
|
|
13729
13989
|
init_vueAutoRouterTransform();
|
|
13730
13990
|
init_stylePreprocessor();
|
|
13731
13991
|
devClientDir3 = resolveDevClientDir3();
|
|
13732
|
-
hmrClientPath4 =
|
|
13992
|
+
hmrClientPath4 = join29(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
13733
13993
|
transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
|
|
13734
13994
|
scriptCache = new Map;
|
|
13735
13995
|
scriptSetupCache = new Map;
|
|
@@ -14211,7 +14471,7 @@ __export(exports_compileAngular, {
|
|
|
14211
14471
|
compileAngular: () => compileAngular
|
|
14212
14472
|
});
|
|
14213
14473
|
import { existsSync as existsSync23, readFileSync as readFileSync19, promises as fs5 } from "fs";
|
|
14214
|
-
import { join as
|
|
14474
|
+
import { join as join30, basename as basename9, sep as sep3, dirname as dirname15, resolve as resolve21, relative as relative12 } from "path";
|
|
14215
14475
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
14216
14476
|
import ts11 from "typescript";
|
|
14217
14477
|
var traceAngularPhase = async (name, fn2, metadata) => {
|
|
@@ -14254,10 +14514,10 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14254
14514
|
`${candidate}.tsx`,
|
|
14255
14515
|
`${candidate}.js`,
|
|
14256
14516
|
`${candidate}.jsx`,
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14517
|
+
join30(candidate, "index.ts"),
|
|
14518
|
+
join30(candidate, "index.tsx"),
|
|
14519
|
+
join30(candidate, "index.js"),
|
|
14520
|
+
join30(candidate, "index.jsx")
|
|
14261
14521
|
];
|
|
14262
14522
|
return candidates.find((file3) => existsSync23(file3));
|
|
14263
14523
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
@@ -14329,7 +14589,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14329
14589
|
if (scan.usesLegacyAnimations)
|
|
14330
14590
|
return true;
|
|
14331
14591
|
for (const specifier of scan.imports) {
|
|
14332
|
-
const importedPath = resolveLocalImport(specifier,
|
|
14592
|
+
const importedPath = resolveLocalImport(specifier, dirname15(resolved));
|
|
14333
14593
|
if (importedPath && await visit(importedPath, visited)) {
|
|
14334
14594
|
return true;
|
|
14335
14595
|
}
|
|
@@ -14388,7 +14648,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14388
14648
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
14389
14649
|
if (hasJsLikeExtension(path))
|
|
14390
14650
|
return `${path}${query}`;
|
|
14391
|
-
const importerDir =
|
|
14651
|
+
const importerDir = dirname15(importerOutputPath);
|
|
14392
14652
|
const fileCandidate = resolve21(importerDir, `${path}.js`);
|
|
14393
14653
|
if (outputFiles?.has(fileCandidate) || existsSync23(fileCandidate)) {
|
|
14394
14654
|
return `${path}.js${query}`;
|
|
@@ -14421,16 +14681,16 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14421
14681
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
14422
14682
|
if (!isRelativeModuleSpecifier(specifier))
|
|
14423
14683
|
return null;
|
|
14424
|
-
const basePath = resolve21(
|
|
14684
|
+
const basePath = resolve21(dirname15(fromFile), specifier);
|
|
14425
14685
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
14426
14686
|
`${basePath}.ts`,
|
|
14427
14687
|
`${basePath}.tsx`,
|
|
14428
14688
|
`${basePath}.mts`,
|
|
14429
14689
|
`${basePath}.cts`,
|
|
14430
|
-
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14690
|
+
join30(basePath, "index.ts"),
|
|
14691
|
+
join30(basePath, "index.tsx"),
|
|
14692
|
+
join30(basePath, "index.mts"),
|
|
14693
|
+
join30(basePath, "index.cts")
|
|
14434
14694
|
];
|
|
14435
14695
|
return candidates.map((candidate) => resolve21(candidate)).find((candidate) => existsSync23(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
14436
14696
|
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
@@ -14456,15 +14716,15 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14456
14716
|
const paths = [];
|
|
14457
14717
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14458
14718
|
if (templateUrlMatch?.[1])
|
|
14459
|
-
paths.push(
|
|
14719
|
+
paths.push(join30(fileDir, templateUrlMatch[1]));
|
|
14460
14720
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14461
14721
|
if (styleUrlMatch?.[1])
|
|
14462
|
-
paths.push(
|
|
14722
|
+
paths.push(join30(fileDir, styleUrlMatch[1]));
|
|
14463
14723
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
14464
14724
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
14465
14725
|
if (urlMatches) {
|
|
14466
14726
|
for (const urlMatch of urlMatches) {
|
|
14467
|
-
paths.push(
|
|
14727
|
+
paths.push(join30(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
14468
14728
|
}
|
|
14469
14729
|
}
|
|
14470
14730
|
return paths.map((path) => resolve21(path));
|
|
@@ -14479,13 +14739,13 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14479
14739
|
return null;
|
|
14480
14740
|
}
|
|
14481
14741
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
14482
|
-
await fs5.mkdir(
|
|
14742
|
+
await fs5.mkdir(dirname15(cachePath), { recursive: true });
|
|
14483
14743
|
await fs5.writeFile(cachePath, JSON.stringify({
|
|
14484
14744
|
source,
|
|
14485
14745
|
version: 1
|
|
14486
14746
|
}), "utf-8");
|
|
14487
14747
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
14488
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
14748
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname15(filePath));
|
|
14489
14749
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
14490
14750
|
const content = await fs5.readFile(resourcePath, "utf-8");
|
|
14491
14751
|
return `${resourcePath}\x00${content}`;
|
|
@@ -14498,7 +14758,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14498
14758
|
safeStableStringify(stylePreprocessors ?? null)
|
|
14499
14759
|
].join("\x00");
|
|
14500
14760
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
14501
|
-
return
|
|
14761
|
+
return join30(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
14502
14762
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
14503
14763
|
const transformedSources = new Map;
|
|
14504
14764
|
const visited = new Set;
|
|
@@ -14525,7 +14785,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14525
14785
|
transformedSource = cached.source;
|
|
14526
14786
|
} else {
|
|
14527
14787
|
stats.cacheMisses += 1;
|
|
14528
|
-
const transformed = await inlineResources(source,
|
|
14788
|
+
const transformed = await inlineResources(source, dirname15(resolvedPath), stylePreprocessors);
|
|
14529
14789
|
transformedSource = transformed.source;
|
|
14530
14790
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
14531
14791
|
}
|
|
@@ -14544,7 +14804,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14544
14804
|
return { stats, transformedSources };
|
|
14545
14805
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
14546
14806
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
14547
|
-
const outputPath = resolve21(
|
|
14807
|
+
const outputPath = resolve21(join30(outDir, relative12(process.cwd(), resolve21(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
14548
14808
|
return [
|
|
14549
14809
|
outputPath,
|
|
14550
14810
|
buildIslandMetadataExports(readFileSync19(inputPath, "utf-8"))
|
|
@@ -14554,7 +14814,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14554
14814
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
14555
14815
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
14556
14816
|
const tsPath = __require.resolve("typescript");
|
|
14557
|
-
const tsRootDir =
|
|
14817
|
+
const tsRootDir = dirname15(tsPath);
|
|
14558
14818
|
return tsRootDir.endsWith("lib") ? tsRootDir : resolve21(tsRootDir, "lib");
|
|
14559
14819
|
});
|
|
14560
14820
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
@@ -14591,7 +14851,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14591
14851
|
const originalGetSourceFile = host.getSourceFile;
|
|
14592
14852
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
14593
14853
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
14594
|
-
const resolvedPath =
|
|
14854
|
+
const resolvedPath = join30(tsLibDir, fileName);
|
|
14595
14855
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
14596
14856
|
}
|
|
14597
14857
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
@@ -14646,7 +14906,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14646
14906
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
14647
14907
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
14648
14908
|
content,
|
|
14649
|
-
target:
|
|
14909
|
+
target: join30(outDir, fileName)
|
|
14650
14910
|
}));
|
|
14651
14911
|
const outputFiles = new Set(rawEntries.map(({ target }) => resolve21(target)));
|
|
14652
14912
|
return rawEntries.map(({ content, target }) => {
|
|
@@ -14668,7 +14928,7 @@ var traceAngularPhase = async (name, fn2, metadata) => {
|
|
|
14668
14928
|
});
|
|
14669
14929
|
});
|
|
14670
14930
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
14671
|
-
await fs5.mkdir(
|
|
14931
|
+
await fs5.mkdir(dirname15(target), { recursive: true });
|
|
14672
14932
|
await fs5.writeFile(target, content, "utf-8");
|
|
14673
14933
|
})), { outputs: entries.length });
|
|
14674
14934
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
@@ -14823,7 +15083,7 @@ ${fields}
|
|
|
14823
15083
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
14824
15084
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14825
15085
|
if (templateUrlMatch?.[1]) {
|
|
14826
|
-
const templatePath =
|
|
15086
|
+
const templatePath = join30(fileDir, templateUrlMatch[1]);
|
|
14827
15087
|
if (!existsSync23(templatePath)) {
|
|
14828
15088
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14829
15089
|
}
|
|
@@ -14854,7 +15114,7 @@ ${fields}
|
|
|
14854
15114
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
14855
15115
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14856
15116
|
if (templateUrlMatch?.[1]) {
|
|
14857
|
-
const templatePath =
|
|
15117
|
+
const templatePath = join30(fileDir, templateUrlMatch[1]);
|
|
14858
15118
|
if (!existsSync23(templatePath)) {
|
|
14859
15119
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14860
15120
|
}
|
|
@@ -14891,7 +15151,7 @@ ${fields}
|
|
|
14891
15151
|
return source;
|
|
14892
15152
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
14893
15153
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
14894
|
-
return readAndEscapeFile(
|
|
15154
|
+
return readAndEscapeFile(join30(fileDir, styleUrl), stylePreprocessors);
|
|
14895
15155
|
});
|
|
14896
15156
|
const results = await Promise.all(stylePromises);
|
|
14897
15157
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -14902,7 +15162,7 @@ ${fields}
|
|
|
14902
15162
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14903
15163
|
if (!styleUrlMatch?.[1])
|
|
14904
15164
|
return source;
|
|
14905
|
-
const escaped = await readAndEscapeFile(
|
|
15165
|
+
const escaped = await readAndEscapeFile(join30(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
14906
15166
|
if (!escaped)
|
|
14907
15167
|
return source;
|
|
14908
15168
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -14938,10 +15198,10 @@ ${fields}
|
|
|
14938
15198
|
`${candidate}.js`,
|
|
14939
15199
|
`${candidate}.jsx`,
|
|
14940
15200
|
`${candidate}.json`,
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
15201
|
+
join30(candidate, "index.ts"),
|
|
15202
|
+
join30(candidate, "index.tsx"),
|
|
15203
|
+
join30(candidate, "index.js"),
|
|
15204
|
+
join30(candidate, "index.jsx")
|
|
14945
15205
|
];
|
|
14946
15206
|
return candidates.find((file3) => existsSync23(file3));
|
|
14947
15207
|
};
|
|
@@ -14965,13 +15225,13 @@ ${fields}
|
|
|
14965
15225
|
}
|
|
14966
15226
|
};
|
|
14967
15227
|
const toOutputPath = (sourcePath) => {
|
|
14968
|
-
const inputDir =
|
|
15228
|
+
const inputDir = dirname15(sourcePath);
|
|
14969
15229
|
const fileBase = basename9(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
14970
15230
|
if (inputDir === outDir || inputDir.startsWith(`${outDir}${sep3}`)) {
|
|
14971
|
-
return
|
|
15231
|
+
return join30(inputDir, fileBase);
|
|
14972
15232
|
}
|
|
14973
15233
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
14974
|
-
return
|
|
15234
|
+
return join30(outDir, relativeDir, fileBase);
|
|
14975
15235
|
};
|
|
14976
15236
|
const withCacheBuster = (specifier) => {
|
|
14977
15237
|
if (!cacheBuster)
|
|
@@ -15019,10 +15279,10 @@ ${fields}
|
|
|
15019
15279
|
return;
|
|
15020
15280
|
visited.add(resolved);
|
|
15021
15281
|
if (resolved.endsWith(".json") && existsSync23(resolved)) {
|
|
15022
|
-
const inputDir2 =
|
|
15282
|
+
const inputDir2 = dirname15(resolved);
|
|
15023
15283
|
const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
|
|
15024
|
-
const targetDir2 =
|
|
15025
|
-
const targetPath2 =
|
|
15284
|
+
const targetDir2 = join30(outDir, relativeDir2);
|
|
15285
|
+
const targetPath2 = join30(targetDir2, basename9(resolved));
|
|
15026
15286
|
await fs5.mkdir(targetDir2, { recursive: true });
|
|
15027
15287
|
await fs5.copyFile(resolved, targetPath2);
|
|
15028
15288
|
allOutputs.push(targetPath2);
|
|
@@ -15034,13 +15294,13 @@ ${fields}
|
|
|
15034
15294
|
if (!existsSync23(actualPath))
|
|
15035
15295
|
return;
|
|
15036
15296
|
let sourceCode = await fs5.readFile(actualPath, "utf-8");
|
|
15037
|
-
const inlined = await inlineResources(sourceCode,
|
|
15038
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
15039
|
-
const inputDir =
|
|
15297
|
+
const inlined = await inlineResources(sourceCode, dirname15(actualPath), stylePreprocessors);
|
|
15298
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname15(actualPath)).source;
|
|
15299
|
+
const inputDir = dirname15(actualPath);
|
|
15040
15300
|
const fileBase = basename9(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
15041
15301
|
const targetPath = toOutputPath(actualPath);
|
|
15042
|
-
const targetDir =
|
|
15043
|
-
const relativeDir =
|
|
15302
|
+
const targetDir = dirname15(targetPath);
|
|
15303
|
+
const relativeDir = relative12(outDir, targetDir).replace(/\\/g, "/");
|
|
15044
15304
|
const localImports = [];
|
|
15045
15305
|
const importRewrites = new Map;
|
|
15046
15306
|
const fromRegex = /(?:from|import)\s+['"]([^'".][^'"]*|\.\.?\/[^'"]+)['"]/g;
|
|
@@ -15061,7 +15321,7 @@ ${fields}
|
|
|
15061
15321
|
const resolved2 = resolveLocalImport(specifier, inputDir);
|
|
15062
15322
|
if (!resolved2)
|
|
15063
15323
|
return null;
|
|
15064
|
-
const relativeImport =
|
|
15324
|
+
const relativeImport = relative12(targetDir, toOutputPath(resolved2)).replace(/\\/g, "/").replace(/\.js$/, "");
|
|
15065
15325
|
const relativeRewrite = relativeImport.startsWith(".") ? relativeImport : `./${relativeImport}`;
|
|
15066
15326
|
importRewrites.set(specifier, relativeRewrite);
|
|
15067
15327
|
return resolved2;
|
|
@@ -15100,7 +15360,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15100
15360
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
15101
15361
|
}
|
|
15102
15362
|
const compiledRoot = compiledParent;
|
|
15103
|
-
const indexesDir =
|
|
15363
|
+
const indexesDir = join30(compiledParent, "indexes");
|
|
15104
15364
|
await traceAngularPhase("setup/create-indexes-dir", () => fs5.mkdir(indexesDir, { recursive: true }));
|
|
15105
15365
|
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve21(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
15106
15366
|
if (!hmr) {
|
|
@@ -15114,10 +15374,10 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15114
15374
|
absolute: false,
|
|
15115
15375
|
cwd: angularSrcDir
|
|
15116
15376
|
})) {
|
|
15117
|
-
const sourcePath =
|
|
15118
|
-
const cwdRel =
|
|
15119
|
-
const targetPath =
|
|
15120
|
-
await fs5.mkdir(
|
|
15377
|
+
const sourcePath = join30(angularSrcDir, rel);
|
|
15378
|
+
const cwdRel = relative12(cwd, sourcePath);
|
|
15379
|
+
const targetPath = join30(compiledRoot, cwdRel);
|
|
15380
|
+
await fs5.mkdir(dirname15(targetPath), { recursive: true });
|
|
15121
15381
|
await fs5.copyFile(sourcePath, targetPath);
|
|
15122
15382
|
}
|
|
15123
15383
|
});
|
|
@@ -15125,7 +15385,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15125
15385
|
const usesLegacyAngularAnimations = await traceAngularPhase("setup/legacy-animation-resolver", () => createLegacyAngularAnimationUsageResolver(outRoot));
|
|
15126
15386
|
const compileTasks = entryPoints.map(async (entry) => {
|
|
15127
15387
|
const resolvedEntry = resolve21(entry);
|
|
15128
|
-
const relativeEntry =
|
|
15388
|
+
const relativeEntry = relative12(outRoot, resolvedEntry).replace(/\.[tj]s$/, ".js");
|
|
15129
15389
|
const compileEntry = () => compileAngularFileJIT(resolvedEntry, compiledRoot, outRoot, stylePreprocessors);
|
|
15130
15390
|
let outputs = hmr ? await traceAngularPhase("jit/compile-entry", compileEntry, {
|
|
15131
15391
|
entry: resolvedEntry
|
|
@@ -15133,9 +15393,9 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15133
15393
|
const fileBase = basename9(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
15134
15394
|
const jsName = `${fileBase}.js`;
|
|
15135
15395
|
const compiledFallbackPaths = [
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
|
|
15396
|
+
join30(compiledRoot, relativeEntry),
|
|
15397
|
+
join30(compiledRoot, "pages", jsName),
|
|
15398
|
+
join30(compiledRoot, jsName)
|
|
15139
15399
|
].map((file3) => resolve21(file3));
|
|
15140
15400
|
const resolveRawServerFile = (candidatePaths) => {
|
|
15141
15401
|
const normalizedCandidates = [
|
|
@@ -15197,7 +15457,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15197
15457
|
})() : "no-providers";
|
|
15198
15458
|
const serverContentHash = `${Bun.hash(original).toString(BASE_36_RADIX)}.${Bun.hash(providersHashInput).toString(BASE_36_RADIX)}`;
|
|
15199
15459
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
15200
|
-
const clientFile =
|
|
15460
|
+
const clientFile = join30(indexesDir, jsName);
|
|
15201
15461
|
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync23(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
15202
15462
|
return {
|
|
15203
15463
|
clientPath: clientFile,
|
|
@@ -15231,11 +15491,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15231
15491
|
const compiledAppProvidersPath = (() => {
|
|
15232
15492
|
const angularDirAbs = resolve21(outRoot);
|
|
15233
15493
|
const appSourceAbs = resolve21(providersInjection.appProvidersSource);
|
|
15234
|
-
const rel =
|
|
15235
|
-
return
|
|
15494
|
+
const rel = relative12(angularDirAbs, appSourceAbs).replace(/\\/g, "/");
|
|
15495
|
+
return join30(compiledParent, rel).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
15236
15496
|
})();
|
|
15237
15497
|
const appProvidersSpec = (() => {
|
|
15238
|
-
const rel =
|
|
15498
|
+
const rel = relative12(dirname15(rawServerFile), compiledAppProvidersPath).replace(/\\/g, "/");
|
|
15239
15499
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
15240
15500
|
})();
|
|
15241
15501
|
importLines.push(`import { appProviders as __abs_globalProviders } from "${appProvidersSpec}";`);
|
|
@@ -15260,7 +15520,7 @@ export const providers = [${fragments.join(", ")}];
|
|
|
15260
15520
|
}
|
|
15261
15521
|
}
|
|
15262
15522
|
await traceAngularPhase("wrapper/write-server-output", () => fs5.writeFile(rawServerFile, rewritten, "utf-8"), { entry: resolvedEntry });
|
|
15263
|
-
const relativePath =
|
|
15523
|
+
const relativePath = relative12(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
15264
15524
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
15265
15525
|
const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
|
|
15266
15526
|
import "${hmrClientPath5}";
|
|
@@ -15456,7 +15716,7 @@ var init_compileAngular = __esm(() => {
|
|
|
15456
15716
|
init_stylePreprocessor();
|
|
15457
15717
|
init_generatedDir();
|
|
15458
15718
|
devClientDir4 = resolveDevClientDir4();
|
|
15459
|
-
hmrClientPath5 =
|
|
15719
|
+
hmrClientPath5 = join30(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
15460
15720
|
jitContentCache = new Map;
|
|
15461
15721
|
wrapperOutputCache = new Map;
|
|
15462
15722
|
});
|
|
@@ -16180,7 +16440,7 @@ __export(exports_fastHmrCompiler, {
|
|
|
16180
16440
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
16181
16441
|
});
|
|
16182
16442
|
import { existsSync as existsSync24, readFileSync as readFileSync20, statSync as statSync2 } from "fs";
|
|
16183
|
-
import { dirname as
|
|
16443
|
+
import { dirname as dirname16, extname as extname6, relative as relative13, resolve as resolve22 } from "path";
|
|
16184
16444
|
import ts15 from "typescript";
|
|
16185
16445
|
var fail = (reason, detail, location) => ({
|
|
16186
16446
|
ok: false,
|
|
@@ -16291,7 +16551,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16291
16551
|
})();
|
|
16292
16552
|
if (!decoratorName)
|
|
16293
16553
|
continue;
|
|
16294
|
-
const projectRel =
|
|
16554
|
+
const projectRel = relative13(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
16295
16555
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
16296
16556
|
if (decoratorName === "Component") {
|
|
16297
16557
|
const componentDecorator = decorators.find((d2) => {
|
|
@@ -16308,7 +16568,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16308
16568
|
continue;
|
|
16309
16569
|
const decoratorMeta = readDecoratorMeta(args);
|
|
16310
16570
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
16311
|
-
const componentDir =
|
|
16571
|
+
const componentDir = dirname16(componentFilePath);
|
|
16312
16572
|
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
16313
16573
|
fingerprintCache.set(id, fingerprint);
|
|
16314
16574
|
} else {
|
|
@@ -17268,7 +17528,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17268
17528
|
});
|
|
17269
17529
|
if (!names.includes(className))
|
|
17270
17530
|
continue;
|
|
17271
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17531
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname16(startDtsPath));
|
|
17272
17532
|
if (!nextDts)
|
|
17273
17533
|
continue;
|
|
17274
17534
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -17278,7 +17538,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17278
17538
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
17279
17539
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
17280
17540
|
const fromPath = m[1] || "";
|
|
17281
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17541
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname16(startDtsPath));
|
|
17282
17542
|
if (!nextDts)
|
|
17283
17543
|
continue;
|
|
17284
17544
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -17856,7 +18116,7 @@ ${block}
|
|
|
17856
18116
|
}
|
|
17857
18117
|
const kind = params.kind ?? "component";
|
|
17858
18118
|
if (kind !== "component") {
|
|
17859
|
-
const entityId = encodeURIComponent(`${
|
|
18119
|
+
const entityId = encodeURIComponent(`${relative13(projectRoot, componentFilePath).replace(/\\/g, "/")}@${className}`);
|
|
17860
18120
|
const currentEntityFingerprint = extractEntityFingerprint(classNode, className, sourceFile);
|
|
17861
18121
|
const cachedEntityFingerprint = entityFingerprintCache.get(entityId);
|
|
17862
18122
|
if (cachedEntityFingerprint !== undefined && !entityFingerprintsEqual(cachedEntityFingerprint, currentEntityFingerprint)) {
|
|
@@ -17875,7 +18135,7 @@ ${block}
|
|
|
17875
18135
|
rebootstrapRequired: false
|
|
17876
18136
|
};
|
|
17877
18137
|
}
|
|
17878
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
18138
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname16(componentFilePath), projectRoot)) {
|
|
17879
18139
|
return fail("inherits-decorated-class");
|
|
17880
18140
|
}
|
|
17881
18141
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -17887,7 +18147,7 @@ ${block}
|
|
|
17887
18147
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
17888
18148
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
17889
18149
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
17890
|
-
const componentDir =
|
|
18150
|
+
const componentDir = dirname16(componentFilePath);
|
|
17891
18151
|
let templateText;
|
|
17892
18152
|
let templatePath;
|
|
17893
18153
|
if (decoratorMeta.template !== null) {
|
|
@@ -17940,7 +18200,7 @@ ${block}
|
|
|
17940
18200
|
return fail("class-not-found", "anonymous class");
|
|
17941
18201
|
const wrappedClass = new compiler.WrappedNodeExpr(className_);
|
|
17942
18202
|
const { inputs, outputs, hasDecoratorIO, hasSignalIO } = extractInputsAndOutputs(classNode, compiler);
|
|
17943
|
-
const projectRelPath =
|
|
18203
|
+
const projectRelPath = relative13(projectRoot, componentFilePath).replace(/\\/g, "/");
|
|
17944
18204
|
const fingerprintId = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
17945
18205
|
const currentFingerprint = extractFingerprint(classNode, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
17946
18206
|
const cachedFingerprint = fingerprintCache.get(fingerprintId);
|
|
@@ -18648,7 +18908,7 @@ __export(exports_compileEmber, {
|
|
|
18648
18908
|
getEmberServerCompiledDir: () => getEmberServerCompiledDir,
|
|
18649
18909
|
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
18650
18910
|
getEmberClientCompiledDir: () => getEmberClientCompiledDir,
|
|
18651
|
-
dirname: () =>
|
|
18911
|
+
dirname: () => dirname17,
|
|
18652
18912
|
compileEmberFileSource: () => compileEmberFileSource,
|
|
18653
18913
|
compileEmberFile: () => compileEmberFile,
|
|
18654
18914
|
compileEmber: () => compileEmber,
|
|
@@ -18656,8 +18916,8 @@ __export(exports_compileEmber, {
|
|
|
18656
18916
|
basename: () => basename10
|
|
18657
18917
|
});
|
|
18658
18918
|
import { existsSync as existsSync25 } from "fs";
|
|
18659
|
-
import { mkdir as
|
|
18660
|
-
import { basename as basename10, dirname as
|
|
18919
|
+
import { mkdir as mkdir7, rm as rm4 } from "fs/promises";
|
|
18920
|
+
import { basename as basename10, dirname as dirname17, extname as extname7, join as join31, resolve as resolve23 } from "path";
|
|
18661
18921
|
var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file3 } = globalThis.Bun;
|
|
18662
18922
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
18663
18923
|
if (cachedPreprocessor)
|
|
@@ -18753,7 +19013,7 @@ export const importSync = (specifier) => {
|
|
|
18753
19013
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
18754
19014
|
if (!originalImporter)
|
|
18755
19015
|
return;
|
|
18756
|
-
const candidateBase = resolve23(
|
|
19016
|
+
const candidateBase = resolve23(dirname17(originalImporter), args.path);
|
|
18757
19017
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
18758
19018
|
for (const ext of extensionsToTry) {
|
|
18759
19019
|
const candidate = candidateBase + ext;
|
|
@@ -18776,7 +19036,7 @@ export const importSync = (specifier) => {
|
|
|
18776
19036
|
build.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
18777
19037
|
if (standalonePackages.has(args.path))
|
|
18778
19038
|
return;
|
|
18779
|
-
const internal =
|
|
19039
|
+
const internal = join31(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
18780
19040
|
if (existsSync25(internal))
|
|
18781
19041
|
return { path: internal };
|
|
18782
19042
|
return;
|
|
@@ -18824,16 +19084,16 @@ export default PageComponent;
|
|
|
18824
19084
|
}
|
|
18825
19085
|
const transpiled = transpiler5.transformSync(preprocessed);
|
|
18826
19086
|
const baseName = basename10(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
18827
|
-
const tmpDir =
|
|
18828
|
-
const serverDir =
|
|
18829
|
-
const clientDir =
|
|
19087
|
+
const tmpDir = join31(compiledRoot, "_tmp");
|
|
19088
|
+
const serverDir = join31(compiledRoot, "server");
|
|
19089
|
+
const clientDir = join31(compiledRoot, "client");
|
|
18830
19090
|
await Promise.all([
|
|
18831
|
-
|
|
18832
|
-
|
|
18833
|
-
|
|
19091
|
+
mkdir7(tmpDir, { recursive: true }),
|
|
19092
|
+
mkdir7(serverDir, { recursive: true }),
|
|
19093
|
+
mkdir7(clientDir, { recursive: true })
|
|
18834
19094
|
]);
|
|
18835
|
-
const tmpPagePath = resolve23(
|
|
18836
|
-
const tmpHarnessPath = resolve23(
|
|
19095
|
+
const tmpPagePath = resolve23(join31(tmpDir, `${baseName}.module.js`));
|
|
19096
|
+
const tmpHarnessPath = resolve23(join31(tmpDir, `${baseName}.harness.js`));
|
|
18837
19097
|
await Promise.all([
|
|
18838
19098
|
write4(tmpPagePath, transpiled),
|
|
18839
19099
|
write4(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -18841,7 +19101,7 @@ export default PageComponent;
|
|
|
18841
19101
|
const stagedSourceMap = new Map([
|
|
18842
19102
|
[tmpPagePath, resolvedEntry]
|
|
18843
19103
|
]);
|
|
18844
|
-
const serverPath =
|
|
19104
|
+
const serverPath = join31(serverDir, `${baseName}.js`);
|
|
18845
19105
|
const buildResult = await bunBuild2({
|
|
18846
19106
|
entrypoints: [tmpHarnessPath],
|
|
18847
19107
|
format: "esm",
|
|
@@ -18858,7 +19118,7 @@ export default PageComponent;
|
|
|
18858
19118
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
18859
19119
|
}
|
|
18860
19120
|
await rm4(tmpDir, { force: true, recursive: true });
|
|
18861
|
-
const clientPath =
|
|
19121
|
+
const clientPath = join31(clientDir, `${baseName}.js`);
|
|
18862
19122
|
await write4(clientPath, transpiled);
|
|
18863
19123
|
return { clientPath, serverPath };
|
|
18864
19124
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -18886,7 +19146,7 @@ export default PageComponent;
|
|
|
18886
19146
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
18887
19147
|
}
|
|
18888
19148
|
return transpiler5.transformSync(preprocessed);
|
|
18889
|
-
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) =>
|
|
19149
|
+
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join31(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join31(getEmberCompiledRoot(emberDir), "client");
|
|
18890
19150
|
var init_compileEmber = __esm(() => {
|
|
18891
19151
|
init_generatedDir();
|
|
18892
19152
|
transpiler5 = new Transpiler4({
|
|
@@ -18908,7 +19168,7 @@ __export(exports_buildReactVendor, {
|
|
|
18908
19168
|
buildReactVendor: () => buildReactVendor
|
|
18909
19169
|
});
|
|
18910
19170
|
import { existsSync as existsSync26, mkdirSync as mkdirSync8 } from "fs";
|
|
18911
|
-
import { join as
|
|
19171
|
+
import { join as join32, resolve as resolve24 } from "path";
|
|
18912
19172
|
import { rm as rm5 } from "fs/promises";
|
|
18913
19173
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
18914
19174
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
@@ -18950,14 +19210,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
18950
19210
|
`)}
|
|
18951
19211
|
`;
|
|
18952
19212
|
}, buildReactVendor = async (buildDir) => {
|
|
18953
|
-
const vendorDir =
|
|
19213
|
+
const vendorDir = join32(buildDir, "react", "vendor");
|
|
18954
19214
|
mkdirSync8(vendorDir, { recursive: true });
|
|
18955
|
-
const tmpDir =
|
|
19215
|
+
const tmpDir = join32(buildDir, "_vendor_tmp");
|
|
18956
19216
|
mkdirSync8(tmpDir, { recursive: true });
|
|
18957
19217
|
const specifiers = reactSpecifiers;
|
|
18958
19218
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
18959
19219
|
const safeName = toSafeFileName(specifier);
|
|
18960
|
-
const entryPath =
|
|
19220
|
+
const entryPath = join32(tmpDir, `${safeName}.ts`);
|
|
18961
19221
|
const source = await generateEntrySource(specifier);
|
|
18962
19222
|
await Bun.write(entryPath, source);
|
|
18963
19223
|
return entryPath;
|
|
@@ -19022,7 +19282,7 @@ __export(exports_buildAngularVendor, {
|
|
|
19022
19282
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
19023
19283
|
});
|
|
19024
19284
|
import { mkdirSync as mkdirSync9 } from "fs";
|
|
19025
|
-
import { join as
|
|
19285
|
+
import { join as join33 } from "path";
|
|
19026
19286
|
import { rm as rm6 } from "fs/promises";
|
|
19027
19287
|
var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
|
|
19028
19288
|
var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => jitMode ? [...REQUIRED_ANGULAR_SPECIFIERS_BASE, "@angular/compiler"] : REQUIRED_ANGULAR_SPECIFIERS_BASE, SERVER_ONLY_ANGULAR_SPECIFIERS, BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES, isBuildOnlyAngularSpecifier = (spec) => BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES.some((prefix) => spec === prefix || spec.startsWith(`${prefix}/`)), SCAN_SKIP_DIRS, isResolvable = (specifier) => {
|
|
@@ -19119,14 +19379,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19119
19379
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
19120
19380
|
return Array.from(angular).filter(isResolvable);
|
|
19121
19381
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
19122
|
-
const vendorDir =
|
|
19382
|
+
const vendorDir = join33(buildDir, "angular", "vendor");
|
|
19123
19383
|
mkdirSync9(vendorDir, { recursive: true });
|
|
19124
|
-
const tmpDir =
|
|
19384
|
+
const tmpDir = join33(buildDir, "_angular_vendor_tmp");
|
|
19125
19385
|
mkdirSync9(tmpDir, { recursive: true });
|
|
19126
19386
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
19127
19387
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19128
19388
|
const safeName = toSafeFileName2(specifier);
|
|
19129
|
-
const entryPath =
|
|
19389
|
+
const entryPath = join33(tmpDir, `${safeName}.ts`);
|
|
19130
19390
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
19131
19391
|
return entryPath;
|
|
19132
19392
|
}));
|
|
@@ -19157,9 +19417,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19157
19417
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
19158
19418
|
return computeAngularVendorPaths(specifiers);
|
|
19159
19419
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
19160
|
-
const vendorDir =
|
|
19420
|
+
const vendorDir = join33(buildDir, "angular", "vendor", "server");
|
|
19161
19421
|
mkdirSync9(vendorDir, { recursive: true });
|
|
19162
|
-
const tmpDir =
|
|
19422
|
+
const tmpDir = join33(buildDir, "_angular_server_vendor_tmp");
|
|
19163
19423
|
mkdirSync9(tmpDir, { recursive: true });
|
|
19164
19424
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
19165
19425
|
const allSpecs = new Set(browserSpecs);
|
|
@@ -19170,7 +19430,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19170
19430
|
const specifiers = Array.from(allSpecs);
|
|
19171
19431
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19172
19432
|
const safeName = toSafeFileName2(specifier);
|
|
19173
|
-
const entryPath =
|
|
19433
|
+
const entryPath = join33(tmpDir, `${safeName}.ts`);
|
|
19174
19434
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
19175
19435
|
return entryPath;
|
|
19176
19436
|
}));
|
|
@@ -19192,9 +19452,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19192
19452
|
return specifiers;
|
|
19193
19453
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
19194
19454
|
const paths = {};
|
|
19195
|
-
const vendorDir =
|
|
19455
|
+
const vendorDir = join33(buildDir, "angular", "vendor", "server");
|
|
19196
19456
|
for (const specifier of specifiers) {
|
|
19197
|
-
paths[specifier] =
|
|
19457
|
+
paths[specifier] = join33(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
19198
19458
|
}
|
|
19199
19459
|
return paths;
|
|
19200
19460
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -19250,17 +19510,17 @@ __export(exports_buildVueVendor, {
|
|
|
19250
19510
|
buildVueVendor: () => buildVueVendor
|
|
19251
19511
|
});
|
|
19252
19512
|
import { mkdirSync as mkdirSync10 } from "fs";
|
|
19253
|
-
import { join as
|
|
19513
|
+
import { join as join34 } from "path";
|
|
19254
19514
|
import { rm as rm7 } from "fs/promises";
|
|
19255
19515
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
19256
19516
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
19257
|
-
const vendorDir =
|
|
19517
|
+
const vendorDir = join34(buildDir, "vue", "vendor");
|
|
19258
19518
|
mkdirSync10(vendorDir, { recursive: true });
|
|
19259
|
-
const tmpDir =
|
|
19519
|
+
const tmpDir = join34(buildDir, "_vue_vendor_tmp");
|
|
19260
19520
|
mkdirSync10(tmpDir, { recursive: true });
|
|
19261
19521
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
19262
19522
|
const safeName = toSafeFileName3(specifier);
|
|
19263
|
-
const entryPath =
|
|
19523
|
+
const entryPath = join34(tmpDir, `${safeName}.ts`);
|
|
19264
19524
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
19265
19525
|
`);
|
|
19266
19526
|
return entryPath;
|
|
@@ -19288,7 +19548,7 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
19288
19548
|
const { readFileSync: readFileSync21, writeFileSync: writeFileSync8, readdirSync: readdirSync5 } = await import("fs");
|
|
19289
19549
|
const files = readdirSync5(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
19290
19550
|
for (const file4 of files) {
|
|
19291
|
-
const filePath =
|
|
19551
|
+
const filePath = join34(vendorDir, file4);
|
|
19292
19552
|
const content = readFileSync21(filePath, "utf-8");
|
|
19293
19553
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
19294
19554
|
continue;
|
|
@@ -19315,7 +19575,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
19315
19575
|
buildSvelteVendor: () => buildSvelteVendor
|
|
19316
19576
|
});
|
|
19317
19577
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
19318
|
-
import { join as
|
|
19578
|
+
import { join as join35 } from "path";
|
|
19319
19579
|
import { rm as rm8 } from "fs/promises";
|
|
19320
19580
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
19321
19581
|
var svelteSpecifiers, isResolvable2 = (specifier) => {
|
|
@@ -19329,13 +19589,13 @@ var svelteSpecifiers, isResolvable2 = (specifier) => {
|
|
|
19329
19589
|
const specifiers = resolveVendorSpecifiers();
|
|
19330
19590
|
if (specifiers.length === 0)
|
|
19331
19591
|
return;
|
|
19332
|
-
const vendorDir =
|
|
19592
|
+
const vendorDir = join35(buildDir, "svelte", "vendor");
|
|
19333
19593
|
mkdirSync11(vendorDir, { recursive: true });
|
|
19334
|
-
const tmpDir =
|
|
19594
|
+
const tmpDir = join35(buildDir, "_svelte_vendor_tmp");
|
|
19335
19595
|
mkdirSync11(tmpDir, { recursive: true });
|
|
19336
19596
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19337
19597
|
const safeName = toSafeFileName4(specifier);
|
|
19338
|
-
const entryPath =
|
|
19598
|
+
const entryPath = join35(tmpDir, `${safeName}.ts`);
|
|
19339
19599
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
19340
19600
|
`);
|
|
19341
19601
|
return entryPath;
|
|
@@ -19373,185 +19633,6 @@ var init_buildSvelteVendor = __esm(() => {
|
|
|
19373
19633
|
];
|
|
19374
19634
|
});
|
|
19375
19635
|
|
|
19376
|
-
// src/build/rewriteImportsPlugin.ts
|
|
19377
|
-
var exports_rewriteImportsPlugin = {};
|
|
19378
|
-
__export(exports_rewriteImportsPlugin, {
|
|
19379
|
-
rewriteVendorDirectories: () => rewriteVendorDirectories,
|
|
19380
|
-
rewriteImportsInContent: () => rewriteImportsInContent,
|
|
19381
|
-
rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
|
|
19382
|
-
rewriteBuildOutputs: () => rewriteBuildOutputs,
|
|
19383
|
-
jsRewriteImports: () => jsRewriteImports,
|
|
19384
|
-
fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
|
|
19385
|
-
buildWithImportRewrite: () => buildWithImportRewrite
|
|
19386
|
-
});
|
|
19387
|
-
import { readdir as readdir3 } from "fs/promises";
|
|
19388
|
-
import { join as join34 } from "path";
|
|
19389
|
-
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
19390
|
-
let result = content;
|
|
19391
|
-
for (const [specifier, webPath] of replacements) {
|
|
19392
|
-
const escaped = escapeRegex2(specifier);
|
|
19393
|
-
const fromRegex = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
|
|
19394
|
-
const sideEffectRegex = new RegExp(`(import\\s*["'])${escaped}(["'])`, "g");
|
|
19395
|
-
const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])${escaped}(["']\\s*\\))`, "g");
|
|
19396
|
-
result = result.replace(fromRegex, `$1${webPath}$2`);
|
|
19397
|
-
result = result.replace(sideEffectRegex, `$1${webPath}$2`);
|
|
19398
|
-
result = result.replace(dynamicRegex, `$1${webPath}$2`);
|
|
19399
|
-
}
|
|
19400
|
-
return result;
|
|
19401
|
-
}, rewriteImportsInContent = (content, vendorPaths) => {
|
|
19402
|
-
if (Object.keys(vendorPaths).length === 0)
|
|
19403
|
-
return content;
|
|
19404
|
-
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
19405
|
-
const native = nativeRewriteImports(content, replacements);
|
|
19406
|
-
return native ?? jsRewriteImports(content, replacements);
|
|
19407
|
-
}, fixMissingReExportNamespacesInContent = (content) => {
|
|
19408
|
-
const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
|
|
19409
|
-
REEXPORT_PATTERN.lastIndex = 0;
|
|
19410
|
-
const missing = [];
|
|
19411
|
-
let match;
|
|
19412
|
-
while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
|
|
19413
|
-
const ident = match[1];
|
|
19414
|
-
if (!ident)
|
|
19415
|
-
continue;
|
|
19416
|
-
const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
|
|
19417
|
-
if (nsImportRe.test(content))
|
|
19418
|
-
continue;
|
|
19419
|
-
const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
|
|
19420
|
-
if (declRe.test(content))
|
|
19421
|
-
continue;
|
|
19422
|
-
const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
|
|
19423
|
-
if (namedImportRe.test(content))
|
|
19424
|
-
continue;
|
|
19425
|
-
const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
|
|
19426
|
-
let pathMatch;
|
|
19427
|
-
let sourcePath;
|
|
19428
|
-
while ((pathMatch = importPathRe.exec(content)) !== null) {
|
|
19429
|
-
const p2 = pathMatch[1];
|
|
19430
|
-
if (!p2)
|
|
19431
|
-
continue;
|
|
19432
|
-
const base = p2.split("/").pop()?.replace(/\.[mc]?js$/, "");
|
|
19433
|
-
if (!base)
|
|
19434
|
-
continue;
|
|
19435
|
-
const normalized = base.startsWith("_") ? base.slice(1) : base;
|
|
19436
|
-
if (normalized === ident || normalized.endsWith(`_${ident}`)) {
|
|
19437
|
-
sourcePath = p2;
|
|
19438
|
-
break;
|
|
19439
|
-
}
|
|
19440
|
-
}
|
|
19441
|
-
if (sourcePath)
|
|
19442
|
-
missing.push({ ident, path: sourcePath });
|
|
19443
|
-
}
|
|
19444
|
-
if (missing.length === 0)
|
|
19445
|
-
return content;
|
|
19446
|
-
const seen = new Set;
|
|
19447
|
-
const unique = missing.filter((entry) => {
|
|
19448
|
-
if (seen.has(entry.ident))
|
|
19449
|
-
return false;
|
|
19450
|
-
seen.add(entry.ident);
|
|
19451
|
-
return true;
|
|
19452
|
-
});
|
|
19453
|
-
const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
|
|
19454
|
-
`);
|
|
19455
|
-
return `${inserts}
|
|
19456
|
-
${content}`;
|
|
19457
|
-
}, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
|
|
19458
|
-
if (Object.keys(vendorPaths).length === 0)
|
|
19459
|
-
return;
|
|
19460
|
-
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
19461
|
-
let original;
|
|
19462
|
-
try {
|
|
19463
|
-
original = await artifact.text();
|
|
19464
|
-
} catch (err) {
|
|
19465
|
-
const code = err.code;
|
|
19466
|
-
if (code === "ENOENT")
|
|
19467
|
-
return;
|
|
19468
|
-
throw err;
|
|
19469
|
-
}
|
|
19470
|
-
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
19471
|
-
if (rewritten === original)
|
|
19472
|
-
return;
|
|
19473
|
-
try {
|
|
19474
|
-
await Bun.write(artifact.path, rewritten);
|
|
19475
|
-
} catch (err) {
|
|
19476
|
-
const code = err.code;
|
|
19477
|
-
if (code === "ENOENT")
|
|
19478
|
-
return;
|
|
19479
|
-
throw err;
|
|
19480
|
-
}
|
|
19481
|
-
}));
|
|
19482
|
-
}, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
|
|
19483
|
-
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
19484
|
-
const vendorPaths = resolveVendorPaths(artifact);
|
|
19485
|
-
if (Object.keys(vendorPaths).length === 0)
|
|
19486
|
-
return;
|
|
19487
|
-
let original;
|
|
19488
|
-
try {
|
|
19489
|
-
original = await artifact.text();
|
|
19490
|
-
} catch (err) {
|
|
19491
|
-
const code = err.code;
|
|
19492
|
-
if (code === "ENOENT")
|
|
19493
|
-
return;
|
|
19494
|
-
throw err;
|
|
19495
|
-
}
|
|
19496
|
-
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
19497
|
-
if (rewritten === original)
|
|
19498
|
-
return;
|
|
19499
|
-
try {
|
|
19500
|
-
await Bun.write(artifact.path, rewritten);
|
|
19501
|
-
} catch (err) {
|
|
19502
|
-
const code = err.code;
|
|
19503
|
-
if (code === "ENOENT")
|
|
19504
|
-
return;
|
|
19505
|
-
throw err;
|
|
19506
|
-
}
|
|
19507
|
-
}));
|
|
19508
|
-
}, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
|
|
19509
|
-
if (Object.keys(vendorPaths).length === 0)
|
|
19510
|
-
return;
|
|
19511
|
-
const allFiles = [];
|
|
19512
|
-
for (const dir of vendorDirs) {
|
|
19513
|
-
try {
|
|
19514
|
-
const entries = await readdir3(dir);
|
|
19515
|
-
for (const entry of entries) {
|
|
19516
|
-
if (entry.endsWith(".js"))
|
|
19517
|
-
allFiles.push(join34(dir, entry));
|
|
19518
|
-
}
|
|
19519
|
-
} catch {}
|
|
19520
|
-
}
|
|
19521
|
-
await Promise.all(allFiles.map(async (filePath) => {
|
|
19522
|
-
let original;
|
|
19523
|
-
try {
|
|
19524
|
-
original = await Bun.file(filePath).text();
|
|
19525
|
-
} catch (err) {
|
|
19526
|
-
const code = err.code;
|
|
19527
|
-
if (code === "ENOENT")
|
|
19528
|
-
return;
|
|
19529
|
-
throw err;
|
|
19530
|
-
}
|
|
19531
|
-
let next = rewriteImportsInContent(original, vendorPaths);
|
|
19532
|
-
next = fixMissingReExportNamespacesInContent(next);
|
|
19533
|
-
if (next === original)
|
|
19534
|
-
return;
|
|
19535
|
-
try {
|
|
19536
|
-
await Bun.write(filePath, next);
|
|
19537
|
-
} catch (err) {
|
|
19538
|
-
const code = err.code;
|
|
19539
|
-
if (code === "ENOENT")
|
|
19540
|
-
return;
|
|
19541
|
-
throw err;
|
|
19542
|
-
}
|
|
19543
|
-
}));
|
|
19544
|
-
}, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
|
|
19545
|
-
const result = await pendingBuild;
|
|
19546
|
-
if (result.outputs.length > 0) {
|
|
19547
|
-
await rewriteBuildOutputs(result.outputs, vendorPaths);
|
|
19548
|
-
}
|
|
19549
|
-
return result;
|
|
19550
|
-
};
|
|
19551
|
-
var init_rewriteImportsPlugin = __esm(() => {
|
|
19552
|
-
init_nativeRewrite();
|
|
19553
|
-
});
|
|
19554
|
-
|
|
19555
19636
|
// src/core/build.ts
|
|
19556
19637
|
import {
|
|
19557
19638
|
copyFileSync as copyFileSync2,
|
|
@@ -19563,7 +19644,7 @@ import {
|
|
|
19563
19644
|
statSync as statSync3,
|
|
19564
19645
|
writeFileSync as writeFileSync8
|
|
19565
19646
|
} from "fs";
|
|
19566
|
-
import { basename as basename11, dirname as
|
|
19647
|
+
import { basename as basename11, dirname as dirname18, extname as extname8, join as join36, relative as relative14, resolve as resolve25 } from "path";
|
|
19567
19648
|
import { cwd, env as env2, exit } from "process";
|
|
19568
19649
|
var {
|
|
19569
19650
|
build: bunBuild7,
|
|
@@ -19644,8 +19725,8 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19644
19725
|
mkdirSync12(htmxDestDir, { recursive: true });
|
|
19645
19726
|
const glob = new Glob8("htmx*.min.js");
|
|
19646
19727
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
19647
|
-
const src =
|
|
19648
|
-
const dest =
|
|
19728
|
+
const src = join36(htmxDir, relPath);
|
|
19729
|
+
const dest = join36(htmxDestDir, "htmx.min.js");
|
|
19649
19730
|
copyFileSync2(src, dest);
|
|
19650
19731
|
return;
|
|
19651
19732
|
}
|
|
@@ -19720,7 +19801,7 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19720
19801
|
vuePagesPath
|
|
19721
19802
|
}) => {
|
|
19722
19803
|
const { readdirSync: readDir } = await import("fs");
|
|
19723
|
-
const devIndexDir =
|
|
19804
|
+
const devIndexDir = join36(buildPath, "_src_indexes");
|
|
19724
19805
|
mkdirSync12(devIndexDir, { recursive: true });
|
|
19725
19806
|
if (reactIndexesPath && reactPagesPath) {
|
|
19726
19807
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -19736,37 +19817,37 @@ var isDev, isBuildTraceEnabled = () => {
|
|
|
19736
19817
|
return;
|
|
19737
19818
|
}
|
|
19738
19819
|
const indexFiles = readDir(reactIndexesPath).filter((file4) => file4.endsWith(".tsx"));
|
|
19739
|
-
const pagesRel =
|
|
19820
|
+
const pagesRel = relative14(process.cwd(), resolve25(reactPagesPath)).replace(/\\/g, "/");
|
|
19740
19821
|
for (const file4 of indexFiles) {
|
|
19741
|
-
let content = readFileSync21(
|
|
19822
|
+
let content = readFileSync21(join36(reactIndexesPath, file4), "utf-8");
|
|
19742
19823
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
19743
|
-
writeFileSync8(
|
|
19824
|
+
writeFileSync8(join36(devIndexDir, file4), content);
|
|
19744
19825
|
}
|
|
19745
19826
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
19746
|
-
const svelteIndexDir =
|
|
19827
|
+
const svelteIndexDir = join36(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
19747
19828
|
const sveltePageEntries = svelteEntries.filter((file4) => resolve25(file4).startsWith(resolve25(sveltePagesPath)));
|
|
19748
19829
|
for (const entry of sveltePageEntries) {
|
|
19749
19830
|
const name = basename11(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
19750
|
-
const indexFile =
|
|
19831
|
+
const indexFile = join36(svelteIndexDir, "pages", `${name}.js`);
|
|
19751
19832
|
if (!existsSync27(indexFile))
|
|
19752
19833
|
continue;
|
|
19753
19834
|
let content = readFileSync21(indexFile, "utf-8");
|
|
19754
|
-
const srcRel =
|
|
19835
|
+
const srcRel = relative14(process.cwd(), resolve25(entry)).replace(/\\/g, "/");
|
|
19755
19836
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
19756
|
-
writeFileSync8(
|
|
19837
|
+
writeFileSync8(join36(devIndexDir, `${name}.svelte.js`), content);
|
|
19757
19838
|
}
|
|
19758
19839
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
19759
|
-
const vueIndexDir =
|
|
19840
|
+
const vueIndexDir = join36(getFrameworkGeneratedDir("vue"), "indexes");
|
|
19760
19841
|
const vuePageEntries = vueEntries.filter((file4) => resolve25(file4).startsWith(resolve25(vuePagesPath)));
|
|
19761
19842
|
for (const entry of vuePageEntries) {
|
|
19762
19843
|
const name = basename11(entry, ".vue");
|
|
19763
|
-
const indexFile =
|
|
19844
|
+
const indexFile = join36(vueIndexDir, `${name}.js`);
|
|
19764
19845
|
if (!existsSync27(indexFile))
|
|
19765
19846
|
continue;
|
|
19766
19847
|
let content = readFileSync21(indexFile, "utf-8");
|
|
19767
|
-
const srcRel =
|
|
19848
|
+
const srcRel = relative14(process.cwd(), resolve25(entry)).replace(/\\/g, "/");
|
|
19768
19849
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
19769
|
-
writeFileSync8(
|
|
19850
|
+
writeFileSync8(join36(devIndexDir, `${name}.vue.js`), content);
|
|
19770
19851
|
}
|
|
19771
19852
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
19772
19853
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -19839,7 +19920,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19839
19920
|
}, buildDevUrlFileMap = (urlReferencedFiles, projectRoot) => {
|
|
19840
19921
|
const urlFileMap = new Map;
|
|
19841
19922
|
for (const srcPath of urlReferencedFiles) {
|
|
19842
|
-
const rel =
|
|
19923
|
+
const rel = relative14(projectRoot, srcPath).replace(/\\/g, "/");
|
|
19843
19924
|
const name = basename11(srcPath);
|
|
19844
19925
|
const mtime = Math.round(statSync3(srcPath).mtimeMs);
|
|
19845
19926
|
const url = `/@src/${rel}?v=${mtime}`;
|
|
@@ -19854,7 +19935,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19854
19935
|
const output = nonReactClientOutputs.find((artifact) => basename11(artifact.path).startsWith(`${srcBase}.`));
|
|
19855
19936
|
if (!output)
|
|
19856
19937
|
continue;
|
|
19857
|
-
urlFileMap.set(basename11(srcPath), `/${
|
|
19938
|
+
urlFileMap.set(basename11(srcPath), `/${relative14(buildPath, output.path).replace(/\\/g, "/")}`);
|
|
19858
19939
|
}
|
|
19859
19940
|
return urlFileMap;
|
|
19860
19941
|
}, buildUrlFileMap = (urlReferencedFiles, hmr, projectRoot, buildPath, nonReactClientOutputs) => {
|
|
@@ -19989,10 +20070,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19989
20070
|
restoreTracePhase();
|
|
19990
20071
|
return;
|
|
19991
20072
|
}
|
|
19992
|
-
const traceDir =
|
|
20073
|
+
const traceDir = join36(buildPath2, ".absolute-trace");
|
|
19993
20074
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
19994
20075
|
mkdirSync12(traceDir, { recursive: true });
|
|
19995
|
-
writeFileSync8(
|
|
20076
|
+
writeFileSync8(join36(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
19996
20077
|
events: traceEvents,
|
|
19997
20078
|
frameworks: traceFrameworkNames,
|
|
19998
20079
|
generatedAt: new Date().toISOString(),
|
|
@@ -20023,15 +20104,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20023
20104
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
20024
20105
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
20025
20106
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
20026
|
-
const reactIndexesPath = reactDir &&
|
|
20027
|
-
const reactPagesPath = reactDir &&
|
|
20028
|
-
const htmlPagesPath = htmlDir &&
|
|
20029
|
-
const htmlScriptsPath = htmlDir &&
|
|
20030
|
-
const sveltePagesPath = svelteDir &&
|
|
20031
|
-
const vuePagesPath = vueDir &&
|
|
20032
|
-
const htmxPagesPath = htmxDir &&
|
|
20033
|
-
const angularPagesPath = angularDir &&
|
|
20034
|
-
const emberPagesPath = emberDir &&
|
|
20107
|
+
const reactIndexesPath = reactDir && join36(getFrameworkGeneratedDir("react"), "indexes");
|
|
20108
|
+
const reactPagesPath = reactDir && join36(reactDir, "pages");
|
|
20109
|
+
const htmlPagesPath = htmlDir && join36(htmlDir, "pages");
|
|
20110
|
+
const htmlScriptsPath = htmlDir && join36(htmlDir, "scripts");
|
|
20111
|
+
const sveltePagesPath = svelteDir && join36(svelteDir, "pages");
|
|
20112
|
+
const vuePagesPath = vueDir && join36(vueDir, "pages");
|
|
20113
|
+
const htmxPagesPath = htmxDir && join36(htmxDir, "pages");
|
|
20114
|
+
const angularPagesPath = angularDir && join36(angularDir, "pages");
|
|
20115
|
+
const emberPagesPath = emberDir && join36(emberDir, "pages");
|
|
20035
20116
|
const frontends = [
|
|
20036
20117
|
reactDir,
|
|
20037
20118
|
htmlDir,
|
|
@@ -20062,7 +20143,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20062
20143
|
const sourceClientRoots = [
|
|
20063
20144
|
htmlDir,
|
|
20064
20145
|
htmxDir,
|
|
20065
|
-
islandBootstrapPath &&
|
|
20146
|
+
islandBootstrapPath && dirname18(islandBootstrapPath)
|
|
20066
20147
|
].filter((dir) => Boolean(dir));
|
|
20067
20148
|
const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
|
|
20068
20149
|
if (usesGenerated)
|
|
@@ -20090,8 +20171,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20090
20171
|
const [firstEntry] = serverDirMap;
|
|
20091
20172
|
if (!firstEntry)
|
|
20092
20173
|
throw new Error("Expected at least one server directory entry");
|
|
20093
|
-
serverRoot =
|
|
20094
|
-
serverOutDir =
|
|
20174
|
+
serverRoot = join36(firstEntry.dir, firstEntry.subdir);
|
|
20175
|
+
serverOutDir = join36(buildPath, basename11(firstEntry.dir));
|
|
20095
20176
|
} else if (serverDirMap.length > 1) {
|
|
20096
20177
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
20097
20178
|
serverOutDir = buildPath;
|
|
@@ -20119,7 +20200,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20119
20200
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
20120
20201
|
}
|
|
20121
20202
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
20122
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
20203
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join36(buildPath, "assets"), {
|
|
20123
20204
|
force: true,
|
|
20124
20205
|
recursive: true
|
|
20125
20206
|
}));
|
|
@@ -20229,11 +20310,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20229
20310
|
}
|
|
20230
20311
|
}
|
|
20231
20312
|
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
20232
|
-
const htmlConventionsOutDir =
|
|
20313
|
+
const htmlConventionsOutDir = join36(buildPath, "conventions", "html");
|
|
20233
20314
|
mkdirSync12(htmlConventionsOutDir, { recursive: true });
|
|
20234
20315
|
const htmlPathRemap = new Map;
|
|
20235
20316
|
for (const sourcePath of htmlConventionSources) {
|
|
20236
|
-
const dest =
|
|
20317
|
+
const dest = join36(htmlConventionsOutDir, basename11(sourcePath));
|
|
20237
20318
|
cpSync(sourcePath, dest, { force: true });
|
|
20238
20319
|
htmlPathRemap.set(sourcePath, dest);
|
|
20239
20320
|
}
|
|
@@ -20276,7 +20357,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20276
20357
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
20277
20358
|
if (entry.startsWith(resolve25(reactIndexesPath))) {
|
|
20278
20359
|
const pageName = basename11(entry, ".tsx");
|
|
20279
|
-
return
|
|
20360
|
+
return join36(reactPagesPath, `${pageName}.tsx`);
|
|
20280
20361
|
}
|
|
20281
20362
|
return null;
|
|
20282
20363
|
}) : allReactEntries;
|
|
@@ -20395,14 +20476,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20395
20476
|
try {
|
|
20396
20477
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20397
20478
|
const { readdir: readdir4 } = await import("fs/promises");
|
|
20398
|
-
const { join:
|
|
20479
|
+
const { join: join37 } = await import("path");
|
|
20399
20480
|
const walk = async (dir) => {
|
|
20400
20481
|
const entries = await readdir4(dir, {
|
|
20401
20482
|
withFileTypes: true
|
|
20402
20483
|
});
|
|
20403
20484
|
const out = [];
|
|
20404
20485
|
for (const entry of entries) {
|
|
20405
|
-
const full =
|
|
20486
|
+
const full = join37(dir, entry.name);
|
|
20406
20487
|
if (entry.isDirectory()) {
|
|
20407
20488
|
out.push(...await walk(full));
|
|
20408
20489
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -20467,7 +20548,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20467
20548
|
const compileReactConventions = async () => {
|
|
20468
20549
|
if (reactConventionSources.length === 0)
|
|
20469
20550
|
return emptyStringArray;
|
|
20470
|
-
const destDir =
|
|
20551
|
+
const destDir = join36(buildPath, "conventions", "react");
|
|
20471
20552
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20472
20553
|
mkdirSync12(destDir, { recursive: true });
|
|
20473
20554
|
const destPaths = [];
|
|
@@ -20483,7 +20564,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20483
20564
|
naming: `${idx}-[name].[ext]`,
|
|
20484
20565
|
outdir: destDir,
|
|
20485
20566
|
plugins: [stylePreprocessorPlugin2],
|
|
20486
|
-
root:
|
|
20567
|
+
root: dirname18(source),
|
|
20487
20568
|
target: "bun",
|
|
20488
20569
|
throw: false,
|
|
20489
20570
|
tsconfig: "./tsconfig.json"
|
|
@@ -20511,7 +20592,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20511
20592
|
angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
|
|
20512
20593
|
]);
|
|
20513
20594
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
20514
|
-
const destDir =
|
|
20595
|
+
const destDir = join36(buildPath, "conventions", framework);
|
|
20515
20596
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20516
20597
|
mkdirSync12(destDir, { recursive: true });
|
|
20517
20598
|
const destPaths = [];
|
|
@@ -20585,7 +20666,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20585
20666
|
}
|
|
20586
20667
|
})) : {
|
|
20587
20668
|
entries: [],
|
|
20588
|
-
generatedRoot:
|
|
20669
|
+
generatedRoot: join36(buildPath, "_island_entries")
|
|
20589
20670
|
};
|
|
20590
20671
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
20591
20672
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -20621,7 +20702,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20621
20702
|
return {};
|
|
20622
20703
|
}
|
|
20623
20704
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
20624
|
-
const refreshEntry =
|
|
20705
|
+
const refreshEntry = join36(reactIndexesPath, "_refresh.tsx");
|
|
20625
20706
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
20626
20707
|
reactClientEntryPoints.push(refreshEntry);
|
|
20627
20708
|
}
|
|
@@ -20631,6 +20712,12 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20631
20712
|
vendorPaths = computeVendorPaths2();
|
|
20632
20713
|
setDevVendorPaths(vendorPaths);
|
|
20633
20714
|
}
|
|
20715
|
+
if (!hmr && reactDir) {
|
|
20716
|
+
const { buildReactVendor: buildReactVendor2, computeVendorPaths: computeVendorPaths2 } = await Promise.resolve().then(() => (init_buildReactVendor(), exports_buildReactVendor));
|
|
20717
|
+
await buildReactVendor2(buildPath);
|
|
20718
|
+
vendorPaths = computeVendorPaths2();
|
|
20719
|
+
setDevVendorPaths(vendorPaths);
|
|
20720
|
+
}
|
|
20634
20721
|
let angularVendorPaths2 = getAngularVendorPaths();
|
|
20635
20722
|
if (!angularVendorPaths2 && hmr && angularDir) {
|
|
20636
20723
|
const { computeAngularVendorPaths: computeAngularVendorPaths2 } = await Promise.resolve().then(() => (init_buildAngularVendor(), exports_buildAngularVendor));
|
|
@@ -20671,12 +20758,24 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20671
20758
|
vueVendorPaths2 = computeVueVendorPaths2();
|
|
20672
20759
|
setVueVendorPaths(vueVendorPaths2);
|
|
20673
20760
|
}
|
|
20761
|
+
if (!hmr && vueDir) {
|
|
20762
|
+
const { buildVueVendor: buildVueVendor2, computeVueVendorPaths: computeVueVendorPaths2 } = await Promise.resolve().then(() => (init_buildVueVendor(), exports_buildVueVendor));
|
|
20763
|
+
await buildVueVendor2(buildPath);
|
|
20764
|
+
vueVendorPaths2 = computeVueVendorPaths2();
|
|
20765
|
+
setVueVendorPaths(vueVendorPaths2);
|
|
20766
|
+
}
|
|
20674
20767
|
let svelteVendorPaths2 = getSvelteVendorPaths();
|
|
20675
20768
|
if (!svelteVendorPaths2 && hmr && svelteDir) {
|
|
20676
20769
|
const { computeSvelteVendorPaths: computeSvelteVendorPaths2 } = await Promise.resolve().then(() => (init_buildSvelteVendor(), exports_buildSvelteVendor));
|
|
20677
20770
|
svelteVendorPaths2 = computeSvelteVendorPaths2();
|
|
20678
20771
|
setSvelteVendorPaths(svelteVendorPaths2);
|
|
20679
20772
|
}
|
|
20773
|
+
if (!hmr && svelteDir) {
|
|
20774
|
+
const { buildSvelteVendor: buildSvelteVendor2, computeSvelteVendorPaths: computeSvelteVendorPaths2 } = await Promise.resolve().then(() => (init_buildSvelteVendor(), exports_buildSvelteVendor));
|
|
20775
|
+
await buildSvelteVendor2(buildPath);
|
|
20776
|
+
svelteVendorPaths2 = computeSvelteVendorPaths2();
|
|
20777
|
+
setSvelteVendorPaths(svelteVendorPaths2);
|
|
20778
|
+
}
|
|
20680
20779
|
const depVendorPaths = hmr && globalThis.__depVendorPaths ? globalThis.__depVendorPaths : {};
|
|
20681
20780
|
const reactExternalPaths = {
|
|
20682
20781
|
...vendorPaths ?? {},
|
|
@@ -20739,19 +20838,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20739
20838
|
throw: false
|
|
20740
20839
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
20741
20840
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
20742
|
-
rmSync2(
|
|
20841
|
+
rmSync2(join36(buildPath, "react", "generated", "indexes"), {
|
|
20743
20842
|
force: true,
|
|
20744
20843
|
recursive: true
|
|
20745
20844
|
});
|
|
20746
20845
|
}
|
|
20747
20846
|
if (angularDir && angularClientPaths.length > 0) {
|
|
20748
|
-
rmSync2(
|
|
20847
|
+
rmSync2(join36(buildPath, "angular", "indexes"), {
|
|
20749
20848
|
force: true,
|
|
20750
20849
|
recursive: true
|
|
20751
20850
|
});
|
|
20752
20851
|
}
|
|
20753
20852
|
if (islandClientEntryPoints.length > 0) {
|
|
20754
|
-
rmSync2(
|
|
20853
|
+
rmSync2(join36(buildPath, "islands"), {
|
|
20755
20854
|
force: true,
|
|
20756
20855
|
recursive: true
|
|
20757
20856
|
});
|
|
@@ -20843,7 +20942,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20843
20942
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20844
20943
|
entrypoints: globalCssEntries,
|
|
20845
20944
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
20846
|
-
outdir: stylesDir ?
|
|
20945
|
+
outdir: stylesDir ? join36(buildPath, basename11(stylesDir)) : buildPath,
|
|
20847
20946
|
plugins: [stylePreprocessorPlugin2],
|
|
20848
20947
|
root: stylesDir || clientRoot,
|
|
20849
20948
|
target: "browser",
|
|
@@ -20852,7 +20951,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20852
20951
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20853
20952
|
entrypoints: vueCssPaths,
|
|
20854
20953
|
naming: `[name].[hash].[ext]`,
|
|
20855
|
-
outdir:
|
|
20954
|
+
outdir: join36(buildPath, assetsPath ? basename11(assetsPath) : "assets", "css"),
|
|
20856
20955
|
target: "browser",
|
|
20857
20956
|
throw: false
|
|
20858
20957
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -20926,10 +21025,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20926
21025
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
20927
21026
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
20928
21027
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
20929
|
-
const fileDir =
|
|
21028
|
+
const fileDir = dirname18(artifact.path);
|
|
20930
21029
|
const relativePaths = {};
|
|
20931
21030
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
20932
|
-
const rel =
|
|
21031
|
+
const rel = relative14(fileDir, absolute);
|
|
20933
21032
|
relativePaths[specifier] = rel.startsWith(".") ? rel : `./${rel}`;
|
|
20934
21033
|
}
|
|
20935
21034
|
return relativePaths;
|
|
@@ -21034,7 +21133,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
21034
21133
|
const parentArtifact = serverJsByPascalName.get(parentName);
|
|
21035
21134
|
if (!parentArtifact)
|
|
21036
21135
|
return;
|
|
21037
|
-
const sourceDir =
|
|
21136
|
+
const sourceDir = dirname18(source);
|
|
21038
21137
|
const entries = routes.flatMap(({ path, importPath }) => {
|
|
21039
21138
|
const childSourcePath = resolve25(sourceDir, importPath);
|
|
21040
21139
|
const childName = basename11(childSourcePath, ".vue");
|
|
@@ -21059,7 +21158,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
21059
21158
|
if (skipAngularClientBundle) {
|
|
21060
21159
|
for (const clientPath of angularClientPaths) {
|
|
21061
21160
|
const fileBase = basename11(clientPath, ".js");
|
|
21062
|
-
const relFromCwd =
|
|
21161
|
+
const relFromCwd = relative14(projectRoot, clientPath).replace(/\\/g, "/");
|
|
21063
21162
|
manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
|
|
21064
21163
|
}
|
|
21065
21164
|
}
|
|
@@ -21084,7 +21183,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
21084
21183
|
const processHtmlPages = async () => {
|
|
21085
21184
|
if (!(htmlDir && htmlPagesPath))
|
|
21086
21185
|
return;
|
|
21087
|
-
const outputHtmlPages = isSingle ?
|
|
21186
|
+
const outputHtmlPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename11(htmlDir), "pages");
|
|
21088
21187
|
mkdirSync12(outputHtmlPages, { recursive: true });
|
|
21089
21188
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
21090
21189
|
force: true,
|
|
@@ -21109,14 +21208,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
21109
21208
|
const processHtmxPages = async () => {
|
|
21110
21209
|
if (!(htmxDir && htmxPagesPath))
|
|
21111
21210
|
return;
|
|
21112
|
-
const outputHtmxPages = isSingle ?
|
|
21211
|
+
const outputHtmxPages = isSingle ? join36(buildPath, "pages") : join36(buildPath, basename11(htmxDir), "pages");
|
|
21113
21212
|
mkdirSync12(outputHtmxPages, { recursive: true });
|
|
21114
21213
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
21115
21214
|
force: true,
|
|
21116
21215
|
recursive: true
|
|
21117
21216
|
});
|
|
21118
21217
|
if (shouldCopyHtmx) {
|
|
21119
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
21218
|
+
const htmxDestDir = isSingle ? buildPath : join36(buildPath, basename11(htmxDir));
|
|
21120
21219
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
21121
21220
|
}
|
|
21122
21221
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -21183,9 +21282,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
21183
21282
|
writeBuildTrace(buildPath);
|
|
21184
21283
|
return { conventions: conventionsMap, manifest };
|
|
21185
21284
|
}
|
|
21186
|
-
writeFileSync8(
|
|
21285
|
+
writeFileSync8(join36(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
21187
21286
|
if (Object.keys(conventionsMap).length > 0) {
|
|
21188
|
-
writeFileSync8(
|
|
21287
|
+
writeFileSync8(join36(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
21189
21288
|
}
|
|
21190
21289
|
writeBuildTrace(buildPath);
|
|
21191
21290
|
if (mode === "production") {
|
|
@@ -21308,7 +21407,7 @@ var init_build = __esm(() => {
|
|
|
21308
21407
|
|
|
21309
21408
|
// src/build/buildEmberVendor.ts
|
|
21310
21409
|
import { mkdirSync as mkdirSync13, existsSync as existsSync28 } from "fs";
|
|
21311
|
-
import { join as
|
|
21410
|
+
import { join as join37 } from "path";
|
|
21312
21411
|
import { rm as rm9 } from "fs/promises";
|
|
21313
21412
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
21314
21413
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -21360,7 +21459,7 @@ export const importSync = (specifier) => {
|
|
|
21360
21459
|
if (standaloneSpecifiers.has(specifier)) {
|
|
21361
21460
|
return { resolveTo: specifier, specifier };
|
|
21362
21461
|
}
|
|
21363
|
-
const emberInternalPath =
|
|
21462
|
+
const emberInternalPath = join37(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
21364
21463
|
if (!existsSync28(emberInternalPath)) {
|
|
21365
21464
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
21366
21465
|
}
|
|
@@ -21392,7 +21491,7 @@ export const importSync = (specifier) => {
|
|
|
21392
21491
|
if (standalonePackages.has(args.path)) {
|
|
21393
21492
|
return;
|
|
21394
21493
|
}
|
|
21395
|
-
const internal =
|
|
21494
|
+
const internal = join37(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
21396
21495
|
if (existsSync28(internal)) {
|
|
21397
21496
|
return { path: internal };
|
|
21398
21497
|
}
|
|
@@ -21400,16 +21499,16 @@ export const importSync = (specifier) => {
|
|
|
21400
21499
|
});
|
|
21401
21500
|
}
|
|
21402
21501
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
21403
|
-
const vendorDir =
|
|
21502
|
+
const vendorDir = join37(buildDir, "ember", "vendor");
|
|
21404
21503
|
mkdirSync13(vendorDir, { recursive: true });
|
|
21405
|
-
const tmpDir =
|
|
21504
|
+
const tmpDir = join37(buildDir, "_ember_vendor_tmp");
|
|
21406
21505
|
mkdirSync13(tmpDir, { recursive: true });
|
|
21407
|
-
const macrosShimPath =
|
|
21506
|
+
const macrosShimPath = join37(tmpDir, "embroider_macros_shim.js");
|
|
21408
21507
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
21409
21508
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
21410
21509
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
21411
21510
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
21412
|
-
const entryPath =
|
|
21511
|
+
const entryPath = join37(tmpDir, `${safeName}.js`);
|
|
21413
21512
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
21414
21513
|
` : generateVendorEntrySource2(resolution);
|
|
21415
21514
|
await Bun.write(entryPath, source);
|
|
@@ -21785,7 +21884,7 @@ var init_clientManager = __esm(() => {
|
|
|
21785
21884
|
|
|
21786
21885
|
// src/dev/pathUtils.ts
|
|
21787
21886
|
import { existsSync as existsSync30, readdirSync as readdirSync5, readFileSync as readFileSync23 } from "fs";
|
|
21788
|
-
import { dirname as
|
|
21887
|
+
import { dirname as dirname19, resolve as resolve28 } from "path";
|
|
21789
21888
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
21790
21889
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
21791
21890
|
return "ignored";
|
|
@@ -21913,10 +22012,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21913
22012
|
refs.push(strMatch[1]);
|
|
21914
22013
|
}
|
|
21915
22014
|
}
|
|
21916
|
-
const componentDir =
|
|
22015
|
+
const componentDir = dirname19(full);
|
|
21917
22016
|
for (const ref of refs) {
|
|
21918
22017
|
const refAbs = normalizePath(resolve28(componentDir, ref));
|
|
21919
|
-
const refDir = normalizePath(
|
|
22018
|
+
const refDir = normalizePath(dirname19(refAbs));
|
|
21920
22019
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
21921
22020
|
continue;
|
|
21922
22021
|
}
|
|
@@ -22044,7 +22143,7 @@ var init_pathUtils = __esm(() => {
|
|
|
22044
22143
|
// src/dev/fileWatcher.ts
|
|
22045
22144
|
import { watch } from "fs";
|
|
22046
22145
|
import { existsSync as existsSync31, readdirSync as readdirSync6, statSync as statSync4 } from "fs";
|
|
22047
|
-
import { dirname as
|
|
22146
|
+
import { dirname as dirname20, join as join38, resolve as resolve29 } from "path";
|
|
22048
22147
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
22049
22148
|
try {
|
|
22050
22149
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -22077,7 +22176,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
22077
22176
|
for (const name of entries) {
|
|
22078
22177
|
if (shouldSkipFilename(name, isStylesDir))
|
|
22079
22178
|
continue;
|
|
22080
|
-
const child =
|
|
22179
|
+
const child = join38(eventDir, name).replace(/\\/g, "/");
|
|
22081
22180
|
let st2;
|
|
22082
22181
|
try {
|
|
22083
22182
|
st2 = statSync4(child);
|
|
@@ -22102,12 +22201,12 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
22102
22201
|
return;
|
|
22103
22202
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
22104
22203
|
if (event === "rename") {
|
|
22105
|
-
const eventDir =
|
|
22204
|
+
const eventDir = dirname20(join38(absolutePath, filename)).replace(/\\/g, "/");
|
|
22106
22205
|
atomicRecoveryScan(eventDir);
|
|
22107
22206
|
}
|
|
22108
22207
|
return;
|
|
22109
22208
|
}
|
|
22110
|
-
const fullPath =
|
|
22209
|
+
const fullPath = join38(absolutePath, filename).replace(/\\/g, "/");
|
|
22111
22210
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
22112
22211
|
return;
|
|
22113
22212
|
}
|
|
@@ -22260,7 +22359,7 @@ var init_assetStore = __esm(() => {
|
|
|
22260
22359
|
|
|
22261
22360
|
// src/islands/pageMetadata.ts
|
|
22262
22361
|
import { readFileSync as readFileSync24 } from "fs";
|
|
22263
|
-
import { dirname as
|
|
22362
|
+
import { dirname as dirname21, resolve as resolve31 } from "path";
|
|
22264
22363
|
var pagePatterns, getPageDirs = (config) => [
|
|
22265
22364
|
{ dir: config.angularDirectory, framework: "angular" },
|
|
22266
22365
|
{ dir: config.emberDirectory, framework: "ember" },
|
|
@@ -22280,7 +22379,7 @@ var pagePatterns, getPageDirs = (config) => [
|
|
|
22280
22379
|
const source = definition.buildReference?.source;
|
|
22281
22380
|
if (!source)
|
|
22282
22381
|
continue;
|
|
22283
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve31(
|
|
22382
|
+
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve31(dirname21(buildInfo.resolvedRegistryPath), source);
|
|
22284
22383
|
lookup.set(`${definition.framework}:${definition.component}`, resolve31(resolvedSource));
|
|
22285
22384
|
}
|
|
22286
22385
|
return lookup;
|
|
@@ -22551,7 +22650,7 @@ __export(exports_resolveOwningComponents, {
|
|
|
22551
22650
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
22552
22651
|
});
|
|
22553
22652
|
import { readdirSync as readdirSync7, readFileSync as readFileSync26, statSync as statSync5 } from "fs";
|
|
22554
|
-
import { dirname as
|
|
22653
|
+
import { dirname as dirname22, extname as extname9, join as join39, resolve as resolve34 } from "path";
|
|
22555
22654
|
import ts16 from "typescript";
|
|
22556
22655
|
var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") || file4.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
22557
22656
|
const out = [];
|
|
@@ -22566,7 +22665,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22566
22665
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
22567
22666
|
continue;
|
|
22568
22667
|
}
|
|
22569
|
-
const full =
|
|
22668
|
+
const full = join39(dir, entry.name);
|
|
22570
22669
|
if (entry.isDirectory()) {
|
|
22571
22670
|
visit(full);
|
|
22572
22671
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -22705,7 +22804,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22705
22804
|
return null;
|
|
22706
22805
|
}
|
|
22707
22806
|
const sf = ts16.createSourceFile(childFilePath, source, ts16.ScriptTarget.ES2022, true, ts16.ScriptKind.TS);
|
|
22708
|
-
const childDir =
|
|
22807
|
+
const childDir = dirname22(childFilePath);
|
|
22709
22808
|
for (const stmt of sf.statements) {
|
|
22710
22809
|
if (!ts16.isImportDeclaration(stmt))
|
|
22711
22810
|
continue;
|
|
@@ -22762,7 +22861,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file4) => file4.endsWith(".ts") ||
|
|
|
22762
22861
|
const parentFile = new Map;
|
|
22763
22862
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
22764
22863
|
const classes = parseDecoratedClasses(tsPath);
|
|
22765
|
-
const componentDir =
|
|
22864
|
+
const componentDir = dirname22(tsPath);
|
|
22766
22865
|
for (const cls of classes) {
|
|
22767
22866
|
const entity = {
|
|
22768
22867
|
className: cls.className,
|
|
@@ -23068,8 +23167,8 @@ __export(exports_moduleServer, {
|
|
|
23068
23167
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
23069
23168
|
});
|
|
23070
23169
|
import { existsSync as existsSync32, readFileSync as readFileSync27, realpathSync as realpathSync3, statSync as statSync6 } from "fs";
|
|
23071
|
-
import { basename as basename13, dirname as
|
|
23072
|
-
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
23170
|
+
import { basename as basename13, dirname as dirname23, extname as extname10, join as join40, resolve as resolve36, relative as relative15 } from "path";
|
|
23171
|
+
var SRC_PREFIX = "/@src/", jsTranspiler2, legacyDecoratorTsconfig, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
23073
23172
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
23074
23173
|
const allExports = [];
|
|
23075
23174
|
let match;
|
|
@@ -23121,11 +23220,11 @@ ${stubs}
|
|
|
23121
23220
|
}
|
|
23122
23221
|
}, resolveRelativeImport = (relPath, fileDir, projectRoot, extensions) => {
|
|
23123
23222
|
const absPath = resolve36(fileDir, relPath);
|
|
23124
|
-
const rel =
|
|
23223
|
+
const rel = relative15(projectRoot, absPath);
|
|
23125
23224
|
const extension = extname10(rel);
|
|
23126
23225
|
let srcPath = RESOLVED_MODULE_EXTENSIONS.has(extension) ? rel : resolveRelativeExtension(rel, projectRoot, extensions);
|
|
23127
23226
|
if (extname10(srcPath) === ".svelte") {
|
|
23128
|
-
srcPath =
|
|
23227
|
+
srcPath = relative15(projectRoot, resolveSvelteModulePath(resolve36(projectRoot, srcPath)));
|
|
23129
23228
|
}
|
|
23130
23229
|
return srcUrl(srcPath, projectRoot);
|
|
23131
23230
|
}, NODE_BUILTIN_RE, resolveAbsoluteSpecifier = (specifier, projectRoot) => {
|
|
@@ -23137,7 +23236,7 @@ ${stubs}
|
|
|
23137
23236
|
"import"
|
|
23138
23237
|
]);
|
|
23139
23238
|
if (fromExports)
|
|
23140
|
-
return
|
|
23239
|
+
return relative15(projectRoot, fromExports);
|
|
23141
23240
|
try {
|
|
23142
23241
|
const isScoped = specifier.startsWith("@");
|
|
23143
23242
|
const parts = specifier.split("/");
|
|
@@ -23145,19 +23244,19 @@ ${stubs}
|
|
|
23145
23244
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
23146
23245
|
if (!subpath) {
|
|
23147
23246
|
const pkgDir = resolve36(projectRoot, "node_modules", packageName ?? "");
|
|
23148
|
-
const pkgJsonPath =
|
|
23247
|
+
const pkgJsonPath = join40(pkgDir, "package.json");
|
|
23149
23248
|
if (existsSync32(pkgJsonPath)) {
|
|
23150
23249
|
const pkg = JSON.parse(readFileSync27(pkgJsonPath, "utf-8"));
|
|
23151
23250
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
23152
23251
|
if (esmEntry) {
|
|
23153
23252
|
const resolved = resolve36(pkgDir, esmEntry);
|
|
23154
23253
|
if (existsSync32(resolved))
|
|
23155
|
-
return
|
|
23254
|
+
return relative15(projectRoot, resolved);
|
|
23156
23255
|
}
|
|
23157
23256
|
}
|
|
23158
23257
|
}
|
|
23159
23258
|
} catch {}
|
|
23160
|
-
return
|
|
23259
|
+
return relative15(projectRoot, Bun.resolveSync(specifier, projectRoot));
|
|
23161
23260
|
} catch {
|
|
23162
23261
|
return;
|
|
23163
23262
|
}
|
|
@@ -23182,28 +23281,28 @@ ${stubs}
|
|
|
23182
23281
|
};
|
|
23183
23282
|
result = result.replace(/^((?:import\s+[^"'`;]+?\s+from|export\s+[^"'`;]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
23184
23283
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
23185
|
-
const fileDir =
|
|
23284
|
+
const fileDir = dirname23(filePath);
|
|
23186
23285
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
23187
23286
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
23188
23287
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
23189
23288
|
const rewriteAbsoluteToSrc = (_match, prefix, absPath, _ext, suffix) => {
|
|
23190
23289
|
if (absPath.startsWith(projectRoot)) {
|
|
23191
|
-
const rel2 =
|
|
23290
|
+
const rel2 = relative15(projectRoot, absPath).replace(/\\/g, "/");
|
|
23192
23291
|
return `${prefix}${srcUrl(rel2, projectRoot)}${suffix}`;
|
|
23193
23292
|
}
|
|
23194
|
-
const rel =
|
|
23293
|
+
const rel = relative15(projectRoot, absPath).replace(/\\/g, "/");
|
|
23195
23294
|
return `${prefix}${srcUrl(rel, projectRoot)}${suffix}`;
|
|
23196
23295
|
};
|
|
23197
23296
|
result = result.replace(/((?:from|import)\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["'])/g, rewriteAbsoluteToSrc);
|
|
23198
23297
|
result = result.replace(/(import\s*\(\s*["'])(\/[^"']+\.(tsx?|jsx?|ts))(["']\s*\))/g, rewriteAbsoluteToSrc);
|
|
23199
23298
|
result = result.replace(/new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g, (_match, relPath) => {
|
|
23200
23299
|
const absPath = resolve36(fileDir, relPath);
|
|
23201
|
-
const rel =
|
|
23300
|
+
const rel = relative15(projectRoot, absPath);
|
|
23202
23301
|
return `new URL('${srcUrl(rel, projectRoot)}', import.meta.url)`;
|
|
23203
23302
|
});
|
|
23204
23303
|
result = result.replace(/import\.meta\.resolve\(\s*["'](\.\.?\/[^"']+)["']\s*\)/g, (_match, relPath) => {
|
|
23205
23304
|
const absPath = resolve36(fileDir, relPath);
|
|
23206
|
-
const rel =
|
|
23305
|
+
const rel = relative15(projectRoot, absPath);
|
|
23207
23306
|
return `'${srcUrl(rel, projectRoot)}'`;
|
|
23208
23307
|
});
|
|
23209
23308
|
return result;
|
|
@@ -23259,7 +23358,7 @@ ${code}`;
|
|
|
23259
23358
|
transpiled = `var $RefreshReg$ = window.$RefreshReg$ || function(){};
|
|
23260
23359
|
` + `var $RefreshSig$ = window.$RefreshSig$ || function(){ return function(t){ return t; }; };
|
|
23261
23360
|
${transpiled}`;
|
|
23262
|
-
const relPath =
|
|
23361
|
+
const relPath = relative15(projectRoot, filePath).replace(/\\/g, "/");
|
|
23263
23362
|
transpiled = transpiled.replace(/\binput\.tsx:/g, `${relPath}:`);
|
|
23264
23363
|
transpiled += buildIslandMetadataExports(raw);
|
|
23265
23364
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
@@ -23420,11 +23519,11 @@ ${code}`;
|
|
|
23420
23519
|
if (compiled.css?.code) {
|
|
23421
23520
|
const cssPath = `${filePath}.css`;
|
|
23422
23521
|
svelteExternalCss.set(cssPath, compiled.css.code);
|
|
23423
|
-
const cssUrl = srcUrl(
|
|
23522
|
+
const cssUrl = srcUrl(relative15(projectRoot, cssPath), projectRoot);
|
|
23424
23523
|
code = `import "${cssUrl}";
|
|
23425
23524
|
${code}`;
|
|
23426
23525
|
}
|
|
23427
|
-
const moduleUrl = `${SRC_PREFIX}${
|
|
23526
|
+
const moduleUrl = `${SRC_PREFIX}${relative15(projectRoot, filePath).replace(/\\/g, "/")}`;
|
|
23428
23527
|
code = code.replace(/if\s*\(import\.meta\.hot\)\s*\{/, `if (typeof window !== "undefined") {
|
|
23429
23528
|
` + ` if (!window.__SVELTE_HMR_ACCEPT__) window.__SVELTE_HMR_ACCEPT__ = {};
|
|
23430
23529
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
@@ -23525,7 +23624,7 @@ ${code}`;
|
|
|
23525
23624
|
return rewriteImports(code, filePath, projectRoot, rewriter);
|
|
23526
23625
|
}, injectVueHmr = (code, filePath, projectRoot, vueDir) => {
|
|
23527
23626
|
const hmrBase = vueDir ? resolve36(vueDir) : projectRoot;
|
|
23528
|
-
const hmrId =
|
|
23627
|
+
const hmrId = relative15(hmrBase, filePath).replace(/\\/g, "/").replace(/\.vue$/, "");
|
|
23529
23628
|
let result = code.replace(/export\s+default\s+/, "var __hmr_comp__ = ");
|
|
23530
23629
|
result += [
|
|
23531
23630
|
"",
|
|
@@ -23871,13 +23970,21 @@ var init_moduleServer = __esm(() => {
|
|
|
23871
23970
|
loader: "js",
|
|
23872
23971
|
trimUnusedImports: true
|
|
23873
23972
|
});
|
|
23973
|
+
legacyDecoratorTsconfig = JSON.stringify({
|
|
23974
|
+
compilerOptions: {
|
|
23975
|
+
emitDecoratorMetadata: true,
|
|
23976
|
+
experimentalDecorators: true
|
|
23977
|
+
}
|
|
23978
|
+
});
|
|
23874
23979
|
tsTranspiler2 = new Bun.Transpiler({
|
|
23875
23980
|
loader: "ts",
|
|
23876
|
-
trimUnusedImports: true
|
|
23981
|
+
trimUnusedImports: true,
|
|
23982
|
+
tsconfig: legacyDecoratorTsconfig
|
|
23877
23983
|
});
|
|
23878
23984
|
tsxTranspiler = new Bun.Transpiler({
|
|
23879
23985
|
loader: "tsx",
|
|
23880
|
-
trimUnusedImports: true
|
|
23986
|
+
trimUnusedImports: true,
|
|
23987
|
+
tsconfig: legacyDecoratorTsconfig
|
|
23881
23988
|
});
|
|
23882
23989
|
TRANSPILABLE = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs"]);
|
|
23883
23990
|
ALL_EXPORTS_RE = /export\s+(?:type|interface|const|let|var|function|class|enum|abstract\s+class)\s+(\w+)/g;
|
|
@@ -23936,6 +24043,9 @@ export function __legacyMetadataTS(k, v) {
|
|
|
23936
24043
|
return Reflect.metadata(k, v);
|
|
23937
24044
|
}
|
|
23938
24045
|
}
|
|
24046
|
+
export function __legacyDecorateParamTS(paramIndex, decorator) {
|
|
24047
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
24048
|
+
}
|
|
23939
24049
|
`.trim();
|
|
23940
24050
|
SRC_IMPORT_RE = /\/@src\/([^"'?\s]+)/g;
|
|
23941
24051
|
SRC_URL_PREFIX = SRC_PREFIX;
|
|
@@ -23987,7 +24097,7 @@ __export(exports_hmrCompiler, {
|
|
|
23987
24097
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
23988
24098
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
23989
24099
|
});
|
|
23990
|
-
import { dirname as
|
|
24100
|
+
import { dirname as dirname24, relative as relative16, resolve as resolve37 } from "path";
|
|
23991
24101
|
import { performance as performance2 } from "perf_hooks";
|
|
23992
24102
|
var getApplyMetadataModule = async (encodedId) => {
|
|
23993
24103
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -23997,7 +24107,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
23997
24107
|
const filePathRel = decoded.slice(0, at2);
|
|
23998
24108
|
const className = decoded.slice(at2 + 1);
|
|
23999
24109
|
const componentFilePath = resolve37(process.cwd(), filePathRel);
|
|
24000
|
-
const projectRelPath =
|
|
24110
|
+
const projectRelPath = relative16(process.cwd(), componentFilePath).replace(/\\/g, "/");
|
|
24001
24111
|
const cacheKey2 = encodeURIComponent(`${projectRelPath}@${className}`);
|
|
24002
24112
|
const { takePendingModule: takePendingModule2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
24003
24113
|
const cached = takePendingModule2(cacheKey2);
|
|
@@ -24007,7 +24117,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
24007
24117
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
24008
24118
|
const owners = resolveOwningComponents2({
|
|
24009
24119
|
changedFilePath: componentFilePath,
|
|
24010
|
-
userAngularRoot:
|
|
24120
|
+
userAngularRoot: dirname24(componentFilePath)
|
|
24011
24121
|
});
|
|
24012
24122
|
const owner = owners.find((o3) => o3.className === className);
|
|
24013
24123
|
const kind = owner?.kind ?? "component";
|
|
@@ -24019,7 +24129,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
24019
24129
|
}
|
|
24020
24130
|
return null;
|
|
24021
24131
|
}, encodeHmrComponentId = (absoluteFilePath, className) => {
|
|
24022
|
-
const projectRel =
|
|
24132
|
+
const projectRel = relative16(process.cwd(), absoluteFilePath).replace(/\\/g, "/");
|
|
24023
24133
|
return `${projectRel}@${className}`;
|
|
24024
24134
|
};
|
|
24025
24135
|
var init_hmrCompiler = __esm(() => {
|
|
@@ -24215,7 +24325,7 @@ var init_simpleHTMXHMR = () => {};
|
|
|
24215
24325
|
|
|
24216
24326
|
// src/dev/rebuildTrigger.ts
|
|
24217
24327
|
import { existsSync as existsSync33, rmSync as rmSync3 } from "fs";
|
|
24218
|
-
import { basename as basename14, dirname as
|
|
24328
|
+
import { basename as basename14, dirname as dirname25, join as join41, relative as relative17, resolve as resolve40, sep as sep4 } from "path";
|
|
24219
24329
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
|
|
24220
24330
|
if (!config.tailwind)
|
|
24221
24331
|
return;
|
|
@@ -24332,8 +24442,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24332
24442
|
const relJs = `${rel.slice(0, -ext[0].length)}.js`;
|
|
24333
24443
|
const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
|
|
24334
24444
|
for (const candidate of [
|
|
24335
|
-
|
|
24336
|
-
`${
|
|
24445
|
+
join41(generatedDir, relJs),
|
|
24446
|
+
`${join41(generatedDir, relJs)}.map`
|
|
24337
24447
|
]) {
|
|
24338
24448
|
try {
|
|
24339
24449
|
rmSync3(candidate, { force: true });
|
|
@@ -24537,15 +24647,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24537
24647
|
const relFromDir = normalizedSource.slice(normalizedDir.length + 1);
|
|
24538
24648
|
const buildDir = state.resolvedPaths.buildDir;
|
|
24539
24649
|
const destPath = resolve40(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
|
|
24540
|
-
const { mkdir:
|
|
24541
|
-
const { dirname:
|
|
24542
|
-
await
|
|
24650
|
+
const { mkdir: mkdir8, copyFile, readFile: readFile6 } = await import("fs/promises");
|
|
24651
|
+
const { dirname: dirname26 } = await import("path");
|
|
24652
|
+
await mkdir8(dirname26(destPath), { recursive: true });
|
|
24543
24653
|
await copyFile(absSource, destPath);
|
|
24544
24654
|
const bytes = await readFile6(destPath);
|
|
24545
24655
|
const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
|
|
24546
24656
|
state.assetStore.set(webPath, new Uint8Array(bytes));
|
|
24547
24657
|
state.fileHashes.set(absSource, currentHash);
|
|
24548
|
-
logHmrUpdate(
|
|
24658
|
+
logHmrUpdate(relative17(process.cwd(), filePath));
|
|
24549
24659
|
broadcastToClients(state, {
|
|
24550
24660
|
data: {
|
|
24551
24661
|
framework: urlPrefix || "public",
|
|
@@ -24563,7 +24673,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24563
24673
|
return;
|
|
24564
24674
|
if (framework === "unknown") {
|
|
24565
24675
|
invalidate(resolve40(filePath));
|
|
24566
|
-
const relPath =
|
|
24676
|
+
const relPath = relative17(process.cwd(), filePath);
|
|
24567
24677
|
logHmrUpdate(relPath);
|
|
24568
24678
|
const angularDir = state.resolvedPaths.angularDir;
|
|
24569
24679
|
let hasAngularDependent = false;
|
|
@@ -24738,7 +24848,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24738
24848
|
const keepByDir = new Map;
|
|
24739
24849
|
const prefixByDir = new Map;
|
|
24740
24850
|
for (const artifact of freshOutputs) {
|
|
24741
|
-
const dir =
|
|
24851
|
+
const dir = dirname25(artifact.path);
|
|
24742
24852
|
const name = basename14(artifact.path);
|
|
24743
24853
|
const [prefix] = name.split(".");
|
|
24744
24854
|
if (!prefix)
|
|
@@ -25151,7 +25261,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25151
25261
|
try {
|
|
25152
25262
|
const { invalidateModule: invalidateModule2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
25153
25263
|
for (const tsFile of tsFilesToRefresh) {
|
|
25154
|
-
const rel =
|
|
25264
|
+
const rel = relative17(angularDirAbs, tsFile).replace(/\\/g, "/").replace(/\.[tj]sx?$/, ".js");
|
|
25155
25265
|
const compiledFile = resolve40(compiledRoot, rel);
|
|
25156
25266
|
invalidateModule2(compiledFile);
|
|
25157
25267
|
}
|
|
@@ -25192,12 +25302,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25192
25302
|
try {
|
|
25193
25303
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
25194
25304
|
const { readdir: readdir5 } = await import("fs/promises");
|
|
25195
|
-
const { join:
|
|
25305
|
+
const { join: join42 } = await import("path");
|
|
25196
25306
|
const walk = async (dir) => {
|
|
25197
25307
|
const entries = await readdir5(dir, { withFileTypes: true });
|
|
25198
25308
|
const files = [];
|
|
25199
25309
|
for (const entry of entries) {
|
|
25200
|
-
const full =
|
|
25310
|
+
const full = join42(dir, entry.name);
|
|
25201
25311
|
if (entry.isDirectory()) {
|
|
25202
25312
|
files.push(...await walk(full));
|
|
25203
25313
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -25297,7 +25407,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25297
25407
|
}, getModuleUrl = async (pageFile) => {
|
|
25298
25408
|
const { invalidateModule: invalidateModule2, warmCache: warmCache2, SRC_URL_PREFIX: SRC_URL_PREFIX2 } = await Promise.resolve().then(() => (init_moduleServer(), exports_moduleServer));
|
|
25299
25409
|
invalidateModule2(pageFile);
|
|
25300
|
-
const rel =
|
|
25410
|
+
const rel = relative17(process.cwd(), pageFile).replace(/\\/g, "/");
|
|
25301
25411
|
const url = `${SRC_URL_PREFIX2}${rel}`;
|
|
25302
25412
|
warmCache2(url);
|
|
25303
25413
|
return url;
|
|
@@ -25328,7 +25438,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25328
25438
|
const pageModuleUrl = await getReactModuleUrl(broadcastTarget);
|
|
25329
25439
|
if (pageModuleUrl) {
|
|
25330
25440
|
const serverDuration = Date.now() - startTime;
|
|
25331
|
-
state.lastHmrPath =
|
|
25441
|
+
state.lastHmrPath = relative17(process.cwd(), primaryFile).replace(/\\/g, "/");
|
|
25332
25442
|
state.lastHmrFramework = "react";
|
|
25333
25443
|
broadcastToClients(state, {
|
|
25334
25444
|
data: {
|
|
@@ -25663,7 +25773,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25663
25773
|
const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
|
|
25664
25774
|
const serverEntries = [...vueServerPaths];
|
|
25665
25775
|
const clientEntries = [...vueIndexPaths, ...vueClientPaths];
|
|
25666
|
-
const cssOutDir =
|
|
25776
|
+
const cssOutDir = join41(buildDir, state.resolvedPaths.assetsDir ? basename14(state.resolvedPaths.assetsDir) : "assets", "css");
|
|
25667
25777
|
const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
|
|
25668
25778
|
const [serverResult, clientResult, cssResult] = await Promise.all([
|
|
25669
25779
|
serverEntries.length > 0 ? bunBuild9({
|
|
@@ -25819,7 +25929,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25819
25929
|
const duration = Date.now() - startTime;
|
|
25820
25930
|
const [primary] = emberFiles;
|
|
25821
25931
|
if (primary) {
|
|
25822
|
-
state.lastHmrPath =
|
|
25932
|
+
state.lastHmrPath = relative17(process.cwd(), primary).replace(/\\/g, "/");
|
|
25823
25933
|
state.lastHmrFramework = "ember";
|
|
25824
25934
|
logHmrUpdate(primary, "ember", duration);
|
|
25825
25935
|
}
|
|
@@ -25904,7 +26014,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25904
26014
|
if (!buildReference?.source) {
|
|
25905
26015
|
return;
|
|
25906
26016
|
}
|
|
25907
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve40(
|
|
26017
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve40(dirname25(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
25908
26018
|
islandFiles.add(resolve40(sourcePath));
|
|
25909
26019
|
}, resolveIslandSourceFiles = async (config) => {
|
|
25910
26020
|
const registryPath = config.islands?.registry;
|
|
@@ -26062,7 +26172,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
26062
26172
|
const baseName = fileName.replace(/\.vue$/, "");
|
|
26063
26173
|
const pascalName = toPascal(baseName);
|
|
26064
26174
|
const vueRoot = config.vueDirectory;
|
|
26065
|
-
const hmrId = vueRoot ?
|
|
26175
|
+
const hmrId = vueRoot ? relative17(vueRoot, vuePagePath).replace(/\\/g, "/").replace(/\.vue$/, "") : baseName;
|
|
26066
26176
|
const cssKey = `${pascalName}CSS`;
|
|
26067
26177
|
const cssUrl = manifest[cssKey] || null;
|
|
26068
26178
|
const { vueHmrMetadata: vueHmrMetadata2 } = await Promise.resolve().then(() => (init_compileVue(), exports_compileVue));
|
|
@@ -26678,7 +26788,7 @@ __export(exports_buildDepVendor, {
|
|
|
26678
26788
|
buildDepVendor: () => buildDepVendor
|
|
26679
26789
|
});
|
|
26680
26790
|
import { mkdirSync as mkdirSync14 } from "fs";
|
|
26681
|
-
import { join as
|
|
26791
|
+
import { join as join42 } from "path";
|
|
26682
26792
|
import { rm as rm10 } from "fs/promises";
|
|
26683
26793
|
var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
|
|
26684
26794
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -26789,7 +26899,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26789
26899
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
26790
26900
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
26791
26901
|
const safeName = toSafeFileName6(specifier);
|
|
26792
|
-
const entryPath =
|
|
26902
|
+
const entryPath = join42(tmpDir, `${safeName}.ts`);
|
|
26793
26903
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
26794
26904
|
return { entryPath, specifier };
|
|
26795
26905
|
}));
|
|
@@ -26850,9 +26960,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26850
26960
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
26851
26961
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
26852
26962
|
return {};
|
|
26853
|
-
const vendorDir =
|
|
26963
|
+
const vendorDir = join42(buildDir, "vendor");
|
|
26854
26964
|
mkdirSync14(vendorDir, { recursive: true });
|
|
26855
|
-
const tmpDir =
|
|
26965
|
+
const tmpDir = join42(buildDir, "_dep_vendor_tmp");
|
|
26856
26966
|
mkdirSync14(tmpDir, { recursive: true });
|
|
26857
26967
|
const allSpecs = new Set(initialSpecs);
|
|
26858
26968
|
const alreadyScanned = new Set;
|
|
@@ -27363,5 +27473,5 @@ export {
|
|
|
27363
27473
|
build
|
|
27364
27474
|
};
|
|
27365
27475
|
|
|
27366
|
-
//# debugId=
|
|
27476
|
+
//# debugId=25EB7439F55390E664756E2164756E21
|
|
27367
27477
|
//# sourceMappingURL=build.js.map
|