@absolutejs/absolute 0.19.0-beta.931 → 0.19.0-beta.933
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 +285 -136
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +267 -118
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +807 -584
- package/dist/build.js.map +17 -16
- package/dist/dev/client/handlers/angularHmrShim.ts +4 -1
- package/dist/dev/client/handlers/angularRemount.ts +2 -2
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -4
- package/dist/dev/client/vendor/lview/lViewOps.ts +8 -6
- package/dist/index.js +925 -651
- package/dist/index.js.map +21 -19
- package/dist/islands/index.js +105 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +167 -18
- package/dist/react/index.js.map +6 -5
- package/dist/react/server.js +63 -17
- package/dist/react/server.js.map +3 -3
- package/dist/src/core/normalizeIslandProps.d.ts +15 -0
- package/dist/src/core/vueServerModule.d.ts +1 -0
- package/dist/src/utils/defineConvention.d.ts +3 -0
- package/dist/src/utils/index.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 +167 -18
- package/dist/svelte/index.js.map +6 -5
- package/dist/svelte/server.js +63 -17
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/conventions.d.ts +5 -0
- package/dist/vue/browser.js +57 -4
- package/dist/vue/browser.js.map +5 -4
- package/dist/vue/index.js +234 -24
- package/dist/vue/index.js.map +9 -7
- package/dist/vue/server.js +73 -20
- package/dist/vue/server.js.map +4 -4
- package/package.json +1 -1
package/dist/islands/index.js
CHANGED
|
@@ -1713,6 +1713,100 @@ var init_svelteServerModule = __esm(() => {
|
|
|
1713
1713
|
});
|
|
1714
1714
|
});
|
|
1715
1715
|
|
|
1716
|
+
// src/core/vueServerModule.ts
|
|
1717
|
+
import { mkdir as mkdir2 } from "fs/promises";
|
|
1718
|
+
import { dirname as dirname3, join as join5, relative as relative3, resolve as resolve5 } from "path";
|
|
1719
|
+
var {Transpiler } = globalThis.Bun;
|
|
1720
|
+
var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot2, compiledModuleCache2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
1721
|
+
const importPath = relative3(dirname3(from), target).replace(/\\/g, "/");
|
|
1722
|
+
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
1723
|
+
}, getCachedModulePath2 = (sourcePath) => {
|
|
1724
|
+
const relativeSourcePath = relative3(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
1725
|
+
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
1726
|
+
return join5(serverCacheRoot2, `${normalizedSourcePath}.server.js`);
|
|
1727
|
+
}, writeIfChanged2 = async (path, content) => {
|
|
1728
|
+
const targetFile = Bun.file(path);
|
|
1729
|
+
if (await targetFile.exists()) {
|
|
1730
|
+
const currentContent = await targetFile.text();
|
|
1731
|
+
if (currentContent === content)
|
|
1732
|
+
return;
|
|
1733
|
+
}
|
|
1734
|
+
await Bun.write(path, content);
|
|
1735
|
+
}, stripExports = (code) => code.replace(/export\s+default/, "const script ="), mergeVueImports = (code) => {
|
|
1736
|
+
const lines = code.split(`
|
|
1737
|
+
`);
|
|
1738
|
+
const specifierSet = new Set;
|
|
1739
|
+
const vueImportRegex = /^import\s+{([^}]+)}\s+from\s+['"]vue['"];?$/;
|
|
1740
|
+
lines.forEach((line) => {
|
|
1741
|
+
const match = line.match(vueImportRegex);
|
|
1742
|
+
if (match?.[1])
|
|
1743
|
+
match[1].split(",").forEach((importSpecifier) => specifierSet.add(importSpecifier.trim()));
|
|
1744
|
+
});
|
|
1745
|
+
const nonVueLines = lines.filter((line) => !vueImportRegex.test(line));
|
|
1746
|
+
return specifierSet.size ? [
|
|
1747
|
+
`import { ${[...specifierSet].join(", ")} } from "vue";`,
|
|
1748
|
+
...nonVueLines
|
|
1749
|
+
].join(`
|
|
1750
|
+
`) : nonVueLines.join(`
|
|
1751
|
+
`);
|
|
1752
|
+
}, 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) => {
|
|
1753
|
+
const cachedModulePath = compiledModuleCache2.get(sourcePath);
|
|
1754
|
+
if (cachedModulePath)
|
|
1755
|
+
return cachedModulePath;
|
|
1756
|
+
const compiler = await import("@vue/compiler-sfc");
|
|
1757
|
+
const source = await Bun.file(sourcePath).text();
|
|
1758
|
+
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
1759
|
+
const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
|
|
1760
|
+
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
1761
|
+
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
1762
|
+
id: componentId,
|
|
1763
|
+
inlineTemplate: false
|
|
1764
|
+
}) : { bindings: {}, content: "export default {};" };
|
|
1765
|
+
const renderCode = descriptor.template ? compiler.compileTemplate({
|
|
1766
|
+
compilerOptions: {
|
|
1767
|
+
bindingMetadata: compiledScript.bindings,
|
|
1768
|
+
expressionPlugins: ["typescript"],
|
|
1769
|
+
prefixIdentifiers: true,
|
|
1770
|
+
isCustomElement: (tag) => tag === "absolute-island"
|
|
1771
|
+
},
|
|
1772
|
+
filename: sourcePath,
|
|
1773
|
+
id: componentId,
|
|
1774
|
+
scoped: descriptor.styles.some((styleBlock) => styleBlock.scoped),
|
|
1775
|
+
source: descriptor.template.content,
|
|
1776
|
+
ssr: true,
|
|
1777
|
+
ssrCssVars: descriptor.cssVars
|
|
1778
|
+
}).code : "const ssrRender = () => {};";
|
|
1779
|
+
const childImportPaths = extractRelativeVueImports(compiledScript.content);
|
|
1780
|
+
const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
|
|
1781
|
+
compiledPath: await compileVueServerModule(resolve5(dirname3(sourcePath), relativeImport)),
|
|
1782
|
+
spec: relativeImport
|
|
1783
|
+
})));
|
|
1784
|
+
const strippedScript = stripExports(compiledScript.content);
|
|
1785
|
+
const transpiledScript = transpiler2.transformSync(strippedScript);
|
|
1786
|
+
const assembled = mergeVueImports([
|
|
1787
|
+
transpiledScript,
|
|
1788
|
+
renderCode,
|
|
1789
|
+
"script.ssrRender = ssrRender;",
|
|
1790
|
+
"export default script;"
|
|
1791
|
+
].join(`
|
|
1792
|
+
`));
|
|
1793
|
+
const compiledModulePath = getCachedModulePath2(sourcePath);
|
|
1794
|
+
let rewritten = assembled;
|
|
1795
|
+
for (const child of compiledChildren) {
|
|
1796
|
+
rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
1797
|
+
}
|
|
1798
|
+
await mkdir2(dirname3(compiledModulePath), { recursive: true });
|
|
1799
|
+
await writeIfChanged2(compiledModulePath, rewritten);
|
|
1800
|
+
compiledModuleCache2.set(sourcePath, compiledModulePath);
|
|
1801
|
+
return compiledModulePath;
|
|
1802
|
+
};
|
|
1803
|
+
var init_vueServerModule = __esm(() => {
|
|
1804
|
+
init_constants();
|
|
1805
|
+
serverCacheRoot2 = join5(process.cwd(), ".absolutejs", "islands", "vue");
|
|
1806
|
+
compiledModuleCache2 = new Map;
|
|
1807
|
+
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
1808
|
+
});
|
|
1809
|
+
|
|
1716
1810
|
// src/core/islandMarkupAttributes.ts
|
|
1717
1811
|
var getIslandMarkerAttributes = (props, islandId) => ({
|
|
1718
1812
|
"data-component": props.component,
|
|
@@ -1748,9 +1842,17 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
1748
1842
|
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
1749
1843
|
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
1750
1844
|
return loadPromise;
|
|
1845
|
+
}, resolveRuntimeImportTarget = async (resolvedModulePath) => {
|
|
1846
|
+
if (resolvedModulePath.endsWith(".svelte")) {
|
|
1847
|
+
return compileSvelteServerModule(resolvedModulePath);
|
|
1848
|
+
}
|
|
1849
|
+
if (resolvedModulePath.endsWith(".vue")) {
|
|
1850
|
+
return compileVueServerModule(resolvedModulePath);
|
|
1851
|
+
}
|
|
1852
|
+
return resolvedModulePath;
|
|
1751
1853
|
}, loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
1752
1854
|
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
1753
|
-
const importTarget =
|
|
1855
|
+
const importTarget = await resolveRuntimeImportTarget(resolvedModulePath);
|
|
1754
1856
|
const loadedModule = await import(importTarget);
|
|
1755
1857
|
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
1756
1858
|
return loadedModule[exportName];
|
|
@@ -1854,6 +1956,7 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
|
|
|
1854
1956
|
var init_renderIslandMarkup = __esm(() => {
|
|
1855
1957
|
init_islandSsr();
|
|
1856
1958
|
init_svelteServerModule();
|
|
1959
|
+
init_vueServerModule();
|
|
1857
1960
|
init_islandMarkupAttributes();
|
|
1858
1961
|
init_islands();
|
|
1859
1962
|
resolvedServerComponentCache = new Map;
|
|
@@ -1982,5 +2085,5 @@ export {
|
|
|
1982
2085
|
createIslandStore
|
|
1983
2086
|
};
|
|
1984
2087
|
|
|
1985
|
-
//# debugId=
|
|
2088
|
+
//# debugId=50CD3E7F3547894F64756E2164756E21
|
|
1986
2089
|
//# sourceMappingURL=index.js.map
|