@absolutejs/absolute 0.19.0-beta.927 → 0.19.0-beta.929
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/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +221 -118
- package/dist/angular/index.js.map +5 -4
- package/dist/angular/server.js +203 -100
- package/dist/angular/server.js.map +5 -4
- package/dist/build.js +687 -565
- package/dist/build.js.map +9 -8
- package/dist/index.js +738 -616
- package/dist/index.js.map +9 -8
- package/dist/islands/index.js +105 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +105 -2
- package/dist/react/index.js.map +5 -4
- package/dist/src/core/normalizeIslandProps.d.ts +15 -0
- package/dist/src/core/vueServerModule.d.ts +1 -0
- package/dist/src/vue/Island.browser.d.ts +36 -12
- package/dist/src/vue/Island.d.ts +35 -11
- package/dist/src/vue/pageHandler.d.ts +8 -0
- package/dist/svelte/index.js +105 -2
- package/dist/svelte/index.js.map +5 -4
- package/dist/vue/browser.js +57 -4
- package/dist/vue/browser.js.map +5 -4
- package/dist/vue/index.js +172 -8
- package/dist/vue/index.js.map +8 -6
- package/dist/vue/server.js +11 -4
- package/dist/vue/server.js.map +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IslandFramework, IslandHydrate } from '../../types/island';
|
|
2
|
+
type RawIslandProps = {
|
|
3
|
+
component: string;
|
|
4
|
+
framework: string;
|
|
5
|
+
hydrate?: string | undefined;
|
|
6
|
+
props: unknown;
|
|
7
|
+
};
|
|
8
|
+
export declare const normalizeRuntimeIslandRenderProps: (raw: RawIslandProps) => {
|
|
9
|
+
component: string;
|
|
10
|
+
framework: IslandFramework;
|
|
11
|
+
hydrate: IslandHydrate | undefined;
|
|
12
|
+
props: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
export declare const normalizeIslandProps: (value: unknown) => Record<string, unknown>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const compileVueServerModule: (sourcePath: string) => Promise<string>;
|
|
@@ -1,13 +1,37 @@
|
|
|
1
|
-
export declare const Island: import("vue").DefineComponent<{
|
|
2
|
-
component:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export declare const Island: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
component: {
|
|
3
|
+
required: true;
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
};
|
|
6
|
+
framework: {
|
|
7
|
+
required: true;
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
};
|
|
10
|
+
hydrate: {
|
|
11
|
+
required: false;
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
};
|
|
14
|
+
props: {
|
|
15
|
+
required: false;
|
|
16
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
17
|
+
};
|
|
18
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
7
19
|
[key: string]: any;
|
|
8
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
9
|
-
component:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
component: {
|
|
22
|
+
required: true;
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
};
|
|
25
|
+
framework: {
|
|
26
|
+
required: true;
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
};
|
|
29
|
+
hydrate: {
|
|
30
|
+
required: false;
|
|
31
|
+
type: StringConstructor;
|
|
32
|
+
};
|
|
33
|
+
props: {
|
|
34
|
+
required: false;
|
|
35
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
36
|
+
};
|
|
37
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/src/vue/Island.d.ts
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
import { h } from 'vue';
|
|
2
|
-
export declare const Island: import("vue").DefineComponent<{
|
|
3
|
-
component:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
export declare const Island: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
component: {
|
|
4
|
+
required: true;
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
};
|
|
7
|
+
framework: {
|
|
8
|
+
required: true;
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
};
|
|
11
|
+
hydrate: {
|
|
12
|
+
required: false;
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
};
|
|
15
|
+
props: {
|
|
16
|
+
required: false;
|
|
17
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
18
|
+
};
|
|
19
|
+
}>, () => ReturnType<typeof h>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
component: {
|
|
21
|
+
required: true;
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
};
|
|
24
|
+
framework: {
|
|
25
|
+
required: true;
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
};
|
|
28
|
+
hydrate: {
|
|
29
|
+
required: false;
|
|
30
|
+
type: StringConstructor;
|
|
31
|
+
};
|
|
32
|
+
props: {
|
|
33
|
+
required: false;
|
|
34
|
+
type: (ObjectConstructor | StringConstructor)[];
|
|
35
|
+
};
|
|
36
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -5,6 +5,14 @@ type VuePageRenderOptions = StreamingSlotEnhancerOptions & {
|
|
|
5
5
|
collectStreamingSlots?: boolean;
|
|
6
6
|
};
|
|
7
7
|
export type VuePageRequestInput<Component extends VueComponent> = VuePageRenderOptions & {
|
|
8
|
+
/** Hydration mode for the page bundle.
|
|
9
|
+
* - `'auto'` (default): emit `<script>window.__INITIAL_PROPS__=…</script>`
|
|
10
|
+
* plus the page's `<script type="module">` index, mounting Vue on the
|
|
11
|
+
* client.
|
|
12
|
+
* - `'none'`: SSR-only. Skip both scripts entirely so the page ships
|
|
13
|
+
* pure HTML — useful for marketing / docs pages that use Vue
|
|
14
|
+
* templating + Tailwind without paying the runtime cost. */
|
|
15
|
+
client?: 'auto' | 'none';
|
|
8
16
|
headTag?: `<head>${string}</head>`;
|
|
9
17
|
indexPath: string;
|
|
10
18
|
pagePath: string;
|
package/dist/svelte/index.js
CHANGED
|
@@ -2679,6 +2679,100 @@ var init_islandSsr = __esm(() => {
|
|
|
2679
2679
|
renderAngularIslandToHtml2 = renderAngularIslandToHtmlInternal;
|
|
2680
2680
|
});
|
|
2681
2681
|
|
|
2682
|
+
// src/core/vueServerModule.ts
|
|
2683
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
2684
|
+
import { dirname as dirname3, join as join5, relative as relative3, resolve as resolve5 } from "path";
|
|
2685
|
+
var {Transpiler } = globalThis.Bun;
|
|
2686
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
2687
|
+
const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
|
|
2688
|
+
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2689
|
+
}, getCachedModulePath2 = (sourcePath) => {
|
|
2690
|
+
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2691
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2692
|
+
return join5(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
2693
|
+
}, writeIfChanged2 = async (path, content) => {
|
|
2694
|
+
const targetFile = Bun.file(path);
|
|
2695
|
+
if (await targetFile.exists()) {
|
|
2696
|
+
const currentContent = await targetFile.text();
|
|
2697
|
+
if (currentContent === content)
|
|
2698
|
+
return;
|
|
2699
|
+
}
|
|
2700
|
+
await Bun.write(path, content);
|
|
2701
|
+
}, stripExports = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports = (code) => {
|
|
2702
|
+
const lines = code.split(`
|
|
2703
|
+
`);
|
|
2704
|
+
const specifierSet = new Set;
|
|
2705
|
+
const vueImportRegex = /^import\s+{([^}]+)}\s+from\s+['"]vue['"];?$/;
|
|
2706
|
+
lines.forEach((line) => {
|
|
2707
|
+
const match = line.match(vueImportRegex);
|
|
2708
|
+
if (match?.[1])
|
|
2709
|
+
match[1].split(",").forEach((importSpecifier) => specifierSet.add(importSpecifier.trim()));
|
|
2710
|
+
});
|
|
2711
|
+
const nonVueLines = lines.filter((line) => !vueImportRegex.test(line));
|
|
2712
|
+
return specifierSet.size ? [
|
|
2713
|
+
`import { ${[...specifierSet].join(", ")} } from "vue";`,
|
|
2714
|
+
...nonVueLines
|
|
2715
|
+
].join(`
|
|
2716
|
+
`) : nonVueLines.join(`
|
|
2717
|
+
`);
|
|
2718
|
+
}, 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) => {
|
|
2719
|
+
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
2720
|
+
if (cachedModulePath)
|
|
2721
|
+
return cachedModulePath;
|
|
2722
|
+
const compiler = await import("@vue/compiler-sfc");
|
|
2723
|
+
const source = await Bun.file(sourcePath).text();
|
|
2724
|
+
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
2725
|
+
const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
|
|
2726
|
+
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
2727
|
+
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
2728
|
+
id: componentId,
|
|
2729
|
+
inlineTemplate: false
|
|
2730
|
+
}) : { bindings: {}, content: "export default {};" };
|
|
2731
|
+
const renderCode = descriptor.template ? compiler.compileTemplate({
|
|
2732
|
+
compilerOptions: {
|
|
2733
|
+
bindingMetadata: compiledScript.bindings,
|
|
2734
|
+
expressionPlugins: ["typescript"],
|
|
2735
|
+
prefixIdentifiers: true,
|
|
2736
|
+
isCustomElement: (tag) => tag === "absolute-island"
|
|
2737
|
+
},
|
|
2738
|
+
filename: sourcePath,
|
|
2739
|
+
id: componentId,
|
|
2740
|
+
scoped: descriptor.styles.some((styleBlock) => styleBlock.scoped),
|
|
2741
|
+
source: descriptor.template.content,
|
|
2742
|
+
ssr: true,
|
|
2743
|
+
ssrCssVars: descriptor.cssVars
|
|
2744
|
+
}).code : "const ssrRender = () => {};";
|
|
2745
|
+
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
2746
|
+
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
2747
|
+
compiledPath: await compileVueServerModule(resolve5(dirname3(sourcePath), relativeImport)),
|
|
2748
|
+
spec: relativeImport
|
|
2749
|
+
})));
|
|
2750
|
+
const strippedScript = stripExports(compiledScript.content);
|
|
2751
|
+
const transpiledScript = transpiler2.transformSync(strippedScript);
|
|
2752
|
+
const assembled = mergeVueImports([
|
|
2753
|
+
transpiledScript,
|
|
2754
|
+
renderCode,
|
|
2755
|
+
"script.ssrRender = ssrRender;",
|
|
2756
|
+
"export default script;"
|
|
2757
|
+
].join(`
|
|
2758
|
+
`));
|
|
2759
|
+
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
2760
|
+
let rewritten = assembled;
|
|
2761
|
+
for (const child of compiledChildren) {
|
|
2762
|
+
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
2763
|
+
}
|
|
2764
|
+
await mkdir2(dirname3(compiledModulePath), { recursive: true });
|
|
2765
|
+
await writeIfChanged2(compiledModulePath, rewritten);
|
|
2766
|
+
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
2767
|
+
return compiledModulePath;
|
|
2768
|
+
};
|
|
2769
|
+
var init_vueServerModule = __esm(() => {
|
|
2770
|
+
init_constants();
|
|
2771
|
+
serverCacheRoot2 = join5(process.cwd(), ".absolutejs", "islands", "vue");
|
|
2772
|
+
compiledModuleCache2 = new Map;
|
|
2773
|
+
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
2774
|
+
});
|
|
2775
|
+
|
|
2682
2776
|
// src/core/islandManifest.ts
|
|
2683
2777
|
var toIslandFrameworkSegment = (framework) => framework[0]?.toUpperCase() + framework.slice(1), collectFrameworkIslands = (manifest, prefix) => {
|
|
2684
2778
|
const entries = {};
|
|
@@ -2765,9 +2859,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2765
2859
|
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
2766
2860
|
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
2767
2861
|
return loadPromise;
|
|
2862
|
+
}, resolveRuntimeImportTarget = async (resolvedModulePath) => {
|
|
2863
|
+
if (resolvedModulePath.endsWith(".svelte")) {
|
|
2864
|
+
return compileSvelteServerModule(resolvedModulePath);
|
|
2865
|
+
}
|
|
2866
|
+
if (resolvedModulePath.endsWith(".vue")) {
|
|
2867
|
+
return compileVueServerModule(resolvedModulePath);
|
|
2868
|
+
}
|
|
2869
|
+
return resolvedModulePath;
|
|
2768
2870
|
}, loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
2769
2871
|
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
2770
|
-
const importTarget =
|
|
2872
|
+
const importTarget = await resolveRuntimeImportTarget(resolvedModulePath);
|
|
2771
2873
|
const loadedModule = await import(importTarget);
|
|
2772
2874
|
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
2773
2875
|
return loadedModule[exportName];
|
|
@@ -2871,6 +2973,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2871
2973
|
var init_renderIslandMarkup = __esm(() => {
|
|
2872
2974
|
init_islandSsr();
|
|
2873
2975
|
init_svelteServerModule();
|
|
2976
|
+
init_vueServerModule();
|
|
2874
2977
|
init_islandMarkupAttributes();
|
|
2875
2978
|
init_islands2();
|
|
2876
2979
|
resolvedServerComponentCache = new Map;
|
|
@@ -3836,5 +3939,5 @@ export {
|
|
|
3836
3939
|
createTypedIsland
|
|
3837
3940
|
};
|
|
3838
3941
|
|
|
3839
|
-
//# debugId=
|
|
3942
|
+
//# debugId=76F703206AC2F94E64756E2164756E21
|
|
3840
3943
|
//# sourceMappingURL=index.js.map
|