@cedarjs/vite 5.0.0-canary.2419 → 5.0.0-canary.2422
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/buildUDApiServer.d.ts +1 -2
- package/dist/buildUDApiServer.d.ts.map +1 -1
- package/dist/buildUDApiServer.js +52 -62
- package/dist/cjs/buildUDApiServer.js +52 -62
- package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +1 -0
- package/dist/plugins/vite-plugin-cedar-universal-deploy.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-universal-deploy.js +1 -0
- package/package.json +12 -12
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface BuildUDApiServerOptions {
|
|
2
2
|
verbose?: boolean;
|
|
3
|
-
apiRootPath?: string;
|
|
4
3
|
}
|
|
5
4
|
/**
|
|
6
5
|
* Builds the API server Universal Deploy server entry using Vite.
|
|
@@ -26,5 +25,5 @@ export interface BuildUDApiServerOptions {
|
|
|
26
25
|
* simply means Vite produces a Node-compatible bundle rather than a browser
|
|
27
26
|
* bundle.
|
|
28
27
|
*/
|
|
29
|
-
export declare function buildUDApiServer({ verbose,
|
|
28
|
+
export declare function buildUDApiServer({ verbose, }?: BuildUDApiServerOptions): Promise<void>;
|
|
30
29
|
//# sourceMappingURL=buildUDApiServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildUDApiServer.d.ts","sourceRoot":"","sources":["../src/buildUDApiServer.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"buildUDApiServer.d.ts","sourceRoot":"","sources":["../src/buildUDApiServer.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,OAAe,GAChB,GAAE,uBAA4B,iBA6E9B"}
|
package/dist/buildUDApiServer.js
CHANGED
|
@@ -2,79 +2,69 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { getPaths } from "@cedarjs/project-config";
|
|
4
4
|
async function buildUDApiServer({
|
|
5
|
-
verbose = false
|
|
6
|
-
apiRootPath
|
|
5
|
+
verbose = false
|
|
7
6
|
} = {}) {
|
|
8
7
|
const { build } = await import("vite");
|
|
9
8
|
const { catchAll, devServer } = await import("@universal-deploy/vite");
|
|
10
9
|
const { catchAllEntry, getAllEntries } = await import("@universal-deploy/store");
|
|
11
10
|
const cedarPaths = getPaths();
|
|
12
11
|
const outDir = path.join(cedarPaths.api.dist, "ud");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"\n requests). Check that you have API functions under",
|
|
46
|
-
"\n `api/src/functions/` and that your vite config includes",
|
|
47
|
-
"\n `cedarUniversalDeployPlugin()`.\n"
|
|
48
|
-
);
|
|
49
|
-
}
|
|
12
|
+
await build({
|
|
13
|
+
// Load the user's Vite config so all plugins (Cedar's UD plugin,
|
|
14
|
+
// provider plugins, etc.) run during the build.
|
|
15
|
+
configFile: cedarPaths.web.viteConfig,
|
|
16
|
+
logLevel: verbose ? "info" : "warn",
|
|
17
|
+
plugins: [
|
|
18
|
+
// catchAll() generates the rou3-based route dispatcher
|
|
19
|
+
// (virtual:ud:catch-all). devServer() provides Vite dev support for
|
|
20
|
+
// cedar dev --ud.
|
|
21
|
+
//
|
|
22
|
+
// NOTE: We intentionally do NOT use universalDeploy() here — that
|
|
23
|
+
// plugin auto-detects deployment targets and would embed the Node
|
|
24
|
+
// HTTP server startup code into the output. Our plugin list is
|
|
25
|
+
// adapter-free: the output is a pure Fetchable export, and cedar
|
|
26
|
+
// serve wraps it in srvx at runtime.
|
|
27
|
+
catchAll(),
|
|
28
|
+
devServer(),
|
|
29
|
+
// Warn if no Cedar API routes were registered — likely means the
|
|
30
|
+
// user's vite config is missing cedarUniversalDeployPlugin or there
|
|
31
|
+
// are no API functions to serve.
|
|
32
|
+
{
|
|
33
|
+
name: "cedar-ud-verify-routes",
|
|
34
|
+
configResolved() {
|
|
35
|
+
const entries = getAllEntries();
|
|
36
|
+
if (entries.length === 0) {
|
|
37
|
+
console.warn(
|
|
38
|
+
"\n Warning: No Universal Deploy API routes were registered.",
|
|
39
|
+
"\n The built server entry will be an empty router (404 for all",
|
|
40
|
+
"\n requests). Check that you have API functions under",
|
|
41
|
+
"\n `api/src/functions/` and that your vite config includes",
|
|
42
|
+
"\n `cedarUniversalDeployPlugin()`.\n"
|
|
43
|
+
);
|
|
50
44
|
}
|
|
51
45
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
// Legacy ssr flag approach. The explicit rollupOptions.input prevents the
|
|
49
|
+
// "index.html as SSR entry" error. Vite will also build a 'client'
|
|
50
|
+
// environment from the user's config file (wasteful but harmless), and
|
|
51
|
+
// the 'ssr' environment produces our canonical Fetchable artifact at
|
|
52
|
+
// api/dist/ud/index.js.
|
|
53
|
+
build: {
|
|
54
|
+
ssr: true,
|
|
55
|
+
outDir,
|
|
56
|
+
rollupOptions: {
|
|
57
|
+
input: catchAllEntry,
|
|
58
|
+
output: {
|
|
59
|
+
entryFileNames: "index.js"
|
|
66
60
|
}
|
|
67
61
|
}
|
|
68
|
-
});
|
|
69
|
-
fs.writeFileSync(
|
|
70
|
-
path.join(outDir, "package.json"),
|
|
71
|
-
JSON.stringify({ type: "module" }, null, 2)
|
|
72
|
-
);
|
|
73
|
-
} finally {
|
|
74
|
-
if (apiRootPath !== void 0) {
|
|
75
|
-
delete process.env.CEDAR_API_ROOT_PATH;
|
|
76
62
|
}
|
|
77
|
-
}
|
|
63
|
+
});
|
|
64
|
+
fs.writeFileSync(
|
|
65
|
+
path.join(outDir, "package.json"),
|
|
66
|
+
JSON.stringify({ type: "module" }, null, 2)
|
|
67
|
+
);
|
|
78
68
|
}
|
|
79
69
|
export {
|
|
80
70
|
buildUDApiServer
|
|
@@ -35,79 +35,69 @@ var import_node_fs = __toESM(require("node:fs"), 1);
|
|
|
35
35
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
36
36
|
var import_project_config = require("@cedarjs/project-config");
|
|
37
37
|
async function buildUDApiServer({
|
|
38
|
-
verbose = false
|
|
39
|
-
apiRootPath
|
|
38
|
+
verbose = false
|
|
40
39
|
} = {}) {
|
|
41
40
|
const { build } = await import("vite");
|
|
42
41
|
const { catchAll, devServer } = await import("@universal-deploy/vite");
|
|
43
42
|
const { catchAllEntry, getAllEntries } = await import("@universal-deploy/store");
|
|
44
43
|
const cedarPaths = (0, import_project_config.getPaths)();
|
|
45
44
|
const outDir = import_node_path.default.join(cedarPaths.api.dist, "ud");
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"\n requests). Check that you have API functions under",
|
|
79
|
-
"\n `api/src/functions/` and that your vite config includes",
|
|
80
|
-
"\n `cedarUniversalDeployPlugin()`.\n"
|
|
81
|
-
);
|
|
82
|
-
}
|
|
45
|
+
await build({
|
|
46
|
+
// Load the user's Vite config so all plugins (Cedar's UD plugin,
|
|
47
|
+
// provider plugins, etc.) run during the build.
|
|
48
|
+
configFile: cedarPaths.web.viteConfig,
|
|
49
|
+
logLevel: verbose ? "info" : "warn",
|
|
50
|
+
plugins: [
|
|
51
|
+
// catchAll() generates the rou3-based route dispatcher
|
|
52
|
+
// (virtual:ud:catch-all). devServer() provides Vite dev support for
|
|
53
|
+
// cedar dev --ud.
|
|
54
|
+
//
|
|
55
|
+
// NOTE: We intentionally do NOT use universalDeploy() here — that
|
|
56
|
+
// plugin auto-detects deployment targets and would embed the Node
|
|
57
|
+
// HTTP server startup code into the output. Our plugin list is
|
|
58
|
+
// adapter-free: the output is a pure Fetchable export, and cedar
|
|
59
|
+
// serve wraps it in srvx at runtime.
|
|
60
|
+
catchAll(),
|
|
61
|
+
devServer(),
|
|
62
|
+
// Warn if no Cedar API routes were registered — likely means the
|
|
63
|
+
// user's vite config is missing cedarUniversalDeployPlugin or there
|
|
64
|
+
// are no API functions to serve.
|
|
65
|
+
{
|
|
66
|
+
name: "cedar-ud-verify-routes",
|
|
67
|
+
configResolved() {
|
|
68
|
+
const entries = getAllEntries();
|
|
69
|
+
if (entries.length === 0) {
|
|
70
|
+
console.warn(
|
|
71
|
+
"\n Warning: No Universal Deploy API routes were registered.",
|
|
72
|
+
"\n The built server entry will be an empty router (404 for all",
|
|
73
|
+
"\n requests). Check that you have API functions under",
|
|
74
|
+
"\n `api/src/functions/` and that your vite config includes",
|
|
75
|
+
"\n `cedarUniversalDeployPlugin()`.\n"
|
|
76
|
+
);
|
|
83
77
|
}
|
|
84
78
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
// Legacy ssr flag approach. The explicit rollupOptions.input prevents the
|
|
82
|
+
// "index.html as SSR entry" error. Vite will also build a 'client'
|
|
83
|
+
// environment from the user's config file (wasteful but harmless), and
|
|
84
|
+
// the 'ssr' environment produces our canonical Fetchable artifact at
|
|
85
|
+
// api/dist/ud/index.js.
|
|
86
|
+
build: {
|
|
87
|
+
ssr: true,
|
|
88
|
+
outDir,
|
|
89
|
+
rollupOptions: {
|
|
90
|
+
input: catchAllEntry,
|
|
91
|
+
output: {
|
|
92
|
+
entryFileNames: "index.js"
|
|
99
93
|
}
|
|
100
94
|
}
|
|
101
|
-
});
|
|
102
|
-
import_node_fs.default.writeFileSync(
|
|
103
|
-
import_node_path.default.join(outDir, "package.json"),
|
|
104
|
-
JSON.stringify({ type: "module" }, null, 2)
|
|
105
|
-
);
|
|
106
|
-
} finally {
|
|
107
|
-
if (apiRootPath !== void 0) {
|
|
108
|
-
delete process.env.CEDAR_API_ROOT_PATH;
|
|
109
95
|
}
|
|
110
|
-
}
|
|
96
|
+
});
|
|
97
|
+
import_node_fs.default.writeFileSync(
|
|
98
|
+
import_node_path.default.join(outDir, "package.json"),
|
|
99
|
+
JSON.stringify({ type: "module" }, null, 2)
|
|
100
|
+
);
|
|
111
101
|
}
|
|
112
102
|
// Annotate the CommonJS export names for ESM import in node:
|
|
113
103
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-universal-deploy.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-universal-deploy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAMlC,MAAM,WAAW,iCAAiC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAuJD,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,iCAAsC,GAC9C,MAAM,
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-universal-deploy.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-universal-deploy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAMlC,MAAM,WAAW,iCAAiC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAuJD,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,iCAAsC,GAC9C,MAAM,CAgHR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2422",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -69,17 +69,17 @@
|
|
|
69
69
|
"@babel/generator": "7.29.1",
|
|
70
70
|
"@babel/parser": "7.29.3",
|
|
71
71
|
"@babel/traverse": "7.29.0",
|
|
72
|
-
"@cedarjs/api": "5.0.0-canary.
|
|
73
|
-
"@cedarjs/auth": "5.0.0-canary.
|
|
74
|
-
"@cedarjs/babel-config": "5.0.0-canary.
|
|
75
|
-
"@cedarjs/context": "5.0.0-canary.
|
|
76
|
-
"@cedarjs/cookie-jar": "5.0.0-canary.
|
|
77
|
-
"@cedarjs/graphql-server": "5.0.0-canary.
|
|
78
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
79
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
80
|
-
"@cedarjs/server-store": "5.0.0-canary.
|
|
81
|
-
"@cedarjs/testing": "5.0.0-canary.
|
|
82
|
-
"@cedarjs/web": "5.0.0-canary.
|
|
72
|
+
"@cedarjs/api": "5.0.0-canary.2422",
|
|
73
|
+
"@cedarjs/auth": "5.0.0-canary.2422",
|
|
74
|
+
"@cedarjs/babel-config": "5.0.0-canary.2422",
|
|
75
|
+
"@cedarjs/context": "5.0.0-canary.2422",
|
|
76
|
+
"@cedarjs/cookie-jar": "5.0.0-canary.2422",
|
|
77
|
+
"@cedarjs/graphql-server": "5.0.0-canary.2422",
|
|
78
|
+
"@cedarjs/internal": "5.0.0-canary.2422",
|
|
79
|
+
"@cedarjs/project-config": "5.0.0-canary.2422",
|
|
80
|
+
"@cedarjs/server-store": "5.0.0-canary.2422",
|
|
81
|
+
"@cedarjs/testing": "5.0.0-canary.2422",
|
|
82
|
+
"@cedarjs/web": "5.0.0-canary.2422",
|
|
83
83
|
"@fastify/url-data": "6.0.3",
|
|
84
84
|
"@swc/core": "1.15.33",
|
|
85
85
|
"@universal-deploy/store": "^0.2.1",
|