@vistagenic/vista 0.3.2 → 0.3.3
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 +79 -109
- package/dist/ai/embeddings.d.ts +11 -11
- package/dist/ai/embeddings.js +71 -71
- package/dist/ai/index.d.ts +10 -10
- package/dist/ai/index.js +26 -26
- package/dist/ai/providers/base.js +85 -85
- package/dist/ai/react/react-server.d.ts +1 -1
- package/dist/ai/react/react-server.js +17 -17
- package/dist/ai/react/use-agent.js +138 -138
- package/dist/auth/core.d.ts +140 -140
- package/dist/auth/core.js +165 -165
- package/dist/auth/index.d.ts +20 -20
- package/dist/auth/index.js +369 -369
- package/dist/auth/react-server.d.ts +1 -1
- package/dist/auth/react-server.js +10 -10
- package/dist/auth/react.d.ts +18 -18
- package/dist/auth/react.js +71 -71
- package/dist/bin/build-rsc-flashpack.js +6 -0
- package/dist/bin/build-rsc.js +537 -492
- package/dist/bin/build.js +355 -353
- package/dist/bin/generate.js +513 -510
- package/dist/bin/webpack.config.js +4 -3
- package/dist/build/manifest.d.ts +169 -169
- package/dist/build/manifest.js +423 -423
- package/dist/build/rsc/client-manifest.d.ts +62 -62
- package/dist/build/rsc/client-manifest.js +295 -295
- package/dist/build/rsc/compiler.js +5 -4
- package/dist/build/rsc/native-scanner.d.ts +135 -135
- package/dist/build/rsc/native-scanner.js +203 -203
- package/dist/build/rsc/react-client-reference-manifest.d.ts +28 -28
- package/dist/build/rsc/react-client-reference-manifest.js +240 -240
- package/dist/build/standalone.js +260 -254
- package/dist/client/dynamic.react-server.d.ts +2 -2
- package/dist/client/dynamic.react-server.js +23 -23
- package/dist/client/link.react-server.d.ts +2 -2
- package/dist/client/link.react-server.js +11 -11
- package/dist/client/navigation.react-server.d.ts +1 -1
- package/dist/client/navigation.react-server.js +17 -17
- package/dist/client/router.react-server.d.ts +1 -1
- package/dist/client/router.react-server.js +17 -17
- package/dist/client/rsc-router.react-server.d.ts +1 -1
- package/dist/client/rsc-router.react-server.js +17 -17
- package/dist/client/script.react-server.d.ts +2 -2
- package/dist/client/script.react-server.js +23 -23
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -7
- package/dist/deploy/adapters/cloudflare.js +43 -19
- package/dist/deploy/adapters/docker.d.ts +1 -0
- package/dist/deploy/adapters/docker.js +5 -4
- package/dist/deploy/adapters/netlify.js +62 -17
- package/dist/deploy/adapters/vercel.js +80 -50
- package/dist/deploy/preflight.js +4 -3
- package/dist/deploy/runtime-pack.d.ts +11 -0
- package/dist/deploy/runtime-pack.js +300 -0
- package/dist/deploy/utils.d.ts +1 -1
- package/dist/deploy/utils.js +31 -2
- package/dist/flashpack/command.js +1 -0
- package/dist/flashpack/runtime.js +2 -1
- package/dist/index.d.ts +23 -23
- package/dist/index.js +61 -61
- package/dist/server/app-dir.d.ts +22 -0
- package/dist/server/app-dir.js +77 -0
- package/dist/server/cookie-parse.d.ts +4 -4
- package/dist/server/cookie-parse.js +14 -14
- package/dist/server/engine.js +5 -5
- package/dist/server/image-optimizer.js +2 -1
- package/dist/server/index.d.ts +109 -109
- package/dist/server/index.js +315 -315
- package/dist/server/middleware-runner.d.ts +125 -125
- package/dist/server/middleware-runner.js +607 -615
- package/dist/server/middleware-security.d.ts +36 -36
- package/dist/server/middleware-security.js +183 -183
- package/dist/server/module-compile-hook.js +695 -695
- package/dist/server/root-resolver.js +6 -5
- package/dist/server/rsc-engine-flashpack.d.ts +3 -1
- package/dist/server/rsc-engine-flashpack.js +12 -1
- package/dist/server/rsc-engine.d.ts +6 -1
- package/dist/server/rsc-engine.js +203 -219
- package/dist/server/rsc-upstream.js +893 -892
- package/dist/server/static-generator.js +4 -3
- package/dist/server/structure-validator.js +2 -1
- package/dist/server/structure-watch.js +2 -0
- package/dist/server/typed-api-runtime.js +639 -635
- package/dist/server/vista-import-map.js +134 -134
- package/dist/stack/index.d.ts +34 -34
- package/dist/stack/index.js +49 -49
- package/dist/stack/server/caller.d.ts +13 -13
- package/dist/stack/server/caller.js +42 -42
- package/dist/stack/server/executor.d.ts +40 -40
- package/dist/stack/server/executor.js +222 -222
- package/dist/stack/server/index.d.ts +11 -11
- package/dist/stack/server/index.js +24 -24
- package/dist/stack/server/procedure.d.ts +20 -20
- package/dist/stack/server/procedure.js +66 -66
- package/dist/stack/server/types.d.ts +113 -113
- package/dist/theme/react-server.d.ts +10 -10
- package/dist/theme/react-server.js +16 -16
- package/package.json +1 -1
|
@@ -1,17 +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);
|
|
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);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './router';
|
|
1
|
+
export * from './router';
|
|
@@ -1,17 +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);
|
|
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);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './rsc-router';
|
|
1
|
+
export * from './rsc-router';
|
|
@@ -1,17 +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);
|
|
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);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './script';
|
|
2
|
-
export { default } from './script';
|
|
1
|
+
export * from './script';
|
|
2
|
+
export { default } from './script';
|
|
@@ -1,23 +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
|
+
"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; } });
|
package/dist/config.d.ts
CHANGED
|
@@ -87,5 +87,5 @@ export declare function resolveTypedApiConfig(config: VistaConfig): ResolvedType
|
|
|
87
87
|
export declare function resolveCacheComponentsConfig(config: VistaConfig): ResolvedCacheComponentsConfig;
|
|
88
88
|
export type ResolvedDeployConfig = Required<DeployConfig>;
|
|
89
89
|
export declare function resolveDeployConfig(config: VistaConfig): ResolvedDeployConfig;
|
|
90
|
-
export declare function inferDeployOutputForTarget(
|
|
90
|
+
export declare function inferDeployOutputForTarget(_target: Exclude<DeployTarget, 'auto'>): DeployOutput;
|
|
91
91
|
export declare function loadConfig(cwd?: string): VistaConfig;
|
package/dist/config.js
CHANGED
|
@@ -168,13 +168,7 @@ function resolveDeployConfig(config) {
|
|
|
168
168
|
preferBuildOutputApi: merged.preferBuildOutputApi !== false,
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function inferDeployOutputForTarget(
|
|
172
|
-
if (target === 'vercel' || target === 'cloudflare' || target === 'netlify') {
|
|
173
|
-
return 'static';
|
|
174
|
-
}
|
|
175
|
-
if (target === 'render' || target === 'docker') {
|
|
176
|
-
return 'standalone';
|
|
177
|
-
}
|
|
171
|
+
function inferDeployOutputForTarget(_target) {
|
|
178
172
|
return 'standalone';
|
|
179
173
|
}
|
|
180
174
|
function mergeConfig(userConfig) {
|
|
@@ -8,12 +8,14 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const cli_runner_1 = require("../cli-runner");
|
|
10
10
|
const preflight_1 = require("../preflight");
|
|
11
|
+
const runtime_pack_1 = require("../runtime-pack");
|
|
11
12
|
const utils_1 = require("../utils");
|
|
13
|
+
const docker_1 = require("./docker");
|
|
12
14
|
const CLOUDFLARE_OUTPUT_DIR = '.vista/deploy/cloudflare';
|
|
13
15
|
function getCloudflareOutputDir(ctx) {
|
|
14
16
|
return path_1.default.join(ctx.cwd, CLOUDFLARE_OUTPUT_DIR);
|
|
15
17
|
}
|
|
16
|
-
function
|
|
18
|
+
function writeStaticWranglerToml(ctx, outputDir) {
|
|
17
19
|
const targetFile = path_1.default.join(ctx.cwd, 'wrangler.toml');
|
|
18
20
|
const relativeOutput = path_1.default.relative(ctx.cwd, outputDir).replace(/\\/g, '/');
|
|
19
21
|
const content = `name = "my-vista-app"
|
|
@@ -47,26 +49,47 @@ function writeRedirects(outputDir) {
|
|
|
47
49
|
}
|
|
48
50
|
exports.cloudflareAdapter = {
|
|
49
51
|
id: 'cloudflare',
|
|
50
|
-
requiredOutput: '
|
|
51
|
-
supportsFullRuntime:
|
|
52
|
+
requiredOutput: 'standalone',
|
|
53
|
+
supportsFullRuntime: true,
|
|
52
54
|
async preflight(ctx) {
|
|
53
|
-
|
|
55
|
+
if ((0, runtime_pack_1.isStaticOnlyDeploy)(ctx)) {
|
|
56
|
+
return (0, preflight_1.runStaticHostPreflight)(ctx);
|
|
57
|
+
}
|
|
58
|
+
return (0, preflight_1.runStandalonePreflight)(ctx);
|
|
54
59
|
},
|
|
55
60
|
async emit(ctx) {
|
|
56
61
|
const outputDir = getCloudflareOutputDir(ctx);
|
|
57
62
|
fs_1.default.rmSync(outputDir, { recursive: true, force: true });
|
|
58
63
|
(0, utils_1.ensureDir)(outputDir);
|
|
64
|
+
if ((0, runtime_pack_1.isStaticOnlyDeploy)(ctx)) {
|
|
65
|
+
(0, utils_1.copyStaticHostAssets)(ctx.cwd, ctx.vistaDir, outputDir);
|
|
66
|
+
const routesPath = writeRoutesJson(outputDir);
|
|
67
|
+
const redirectsPath = writeRedirects(outputDir);
|
|
68
|
+
const wranglerPath = writeStaticWranglerToml(ctx, outputDir);
|
|
69
|
+
return {
|
|
70
|
+
status: 'emitted',
|
|
71
|
+
target: 'cloudflare',
|
|
72
|
+
artifactPaths: [outputDir, routesPath, redirectsPath, wranglerPath],
|
|
73
|
+
instructions: [
|
|
74
|
+
'Static mode: Cloudflare Pages serves pre-rendered output.',
|
|
75
|
+
'For Flight SSR, omit deploy.output "static" and use Cloudflare Containers.',
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
59
79
|
(0, utils_1.copyStaticHostAssets)(ctx.cwd, ctx.vistaDir, outputDir);
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
const
|
|
80
|
+
(0, runtime_pack_1.writeCloudflareContainerWorker)(outputDir);
|
|
81
|
+
const wranglerPath = (0, runtime_pack_1.writeCloudflareFullRuntimeToml)(ctx);
|
|
82
|
+
const dockerfilePath = path_1.default.join(ctx.cwd, 'Dockerfile');
|
|
83
|
+
(0, utils_1.writeFileIfAllowed)(dockerfilePath, docker_1.DOCKERFILE_TEMPLATE, ctx.force);
|
|
63
84
|
return {
|
|
64
85
|
status: 'emitted',
|
|
65
86
|
target: 'cloudflare',
|
|
66
|
-
artifactPaths: [outputDir,
|
|
87
|
+
artifactPaths: [outputDir, wranglerPath, dockerfilePath],
|
|
67
88
|
instructions: [
|
|
68
|
-
'Cloudflare
|
|
69
|
-
'
|
|
89
|
+
'Cloudflare Workers cannot spawn Vista’s Node Flight process.',
|
|
90
|
+
'Full SSR uses Cloudflare Containers (same Dockerfile as docker deploy).',
|
|
91
|
+
'Run: npx wrangler login && npx wrangler deploy --prod',
|
|
92
|
+
'Or build/run the Dockerfile on any Node host (Fly, Railway, Render).',
|
|
70
93
|
],
|
|
71
94
|
};
|
|
72
95
|
},
|
|
@@ -85,22 +108,22 @@ exports.cloudflareAdapter = {
|
|
|
85
108
|
};
|
|
86
109
|
}
|
|
87
110
|
const outputDir = getCloudflareOutputDir(ctx);
|
|
111
|
+
const staticOnly = (0, runtime_pack_1.isStaticOnlyDeploy)(ctx);
|
|
112
|
+
const wranglerCommand = staticOnly
|
|
113
|
+
? `wrangler pages deploy "${outputDir}" --project-name my-vista-app${ctx.prod ? '' : ' --branch preview'}`
|
|
114
|
+
: ctx.prod
|
|
115
|
+
? 'wrangler deploy --prod'
|
|
116
|
+
: 'wrangler deploy';
|
|
88
117
|
if (!(0, cli_runner_1.isCliAvailable)('wrangler')) {
|
|
89
118
|
return {
|
|
90
119
|
status: 'emitted',
|
|
91
120
|
target: 'cloudflare',
|
|
92
121
|
artifactPaths: emitted.artifactPaths,
|
|
93
122
|
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
|
-
],
|
|
123
|
+
instructions: emitted.instructions,
|
|
99
124
|
};
|
|
100
125
|
}
|
|
101
|
-
const
|
|
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 });
|
|
126
|
+
const result = (0, cli_runner_1.runCliCommand)(wranglerCommand, { cwd: ctx.cwd, dryRun: ctx.dryRun });
|
|
104
127
|
if (!result.ok) {
|
|
105
128
|
return {
|
|
106
129
|
status: 'emitted',
|
|
@@ -109,7 +132,8 @@ exports.cloudflareAdapter = {
|
|
|
109
132
|
warnings: [...warnings, result.stderr || 'Wrangler deploy failed.'],
|
|
110
133
|
instructions: [
|
|
111
134
|
'Run: wrangler login',
|
|
112
|
-
'Or set CLOUDFLARE_API_TOKEN
|
|
135
|
+
'Or set CLOUDFLARE_API_TOKEN.',
|
|
136
|
+
...(staticOnly ? [] : ['If Containers are unavailable, deploy the Dockerfile to Fly/Railway/Render.']),
|
|
113
137
|
],
|
|
114
138
|
};
|
|
115
139
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { DeployAdapter } from '../types';
|
|
2
|
+
export declare const DOCKERFILE_TEMPLATE = "# syntax=docker/dockerfile:1\n\nFROM node:20-alpine AS builder\nWORKDIR /app\nCOPY package.json package-lock.json* pnpm-lock.yaml* yarn.lock* ./\nRUN npm install --no-audit --no-fund\nCOPY . .\nRUN npm run build\n\nFROM node:20-alpine AS runner\nWORKDIR /app\nENV NODE_ENV=production\nENV PORT=3003\nCOPY --from=builder /app/package.json ./package.json\nCOPY --from=builder /app/node_modules ./node_modules\nCOPY --from=builder /app/.vista ./.vista\nEXPOSE 3003\nCMD [\"node\", \".vista/standalone/server.js\"]\n";
|
|
2
3
|
export declare const dockerAdapter: DeployAdapter;
|
|
@@ -3,12 +3,12 @@ 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.dockerAdapter = void 0;
|
|
6
|
+
exports.dockerAdapter = exports.DOCKERFILE_TEMPLATE = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const cli_runner_1 = require("../cli-runner");
|
|
9
9
|
const preflight_1 = require("../preflight");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
|
-
|
|
11
|
+
exports.DOCKERFILE_TEMPLATE = `# syntax=docker/dockerfile:1
|
|
12
12
|
|
|
13
13
|
FROM node:20-alpine AS builder
|
|
14
14
|
WORKDIR /app
|
|
@@ -21,8 +21,9 @@ FROM node:20-alpine AS runner
|
|
|
21
21
|
WORKDIR /app
|
|
22
22
|
ENV NODE_ENV=production
|
|
23
23
|
ENV PORT=3003
|
|
24
|
-
COPY --from=builder /app/.vista ./.vista
|
|
25
24
|
COPY --from=builder /app/package.json ./package.json
|
|
25
|
+
COPY --from=builder /app/node_modules ./node_modules
|
|
26
|
+
COPY --from=builder /app/.vista ./.vista
|
|
26
27
|
EXPOSE 3003
|
|
27
28
|
CMD ["node", ".vista/standalone/server.js"]
|
|
28
29
|
`;
|
|
@@ -47,7 +48,7 @@ exports.dockerAdapter = {
|
|
|
47
48
|
async emit(ctx) {
|
|
48
49
|
const dockerfilePath = path_1.default.join(ctx.cwd, 'Dockerfile');
|
|
49
50
|
const dockerignorePath = path_1.default.join(ctx.cwd, '.dockerignore');
|
|
50
|
-
(0, utils_1.writeFileIfAllowed)(dockerfilePath, DOCKERFILE_TEMPLATE, ctx.force);
|
|
51
|
+
(0, utils_1.writeFileIfAllowed)(dockerfilePath, exports.DOCKERFILE_TEMPLATE, ctx.force);
|
|
51
52
|
(0, utils_1.writeFileIfAllowed)(dockerignorePath, DOCKERIGNORE_TEMPLATE, ctx.force);
|
|
52
53
|
return {
|
|
53
54
|
status: 'emitted',
|
|
@@ -8,12 +8,13 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const cli_runner_1 = require("../cli-runner");
|
|
10
10
|
const preflight_1 = require("../preflight");
|
|
11
|
+
const runtime_pack_1 = require("../runtime-pack");
|
|
11
12
|
const utils_1 = require("../utils");
|
|
12
13
|
const NETLIFY_OUTPUT_DIR = '.vista/deploy/netlify';
|
|
13
14
|
function getNetlifyOutputDir(ctx) {
|
|
14
15
|
return path_1.default.join(ctx.cwd, NETLIFY_OUTPUT_DIR);
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function writeStaticNetlifyToml(ctx) {
|
|
17
18
|
const targetFile = path_1.default.join(ctx.cwd, 'netlify.toml');
|
|
18
19
|
const content = `[build]
|
|
19
20
|
command = "npm run build"
|
|
@@ -26,7 +27,35 @@ function writeNetlifyToml(ctx) {
|
|
|
26
27
|
(0, utils_1.writeFileIfAllowed)(targetFile, content, ctx.force);
|
|
27
28
|
return targetFile;
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function writeFullRuntimeNetlifyToml(ctx) {
|
|
31
|
+
const targetFile = path_1.default.join(ctx.cwd, 'netlify.toml');
|
|
32
|
+
const content = `[build]
|
|
33
|
+
command = "npm run build"
|
|
34
|
+
publish = ".vista/deploy/netlify"
|
|
35
|
+
functions = "netlify/functions"
|
|
36
|
+
|
|
37
|
+
[functions]
|
|
38
|
+
node_bundler = "none"
|
|
39
|
+
included_files = ["netlify/functions/.vista/**", "netlify/functions/node_modules/**"]
|
|
40
|
+
|
|
41
|
+
[dev]
|
|
42
|
+
command = "npm run dev"
|
|
43
|
+
port = 3003
|
|
44
|
+
|
|
45
|
+
[[redirects]]
|
|
46
|
+
from = "/_vista/*"
|
|
47
|
+
to = "/_vista/:splat"
|
|
48
|
+
status = 200
|
|
49
|
+
|
|
50
|
+
[[redirects]]
|
|
51
|
+
from = "/*"
|
|
52
|
+
to = "/.netlify/functions/ssr"
|
|
53
|
+
status = 200
|
|
54
|
+
`;
|
|
55
|
+
(0, utils_1.writeFileIfAllowed)(targetFile, content, ctx.force);
|
|
56
|
+
return targetFile;
|
|
57
|
+
}
|
|
58
|
+
function writeStaticRedirects(outputDir) {
|
|
30
59
|
const redirectsPath = path_1.default.join(outputDir, '_redirects');
|
|
31
60
|
const lines = [
|
|
32
61
|
'/_vista/* /:splat 200',
|
|
@@ -40,24 +69,44 @@ function writeRedirects(outputDir) {
|
|
|
40
69
|
}
|
|
41
70
|
exports.netlifyAdapter = {
|
|
42
71
|
id: 'netlify',
|
|
43
|
-
requiredOutput: '
|
|
44
|
-
supportsFullRuntime:
|
|
72
|
+
requiredOutput: 'standalone',
|
|
73
|
+
supportsFullRuntime: true,
|
|
45
74
|
async preflight(ctx) {
|
|
46
|
-
|
|
75
|
+
if ((0, runtime_pack_1.isStaticOnlyDeploy)(ctx)) {
|
|
76
|
+
return (0, preflight_1.runStaticHostPreflight)(ctx);
|
|
77
|
+
}
|
|
78
|
+
return (0, preflight_1.runStandalonePreflight)(ctx);
|
|
47
79
|
},
|
|
48
80
|
async emit(ctx) {
|
|
49
81
|
const outputDir = getNetlifyOutputDir(ctx);
|
|
50
82
|
fs_1.default.rmSync(outputDir, { recursive: true, force: true });
|
|
51
83
|
(0, utils_1.ensureDir)(outputDir);
|
|
84
|
+
if ((0, runtime_pack_1.isStaticOnlyDeploy)(ctx)) {
|
|
85
|
+
(0, utils_1.copyStaticHostAssets)(ctx.cwd, ctx.vistaDir, outputDir);
|
|
86
|
+
const redirectsPath = writeStaticRedirects(outputDir);
|
|
87
|
+
const netlifyTomlPath = writeStaticNetlifyToml(ctx);
|
|
88
|
+
return {
|
|
89
|
+
status: 'emitted',
|
|
90
|
+
target: 'netlify',
|
|
91
|
+
artifactPaths: [outputDir, redirectsPath, netlifyTomlPath],
|
|
92
|
+
instructions: ['Static mode: Netlify serves pre-rendered pages only.'],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
52
95
|
(0, utils_1.copyStaticHostAssets)(ctx.cwd, ctx.vistaDir, outputDir);
|
|
53
|
-
|
|
54
|
-
const
|
|
96
|
+
(0, utils_1.copyDirectoryRecursive)(path_1.default.join(ctx.vistaDir, 'static'), path_1.default.join(outputDir, '_vista', 'static'));
|
|
97
|
+
const functionDir = path_1.default.join(ctx.cwd, 'netlify', 'functions');
|
|
98
|
+
fs_1.default.rmSync(functionDir, { recursive: true, force: true });
|
|
99
|
+
(0, runtime_pack_1.writeNetlifySsrHandler)(functionDir);
|
|
100
|
+
(0, utils_1.copyDirectoryRecursive)(ctx.vistaDir, path_1.default.join(functionDir, '.vista'));
|
|
101
|
+
(0, runtime_pack_1.packRuntimeNodeModules)(ctx.cwd, functionDir);
|
|
102
|
+
const netlifyTomlPath = writeFullRuntimeNetlifyToml(ctx);
|
|
55
103
|
return {
|
|
56
104
|
status: 'emitted',
|
|
57
105
|
target: 'netlify',
|
|
58
|
-
artifactPaths: [outputDir,
|
|
106
|
+
artifactPaths: [outputDir, functionDir, netlifyTomlPath],
|
|
59
107
|
instructions: [
|
|
60
|
-
'Netlify
|
|
108
|
+
'Netlify Functions run the Vista Flight SSR server.',
|
|
109
|
+
'Deploy with: netlify deploy --prod --dir=".vista/deploy/netlify" --functions="netlify/functions"',
|
|
61
110
|
],
|
|
62
111
|
};
|
|
63
112
|
},
|
|
@@ -75,7 +124,6 @@ exports.netlifyAdapter = {
|
|
|
75
124
|
warnings: [...warnings, ...errors],
|
|
76
125
|
};
|
|
77
126
|
}
|
|
78
|
-
const outputDir = getNetlifyOutputDir(ctx);
|
|
79
127
|
if (!(0, cli_runner_1.isCliAvailable)('netlify')) {
|
|
80
128
|
return {
|
|
81
129
|
status: 'emitted',
|
|
@@ -84,13 +132,13 @@ exports.netlifyAdapter = {
|
|
|
84
132
|
warnings: [...warnings, 'Netlify CLI not found. Install with: npm i -g netlify-cli'],
|
|
85
133
|
instructions: [
|
|
86
134
|
'Install Netlify CLI: npm i -g netlify-cli',
|
|
87
|
-
|
|
135
|
+
'Then run: netlify deploy --prod --dir=".vista/deploy/netlify" --functions="netlify/functions"',
|
|
88
136
|
],
|
|
89
137
|
};
|
|
90
138
|
}
|
|
91
139
|
const command = ctx.prod
|
|
92
|
-
?
|
|
93
|
-
:
|
|
140
|
+
? 'netlify deploy --prod --dir=".vista/deploy/netlify" --functions="netlify/functions"'
|
|
141
|
+
: 'netlify deploy --dir=".vista/deploy/netlify" --functions="netlify/functions"';
|
|
94
142
|
const result = (0, cli_runner_1.runCliCommand)(command, { cwd: ctx.cwd, dryRun: ctx.dryRun });
|
|
95
143
|
if (!result.ok) {
|
|
96
144
|
return {
|
|
@@ -98,10 +146,7 @@ exports.netlifyAdapter = {
|
|
|
98
146
|
target: 'netlify',
|
|
99
147
|
artifactPaths: emitted.artifactPaths,
|
|
100
148
|
warnings: [...warnings, result.stderr || 'Netlify deploy failed.'],
|
|
101
|
-
instructions: [
|
|
102
|
-
'Run: netlify login',
|
|
103
|
-
'Or set NETLIFY_AUTH_TOKEN in your environment.',
|
|
104
|
-
],
|
|
149
|
+
instructions: ['Run: netlify login', 'Or set NETLIFY_AUTH_TOKEN.'],
|
|
105
150
|
};
|
|
106
151
|
}
|
|
107
152
|
return {
|