@guren/core 1.3.0 → 1.4.0
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/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/internal/deploy-build.d.ts +189 -0
- package/dist/internal/deploy-build.js +155 -0
- package/package.json +8 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiTokenStore, ApiToken, SessionStore, SessionData, OAuthStateStore, OAuthStatePayload } from '@guren/server';
|
|
2
2
|
export * from '@guren/server';
|
|
3
|
-
export { AccessorDefinitions, AccessorFn, BelongsToManyRecord, BelongsToManyRelationResult, BelongsToRecord, BelongsToRelationResult, BelongsToRequiredRecord, CastType, D1DatabaseHandle, D1DatabaseOptions, DrizzleAdapter, FindManyOptions, GroupCondition, HasManyRecord, HasManyRelationResult, HasManyThroughRecord, HasManyThroughRelationResult, HasOneRecord, HasOneRelationResult, HookCallback, HookName, InferModelInsert, InferModelRecord, MassAssignmentException, Model, ModelHooks, ModelNotFoundException, ModelObserver, ModelObserverConstructor, ModelPaginationMeta, MorphManyRecord, MorphManyRelationResult, MorphToRecord, MorphToRelationResult, MutatorDefinitions, MutatorFn, MySqlDatabase, MySqlDatabaseOptions, ORMAdapter, ORMAdapterAdvanced, OrderByClause, OrderByInput, OrderDefinition, OrderDirection, PaginateOptions, PaginatedResult, PlainObject, PostgresDatabase, PostgresDatabaseOptions, QueryBuilder, QueryBuilderOptions, ScopeFunction, SeederContext, SeederHandler, SimpleCondition, SoftDeletes, SoftDeletesStatic, SqliteDatabase, SqliteDatabaseOptions, TransactionHandle, TransactionModelScope, WhereClause, WhereCondition, WhereOperator, WithRelations, createD1Database, createMySqlDatabase, createPostgresDatabase, createSqliteDatabase, defineModel, defineSeeder, runSeeders } from '@guren/orm';
|
|
3
|
+
export { AccessorDefinitions, AccessorFn, AwsDataApiDatabase, AwsDataApiDatabaseOptions, BelongsToManyRecord, BelongsToManyRelationResult, BelongsToRecord, BelongsToRelationResult, BelongsToRequiredRecord, CastType, D1DatabaseHandle, D1DatabaseOptions, DrizzleAdapter, FindManyOptions, GroupCondition, HasManyRecord, HasManyRelationResult, HasManyThroughRecord, HasManyThroughRelationResult, HasOneRecord, HasOneRelationResult, HookCallback, HookName, InferModelInsert, InferModelRecord, MassAssignmentException, Model, ModelHooks, ModelNotFoundException, ModelObserver, ModelObserverConstructor, ModelPaginationMeta, MorphManyRecord, MorphManyRelationResult, MorphToRecord, MorphToRelationResult, MutatorDefinitions, MutatorFn, MySqlDatabase, MySqlDatabaseOptions, ORMAdapter, ORMAdapterAdvanced, OrderByClause, OrderByInput, OrderDefinition, OrderDirection, PaginateOptions, PaginatedResult, PlainObject, PostgresDatabase, PostgresDatabaseOptions, QueryBuilder, QueryBuilderOptions, ScopeFunction, SeederContext, SeederHandler, SimpleCondition, SoftDeletes, SoftDeletesStatic, SqliteDatabase, SqliteDatabaseOptions, TransactionHandle, TransactionModelScope, WhereClause, WhereCondition, WhereOperator, WithRelations, createAwsDataApiDatabase, createD1Database, createMySqlDatabase, createPostgresDatabase, createSqliteDatabase, defineModel, defineSeeder, runSeeders } from '@guren/orm';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Options for DatabaseApiTokenStore.
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
createMySqlDatabase,
|
|
13
13
|
createSqliteDatabase,
|
|
14
14
|
createD1Database,
|
|
15
|
+
createAwsDataApiDatabase,
|
|
15
16
|
runSeeders,
|
|
16
17
|
defineSeeder
|
|
17
18
|
} from "@guren/orm";
|
|
@@ -294,6 +295,7 @@ export {
|
|
|
294
295
|
ModelNotFoundException,
|
|
295
296
|
QueryBuilder,
|
|
296
297
|
SoftDeletes,
|
|
298
|
+
createAwsDataApiDatabase,
|
|
297
299
|
createD1Database,
|
|
298
300
|
createMySqlDatabase,
|
|
299
301
|
createPostgresDatabase,
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
type PathLike = string | URL;
|
|
2
|
+
type ManifestEntry = {
|
|
3
|
+
file?: string;
|
|
4
|
+
css?: string[];
|
|
5
|
+
};
|
|
6
|
+
type Manifest = Record<string, ManifestEntry>;
|
|
7
|
+
declare function resolvePathLike(value: PathLike): string;
|
|
8
|
+
/**
|
|
9
|
+
* Read the first manifest that parses, tolerating both Vite layouts
|
|
10
|
+
* (`.vite/manifest.json` and the flat `manifest.json` older configs emit), and
|
|
11
|
+
* report which path it was. A malformed file is skipped rather than fatal —
|
|
12
|
+
* the caller decides what a missing manifest means for its platform. The path
|
|
13
|
+
* is part of the result because a caller publishing the manifest location to
|
|
14
|
+
* the runtime has to name the file that was actually parsed: testing which one
|
|
15
|
+
* *exists* picks the malformed one that was just skipped.
|
|
16
|
+
*/
|
|
17
|
+
declare function readManifest(...paths: string[]): {
|
|
18
|
+
manifest: Manifest;
|
|
19
|
+
path: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Throw unless `out` is safe to delete: it must be neither the app root nor a
|
|
23
|
+
* directory containing it.
|
|
24
|
+
*
|
|
25
|
+
* Both paths are resolved through their symlinks first, because the delete
|
|
26
|
+
* that follows does too. Comparing lexically accepts `outputDir` values that
|
|
27
|
+
* reach the app root the long way — on macOS `/tmp` is itself a symlink to
|
|
28
|
+
* `/private/tmp`, so this is not a contrived case.
|
|
29
|
+
*
|
|
30
|
+
* Containment is then decided with `relative` rather than a string prefix
|
|
31
|
+
* because `out + sep` is `//` at the filesystem root, which no absolute path
|
|
32
|
+
* is prefixed by — a prefix test lets `outputDir: '/'` through. The escape
|
|
33
|
+
* test is `'..'` exactly or a `'../'` prefix, not `startsWith('..')`: a
|
|
34
|
+
* directory legitimately named `..-source` inside `out` yields the relative
|
|
35
|
+
* path `..-source`, which the looser test would read as an escape.
|
|
36
|
+
*
|
|
37
|
+
* Exported separately from `resetOutputDir` so a caller can validate the
|
|
38
|
+
* option early and delete later, but the delete itself should always go
|
|
39
|
+
* through `resetOutputDir`.
|
|
40
|
+
*
|
|
41
|
+
* @param label Platform name for the error message, e.g. `'Lambda build'`.
|
|
42
|
+
*/
|
|
43
|
+
declare function assertOutputDirOutsideRoot(out: string, root: string, label: string): void;
|
|
44
|
+
/**
|
|
45
|
+
* Delete the output directory so the build starts from a clean slate, after
|
|
46
|
+
* checking it is safe to delete.
|
|
47
|
+
*
|
|
48
|
+
* The check and the delete are one call on purpose: they were separate
|
|
49
|
+
* statements in each plugin, and a plugin that had only the delete has already
|
|
50
|
+
* shipped.
|
|
51
|
+
*
|
|
52
|
+
* @param label Platform name for the error message, e.g. `'Lambda build'`.
|
|
53
|
+
*/
|
|
54
|
+
declare function resetOutputDir(out: string, root: string, label: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Relative specifier for importing `target` from a module written into
|
|
57
|
+
* `fromDir`, in POSIX form so the emitted source is platform-agnostic.
|
|
58
|
+
*
|
|
59
|
+
* @param label Platform name for the error message, e.g. `'Lambda build'`.
|
|
60
|
+
*/
|
|
61
|
+
declare function importSpecifier(fromDir: string, target: string, label: string): string;
|
|
62
|
+
interface ClientAssetEnv {
|
|
63
|
+
entry?: string;
|
|
64
|
+
styles?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Locate the built client entry and its CSS in the Vite client manifest, as
|
|
68
|
+
* the `/assets/`-prefixed URLs the Inertia head expects.
|
|
69
|
+
*
|
|
70
|
+
* Takes the public directory rather than the app root so a caller passing a
|
|
71
|
+
* custom `publicDir` is honoured.
|
|
72
|
+
*
|
|
73
|
+
* @param label Platform name for the warning message, e.g. `'Lambda build'`.
|
|
74
|
+
*/
|
|
75
|
+
declare function resolveClientAssetEnv(publicDir: string, clientEntryKey: string, label: string): ClientAssetEnv;
|
|
76
|
+
/**
|
|
77
|
+
* Absolute path of the built SSR entry chunk, or undefined when the app has no
|
|
78
|
+
* SSR build. Verifying that the chunk actually exports a renderer is left to
|
|
79
|
+
* the caller: the platforms disagree on whether importing it during a build is
|
|
80
|
+
* acceptable.
|
|
81
|
+
*
|
|
82
|
+
* @param label Platform name for the error messages, e.g. `'Lambda build'`.
|
|
83
|
+
*/
|
|
84
|
+
declare function resolveSsrEntryFile(ssrDir: string, ssrEntryKey: string, label: string): string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Runtime locations of a staged SSR bundle, for platforms that copy `ssrDir`
|
|
87
|
+
* under the function root and hand the layout to the server through
|
|
88
|
+
* environment variables. `prefix` is where the caller stages the directory —
|
|
89
|
+
* it cannot be derived here because staging happens later in the caller's own
|
|
90
|
+
* flow.
|
|
91
|
+
*
|
|
92
|
+
* The manifest path is derived from the file that parsed rather than the
|
|
93
|
+
* first one that exists: both Vite layouts occur in the wild, and a malformed
|
|
94
|
+
* `.vite/manifest.json` alongside a valid flat one would otherwise publish the
|
|
95
|
+
* path to the file that was skipped. It is optional only for the mid-build
|
|
96
|
+
* race where the manifest vanishes between `resolveSsrEntryFile` and this
|
|
97
|
+
* call — callers already hold a chunk path that manifest produced.
|
|
98
|
+
*/
|
|
99
|
+
declare function ssrRuntimePaths(ssrDir: string, ssrFile: string, prefix: string): {
|
|
100
|
+
entry: string;
|
|
101
|
+
manifest?: string;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Copy `public/` into a platform's static-asset staging directory.
|
|
105
|
+
*
|
|
106
|
+
* Two pieces of Guren-specific knowledge, not platform policy, which is why
|
|
107
|
+
* this is shared: the dev-mode `index.html` shell must never ship (it would
|
|
108
|
+
* shadow the app's root route on any host that serves static files first), and
|
|
109
|
+
* built assets self-reference the Vite plugin's derived base `/public/assets/`
|
|
110
|
+
* while HTML references use `/assets/` — so on a host without rewrites the
|
|
111
|
+
* built-assets directory has to appear under both prefixes.
|
|
112
|
+
*/
|
|
113
|
+
declare function stageStaticAssets(publicDir: string, assetsOut: string): void;
|
|
114
|
+
/** What a dev-only module is needed for, so a plugin can word its own message. */
|
|
115
|
+
type DevOnlyModuleKind = 'sqlite' | 'vite' | 'mcp';
|
|
116
|
+
interface DevOnlyModule {
|
|
117
|
+
readonly specifier: string;
|
|
118
|
+
readonly kind: DevOnlyModuleKind;
|
|
119
|
+
/**
|
|
120
|
+
* Names the importing code destructures. A stub must declare every one of
|
|
121
|
+
* them: an empty module fails the bundle with "no matching export" rather
|
|
122
|
+
* than at runtime. Empty means the module is only ever read through
|
|
123
|
+
* namespace property access, so an empty module suffices.
|
|
124
|
+
*/
|
|
125
|
+
readonly exportNames: readonly string[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Modules that cannot run off Bun but sit in the graph of any app importing
|
|
129
|
+
* `@guren/core`, reached only through dev-time branches. Core aggregates
|
|
130
|
+
* `@guren/server` and `@guren/orm`, where these imports actually live, so it
|
|
131
|
+
* is the one package that sees the whole set — which is why the list lives
|
|
132
|
+
* here rather than in each plugin, where two copies had already drifted apart.
|
|
133
|
+
*
|
|
134
|
+
* Bundlers follow these imports even when they are dynamic, so without stubs
|
|
135
|
+
* the build either fails to resolve them or ships megabytes of dev tooling.
|
|
136
|
+
*
|
|
137
|
+
* - `sqlite` — the local sqlite ORM factory, opposite the platform's own
|
|
138
|
+
* database branch in `config/database.ts`.
|
|
139
|
+
* - `vite` — the dev asset server `Application` starts when serving locally.
|
|
140
|
+
* - `mcp` — the opt-in MCP endpoint's lazy imports, which drag the CLI
|
|
141
|
+
* generators (and Babel) plus the MCP SDK in behind them.
|
|
142
|
+
*
|
|
143
|
+
* `as const` so a consumer can key an exhaustive table on the specifiers and
|
|
144
|
+
* have a new entry here surface as a compile error there.
|
|
145
|
+
*/
|
|
146
|
+
declare const DEV_ONLY_MODULES: readonly [{
|
|
147
|
+
readonly specifier: "bun:sqlite";
|
|
148
|
+
readonly kind: "sqlite";
|
|
149
|
+
readonly exportNames: readonly ["Database"];
|
|
150
|
+
}, {
|
|
151
|
+
readonly specifier: "vite";
|
|
152
|
+
readonly kind: "vite";
|
|
153
|
+
readonly exportNames: readonly ["createServer"];
|
|
154
|
+
}, {
|
|
155
|
+
readonly specifier: "@guren/cli";
|
|
156
|
+
readonly kind: "mcp";
|
|
157
|
+
readonly exportNames: readonly [];
|
|
158
|
+
}, {
|
|
159
|
+
readonly specifier: "@modelcontextprotocol/sdk/server/mcp.js";
|
|
160
|
+
readonly kind: "mcp";
|
|
161
|
+
readonly exportNames: readonly ["McpServer", "ResourceTemplate"];
|
|
162
|
+
}, {
|
|
163
|
+
readonly specifier: "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
164
|
+
readonly kind: "mcp";
|
|
165
|
+
readonly exportNames: readonly ["WebStandardStreamableHTTPServerTransport"];
|
|
166
|
+
}];
|
|
167
|
+
type DevOnlySpecifier = (typeof DEV_ONLY_MODULES)[number]['specifier'];
|
|
168
|
+
/**
|
|
169
|
+
* Source for a stub replacing one dev-only module. Shared because what it
|
|
170
|
+
* encodes is a bundler constraint, not a platform choice: every name the
|
|
171
|
+
* importer destructures must be present or the bundle fails with "no matching
|
|
172
|
+
* export", and each is emitted as a throwing *function* because the stubbed
|
|
173
|
+
* names mix constructors (`new Database()`) with plain calls
|
|
174
|
+
* (`createServer()`) — a class invoked without `new` reports "Class
|
|
175
|
+
* constructor cannot be invoked without 'new'" instead of the real reason.
|
|
176
|
+
*
|
|
177
|
+
* @param message Platform-specific explanation, including the replacement API.
|
|
178
|
+
*/
|
|
179
|
+
declare function renderDevOnlyStub(module: DevOnlyModule, message: string): string;
|
|
180
|
+
/**
|
|
181
|
+
* The MCP SDK is only ever reached through subpaths, and a bundler alias on a
|
|
182
|
+
* package name does not cover them — which is why `DEV_ONLY_MODULES` lists
|
|
183
|
+
* each one. A platform whose aliasing supports prefixes should also route
|
|
184
|
+
* unlisted subpaths under this prefix to a stub, so a new subpath added
|
|
185
|
+
* upstream cannot pull the real SDK into a deployed bundle.
|
|
186
|
+
*/
|
|
187
|
+
declare const MCP_SDK_SUBPATH_PREFIX = "@modelcontextprotocol/sdk/";
|
|
188
|
+
|
|
189
|
+
export { type ClientAssetEnv, DEV_ONLY_MODULES, type DevOnlyModule, type DevOnlyModuleKind, type DevOnlySpecifier, MCP_SDK_SUBPATH_PREFIX, type Manifest, type ManifestEntry, type PathLike, assertOutputDirOutsideRoot, importSpecifier, readManifest, renderDevOnlyStub, resetOutputDir, resolveClientAssetEnv, resolvePathLike, resolveSsrEntryFile, ssrRuntimePaths, stageStaticAssets };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// src/internal/deploy-build.ts
|
|
2
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, realpathSync, rmSync } from "fs";
|
|
3
|
+
import { basename, dirname, isAbsolute, relative, resolve, sep } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
function resolvePathLike(value) {
|
|
6
|
+
return value instanceof URL ? fileURLToPath(value) : resolve(String(value));
|
|
7
|
+
}
|
|
8
|
+
function readManifest(...paths) {
|
|
9
|
+
for (const path of paths) {
|
|
10
|
+
if (!existsSync(path)) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
return { manifest: JSON.parse(readFileSync(path, "utf8")), path };
|
|
15
|
+
} catch {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
21
|
+
function manifestPaths(dir) {
|
|
22
|
+
return [resolve(dir, ".vite/manifest.json"), resolve(dir, "manifest.json")];
|
|
23
|
+
}
|
|
24
|
+
function realpathOfNearestExisting(path) {
|
|
25
|
+
try {
|
|
26
|
+
return realpathSync(path);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
if (error.code !== "ENOENT") {
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const parent = dirname(path);
|
|
33
|
+
if (parent === path) {
|
|
34
|
+
return path;
|
|
35
|
+
}
|
|
36
|
+
return resolve(realpathOfNearestExisting(parent), basename(path));
|
|
37
|
+
}
|
|
38
|
+
function assertOutputDirOutsideRoot(out, root, label) {
|
|
39
|
+
const outToRoot = relative(realpathOfNearestExisting(out), realpathOfNearestExisting(root));
|
|
40
|
+
const rootIsInsideOut = outToRoot !== ".." && !outToRoot.startsWith(`..${sep}`) && !isAbsolute(outToRoot);
|
|
41
|
+
if (outToRoot === "" || rootIsInsideOut) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
`${label}: outputDir (${out}) must be a directory outside or below the app root, never the root itself or a parent of it \u2014 it is deleted on every build.`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function resetOutputDir(out, root, label) {
|
|
48
|
+
assertOutputDirOutsideRoot(out, root, label);
|
|
49
|
+
if (existsSync(out)) {
|
|
50
|
+
rmSync(out, { recursive: true, force: true });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function importSpecifier(fromDir, target, label) {
|
|
54
|
+
const rel = relative(fromDir, target);
|
|
55
|
+
if (isAbsolute(rel)) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`${label}: ${target} cannot be imported relative to ${fromDir} (different drive or root?). Keep the app, SSR output, and outputDir on the same volume.`
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
const specifier = rel.split(sep).join("/");
|
|
61
|
+
return specifier.startsWith(".") ? specifier : `./${specifier}`;
|
|
62
|
+
}
|
|
63
|
+
function resolveClientAssetEnv(publicDir, clientEntryKey, label) {
|
|
64
|
+
const manifest = readManifest(...manifestPaths(resolve(publicDir, "assets")))?.manifest;
|
|
65
|
+
const entry = manifest?.[clientEntryKey];
|
|
66
|
+
if (!entry?.file) {
|
|
67
|
+
console.warn(
|
|
68
|
+
`${label}: no client manifest entry for "${clientEntryKey}"; GUREN_INERTIA_ENTRY will not be set.`
|
|
69
|
+
);
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
entry: `/assets/${entry.file}`,
|
|
74
|
+
styles: entry.css?.length ? entry.css.map((file) => `/assets/${file}`).join(",") : void 0
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function resolveSsrEntryFile(ssrDir, ssrEntryKey, label) {
|
|
78
|
+
const manifest = readManifest(...manifestPaths(ssrDir))?.manifest;
|
|
79
|
+
const entryFile = manifest?.[ssrEntryKey]?.file;
|
|
80
|
+
if (!entryFile) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
const file = resolve(ssrDir, entryFile);
|
|
84
|
+
if (!file.startsWith(ssrDir + sep)) {
|
|
85
|
+
throw new Error(`${label}: SSR manifest entry "${entryFile}" escapes the SSR output directory ${ssrDir}.`);
|
|
86
|
+
}
|
|
87
|
+
if (!existsSync(file)) {
|
|
88
|
+
throw new Error(`${label}: SSR manifest points at ${file}, but the file does not exist.`);
|
|
89
|
+
}
|
|
90
|
+
return file;
|
|
91
|
+
}
|
|
92
|
+
function ssrRuntimePaths(ssrDir, ssrFile, prefix) {
|
|
93
|
+
const under = (target) => `${prefix}/${relative(ssrDir, target).split(sep).join("/")}`;
|
|
94
|
+
const read = readManifest(...manifestPaths(ssrDir));
|
|
95
|
+
return {
|
|
96
|
+
entry: under(ssrFile),
|
|
97
|
+
manifest: read ? under(read.path) : void 0
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function stageStaticAssets(publicDir, assetsOut) {
|
|
101
|
+
mkdirSync(assetsOut, { recursive: true });
|
|
102
|
+
if (!existsSync(publicDir)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
cpSync(publicDir, assetsOut, { recursive: true });
|
|
106
|
+
const shadowingIndex = resolve(assetsOut, "index.html");
|
|
107
|
+
if (existsSync(shadowingIndex)) {
|
|
108
|
+
rmSync(shadowingIndex);
|
|
109
|
+
}
|
|
110
|
+
const clientAssetsDir = resolve(publicDir, "assets");
|
|
111
|
+
if (existsSync(clientAssetsDir)) {
|
|
112
|
+
cpSync(clientAssetsDir, resolve(assetsOut, "public/assets"), { recursive: true });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
var DEV_ONLY_MODULES = [
|
|
116
|
+
{ specifier: "bun:sqlite", kind: "sqlite", exportNames: ["Database"] },
|
|
117
|
+
{ specifier: "vite", kind: "vite", exportNames: ["createServer"] },
|
|
118
|
+
{ specifier: "@guren/cli", kind: "mcp", exportNames: [] },
|
|
119
|
+
{
|
|
120
|
+
specifier: "@modelcontextprotocol/sdk/server/mcp.js",
|
|
121
|
+
kind: "mcp",
|
|
122
|
+
exportNames: ["McpServer", "ResourceTemplate"]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
specifier: "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js",
|
|
126
|
+
kind: "mcp",
|
|
127
|
+
exportNames: ["WebStandardStreamableHTTPServerTransport"]
|
|
128
|
+
}
|
|
129
|
+
];
|
|
130
|
+
function renderDevOnlyStub(module, message) {
|
|
131
|
+
if (module.exportNames.length === 0) {
|
|
132
|
+
return `// ${message}
|
|
133
|
+
export {}
|
|
134
|
+
`;
|
|
135
|
+
}
|
|
136
|
+
const throwing = module.exportNames.map((name) => `export function ${name}() { throw new Error(${JSON.stringify(message)}) }`).join("\n");
|
|
137
|
+
return `${throwing}
|
|
138
|
+
export default { ${module.exportNames.join(", ")} }
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
var MCP_SDK_SUBPATH_PREFIX = "@modelcontextprotocol/sdk/";
|
|
142
|
+
export {
|
|
143
|
+
DEV_ONLY_MODULES,
|
|
144
|
+
MCP_SDK_SUBPATH_PREFIX,
|
|
145
|
+
assertOutputDirOutsideRoot,
|
|
146
|
+
importSpecifier,
|
|
147
|
+
readManifest,
|
|
148
|
+
renderDevOnlyStub,
|
|
149
|
+
resetOutputDir,
|
|
150
|
+
resolveClientAssetEnv,
|
|
151
|
+
resolvePathLike,
|
|
152
|
+
resolveSsrEntryFile,
|
|
153
|
+
ssrRuntimePaths,
|
|
154
|
+
stageStaticAssets
|
|
155
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guren/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"./redis": {
|
|
41
41
|
"types": "./dist/redis.d.ts",
|
|
42
42
|
"default": "./dist/redis.js"
|
|
43
|
+
},
|
|
44
|
+
"./internal/deploy-build": {
|
|
45
|
+
"types": "./dist/internal/deploy-build.d.ts",
|
|
46
|
+
"default": "./dist/internal/deploy-build.js"
|
|
43
47
|
}
|
|
44
48
|
},
|
|
45
49
|
"bin": {
|
|
@@ -52,9 +56,9 @@
|
|
|
52
56
|
"typecheck": "tsc --noEmit"
|
|
53
57
|
},
|
|
54
58
|
"dependencies": {
|
|
55
|
-
"@guren/cli": "^1.
|
|
56
|
-
"@guren/orm": "^1.
|
|
57
|
-
"@guren/server": "^1.
|
|
59
|
+
"@guren/cli": "^1.6.0",
|
|
60
|
+
"@guren/orm": "^1.3.0",
|
|
61
|
+
"@guren/server": "^1.5.0"
|
|
58
62
|
},
|
|
59
63
|
"devDependencies": {
|
|
60
64
|
"@types/node": "^20.14.10",
|