@cedarjs/vite 5.0.0-canary.2432 → 5.0.0-canary.2433

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.
@@ -1 +1 @@
1
- {"version":3,"file":"buildApp.d.ts","sourceRoot":"","sources":["../src/buildApp.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,EAClC,OAAe,EACf,SAA0B,GAC3B,GAAE,oBAAyB,iBA4N3B"}
1
+ {"version":3,"file":"buildApp.d.ts","sourceRoot":"","sources":["../src/buildApp.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,EAClC,OAAe,EACf,SAA0B,GAC3B,GAAE,oBAAyB,iBA0P3B"}
package/dist/buildApp.js CHANGED
@@ -125,6 +125,20 @@ async function buildCedarApp({
125
125
  delete config.environments.ssr;
126
126
  }
127
127
  }
128
+ },
129
+ {
130
+ name: "cedar-build-app",
131
+ buildApp: {
132
+ order: "pre",
133
+ async handler(builder2) {
134
+ if (workspace.includes("web") && builder2.environments.client && !builder2.environments.client.isBuilt) {
135
+ await builder2.build(builder2.environments.client);
136
+ }
137
+ if (workspace.includes("api") && builder2.environments.api && !builder2.environments.api.isBuilt) {
138
+ await builder2.build(builder2.environments.api);
139
+ }
140
+ }
141
+ }
128
142
  }
129
143
  ];
130
144
  if (workspace.includes("api")) {
@@ -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;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,OAAe,GAChB,GAAE,uBAA4B,iBA6E9B"}
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,iBAyG9B"}
@@ -9,62 +9,84 @@ async function buildUDApiServer({
9
9
  const { catchAllEntry, getAllEntries } = await import("@universal-deploy/store");
10
10
  const cedarPaths = getPaths();
11
11
  const outDir = path.join(cedarPaths.api.dist, "ud");
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
- );
12
+ const providerOutputDirs = [path.join(cedarPaths.base, ".vercel", "output")];
13
+ const savedDirs = /* @__PURE__ */ new Map();
14
+ for (const dir of providerOutputDirs) {
15
+ if (fs.existsSync(dir)) {
16
+ const tmpDir = dir + ".cedar-ud-backup";
17
+ await fs.promises.cp(dir, tmpDir, { recursive: true, force: true });
18
+ savedDirs.set(dir, tmpDir);
19
+ }
20
+ }
21
+ try {
22
+ await build({
23
+ // Load the user's Vite config so all plugins (Cedar's UD plugin,
24
+ // provider plugins, etc.) run during the build.
25
+ configFile: cedarPaths.web.viteConfig,
26
+ logLevel: verbose ? "info" : "warn",
27
+ plugins: [
28
+ // catchAll() generates the rou3-based route dispatcher
29
+ // (virtual:ud:catch-all). devServer() provides Vite dev support for
30
+ // cedar dev --ud.
31
+ //
32
+ // NOTE: We intentionally do NOT use universalDeploy() here — that
33
+ // plugin auto-detects deployment targets and would embed the Node
34
+ // HTTP server startup code into the output. Our plugin list is
35
+ // adapter-free: the output is a pure Fetchable export, and cedar
36
+ // serve wraps it in srvx at runtime.
37
+ catchAll(),
38
+ devServer(),
39
+ // Warn if no Cedar API routes were registered likely means the
40
+ // user's vite config is missing cedarUniversalDeployPlugin or there
41
+ // are no API functions to serve.
42
+ {
43
+ name: "cedar-ud-verify-routes",
44
+ configResolved() {
45
+ const entries = getAllEntries();
46
+ if (entries.length === 0) {
47
+ console.warn(
48
+ "\n Warning: No Universal Deploy API routes were registered.",
49
+ "\n The built server entry will be an empty router (404 for all",
50
+ "\n requests). Check that you have API functions under",
51
+ "\n `api/src/functions/` and that your vite config includes",
52
+ "\n `cedarUniversalDeployPlugin()`.\n"
53
+ );
54
+ }
44
55
  }
45
56
  }
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"
57
+ ],
58
+ // Legacy ssr flag approach. The explicit rollupOptions.input prevents the
59
+ // "index.html as SSR entry" error. Vite will also build a 'client'
60
+ // environment from the user's config file (wasteful but harmless), and
61
+ // the 'ssr' environment produces our canonical Fetchable artifact at
62
+ // api/dist/ud/index.js.
63
+ build: {
64
+ ssr: true,
65
+ outDir,
66
+ rollupOptions: {
67
+ input: catchAllEntry,
68
+ output: {
69
+ entryFileNames: "index.js"
70
+ }
60
71
  }
61
72
  }
73
+ });
74
+ fs.writeFileSync(
75
+ path.join(outDir, "package.json"),
76
+ JSON.stringify({ type: "module" }, null, 2)
77
+ );
78
+ } finally {
79
+ for (const [dir, tmpDir] of savedDirs) {
80
+ if (fs.existsSync(tmpDir)) {
81
+ const opts = { recursive: true, force: true };
82
+ await fs.promises.rm(dir, opts).catch(() => {
83
+ });
84
+ await fs.promises.cp(tmpDir, dir, opts);
85
+ await fs.promises.rm(tmpDir, opts).catch(() => {
86
+ });
87
+ }
62
88
  }
63
- });
64
- fs.writeFileSync(
65
- path.join(outDir, "package.json"),
66
- JSON.stringify({ type: "module" }, null, 2)
67
- );
89
+ }
68
90
  }
69
91
  export {
70
92
  buildUDApiServer
@@ -155,6 +155,20 @@ async function buildCedarApp({
155
155
  delete config.environments.ssr;
156
156
  }
157
157
  }
158
+ },
159
+ {
160
+ name: "cedar-build-app",
161
+ buildApp: {
162
+ order: "pre",
163
+ async handler(builder2) {
164
+ if (workspace.includes("web") && builder2.environments.client && !builder2.environments.client.isBuilt) {
165
+ await builder2.build(builder2.environments.client);
166
+ }
167
+ if (workspace.includes("api") && builder2.environments.api && !builder2.environments.api.isBuilt) {
168
+ await builder2.build(builder2.environments.api);
169
+ }
170
+ }
171
+ }
158
172
  }
159
173
  ];
160
174
  if (workspace.includes("api")) {
@@ -42,62 +42,84 @@ async function buildUDApiServer({
42
42
  const { catchAllEntry, getAllEntries } = await import("@universal-deploy/store");
43
43
  const cedarPaths = (0, import_project_config.getPaths)();
44
44
  const outDir = import_node_path.default.join(cedarPaths.api.dist, "ud");
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
- );
45
+ const providerOutputDirs = [import_node_path.default.join(cedarPaths.base, ".vercel", "output")];
46
+ const savedDirs = /* @__PURE__ */ new Map();
47
+ for (const dir of providerOutputDirs) {
48
+ if (import_node_fs.default.existsSync(dir)) {
49
+ const tmpDir = dir + ".cedar-ud-backup";
50
+ await import_node_fs.default.promises.cp(dir, tmpDir, { recursive: true, force: true });
51
+ savedDirs.set(dir, tmpDir);
52
+ }
53
+ }
54
+ try {
55
+ await build({
56
+ // Load the user's Vite config so all plugins (Cedar's UD plugin,
57
+ // provider plugins, etc.) run during the build.
58
+ configFile: cedarPaths.web.viteConfig,
59
+ logLevel: verbose ? "info" : "warn",
60
+ plugins: [
61
+ // catchAll() generates the rou3-based route dispatcher
62
+ // (virtual:ud:catch-all). devServer() provides Vite dev support for
63
+ // cedar dev --ud.
64
+ //
65
+ // NOTE: We intentionally do NOT use universalDeploy() here — that
66
+ // plugin auto-detects deployment targets and would embed the Node
67
+ // HTTP server startup code into the output. Our plugin list is
68
+ // adapter-free: the output is a pure Fetchable export, and cedar
69
+ // serve wraps it in srvx at runtime.
70
+ catchAll(),
71
+ devServer(),
72
+ // Warn if no Cedar API routes were registered likely means the
73
+ // user's vite config is missing cedarUniversalDeployPlugin or there
74
+ // are no API functions to serve.
75
+ {
76
+ name: "cedar-ud-verify-routes",
77
+ configResolved() {
78
+ const entries = getAllEntries();
79
+ if (entries.length === 0) {
80
+ console.warn(
81
+ "\n Warning: No Universal Deploy API routes were registered.",
82
+ "\n The built server entry will be an empty router (404 for all",
83
+ "\n requests). Check that you have API functions under",
84
+ "\n `api/src/functions/` and that your vite config includes",
85
+ "\n `cedarUniversalDeployPlugin()`.\n"
86
+ );
87
+ }
77
88
  }
78
89
  }
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"
90
+ ],
91
+ // Legacy ssr flag approach. The explicit rollupOptions.input prevents the
92
+ // "index.html as SSR entry" error. Vite will also build a 'client'
93
+ // environment from the user's config file (wasteful but harmless), and
94
+ // the 'ssr' environment produces our canonical Fetchable artifact at
95
+ // api/dist/ud/index.js.
96
+ build: {
97
+ ssr: true,
98
+ outDir,
99
+ rollupOptions: {
100
+ input: catchAllEntry,
101
+ output: {
102
+ entryFileNames: "index.js"
103
+ }
93
104
  }
94
105
  }
106
+ });
107
+ import_node_fs.default.writeFileSync(
108
+ import_node_path.default.join(outDir, "package.json"),
109
+ JSON.stringify({ type: "module" }, null, 2)
110
+ );
111
+ } finally {
112
+ for (const [dir, tmpDir] of savedDirs) {
113
+ if (import_node_fs.default.existsSync(tmpDir)) {
114
+ const opts = { recursive: true, force: true };
115
+ await import_node_fs.default.promises.rm(dir, opts).catch(() => {
116
+ });
117
+ await import_node_fs.default.promises.cp(tmpDir, dir, opts);
118
+ await import_node_fs.default.promises.rm(tmpDir, opts).catch(() => {
119
+ });
120
+ }
95
121
  }
96
- });
97
- import_node_fs.default.writeFileSync(
98
- import_node_path.default.join(outDir, "package.json"),
99
- JSON.stringify({ type: "module" }, null, 2)
100
- );
122
+ }
101
123
  }
102
124
  // Annotate the CommonJS export names for ESM import in node:
103
125
  0 && (module.exports = {
@@ -115,10 +115,7 @@ function cedarUniversalDeployPlugin(options = {}) {
115
115
  apply: "build",
116
116
  config: {
117
117
  order: "pre",
118
- handler(_config, env) {
119
- if (!env.isSsrBuild) {
120
- return;
121
- }
118
+ handler() {
122
119
  if (entriesInjected) {
123
120
  return;
124
121
  }
@@ -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,CA0HR"}
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,CAuHR"}
@@ -82,10 +82,7 @@ function cedarUniversalDeployPlugin(options = {}) {
82
82
  apply: "build",
83
83
  config: {
84
84
  order: "pre",
85
- handler(_config, env) {
86
- if (!env.isSsrBuild) {
87
- return;
88
- }
85
+ handler() {
89
86
  if (entriesInjected) {
90
87
  return;
91
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "5.0.0-canary.2432",
3
+ "version": "5.0.0-canary.2433",
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.2432",
73
- "@cedarjs/auth": "5.0.0-canary.2432",
74
- "@cedarjs/babel-config": "5.0.0-canary.2432",
75
- "@cedarjs/context": "5.0.0-canary.2432",
76
- "@cedarjs/cookie-jar": "5.0.0-canary.2432",
77
- "@cedarjs/graphql-server": "5.0.0-canary.2432",
78
- "@cedarjs/internal": "5.0.0-canary.2432",
79
- "@cedarjs/project-config": "5.0.0-canary.2432",
80
- "@cedarjs/server-store": "5.0.0-canary.2432",
81
- "@cedarjs/testing": "5.0.0-canary.2432",
82
- "@cedarjs/web": "5.0.0-canary.2432",
72
+ "@cedarjs/api": "5.0.0-canary.2433",
73
+ "@cedarjs/auth": "5.0.0-canary.2433",
74
+ "@cedarjs/babel-config": "5.0.0-canary.2433",
75
+ "@cedarjs/context": "5.0.0-canary.2433",
76
+ "@cedarjs/cookie-jar": "5.0.0-canary.2433",
77
+ "@cedarjs/graphql-server": "5.0.0-canary.2433",
78
+ "@cedarjs/internal": "5.0.0-canary.2433",
79
+ "@cedarjs/project-config": "5.0.0-canary.2433",
80
+ "@cedarjs/server-store": "5.0.0-canary.2433",
81
+ "@cedarjs/testing": "5.0.0-canary.2433",
82
+ "@cedarjs/web": "5.0.0-canary.2433",
83
83
  "@fastify/url-data": "6.0.3",
84
84
  "@swc/core": "1.15.33",
85
85
  "@universal-deploy/store": "^0.2.1",