@vistagenic/vista 0.1.0-alpha.1
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/bin/vista.js +98 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.js +16 -0
- package/dist/bin/build-rsc.d.ts +17 -0
- package/dist/bin/build-rsc.js +320 -0
- package/dist/bin/build.d.ts +4 -0
- package/dist/bin/build.js +336 -0
- package/dist/bin/file-scanner.d.ts +66 -0
- package/dist/bin/file-scanner.js +399 -0
- package/dist/bin/server-component-plugin.d.ts +17 -0
- package/dist/bin/server-component-plugin.js +133 -0
- package/dist/bin/webpack.config.d.ts +6 -0
- package/dist/bin/webpack.config.js +138 -0
- package/dist/build/manifest.d.ts +95 -0
- package/dist/build/manifest.js +168 -0
- package/dist/build/rsc/client-manifest.d.ts +48 -0
- package/dist/build/rsc/client-manifest.js +191 -0
- package/dist/build/rsc/client-reference-plugin.d.ts +37 -0
- package/dist/build/rsc/client-reference-plugin.js +185 -0
- package/dist/build/rsc/compiler.d.ts +36 -0
- package/dist/build/rsc/compiler.js +311 -0
- package/dist/build/rsc/index.d.ts +16 -0
- package/dist/build/rsc/index.js +32 -0
- package/dist/build/rsc/native-scanner.d.ts +123 -0
- package/dist/build/rsc/native-scanner.js +165 -0
- package/dist/build/rsc/rsc-renderer.d.ts +99 -0
- package/dist/build/rsc/rsc-renderer.js +269 -0
- package/dist/build/rsc/server-component-loader.d.ts +19 -0
- package/dist/build/rsc/server-component-loader.js +147 -0
- package/dist/build/rsc/server-manifest.d.ts +63 -0
- package/dist/build/rsc/server-manifest.js +268 -0
- package/dist/build/webpack/loaders/vista-flight-loader.d.ts +17 -0
- package/dist/build/webpack/loaders/vista-flight-loader.js +93 -0
- package/dist/build/webpack/plugins/vista-flight-plugin.d.ts +36 -0
- package/dist/build/webpack/plugins/vista-flight-plugin.js +133 -0
- package/dist/client/dynamic.d.ts +25 -0
- package/dist/client/dynamic.js +68 -0
- package/dist/client/font.d.ts +98 -0
- package/dist/client/font.js +109 -0
- package/dist/client/head.d.ts +79 -0
- package/dist/client/head.js +261 -0
- package/dist/client/hydration.d.ts +45 -0
- package/dist/client/hydration.js +291 -0
- package/dist/client/link.d.ts +30 -0
- package/dist/client/link.js +188 -0
- package/dist/client/navigation.d.ts +28 -0
- package/dist/client/navigation.js +116 -0
- package/dist/client/router.d.ts +41 -0
- package/dist/client/router.js +190 -0
- package/dist/client/script.d.ts +51 -0
- package/dist/client/script.js +118 -0
- package/dist/components/client-island.d.ts +34 -0
- package/dist/components/client-island.js +75 -0
- package/dist/components/client.d.ts +29 -0
- package/dist/components/client.js +102 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +8 -0
- package/dist/components/link.d.ts +6 -0
- package/dist/components/link.js +13 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.js +31 -0
- package/dist/dev-error.d.ts +35 -0
- package/dist/dev-error.js +310 -0
- package/dist/image/get-img-props.d.ts +28 -0
- package/dist/image/get-img-props.js +49 -0
- package/dist/image/image-config.d.ts +20 -0
- package/dist/image/image-config.js +20 -0
- package/dist/image/image-loader.d.ts +7 -0
- package/dist/image/image-loader.js +14 -0
- package/dist/image/index.d.ts +6 -0
- package/dist/image/index.js +110 -0
- package/dist/image.d.ts +10 -0
- package/dist/image.js +7 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +53 -0
- package/dist/metadata/generate.d.ts +22 -0
- package/dist/metadata/generate.js +324 -0
- package/dist/metadata/index.d.ts +7 -0
- package/dist/metadata/index.js +26 -0
- package/dist/metadata/types.d.ts +325 -0
- package/dist/metadata/types.js +15 -0
- package/dist/router/context.d.ts +8 -0
- package/dist/router/context.js +13 -0
- package/dist/router/index.d.ts +2 -0
- package/dist/router/index.js +18 -0
- package/dist/router/provider.d.ts +5 -0
- package/dist/router/provider.js +31 -0
- package/dist/server/client-boundary.d.ts +48 -0
- package/dist/server/client-boundary.js +133 -0
- package/dist/server/engine.d.ts +4 -0
- package/dist/server/engine.js +651 -0
- package/dist/server/index.d.ts +95 -0
- package/dist/server/index.js +177 -0
- package/dist/server/rsc-engine.d.ts +20 -0
- package/dist/server/rsc-engine.js +588 -0
- package/dist/server/rsc-module-system.d.ts +33 -0
- package/dist/server/rsc-module-system.js +119 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +2 -0
- package/package.json +103 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vista Script Component
|
|
3
|
+
*
|
|
4
|
+
* Optimized script loading with different strategies.
|
|
5
|
+
* Similar to Next.js Script component.
|
|
6
|
+
*/
|
|
7
|
+
'client load';
|
|
8
|
+
"use strict";
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.default = Script;
|
|
44
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
45
|
+
const React = __importStar(require("react"));
|
|
46
|
+
// Track loaded scripts to prevent duplicates
|
|
47
|
+
const loadedScripts = new Set();
|
|
48
|
+
/**
|
|
49
|
+
* Script component for optimized script loading
|
|
50
|
+
*/
|
|
51
|
+
function Script({ src, dangerouslySetInnerHTML, strategy = 'afterInteractive', onLoad, onError, onReady, id, ...rest }) {
|
|
52
|
+
const scriptId = id || src;
|
|
53
|
+
React.useEffect(() => {
|
|
54
|
+
// Skip if already loaded
|
|
55
|
+
if (scriptId && loadedScripts.has(scriptId)) {
|
|
56
|
+
onLoad?.();
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const loadScript = () => {
|
|
60
|
+
const script = document.createElement('script');
|
|
61
|
+
if (src) {
|
|
62
|
+
script.src = src;
|
|
63
|
+
script.async = true;
|
|
64
|
+
script.onload = () => {
|
|
65
|
+
if (scriptId)
|
|
66
|
+
loadedScripts.add(scriptId);
|
|
67
|
+
onLoad?.();
|
|
68
|
+
};
|
|
69
|
+
script.onerror = () => {
|
|
70
|
+
onError?.();
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
else if (dangerouslySetInnerHTML) {
|
|
74
|
+
script.innerHTML = dangerouslySetInnerHTML.__html;
|
|
75
|
+
}
|
|
76
|
+
// Apply additional attributes
|
|
77
|
+
Object.entries(rest).forEach(([key, value]) => {
|
|
78
|
+
if (typeof value === 'string') {
|
|
79
|
+
script.setAttribute(key, value);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
document.body.appendChild(script);
|
|
83
|
+
if (dangerouslySetInnerHTML) {
|
|
84
|
+
onReady?.();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
switch (strategy) {
|
|
88
|
+
case 'beforeInteractive':
|
|
89
|
+
// Already handled during SSR, just mark as loaded
|
|
90
|
+
if (scriptId)
|
|
91
|
+
loadedScripts.add(scriptId);
|
|
92
|
+
break;
|
|
93
|
+
case 'afterInteractive':
|
|
94
|
+
// Load immediately after hydration
|
|
95
|
+
loadScript();
|
|
96
|
+
break;
|
|
97
|
+
case 'lazyOnload':
|
|
98
|
+
// Load during idle time
|
|
99
|
+
if ('requestIdleCallback' in window) {
|
|
100
|
+
window.requestIdleCallback(loadScript);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
setTimeout(loadScript, 200);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
case 'worker':
|
|
107
|
+
// Web worker loading (simplified - would need full worker setup)
|
|
108
|
+
console.warn('[Vista Script] strategy="worker" is experimental');
|
|
109
|
+
loadScript();
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}, [src, strategy, scriptId]);
|
|
113
|
+
// beforeInteractive scripts are rendered in SSR
|
|
114
|
+
if (strategy === 'beforeInteractive' && src) {
|
|
115
|
+
return (0, jsx_runtime_1.jsx)("script", { src: src, ...rest });
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vista ClientIsland Component
|
|
3
|
+
*
|
|
4
|
+
* Wraps client components to mark them for hydration.
|
|
5
|
+
* Usage in server components:
|
|
6
|
+
*
|
|
7
|
+
* import { ClientIsland } from 'vista/client-island';
|
|
8
|
+
* import Counter from './counter';
|
|
9
|
+
*
|
|
10
|
+
* <ClientIsland component="counter">
|
|
11
|
+
* <Counter />
|
|
12
|
+
* </ClientIsland>
|
|
13
|
+
*/
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
interface ClientIslandProps {
|
|
16
|
+
/** Component ID - must match the registered client component name */
|
|
17
|
+
component: string;
|
|
18
|
+
/** Props to pass to the client component for hydration */
|
|
19
|
+
props?: Record<string, any>;
|
|
20
|
+
/** Children - the server-rendered content of the client component */
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* ClientIsland wraps client components with hydration markers.
|
|
25
|
+
*
|
|
26
|
+
* During SSR, it renders:
|
|
27
|
+
* <div data-vista-client="counter" data-props="{}">
|
|
28
|
+
* {children from SSR}
|
|
29
|
+
* </div>
|
|
30
|
+
*
|
|
31
|
+
* The client then hydrates only these marked islands.
|
|
32
|
+
*/
|
|
33
|
+
export declare function ClientIsland({ component, props, children }: ClientIslandProps): React.ReactElement;
|
|
34
|
+
export default ClientIsland;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vista ClientIsland Component
|
|
4
|
+
*
|
|
5
|
+
* Wraps client components to mark them for hydration.
|
|
6
|
+
* Usage in server components:
|
|
7
|
+
*
|
|
8
|
+
* import { ClientIsland } from 'vista/client-island';
|
|
9
|
+
* import Counter from './counter';
|
|
10
|
+
*
|
|
11
|
+
* <ClientIsland component="counter">
|
|
12
|
+
* <Counter />
|
|
13
|
+
* </ClientIsland>
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
+
}) : function(o, v) {
|
|
29
|
+
o["default"] = v;
|
|
30
|
+
});
|
|
31
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
32
|
+
var ownKeys = function(o) {
|
|
33
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
34
|
+
var ar = [];
|
|
35
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
36
|
+
return ar;
|
|
37
|
+
};
|
|
38
|
+
return ownKeys(o);
|
|
39
|
+
};
|
|
40
|
+
return function (mod) {
|
|
41
|
+
if (mod && mod.__esModule) return mod;
|
|
42
|
+
var result = {};
|
|
43
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
44
|
+
__setModuleDefault(result, mod);
|
|
45
|
+
return result;
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.ClientIsland = ClientIsland;
|
|
50
|
+
const React = __importStar(require("react"));
|
|
51
|
+
/**
|
|
52
|
+
* ClientIsland wraps client components with hydration markers.
|
|
53
|
+
*
|
|
54
|
+
* During SSR, it renders:
|
|
55
|
+
* <div data-vista-client="counter" data-props="{}">
|
|
56
|
+
* {children from SSR}
|
|
57
|
+
* </div>
|
|
58
|
+
*
|
|
59
|
+
* The client then hydrates only these marked islands.
|
|
60
|
+
*/
|
|
61
|
+
function ClientIsland({ component, props = {}, children }) {
|
|
62
|
+
// Serialize props (exclude functions and React elements)
|
|
63
|
+
const safeProps = {};
|
|
64
|
+
for (const [key, value] of Object.entries(props)) {
|
|
65
|
+
if (typeof value !== 'function' && !React.isValidElement(value)) {
|
|
66
|
+
safeProps[key] = value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return React.createElement('div', {
|
|
70
|
+
'data-vista-client': component,
|
|
71
|
+
'data-props': JSON.stringify(safeProps),
|
|
72
|
+
style: { display: 'contents' } // Don't affect layout
|
|
73
|
+
}, children);
|
|
74
|
+
}
|
|
75
|
+
exports.default = ClientIsland;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vista Client Component Wrapper
|
|
3
|
+
*
|
|
4
|
+
* A wrapper that marks children as client components for hydration.
|
|
5
|
+
* SSR: Renders the component normally (like Next.js/Astro)
|
|
6
|
+
* Client: Hydrates the existing DOM (attaches event handlers)
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { Client } from 'vista';
|
|
11
|
+
*
|
|
12
|
+
* <Client>
|
|
13
|
+
* <Counter />
|
|
14
|
+
* </Client>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import * as React from 'react';
|
|
18
|
+
interface ClientProps {
|
|
19
|
+
/** Children - client components to hydrate */
|
|
20
|
+
children: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Wraps child components and marks them for client-side hydration.
|
|
24
|
+
*
|
|
25
|
+
* During SSR, components are rendered normally (no placeholders).
|
|
26
|
+
* On client, hydrateRoot attaches to existing DOM.
|
|
27
|
+
*/
|
|
28
|
+
export declare function Client({ children }: ClientProps): React.ReactElement;
|
|
29
|
+
export default Client;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vista Client Component Wrapper
|
|
4
|
+
*
|
|
5
|
+
* A wrapper that marks children as client components for hydration.
|
|
6
|
+
* SSR: Renders the component normally (like Next.js/Astro)
|
|
7
|
+
* Client: Hydrates the existing DOM (attaches event handlers)
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { Client } from 'vista';
|
|
12
|
+
*
|
|
13
|
+
* <Client>
|
|
14
|
+
* <Counter />
|
|
15
|
+
* </Client>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
21
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
22
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
23
|
+
}
|
|
24
|
+
Object.defineProperty(o, k2, desc);
|
|
25
|
+
}) : (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
o[k2] = m[k];
|
|
28
|
+
}));
|
|
29
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
30
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
31
|
+
}) : function(o, v) {
|
|
32
|
+
o["default"] = v;
|
|
33
|
+
});
|
|
34
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
35
|
+
var ownKeys = function(o) {
|
|
36
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
37
|
+
var ar = [];
|
|
38
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
39
|
+
return ar;
|
|
40
|
+
};
|
|
41
|
+
return ownKeys(o);
|
|
42
|
+
};
|
|
43
|
+
return function (mod) {
|
|
44
|
+
if (mod && mod.__esModule) return mod;
|
|
45
|
+
var result = {};
|
|
46
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
47
|
+
__setModuleDefault(result, mod);
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
})();
|
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
+
exports.Client = Client;
|
|
53
|
+
const React = __importStar(require("react"));
|
|
54
|
+
/**
|
|
55
|
+
* Wraps child components and marks them for client-side hydration.
|
|
56
|
+
*
|
|
57
|
+
* During SSR, components are rendered normally (no placeholders).
|
|
58
|
+
* On client, hydrateRoot attaches to existing DOM.
|
|
59
|
+
*/
|
|
60
|
+
function Client({ children }) {
|
|
61
|
+
// Process children and wrap with hydration markers
|
|
62
|
+
const processedChildren = React.Children.map(children, (child, index) => {
|
|
63
|
+
if (!React.isValidElement(child)) {
|
|
64
|
+
return child;
|
|
65
|
+
}
|
|
66
|
+
// Get component name from displayName, name, or fallback
|
|
67
|
+
const componentType = child.type;
|
|
68
|
+
let componentName = 'unknown';
|
|
69
|
+
if (typeof componentType === 'function') {
|
|
70
|
+
componentName = componentType.displayName ||
|
|
71
|
+
componentType.name ||
|
|
72
|
+
'Component';
|
|
73
|
+
}
|
|
74
|
+
else if (typeof componentType === 'string') {
|
|
75
|
+
// It's a native element - render it normally
|
|
76
|
+
return child;
|
|
77
|
+
}
|
|
78
|
+
// Convert to lowercase for hydration matching
|
|
79
|
+
const componentId = componentName.toLowerCase();
|
|
80
|
+
// Serialize safe props (exclude functions and react elements)
|
|
81
|
+
const safeProps = {};
|
|
82
|
+
if (child.props) {
|
|
83
|
+
for (const [key, value] of Object.entries(child.props)) {
|
|
84
|
+
if (key !== 'children' &&
|
|
85
|
+
typeof value !== 'function' &&
|
|
86
|
+
!React.isValidElement(value)) {
|
|
87
|
+
safeProps[key] = value;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Wrap the child with hydration marker AND render the actual child
|
|
92
|
+
// This is the Next.js/Astro approach - SSR the content, hydrate on client
|
|
93
|
+
return React.createElement('div', {
|
|
94
|
+
key: index,
|
|
95
|
+
'data-vista-client': componentId,
|
|
96
|
+
'data-props': JSON.stringify(safeProps),
|
|
97
|
+
style: { display: 'contents' } // Don't affect layout
|
|
98
|
+
}, child); // RENDER THE CHILD during SSR!
|
|
99
|
+
});
|
|
100
|
+
return React.createElement(React.Fragment, null, processedChildren);
|
|
101
|
+
}
|
|
102
|
+
exports.default = Client;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Link } from './link';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Link = void 0;
|
|
7
|
+
var link_1 = require("./link");
|
|
8
|
+
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return __importDefault(link_1).default; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Link;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const context_1 = require("../router/context");
|
|
6
|
+
function Link({ href, children, className }) {
|
|
7
|
+
const router = (0, context_1.useRouter)();
|
|
8
|
+
const handleClick = (e) => {
|
|
9
|
+
e.preventDefault();
|
|
10
|
+
router.push(href);
|
|
11
|
+
};
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("a", { href: href, onClick: handleClick, className: className, children: children }));
|
|
13
|
+
}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImageConfig } from './image/image-config';
|
|
2
|
+
export interface VistaConfig {
|
|
3
|
+
images?: ImageConfig;
|
|
4
|
+
react?: any;
|
|
5
|
+
server?: {
|
|
6
|
+
port?: number;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare const defaultConfig: VistaConfig;
|
|
10
|
+
export declare function loadConfig(cwd?: string): VistaConfig;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.defaultConfig = void 0;
|
|
7
|
+
exports.loadConfig = loadConfig;
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
10
|
+
exports.defaultConfig = {
|
|
11
|
+
images: {},
|
|
12
|
+
};
|
|
13
|
+
function loadConfig(cwd = process.cwd()) {
|
|
14
|
+
const tsPath = path_1.default.join(cwd, 'vista.config.ts');
|
|
15
|
+
const jsPath = path_1.default.join(cwd, 'vista.config.js');
|
|
16
|
+
try {
|
|
17
|
+
if (fs_1.default.existsSync(tsPath)) {
|
|
18
|
+
// We assume ts-node is registered by engine or bin
|
|
19
|
+
const mod = require(tsPath);
|
|
20
|
+
return { ...exports.defaultConfig, ...(mod.default || mod) };
|
|
21
|
+
}
|
|
22
|
+
else if (fs_1.default.existsSync(jsPath)) {
|
|
23
|
+
const mod = require(jsPath);
|
|
24
|
+
return { ...exports.defaultConfig, ...(mod.default || mod) };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error("Error loading vista.config:", error);
|
|
29
|
+
}
|
|
30
|
+
return exports.defaultConfig;
|
|
31
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vista Error Overlay
|
|
3
|
+
*
|
|
4
|
+
* A standalone error overlay that works without React hydration.
|
|
5
|
+
* Uses inline styles and vanilla JS for interactivity.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
export interface VistaError {
|
|
9
|
+
type: 'build' | 'runtime' | 'hydration';
|
|
10
|
+
message: string;
|
|
11
|
+
stack?: string;
|
|
12
|
+
file?: string;
|
|
13
|
+
line?: number;
|
|
14
|
+
column?: number;
|
|
15
|
+
codeFrame?: string;
|
|
16
|
+
}
|
|
17
|
+
interface ErrorOverlayProps {
|
|
18
|
+
errors: VistaError[];
|
|
19
|
+
}
|
|
20
|
+
export declare function ErrorOverlay({ errors }: ErrorOverlayProps): React.ReactElement;
|
|
21
|
+
export declare class DevErrorBoundary extends React.Component<{
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
}, {
|
|
24
|
+
hasError: boolean;
|
|
25
|
+
error: Error | null;
|
|
26
|
+
}> {
|
|
27
|
+
constructor(props: any);
|
|
28
|
+
static getDerivedStateFromError(error: Error): {
|
|
29
|
+
hasError: boolean;
|
|
30
|
+
error: Error;
|
|
31
|
+
};
|
|
32
|
+
render(): string | number | bigint | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>>;
|
|
33
|
+
}
|
|
34
|
+
export { ErrorOverlay as VistaErrorOverlay };
|
|
35
|
+
export { DevErrorBoundary as VistaDevErrorBoundary };
|