@cedarjs/vite 4.2.1-next.0 → 4.2.1-next.269
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/bins/cedar-unified-dev.mjs +7 -0
- package/dist/apiDevMiddleware.d.ts.map +1 -1
- package/dist/apiDevMiddleware.js +18 -5
- package/dist/buildApp.d.ts +2 -1
- package/dist/buildApp.d.ts.map +1 -1
- package/dist/buildApp.js +151 -26
- package/dist/buildFeServer.d.ts.map +1 -1
- package/dist/buildFeServer.js +1 -1
- package/dist/buildRouteHooks.d.ts.map +1 -1
- package/dist/buildRouteHooks.js +7 -3
- package/dist/cedar-unified-dev.d.ts +13 -2
- package/dist/cedar-unified-dev.d.ts.map +1 -1
- package/dist/cedar-unified-dev.js +171 -16
- package/dist/cjs/apiDevMiddleware.js +18 -5
- package/dist/cjs/buildApp.js +154 -29
- package/dist/cjs/buildFeServer.js +1 -1
- package/dist/cjs/buildRouteHooks.js +17 -3
- package/dist/cjs/cedar-unified-dev.js +184 -16
- package/dist/cjs/devFeServer.js +2 -1
- package/dist/cjs/index.js +18 -8
- package/dist/cjs/lib/getMergedConfig.js +12 -4
- package/dist/cjs/lib/workspacePackageAliases.js +2 -8
- package/dist/cjs/plugins/vite-plugin-cedar-context-wrapping.js +95 -0
- package/dist/cjs/plugins/vite-plugin-cedar-entry-injection.js +20 -5
- package/dist/cjs/plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js +61 -0
- package/dist/cjs/plugins/vite-plugin-cedar-routes-auto-loader.js +126 -0
- package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +202 -14
- package/dist/cjs/runFeServer.js +2 -1
- package/dist/cjs/utils.js +2 -1
- package/dist/devFeServer.d.ts +1 -0
- package/dist/devFeServer.js +2 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -8
- package/dist/lib/getMergedConfig.d.ts.map +1 -1
- package/dist/lib/getMergedConfig.js +12 -4
- package/dist/lib/workspacePackageAliases.d.ts.map +1 -1
- package/dist/lib/workspacePackageAliases.js +2 -8
- package/dist/plugins/vite-plugin-cedar-context-wrapping.d.ts +44 -0
- package/dist/plugins/vite-plugin-cedar-context-wrapping.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-context-wrapping.js +60 -0
- package/dist/plugins/vite-plugin-cedar-entry-injection.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-entry-injection.js +20 -5
- package/dist/plugins/vite-plugin-cedar-remove-dev-fatal-error-page.d.ts +15 -0
- package/dist/plugins/vite-plugin-cedar-remove-dev-fatal-error-page.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js +37 -0
- package/dist/plugins/vite-plugin-cedar-routes-auto-loader.d.ts +24 -0
- package/dist/plugins/vite-plugin-cedar-routes-auto-loader.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-routes-auto-loader.js +98 -0
- package/dist/plugins/vite-plugin-cedar-universal-deploy.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-universal-deploy.js +202 -14
- package/dist/runFeServer.d.ts +1 -0
- package/dist/runFeServer.d.ts.map +1 -1
- package/dist/runFeServer.js +2 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +2 -1
- package/package.json +31 -61
- package/dist/buildUDApiServer.d.ts +0 -24
- package/dist/buildUDApiServer.d.ts.map +0 -1
- package/dist/buildUDApiServer.js +0 -41
- package/dist/cjs/buildUDApiServer.js +0 -75
- package/dist/cjs/ud-handlers/catch-all.js +0 -65
- package/dist/cjs/ud-handlers/function.js +0 -47
- package/dist/cjs/ud-handlers/graphql.js +0 -59
- package/dist/ud-handlers/catch-all.d.ts +0 -15
- package/dist/ud-handlers/catch-all.d.ts.map +0 -1
- package/dist/ud-handlers/catch-all.js +0 -41
- package/dist/ud-handlers/function.d.ts +0 -5
- package/dist/ud-handlers/function.d.ts.map +0 -1
- package/dist/ud-handlers/function.js +0 -23
- package/dist/ud-handlers/graphql.d.ts +0 -7
- package/dist/ud-handlers/graphql.d.ts.map +0 -1
- package/dist/ud-handlers/graphql.js +0 -35
|
@@ -64,25 +64,39 @@ function toEntryMeta(route) {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
function cedarUniversalDeployPlugin(options = {}) {
|
|
67
|
-
const
|
|
68
|
-
const routes = discoverCedarRoutes(
|
|
69
|
-
let entriesInjected = false;
|
|
67
|
+
const effectiveApiRootPath = process.env.CEDAR_API_ROOT_PATH ?? options.apiRootPath;
|
|
68
|
+
const routes = discoverCedarRoutes(effectiveApiRootPath ?? "/");
|
|
70
69
|
return {
|
|
71
70
|
name: "cedar-universal-deploy",
|
|
72
71
|
apply: "build",
|
|
73
72
|
config: {
|
|
74
73
|
order: "pre",
|
|
75
74
|
handler() {
|
|
76
|
-
if (entriesInjected) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
entriesInjected = true;
|
|
80
75
|
for (const route of routes) {
|
|
81
76
|
addEntry(toEntryMeta(route));
|
|
82
77
|
}
|
|
83
78
|
}
|
|
84
79
|
},
|
|
80
|
+
buildStart() {
|
|
81
|
+
if (this.environment.name !== "ssr") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
for (const route of routes) {
|
|
85
|
+
const resolvedId = RESOLVED_CEDAR_FN_PREFIX + route.id;
|
|
86
|
+
const safeName = route.id.replace(/[/\\?%*:|"<>]/g, "_").replace(/^_+/, "");
|
|
87
|
+
this.emitFile({
|
|
88
|
+
type: "chunk",
|
|
89
|
+
id: resolvedId,
|
|
90
|
+
// Emit the functions into a sub-dir to "hide" them from Netlify
|
|
91
|
+
fileName: "chunks/" + safeName + "-handler.js"
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
},
|
|
85
95
|
resolveId(id) {
|
|
96
|
+
const viteEnv = this.environment;
|
|
97
|
+
if (viteEnv.config.consumer === "client" || viteEnv.name === "api") {
|
|
98
|
+
return void 0;
|
|
99
|
+
}
|
|
86
100
|
if (id.startsWith(RESOLVED_CEDAR_FN_PREFIX)) {
|
|
87
101
|
return id;
|
|
88
102
|
}
|
|
@@ -91,7 +105,11 @@ function cedarUniversalDeployPlugin(options = {}) {
|
|
|
91
105
|
}
|
|
92
106
|
return void 0;
|
|
93
107
|
},
|
|
94
|
-
load(id) {
|
|
108
|
+
async load(id) {
|
|
109
|
+
const viteEnv = this.environment;
|
|
110
|
+
if (viteEnv.config.consumer === "client" || viteEnv.name === "api") {
|
|
111
|
+
return void 0;
|
|
112
|
+
}
|
|
95
113
|
if (id.startsWith(RESOLVED_CEDAR_FN_PREFIX)) {
|
|
96
114
|
const routeId = id.slice(RESOLVED_CEDAR_FN_PREFIX.length);
|
|
97
115
|
const route = routes.find((r) => r.id === routeId);
|
|
@@ -107,16 +125,186 @@ function cedarUniversalDeployPlugin(options = {}) {
|
|
|
107
125
|
}
|
|
108
126
|
};
|
|
109
127
|
}
|
|
110
|
-
function
|
|
128
|
+
async function bundleDistFile(distPath, options = {}) {
|
|
129
|
+
const { build } = await import("esbuild");
|
|
130
|
+
const buildOptions = {
|
|
131
|
+
bundle: true,
|
|
132
|
+
write: false,
|
|
133
|
+
format: "esm",
|
|
134
|
+
platform: "node",
|
|
135
|
+
target: "node24",
|
|
136
|
+
plugins: [
|
|
137
|
+
{
|
|
138
|
+
name: "ud-external",
|
|
139
|
+
setup(build2) {
|
|
140
|
+
build2.onResolve({ filter: /^[^.]/ }, (args) => {
|
|
141
|
+
if (path.isAbsolute(args.path)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (args.path.startsWith("api/")) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
return { external: true };
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
logLevel: "silent"
|
|
153
|
+
};
|
|
154
|
+
if (options.include && options.include.length > 0) {
|
|
155
|
+
const resolveDir = path.dirname(distPath);
|
|
156
|
+
const relativeDistPath = "./" + path.basename(distPath);
|
|
157
|
+
const exportList = options.include.join(", ");
|
|
158
|
+
buildOptions.stdin = {
|
|
159
|
+
// Use stdin to define a synthetic entry point that exports only the
|
|
160
|
+
// requested named exports
|
|
161
|
+
contents: `export { ${exportList} } from ${JSON.stringify(relativeDistPath)}`,
|
|
162
|
+
resolveDir,
|
|
163
|
+
loader: "js"
|
|
164
|
+
};
|
|
165
|
+
} else {
|
|
166
|
+
buildOptions.entryPoints = [distPath];
|
|
167
|
+
}
|
|
168
|
+
const result = await build(buildOptions);
|
|
169
|
+
if (!result.outputFiles || result.outputFiles.length === 0) {
|
|
170
|
+
throw new Error("esbuild bundle produced no output files");
|
|
171
|
+
}
|
|
172
|
+
let text = result.outputFiles[0].text;
|
|
173
|
+
const exportBlock = text.match(/\nexport\s*\{([^}]*)\};\s*$/);
|
|
174
|
+
if (exportBlock) {
|
|
175
|
+
const defaultExportMatch = exportBlock[1].match(
|
|
176
|
+
/(?:^|,)\s*(\w+)\s+as\s+default\s*(?:,|$)/
|
|
177
|
+
);
|
|
178
|
+
if (defaultExportMatch) {
|
|
179
|
+
const defaultBinding = defaultExportMatch[1];
|
|
180
|
+
text = text.replace(/\nexport\s*\{[^}]*\};\s*$/, "") + `
|
|
181
|
+
const __cedar_default = ${defaultBinding};`;
|
|
182
|
+
} else {
|
|
183
|
+
text = text.replace(/\nexport\s*\{[^}]*\};\s*$/, "");
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return text;
|
|
187
|
+
}
|
|
188
|
+
async function generateGraphQLModule(distPath) {
|
|
189
|
+
const bundledCode = await bundleDistFile(distPath, {
|
|
190
|
+
include: ["__cedar_graphqlOptions"]
|
|
191
|
+
});
|
|
111
192
|
return `
|
|
112
|
-
import {
|
|
113
|
-
|
|
193
|
+
import { buildCedarContext, requestToLegacyEvent } from '@cedarjs/api/runtime';
|
|
194
|
+
import { createGraphQLYoga } from '@cedarjs/graphql-server';
|
|
195
|
+
|
|
196
|
+
// Inlined bundle of ${path.basename(distPath)} (node_modules kept external)
|
|
197
|
+
${bundledCode}
|
|
198
|
+
|
|
199
|
+
let yogaInitPromise = null;
|
|
200
|
+
|
|
201
|
+
function getYoga() {
|
|
202
|
+
if (!yogaInitPromise) {
|
|
203
|
+
yogaInitPromise = createGraphQLYoga(__cedar_graphqlOptions).then(
|
|
204
|
+
({ yoga }) => ({ yoga, graphqlOptions: __cedar_graphqlOptions })
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
return yogaInitPromise;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export default {
|
|
211
|
+
async fetch(request) {
|
|
212
|
+
const { yoga, graphqlOptions } = await getYoga();
|
|
213
|
+
const cedarContext = await buildCedarContext(request, {
|
|
214
|
+
authDecoder: graphqlOptions ? graphqlOptions.authDecoder : undefined,
|
|
215
|
+
});
|
|
216
|
+
const event = await requestToLegacyEvent(request, cedarContext);
|
|
217
|
+
// Wrap yoga.handle in an AsyncLocalStorage run so directive
|
|
218
|
+
// validators can read from the global @cedarjs/context. Without
|
|
219
|
+
// this, the auth plugin's setContext() call writes to a store
|
|
220
|
+
// that's only visible inside the plugin's own callback \u2014 not
|
|
221
|
+
// during directive validation.
|
|
222
|
+
const { getAsyncStoreInstance } = await import('@cedarjs/context/dist/store')
|
|
223
|
+
const store = getAsyncStoreInstance()
|
|
224
|
+
|
|
225
|
+
return store.run(new Map(), () => {
|
|
226
|
+
return yoga.handle(request, {
|
|
227
|
+
request,
|
|
228
|
+
cedarContext,
|
|
229
|
+
event,
|
|
230
|
+
requestContext: undefined,
|
|
231
|
+
})
|
|
232
|
+
}).then((response) => {
|
|
233
|
+
// GraphQL Yoga returns a PonyfillResponse from @whatwg-node/fetch
|
|
234
|
+
// which is not an instanceof the native Response class. Netlify's
|
|
235
|
+
// bootstrap checks instanceof Response, so we wrap it.
|
|
236
|
+
return new Response(response.body, {
|
|
237
|
+
status: response.status,
|
|
238
|
+
statusText: response.statusText,
|
|
239
|
+
headers: response.headers,
|
|
240
|
+
})
|
|
241
|
+
}).catch((e) => {
|
|
242
|
+
if (e?.code === 'ERR_STREAM_PREMATURE_CLOSE') {
|
|
243
|
+
// Client disconnected while the request was being processed (e.g.,
|
|
244
|
+
// page navigation, tab close). Return a 499 so the runtime doesn't
|
|
245
|
+
// treat this as a 500.
|
|
246
|
+
return new Response(null, { status: 499 })
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
throw e
|
|
250
|
+
})
|
|
251
|
+
}
|
|
252
|
+
};
|
|
114
253
|
`;
|
|
115
254
|
}
|
|
116
|
-
function generateFunctionModule(distPath) {
|
|
255
|
+
async function generateFunctionModule(distPath) {
|
|
256
|
+
const bundledCode = await bundleDistFile(distPath);
|
|
257
|
+
const notFoundMsg = JSON.stringify(
|
|
258
|
+
`Handler not found in ${path.basename(distPath)}. Expected \`export async function handleRequest(request, ctx)\`, \`export default async (request, ctx) => Response\`, \`export default { handleRequest }\`, or a legacy Lambda-shaped \`handler\`.`
|
|
259
|
+
);
|
|
117
260
|
return `
|
|
118
|
-
import {
|
|
119
|
-
|
|
261
|
+
import { wrapLegacyHandler, buildCedarContext } from '@cedarjs/api/runtime';
|
|
262
|
+
|
|
263
|
+
// Inlined bundle of ${path.basename(distPath)} (node_modules kept external)
|
|
264
|
+
${bundledCode}
|
|
265
|
+
|
|
266
|
+
const nativeHandler = (() => {
|
|
267
|
+
// Prefer named handleRequest export
|
|
268
|
+
if (typeof handleRequest !== 'undefined') { return handleRequest; }
|
|
269
|
+
// Handle export default { handleRequest } pattern
|
|
270
|
+
if (typeof __cedar_default !== 'undefined' && __cedar_default && typeof __cedar_default.handleRequest === 'function') {
|
|
271
|
+
return __cedar_default.handleRequest;
|
|
272
|
+
}
|
|
273
|
+
// Handle plain default-exported async function: export default async (req) => Response
|
|
274
|
+
if (typeof __cedar_default !== 'undefined' && typeof __cedar_default === 'function') {
|
|
275
|
+
return __cedar_default;
|
|
276
|
+
}
|
|
277
|
+
return undefined;
|
|
278
|
+
})();
|
|
279
|
+
|
|
280
|
+
const legacyFn = (() => {
|
|
281
|
+
if (typeof handler !== 'undefined') { return handler; }
|
|
282
|
+
if (typeof __cedar_default !== 'undefined' && __cedar_default && typeof __cedar_default.handler === 'function') {
|
|
283
|
+
return __cedar_default.handler;
|
|
284
|
+
}
|
|
285
|
+
return undefined;
|
|
286
|
+
})();
|
|
287
|
+
|
|
288
|
+
if (!nativeHandler && !legacyFn) {
|
|
289
|
+
throw new Error(${notFoundMsg});
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const _handler = nativeHandler ?? wrapLegacyHandler(legacyFn);
|
|
293
|
+
|
|
294
|
+
export default {
|
|
295
|
+
async fetch(request) {
|
|
296
|
+
const ctx = await buildCedarContext(request);
|
|
297
|
+
// Wrap the handler in an AsyncLocalStorage run so the global
|
|
298
|
+
// @cedarjs/context is available inside it (and isolated per request).
|
|
299
|
+
// Mirrors the GraphQL module above and the cedarContextWrappingPlugin
|
|
300
|
+
// used for non-UD builds.
|
|
301
|
+
const { getAsyncStoreInstance } = await import(
|
|
302
|
+
'@cedarjs/context/dist/store'
|
|
303
|
+
);
|
|
304
|
+
const store = getAsyncStoreInstance();
|
|
305
|
+
return store.run(new Map(), () => _handler(request, ctx));
|
|
306
|
+
}
|
|
307
|
+
};
|
|
120
308
|
`;
|
|
121
309
|
}
|
|
122
310
|
export {
|
package/dist/runFeServer.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runFeServer.d.ts","sourceRoot":"","sources":["../src/runFeServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runFeServer.d.ts","sourceRoot":"","sources":["../src/runFeServer.ts"],"names":[],"mappings":";AAkDA,wBAAsB,WAAW,kBAqJhC"}
|
package/dist/runFeServer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import url from "node:url";
|
|
3
4
|
import { createServerAdapter } from "@whatwg-node/server";
|
|
@@ -41,7 +42,7 @@ async function runFeServer() {
|
|
|
41
42
|
path.join(rwPaths.web.distBrowser, "client-build-manifest.json")
|
|
42
43
|
).href;
|
|
43
44
|
const clientBuildManifest = (await import(clientBuildManifestUrl, { with: { type: "json" } })).default;
|
|
44
|
-
const clientEntry = rscEnabled ? clientBuildManifest["entry.client.tsx"] || clientBuildManifest["entry.client.jsx"] : Object.values(clientBuildManifest).find(
|
|
45
|
+
const clientEntry = rscEnabled ? clientBuildManifest["src/entry.client.tsx"] || clientBuildManifest["src/entry.client.jsx"] : Object.values(clientBuildManifest).find(
|
|
45
46
|
(manifestItem) => manifestItem.isEntry
|
|
46
47
|
);
|
|
47
48
|
if (!clientEntry) {
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,SAAS,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAKzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C,wBAAgB,+BAA+B,CAAC,GAAG,EAAE,MAAM,UAE1D;AAID,wBAAgB,mBAAmB,CAAC,MAAM,GAAE,MAA4B,QAYvE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,UAExC;AAED,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,aAAa,wBAYpE;AAED,wBAAgB,qBAAqB,CACnC,sBAAsB,EAAE,cAAc,CAAC,iBAAiB,CAAC,WAc1D;AAED,eAAO,MAAM,UAAU,GAAI,KAAK,cAAc,EAAE,YAAY,OAAO,WAiBlE,CAAA"}
|
package/dist/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { pathToFileURL } from "node:url";
|
|
2
2
|
import { getPaths } from "@cedarjs/project-config";
|
|
3
|
+
import { prettyPrintCedarCommand } from "@cedarjs/project-config/packageManager";
|
|
3
4
|
function stripQueryStringAndHashFromPath(url) {
|
|
4
5
|
return url.split("?")[0].split("#")[0];
|
|
5
6
|
}
|
|
@@ -8,7 +9,7 @@ function ensureProcessDirWeb(webDir = getPaths().web.base) {
|
|
|
8
9
|
console.error("\u26A0\uFE0F Warning: CWD is ", process.cwd());
|
|
9
10
|
console.warn("~".repeat(50));
|
|
10
11
|
console.warn(
|
|
11
|
-
|
|
12
|
+
`The cwd must be web/. Please use \`${prettyPrintCedarCommand(["<command>"])}\` or run the command from the web/ directory.`
|
|
12
13
|
);
|
|
13
14
|
console.log(`Changing cwd to ${webDir}....`);
|
|
14
15
|
console.log();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "4.2.1-next.
|
|
3
|
+
"version": "4.2.1-next.269",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,57 +25,20 @@
|
|
|
25
25
|
"types": "./dist/api/vite-plugin-cedar-vitest-api-preset.d.ts",
|
|
26
26
|
"default": "./dist/api/vite-plugin-cedar-vitest-api-preset.js"
|
|
27
27
|
},
|
|
28
|
-
"./client": {
|
|
29
|
-
"require": "./dist/cjs/client.js",
|
|
30
|
-
"import": "./dist/client.js"
|
|
31
|
-
},
|
|
32
28
|
"./buildFeServer": {
|
|
33
29
|
"require": "./dist/cjs/buildFeServer.js",
|
|
34
30
|
"import": "./dist/buildFeServer.js"
|
|
35
31
|
},
|
|
36
|
-
"./buildUDApiServer": {
|
|
37
|
-
"import": "./dist/buildUDApiServer.js"
|
|
38
|
-
},
|
|
39
32
|
"./build": {
|
|
40
33
|
"import": "./dist/build/build.js",
|
|
41
34
|
"default": "./dist/cjs/build/build.js"
|
|
42
35
|
},
|
|
43
|
-
"./bins/cedar-vite-build.mjs": "./bins/cedar-vite-build.mjs"
|
|
44
|
-
"./ud-handlers/graphql": {
|
|
45
|
-
"import": {
|
|
46
|
-
"types": "./dist/ud-handlers/graphql.d.ts",
|
|
47
|
-
"default": "./dist/ud-handlers/graphql.js"
|
|
48
|
-
},
|
|
49
|
-
"require": {
|
|
50
|
-
"types": "./dist/cjs/ud-handlers/graphql.d.ts",
|
|
51
|
-
"default": "./dist/cjs/ud-handlers/graphql.js"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"./ud-handlers/function": {
|
|
55
|
-
"import": {
|
|
56
|
-
"types": "./dist/ud-handlers/function.d.ts",
|
|
57
|
-
"default": "./dist/ud-handlers/function.js"
|
|
58
|
-
},
|
|
59
|
-
"require": {
|
|
60
|
-
"types": "./dist/cjs/ud-handlers/function.d.ts",
|
|
61
|
-
"default": "./dist/cjs/ud-handlers/function.js"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"./ud-handlers/catch-all": {
|
|
65
|
-
"import": {
|
|
66
|
-
"types": "./dist/ud-handlers/catch-all.d.ts",
|
|
67
|
-
"default": "./dist/ud-handlers/catch-all.js"
|
|
68
|
-
},
|
|
69
|
-
"require": {
|
|
70
|
-
"types": "./dist/cjs/ud-handlers/catch-all.d.ts",
|
|
71
|
-
"default": "./dist/cjs/ud-handlers/catch-all.js"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
36
|
+
"./bins/cedar-vite-build.mjs": "./bins/cedar-vite-build.mjs"
|
|
74
37
|
},
|
|
75
38
|
"bin": {
|
|
76
39
|
"cedar-dev-fe": "./dist/devFeServer.js",
|
|
77
40
|
"cedar-serve-fe": "./dist/runFeServer.js",
|
|
78
|
-
"cedar-unified-dev": "./
|
|
41
|
+
"cedar-unified-dev": "./bins/cedar-unified-dev.mjs",
|
|
79
42
|
"cedar-vite-build": "./bins/cedar-vite-build.mjs",
|
|
80
43
|
"cedar-vite-dev": "./bins/cedar-vite-dev.mjs",
|
|
81
44
|
"vite": "./bins/vite.mjs"
|
|
@@ -86,7 +49,7 @@
|
|
|
86
49
|
"inject"
|
|
87
50
|
],
|
|
88
51
|
"scripts": {
|
|
89
|
-
"build": "
|
|
52
|
+
"build": "node ./build.ts && yarn build:types",
|
|
90
53
|
"build:pack": "yarn pack -o cedarjs-vite.tgz",
|
|
91
54
|
"build:types": "tsc --build --verbose ./tsconfig.build.json",
|
|
92
55
|
"check:attw": "tsx ./attw.ts",
|
|
@@ -95,13 +58,12 @@
|
|
|
95
58
|
"test:watch": "vitest watch"
|
|
96
59
|
},
|
|
97
60
|
"dependencies": {
|
|
98
|
-
"@ast-grep/napi": "0.
|
|
99
|
-
"@babel/generator": "7.29.
|
|
100
|
-
"@babel/parser": "7.29.
|
|
101
|
-
"@babel/traverse": "7.29.
|
|
61
|
+
"@ast-grep/napi": "0.43.0",
|
|
62
|
+
"@babel/generator": "7.29.7",
|
|
63
|
+
"@babel/parser": "7.29.7",
|
|
64
|
+
"@babel/traverse": "7.29.7",
|
|
65
|
+
"@babel/types": "7.29.7",
|
|
102
66
|
"@cedarjs/api": "4.2.0",
|
|
103
|
-
"@cedarjs/api-server": "4.2.0",
|
|
104
|
-
"@cedarjs/auth": "4.2.0",
|
|
105
67
|
"@cedarjs/babel-config": "4.2.0",
|
|
106
68
|
"@cedarjs/context": "4.2.0",
|
|
107
69
|
"@cedarjs/cookie-jar": "4.2.0",
|
|
@@ -110,10 +72,8 @@
|
|
|
110
72
|
"@cedarjs/project-config": "4.2.0",
|
|
111
73
|
"@cedarjs/server-store": "4.2.0",
|
|
112
74
|
"@cedarjs/testing": "4.2.0",
|
|
113
|
-
"@cedarjs/web": "4.2.0",
|
|
114
75
|
"@fastify/url-data": "6.0.3",
|
|
115
|
-
"@swc/core": "1.15.
|
|
116
|
-
"@universal-deploy/node": "^0.1.6",
|
|
76
|
+
"@swc/core": "1.15.41",
|
|
117
77
|
"@universal-deploy/store": "^0.2.1",
|
|
118
78
|
"@universal-deploy/vite": "^0.1.9",
|
|
119
79
|
"@vitejs/plugin-react": "4.7.0",
|
|
@@ -127,26 +87,30 @@
|
|
|
127
87
|
"cookie": "1.1.1",
|
|
128
88
|
"dotenv-defaults": "5.0.2",
|
|
129
89
|
"execa": "5.1.1",
|
|
130
|
-
"express": "4.22.
|
|
90
|
+
"express": "4.22.2",
|
|
131
91
|
"fastify": "5.8.5",
|
|
132
92
|
"fastify-raw-body": "5.0.0",
|
|
133
93
|
"find-my-way": "8.2.2",
|
|
134
|
-
"http-proxy-middleware": "3.0.
|
|
135
|
-
"isbot": "5.1.
|
|
94
|
+
"http-proxy-middleware": "3.0.7",
|
|
95
|
+
"isbot": "5.1.43",
|
|
136
96
|
"react": "18.3.1",
|
|
137
97
|
"react-server-dom-webpack": "19.2.4",
|
|
138
98
|
"rimraf": "6.1.3",
|
|
139
99
|
"rou3": "^0.8.1",
|
|
140
|
-
"vite": "7.3.
|
|
100
|
+
"vite": "7.3.5",
|
|
141
101
|
"vite-plugin-cjs-interop": "2.4.4",
|
|
142
102
|
"vite-plugin-node-polyfills": "0.26.0",
|
|
143
103
|
"ws": "8.20.0",
|
|
144
104
|
"yargs-parser": "21.1.1"
|
|
145
105
|
},
|
|
146
106
|
"devDependencies": {
|
|
147
|
-
"@arethetypeswrong/cli": "0.18.
|
|
107
|
+
"@arethetypeswrong/cli": "0.18.4",
|
|
108
|
+
"@cedarjs/auth": "4.2.0",
|
|
109
|
+
"@cedarjs/router": "4.2.0",
|
|
110
|
+
"@cedarjs/web": "4.2.0",
|
|
148
111
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
149
|
-
"@
|
|
112
|
+
"@jridgewell/trace-mapping": "0.3.31",
|
|
113
|
+
"@types/aws-lambda": "8.10.162",
|
|
150
114
|
"@types/busboy": "^1",
|
|
151
115
|
"@types/express": "4",
|
|
152
116
|
"@types/react": "^18.2.55",
|
|
@@ -154,12 +118,18 @@
|
|
|
154
118
|
"@types/yargs-parser": "21.0.3",
|
|
155
119
|
"concurrently": "9.2.1",
|
|
156
120
|
"glob": "11.1.0",
|
|
157
|
-
"memfs": "4.57.
|
|
158
|
-
"publint": "0.3.
|
|
159
|
-
"rollup": "4.60.
|
|
160
|
-
"
|
|
121
|
+
"memfs": "4.57.7",
|
|
122
|
+
"publint": "0.3.21",
|
|
123
|
+
"rollup": "4.60.4",
|
|
124
|
+
"ts-dedent": "2.3.0",
|
|
125
|
+
"tsx": "4.22.4",
|
|
161
126
|
"typescript": "5.9.3",
|
|
162
|
-
"vitest": "3.2.
|
|
127
|
+
"vitest": "3.2.6"
|
|
128
|
+
},
|
|
129
|
+
"peerDependencies": {
|
|
130
|
+
"@cedarjs/auth": "4.2.0",
|
|
131
|
+
"@cedarjs/router": "4.2.0",
|
|
132
|
+
"@cedarjs/web": "4.2.0"
|
|
163
133
|
},
|
|
164
134
|
"engines": {
|
|
165
135
|
"node": ">=24"
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface BuildUDApiServerOptions {
|
|
2
|
-
verbose?: boolean;
|
|
3
|
-
apiRootPath?: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Builds the API server Universal Deploy entry using Vite.
|
|
7
|
-
*
|
|
8
|
-
* Runs a Vite server build that:
|
|
9
|
-
* 1. Installs `cedarUniversalDeployPlugin()` to register per-route API
|
|
10
|
-
* entries (GraphQL, auth, functions) with UD's store.
|
|
11
|
-
* 2. Installs `universalDeploy()` from `@universal-deploy/vite` which
|
|
12
|
-
* provides `catchAll()` (rou3-based route dispatch), `devServer()`, and
|
|
13
|
-
* auto-detection of deployment targets (Node by default, or Netlify/
|
|
14
|
-
* Vercel/Cloudflare if the user has added the corresponding Vite plugin).
|
|
15
|
-
*
|
|
16
|
-
* The emitted entry can be launched directly: node api/dist/ud/index.js
|
|
17
|
-
* That is what `cedar serve api` does.
|
|
18
|
-
*
|
|
19
|
-
* NOTE: The Vite "ssr" build target used here is a server-side module build
|
|
20
|
-
* concern — it is NOT related to Cedar HTML SSR or RSC. "ssr" simply means
|
|
21
|
-
* Vite produces a Node-compatible bundle rather than a browser bundle.
|
|
22
|
-
*/
|
|
23
|
-
export declare const buildUDApiServer: ({ verbose, apiRootPath, }?: BuildUDApiServerOptions) => Promise<void>;
|
|
24
|
-
//# sourceMappingURL=buildUDApiServer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildUDApiServer.d.ts","sourceRoot":"","sources":["../src/buildUDApiServer.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,GAAU,4BAGpC,uBAA4B,kBA6C9B,CAAA"}
|
package/dist/buildUDApiServer.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { getPaths } from "@cedarjs/project-config";
|
|
3
|
-
const buildUDApiServer = async ({
|
|
4
|
-
verbose = false,
|
|
5
|
-
apiRootPath
|
|
6
|
-
} = {}) => {
|
|
7
|
-
const { build } = await import("vite");
|
|
8
|
-
const { cedarUniversalDeployPlugin } = await import("./plugins/vite-plugin-cedar-universal-deploy.js");
|
|
9
|
-
const { default: universalDeploy } = await import("@universal-deploy/vite");
|
|
10
|
-
const rwPaths = getPaths();
|
|
11
|
-
const outDir = path.join(rwPaths.api.dist, "ud");
|
|
12
|
-
await build({
|
|
13
|
-
logLevel: verbose ? "info" : "warn",
|
|
14
|
-
plugins: [
|
|
15
|
-
// Registers per-route API entries with @universal-deploy/store.
|
|
16
|
-
cedarUniversalDeployPlugin({ apiRootPath }),
|
|
17
|
-
// Includes catchAll(), devServer(), and auto-detection of
|
|
18
|
-
// deployment targets. Enables @universal-deploy/node by default
|
|
19
|
-
// when no other target (Netlify, Vercel, Cloudflare) is detected
|
|
20
|
-
// in the user's Vite config.
|
|
21
|
-
universalDeploy()
|
|
22
|
-
],
|
|
23
|
-
// The ssr environment is the Vite mechanism for server-side builds.
|
|
24
|
-
// Reminder: "ssr" here means "server-side module execution", NOT
|
|
25
|
-
// Cedar HTML SSR / streaming / RSC.
|
|
26
|
-
environments: {
|
|
27
|
-
ssr: {
|
|
28
|
-
build: {
|
|
29
|
-
outDir
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
build: {
|
|
34
|
-
// This is a server (Node) build, not a browser build.
|
|
35
|
-
ssr: true
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
buildUDApiServer
|
|
41
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var buildUDApiServer_exports = {};
|
|
30
|
-
__export(buildUDApiServer_exports, {
|
|
31
|
-
buildUDApiServer: () => buildUDApiServer
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(buildUDApiServer_exports);
|
|
34
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
35
|
-
var import_project_config = require("@cedarjs/project-config");
|
|
36
|
-
const buildUDApiServer = async ({
|
|
37
|
-
verbose = false,
|
|
38
|
-
apiRootPath
|
|
39
|
-
} = {}) => {
|
|
40
|
-
const { build } = await import("vite");
|
|
41
|
-
const { cedarUniversalDeployPlugin } = await import("./plugins/vite-plugin-cedar-universal-deploy.js");
|
|
42
|
-
const { default: universalDeploy } = await import("@universal-deploy/vite");
|
|
43
|
-
const rwPaths = (0, import_project_config.getPaths)();
|
|
44
|
-
const outDir = import_node_path.default.join(rwPaths.api.dist, "ud");
|
|
45
|
-
await build({
|
|
46
|
-
logLevel: verbose ? "info" : "warn",
|
|
47
|
-
plugins: [
|
|
48
|
-
// Registers per-route API entries with @universal-deploy/store.
|
|
49
|
-
cedarUniversalDeployPlugin({ apiRootPath }),
|
|
50
|
-
// Includes catchAll(), devServer(), and auto-detection of
|
|
51
|
-
// deployment targets. Enables @universal-deploy/node by default
|
|
52
|
-
// when no other target (Netlify, Vercel, Cloudflare) is detected
|
|
53
|
-
// in the user's Vite config.
|
|
54
|
-
universalDeploy()
|
|
55
|
-
],
|
|
56
|
-
// The ssr environment is the Vite mechanism for server-side builds.
|
|
57
|
-
// Reminder: "ssr" here means "server-side module execution", NOT
|
|
58
|
-
// Cedar HTML SSR / streaming / RSC.
|
|
59
|
-
environments: {
|
|
60
|
-
ssr: {
|
|
61
|
-
build: {
|
|
62
|
-
outDir
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
build: {
|
|
67
|
-
// This is a server (Node) build, not a browser build.
|
|
68
|
-
ssr: true
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
-
0 && (module.exports = {
|
|
74
|
-
buildUDApiServer
|
|
75
|
-
});
|