@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.
- package/bin/vista.js +184 -177
- package/dist/ai/agent.d.ts +37 -0
- package/dist/ai/agent.js +385 -0
- package/dist/ai/embeddings.d.ts +11 -0
- package/dist/ai/embeddings.js +71 -0
- package/dist/ai/index.d.ts +10 -0
- package/dist/ai/index.js +26 -0
- package/dist/ai/memory.d.ts +16 -0
- package/dist/ai/memory.js +39 -0
- package/dist/ai/observability.d.ts +21 -0
- package/dist/ai/observability.js +69 -0
- package/dist/ai/providers/anthropic.d.ts +2 -0
- package/dist/ai/providers/anthropic.js +190 -0
- package/dist/ai/providers/base.d.ts +7 -0
- package/dist/ai/providers/base.js +85 -0
- package/dist/ai/providers/gemini.d.ts +2 -0
- package/dist/ai/providers/gemini.js +194 -0
- package/dist/ai/providers/index.d.ts +5 -0
- package/dist/ai/providers/index.js +21 -0
- package/dist/ai/providers/mock.d.ts +8 -0
- package/dist/ai/providers/mock.js +77 -0
- package/dist/ai/providers/openai.d.ts +2 -0
- package/dist/ai/providers/openai.js +211 -0
- package/dist/ai/rag.d.ts +35 -0
- package/dist/ai/rag.js +110 -0
- package/dist/ai/react/index.d.ts +1 -0
- package/dist/ai/react/index.js +17 -0
- package/dist/ai/react/react-server.d.ts +1 -0
- package/dist/ai/react/react-server.js +17 -0
- package/dist/ai/react/use-agent.d.ts +23 -0
- package/dist/ai/react/use-agent.js +138 -0
- package/dist/ai/stream.d.ts +24 -0
- package/dist/ai/stream.js +109 -0
- package/dist/ai/tool.d.ts +11 -0
- package/dist/ai/tool.js +47 -0
- package/dist/ai/types.d.ts +117 -0
- package/dist/ai/types.js +5 -0
- package/dist/auth/core.d.ts +140 -0
- package/dist/auth/core.js +165 -0
- package/dist/auth/index.d.ts +20 -8
- package/dist/auth/index.js +369 -16
- package/dist/auth/react-server.d.ts +1 -0
- package/dist/auth/react-server.js +10 -0
- package/dist/auth/react.d.ts +18 -0
- package/dist/auth/react.js +71 -0
- package/dist/bin/build-rsc.js +602 -604
- package/dist/bin/build.js +389 -388
- package/dist/bin/deploy-output.d.ts +2 -7
- package/dist/bin/deploy-output.js +3 -76
- package/dist/bin/deploy.d.ts +7 -0
- package/dist/bin/deploy.js +102 -0
- package/dist/bin/dev-error-overlay-snippet.js +778 -552
- package/dist/bin/devtools-indicator-snippet.js +387 -387
- package/dist/bin/generate.js +510 -248
- package/dist/build/manifest.d.ts +169 -139
- package/dist/build/manifest.js +423 -367
- package/dist/build/rsc/client-manifest.d.ts +62 -52
- package/dist/build/rsc/client-manifest.js +295 -193
- package/dist/build/rsc/client-reference-plugin.d.ts +37 -37
- package/dist/build/rsc/client-reference-plugin.js +160 -160
- package/dist/build/rsc/native-scanner.d.ts +135 -123
- package/dist/build/rsc/native-scanner.js +203 -170
- package/dist/build/rsc/react-client-reference-manifest.d.ts +28 -22
- package/dist/build/rsc/react-client-reference-manifest.js +240 -219
- package/dist/build/rsc/rsc-renderer.d.ts +99 -99
- package/dist/build/rsc/rsc-renderer.js +263 -263
- package/dist/build/rsc/server-component-loader.d.ts +19 -19
- package/dist/build/rsc/server-component-loader.js +91 -91
- package/dist/build/rsc/server-manifest.d.ts +17 -0
- package/dist/build/rsc/server-manifest.js +20 -0
- package/dist/build/standalone.js +337 -334
- package/dist/build/webpack/plugins/vista-flight-plugin.js +5 -5
- package/dist/client/dynamic.react-server.d.ts +2 -0
- package/dist/client/dynamic.react-server.js +23 -0
- package/dist/client/link.react-server.d.ts +2 -0
- package/dist/client/link.react-server.js +11 -0
- package/dist/client/navigation.react-server.d.ts +1 -0
- package/dist/client/navigation.react-server.js +17 -0
- package/dist/client/router.react-server.d.ts +1 -0
- package/dist/client/router.react-server.js +17 -0
- package/dist/client/rsc-router.react-server.d.ts +1 -0
- package/dist/client/rsc-router.react-server.js +17 -0
- package/dist/client/script.react-server.d.ts +2 -0
- package/dist/client/script.react-server.js +23 -0
- package/dist/components/client-island.d.ts +34 -34
- package/dist/components/client-island.js +75 -75
- package/dist/config.d.ts +17 -0
- package/dist/config.js +60 -1
- package/dist/deploy/adapters/cloudflare.d.ts +2 -0
- package/dist/deploy/adapters/cloudflare.js +124 -0
- package/dist/deploy/adapters/docker.d.ts +2 -0
- package/dist/deploy/adapters/docker.js +112 -0
- package/dist/deploy/adapters/index.d.ts +15 -0
- package/dist/deploy/adapters/index.js +24 -0
- package/dist/deploy/adapters/netlify.d.ts +2 -0
- package/dist/deploy/adapters/netlify.js +115 -0
- package/dist/deploy/adapters/render.d.ts +2 -0
- package/dist/deploy/adapters/render.js +95 -0
- package/dist/deploy/adapters/vercel.d.ts +7 -0
- package/dist/deploy/adapters/vercel.js +164 -0
- package/dist/deploy/cli-runner.d.ts +8 -0
- package/dist/deploy/cli-runner.js +58 -0
- package/dist/deploy/detect.d.ts +6 -0
- package/dist/deploy/detect.js +77 -0
- package/dist/deploy/index.d.ts +24 -0
- package/dist/deploy/index.js +112 -0
- package/dist/deploy/preflight.d.ts +8 -0
- package/dist/deploy/preflight.js +80 -0
- package/dist/deploy/types.d.ts +48 -0
- package/dist/deploy/types.js +2 -0
- package/dist/deploy/utils.d.ts +18 -0
- package/dist/deploy/utils.js +70 -0
- package/dist/dev-error.d.ts +14 -0
- package/dist/dev-error.js +1763 -705
- package/dist/index.d.ts +23 -21
- package/dist/index.js +61 -57
- package/dist/server/cookie-parse.d.ts +4 -0
- package/dist/server/cookie-parse.js +14 -0
- package/dist/server/engine.js +7 -26
- package/dist/server/index.d.ts +109 -102
- package/dist/server/index.js +315 -286
- package/dist/server/middleware-runner.d.ts +125 -57
- package/dist/server/middleware-runner.js +615 -218
- package/dist/server/middleware-security.d.ts +36 -0
- package/dist/server/middleware-security.js +183 -0
- package/dist/server/module-compile-hook.js +695 -662
- package/dist/server/route-handler-registry.d.ts +65 -0
- package/dist/server/route-handler-registry.js +195 -0
- package/dist/server/route-patterns.d.ts +67 -0
- package/dist/server/route-patterns.js +186 -0
- package/dist/server/rsc-engine.js +75 -92
- package/dist/server/rsc-module-system.d.ts +33 -33
- package/dist/server/rsc-module-system.js +87 -87
- package/dist/server/rsc-upstream.js +892 -888
- package/dist/server/static-generator.js +10 -10
- package/dist/server/typed-api-runtime.d.ts +18 -0
- package/dist/server/typed-api-runtime.js +635 -507
- package/dist/server/vista-import-map.js +134 -123
- package/dist/stack/index.d.ts +34 -32
- package/dist/stack/index.js +49 -45
- package/dist/stack/server/caller.d.ts +13 -0
- package/dist/stack/server/caller.js +42 -0
- package/dist/stack/server/executor.d.ts +40 -36
- package/dist/stack/server/executor.js +222 -174
- package/dist/stack/server/index.d.ts +11 -10
- package/dist/stack/server/index.js +24 -23
- package/dist/stack/server/procedure.d.ts +20 -18
- package/dist/stack/server/procedure.js +66 -58
- package/dist/stack/server/types.d.ts +113 -100
- package/dist/theme/react-server.d.ts +10 -0
- package/dist/theme/react-server.js +16 -0
- package/package.json +28 -3
- package/LICENSE +0 -21
package/dist/build/standalone.js
CHANGED
|
@@ -1,334 +1,337 @@
|
|
|
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.generateStandaloneOutput = generateStandaloneOutput;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const url_1 = require("url");
|
|
10
|
-
const manifest_1 = require("./manifest");
|
|
11
|
-
const EXCLUDED_DIRECTORIES = new Set([
|
|
12
|
-
'.git',
|
|
13
|
-
'.vista',
|
|
14
|
-
'.flash',
|
|
15
|
-
'.turbo',
|
|
16
|
-
'.next',
|
|
17
|
-
'.vercel',
|
|
18
|
-
'node_modules',
|
|
19
|
-
'coverage',
|
|
20
|
-
]);
|
|
21
|
-
const EXCLUDED_FILE_SUFFIXES = ['.log', '.tsbuildinfo'];
|
|
22
|
-
function ensureDir(absolutePath) {
|
|
23
|
-
fs_1.default.mkdirSync(absolutePath, { recursive: true });
|
|
24
|
-
}
|
|
25
|
-
function isExcludedDirectory(name) {
|
|
26
|
-
return EXCLUDED_DIRECTORIES.has(name);
|
|
27
|
-
}
|
|
28
|
-
function isExcludedFile(name) {
|
|
29
|
-
return EXCLUDED_FILE_SUFFIXES.some((suffix) => name.endsWith(suffix));
|
|
30
|
-
}
|
|
31
|
-
function copyDirectoryRecursive(sourceDir, targetDir) {
|
|
32
|
-
if (!fs_1.default.existsSync(sourceDir)) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
ensureDir(targetDir);
|
|
36
|
-
for (const entry of fs_1.default.readdirSync(sourceDir, { withFileTypes: true })) {
|
|
37
|
-
if (entry.isDirectory()) {
|
|
38
|
-
copyDirectoryRecursive(path_1.default.join(sourceDir, entry.name), path_1.default.join(targetDir, entry.name));
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
if (!entry.isFile()) {
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
ensureDir(targetDir);
|
|
45
|
-
fs_1.default.copyFileSync(path_1.default.join(sourceDir, entry.name), path_1.default.join(targetDir, entry.name));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function copyProjectSnapshot(sourceRoot, targetRoot) {
|
|
49
|
-
const copiedFiles = [];
|
|
50
|
-
const copiedDirectories = [];
|
|
51
|
-
const visit = (currentSource, currentTarget) => {
|
|
52
|
-
ensureDir(currentTarget);
|
|
53
|
-
const relativeDir = path_1.default.relative(sourceRoot, currentSource) || '.';
|
|
54
|
-
copiedDirectories.push(relativeDir.replace(/\\/g, '/'));
|
|
55
|
-
for (const entry of fs_1.default.readdirSync(currentSource, { withFileTypes: true })) {
|
|
56
|
-
if (entry.isDirectory()) {
|
|
57
|
-
if (isExcludedDirectory(entry.name)) {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
visit(path_1.default.join(currentSource, entry.name), path_1.default.join(currentTarget, entry.name));
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
if (!entry.isFile() || isExcludedFile(entry.name)) {
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
const sourceFile = path_1.default.join(currentSource, entry.name);
|
|
67
|
-
const targetFile = path_1.default.join(currentTarget, entry.name);
|
|
68
|
-
ensureDir(path_1.default.dirname(targetFile));
|
|
69
|
-
fs_1.default.copyFileSync(sourceFile, targetFile);
|
|
70
|
-
copiedFiles.push(path_1.default.relative(sourceRoot, sourceFile).replace(/\\/g, '/'));
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
visit(sourceRoot, targetRoot);
|
|
74
|
-
copiedFiles.sort();
|
|
75
|
-
copiedDirectories.sort();
|
|
76
|
-
return { copiedFiles, copiedDirectories };
|
|
77
|
-
}
|
|
78
|
-
function resolveFrameworkDistRoot(cwd) {
|
|
79
|
-
const candidates = [];
|
|
80
|
-
try {
|
|
81
|
-
const packageJsonPath = require.resolve('@vistagenic/vista/package.json', { paths: [cwd] });
|
|
82
|
-
candidates.push(path_1.default.join(path_1.default.dirname(packageJsonPath), 'dist'));
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
// fall through
|
|
86
|
-
}
|
|
87
|
-
candidates.push(path_1.default.resolve(__dirname, '..', '..', 'dist'));
|
|
88
|
-
for (const candidate of candidates) {
|
|
89
|
-
if (fs_1.default.existsSync(candidate)) {
|
|
90
|
-
return candidate;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
throw new Error('[vista:build] Unable to locate the Vista runtime dist directory.');
|
|
94
|
-
}
|
|
95
|
-
function isWithinRoot(candidatePath, rootPath) {
|
|
96
|
-
const relative = path_1.default.relative(rootPath, candidatePath);
|
|
97
|
-
return relative === '' || (!relative.startsWith('..') && !path_1.default.isAbsolute(relative));
|
|
98
|
-
}
|
|
99
|
-
function rebaseAbsolutePath(absolutePath, context) {
|
|
100
|
-
const normalizedAbsolute = path_1.default.resolve(absolutePath);
|
|
101
|
-
if (isWithinRoot(normalizedAbsolute, context.projectRoot)) {
|
|
102
|
-
return path_1.default.join(context.runtimeRoot, path_1.default.relative(context.projectRoot, normalizedAbsolute));
|
|
103
|
-
}
|
|
104
|
-
if (isWithinRoot(normalizedAbsolute, context.frameworkDistRoot)) {
|
|
105
|
-
return path_1.default.join(context.frameworkRuntimeRoot, path_1.default.relative(context.frameworkDistRoot, normalizedAbsolute));
|
|
106
|
-
}
|
|
107
|
-
return absolutePath;
|
|
108
|
-
}
|
|
109
|
-
function rewriteStringValue(value, context) {
|
|
110
|
-
if (value.startsWith('file://')) {
|
|
111
|
-
try {
|
|
112
|
-
const parsed = new URL(value);
|
|
113
|
-
const preserveEmptyHash = value.endsWith('#') && parsed.hash === '';
|
|
114
|
-
const decoded = (0, url_1.fileURLToPath)(parsed);
|
|
115
|
-
const rebased = rebaseAbsolutePath(decoded, context);
|
|
116
|
-
if (rebased === decoded) {
|
|
117
|
-
return value;
|
|
118
|
-
}
|
|
119
|
-
const nextUrl = (0, url_1.pathToFileURL)(rebased);
|
|
120
|
-
nextUrl.hash = parsed.hash;
|
|
121
|
-
const rewritten = nextUrl
|
|
122
|
-
.toString()
|
|
123
|
-
.replace(/^file:\/\/\/([A-Z]):/, (_match, driveLetter) => {
|
|
124
|
-
return `file:///${driveLetter.toLowerCase()}:`;
|
|
125
|
-
});
|
|
126
|
-
return preserveEmptyHash && !rewritten.endsWith('#') ? `${rewritten}#` : rewritten;
|
|
127
|
-
}
|
|
128
|
-
catch {
|
|
129
|
-
return value;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (!path_1.default.isAbsolute(value)) {
|
|
133
|
-
return value;
|
|
134
|
-
}
|
|
135
|
-
const rebased = rebaseAbsolutePath(value, context);
|
|
136
|
-
if (rebased === value) {
|
|
137
|
-
return value;
|
|
138
|
-
}
|
|
139
|
-
if (value.includes('\\')) {
|
|
140
|
-
return rebased;
|
|
141
|
-
}
|
|
142
|
-
return rebased.replace(/\\/g, '/');
|
|
143
|
-
}
|
|
144
|
-
function rewriteManifestValue(value, context) {
|
|
145
|
-
if (typeof value === 'string') {
|
|
146
|
-
return rewriteStringValue(value, context);
|
|
147
|
-
}
|
|
148
|
-
if (Array.isArray(value)) {
|
|
149
|
-
return value.map((entry) => rewriteManifestValue(entry, context));
|
|
150
|
-
}
|
|
151
|
-
if (value && typeof value === 'object') {
|
|
152
|
-
const next = {};
|
|
153
|
-
for (const [rawKey, rawValue] of Object.entries(value)) {
|
|
154
|
-
const nextKey = rewriteStringValue(rawKey, context);
|
|
155
|
-
next[nextKey] = rewriteManifestValue(rawValue, context);
|
|
156
|
-
}
|
|
157
|
-
return next;
|
|
158
|
-
}
|
|
159
|
-
return value;
|
|
160
|
-
}
|
|
161
|
-
function writeJsonFile(absolutePath, payload) {
|
|
162
|
-
ensureDir(path_1.default.dirname(absolutePath));
|
|
163
|
-
fs_1.default.writeFileSync(absolutePath, JSON.stringify(payload, null, 2));
|
|
164
|
-
}
|
|
165
|
-
function writeStandaloneServerEntry(standaloneDir) {
|
|
166
|
-
const serverEntry = `#!/usr/bin/env node
|
|
167
|
-
const path = require('path');
|
|
168
|
-
const fs = require('fs');
|
|
169
|
-
const Module = require('module');
|
|
170
|
-
|
|
171
|
-
function normalizeEngine(value) {
|
|
172
|
-
const raw = String(value || '').trim().toLowerCase();
|
|
173
|
-
if (raw === 'flashpack') return 'flashpack';
|
|
174
|
-
if (raw === 'default' || raw === 'webpack') return 'default';
|
|
175
|
-
return 'default';
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function readRuntimeManifest(projectRoot) {
|
|
179
|
-
const manifestPath = path.join(projectRoot, '.vista', 'server', 'runtime-manifest.json');
|
|
180
|
-
try {
|
|
181
|
-
return JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
182
|
-
} catch {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function installDependencyRoots(projectRoot, manifest) {
|
|
188
|
-
const candidates = [];
|
|
189
|
-
let current = projectRoot;
|
|
190
|
-
while (true) {
|
|
191
|
-
candidates.push(path.join(current, 'node_modules'));
|
|
192
|
-
const parent = path.dirname(current);
|
|
193
|
-
if (parent === current) break;
|
|
194
|
-
current = parent;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
for (const relativePath of manifest?.dependencyRootsRelative || []) {
|
|
198
|
-
candidates.push(path.resolve(projectRoot, relativePath));
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const existing = candidates.filter((entry) => fs.existsSync(entry));
|
|
202
|
-
if (existing.length === 0) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const currentNodePath = process.env.NODE_PATH
|
|
207
|
-
? process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
|
|
208
|
-
: [];
|
|
209
|
-
const merged = Array.from(new Set([...existing, ...currentNodePath]));
|
|
210
|
-
process.env.NODE_PATH = merged.join(path.delimiter);
|
|
211
|
-
Module._initPaths();
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function startStandaloneServer(options = {}) {
|
|
215
|
-
const projectRoot = path.resolve(__dirname, '..', '..');
|
|
216
|
-
const runtimeRoot = path.join(__dirname, 'project');
|
|
217
|
-
const runtimeManifest = readRuntimeManifest(projectRoot);
|
|
218
|
-
const engine = normalizeEngine(
|
|
219
|
-
options.engine ||
|
|
220
|
-
process.env.VISTA_ENGINE ||
|
|
221
|
-
process.env.VISTA_ENGINE_VARIANT ||
|
|
222
|
-
(process.env.VISTA_FLASHPACK === 'true' ? 'flashpack' : '')
|
|
223
|
-
);
|
|
224
|
-
|
|
225
|
-
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
|
226
|
-
process.env.VISTA_ENGINE = engine;
|
|
227
|
-
process.env.VISTA_ENGINE_VARIANT = engine;
|
|
228
|
-
process.env.VISTA_FLASHPACK = engine === 'flashpack' ? 'true' : 'false';
|
|
229
|
-
process.env.VISTA_RUNTIME_ROOT = runtimeRoot;
|
|
230
|
-
process.env.VISTA_ARTIFACT_ROOT = projectRoot;
|
|
231
|
-
installDependencyRoots(projectRoot, runtimeManifest);
|
|
232
|
-
|
|
233
|
-
const runtimeEntry =
|
|
234
|
-
engine === 'flashpack'
|
|
235
|
-
? path.join(__dirname, 'runtime', 'vista', 'server', 'rsc-engine-flashpack.js')
|
|
236
|
-
: path.join(__dirname, 'runtime', 'vista', 'server', 'rsc-engine.js');
|
|
237
|
-
const runtime = require(runtimeEntry);
|
|
238
|
-
const start = runtime.startRSCServer || runtime.default;
|
|
239
|
-
start({
|
|
240
|
-
port: options.port || process.env.PORT || 3003,
|
|
241
|
-
projectRoot,
|
|
242
|
-
runtimeRoot,
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
module.exports = { startStandaloneServer };
|
|
247
|
-
|
|
248
|
-
if (require.main === module) {
|
|
249
|
-
startStandaloneServer();
|
|
250
|
-
}
|
|
251
|
-
`;
|
|
252
|
-
fs_1.default.writeFileSync(path_1.default.join(standaloneDir, 'server.js'), serverEntry, 'utf-8');
|
|
253
|
-
}
|
|
254
|
-
function generateStandaloneOutput(options) {
|
|
255
|
-
const { cwd, vistaDir, buildId, serverManifest, debug = false } = options;
|
|
256
|
-
const standaloneDir = path_1.default.join(vistaDir, 'standalone');
|
|
257
|
-
const runtimeProjectRoot = path_1.default.join(standaloneDir, 'project');
|
|
258
|
-
const frameworkRuntimeRoot = path_1.default.join(standaloneDir, 'runtime', 'vista');
|
|
259
|
-
const runtimeManifestPath = path_1.default.join(vistaDir, 'server', 'runtime-manifest.json');
|
|
260
|
-
const fileTracePath = path_1.default.join(vistaDir, 'server', 'file-trace.json');
|
|
261
|
-
fs_1.default.rmSync(standaloneDir, { recursive: true, force: true });
|
|
262
|
-
ensureDir(standaloneDir);
|
|
263
|
-
const snapshotTrace = copyProjectSnapshot(cwd, runtimeProjectRoot);
|
|
264
|
-
const frameworkDistRoot = resolveFrameworkDistRoot(cwd);
|
|
265
|
-
copyDirectoryRecursive(frameworkDistRoot, frameworkRuntimeRoot);
|
|
266
|
-
writeStandaloneServerEntry(standaloneDir);
|
|
267
|
-
const rewriteContext = {
|
|
268
|
-
projectRoot: cwd,
|
|
269
|
-
runtimeRoot: runtimeProjectRoot,
|
|
270
|
-
frameworkDistRoot,
|
|
271
|
-
frameworkRuntimeRoot,
|
|
272
|
-
};
|
|
273
|
-
const rebasedServerManifest = rewriteManifestValue(serverManifest, rewriteContext);
|
|
274
|
-
writeJsonFile(path_1.default.join(vistaDir, 'server', 'server-manifest.json'), rebasedServerManifest);
|
|
275
|
-
const manifestFiles = [
|
|
276
|
-
'client-manifest.json',
|
|
277
|
-
'app-path-routes-manifest.json',
|
|
278
|
-
'routes-manifest.json',
|
|
279
|
-
'react-client-manifest.json',
|
|
280
|
-
'react-server-manifest.json',
|
|
281
|
-
'react-ssr-manifest.json',
|
|
282
|
-
];
|
|
283
|
-
const rewrittenArtifacts = ['server/server-manifest.json'];
|
|
284
|
-
for (const relativePath of manifestFiles) {
|
|
285
|
-
const absolutePath = path_1.default.join(vistaDir, relativePath);
|
|
286
|
-
if (!fs_1.default.existsSync(absolutePath)) {
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
|
-
const payload = JSON.parse(fs_1.default.readFileSync(absolutePath, 'utf-8'));
|
|
290
|
-
writeJsonFile(absolutePath, rewriteManifestValue(payload, rewriteContext));
|
|
291
|
-
rewrittenArtifacts.push(relativePath);
|
|
292
|
-
}
|
|
293
|
-
const runtimeManifest = {
|
|
294
|
-
schemaVersion: 1,
|
|
295
|
-
buildId,
|
|
296
|
-
generatedAt: new Date().toISOString(),
|
|
297
|
-
runtimeRootRelative: path_1.default.relative(cwd, runtimeProjectRoot).replace(/\\/g, '/'),
|
|
298
|
-
frameworkRuntimeRelative: path_1.default.relative(cwd, frameworkRuntimeRoot).replace(/\\/g, '/'),
|
|
299
|
-
standaloneServerRelative: path_1.default.relative(cwd, path_1.default.join(standaloneDir, 'server.js')).replace(/\\/g, '/'),
|
|
300
|
-
fileTraceRelative: path_1.default.relative(cwd, fileTracePath).replace(/\\/g, '/'),
|
|
301
|
-
dependencyRootsRelative: [],
|
|
302
|
-
};
|
|
303
|
-
const frameworkNodeModules = path_1.default.join(path_1.default.dirname(frameworkDistRoot), 'node_modules');
|
|
304
|
-
if (fs_1.default.existsSync(frameworkNodeModules)) {
|
|
305
|
-
runtimeManifest.dependencyRootsRelative.push(path_1.default.relative(cwd, frameworkNodeModules).replace(/\\/g, '/'));
|
|
306
|
-
}
|
|
307
|
-
const fileTrace = {
|
|
308
|
-
schemaVersion: 1,
|
|
309
|
-
buildId,
|
|
310
|
-
generatedAt: new Date().toISOString(),
|
|
311
|
-
projectRoot: cwd,
|
|
312
|
-
runtimeRootRelative: runtimeManifest.runtimeRootRelative,
|
|
313
|
-
frameworkRuntimeRelative: runtimeManifest.frameworkRuntimeRelative,
|
|
314
|
-
copiedFiles: snapshotTrace.copiedFiles,
|
|
315
|
-
copiedDirectories: snapshotTrace.copiedDirectories,
|
|
316
|
-
rewrittenArtifacts,
|
|
317
|
-
};
|
|
318
|
-
writeJsonFile(runtimeManifestPath, runtimeManifest);
|
|
319
|
-
writeJsonFile(fileTracePath, fileTrace);
|
|
320
|
-
(0, manifest_1.
|
|
321
|
-
|
|
322
|
-
`${path_1.default.basename(vistaDir)}/server/
|
|
323
|
-
`${path_1.default.basename(vistaDir)}/
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
|
|
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.generateStandaloneOutput = generateStandaloneOutput;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const url_1 = require("url");
|
|
10
|
+
const manifest_1 = require("./manifest");
|
|
11
|
+
const EXCLUDED_DIRECTORIES = new Set([
|
|
12
|
+
'.git',
|
|
13
|
+
'.vista',
|
|
14
|
+
'.flash',
|
|
15
|
+
'.turbo',
|
|
16
|
+
'.next',
|
|
17
|
+
'.vercel',
|
|
18
|
+
'node_modules',
|
|
19
|
+
'coverage',
|
|
20
|
+
]);
|
|
21
|
+
const EXCLUDED_FILE_SUFFIXES = ['.log', '.tsbuildinfo'];
|
|
22
|
+
function ensureDir(absolutePath) {
|
|
23
|
+
fs_1.default.mkdirSync(absolutePath, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
function isExcludedDirectory(name) {
|
|
26
|
+
return EXCLUDED_DIRECTORIES.has(name);
|
|
27
|
+
}
|
|
28
|
+
function isExcludedFile(name) {
|
|
29
|
+
return EXCLUDED_FILE_SUFFIXES.some((suffix) => name.endsWith(suffix));
|
|
30
|
+
}
|
|
31
|
+
function copyDirectoryRecursive(sourceDir, targetDir) {
|
|
32
|
+
if (!fs_1.default.existsSync(sourceDir)) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
ensureDir(targetDir);
|
|
36
|
+
for (const entry of fs_1.default.readdirSync(sourceDir, { withFileTypes: true })) {
|
|
37
|
+
if (entry.isDirectory()) {
|
|
38
|
+
copyDirectoryRecursive(path_1.default.join(sourceDir, entry.name), path_1.default.join(targetDir, entry.name));
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (!entry.isFile()) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
ensureDir(targetDir);
|
|
45
|
+
fs_1.default.copyFileSync(path_1.default.join(sourceDir, entry.name), path_1.default.join(targetDir, entry.name));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function copyProjectSnapshot(sourceRoot, targetRoot) {
|
|
49
|
+
const copiedFiles = [];
|
|
50
|
+
const copiedDirectories = [];
|
|
51
|
+
const visit = (currentSource, currentTarget) => {
|
|
52
|
+
ensureDir(currentTarget);
|
|
53
|
+
const relativeDir = path_1.default.relative(sourceRoot, currentSource) || '.';
|
|
54
|
+
copiedDirectories.push(relativeDir.replace(/\\/g, '/'));
|
|
55
|
+
for (const entry of fs_1.default.readdirSync(currentSource, { withFileTypes: true })) {
|
|
56
|
+
if (entry.isDirectory()) {
|
|
57
|
+
if (isExcludedDirectory(entry.name)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
visit(path_1.default.join(currentSource, entry.name), path_1.default.join(currentTarget, entry.name));
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (!entry.isFile() || isExcludedFile(entry.name)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const sourceFile = path_1.default.join(currentSource, entry.name);
|
|
67
|
+
const targetFile = path_1.default.join(currentTarget, entry.name);
|
|
68
|
+
ensureDir(path_1.default.dirname(targetFile));
|
|
69
|
+
fs_1.default.copyFileSync(sourceFile, targetFile);
|
|
70
|
+
copiedFiles.push(path_1.default.relative(sourceRoot, sourceFile).replace(/\\/g, '/'));
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
visit(sourceRoot, targetRoot);
|
|
74
|
+
copiedFiles.sort();
|
|
75
|
+
copiedDirectories.sort();
|
|
76
|
+
return { copiedFiles, copiedDirectories };
|
|
77
|
+
}
|
|
78
|
+
function resolveFrameworkDistRoot(cwd) {
|
|
79
|
+
const candidates = [];
|
|
80
|
+
try {
|
|
81
|
+
const packageJsonPath = require.resolve('@vistagenic/vista/package.json', { paths: [cwd] });
|
|
82
|
+
candidates.push(path_1.default.join(path_1.default.dirname(packageJsonPath), 'dist'));
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// fall through
|
|
86
|
+
}
|
|
87
|
+
candidates.push(path_1.default.resolve(__dirname, '..', '..', 'dist'));
|
|
88
|
+
for (const candidate of candidates) {
|
|
89
|
+
if (fs_1.default.existsSync(candidate)) {
|
|
90
|
+
return candidate;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
throw new Error('[vista:build] Unable to locate the Vista runtime dist directory.');
|
|
94
|
+
}
|
|
95
|
+
function isWithinRoot(candidatePath, rootPath) {
|
|
96
|
+
const relative = path_1.default.relative(rootPath, candidatePath);
|
|
97
|
+
return relative === '' || (!relative.startsWith('..') && !path_1.default.isAbsolute(relative));
|
|
98
|
+
}
|
|
99
|
+
function rebaseAbsolutePath(absolutePath, context) {
|
|
100
|
+
const normalizedAbsolute = path_1.default.resolve(absolutePath);
|
|
101
|
+
if (isWithinRoot(normalizedAbsolute, context.projectRoot)) {
|
|
102
|
+
return path_1.default.join(context.runtimeRoot, path_1.default.relative(context.projectRoot, normalizedAbsolute));
|
|
103
|
+
}
|
|
104
|
+
if (isWithinRoot(normalizedAbsolute, context.frameworkDistRoot)) {
|
|
105
|
+
return path_1.default.join(context.frameworkRuntimeRoot, path_1.default.relative(context.frameworkDistRoot, normalizedAbsolute));
|
|
106
|
+
}
|
|
107
|
+
return absolutePath;
|
|
108
|
+
}
|
|
109
|
+
function rewriteStringValue(value, context) {
|
|
110
|
+
if (value.startsWith('file://')) {
|
|
111
|
+
try {
|
|
112
|
+
const parsed = new URL(value);
|
|
113
|
+
const preserveEmptyHash = value.endsWith('#') && parsed.hash === '';
|
|
114
|
+
const decoded = (0, url_1.fileURLToPath)(parsed);
|
|
115
|
+
const rebased = rebaseAbsolutePath(decoded, context);
|
|
116
|
+
if (rebased === decoded) {
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
119
|
+
const nextUrl = (0, url_1.pathToFileURL)(rebased);
|
|
120
|
+
nextUrl.hash = parsed.hash;
|
|
121
|
+
const rewritten = nextUrl
|
|
122
|
+
.toString()
|
|
123
|
+
.replace(/^file:\/\/\/([A-Z]):/, (_match, driveLetter) => {
|
|
124
|
+
return `file:///${driveLetter.toLowerCase()}:`;
|
|
125
|
+
});
|
|
126
|
+
return preserveEmptyHash && !rewritten.endsWith('#') ? `${rewritten}#` : rewritten;
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
return value;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (!path_1.default.isAbsolute(value)) {
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
const rebased = rebaseAbsolutePath(value, context);
|
|
136
|
+
if (rebased === value) {
|
|
137
|
+
return value;
|
|
138
|
+
}
|
|
139
|
+
if (value.includes('\\')) {
|
|
140
|
+
return rebased;
|
|
141
|
+
}
|
|
142
|
+
return rebased.replace(/\\/g, '/');
|
|
143
|
+
}
|
|
144
|
+
function rewriteManifestValue(value, context) {
|
|
145
|
+
if (typeof value === 'string') {
|
|
146
|
+
return rewriteStringValue(value, context);
|
|
147
|
+
}
|
|
148
|
+
if (Array.isArray(value)) {
|
|
149
|
+
return value.map((entry) => rewriteManifestValue(entry, context));
|
|
150
|
+
}
|
|
151
|
+
if (value && typeof value === 'object') {
|
|
152
|
+
const next = {};
|
|
153
|
+
for (const [rawKey, rawValue] of Object.entries(value)) {
|
|
154
|
+
const nextKey = rewriteStringValue(rawKey, context);
|
|
155
|
+
next[nextKey] = rewriteManifestValue(rawValue, context);
|
|
156
|
+
}
|
|
157
|
+
return next;
|
|
158
|
+
}
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
function writeJsonFile(absolutePath, payload) {
|
|
162
|
+
ensureDir(path_1.default.dirname(absolutePath));
|
|
163
|
+
fs_1.default.writeFileSync(absolutePath, JSON.stringify(payload, null, 2));
|
|
164
|
+
}
|
|
165
|
+
function writeStandaloneServerEntry(standaloneDir) {
|
|
166
|
+
const serverEntry = `#!/usr/bin/env node
|
|
167
|
+
const path = require('path');
|
|
168
|
+
const fs = require('fs');
|
|
169
|
+
const Module = require('module');
|
|
170
|
+
|
|
171
|
+
function normalizeEngine(value) {
|
|
172
|
+
const raw = String(value || '').trim().toLowerCase();
|
|
173
|
+
if (raw === 'flashpack') return 'flashpack';
|
|
174
|
+
if (raw === 'default' || raw === 'webpack') return 'default';
|
|
175
|
+
return 'default';
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function readRuntimeManifest(projectRoot) {
|
|
179
|
+
const manifestPath = path.join(projectRoot, '.vista', 'server', 'runtime-manifest.json');
|
|
180
|
+
try {
|
|
181
|
+
return JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
182
|
+
} catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function installDependencyRoots(projectRoot, manifest) {
|
|
188
|
+
const candidates = [];
|
|
189
|
+
let current = projectRoot;
|
|
190
|
+
while (true) {
|
|
191
|
+
candidates.push(path.join(current, 'node_modules'));
|
|
192
|
+
const parent = path.dirname(current);
|
|
193
|
+
if (parent === current) break;
|
|
194
|
+
current = parent;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
for (const relativePath of manifest?.dependencyRootsRelative || []) {
|
|
198
|
+
candidates.push(path.resolve(projectRoot, relativePath));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const existing = candidates.filter((entry) => fs.existsSync(entry));
|
|
202
|
+
if (existing.length === 0) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const currentNodePath = process.env.NODE_PATH
|
|
207
|
+
? process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
|
|
208
|
+
: [];
|
|
209
|
+
const merged = Array.from(new Set([...existing, ...currentNodePath]));
|
|
210
|
+
process.env.NODE_PATH = merged.join(path.delimiter);
|
|
211
|
+
Module._initPaths();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function startStandaloneServer(options = {}) {
|
|
215
|
+
const projectRoot = path.resolve(__dirname, '..', '..');
|
|
216
|
+
const runtimeRoot = path.join(__dirname, 'project');
|
|
217
|
+
const runtimeManifest = readRuntimeManifest(projectRoot);
|
|
218
|
+
const engine = normalizeEngine(
|
|
219
|
+
options.engine ||
|
|
220
|
+
process.env.VISTA_ENGINE ||
|
|
221
|
+
process.env.VISTA_ENGINE_VARIANT ||
|
|
222
|
+
(process.env.VISTA_FLASHPACK === 'true' ? 'flashpack' : '')
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
|
226
|
+
process.env.VISTA_ENGINE = engine;
|
|
227
|
+
process.env.VISTA_ENGINE_VARIANT = engine;
|
|
228
|
+
process.env.VISTA_FLASHPACK = engine === 'flashpack' ? 'true' : 'false';
|
|
229
|
+
process.env.VISTA_RUNTIME_ROOT = runtimeRoot;
|
|
230
|
+
process.env.VISTA_ARTIFACT_ROOT = projectRoot;
|
|
231
|
+
installDependencyRoots(projectRoot, runtimeManifest);
|
|
232
|
+
|
|
233
|
+
const runtimeEntry =
|
|
234
|
+
engine === 'flashpack'
|
|
235
|
+
? path.join(__dirname, 'runtime', 'vista', 'server', 'rsc-engine-flashpack.js')
|
|
236
|
+
: path.join(__dirname, 'runtime', 'vista', 'server', 'rsc-engine.js');
|
|
237
|
+
const runtime = require(runtimeEntry);
|
|
238
|
+
const start = runtime.startRSCServer || runtime.default;
|
|
239
|
+
start({
|
|
240
|
+
port: options.port || process.env.PORT || 3003,
|
|
241
|
+
projectRoot,
|
|
242
|
+
runtimeRoot,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
module.exports = { startStandaloneServer };
|
|
247
|
+
|
|
248
|
+
if (require.main === module) {
|
|
249
|
+
startStandaloneServer();
|
|
250
|
+
}
|
|
251
|
+
`;
|
|
252
|
+
fs_1.default.writeFileSync(path_1.default.join(standaloneDir, 'server.js'), serverEntry, 'utf-8');
|
|
253
|
+
}
|
|
254
|
+
function generateStandaloneOutput(options) {
|
|
255
|
+
const { cwd, vistaDir, buildId, serverManifest, debug = false } = options;
|
|
256
|
+
const standaloneDir = path_1.default.join(vistaDir, 'standalone');
|
|
257
|
+
const runtimeProjectRoot = path_1.default.join(standaloneDir, 'project');
|
|
258
|
+
const frameworkRuntimeRoot = path_1.default.join(standaloneDir, 'runtime', 'vista');
|
|
259
|
+
const runtimeManifestPath = path_1.default.join(vistaDir, 'server', 'runtime-manifest.json');
|
|
260
|
+
const fileTracePath = path_1.default.join(vistaDir, 'server', 'file-trace.json');
|
|
261
|
+
fs_1.default.rmSync(standaloneDir, { recursive: true, force: true });
|
|
262
|
+
ensureDir(standaloneDir);
|
|
263
|
+
const snapshotTrace = copyProjectSnapshot(cwd, runtimeProjectRoot);
|
|
264
|
+
const frameworkDistRoot = resolveFrameworkDistRoot(cwd);
|
|
265
|
+
copyDirectoryRecursive(frameworkDistRoot, frameworkRuntimeRoot);
|
|
266
|
+
writeStandaloneServerEntry(standaloneDir);
|
|
267
|
+
const rewriteContext = {
|
|
268
|
+
projectRoot: cwd,
|
|
269
|
+
runtimeRoot: runtimeProjectRoot,
|
|
270
|
+
frameworkDistRoot,
|
|
271
|
+
frameworkRuntimeRoot,
|
|
272
|
+
};
|
|
273
|
+
const rebasedServerManifest = rewriteManifestValue(serverManifest, rewriteContext);
|
|
274
|
+
writeJsonFile(path_1.default.join(vistaDir, 'server', 'server-manifest.json'), rebasedServerManifest);
|
|
275
|
+
const manifestFiles = [
|
|
276
|
+
'client-manifest.json',
|
|
277
|
+
'app-path-routes-manifest.json',
|
|
278
|
+
'routes-manifest.json',
|
|
279
|
+
'react-client-manifest.json',
|
|
280
|
+
'react-server-manifest.json',
|
|
281
|
+
'react-ssr-manifest.json',
|
|
282
|
+
];
|
|
283
|
+
const rewrittenArtifacts = ['server/server-manifest.json'];
|
|
284
|
+
for (const relativePath of manifestFiles) {
|
|
285
|
+
const absolutePath = path_1.default.join(vistaDir, relativePath);
|
|
286
|
+
if (!fs_1.default.existsSync(absolutePath)) {
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
const payload = JSON.parse(fs_1.default.readFileSync(absolutePath, 'utf-8'));
|
|
290
|
+
writeJsonFile(absolutePath, rewriteManifestValue(payload, rewriteContext));
|
|
291
|
+
rewrittenArtifacts.push(relativePath);
|
|
292
|
+
}
|
|
293
|
+
const runtimeManifest = {
|
|
294
|
+
schemaVersion: 1,
|
|
295
|
+
buildId,
|
|
296
|
+
generatedAt: new Date().toISOString(),
|
|
297
|
+
runtimeRootRelative: path_1.default.relative(cwd, runtimeProjectRoot).replace(/\\/g, '/'),
|
|
298
|
+
frameworkRuntimeRelative: path_1.default.relative(cwd, frameworkRuntimeRoot).replace(/\\/g, '/'),
|
|
299
|
+
standaloneServerRelative: path_1.default.relative(cwd, path_1.default.join(standaloneDir, 'server.js')).replace(/\\/g, '/'),
|
|
300
|
+
fileTraceRelative: path_1.default.relative(cwd, fileTracePath).replace(/\\/g, '/'),
|
|
301
|
+
dependencyRootsRelative: [],
|
|
302
|
+
};
|
|
303
|
+
const frameworkNodeModules = path_1.default.join(path_1.default.dirname(frameworkDistRoot), 'node_modules');
|
|
304
|
+
if (fs_1.default.existsSync(frameworkNodeModules)) {
|
|
305
|
+
runtimeManifest.dependencyRootsRelative.push(path_1.default.relative(cwd, frameworkNodeModules).replace(/\\/g, '/'));
|
|
306
|
+
}
|
|
307
|
+
const fileTrace = {
|
|
308
|
+
schemaVersion: 1,
|
|
309
|
+
buildId,
|
|
310
|
+
generatedAt: new Date().toISOString(),
|
|
311
|
+
projectRoot: cwd,
|
|
312
|
+
runtimeRootRelative: runtimeManifest.runtimeRootRelative,
|
|
313
|
+
frameworkRuntimeRelative: runtimeManifest.frameworkRuntimeRelative,
|
|
314
|
+
copiedFiles: snapshotTrace.copiedFiles,
|
|
315
|
+
copiedDirectories: snapshotTrace.copiedDirectories,
|
|
316
|
+
rewrittenArtifacts,
|
|
317
|
+
};
|
|
318
|
+
writeJsonFile(runtimeManifestPath, runtimeManifest);
|
|
319
|
+
writeJsonFile(fileTracePath, fileTrace);
|
|
320
|
+
(0, manifest_1.writeVistaTrace)(vistaDir, fileTrace);
|
|
321
|
+
(0, manifest_1.generateRequiredServerFilesManifest)(cwd, vistaDir, [
|
|
322
|
+
`${path_1.default.basename(vistaDir)}/server/runtime-manifest.json`,
|
|
323
|
+
`${path_1.default.basename(vistaDir)}/server/file-trace.json`,
|
|
324
|
+
`${path_1.default.basename(vistaDir)}/standalone/server.js`,
|
|
325
|
+
], runtimeProjectRoot);
|
|
326
|
+
(0, manifest_1.writeArtifactManifest)(vistaDir, buildId, {
|
|
327
|
+
serverManifest: 'server/server-manifest.json',
|
|
328
|
+
runtimeManifest: 'server/runtime-manifest.json',
|
|
329
|
+
fileTrace: 'server/file-trace.json',
|
|
330
|
+
standaloneServer: 'standalone/server.js',
|
|
331
|
+
types: 'types/routes.d.ts',
|
|
332
|
+
trace: 'trace',
|
|
333
|
+
});
|
|
334
|
+
if (debug) {
|
|
335
|
+
console.log(`[vista:build] Standalone output ready (${snapshotTrace.copiedFiles.length} files, ${snapshotTrace.copiedDirectories.length} directories)`);
|
|
336
|
+
}
|
|
337
|
+
}
|