@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
package/dist/index.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
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.NextResponse = exports.callServer = exports.useRSCRouter = exports.RSCRouterContext = exports.RSCRouter = exports.Client = exports.initializeHydration = exports.hydrateClientComponents = exports.generateMetadataHead = exports.Head = exports.Script = exports.dynamic = exports.useSelectedLayoutSegments = exports.useSelectedLayoutSegment = exports.useParams = exports.useSearchParams = exports.usePathname = exports.useRouter = void 0;
|
|
21
|
-
__exportStar(require("./router"), exports);
|
|
22
|
-
__exportStar(require("./components"), exports);
|
|
23
|
-
__exportStar(require("./types"), exports);
|
|
24
|
-
__exportStar(require("./dev-error"), exports);
|
|
25
|
-
// Client-side features
|
|
26
|
-
var router_1 = require("./client/router");
|
|
27
|
-
Object.defineProperty(exports, "useRouter", { enumerable: true, get: function () { return router_1.useRouter; } });
|
|
28
|
-
var navigation_1 = require("./client/navigation");
|
|
29
|
-
Object.defineProperty(exports, "usePathname", { enumerable: true, get: function () { return navigation_1.usePathname; } });
|
|
30
|
-
Object.defineProperty(exports, "useSearchParams", { enumerable: true, get: function () { return navigation_1.useSearchParams; } });
|
|
31
|
-
Object.defineProperty(exports, "useParams", { enumerable: true, get: function () { return navigation_1.useParams; } });
|
|
32
|
-
Object.defineProperty(exports, "useSelectedLayoutSegment", { enumerable: true, get: function () { return navigation_1.useSelectedLayoutSegment; } });
|
|
33
|
-
Object.defineProperty(exports, "useSelectedLayoutSegments", { enumerable: true, get: function () { return navigation_1.useSelectedLayoutSegments; } });
|
|
34
|
-
var dynamic_1 = require("./client/dynamic");
|
|
35
|
-
Object.defineProperty(exports, "dynamic", { enumerable: true, get: function () { return __importDefault(dynamic_1).default; } });
|
|
36
|
-
var script_1 = require("./client/script");
|
|
37
|
-
Object.defineProperty(exports, "Script", { enumerable: true, get: function () { return __importDefault(script_1).default; } });
|
|
38
|
-
var head_1 = require("./client/head");
|
|
39
|
-
Object.defineProperty(exports, "Head", { enumerable: true, get: function () { return __importDefault(head_1).default; } });
|
|
40
|
-
Object.defineProperty(exports, "generateMetadataHead", { enumerable: true, get: function () { return head_1.generateMetadataHead; } });
|
|
41
|
-
// Font exports
|
|
42
|
-
__exportStar(require("./font/index"), exports);
|
|
43
|
-
// Metadata exports (Next.js compatible)
|
|
44
|
-
__exportStar(require("./metadata"), exports);
|
|
45
|
-
// RSC (React Server Components) exports
|
|
46
|
-
var hydration_1 = require("./client/hydration");
|
|
47
|
-
Object.defineProperty(exports, "hydrateClientComponents", { enumerable: true, get: function () { return hydration_1.hydrateClientComponents; } });
|
|
48
|
-
Object.defineProperty(exports, "initializeHydration", { enumerable: true, get: function () { return hydration_1.initializeHydration; } });
|
|
49
|
-
var client_1 = require("./components/client");
|
|
50
|
-
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
|
|
51
|
-
var rsc_router_1 = require("./client/rsc-router");
|
|
52
|
-
Object.defineProperty(exports, "RSCRouter", { enumerable: true, get: function () { return rsc_router_1.RSCRouter; } });
|
|
53
|
-
Object.defineProperty(exports, "RSCRouterContext", { enumerable: true, get: function () { return rsc_router_1.RSCRouterContext; } });
|
|
54
|
-
Object.defineProperty(exports, "useRSCRouter", { enumerable: true, get: function () { return rsc_router_1.useRSCRouter; } });
|
|
55
|
-
var server_actions_1 = require("./client/server-actions");
|
|
56
|
-
Object.defineProperty(exports, "callServer", { enumerable: true, get: function () { return server_actions_1.callServer; } });
|
|
57
|
-
// Server & Middleware exports
|
|
58
|
-
var index_1 = require("./server/index");
|
|
59
|
-
Object.defineProperty(exports, "NextResponse", { enumerable: true, get: function () { return index_1.NextResponse; } });
|
|
60
|
-
// AI Framework
|
|
61
|
-
__exportStar(require("./ai"), 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
|
+
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.NextResponse = exports.callServer = exports.useRSCRouter = exports.RSCRouterContext = exports.RSCRouter = exports.Client = exports.initializeHydration = exports.hydrateClientComponents = exports.generateMetadataHead = exports.Head = exports.Script = exports.dynamic = exports.useSelectedLayoutSegments = exports.useSelectedLayoutSegment = exports.useParams = exports.useSearchParams = exports.usePathname = exports.useRouter = void 0;
|
|
21
|
+
__exportStar(require("./router"), exports);
|
|
22
|
+
__exportStar(require("./components"), exports);
|
|
23
|
+
__exportStar(require("./types"), exports);
|
|
24
|
+
__exportStar(require("./dev-error"), exports);
|
|
25
|
+
// Client-side features
|
|
26
|
+
var router_1 = require("./client/router");
|
|
27
|
+
Object.defineProperty(exports, "useRouter", { enumerable: true, get: function () { return router_1.useRouter; } });
|
|
28
|
+
var navigation_1 = require("./client/navigation");
|
|
29
|
+
Object.defineProperty(exports, "usePathname", { enumerable: true, get: function () { return navigation_1.usePathname; } });
|
|
30
|
+
Object.defineProperty(exports, "useSearchParams", { enumerable: true, get: function () { return navigation_1.useSearchParams; } });
|
|
31
|
+
Object.defineProperty(exports, "useParams", { enumerable: true, get: function () { return navigation_1.useParams; } });
|
|
32
|
+
Object.defineProperty(exports, "useSelectedLayoutSegment", { enumerable: true, get: function () { return navigation_1.useSelectedLayoutSegment; } });
|
|
33
|
+
Object.defineProperty(exports, "useSelectedLayoutSegments", { enumerable: true, get: function () { return navigation_1.useSelectedLayoutSegments; } });
|
|
34
|
+
var dynamic_1 = require("./client/dynamic");
|
|
35
|
+
Object.defineProperty(exports, "dynamic", { enumerable: true, get: function () { return __importDefault(dynamic_1).default; } });
|
|
36
|
+
var script_1 = require("./client/script");
|
|
37
|
+
Object.defineProperty(exports, "Script", { enumerable: true, get: function () { return __importDefault(script_1).default; } });
|
|
38
|
+
var head_1 = require("./client/head");
|
|
39
|
+
Object.defineProperty(exports, "Head", { enumerable: true, get: function () { return __importDefault(head_1).default; } });
|
|
40
|
+
Object.defineProperty(exports, "generateMetadataHead", { enumerable: true, get: function () { return head_1.generateMetadataHead; } });
|
|
41
|
+
// Font exports
|
|
42
|
+
__exportStar(require("./font/index"), exports);
|
|
43
|
+
// Metadata exports (Next.js compatible)
|
|
44
|
+
__exportStar(require("./metadata"), exports);
|
|
45
|
+
// RSC (React Server Components) exports
|
|
46
|
+
var hydration_1 = require("./client/hydration");
|
|
47
|
+
Object.defineProperty(exports, "hydrateClientComponents", { enumerable: true, get: function () { return hydration_1.hydrateClientComponents; } });
|
|
48
|
+
Object.defineProperty(exports, "initializeHydration", { enumerable: true, get: function () { return hydration_1.initializeHydration; } });
|
|
49
|
+
var client_1 = require("./components/client");
|
|
50
|
+
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } });
|
|
51
|
+
var rsc_router_1 = require("./client/rsc-router");
|
|
52
|
+
Object.defineProperty(exports, "RSCRouter", { enumerable: true, get: function () { return rsc_router_1.RSCRouter; } });
|
|
53
|
+
Object.defineProperty(exports, "RSCRouterContext", { enumerable: true, get: function () { return rsc_router_1.RSCRouterContext; } });
|
|
54
|
+
Object.defineProperty(exports, "useRSCRouter", { enumerable: true, get: function () { return rsc_router_1.useRSCRouter; } });
|
|
55
|
+
var server_actions_1 = require("./client/server-actions");
|
|
56
|
+
Object.defineProperty(exports, "callServer", { enumerable: true, get: function () { return server_actions_1.callServer; } });
|
|
57
|
+
// Server & Middleware exports
|
|
58
|
+
var index_1 = require("./server/index");
|
|
59
|
+
Object.defineProperty(exports, "NextResponse", { enumerable: true, get: function () { return index_1.NextResponse; } });
|
|
60
|
+
// AI Framework
|
|
61
|
+
__exportStar(require("./ai"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the App Router source directory.
|
|
3
|
+
*
|
|
4
|
+
* Supports both layouts (Next-compatible):
|
|
5
|
+
* - `<cwd>/app`
|
|
6
|
+
* - `<cwd>/src/app`
|
|
7
|
+
*
|
|
8
|
+
* Preference when both exist: root `app/` (matches existing middleware discovery).
|
|
9
|
+
* When neither exists, returns `<cwd>/app` so callers can emit a clear missing-app error.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveAppDir(cwd: string): string;
|
|
12
|
+
/** Like resolveAppDir, but returns null when no app directory exists yet. */
|
|
13
|
+
export declare function resolveAppDirOrNull(cwd: string): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* True when the resolved app dir lives under `src/` (i.e. `src/app`).
|
|
16
|
+
*/
|
|
17
|
+
export declare function isSrcAppLayout(cwd: string, appDir?: string): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Shared UI directory paired with the app layout.
|
|
20
|
+
* Prefers `src/components` for `src/app` projects, otherwise root `components/`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveComponentsDir(cwd: string): string;
|
|
@@ -0,0 +1,77 @@
|
|
|
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.resolveAppDir = resolveAppDir;
|
|
7
|
+
exports.resolveAppDirOrNull = resolveAppDirOrNull;
|
|
8
|
+
exports.isSrcAppLayout = isSrcAppLayout;
|
|
9
|
+
exports.resolveComponentsDir = resolveComponentsDir;
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
const path_1 = __importDefault(require("path"));
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the App Router source directory.
|
|
14
|
+
*
|
|
15
|
+
* Supports both layouts (Next-compatible):
|
|
16
|
+
* - `<cwd>/app`
|
|
17
|
+
* - `<cwd>/src/app`
|
|
18
|
+
*
|
|
19
|
+
* Preference when both exist: root `app/` (matches existing middleware discovery).
|
|
20
|
+
* When neither exists, returns `<cwd>/app` so callers can emit a clear missing-app error.
|
|
21
|
+
*/
|
|
22
|
+
function resolveAppDir(cwd) {
|
|
23
|
+
const rootApp = path_1.default.join(cwd, 'app');
|
|
24
|
+
const srcApp = path_1.default.join(cwd, 'src', 'app');
|
|
25
|
+
if (isDirectory(rootApp))
|
|
26
|
+
return rootApp;
|
|
27
|
+
if (isDirectory(srcApp))
|
|
28
|
+
return srcApp;
|
|
29
|
+
return rootApp;
|
|
30
|
+
}
|
|
31
|
+
/** Like resolveAppDir, but returns null when no app directory exists yet. */
|
|
32
|
+
function resolveAppDirOrNull(cwd) {
|
|
33
|
+
const rootApp = path_1.default.join(cwd, 'app');
|
|
34
|
+
const srcApp = path_1.default.join(cwd, 'src', 'app');
|
|
35
|
+
if (isDirectory(rootApp))
|
|
36
|
+
return rootApp;
|
|
37
|
+
if (isDirectory(srcApp))
|
|
38
|
+
return srcApp;
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* True when the resolved app dir lives under `src/` (i.e. `src/app`).
|
|
43
|
+
*/
|
|
44
|
+
function isSrcAppLayout(cwd, appDir = resolveAppDir(cwd)) {
|
|
45
|
+
const relative = path_1.default.relative(cwd, appDir).replace(/\\/g, '/');
|
|
46
|
+
return relative === 'src/app' || relative.startsWith('src/app/');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Shared UI directory paired with the app layout.
|
|
50
|
+
* Prefers `src/components` for `src/app` projects, otherwise root `components/`.
|
|
51
|
+
*/
|
|
52
|
+
function resolveComponentsDir(cwd) {
|
|
53
|
+
const appDir = resolveAppDirOrNull(cwd);
|
|
54
|
+
const preferSrc = appDir ? isSrcAppLayout(cwd, appDir) : false;
|
|
55
|
+
const srcComponents = path_1.default.join(cwd, 'src', 'components');
|
|
56
|
+
const rootComponents = path_1.default.join(cwd, 'components');
|
|
57
|
+
if (preferSrc) {
|
|
58
|
+
if (isDirectory(srcComponents))
|
|
59
|
+
return srcComponents;
|
|
60
|
+
if (isDirectory(rootComponents))
|
|
61
|
+
return rootComponents;
|
|
62
|
+
return srcComponents;
|
|
63
|
+
}
|
|
64
|
+
if (isDirectory(rootComponents))
|
|
65
|
+
return rootComponents;
|
|
66
|
+
if (isDirectory(srcComponents))
|
|
67
|
+
return srcComponents;
|
|
68
|
+
return rootComponents;
|
|
69
|
+
}
|
|
70
|
+
function isDirectory(absolutePath) {
|
|
71
|
+
try {
|
|
72
|
+
return fs_1.default.existsSync(absolutePath) && fs_1.default.statSync(absolutePath).isDirectory();
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decode a cookie value without throwing on malformed % sequences.
|
|
3
|
-
*/
|
|
4
|
-
export declare function safeDecodeURIComponent(value: string): string;
|
|
1
|
+
/**
|
|
2
|
+
* Decode a cookie value without throwing on malformed % sequences.
|
|
3
|
+
*/
|
|
4
|
+
export declare function safeDecodeURIComponent(value: string): string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.safeDecodeURIComponent = safeDecodeURIComponent;
|
|
4
|
-
/**
|
|
5
|
-
* Decode a cookie value without throwing on malformed % sequences.
|
|
6
|
-
*/
|
|
7
|
-
function safeDecodeURIComponent(value) {
|
|
8
|
-
try {
|
|
9
|
-
return decodeURIComponent(value);
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.safeDecodeURIComponent = safeDecodeURIComponent;
|
|
4
|
+
/**
|
|
5
|
+
* Decode a cookie value without throwing on malformed % sequences.
|
|
6
|
+
*/
|
|
7
|
+
function safeDecodeURIComponent(value) {
|
|
8
|
+
try {
|
|
9
|
+
return decodeURIComponent(value);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/dist/server/engine.js
CHANGED
|
@@ -31,6 +31,7 @@ const logger_1 = require("./logger");
|
|
|
31
31
|
const structure_log_1 = require("./structure-log");
|
|
32
32
|
const module_compile_hook_1 = require("./module-compile-hook");
|
|
33
33
|
const request_context_1 = require("./request-context");
|
|
34
|
+
const app_dir_1 = require("./app-dir");
|
|
34
35
|
// Support CSS imports on server runtime
|
|
35
36
|
// - Regular .css: ignored (handled by PostCSS)
|
|
36
37
|
// - .module.css: return empty class mapping (webpack build handles real mappings)
|
|
@@ -109,7 +110,7 @@ function initClientComponentRegistry(appDir, cwd) {
|
|
|
109
110
|
try {
|
|
110
111
|
clientComponentIdsByPath.clear();
|
|
111
112
|
const appCount = registerClientComponents(appDir);
|
|
112
|
-
const componentsCount = registerClientComponents(
|
|
113
|
+
const componentsCount = registerClientComponents((0, app_dir_1.resolveComponentsDir)(cwd), 'components/');
|
|
113
114
|
if (process.env.VISTA_DEBUG) {
|
|
114
115
|
console.log(`[Vista JS RSC] Registered ${clientComponentIdsByPath.size} client component(s) for hydration wrapping (app=${appCount}, components=${componentsCount})`);
|
|
115
116
|
}
|
|
@@ -213,7 +214,7 @@ function startServer(port = 3003, compiler) {
|
|
|
213
214
|
const engineVariant = (0, config_1.resolveAndApplyEngineVariant)(vistaConfig);
|
|
214
215
|
const typedApiConfig = (0, config_1.resolveTypedApiConfig)(vistaConfig);
|
|
215
216
|
const isDev = process.env.NODE_ENV !== 'production';
|
|
216
|
-
const appDir =
|
|
217
|
+
const appDir = (0, app_dir_1.resolveAppDir)(cwd);
|
|
217
218
|
if (process.env.VISTA_DEBUG) {
|
|
218
219
|
(0, logger_1.logInfo)(`Engine variant: ${engineVariant}`);
|
|
219
220
|
}
|
|
@@ -524,8 +525,8 @@ function startServer(port = 3003, compiler) {
|
|
|
524
525
|
// Route Matching Logic
|
|
525
526
|
const getExactPath = (p) => {
|
|
526
527
|
if (p === '/' || p === '/index')
|
|
527
|
-
return path_1.default.
|
|
528
|
-
return path_1.default.
|
|
528
|
+
return path_1.default.join(appDir, 'index.tsx');
|
|
529
|
+
return path_1.default.join(appDir, p.substring(1), 'page.tsx');
|
|
529
530
|
};
|
|
530
531
|
const tryPath = getExactPath(req.path);
|
|
531
532
|
// Clear require cache for hot reloading in dev
|
|
@@ -542,7 +543,6 @@ function startServer(port = 3003, compiler) {
|
|
|
542
543
|
else {
|
|
543
544
|
// Dynamic Route Matching
|
|
544
545
|
const segments = req.path.split('/').filter(Boolean);
|
|
545
|
-
const appDir = path_1.default.resolve(cwd, 'app');
|
|
546
546
|
if (segments.length === 2) {
|
|
547
547
|
const [section, paramVal] = segments;
|
|
548
548
|
const sectionPath = path_1.default.join(appDir, section);
|
|
@@ -24,6 +24,7 @@ const http_1 = __importDefault(require("http"));
|
|
|
24
24
|
const https_1 = __importDefault(require("https"));
|
|
25
25
|
const url_1 = require("url");
|
|
26
26
|
const image_config_1 = require("../image/image-config");
|
|
27
|
+
const app_dir_1 = require("./app-dir");
|
|
27
28
|
// ---------------------------------------------------------------------------
|
|
28
29
|
// Cache
|
|
29
30
|
// ---------------------------------------------------------------------------
|
|
@@ -71,7 +72,7 @@ function fetchLocalFile(filePath, cwd) {
|
|
|
71
72
|
return fs_1.default.promises.readFile(publicPath);
|
|
72
73
|
}
|
|
73
74
|
// Also try app/ directory
|
|
74
|
-
const appPath = path_1.default.join(
|
|
75
|
+
const appPath = path_1.default.join((0, app_dir_1.resolveAppDir)(cwd), filePath);
|
|
75
76
|
if (fs_1.default.existsSync(appPath)) {
|
|
76
77
|
return fs_1.default.promises.readFile(appPath);
|
|
77
78
|
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vista Server Utilities
|
|
3
|
-
*
|
|
4
|
-
* Next.js-compatible server-only functions for use in Server Components and API routes.
|
|
5
|
-
* These functions only work on the server side.
|
|
6
|
-
*/
|
|
7
|
-
export interface CookieOptions {
|
|
8
|
-
maxAge?: number;
|
|
9
|
-
expires?: Date;
|
|
10
|
-
path?: string;
|
|
11
|
-
domain?: string;
|
|
12
|
-
secure?: boolean;
|
|
13
|
-
httpOnly?: boolean;
|
|
14
|
-
sameSite?: 'strict' | 'lax' | 'none';
|
|
15
|
-
priority?: 'low' | 'medium' | 'high';
|
|
16
|
-
}
|
|
17
|
-
export interface ReadonlyCookie {
|
|
18
|
-
name: string;
|
|
19
|
-
value: string;
|
|
20
|
-
}
|
|
21
|
-
export interface CookieStore {
|
|
22
|
-
get(name: string): ReadonlyCookie | undefined;
|
|
23
|
-
getAll(): ReadonlyCookie[];
|
|
24
|
-
has(name: string): boolean;
|
|
25
|
-
set(name: string, value: string, options?: CookieOptions): void;
|
|
26
|
-
delete(name: string): void;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Access cookies in Server Components and API routes.
|
|
30
|
-
* Note: This is a simplified implementation - in production, integrate with actual request.
|
|
31
|
-
*/
|
|
32
|
-
export declare function cookies(): CookieStore;
|
|
33
|
-
export interface ReadonlyHeaders {
|
|
34
|
-
get(name: string): string | null;
|
|
35
|
-
has(name: string): boolean;
|
|
36
|
-
entries(): IterableIterator<[string, string]>;
|
|
37
|
-
keys(): IterableIterator<string>;
|
|
38
|
-
values(): IterableIterator<string>;
|
|
39
|
-
forEach(callback: (value: string, key: string) => void): void;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Access request headers in Server Components.
|
|
43
|
-
* Note: This is a simplified implementation - in production, integrate with actual request.
|
|
44
|
-
*/
|
|
45
|
-
export declare function headers(): ReadonlyHeaders;
|
|
46
|
-
export interface DraftMode {
|
|
47
|
-
isEnabled: boolean;
|
|
48
|
-
enable(): void;
|
|
49
|
-
disable(): void;
|
|
50
|
-
}
|
|
51
|
-
export declare function draftMode(): DraftMode;
|
|
52
|
-
export type RedirectType = 'push' | 'replace';
|
|
53
|
-
export declare class RedirectError extends Error {
|
|
54
|
-
readonly url: string;
|
|
55
|
-
readonly type: RedirectType;
|
|
56
|
-
constructor(url: string, type?: RedirectType);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Redirect to another URL from a Server Component or API route.
|
|
60
|
-
* @param url - The URL to redirect to
|
|
61
|
-
* @param type - The type of redirect ('push' or 'replace')
|
|
62
|
-
* @throws RedirectError - Always throws to interrupt rendering
|
|
63
|
-
*/
|
|
64
|
-
export declare function redirect(url: string, type?: RedirectType): never;
|
|
65
|
-
/**
|
|
66
|
-
* Permanent redirect (HTTP 308) to another URL.
|
|
67
|
-
* @param url - The URL to redirect to
|
|
68
|
-
* @throws RedirectError - Always throws to interrupt rendering
|
|
69
|
-
*/
|
|
70
|
-
export declare function permanentRedirect(url: string): never;
|
|
71
|
-
export declare class NotFoundError extends Error {
|
|
72
|
-
constructor();
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Trigger a 404 Not Found response from a Server Component.
|
|
76
|
-
* @throws NotFoundError - Always throws to interrupt rendering
|
|
77
|
-
*/
|
|
78
|
-
export declare function notFound(): never;
|
|
79
|
-
/**
|
|
80
|
-
* Create a JSON response (for API routes).
|
|
81
|
-
*/
|
|
82
|
-
export declare function json<T>(data: T, init?: ResponseInit): Response;
|
|
83
|
-
/**
|
|
84
|
-
* Create a NextResponse-compatible response object.
|
|
85
|
-
*/
|
|
86
|
-
export declare class NextResponse extends Response {
|
|
87
|
-
static json<T>(data: T, init?: ResponseInit): NextResponse;
|
|
88
|
-
static redirect(url: string | URL, status?: number): NextResponse;
|
|
89
|
-
static rewrite(url: string | URL): NextResponse;
|
|
90
|
-
static next(options?: {
|
|
91
|
-
request?: {
|
|
92
|
-
headers?: Headers | Record<string, string>;
|
|
93
|
-
};
|
|
94
|
-
}): NextResponse;
|
|
95
|
-
}
|
|
96
|
-
export interface NextRequest extends Request {
|
|
97
|
-
nextUrl: {
|
|
98
|
-
pathname: string;
|
|
99
|
-
searchParams: URLSearchParams;
|
|
100
|
-
href: string;
|
|
101
|
-
origin: string;
|
|
102
|
-
};
|
|
103
|
-
cookies: CookieStore;
|
|
104
|
-
headers: Headers;
|
|
105
|
-
}
|
|
106
|
-
export { cacheLife, cacheTag, revalidatePath, revalidateTag, unstable_cache } from './cache';
|
|
107
|
-
export { runMiddleware, applyMiddlewareResult, discoverGlobalMiddleware, discoverRouteMiddlewares, clearMiddlewareCaches, buildNextRequest, patternToRegExp, shouldRunMiddleware, } from './middleware-runner';
|
|
108
|
-
export { chain, cors, rateLimit, securityHeaders, isSafeRedirectLocation, sanitizeRequestHeaderMap, } from './middleware-security';
|
|
109
|
-
export type { MiddlewareResult, VistaMiddlewareRequest, VistaMiddlewareContext, MiddlewareFunction, MiddlewareConfig, MiddlewareMatcher, MiddlewareModule, NextFunction, } from './middleware-runner';
|
|
1
|
+
/**
|
|
2
|
+
* Vista Server Utilities
|
|
3
|
+
*
|
|
4
|
+
* Next.js-compatible server-only functions for use in Server Components and API routes.
|
|
5
|
+
* These functions only work on the server side.
|
|
6
|
+
*/
|
|
7
|
+
export interface CookieOptions {
|
|
8
|
+
maxAge?: number;
|
|
9
|
+
expires?: Date;
|
|
10
|
+
path?: string;
|
|
11
|
+
domain?: string;
|
|
12
|
+
secure?: boolean;
|
|
13
|
+
httpOnly?: boolean;
|
|
14
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
15
|
+
priority?: 'low' | 'medium' | 'high';
|
|
16
|
+
}
|
|
17
|
+
export interface ReadonlyCookie {
|
|
18
|
+
name: string;
|
|
19
|
+
value: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CookieStore {
|
|
22
|
+
get(name: string): ReadonlyCookie | undefined;
|
|
23
|
+
getAll(): ReadonlyCookie[];
|
|
24
|
+
has(name: string): boolean;
|
|
25
|
+
set(name: string, value: string, options?: CookieOptions): void;
|
|
26
|
+
delete(name: string): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Access cookies in Server Components and API routes.
|
|
30
|
+
* Note: This is a simplified implementation - in production, integrate with actual request.
|
|
31
|
+
*/
|
|
32
|
+
export declare function cookies(): CookieStore;
|
|
33
|
+
export interface ReadonlyHeaders {
|
|
34
|
+
get(name: string): string | null;
|
|
35
|
+
has(name: string): boolean;
|
|
36
|
+
entries(): IterableIterator<[string, string]>;
|
|
37
|
+
keys(): IterableIterator<string>;
|
|
38
|
+
values(): IterableIterator<string>;
|
|
39
|
+
forEach(callback: (value: string, key: string) => void): void;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Access request headers in Server Components.
|
|
43
|
+
* Note: This is a simplified implementation - in production, integrate with actual request.
|
|
44
|
+
*/
|
|
45
|
+
export declare function headers(): ReadonlyHeaders;
|
|
46
|
+
export interface DraftMode {
|
|
47
|
+
isEnabled: boolean;
|
|
48
|
+
enable(): void;
|
|
49
|
+
disable(): void;
|
|
50
|
+
}
|
|
51
|
+
export declare function draftMode(): DraftMode;
|
|
52
|
+
export type RedirectType = 'push' | 'replace';
|
|
53
|
+
export declare class RedirectError extends Error {
|
|
54
|
+
readonly url: string;
|
|
55
|
+
readonly type: RedirectType;
|
|
56
|
+
constructor(url: string, type?: RedirectType);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Redirect to another URL from a Server Component or API route.
|
|
60
|
+
* @param url - The URL to redirect to
|
|
61
|
+
* @param type - The type of redirect ('push' or 'replace')
|
|
62
|
+
* @throws RedirectError - Always throws to interrupt rendering
|
|
63
|
+
*/
|
|
64
|
+
export declare function redirect(url: string, type?: RedirectType): never;
|
|
65
|
+
/**
|
|
66
|
+
* Permanent redirect (HTTP 308) to another URL.
|
|
67
|
+
* @param url - The URL to redirect to
|
|
68
|
+
* @throws RedirectError - Always throws to interrupt rendering
|
|
69
|
+
*/
|
|
70
|
+
export declare function permanentRedirect(url: string): never;
|
|
71
|
+
export declare class NotFoundError extends Error {
|
|
72
|
+
constructor();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Trigger a 404 Not Found response from a Server Component.
|
|
76
|
+
* @throws NotFoundError - Always throws to interrupt rendering
|
|
77
|
+
*/
|
|
78
|
+
export declare function notFound(): never;
|
|
79
|
+
/**
|
|
80
|
+
* Create a JSON response (for API routes).
|
|
81
|
+
*/
|
|
82
|
+
export declare function json<T>(data: T, init?: ResponseInit): Response;
|
|
83
|
+
/**
|
|
84
|
+
* Create a NextResponse-compatible response object.
|
|
85
|
+
*/
|
|
86
|
+
export declare class NextResponse extends Response {
|
|
87
|
+
static json<T>(data: T, init?: ResponseInit): NextResponse;
|
|
88
|
+
static redirect(url: string | URL, status?: number): NextResponse;
|
|
89
|
+
static rewrite(url: string | URL): NextResponse;
|
|
90
|
+
static next(options?: {
|
|
91
|
+
request?: {
|
|
92
|
+
headers?: Headers | Record<string, string>;
|
|
93
|
+
};
|
|
94
|
+
}): NextResponse;
|
|
95
|
+
}
|
|
96
|
+
export interface NextRequest extends Request {
|
|
97
|
+
nextUrl: {
|
|
98
|
+
pathname: string;
|
|
99
|
+
searchParams: URLSearchParams;
|
|
100
|
+
href: string;
|
|
101
|
+
origin: string;
|
|
102
|
+
};
|
|
103
|
+
cookies: CookieStore;
|
|
104
|
+
headers: Headers;
|
|
105
|
+
}
|
|
106
|
+
export { cacheLife, cacheTag, revalidatePath, revalidateTag, unstable_cache } from './cache';
|
|
107
|
+
export { runMiddleware, applyMiddlewareResult, discoverGlobalMiddleware, discoverRouteMiddlewares, clearMiddlewareCaches, buildNextRequest, patternToRegExp, shouldRunMiddleware, } from './middleware-runner';
|
|
108
|
+
export { chain, cors, rateLimit, securityHeaders, isSafeRedirectLocation, sanitizeRequestHeaderMap, } from './middleware-security';
|
|
109
|
+
export type { MiddlewareResult, VistaMiddlewareRequest, VistaMiddlewareContext, MiddlewareFunction, MiddlewareConfig, MiddlewareMatcher, MiddlewareModule, NextFunction, } from './middleware-runner';
|