@absolutejs/absolute 0.19.0-beta.1023 → 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 +827 -735
- package/dist/build.js.map +11 -10
- 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 +899 -800
- package/dist/index.js.map +12 -11
- 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/svelte/index.js
CHANGED
|
@@ -2325,9 +2325,12 @@ var initDominoAdapter = (platformServer) => {
|
|
|
2325
2325
|
return {
|
|
2326
2326
|
APP_BASE_HREF: common.APP_BASE_HREF,
|
|
2327
2327
|
bootstrapApplication: platformBrowser.bootstrapApplication,
|
|
2328
|
+
Component: core.Component,
|
|
2328
2329
|
DomSanitizer: platformBrowser.DomSanitizer,
|
|
2329
2330
|
ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
|
|
2330
2331
|
inject: core.inject,
|
|
2332
|
+
InjectionToken: core.InjectionToken,
|
|
2333
|
+
NgComponentOutlet: common.NgComponentOutlet,
|
|
2331
2334
|
provideClientHydration: platformBrowser.provideClientHydration,
|
|
2332
2335
|
provideServerRendering: platformServer.provideServerRendering,
|
|
2333
2336
|
provideZonelessChangeDetection: core.provideZonelessChangeDetection,
|
|
@@ -2583,9 +2586,8 @@ var angularIslandSelector = "abs-angular-island", isAngularComponent = (value) =
|
|
|
2583
2586
|
const componentName = typeof component.name === "string" && component.name.length > 0 ? component.name : "AngularIsland";
|
|
2584
2587
|
return `${componentName}:${JSON.stringify(props)}`;
|
|
2585
2588
|
}, buildAngularIslandWrapperMetadata = async (component, islandId, wrapperKey) => {
|
|
2586
|
-
const { Component, InjectionToken, inject } = await import("@angular/core");
|
|
2587
|
-
const { NgComponentOutlet } = await import("@angular/common");
|
|
2588
2589
|
const deps = await getAngularDeps();
|
|
2590
|
+
const { Component, InjectionToken, NgComponentOutlet, inject } = deps;
|
|
2589
2591
|
const selector = getAngularIslandSelector(islandId);
|
|
2590
2592
|
const propsToken = new InjectionToken(`${wrapperKey}:props`);
|
|
2591
2593
|
|
|
@@ -2691,7 +2693,15 @@ var init_islands = __esm(() => {
|
|
|
2691
2693
|
var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
|
|
2692
2694
|
const { renderAngularIslandToHtml: renderAngularIslandToHtml2 } = await Promise.resolve().then(() => (init_islands(), exports_islands));
|
|
2693
2695
|
return renderAngularIslandToHtml2(component, props, islandId);
|
|
2694
|
-
}, renderAngularIslandToHtml2,
|
|
2696
|
+
}, renderAngularIslandToHtml2, LEADING_HOISTED_RESOURCE_RE, stripLeadingHoistedResources = (html) => {
|
|
2697
|
+
let result = html;
|
|
2698
|
+
let match = LEADING_HOISTED_RESOURCE_RE.exec(result);
|
|
2699
|
+
while (match) {
|
|
2700
|
+
result = result.slice(match[0].length);
|
|
2701
|
+
match = LEADING_HOISTED_RESOURCE_RE.exec(result);
|
|
2702
|
+
}
|
|
2703
|
+
return result.trimStart();
|
|
2704
|
+
}, 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 }) => {
|
|
2695
2705
|
const { body } = render(component, { props });
|
|
2696
2706
|
return body;
|
|
2697
2707
|
}), renderVueIslandToHtml = (component, props) => import("vue").then(({ createSSRApp, h: createVueVNode }) => {
|
|
@@ -2702,20 +2712,321 @@ var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
|
|
|
2702
2712
|
});
|
|
2703
2713
|
var init_islandSsr = __esm(() => {
|
|
2704
2714
|
renderAngularIslandToHtml2 = renderAngularIslandToHtmlInternal;
|
|
2715
|
+
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;
|
|
2716
|
+
});
|
|
2717
|
+
|
|
2718
|
+
// src/build/nativeRewrite.ts
|
|
2719
|
+
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
2720
|
+
import { platform, arch } from "os";
|
|
2721
|
+
import { resolve as resolve5 } from "path";
|
|
2722
|
+
var ffiDefinition, nativeLib = null, loadNative = () => {
|
|
2723
|
+
if (nativeLib !== null)
|
|
2724
|
+
return nativeLib;
|
|
2725
|
+
const osPlatform = platform();
|
|
2726
|
+
const cpu = arch();
|
|
2727
|
+
const platformMap = {
|
|
2728
|
+
"darwin-arm64": "darwin-arm64/fast_ops.dylib",
|
|
2729
|
+
"darwin-x64": "darwin-x64/fast_ops.dylib",
|
|
2730
|
+
"linux-arm64": "linux-arm64/fast_ops.so",
|
|
2731
|
+
"linux-x64": "linux-x64/fast_ops.so",
|
|
2732
|
+
"win32-arm64": "windows-arm64/fast_ops.dll",
|
|
2733
|
+
"win32-x64": "windows-x64/fast_ops.dll"
|
|
2734
|
+
};
|
|
2735
|
+
const libPath = platformMap[`${osPlatform}-${cpu}`];
|
|
2736
|
+
if (!libPath)
|
|
2737
|
+
return null;
|
|
2738
|
+
try {
|
|
2739
|
+
const fullPath = resolve5(import.meta.dir, "../../native/packages", libPath);
|
|
2740
|
+
const lib = dlopen(fullPath, ffiDefinition);
|
|
2741
|
+
nativeLib = lib.symbols;
|
|
2742
|
+
return nativeLib;
|
|
2743
|
+
} catch {
|
|
2744
|
+
return null;
|
|
2745
|
+
}
|
|
2746
|
+
}, nativeRewriteImports = (content, replacements) => {
|
|
2747
|
+
const lib = loadNative();
|
|
2748
|
+
if (!lib)
|
|
2749
|
+
return null;
|
|
2750
|
+
const jsonStr = JSON.stringify(replacements);
|
|
2751
|
+
const contentBuf = Buffer.from(content);
|
|
2752
|
+
const jsonBuf = Buffer.from(jsonStr);
|
|
2753
|
+
const outBuf = Buffer.alloc(content.length * 2);
|
|
2754
|
+
const outLenBuf = new BigUint64Array([BigInt(outBuf.length)]);
|
|
2755
|
+
const result = lib.rewrite_imports(ptr(contentBuf), contentBuf.length, ptr(jsonBuf), jsonBuf.length, ptr(outBuf), ptr(new Uint8Array(outLenBuf.buffer)));
|
|
2756
|
+
if (result < 0)
|
|
2757
|
+
return null;
|
|
2758
|
+
if (result === 0)
|
|
2759
|
+
return content;
|
|
2760
|
+
const outLen = Number(outLenBuf[0]);
|
|
2761
|
+
return outBuf.subarray(0, outLen).toString("utf-8");
|
|
2762
|
+
};
|
|
2763
|
+
var init_nativeRewrite = __esm(() => {
|
|
2764
|
+
ffiDefinition = {
|
|
2765
|
+
rewrite_imports: {
|
|
2766
|
+
args: [
|
|
2767
|
+
FFIType.ptr,
|
|
2768
|
+
FFIType.u64,
|
|
2769
|
+
FFIType.ptr,
|
|
2770
|
+
FFIType.u64,
|
|
2771
|
+
FFIType.ptr,
|
|
2772
|
+
FFIType.ptr
|
|
2773
|
+
],
|
|
2774
|
+
returns: FFIType.i32
|
|
2775
|
+
}
|
|
2776
|
+
};
|
|
2777
|
+
});
|
|
2778
|
+
|
|
2779
|
+
// src/build/rewriteImportsPlugin.ts
|
|
2780
|
+
var exports_rewriteImportsPlugin = {};
|
|
2781
|
+
__export(exports_rewriteImportsPlugin, {
|
|
2782
|
+
rewriteVendorDirectories: () => rewriteVendorDirectories,
|
|
2783
|
+
rewriteImportsInContent: () => rewriteImportsInContent,
|
|
2784
|
+
rewriteBuildOutputsWith: () => rewriteBuildOutputsWith,
|
|
2785
|
+
rewriteBuildOutputs: () => rewriteBuildOutputs,
|
|
2786
|
+
jsRewriteImports: () => jsRewriteImports,
|
|
2787
|
+
fixMissingReExportNamespacesInContent: () => fixMissingReExportNamespacesInContent,
|
|
2788
|
+
buildWithImportRewrite: () => buildWithImportRewrite
|
|
2789
|
+
});
|
|
2790
|
+
import { readdir as readdir2 } from "fs/promises";
|
|
2791
|
+
import { join as join5 } from "path";
|
|
2792
|
+
var escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
2793
|
+
let result = content;
|
|
2794
|
+
for (const [specifier, webPath] of replacements) {
|
|
2795
|
+
const escaped = escapeRegex(specifier);
|
|
2796
|
+
const fromRegex = new RegExp(`(from\\s*["'])${escaped}(["'])`, "g");
|
|
2797
|
+
const sideEffectRegex = new RegExp(`(import\\s*["'])${escaped}(["'])`, "g");
|
|
2798
|
+
const dynamicRegex = new RegExp(`(import\\s*\\(\\s*["'])${escaped}(["']\\s*\\))`, "g");
|
|
2799
|
+
result = result.replace(fromRegex, `$1${webPath}$2`);
|
|
2800
|
+
result = result.replace(sideEffectRegex, `$1${webPath}$2`);
|
|
2801
|
+
result = result.replace(dynamicRegex, `$1${webPath}$2`);
|
|
2802
|
+
}
|
|
2803
|
+
return result;
|
|
2804
|
+
}, rewriteImportsInContent = (content, vendorPaths) => {
|
|
2805
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
2806
|
+
return content;
|
|
2807
|
+
const replacements = Object.entries(vendorPaths).sort(([keyA], [keyB]) => keyB.length - keyA.length);
|
|
2808
|
+
const native = nativeRewriteImports(content, replacements);
|
|
2809
|
+
return native ?? jsRewriteImports(content, replacements);
|
|
2810
|
+
}, fixMissingReExportNamespacesInContent = (content) => {
|
|
2811
|
+
const REEXPORT_PATTERN = /__reExport\(\s*[A-Za-z_$][\w$]*\s*,\s*([A-Za-z_$][\w$]*)\s*\)/g;
|
|
2812
|
+
REEXPORT_PATTERN.lastIndex = 0;
|
|
2813
|
+
const missing = [];
|
|
2814
|
+
let match;
|
|
2815
|
+
while ((match = REEXPORT_PATTERN.exec(content)) !== null) {
|
|
2816
|
+
const ident = match[1];
|
|
2817
|
+
if (!ident)
|
|
2818
|
+
continue;
|
|
2819
|
+
const nsImportRe = new RegExp(`\\bimport\\s*\\*\\s*as\\s+${ident}\\s+from\\b`);
|
|
2820
|
+
if (nsImportRe.test(content))
|
|
2821
|
+
continue;
|
|
2822
|
+
const declRe = new RegExp(`\\b(?:const|let|var|function|class)\\s+${ident}\\b`);
|
|
2823
|
+
if (declRe.test(content))
|
|
2824
|
+
continue;
|
|
2825
|
+
const namedImportRe = new RegExp(`\\bimport\\s*\\{[^}]*\\b${ident}\\b[^}]*\\}\\s*from\\b`);
|
|
2826
|
+
if (namedImportRe.test(content))
|
|
2827
|
+
continue;
|
|
2828
|
+
const importPathRe = /(?:from\s+|import\s*)["']([^"']+)["']/g;
|
|
2829
|
+
let pathMatch;
|
|
2830
|
+
let sourcePath;
|
|
2831
|
+
while ((pathMatch = importPathRe.exec(content)) !== null) {
|
|
2832
|
+
const p = pathMatch[1];
|
|
2833
|
+
if (!p)
|
|
2834
|
+
continue;
|
|
2835
|
+
const base = p.split("/").pop()?.replace(/\.[mc]?js$/, "");
|
|
2836
|
+
if (!base)
|
|
2837
|
+
continue;
|
|
2838
|
+
const normalized = base.startsWith("_") ? base.slice(1) : base;
|
|
2839
|
+
if (normalized === ident || normalized.endsWith(`_${ident}`)) {
|
|
2840
|
+
sourcePath = p;
|
|
2841
|
+
break;
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
if (sourcePath)
|
|
2845
|
+
missing.push({ ident, path: sourcePath });
|
|
2846
|
+
}
|
|
2847
|
+
if (missing.length === 0)
|
|
2848
|
+
return content;
|
|
2849
|
+
const seen = new Set;
|
|
2850
|
+
const unique = missing.filter((entry) => {
|
|
2851
|
+
if (seen.has(entry.ident))
|
|
2852
|
+
return false;
|
|
2853
|
+
seen.add(entry.ident);
|
|
2854
|
+
return true;
|
|
2855
|
+
});
|
|
2856
|
+
const inserts = unique.map((entry) => `import * as ${entry.ident} from "${entry.path}";`).join(`
|
|
2857
|
+
`);
|
|
2858
|
+
return `${inserts}
|
|
2859
|
+
${content}`;
|
|
2860
|
+
}, isReadableArtifact = (artifact) => artifact.path.endsWith(".js"), rewriteBuildOutputs = async (outputs, vendorPaths) => {
|
|
2861
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
2862
|
+
return;
|
|
2863
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
2864
|
+
let original;
|
|
2865
|
+
try {
|
|
2866
|
+
original = await artifact.text();
|
|
2867
|
+
} catch (err) {
|
|
2868
|
+
const code = err.code;
|
|
2869
|
+
if (code === "ENOENT")
|
|
2870
|
+
return;
|
|
2871
|
+
throw err;
|
|
2872
|
+
}
|
|
2873
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
2874
|
+
if (rewritten === original)
|
|
2875
|
+
return;
|
|
2876
|
+
try {
|
|
2877
|
+
await Bun.write(artifact.path, rewritten);
|
|
2878
|
+
} catch (err) {
|
|
2879
|
+
const code = err.code;
|
|
2880
|
+
if (code === "ENOENT")
|
|
2881
|
+
return;
|
|
2882
|
+
throw err;
|
|
2883
|
+
}
|
|
2884
|
+
}));
|
|
2885
|
+
}, rewriteBuildOutputsWith = async (outputs, resolveVendorPaths) => {
|
|
2886
|
+
await Promise.all(outputs.filter(isReadableArtifact).map(async (artifact) => {
|
|
2887
|
+
const vendorPaths = resolveVendorPaths(artifact);
|
|
2888
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
2889
|
+
return;
|
|
2890
|
+
let original;
|
|
2891
|
+
try {
|
|
2892
|
+
original = await artifact.text();
|
|
2893
|
+
} catch (err) {
|
|
2894
|
+
const code = err.code;
|
|
2895
|
+
if (code === "ENOENT")
|
|
2896
|
+
return;
|
|
2897
|
+
throw err;
|
|
2898
|
+
}
|
|
2899
|
+
const rewritten = rewriteImportsInContent(original, vendorPaths);
|
|
2900
|
+
if (rewritten === original)
|
|
2901
|
+
return;
|
|
2902
|
+
try {
|
|
2903
|
+
await Bun.write(artifact.path, rewritten);
|
|
2904
|
+
} catch (err) {
|
|
2905
|
+
const code = err.code;
|
|
2906
|
+
if (code === "ENOENT")
|
|
2907
|
+
return;
|
|
2908
|
+
throw err;
|
|
2909
|
+
}
|
|
2910
|
+
}));
|
|
2911
|
+
}, rewriteVendorDirectories = async (vendorDirs, vendorPaths) => {
|
|
2912
|
+
if (Object.keys(vendorPaths).length === 0)
|
|
2913
|
+
return;
|
|
2914
|
+
const allFiles = [];
|
|
2915
|
+
for (const dir of vendorDirs) {
|
|
2916
|
+
try {
|
|
2917
|
+
const entries = await readdir2(dir);
|
|
2918
|
+
for (const entry of entries) {
|
|
2919
|
+
if (entry.endsWith(".js"))
|
|
2920
|
+
allFiles.push(join5(dir, entry));
|
|
2921
|
+
}
|
|
2922
|
+
} catch {}
|
|
2923
|
+
}
|
|
2924
|
+
await Promise.all(allFiles.map(async (filePath) => {
|
|
2925
|
+
let original;
|
|
2926
|
+
try {
|
|
2927
|
+
original = await Bun.file(filePath).text();
|
|
2928
|
+
} catch (err) {
|
|
2929
|
+
const code = err.code;
|
|
2930
|
+
if (code === "ENOENT")
|
|
2931
|
+
return;
|
|
2932
|
+
throw err;
|
|
2933
|
+
}
|
|
2934
|
+
let next = rewriteImportsInContent(original, vendorPaths);
|
|
2935
|
+
next = fixMissingReExportNamespacesInContent(next);
|
|
2936
|
+
if (next === original)
|
|
2937
|
+
return;
|
|
2938
|
+
try {
|
|
2939
|
+
await Bun.write(filePath, next);
|
|
2940
|
+
} catch (err) {
|
|
2941
|
+
const code = err.code;
|
|
2942
|
+
if (code === "ENOENT")
|
|
2943
|
+
return;
|
|
2944
|
+
throw err;
|
|
2945
|
+
}
|
|
2946
|
+
}));
|
|
2947
|
+
}, buildWithImportRewrite = async (pendingBuild, vendorPaths) => {
|
|
2948
|
+
const result = await pendingBuild;
|
|
2949
|
+
if (result.outputs.length > 0) {
|
|
2950
|
+
await rewriteBuildOutputs(result.outputs, vendorPaths);
|
|
2951
|
+
}
|
|
2952
|
+
return result;
|
|
2953
|
+
};
|
|
2954
|
+
var init_rewriteImportsPlugin = __esm(() => {
|
|
2955
|
+
init_nativeRewrite();
|
|
2956
|
+
});
|
|
2957
|
+
|
|
2958
|
+
// src/core/angularServerModule.ts
|
|
2959
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
2960
|
+
import { dirname as dirname3, join as join6, relative as relative3 } from "path";
|
|
2961
|
+
var serverCacheRoot2, compiledModuleCache2, ANGULAR_SPECIFIER_RE, getCachedModulePath2 = (sourcePath) => {
|
|
2962
|
+
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2963
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2964
|
+
return join6(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
2965
|
+
}, collectVendorPaths = (code) => {
|
|
2966
|
+
const vendorPaths = {};
|
|
2967
|
+
if (!isProductionRuntime()) {
|
|
2968
|
+
return vendorPaths;
|
|
2969
|
+
}
|
|
2970
|
+
const specifiers = new Set([...code.matchAll(ANGULAR_SPECIFIER_RE)].map((match) => match[1]));
|
|
2971
|
+
specifiers.forEach((specifier) => {
|
|
2972
|
+
if (!specifier)
|
|
2973
|
+
return;
|
|
2974
|
+
const resolved = resolveAngularRuntimePath(specifier);
|
|
2975
|
+
if (resolved === specifier)
|
|
2976
|
+
return;
|
|
2977
|
+
vendorPaths[specifier] = resolved;
|
|
2978
|
+
});
|
|
2979
|
+
return vendorPaths;
|
|
2980
|
+
}, buildAngularServerModule = async (sourcePath) => {
|
|
2981
|
+
const result = await Bun.build({
|
|
2982
|
+
entrypoints: [sourcePath],
|
|
2983
|
+
format: "esm",
|
|
2984
|
+
packages: "external",
|
|
2985
|
+
target: "bun",
|
|
2986
|
+
throw: false
|
|
2987
|
+
});
|
|
2988
|
+
const entry = result.outputs.find((output) => output.kind === "entry-point");
|
|
2989
|
+
if (!result.success || !entry) {
|
|
2990
|
+
const message = result.logs.map((log2) => String(log2)).join(`
|
|
2991
|
+
`);
|
|
2992
|
+
throw new Error(`Failed to compile Angular island server module for "${sourcePath}":
|
|
2993
|
+
${message}`);
|
|
2994
|
+
}
|
|
2995
|
+
const code = await entry.text();
|
|
2996
|
+
const rewritten = rewriteImportsInContent(code, collectVendorPaths(code));
|
|
2997
|
+
const modulePath = getCachedModulePath2(sourcePath);
|
|
2998
|
+
await mkdir2(dirname3(modulePath), { recursive: true });
|
|
2999
|
+
await Bun.write(modulePath, rewritten);
|
|
3000
|
+
return modulePath;
|
|
3001
|
+
}, compileAngularServerModule = (sourcePath) => {
|
|
3002
|
+
const cached = compiledModuleCache2.get(sourcePath);
|
|
3003
|
+
if (cached) {
|
|
3004
|
+
return cached;
|
|
3005
|
+
}
|
|
3006
|
+
const compiledModulePromise = buildAngularServerModule(sourcePath);
|
|
3007
|
+
compiledModuleCache2.set(sourcePath, compiledModulePromise);
|
|
3008
|
+
return compiledModulePromise;
|
|
3009
|
+
};
|
|
3010
|
+
var init_angularServerModule = __esm(() => {
|
|
3011
|
+
init_resolveAngularPackage();
|
|
3012
|
+
init_rewriteImportsPlugin();
|
|
3013
|
+
serverCacheRoot2 = join6(process.cwd(), ".absolutejs", "islands", "angular");
|
|
3014
|
+
compiledModuleCache2 = new Map;
|
|
3015
|
+
ANGULAR_SPECIFIER_RE = /["'](@angular\/[^"']+)["']/g;
|
|
2705
3016
|
});
|
|
2706
3017
|
|
|
2707
3018
|
// src/core/vueServerModule.ts
|
|
2708
3019
|
import { existsSync as existsSync4, readFileSync as readFileSync4, realpathSync } from "fs";
|
|
2709
|
-
import { mkdir as
|
|
2710
|
-
import { dirname as
|
|
3020
|
+
import { mkdir as mkdir3 } from "fs/promises";
|
|
3021
|
+
import { dirname as dirname4, join as join7, relative as relative4, resolve as resolve6 } from "path";
|
|
2711
3022
|
var {Transpiler } = globalThis.Bun;
|
|
2712
|
-
var ISLAND_COMPONENT_ID_LENGTH = 8,
|
|
2713
|
-
const importPath =
|
|
3023
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
3024
|
+
const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
|
|
2714
3025
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2715
|
-
},
|
|
2716
|
-
const relativeSourcePath =
|
|
3026
|
+
}, getCachedModulePath3 = (sourcePath) => {
|
|
3027
|
+
const relativeSourcePath = relative4(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2717
3028
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2718
|
-
return
|
|
3029
|
+
return join7(serverCacheRoot3, `${normalizedSourcePath}.server.js`);
|
|
2719
3030
|
}, writeIfChanged2 = async (path, content) => {
|
|
2720
3031
|
const targetFile = Bun.file(path);
|
|
2721
3032
|
if (await targetFile.exists()) {
|
|
@@ -2742,7 +3053,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
2742
3053
|
`) : nonVueLines.join(`
|
|
2743
3054
|
`);
|
|
2744
3055
|
}, 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) => {
|
|
2745
|
-
const cachedModulePath =
|
|
3056
|
+
const cachedModulePath = compiledModuleCache3.get(sourcePath);
|
|
2746
3057
|
if (cachedModulePath)
|
|
2747
3058
|
return cachedModulePath;
|
|
2748
3059
|
const compiler = await import("@vue/compiler-sfc");
|
|
@@ -2775,7 +3086,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
2775
3086
|
}).code : "const ssrRender = () => {};";
|
|
2776
3087
|
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
2777
3088
|
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
2778
|
-
compiledPath: await compileVueServerModule(
|
|
3089
|
+
compiledPath: await compileVueServerModule(resolve6(dirname4(sourcePath), relativeImport)),
|
|
2779
3090
|
spec: relativeImport
|
|
2780
3091
|
})));
|
|
2781
3092
|
const strippedScript = stripExports(compiledScript.content);
|
|
@@ -2787,20 +3098,20 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, tran
|
|
|
2787
3098
|
"export default script;"
|
|
2788
3099
|
].join(`
|
|
2789
3100
|
`));
|
|
2790
|
-
const compiledModulePath =
|
|
3101
|
+
const compiledModulePath = getCachedModulePath3(sourcePath);
|
|
2791
3102
|
let rewritten = assembled;
|
|
2792
3103
|
for (const child of compiledChildren) {
|
|
2793
3104
|
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
2794
3105
|
}
|
|
2795
|
-
await
|
|
3106
|
+
await mkdir3(dirname4(compiledModulePath), { recursive: true });
|
|
2796
3107
|
await writeIfChanged2(compiledModulePath, rewritten);
|
|
2797
|
-
|
|
3108
|
+
compiledModuleCache3.set(sourcePath, compiledModulePath);
|
|
2798
3109
|
return compiledModulePath;
|
|
2799
3110
|
};
|
|
2800
3111
|
var init_vueServerModule = __esm(() => {
|
|
2801
3112
|
init_constants();
|
|
2802
|
-
|
|
2803
|
-
|
|
3113
|
+
serverCacheRoot3 = join7(process.cwd(), ".absolutejs", "islands", "vue");
|
|
3114
|
+
compiledModuleCache3 = new Map;
|
|
2804
3115
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
2805
3116
|
});
|
|
2806
3117
|
|
|
@@ -2946,8 +3257,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2946
3257
|
throw new Error("Resolved Vue island is not a valid Vue component.");
|
|
2947
3258
|
}
|
|
2948
3259
|
return resolvedComponent;
|
|
3260
|
+
}, loadAngularServerBuildComponent = async (buildReferencePath, exportName) => {
|
|
3261
|
+
const serverModulePath = await compileAngularServerModule(buildReferencePath);
|
|
3262
|
+
const loadedModule = await import(serverModulePath);
|
|
3263
|
+
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
3264
|
+
return loadedModule[exportName];
|
|
3265
|
+
}
|
|
3266
|
+
return "default" in loadedModule ? loadedModule.default : loadedModule;
|
|
2949
3267
|
}, resolveAngularServerIslandComponent = async (component) => {
|
|
2950
|
-
const
|
|
3268
|
+
const buildReference = getIslandBuildReference(component);
|
|
3269
|
+
const buildReferencePath = buildReference?.source ? resolveBuildReferencePath(buildReference.source, import.meta.url) : null;
|
|
3270
|
+
const resolvedComponent = buildReferencePath ? await loadAngularServerBuildComponent(buildReferencePath, buildReference?.export) : await resolveServerIslandComponent(component);
|
|
2951
3271
|
if (!isAngularServerIslandComponent(resolvedComponent)) {
|
|
2952
3272
|
throw new Error("Resolved Angular island is not a valid Angular component.");
|
|
2953
3273
|
}
|
|
@@ -3003,6 +3323,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
3003
3323
|
};
|
|
3004
3324
|
var init_renderIslandMarkup = __esm(() => {
|
|
3005
3325
|
init_islandSsr();
|
|
3326
|
+
init_angularServerModule();
|
|
3006
3327
|
init_svelteServerModule();
|
|
3007
3328
|
init_vueServerModule();
|
|
3008
3329
|
init_islandMarkupAttributes();
|
|
@@ -3134,7 +3455,6 @@ var runWithStreamingSlotRegistry = async (task) => {
|
|
|
3134
3455
|
init_svelteServerModule();
|
|
3135
3456
|
|
|
3136
3457
|
// src/core/islandPageContext.ts
|
|
3137
|
-
init_constants();
|
|
3138
3458
|
var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient";
|
|
3139
3459
|
var ISLAND_MARKER = 'data-island="true"';
|
|
3140
3460
|
var MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__";
|
|
@@ -3255,61 +3575,69 @@ var pipeStreamWithHeadInjection = (stream, markup) => {
|
|
|
3255
3575
|
var pipeStreamWithIslandMarkerDetection = (stream, markup) => {
|
|
3256
3576
|
const encoder = new TextEncoder;
|
|
3257
3577
|
const decoder = new TextDecoder;
|
|
3258
|
-
const
|
|
3259
|
-
const
|
|
3260
|
-
if (
|
|
3261
|
-
controller.enqueue(encoder.encode(
|
|
3262
|
-
return { injected, pending: "" };
|
|
3578
|
+
const headLookbehind = CLOSING_HEAD_TAG.length - 1;
|
|
3579
|
+
const enqueue = (controller, text) => {
|
|
3580
|
+
if (text.length > 0) {
|
|
3581
|
+
controller.enqueue(encoder.encode(text));
|
|
3263
3582
|
}
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
const next = `${pending.slice(0, injectAt)}${markup}${pending.slice(injectAt)}`;
|
|
3269
|
-
controller.enqueue(encoder.encode(next));
|
|
3270
|
-
return { injected: true, pending: "" };
|
|
3583
|
+
};
|
|
3584
|
+
const processHolding = (controller, held) => {
|
|
3585
|
+
if (!held.includes(ISLAND_MARKER)) {
|
|
3586
|
+
return { held, injected: false, pending: "", sawHead: true };
|
|
3271
3587
|
}
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
pending: flushSafePendingText(controller, encoder, pending, lookbehind)
|
|
3275
|
-
};
|
|
3588
|
+
enqueue(controller, `${markup}${held}`);
|
|
3589
|
+
return { held: "", injected: true, pending: "", sawHead: true };
|
|
3276
3590
|
};
|
|
3277
|
-
const
|
|
3278
|
-
const
|
|
3279
|
-
if (
|
|
3280
|
-
|
|
3591
|
+
const processHead = (controller, pending) => {
|
|
3592
|
+
const headIndex = pending.indexOf(CLOSING_HEAD_TAG);
|
|
3593
|
+
if (headIndex < 0) {
|
|
3594
|
+
return {
|
|
3595
|
+
held: "",
|
|
3596
|
+
injected: false,
|
|
3597
|
+
pending: flushSafePendingText(controller, encoder, pending, headLookbehind),
|
|
3598
|
+
sawHead: false
|
|
3599
|
+
};
|
|
3281
3600
|
}
|
|
3282
|
-
controller.
|
|
3601
|
+
enqueue(controller, pending.slice(0, headIndex));
|
|
3602
|
+
return processHolding(controller, pending.slice(headIndex));
|
|
3283
3603
|
};
|
|
3284
|
-
const
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
return
|
|
3604
|
+
const processChunk = (controller, state, chunk) => {
|
|
3605
|
+
if (state.injected) {
|
|
3606
|
+
enqueue(controller, chunk);
|
|
3607
|
+
return state;
|
|
3288
3608
|
}
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
pending: processed.pending
|
|
3294
|
-
};
|
|
3609
|
+
if (!state.sawHead) {
|
|
3610
|
+
return processHead(controller, state.pending + chunk);
|
|
3611
|
+
}
|
|
3612
|
+
return processHolding(controller, state.held + chunk);
|
|
3295
3613
|
};
|
|
3296
|
-
const
|
|
3297
|
-
const
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3614
|
+
const finishMarkerStream = (controller, state) => {
|
|
3615
|
+
const tail = decoder.decode();
|
|
3616
|
+
const remainder = state.injected ? tail : (state.sawHead ? state.held : state.pending) + tail;
|
|
3617
|
+
enqueue(controller, remainder);
|
|
3618
|
+
controller.close();
|
|
3619
|
+
};
|
|
3620
|
+
const runMarkerLoop = (controller, reader) => {
|
|
3621
|
+
const consumeNext = async (state) => {
|
|
3622
|
+
const { done, value } = await readStreamChunk(reader);
|
|
3623
|
+
if (done || !value) {
|
|
3624
|
+
return state;
|
|
3302
3625
|
}
|
|
3303
|
-
return
|
|
3626
|
+
return consumeNext(processChunk(controller, state, streamChunkToString(value, decoder)));
|
|
3304
3627
|
};
|
|
3305
|
-
return
|
|
3628
|
+
return consumeNext({
|
|
3629
|
+
held: "",
|
|
3630
|
+
injected: false,
|
|
3631
|
+
pending: "",
|
|
3632
|
+
sawHead: false
|
|
3633
|
+
});
|
|
3306
3634
|
};
|
|
3307
3635
|
return new ReadableStream({
|
|
3308
3636
|
async start(controller) {
|
|
3309
3637
|
const reader = stream.getReader();
|
|
3310
3638
|
try {
|
|
3311
|
-
const
|
|
3312
|
-
|
|
3639
|
+
const finalState = await runMarkerLoop(controller, reader);
|
|
3640
|
+
finishMarkerStream(controller, finalState);
|
|
3313
3641
|
} catch (error) {
|
|
3314
3642
|
controller.error(error);
|
|
3315
3643
|
}
|
|
@@ -4032,5 +4360,5 @@ export {
|
|
|
4032
4360
|
createTypedIsland
|
|
4033
4361
|
};
|
|
4034
4362
|
|
|
4035
|
-
//# debugId=
|
|
4363
|
+
//# debugId=D41079B38272CB2A64756E2164756E21
|
|
4036
4364
|
//# sourceMappingURL=index.js.map
|