@vistagenic/vista 0.2.16 → 0.3.2

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.
Files changed (153) hide show
  1. package/bin/vista.js +184 -177
  2. package/dist/ai/agent.d.ts +37 -0
  3. package/dist/ai/agent.js +385 -0
  4. package/dist/ai/embeddings.d.ts +11 -0
  5. package/dist/ai/embeddings.js +71 -0
  6. package/dist/ai/index.d.ts +10 -0
  7. package/dist/ai/index.js +26 -0
  8. package/dist/ai/memory.d.ts +16 -0
  9. package/dist/ai/memory.js +39 -0
  10. package/dist/ai/observability.d.ts +21 -0
  11. package/dist/ai/observability.js +69 -0
  12. package/dist/ai/providers/anthropic.d.ts +2 -0
  13. package/dist/ai/providers/anthropic.js +190 -0
  14. package/dist/ai/providers/base.d.ts +7 -0
  15. package/dist/ai/providers/base.js +85 -0
  16. package/dist/ai/providers/gemini.d.ts +2 -0
  17. package/dist/ai/providers/gemini.js +194 -0
  18. package/dist/ai/providers/index.d.ts +5 -0
  19. package/dist/ai/providers/index.js +21 -0
  20. package/dist/ai/providers/mock.d.ts +8 -0
  21. package/dist/ai/providers/mock.js +77 -0
  22. package/dist/ai/providers/openai.d.ts +2 -0
  23. package/dist/ai/providers/openai.js +211 -0
  24. package/dist/ai/rag.d.ts +35 -0
  25. package/dist/ai/rag.js +110 -0
  26. package/dist/ai/react/index.d.ts +1 -0
  27. package/dist/ai/react/index.js +17 -0
  28. package/dist/ai/react/react-server.d.ts +1 -0
  29. package/dist/ai/react/react-server.js +17 -0
  30. package/dist/ai/react/use-agent.d.ts +23 -0
  31. package/dist/ai/react/use-agent.js +138 -0
  32. package/dist/ai/stream.d.ts +24 -0
  33. package/dist/ai/stream.js +109 -0
  34. package/dist/ai/tool.d.ts +11 -0
  35. package/dist/ai/tool.js +47 -0
  36. package/dist/ai/types.d.ts +117 -0
  37. package/dist/ai/types.js +5 -0
  38. package/dist/auth/core.d.ts +140 -0
  39. package/dist/auth/core.js +165 -0
  40. package/dist/auth/index.d.ts +20 -8
  41. package/dist/auth/index.js +369 -16
  42. package/dist/auth/react-server.d.ts +1 -0
  43. package/dist/auth/react-server.js +10 -0
  44. package/dist/auth/react.d.ts +18 -0
  45. package/dist/auth/react.js +71 -0
  46. package/dist/bin/build-rsc.js +602 -604
  47. package/dist/bin/build.js +389 -388
  48. package/dist/bin/deploy-output.d.ts +2 -7
  49. package/dist/bin/deploy-output.js +3 -76
  50. package/dist/bin/deploy.d.ts +7 -0
  51. package/dist/bin/deploy.js +102 -0
  52. package/dist/bin/dev-error-overlay-snippet.js +778 -552
  53. package/dist/bin/devtools-indicator-snippet.js +387 -387
  54. package/dist/bin/generate.js +510 -248
  55. package/dist/build/manifest.d.ts +169 -139
  56. package/dist/build/manifest.js +423 -367
  57. package/dist/build/rsc/client-manifest.d.ts +62 -52
  58. package/dist/build/rsc/client-manifest.js +295 -193
  59. package/dist/build/rsc/client-reference-plugin.d.ts +37 -37
  60. package/dist/build/rsc/client-reference-plugin.js +160 -160
  61. package/dist/build/rsc/native-scanner.d.ts +135 -123
  62. package/dist/build/rsc/native-scanner.js +203 -170
  63. package/dist/build/rsc/react-client-reference-manifest.d.ts +28 -22
  64. package/dist/build/rsc/react-client-reference-manifest.js +240 -219
  65. package/dist/build/rsc/rsc-renderer.d.ts +99 -99
  66. package/dist/build/rsc/rsc-renderer.js +263 -263
  67. package/dist/build/rsc/server-component-loader.d.ts +19 -19
  68. package/dist/build/rsc/server-component-loader.js +91 -91
  69. package/dist/build/rsc/server-manifest.d.ts +17 -0
  70. package/dist/build/rsc/server-manifest.js +20 -0
  71. package/dist/build/standalone.js +337 -334
  72. package/dist/build/webpack/plugins/vista-flight-plugin.js +5 -5
  73. package/dist/client/dynamic.react-server.d.ts +2 -0
  74. package/dist/client/dynamic.react-server.js +23 -0
  75. package/dist/client/link.react-server.d.ts +2 -0
  76. package/dist/client/link.react-server.js +11 -0
  77. package/dist/client/navigation.react-server.d.ts +1 -0
  78. package/dist/client/navigation.react-server.js +17 -0
  79. package/dist/client/router.react-server.d.ts +1 -0
  80. package/dist/client/router.react-server.js +17 -0
  81. package/dist/client/rsc-router.react-server.d.ts +1 -0
  82. package/dist/client/rsc-router.react-server.js +17 -0
  83. package/dist/client/script.react-server.d.ts +2 -0
  84. package/dist/client/script.react-server.js +23 -0
  85. package/dist/components/client-island.d.ts +34 -34
  86. package/dist/components/client-island.js +75 -75
  87. package/dist/config.d.ts +17 -0
  88. package/dist/config.js +60 -1
  89. package/dist/deploy/adapters/cloudflare.d.ts +2 -0
  90. package/dist/deploy/adapters/cloudflare.js +124 -0
  91. package/dist/deploy/adapters/docker.d.ts +2 -0
  92. package/dist/deploy/adapters/docker.js +112 -0
  93. package/dist/deploy/adapters/index.d.ts +15 -0
  94. package/dist/deploy/adapters/index.js +24 -0
  95. package/dist/deploy/adapters/netlify.d.ts +2 -0
  96. package/dist/deploy/adapters/netlify.js +115 -0
  97. package/dist/deploy/adapters/render.d.ts +2 -0
  98. package/dist/deploy/adapters/render.js +95 -0
  99. package/dist/deploy/adapters/vercel.d.ts +7 -0
  100. package/dist/deploy/adapters/vercel.js +164 -0
  101. package/dist/deploy/cli-runner.d.ts +8 -0
  102. package/dist/deploy/cli-runner.js +58 -0
  103. package/dist/deploy/detect.d.ts +6 -0
  104. package/dist/deploy/detect.js +77 -0
  105. package/dist/deploy/index.d.ts +24 -0
  106. package/dist/deploy/index.js +112 -0
  107. package/dist/deploy/preflight.d.ts +8 -0
  108. package/dist/deploy/preflight.js +80 -0
  109. package/dist/deploy/types.d.ts +48 -0
  110. package/dist/deploy/types.js +2 -0
  111. package/dist/deploy/utils.d.ts +18 -0
  112. package/dist/deploy/utils.js +70 -0
  113. package/dist/dev-error.d.ts +14 -0
  114. package/dist/dev-error.js +1763 -705
  115. package/dist/index.d.ts +23 -21
  116. package/dist/index.js +61 -57
  117. package/dist/server/cookie-parse.d.ts +4 -0
  118. package/dist/server/cookie-parse.js +14 -0
  119. package/dist/server/engine.js +7 -26
  120. package/dist/server/index.d.ts +109 -102
  121. package/dist/server/index.js +315 -286
  122. package/dist/server/middleware-runner.d.ts +125 -57
  123. package/dist/server/middleware-runner.js +615 -218
  124. package/dist/server/middleware-security.d.ts +36 -0
  125. package/dist/server/middleware-security.js +183 -0
  126. package/dist/server/module-compile-hook.js +695 -662
  127. package/dist/server/route-handler-registry.d.ts +65 -0
  128. package/dist/server/route-handler-registry.js +195 -0
  129. package/dist/server/route-patterns.d.ts +67 -0
  130. package/dist/server/route-patterns.js +186 -0
  131. package/dist/server/rsc-engine.js +75 -92
  132. package/dist/server/rsc-module-system.d.ts +33 -33
  133. package/dist/server/rsc-module-system.js +87 -87
  134. package/dist/server/rsc-upstream.js +892 -888
  135. package/dist/server/static-generator.js +10 -10
  136. package/dist/server/typed-api-runtime.d.ts +18 -0
  137. package/dist/server/typed-api-runtime.js +635 -507
  138. package/dist/server/vista-import-map.js +134 -123
  139. package/dist/stack/index.d.ts +34 -32
  140. package/dist/stack/index.js +49 -45
  141. package/dist/stack/server/caller.d.ts +13 -0
  142. package/dist/stack/server/caller.js +42 -0
  143. package/dist/stack/server/executor.d.ts +40 -36
  144. package/dist/stack/server/executor.js +222 -174
  145. package/dist/stack/server/index.d.ts +11 -10
  146. package/dist/stack/server/index.js +24 -23
  147. package/dist/stack/server/procedure.d.ts +20 -18
  148. package/dist/stack/server/procedure.js +66 -58
  149. package/dist/stack/server/types.d.ts +113 -100
  150. package/dist/theme/react-server.d.ts +10 -0
  151. package/dist/theme/react-server.js +16 -0
  152. package/package.json +28 -3
  153. package/LICENSE +0 -21
@@ -86,11 +86,11 @@ class VistaFlightPlugin {
86
86
  };
87
87
  manifest.pathToId[info.relativePath] = componentId;
88
88
  }
89
- const jsSource = `// Vista Client Reference Manifest
90
- (function() {
91
- if (typeof window !== 'undefined') {
92
- window.${constants_1.CLIENT_MANIFEST_FLAG} = ${JSON.stringify(manifest, null, 2)};
93
- }
89
+ const jsSource = `// Vista Client Reference Manifest
90
+ (function() {
91
+ if (typeof window !== 'undefined') {
92
+ window.${constants_1.CLIENT_MANIFEST_FLAG} = ${JSON.stringify(manifest, null, 2)};
93
+ }
94
94
  })();`;
95
95
  compilation.emitAsset('vista-client-manifest.js', new webpack_1.default.sources.RawSource(jsSource));
96
96
  if (this.dev) {
@@ -0,0 +1,2 @@
1
+ export * from './dynamic';
2
+ export { default } from './dynamic';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.default = void 0;
21
+ __exportStar(require("./dynamic"), exports);
22
+ var dynamic_1 = require("./dynamic");
23
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(dynamic_1).default; } });
@@ -0,0 +1,2 @@
1
+ export { default, Link, useLinkStatus, useIsActive } from './link';
2
+ export type { LinkProps } from './link';
@@ -0,0 +1,11 @@
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.useIsActive = exports.useLinkStatus = exports.Link = exports.default = void 0;
7
+ var link_1 = require("./link");
8
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(link_1).default; } });
9
+ Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return link_1.Link; } });
10
+ Object.defineProperty(exports, "useLinkStatus", { enumerable: true, get: function () { return link_1.useLinkStatus; } });
11
+ Object.defineProperty(exports, "useIsActive", { enumerable: true, get: function () { return link_1.useIsActive; } });
@@ -0,0 +1 @@
1
+ export * from './navigation';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./navigation"), exports);
@@ -0,0 +1 @@
1
+ export * from './router';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./router"), exports);
@@ -0,0 +1 @@
1
+ export * from './rsc-router';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./rsc-router"), exports);
@@ -0,0 +1,2 @@
1
+ export * from './script';
2
+ export { default } from './script';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.default = void 0;
21
+ __exportStar(require("./script"), exports);
22
+ var script_1 = require("./script");
23
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(script_1).default; } });
@@ -1,34 +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;
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;
@@ -1,75 +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;
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;
package/dist/config.d.ts CHANGED
@@ -41,6 +41,18 @@ export interface ExperimentalConfig {
41
41
  typedApi?: TypedApiExperimentalConfig;
42
42
  cacheComponents?: CacheComponentsExperimentalConfig;
43
43
  }
44
+ export type DeployTarget = 'auto' | 'render' | 'vercel' | 'cloudflare' | 'netlify' | 'docker';
45
+ export type DeployOutput = 'standalone' | 'static' | 'hybrid';
46
+ export interface DeployConfig {
47
+ /** Deployment platform target. Default: 'auto' */
48
+ target?: DeployTarget;
49
+ /** Build output mode. Default: inferred from target */
50
+ output?: DeployOutput;
51
+ /** Production deploy by default. Default: true */
52
+ prod?: boolean;
53
+ /** Prefer Vercel Build Output API (.vercel/output) over vercel.json. Default: true */
54
+ preferBuildOutputApi?: boolean;
55
+ }
44
56
  export interface VistaConfig {
45
57
  images?: ImageConfig;
46
58
  react?: any;
@@ -48,6 +60,7 @@ export interface VistaConfig {
48
60
  server?: {
49
61
  port?: number;
50
62
  };
63
+ deploy?: DeployConfig;
51
64
  validation?: {
52
65
  structure?: StructureValidationConfig;
53
66
  };
@@ -56,6 +69,7 @@ export interface VistaConfig {
56
69
  export declare const defaultStructureValidationConfig: Required<StructureValidationConfig>;
57
70
  export declare const defaultTypedApiConfig: Required<TypedApiExperimentalConfig>;
58
71
  export declare const defaultCacheComponentsConfig: Required<CacheComponentsExperimentalConfig>;
72
+ export declare const defaultDeployConfig: Required<DeployConfig>;
59
73
  export declare const defaultConfig: VistaConfig;
60
74
  /**
61
75
  * Resolve the effective structure validation config merging user overrides.
@@ -71,4 +85,7 @@ export declare function resolveAndApplyEngineVariant(config: VistaConfig, env?:
71
85
  */
72
86
  export declare function resolveTypedApiConfig(config: VistaConfig): ResolvedTypedApiConfig;
73
87
  export declare function resolveCacheComponentsConfig(config: VistaConfig): ResolvedCacheComponentsConfig;
88
+ export type ResolvedDeployConfig = Required<DeployConfig>;
89
+ export declare function resolveDeployConfig(config: VistaConfig): ResolvedDeployConfig;
90
+ export declare function inferDeployOutputForTarget(target: Exclude<DeployTarget, 'auto'>): DeployOutput;
74
91
  export declare function loadConfig(cwd?: string): VistaConfig;
package/dist/config.js CHANGED
@@ -3,13 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.defaultConfig = exports.defaultCacheComponentsConfig = exports.defaultTypedApiConfig = exports.defaultStructureValidationConfig = void 0;
6
+ exports.defaultConfig = exports.defaultDeployConfig = exports.defaultCacheComponentsConfig = exports.defaultTypedApiConfig = exports.defaultStructureValidationConfig = void 0;
7
7
  exports.resolveStructureValidationConfig = resolveStructureValidationConfig;
8
8
  exports.resolveEngineVariant = resolveEngineVariant;
9
9
  exports.applyEngineVariantToEnv = applyEngineVariantToEnv;
10
10
  exports.resolveAndApplyEngineVariant = resolveAndApplyEngineVariant;
11
11
  exports.resolveTypedApiConfig = resolveTypedApiConfig;
12
12
  exports.resolveCacheComponentsConfig = resolveCacheComponentsConfig;
13
+ exports.resolveDeployConfig = resolveDeployConfig;
14
+ exports.inferDeployOutputForTarget = inferDeployOutputForTarget;
13
15
  exports.loadConfig = loadConfig;
14
16
  const path_1 = __importDefault(require("path"));
15
17
  const fs_1 = __importDefault(require("fs"));
@@ -29,6 +31,12 @@ exports.defaultTypedApiConfig = {
29
31
  exports.defaultCacheComponentsConfig = {
30
32
  enabled: false,
31
33
  };
34
+ exports.defaultDeployConfig = {
35
+ target: 'auto',
36
+ output: 'standalone',
37
+ prod: true,
38
+ preferBuildOutputApi: true,
39
+ };
32
40
  exports.defaultConfig = {
33
41
  images: {},
34
42
  engine: {
@@ -37,6 +45,7 @@ exports.defaultConfig = {
37
45
  validation: {
38
46
  structure: { ...exports.defaultStructureValidationConfig },
39
47
  },
48
+ deploy: { ...exports.defaultDeployConfig },
40
49
  experimental: {
41
50
  typedApi: { ...exports.defaultTypedApiConfig },
42
51
  cacheComponents: { ...exports.defaultCacheComponentsConfig },
@@ -122,6 +131,52 @@ function resolveCacheComponentsConfig(config) {
122
131
  enabled: Boolean(merged.enabled),
123
132
  };
124
133
  }
134
+ function normalizeDeployTarget(raw) {
135
+ const value = String(raw ?? '')
136
+ .trim()
137
+ .toLowerCase();
138
+ const allowed = [
139
+ 'auto',
140
+ 'render',
141
+ 'vercel',
142
+ 'cloudflare',
143
+ 'netlify',
144
+ 'docker',
145
+ ];
146
+ return allowed.includes(value) ? value : undefined;
147
+ }
148
+ function normalizeDeployOutput(raw) {
149
+ const value = String(raw ?? '')
150
+ .trim()
151
+ .toLowerCase();
152
+ if (value === 'standalone' || value === 'static' || value === 'hybrid') {
153
+ return value;
154
+ }
155
+ return undefined;
156
+ }
157
+ function resolveDeployConfig(config) {
158
+ const merged = {
159
+ ...exports.defaultDeployConfig,
160
+ ...(config.deploy ?? {}),
161
+ };
162
+ const target = normalizeDeployTarget(merged.target) ?? exports.defaultDeployConfig.target;
163
+ const output = normalizeDeployOutput(merged.output) ?? exports.defaultDeployConfig.output;
164
+ return {
165
+ target,
166
+ output,
167
+ prod: merged.prod !== false,
168
+ preferBuildOutputApi: merged.preferBuildOutputApi !== false,
169
+ };
170
+ }
171
+ function inferDeployOutputForTarget(target) {
172
+ if (target === 'vercel' || target === 'cloudflare' || target === 'netlify') {
173
+ return 'static';
174
+ }
175
+ if (target === 'render' || target === 'docker') {
176
+ return 'standalone';
177
+ }
178
+ return 'standalone';
179
+ }
125
180
  function mergeConfig(userConfig) {
126
181
  const mergedBase = {
127
182
  ...exports.defaultConfig,
@@ -143,6 +198,10 @@ function mergeConfig(userConfig) {
143
198
  ...(exports.defaultConfig.server ?? {}),
144
199
  ...(userConfig.server ?? {}),
145
200
  },
201
+ deploy: {
202
+ ...exports.defaultDeployConfig,
203
+ ...(userConfig.deploy ?? {}),
204
+ },
146
205
  validation: {
147
206
  ...(exports.defaultConfig.validation ?? {}),
148
207
  ...(userConfig.validation ?? {}),
@@ -0,0 +1,2 @@
1
+ import type { DeployAdapter } from '../types';
2
+ export declare const cloudflareAdapter: DeployAdapter;
@@ -0,0 +1,124 @@
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.cloudflareAdapter = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const cli_runner_1 = require("../cli-runner");
10
+ const preflight_1 = require("../preflight");
11
+ const utils_1 = require("../utils");
12
+ const CLOUDFLARE_OUTPUT_DIR = '.vista/deploy/cloudflare';
13
+ function getCloudflareOutputDir(ctx) {
14
+ return path_1.default.join(ctx.cwd, CLOUDFLARE_OUTPUT_DIR);
15
+ }
16
+ function writeWranglerToml(ctx, outputDir) {
17
+ const targetFile = path_1.default.join(ctx.cwd, 'wrangler.toml');
18
+ const relativeOutput = path_1.default.relative(ctx.cwd, outputDir).replace(/\\/g, '/');
19
+ const content = `name = "my-vista-app"
20
+ compatibility_date = "2024-09-01"
21
+ pages_build_output_dir = "${relativeOutput}"
22
+ `;
23
+ (0, utils_1.writeFileIfAllowed)(targetFile, content, ctx.force);
24
+ return targetFile;
25
+ }
26
+ function writeRoutesJson(outputDir) {
27
+ const routesPath = path_1.default.join(outputDir, '_routes.json');
28
+ const routes = {
29
+ version: 1,
30
+ include: ['/*'],
31
+ exclude: ['/static/*'],
32
+ };
33
+ fs_1.default.writeFileSync(routesPath, `${JSON.stringify(routes, null, 2)}\n`, 'utf8');
34
+ return routesPath;
35
+ }
36
+ function writeRedirects(outputDir) {
37
+ const redirectsPath = path_1.default.join(outputDir, '_redirects');
38
+ const lines = [
39
+ '/_vista/* /:splat 200',
40
+ '/ /static/pages/index.html 200',
41
+ '/rsc /static/pages/index.rsc 200',
42
+ '/_rsc/* /static/pages/:splat.rsc 200',
43
+ '/* /static/pages/:splat.html 200',
44
+ ];
45
+ fs_1.default.writeFileSync(redirectsPath, `${lines.join('\n')}\n`, 'utf8');
46
+ return redirectsPath;
47
+ }
48
+ exports.cloudflareAdapter = {
49
+ id: 'cloudflare',
50
+ requiredOutput: 'static',
51
+ supportsFullRuntime: false,
52
+ async preflight(ctx) {
53
+ return (0, preflight_1.runStaticHostPreflight)(ctx);
54
+ },
55
+ async emit(ctx) {
56
+ const outputDir = getCloudflareOutputDir(ctx);
57
+ fs_1.default.rmSync(outputDir, { recursive: true, force: true });
58
+ (0, utils_1.ensureDir)(outputDir);
59
+ (0, utils_1.copyStaticHostAssets)(ctx.cwd, ctx.vistaDir, outputDir);
60
+ const routesPath = writeRoutesJson(outputDir);
61
+ const redirectsPath = writeRedirects(outputDir);
62
+ const wranglerPath = writeWranglerToml(ctx, outputDir);
63
+ return {
64
+ status: 'emitted',
65
+ target: 'cloudflare',
66
+ artifactPaths: [outputDir, routesPath, redirectsPath, wranglerPath],
67
+ instructions: [
68
+ 'Cloudflare Pages deploy uses pre-rendered static output.',
69
+ 'Set images.unoptimized: true when using Vista Image on static hosts.',
70
+ ],
71
+ };
72
+ },
73
+ async deploy(ctx) {
74
+ const emitted = await exports.cloudflareAdapter.emit(ctx);
75
+ if (ctx.dryRun) {
76
+ return emitted;
77
+ }
78
+ const preflightMessages = await exports.cloudflareAdapter.preflight(ctx);
79
+ const { errors, warnings } = (0, preflight_1.splitPreflightMessages)(preflightMessages);
80
+ if (errors.length > 0) {
81
+ return {
82
+ status: 'failed',
83
+ target: 'cloudflare',
84
+ warnings: [...warnings, ...errors],
85
+ };
86
+ }
87
+ const outputDir = getCloudflareOutputDir(ctx);
88
+ if (!(0, cli_runner_1.isCliAvailable)('wrangler')) {
89
+ return {
90
+ status: 'emitted',
91
+ target: 'cloudflare',
92
+ artifactPaths: emitted.artifactPaths,
93
+ warnings: [...warnings, 'Wrangler CLI not found. Install with: npm i -g wrangler'],
94
+ instructions: [
95
+ 'Install Wrangler: npm i -g wrangler',
96
+ `Then run: wrangler pages deploy "${outputDir}" --project-name my-vista-app`,
97
+ 'Or connect the repo in the Cloudflare Pages dashboard.',
98
+ ],
99
+ };
100
+ }
101
+ const branchFlag = ctx.prod ? '' : '--branch preview';
102
+ const command = `wrangler pages deploy "${outputDir}" --project-name my-vista-app ${branchFlag}`.trim();
103
+ const result = (0, cli_runner_1.runCliCommand)(command, { cwd: ctx.cwd, dryRun: ctx.dryRun });
104
+ if (!result.ok) {
105
+ return {
106
+ status: 'emitted',
107
+ target: 'cloudflare',
108
+ artifactPaths: emitted.artifactPaths,
109
+ warnings: [...warnings, result.stderr || 'Wrangler deploy failed.'],
110
+ instructions: [
111
+ 'Run: wrangler login',
112
+ 'Or set CLOUDFLARE_API_TOKEN in your environment.',
113
+ ],
114
+ };
115
+ }
116
+ return {
117
+ status: 'deployed',
118
+ target: 'cloudflare',
119
+ url: (0, cli_runner_1.extractDeploymentUrl)(`${result.stdout}\n${result.stderr}`),
120
+ artifactPaths: emitted.artifactPaths,
121
+ warnings,
122
+ };
123
+ },
124
+ };
@@ -0,0 +1,2 @@
1
+ import type { DeployAdapter } from '../types';
2
+ export declare const dockerAdapter: DeployAdapter;