@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
package/dist/react/index.js
CHANGED
|
@@ -2698,6 +2698,100 @@ var init_svelteServerModule = __esm(() => {
|
|
|
2698
2698
|
});
|
|
2699
2699
|
});
|
|
2700
2700
|
|
|
2701
|
+
// src/core/vueServerModule.ts
|
|
2702
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
2703
|
+
import { dirname as dirname3, join as join5, relative as relative3, resolve as resolve5 } from "path";
|
|
2704
|
+
var {Transpiler } = globalThis.Bun;
|
|
2705
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
2706
|
+
const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
|
|
2707
|
+
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
2708
|
+
}, getCachedModulePath2 = (sourcePath) => {
|
|
2709
|
+
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
2710
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
2711
|
+
return join5(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
2712
|
+
}, writeIfChanged2 = async (path, content) => {
|
|
2713
|
+
const targetFile = Bun.file(path);
|
|
2714
|
+
if (await targetFile.exists()) {
|
|
2715
|
+
const currentContent = await targetFile.text();
|
|
2716
|
+
if (currentContent === content)
|
|
2717
|
+
return;
|
|
2718
|
+
}
|
|
2719
|
+
await Bun.write(path, content);
|
|
2720
|
+
}, stripExports = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports = (code) => {
|
|
2721
|
+
const lines = code.split(`
|
|
2722
|
+
`);
|
|
2723
|
+
const specifierSet = new Set;
|
|
2724
|
+
const vueImportRegex = /^import\s+{([^}]+)}\s+from\s+['"]vue['"];?$/;
|
|
2725
|
+
lines.forEach((line) => {
|
|
2726
|
+
const match = line.match(vueImportRegex);
|
|
2727
|
+
if (match?.[1])
|
|
2728
|
+
match[1].split(",").forEach((importSpecifier) => specifierSet.add(importSpecifier.trim()));
|
|
2729
|
+
});
|
|
2730
|
+
const nonVueLines = lines.filter((line) => !vueImportRegex.test(line));
|
|
2731
|
+
return specifierSet.size ? [
|
|
2732
|
+
`import { ${[...specifierSet].join(", ")} } from "vue";`,
|
|
2733
|
+
...nonVueLines
|
|
2734
|
+
].join(`
|
|
2735
|
+
`) : nonVueLines.join(`
|
|
2736
|
+
`);
|
|
2737
|
+
}, 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) => {
|
|
2738
|
+
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
2739
|
+
if (cachedModulePath)
|
|
2740
|
+
return cachedModulePath;
|
|
2741
|
+
const compiler = await import("@vue/compiler-sfc");
|
|
2742
|
+
const source = await Bun.file(sourcePath).text();
|
|
2743
|
+
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
2744
|
+
const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
|
|
2745
|
+
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
2746
|
+
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
2747
|
+
id: componentId,
|
|
2748
|
+
inlineTemplate: false
|
|
2749
|
+
}) : { bindings: {}, content: "export default {};" };
|
|
2750
|
+
const renderCode = descriptor.template ? compiler.compileTemplate({
|
|
2751
|
+
compilerOptions: {
|
|
2752
|
+
bindingMetadata: compiledScript.bindings,
|
|
2753
|
+
expressionPlugins: ["typescript"],
|
|
2754
|
+
prefixIdentifiers: true,
|
|
2755
|
+
isCustomElement: (tag) => tag === "absolute-island"
|
|
2756
|
+
},
|
|
2757
|
+
filename: sourcePath,
|
|
2758
|
+
id: componentId,
|
|
2759
|
+
scoped: descriptor.styles.some((styleBlock) => styleBlock.scoped),
|
|
2760
|
+
source: descriptor.template.content,
|
|
2761
|
+
ssr: true,
|
|
2762
|
+
ssrCssVars: descriptor.cssVars
|
|
2763
|
+
}).code : "const ssrRender = () => {};";
|
|
2764
|
+
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
2765
|
+
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
2766
|
+
compiledPath: await compileVueServerModule(resolve5(dirname3(sourcePath), relativeImport)),
|
|
2767
|
+
spec: relativeImport
|
|
2768
|
+
})));
|
|
2769
|
+
const strippedScript = stripExports(compiledScript.content);
|
|
2770
|
+
const transpiledScript = transpiler2.transformSync(strippedScript);
|
|
2771
|
+
const assembled = mergeVueImports([
|
|
2772
|
+
transpiledScript,
|
|
2773
|
+
renderCode,
|
|
2774
|
+
"script.ssrRender = ssrRender;",
|
|
2775
|
+
"export default script;"
|
|
2776
|
+
].join(`
|
|
2777
|
+
`));
|
|
2778
|
+
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
2779
|
+
let rewritten = assembled;
|
|
2780
|
+
for (const child of compiledChildren) {
|
|
2781
|
+
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
2782
|
+
}
|
|
2783
|
+
await mkdir2(dirname3(compiledModulePath), { recursive: true });
|
|
2784
|
+
await writeIfChanged2(compiledModulePath, rewritten);
|
|
2785
|
+
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
2786
|
+
return compiledModulePath;
|
|
2787
|
+
};
|
|
2788
|
+
var init_vueServerModule = __esm(() => {
|
|
2789
|
+
init_constants();
|
|
2790
|
+
serverCacheRoot2 = join5(process.cwd(), ".absolutejs", "islands", "vue");
|
|
2791
|
+
compiledModuleCache2 = new Map;
|
|
2792
|
+
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
2793
|
+
});
|
|
2794
|
+
|
|
2701
2795
|
// src/core/renderIslandMarkup.ts
|
|
2702
2796
|
var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
|
|
2703
2797
|
islandSequence += 1;
|
|
@@ -2720,9 +2814,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2720
2814
|
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
2721
2815
|
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
2722
2816
|
return loadPromise;
|
|
2817
|
+
}, resolveRuntimeImportTarget = async (resolvedModulePath) => {
|
|
2818
|
+
if (resolvedModulePath.endsWith(".svelte")) {
|
|
2819
|
+
return compileSvelteServerModule(resolvedModulePath);
|
|
2820
|
+
}
|
|
2821
|
+
if (resolvedModulePath.endsWith(".vue")) {
|
|
2822
|
+
return compileVueServerModule(resolvedModulePath);
|
|
2823
|
+
}
|
|
2824
|
+
return resolvedModulePath;
|
|
2723
2825
|
}, loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
2724
2826
|
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
2725
|
-
const importTarget =
|
|
2827
|
+
const importTarget = await resolveRuntimeImportTarget(resolvedModulePath);
|
|
2726
2828
|
const loadedModule = await import(importTarget);
|
|
2727
2829
|
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
2728
2830
|
return loadedModule[exportName];
|
|
@@ -2826,6 +2928,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
2826
2928
|
var init_renderIslandMarkup = __esm(() => {
|
|
2827
2929
|
init_islandSsr();
|
|
2828
2930
|
init_svelteServerModule();
|
|
2931
|
+
init_vueServerModule();
|
|
2829
2932
|
init_islandMarkupAttributes();
|
|
2830
2933
|
init_islands();
|
|
2831
2934
|
resolvedServerComponentCache = new Map;
|
|
@@ -3783,5 +3886,5 @@ export {
|
|
|
3783
3886
|
Island
|
|
3784
3887
|
};
|
|
3785
3888
|
|
|
3786
|
-
//# debugId=
|
|
3889
|
+
//# debugId=FFD15DAC4462A68964756E2164756E21
|
|
3787
3890
|
//# sourceMappingURL=index.js.map
|