@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
@@ -1,37 +1,37 @@
1
- /**
2
- * Vista Client Reference Plugin
3
- *
4
- * Webpack plugin that transforms server component imports in the client bundle.
5
- *
6
- * When a client bundle imports a server component, this plugin:
7
- * 1. Replaces the import with a client reference proxy
8
- * 2. The proxy throws an error if used on the client (server components can't run on client)
9
- * 3. For valid patterns (passing server component as children), the reference works
10
- *
11
- * This ensures:
12
- * - Server code never leaks to the client bundle
13
- * - Server components contribute 0kb to client JavaScript
14
- * - Clear error messages when misusing server components
15
- */
16
- import webpack from 'webpack';
17
- export interface ClientReferencePluginOptions {
18
- /** Path to the app directory */
19
- appDir: string;
20
- /** Path to client manifest JSON */
21
- clientManifestPath: string;
22
- }
23
- /**
24
- * Client Reference Plugin
25
- *
26
- * Transforms imports of server components in the client bundle
27
- */
28
- export declare class ClientReferencePlugin {
29
- private appDir;
30
- private clientManifestPath;
31
- private clientManifest;
32
- constructor(options: ClientReferencePluginOptions);
33
- apply(compiler: webpack.Compiler): void;
34
- private loadManifest;
35
- private getComponentId;
36
- private generateRuntimeManifest;
37
- }
1
+ /**
2
+ * Vista Client Reference Plugin
3
+ *
4
+ * Webpack plugin that transforms server component imports in the client bundle.
5
+ *
6
+ * When a client bundle imports a server component, this plugin:
7
+ * 1. Replaces the import with a client reference proxy
8
+ * 2. The proxy throws an error if used on the client (server components can't run on client)
9
+ * 3. For valid patterns (passing server component as children), the reference works
10
+ *
11
+ * This ensures:
12
+ * - Server code never leaks to the client bundle
13
+ * - Server components contribute 0kb to client JavaScript
14
+ * - Clear error messages when misusing server components
15
+ */
16
+ import webpack from 'webpack';
17
+ export interface ClientReferencePluginOptions {
18
+ /** Path to the app directory */
19
+ appDir: string;
20
+ /** Path to client manifest JSON */
21
+ clientManifestPath: string;
22
+ }
23
+ /**
24
+ * Client Reference Plugin
25
+ *
26
+ * Transforms imports of server components in the client bundle
27
+ */
28
+ export declare class ClientReferencePlugin {
29
+ private appDir;
30
+ private clientManifestPath;
31
+ private clientManifest;
32
+ constructor(options: ClientReferencePluginOptions);
33
+ apply(compiler: webpack.Compiler): void;
34
+ private loadManifest;
35
+ private getComponentId;
36
+ private generateRuntimeManifest;
37
+ }
@@ -1,160 +1,160 @@
1
- "use strict";
2
- /**
3
- * Vista Client Reference Plugin
4
- *
5
- * Webpack plugin that transforms server component imports in the client bundle.
6
- *
7
- * When a client bundle imports a server component, this plugin:
8
- * 1. Replaces the import with a client reference proxy
9
- * 2. The proxy throws an error if used on the client (server components can't run on client)
10
- * 3. For valid patterns (passing server component as children), the reference works
11
- *
12
- * This ensures:
13
- * - Server code never leaks to the client bundle
14
- * - Server components contribute 0kb to client JavaScript
15
- * - Clear error messages when misusing server components
16
- */
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.ClientReferencePlugin = void 0;
22
- const webpack_1 = __importDefault(require("webpack"));
23
- const path_1 = __importDefault(require("path"));
24
- const fs_1 = __importDefault(require("fs"));
25
- /**
26
- * Check if a file is a client component by reading 'use client' directive
27
- */
28
- function isClientComponent(filePath) {
29
- try {
30
- const content = fs_1.default.readFileSync(filePath, 'utf-8');
31
- const trimmed = content.trim();
32
- return trimmed.startsWith("'use client'") || trimmed.startsWith('"use client"');
33
- }
34
- catch {
35
- return false;
36
- }
37
- }
38
- /**
39
- * Client Reference Plugin
40
- *
41
- * Transforms imports of server components in the client bundle
42
- */
43
- class ClientReferencePlugin {
44
- appDir;
45
- clientManifestPath;
46
- clientManifest = null;
47
- constructor(options) {
48
- this.appDir = options.appDir;
49
- this.clientManifestPath = options.clientManifestPath;
50
- }
51
- apply(compiler) {
52
- const pluginName = 'VistaClientReferencePlugin';
53
- // Load client manifest
54
- compiler.hooks.beforeCompile.tap(pluginName, () => {
55
- this.loadManifest();
56
- });
57
- // Provide virtual module for server component proxies
58
- compiler.hooks.normalModuleFactory.tap(pluginName, (nmf) => {
59
- nmf.hooks.beforeResolve.tap(pluginName, (resolveData) => {
60
- if (!resolveData)
61
- return;
62
- // Check if this is importing a server component from client code
63
- const request = resolveData.request;
64
- if (request === 'vista/server-component-proxy') {
65
- // Virtual module - allow it to continue
66
- return;
67
- }
68
- });
69
- nmf.hooks.afterResolve.tap(pluginName, (resolveData) => {
70
- if (!resolveData || !resolveData.createData)
71
- return;
72
- const resourcePath = resolveData.createData.resource;
73
- if (!resourcePath)
74
- return;
75
- // Check if this is a file in the app directory
76
- if (!resourcePath.startsWith(this.appDir))
77
- return;
78
- // Check if this is a TypeScript/JavaScript file
79
- if (!/\.[jt]sx?$/.test(resourcePath))
80
- return;
81
- // Check if this is a server component (NOT a client component)
82
- if (!isClientComponent(resourcePath)) {
83
- // This is a server component being imported in client bundle
84
- // We need to replace it with a proxy
85
- // Mark it for replacement (use any to add custom properties)
86
- resolveData.createData.vistaServerComponent = true;
87
- resolveData.createData.vistaComponentId = this.getComponentId(resourcePath);
88
- }
89
- });
90
- });
91
- // Transform the module content for server components
92
- compiler.hooks.compilation.tap(pluginName, (compilation) => {
93
- // Add the server component proxy to the beginning of affected modules
94
- compilation.hooks.succeedModule.tap(pluginName, (module) => {
95
- if (module.vistaServerComponent) {
96
- // This module is a server component - it should be replaced with a proxy
97
- // In practice, we handle this via the loader
98
- }
99
- });
100
- });
101
- // Add a loader to handle server component replacement
102
- compiler.options.module?.rules?.push({
103
- test: /\.[jt]sx?$/,
104
- include: this.appDir,
105
- enforce: 'pre',
106
- use: [
107
- {
108
- loader: require.resolve('./server-component-loader'),
109
- options: {
110
- appDir: this.appDir,
111
- clientManifestPath: this.clientManifestPath,
112
- },
113
- },
114
- ],
115
- });
116
- compiler.hooks.compilation.tap(pluginName, (compilation) => {
117
- compilation.hooks.processAssets.tap({
118
- name: pluginName,
119
- stage: webpack_1.default.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
120
- }, () => {
121
- if (!this.clientManifest)
122
- return;
123
- const runtimeManifest = this.generateRuntimeManifest();
124
- const manifestSource = JSON.stringify(runtimeManifest, null, 2);
125
- compilation.emitAsset('client-reference-manifest.json', new webpack_1.default.sources.RawSource(manifestSource));
126
- });
127
- });
128
- }
129
- loadManifest() {
130
- try {
131
- if (fs_1.default.existsSync(this.clientManifestPath)) {
132
- const content = fs_1.default.readFileSync(this.clientManifestPath, 'utf-8');
133
- this.clientManifest = JSON.parse(content);
134
- }
135
- }
136
- catch (e) {
137
- console.warn('[Vista] Failed to load client manifest:', e);
138
- }
139
- }
140
- getComponentId(filePath) {
141
- const relative = path_1.default.relative(this.appDir, filePath);
142
- return `server:${relative.replace(/\\/g, '/').replace(/\.[jt]sx?$/, '')}`;
143
- }
144
- generateRuntimeManifest() {
145
- if (!this.clientManifest)
146
- return {};
147
- return {
148
- clientModules: Object.keys(this.clientManifest.clientModules).reduce((acc, key) => {
149
- const entry = this.clientManifest.clientModules[key];
150
- acc[key] = {
151
- id: entry.id,
152
- chunks: [entry.chunkName],
153
- name: entry.exports[0] || 'default',
154
- };
155
- return acc;
156
- }, {}),
157
- };
158
- }
159
- }
160
- exports.ClientReferencePlugin = ClientReferencePlugin;
1
+ "use strict";
2
+ /**
3
+ * Vista Client Reference Plugin
4
+ *
5
+ * Webpack plugin that transforms server component imports in the client bundle.
6
+ *
7
+ * When a client bundle imports a server component, this plugin:
8
+ * 1. Replaces the import with a client reference proxy
9
+ * 2. The proxy throws an error if used on the client (server components can't run on client)
10
+ * 3. For valid patterns (passing server component as children), the reference works
11
+ *
12
+ * This ensures:
13
+ * - Server code never leaks to the client bundle
14
+ * - Server components contribute 0kb to client JavaScript
15
+ * - Clear error messages when misusing server components
16
+ */
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.ClientReferencePlugin = void 0;
22
+ const webpack_1 = __importDefault(require("webpack"));
23
+ const path_1 = __importDefault(require("path"));
24
+ const fs_1 = __importDefault(require("fs"));
25
+ /**
26
+ * Check if a file is a client component by reading 'use client' directive
27
+ */
28
+ function isClientComponent(filePath) {
29
+ try {
30
+ const content = fs_1.default.readFileSync(filePath, 'utf-8');
31
+ const trimmed = content.trim();
32
+ return trimmed.startsWith("'use client'") || trimmed.startsWith('"use client"');
33
+ }
34
+ catch {
35
+ return false;
36
+ }
37
+ }
38
+ /**
39
+ * Client Reference Plugin
40
+ *
41
+ * Transforms imports of server components in the client bundle
42
+ */
43
+ class ClientReferencePlugin {
44
+ appDir;
45
+ clientManifestPath;
46
+ clientManifest = null;
47
+ constructor(options) {
48
+ this.appDir = options.appDir;
49
+ this.clientManifestPath = options.clientManifestPath;
50
+ }
51
+ apply(compiler) {
52
+ const pluginName = 'VistaClientReferencePlugin';
53
+ // Load client manifest
54
+ compiler.hooks.beforeCompile.tap(pluginName, () => {
55
+ this.loadManifest();
56
+ });
57
+ // Provide virtual module for server component proxies
58
+ compiler.hooks.normalModuleFactory.tap(pluginName, (nmf) => {
59
+ nmf.hooks.beforeResolve.tap(pluginName, (resolveData) => {
60
+ if (!resolveData)
61
+ return;
62
+ // Check if this is importing a server component from client code
63
+ const request = resolveData.request;
64
+ if (request === 'vista/server-component-proxy') {
65
+ // Virtual module - allow it to continue
66
+ return;
67
+ }
68
+ });
69
+ nmf.hooks.afterResolve.tap(pluginName, (resolveData) => {
70
+ if (!resolveData || !resolveData.createData)
71
+ return;
72
+ const resourcePath = resolveData.createData.resource;
73
+ if (!resourcePath)
74
+ return;
75
+ // Check if this is a file in the app directory
76
+ if (!resourcePath.startsWith(this.appDir))
77
+ return;
78
+ // Check if this is a TypeScript/JavaScript file
79
+ if (!/\.[jt]sx?$/.test(resourcePath))
80
+ return;
81
+ // Check if this is a server component (NOT a client component)
82
+ if (!isClientComponent(resourcePath)) {
83
+ // This is a server component being imported in client bundle
84
+ // We need to replace it with a proxy
85
+ // Mark it for replacement (use any to add custom properties)
86
+ resolveData.createData.vistaServerComponent = true;
87
+ resolveData.createData.vistaComponentId = this.getComponentId(resourcePath);
88
+ }
89
+ });
90
+ });
91
+ // Transform the module content for server components
92
+ compiler.hooks.compilation.tap(pluginName, (compilation) => {
93
+ // Add the server component proxy to the beginning of affected modules
94
+ compilation.hooks.succeedModule.tap(pluginName, (module) => {
95
+ if (module.vistaServerComponent) {
96
+ // This module is a server component - it should be replaced with a proxy
97
+ // In practice, we handle this via the loader
98
+ }
99
+ });
100
+ });
101
+ // Add a loader to handle server component replacement
102
+ compiler.options.module?.rules?.push({
103
+ test: /\.[jt]sx?$/,
104
+ include: this.appDir,
105
+ enforce: 'pre',
106
+ use: [
107
+ {
108
+ loader: require.resolve('./server-component-loader'),
109
+ options: {
110
+ appDir: this.appDir,
111
+ clientManifestPath: this.clientManifestPath,
112
+ },
113
+ },
114
+ ],
115
+ });
116
+ compiler.hooks.compilation.tap(pluginName, (compilation) => {
117
+ compilation.hooks.processAssets.tap({
118
+ name: pluginName,
119
+ stage: webpack_1.default.Compilation.PROCESS_ASSETS_STAGE_ADDITIONAL,
120
+ }, () => {
121
+ if (!this.clientManifest)
122
+ return;
123
+ const runtimeManifest = this.generateRuntimeManifest();
124
+ const manifestSource = JSON.stringify(runtimeManifest, null, 2);
125
+ compilation.emitAsset('client-reference-manifest.json', new webpack_1.default.sources.RawSource(manifestSource));
126
+ });
127
+ });
128
+ }
129
+ loadManifest() {
130
+ try {
131
+ if (fs_1.default.existsSync(this.clientManifestPath)) {
132
+ const content = fs_1.default.readFileSync(this.clientManifestPath, 'utf-8');
133
+ this.clientManifest = JSON.parse(content);
134
+ }
135
+ }
136
+ catch (e) {
137
+ console.warn('[Vista] Failed to load client manifest:', e);
138
+ }
139
+ }
140
+ getComponentId(filePath) {
141
+ const relative = path_1.default.relative(this.appDir, filePath);
142
+ return `server:${relative.replace(/\\/g, '/').replace(/\.[jt]sx?$/, '')}`;
143
+ }
144
+ generateRuntimeManifest() {
145
+ if (!this.clientManifest)
146
+ return {};
147
+ return {
148
+ clientModules: Object.keys(this.clientManifest.clientModules).reduce((acc, key) => {
149
+ const entry = this.clientManifest.clientModules[key];
150
+ acc[key] = {
151
+ id: entry.id,
152
+ chunks: [entry.chunkName],
153
+ name: entry.exports[0] || 'default',
154
+ };
155
+ return acc;
156
+ }, {}),
157
+ };
158
+ }
159
+ }
160
+ exports.ClientReferencePlugin = ClientReferencePlugin;
@@ -1,123 +1,135 @@
1
- /**
2
- * Vista RSC Native Scanner
3
- *
4
- * Uses Rust-powered native bindings for blazing fast component scanning.
5
- * Falls back to TypeScript implementation if native module unavailable.
6
- */
7
- export interface NapiScannedComponent {
8
- absolutePath: string;
9
- relativePath: string;
10
- isClient: boolean;
11
- directiveLine: number;
12
- componentType: string;
13
- exports: string[];
14
- clientHooksUsed: string[];
15
- hasMetadata: boolean;
16
- hasGenerateMetadata: boolean;
17
- }
18
- export interface NapiServerComponentError {
19
- file: string;
20
- message: string;
21
- hooks: string[];
22
- }
23
- export interface NapiScanResult {
24
- clientComponents: NapiScannedComponent[];
25
- serverComponents: NapiScannedComponent[];
26
- pages: NapiScannedComponent[];
27
- layouts: NapiScannedComponent[];
28
- apiRoutes: NapiScannedComponent[];
29
- errors: NapiServerComponentError[];
30
- totalFiles: number;
31
- scanTimeMs: number;
32
- }
33
- export interface NapiClientModuleEntry {
34
- id: string;
35
- path: string;
36
- absolutePath: string;
37
- chunkName: string;
38
- exports: string[];
39
- asyncLoad: boolean;
40
- }
41
- export interface NapiClientManifest {
42
- buildId: string;
43
- clientModules: NapiClientModuleEntry[];
44
- }
45
- export interface NapiRouteEntry {
46
- pattern: string;
47
- pagePath: string;
48
- layoutPaths: string[];
49
- loadingPath: string | null;
50
- errorPath: string | null;
51
- routeType: string;
52
- }
53
- export interface NapiServerModuleEntry {
54
- id: string;
55
- path: string;
56
- absolutePath: string;
57
- componentType: string;
58
- hasMetadata: boolean;
59
- hasGenerateMetadata: boolean;
60
- }
61
- export interface NapiServerManifest {
62
- buildId: string;
63
- serverModules: NapiServerModuleEntry[];
64
- routes: NapiRouteEntry[];
65
- }
66
- /**
67
- * Check if native module is available
68
- */
69
- export declare function isNativeAvailable(): boolean;
70
- /**
71
- * Scan app directory using Rust native code
72
- * Returns null if native module is not available
73
- */
74
- export declare function scanAppNative(appDir: string): NapiScanResult | null;
75
- /**
76
- * Generate client manifest using Rust native code
77
- */
78
- export declare function generateClientManifestNative(appDir: string, buildId: string): NapiClientManifest | null;
79
- /**
80
- * Generate server manifest using Rust native code
81
- */
82
- export declare function generateServerManifestNative(appDir: string, buildId: string): NapiServerManifest | null;
83
- /**
84
- * Generate unique mount ID for client component
85
- */
86
- export declare function generateMountIdNative(): string | null;
87
- /**
88
- * Reset mount ID counter (call at start of each request)
89
- */
90
- export declare function resetMountCounterNative(): boolean;
91
- /**
92
- * Convert NAPI scan result to internal format
93
- */
94
- export declare function convertScanResult(result: NapiScanResult): {
95
- clientComponents: {
96
- absolutePath: string;
97
- relativePath: string;
98
- isClient: boolean;
99
- directiveLine: number;
100
- componentType: string;
101
- exports: string[];
102
- clientHooksUsed: string[];
103
- hasMetadata: boolean;
104
- hasGenerateMetadata: boolean;
105
- }[];
106
- serverComponents: {
107
- absolutePath: string;
108
- relativePath: string;
109
- isClient: boolean;
110
- directiveLine: number;
111
- componentType: string;
112
- exports: string[];
113
- clientHooksUsed: any[];
114
- hasMetadata: boolean;
115
- hasGenerateMetadata: boolean;
116
- }[];
117
- pages: NapiScannedComponent[];
118
- layouts: NapiScannedComponent[];
119
- apiRoutes: NapiScannedComponent[];
120
- errors: NapiServerComponentError[];
121
- totalFiles: number;
122
- scanTimeMs: number;
123
- };
1
+ /**
2
+ * Vista RSC Native Scanner
3
+ *
4
+ * Uses Rust-powered native bindings for blazing fast component scanning.
5
+ * Falls back to TypeScript implementation if native module unavailable.
6
+ */
7
+ export interface NapiScannedComponent {
8
+ absolutePath: string;
9
+ relativePath: string;
10
+ isClient: boolean;
11
+ directiveLine: number;
12
+ componentType: string;
13
+ exports: string[];
14
+ clientHooksUsed: string[];
15
+ hasMetadata: boolean;
16
+ hasGenerateMetadata: boolean;
17
+ }
18
+ export interface NapiServerComponentError {
19
+ file: string;
20
+ message: string;
21
+ hooks: string[];
22
+ }
23
+ export interface NapiScanResult {
24
+ clientComponents: NapiScannedComponent[];
25
+ serverComponents: NapiScannedComponent[];
26
+ pages: NapiScannedComponent[];
27
+ layouts: NapiScannedComponent[];
28
+ apiRoutes: NapiScannedComponent[];
29
+ errors: NapiServerComponentError[];
30
+ totalFiles: number;
31
+ scanTimeMs: number;
32
+ }
33
+ export interface NapiClientModuleEntry {
34
+ id: string;
35
+ path: string;
36
+ absolutePath: string;
37
+ chunkName: string;
38
+ exports: string[];
39
+ asyncLoad: boolean;
40
+ }
41
+ export interface NapiClientManifest {
42
+ buildId: string;
43
+ clientModules: NapiClientModuleEntry[];
44
+ }
45
+ export interface NapiRouteEntry {
46
+ pattern: string;
47
+ pagePath: string;
48
+ layoutPaths: string[];
49
+ loadingPath: string | null;
50
+ errorPath: string | null;
51
+ routeType: string;
52
+ }
53
+ export interface NapiServerModuleEntry {
54
+ id: string;
55
+ path: string;
56
+ absolutePath: string;
57
+ componentType: string;
58
+ hasMetadata: boolean;
59
+ hasGenerateMetadata: boolean;
60
+ }
61
+ export interface NapiServerManifest {
62
+ buildId: string;
63
+ serverModules: NapiServerModuleEntry[];
64
+ routes: NapiRouteEntry[];
65
+ }
66
+ export interface NapiClientScanRoot {
67
+ dir: string;
68
+ prefix: string;
69
+ }
70
+ /**
71
+ * Check if native module is available
72
+ */
73
+ export declare function isNativeAvailable(): boolean;
74
+ /**
75
+ * Scan app directory using Rust native code
76
+ * Returns null if native module is not available
77
+ */
78
+ export declare function scanAppNative(appDir: string): NapiScanResult | null;
79
+ /**
80
+ * Generate client manifest using Rust native code
81
+ */
82
+ export declare function generateClientManifestNative(appDir: string, buildId: string): NapiClientManifest | null;
83
+ /**
84
+ * Generate client manifest from an explicit project root plus `app/`
85
+ */
86
+ export declare function generateClientManifestForProjectNative(cwd: string, appDir: string, buildId: string): NapiClientManifest | null;
87
+ /**
88
+ * Discover project-level client scan roots using Rust native code
89
+ */
90
+ export declare function discoverProjectClientRootsNative(cwd: string): NapiClientScanRoot[] | null;
91
+ /**
92
+ * Generate server manifest using Rust native code
93
+ */
94
+ export declare function generateServerManifestNative(appDir: string, buildId: string): NapiServerManifest | null;
95
+ /**
96
+ * Generate unique mount ID for client component
97
+ */
98
+ export declare function generateMountIdNative(): string | null;
99
+ /**
100
+ * Reset mount ID counter (call at start of each request)
101
+ */
102
+ export declare function resetMountCounterNative(): boolean;
103
+ /**
104
+ * Convert NAPI scan result to internal format
105
+ */
106
+ export declare function convertScanResult(result: NapiScanResult): {
107
+ clientComponents: {
108
+ absolutePath: string;
109
+ relativePath: string;
110
+ isClient: boolean;
111
+ directiveLine: number;
112
+ componentType: string;
113
+ exports: string[];
114
+ clientHooksUsed: string[];
115
+ hasMetadata: boolean;
116
+ hasGenerateMetadata: boolean;
117
+ }[];
118
+ serverComponents: {
119
+ absolutePath: string;
120
+ relativePath: string;
121
+ isClient: boolean;
122
+ directiveLine: number;
123
+ componentType: string;
124
+ exports: string[];
125
+ clientHooksUsed: any[];
126
+ hasMetadata: boolean;
127
+ hasGenerateMetadata: boolean;
128
+ }[];
129
+ pages: NapiScannedComponent[];
130
+ layouts: NapiScannedComponent[];
131
+ apiRoutes: NapiScannedComponent[];
132
+ errors: NapiServerComponentError[];
133
+ totalFiles: number;
134
+ scanTimeMs: number;
135
+ };