@cedarjs/vite 5.0.0-canary.2363 → 5.0.0-canary.2374
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.map +1 -1
- package/dist/buildUDApiServer.js +0 -7
- package/dist/cjs/buildUDApiServer.js +0 -7
- package/dist/cjs/lib/getMergedConfig.js +6 -3
- package/dist/cjs/plugins/vite-plugin-cedar-entry-injection.js +20 -5
- package/dist/cjs/runFeServer.js +1 -1
- package/dist/lib/getMergedConfig.d.ts.map +1 -1
- package/dist/lib/getMergedConfig.js +6 -3
- 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/runFeServer.js +1 -1
- package/package.json +13 -13
|
@@ -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;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,OAAe,EACf,WAAW,GACZ,GAAE,uBAA4B,
|
|
1
|
+
{"version":3,"file":"buildUDApiServer.d.ts","sourceRoot":"","sources":["../src/buildUDApiServer.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,uBAAuB;IACtC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,gBAAgB,CAAC,EACrC,OAAe,EACf,WAAW,GACZ,GAAE,uBAA4B,iBA2F9B"}
|
package/dist/buildUDApiServer.js
CHANGED
|
@@ -18,13 +18,6 @@ async function buildUDApiServer({
|
|
|
18
18
|
// Load the user's Vite config so all plugins (Cedar's UD plugin,
|
|
19
19
|
// provider plugins, etc.) run during the build.
|
|
20
20
|
configFile: cedarPaths.web.viteConfig,
|
|
21
|
-
// Cedar's getMergedConfig (from the cedar() plugin) overrides root to
|
|
22
|
-
// web/src/. For the UD server build, we want root to be the config
|
|
23
|
-
// file directory (web/) so that plugins like @netlify/vite-plugin
|
|
24
|
-
// output their files relative to the project structure, not a source
|
|
25
|
-
// directory.
|
|
26
|
-
// TODO: See what it'd take to *not* have cedar() set it to web/src
|
|
27
|
-
root: cedarPaths.web.base,
|
|
28
21
|
logLevel: verbose ? "info" : "warn",
|
|
29
22
|
plugins: [
|
|
30
23
|
// catchAll() generates the rou3-based route dispatcher
|
|
@@ -51,13 +51,6 @@ async function buildUDApiServer({
|
|
|
51
51
|
// Load the user's Vite config so all plugins (Cedar's UD plugin,
|
|
52
52
|
// provider plugins, etc.) run during the build.
|
|
53
53
|
configFile: cedarPaths.web.viteConfig,
|
|
54
|
-
// Cedar's getMergedConfig (from the cedar() plugin) overrides root to
|
|
55
|
-
// web/src/. For the UD server build, we want root to be the config
|
|
56
|
-
// file directory (web/) so that plugins like @netlify/vite-plugin
|
|
57
|
-
// output their files relative to the project structure, not a source
|
|
58
|
-
// directory.
|
|
59
|
-
// TODO: See what it'd take to *not* have cedar() set it to web/src
|
|
60
|
-
root: cedarPaths.web.base,
|
|
61
54
|
logLevel: verbose ? "info" : "warn",
|
|
62
55
|
plugins: [
|
|
63
56
|
// catchAll() generates the rou3-based route dispatcher
|
|
@@ -50,7 +50,7 @@ function getMergedConfig(cedarConfig, cedarPaths) {
|
|
|
50
50
|
apiPort = cedarConfig.api.port;
|
|
51
51
|
}
|
|
52
52
|
const defaultCedarViteConfig = {
|
|
53
|
-
root: cedarPaths.web.
|
|
53
|
+
root: cedarPaths.web.base,
|
|
54
54
|
resolve: {
|
|
55
55
|
alias: workspaceAliases
|
|
56
56
|
},
|
|
@@ -104,7 +104,7 @@ function getMergedConfig(cedarConfig, cedarPaths) {
|
|
|
104
104
|
// Note that sourcemap can be boolean or 'inline'
|
|
105
105
|
sourcemap: !env.isSsrBuild && cedarConfig.web.sourceMap,
|
|
106
106
|
rollupOptions: {
|
|
107
|
-
input: getRollupInput(!!env.isSsrBuild)
|
|
107
|
+
input: getRollupInput(userConfig, !!env.isSsrBuild)
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
// @MARK: do not set buildSsrCjsExternalHeuristics here
|
|
@@ -137,9 +137,12 @@ function getMergedConfig(cedarConfig, cedarPaths) {
|
|
|
137
137
|
return (0, import_vite.mergeConfig)(defaultCedarViteConfig, userConfig);
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
|
-
function getRollupInput(ssr) {
|
|
140
|
+
function getRollupInput(userConfig, ssr) {
|
|
141
141
|
const cedarConfig = (0, import_project_config.getConfig)();
|
|
142
142
|
const cedarPaths = (0, import_project_config.getPaths)();
|
|
143
|
+
if (userConfig.build?.rollupOptions?.input) {
|
|
144
|
+
return userConfig.build.rollupOptions.input;
|
|
145
|
+
}
|
|
143
146
|
if (!cedarPaths.web.entryClient) {
|
|
144
147
|
throw new Error("entryClient not defined");
|
|
145
148
|
}
|
|
@@ -36,21 +36,36 @@ var import_node_path = __toESM(require("node:path"), 1);
|
|
|
36
36
|
var import_vite = require("vite");
|
|
37
37
|
var import_project_config = require("@cedarjs/project-config");
|
|
38
38
|
function cedarEntryInjectionPlugin() {
|
|
39
|
-
const
|
|
40
|
-
const clientEntryPath =
|
|
39
|
+
const cedarPaths = (0, import_project_config.getPaths)();
|
|
40
|
+
const clientEntryPath = cedarPaths.web.entryClient;
|
|
41
41
|
if (!clientEntryPath) {
|
|
42
42
|
throw new Error(
|
|
43
43
|
"Vite client entry point not found. Please check that your project has an entry.client.{jsx,tsx} file in the web/src directory."
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
|
-
const relativeEntryPath =
|
|
46
|
+
const relativeEntryPath = (0, import_vite.normalizePath)(
|
|
47
|
+
import_node_path.default.relative(cedarPaths.web.base, clientEntryPath)
|
|
48
|
+
);
|
|
47
49
|
return {
|
|
48
50
|
name: "cedar-entry-injection",
|
|
51
|
+
// Vite's dependency optimizer and dev server resolve the script tag
|
|
52
|
+
// src="/src/entry.client.{tsx,jsx}" as an absolute filesystem path
|
|
53
|
+
// (/src/entry.client.tsx) instead of relative to the Vite root.
|
|
54
|
+
// This hook maps it to the real file path so Vite can find it.
|
|
55
|
+
resolveId(id) {
|
|
56
|
+
if (id === "/" + relativeEntryPath) {
|
|
57
|
+
return clientEntryPath;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
},
|
|
49
61
|
// ---------- Bundle injection ----------
|
|
50
62
|
// Used by Vite during dev, to inject the entrypoint.
|
|
51
63
|
transformIndexHtml: {
|
|
52
64
|
order: "pre",
|
|
53
|
-
handler: (html) => {
|
|
65
|
+
handler: (html, ctx) => {
|
|
66
|
+
if (!ctx.filename || (0, import_vite.normalizePath)(ctx.filename) !== (0, import_vite.normalizePath)(cedarPaths.web.html)) {
|
|
67
|
+
return html;
|
|
68
|
+
}
|
|
54
69
|
if (import_node_fs.default.existsSync(clientEntryPath)) {
|
|
55
70
|
return html.replace(
|
|
56
71
|
"</head>",
|
|
@@ -67,7 +82,7 @@ function cedarEntryInjectionPlugin() {
|
|
|
67
82
|
// Used by rollup during build to inject the entrypoint
|
|
68
83
|
// but note index.html does not come through as an id during dev
|
|
69
84
|
transform: (code, id) => {
|
|
70
|
-
if (import_node_fs.default.existsSync(clientEntryPath) && (0, import_vite.normalizePath)(id) === (0, import_vite.normalizePath)(
|
|
85
|
+
if (import_node_fs.default.existsSync(clientEntryPath) && (0, import_vite.normalizePath)(id) === (0, import_vite.normalizePath)(cedarPaths.web.html)) {
|
|
71
86
|
return {
|
|
72
87
|
code: code.replace(
|
|
73
88
|
"</head>",
|
package/dist/cjs/runFeServer.js
CHANGED
|
@@ -74,7 +74,7 @@ async function runFeServer() {
|
|
|
74
74
|
import_node_path.default.join(rwPaths.web.distBrowser, "client-build-manifest.json")
|
|
75
75
|
).href;
|
|
76
76
|
const clientBuildManifest = (await import(clientBuildManifestUrl, { with: { type: "json" } })).default;
|
|
77
|
-
const clientEntry = rscEnabled ? clientBuildManifest["entry.client.tsx"] || clientBuildManifest["entry.client.jsx"] : Object.values(clientBuildManifest).find(
|
|
77
|
+
const clientEntry = rscEnabled ? clientBuildManifest["src/entry.client.tsx"] || clientBuildManifest["src/entry.client.jsx"] : Object.values(clientBuildManifest).find(
|
|
78
78
|
(manifestItem) => manifestItem.isEntry
|
|
79
79
|
);
|
|
80
80
|
if (!clientEntry) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getMergedConfig.d.ts","sourceRoot":"","sources":["../../src/lib/getMergedConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAS5D;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,IAC5D,YAAY,cAAc,EAAE,KAAK,SAAS,KAAG,cAAc,CAqHpE"}
|
|
@@ -21,7 +21,7 @@ function getMergedConfig(cedarConfig, cedarPaths) {
|
|
|
21
21
|
apiPort = cedarConfig.api.port;
|
|
22
22
|
}
|
|
23
23
|
const defaultCedarViteConfig = {
|
|
24
|
-
root: cedarPaths.web.
|
|
24
|
+
root: cedarPaths.web.base,
|
|
25
25
|
resolve: {
|
|
26
26
|
alias: workspaceAliases
|
|
27
27
|
},
|
|
@@ -75,7 +75,7 @@ function getMergedConfig(cedarConfig, cedarPaths) {
|
|
|
75
75
|
// Note that sourcemap can be boolean or 'inline'
|
|
76
76
|
sourcemap: !env.isSsrBuild && cedarConfig.web.sourceMap,
|
|
77
77
|
rollupOptions: {
|
|
78
|
-
input: getRollupInput(!!env.isSsrBuild)
|
|
78
|
+
input: getRollupInput(userConfig, !!env.isSsrBuild)
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
// @MARK: do not set buildSsrCjsExternalHeuristics here
|
|
@@ -108,9 +108,12 @@ function getMergedConfig(cedarConfig, cedarPaths) {
|
|
|
108
108
|
return mergeConfig(defaultCedarViteConfig, userConfig);
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
-
function getRollupInput(ssr) {
|
|
111
|
+
function getRollupInput(userConfig, ssr) {
|
|
112
112
|
const cedarConfig = getConfig();
|
|
113
113
|
const cedarPaths = getPaths();
|
|
114
|
+
if (userConfig.build?.rollupOptions?.input) {
|
|
115
|
+
return userConfig.build.rollupOptions.input;
|
|
116
|
+
}
|
|
114
117
|
if (!cedarPaths.web.entryClient) {
|
|
115
118
|
throw new Error("entryClient not defined");
|
|
116
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-entry-injection.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-entry-injection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC,wBAAgB,yBAAyB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-entry-injection.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-entry-injection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC,wBAAgB,yBAAyB,IAAI,MAAM,CAqFlD"}
|
|
@@ -3,21 +3,36 @@ import path from "node:path";
|
|
|
3
3
|
import { normalizePath } from "vite";
|
|
4
4
|
import { getPaths } from "@cedarjs/project-config";
|
|
5
5
|
function cedarEntryInjectionPlugin() {
|
|
6
|
-
const
|
|
7
|
-
const clientEntryPath =
|
|
6
|
+
const cedarPaths = getPaths();
|
|
7
|
+
const clientEntryPath = cedarPaths.web.entryClient;
|
|
8
8
|
if (!clientEntryPath) {
|
|
9
9
|
throw new Error(
|
|
10
10
|
"Vite client entry point not found. Please check that your project has an entry.client.{jsx,tsx} file in the web/src directory."
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
const relativeEntryPath =
|
|
13
|
+
const relativeEntryPath = normalizePath(
|
|
14
|
+
path.relative(cedarPaths.web.base, clientEntryPath)
|
|
15
|
+
);
|
|
14
16
|
return {
|
|
15
17
|
name: "cedar-entry-injection",
|
|
18
|
+
// Vite's dependency optimizer and dev server resolve the script tag
|
|
19
|
+
// src="/src/entry.client.{tsx,jsx}" as an absolute filesystem path
|
|
20
|
+
// (/src/entry.client.tsx) instead of relative to the Vite root.
|
|
21
|
+
// This hook maps it to the real file path so Vite can find it.
|
|
22
|
+
resolveId(id) {
|
|
23
|
+
if (id === "/" + relativeEntryPath) {
|
|
24
|
+
return clientEntryPath;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
},
|
|
16
28
|
// ---------- Bundle injection ----------
|
|
17
29
|
// Used by Vite during dev, to inject the entrypoint.
|
|
18
30
|
transformIndexHtml: {
|
|
19
31
|
order: "pre",
|
|
20
|
-
handler: (html) => {
|
|
32
|
+
handler: (html, ctx) => {
|
|
33
|
+
if (!ctx.filename || normalizePath(ctx.filename) !== normalizePath(cedarPaths.web.html)) {
|
|
34
|
+
return html;
|
|
35
|
+
}
|
|
21
36
|
if (fs.existsSync(clientEntryPath)) {
|
|
22
37
|
return html.replace(
|
|
23
38
|
"</head>",
|
|
@@ -34,7 +49,7 @@ function cedarEntryInjectionPlugin() {
|
|
|
34
49
|
// Used by rollup during build to inject the entrypoint
|
|
35
50
|
// but note index.html does not come through as an id during dev
|
|
36
51
|
transform: (code, id) => {
|
|
37
|
-
if (fs.existsSync(clientEntryPath) && normalizePath(id) === normalizePath(
|
|
52
|
+
if (fs.existsSync(clientEntryPath) && normalizePath(id) === normalizePath(cedarPaths.web.html)) {
|
|
38
53
|
return {
|
|
39
54
|
code: code.replace(
|
|
40
55
|
"</head>",
|
package/dist/runFeServer.js
CHANGED
|
@@ -41,7 +41,7 @@ async function runFeServer() {
|
|
|
41
41
|
path.join(rwPaths.web.distBrowser, "client-build-manifest.json")
|
|
42
42
|
).href;
|
|
43
43
|
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(
|
|
44
|
+
const clientEntry = rscEnabled ? clientBuildManifest["src/entry.client.tsx"] || clientBuildManifest["src/entry.client.jsx"] : Object.values(clientBuildManifest).find(
|
|
45
45
|
(manifestItem) => manifestItem.isEntry
|
|
46
46
|
);
|
|
47
47
|
if (!clientEntry) {
|
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.2374",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -99,18 +99,18 @@
|
|
|
99
99
|
"@babel/generator": "7.29.1",
|
|
100
100
|
"@babel/parser": "7.29.3",
|
|
101
101
|
"@babel/traverse": "7.29.0",
|
|
102
|
-
"@cedarjs/api": "5.0.0-canary.
|
|
103
|
-
"@cedarjs/api-server": "5.0.0-canary.
|
|
104
|
-
"@cedarjs/auth": "5.0.0-canary.
|
|
105
|
-
"@cedarjs/babel-config": "5.0.0-canary.
|
|
106
|
-
"@cedarjs/context": "5.0.0-canary.
|
|
107
|
-
"@cedarjs/cookie-jar": "5.0.0-canary.
|
|
108
|
-
"@cedarjs/graphql-server": "5.0.0-canary.
|
|
109
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
110
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
111
|
-
"@cedarjs/server-store": "5.0.0-canary.
|
|
112
|
-
"@cedarjs/testing": "5.0.0-canary.
|
|
113
|
-
"@cedarjs/web": "5.0.0-canary.
|
|
102
|
+
"@cedarjs/api": "5.0.0-canary.2374",
|
|
103
|
+
"@cedarjs/api-server": "5.0.0-canary.2374",
|
|
104
|
+
"@cedarjs/auth": "5.0.0-canary.2374",
|
|
105
|
+
"@cedarjs/babel-config": "5.0.0-canary.2374",
|
|
106
|
+
"@cedarjs/context": "5.0.0-canary.2374",
|
|
107
|
+
"@cedarjs/cookie-jar": "5.0.0-canary.2374",
|
|
108
|
+
"@cedarjs/graphql-server": "5.0.0-canary.2374",
|
|
109
|
+
"@cedarjs/internal": "5.0.0-canary.2374",
|
|
110
|
+
"@cedarjs/project-config": "5.0.0-canary.2374",
|
|
111
|
+
"@cedarjs/server-store": "5.0.0-canary.2374",
|
|
112
|
+
"@cedarjs/testing": "5.0.0-canary.2374",
|
|
113
|
+
"@cedarjs/web": "5.0.0-canary.2374",
|
|
114
114
|
"@fastify/url-data": "6.0.3",
|
|
115
115
|
"@swc/core": "1.15.33",
|
|
116
116
|
"@universal-deploy/store": "^0.2.1",
|