@cedarjs/vite 7.1.0 → 7.1.1-next.468
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/buildApp.d.ts.map +1 -1
- package/dist/buildApp.js +32 -11
- package/dist/buildRouteHooks.d.ts +7 -13
- package/dist/buildRouteHooks.d.ts.map +1 -1
- package/dist/buildRouteHooks.js +5 -10
- package/dist/bundled/react-server-dom-webpack.server.js +2263 -29124
- package/dist/devFeServer.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/jobsDevMiddleware.d.ts.map +1 -1
- package/dist/jobsDevMiddleware.js +29 -2
- package/dist/lib/sandboxChildren.d.ts +58 -0
- package/dist/lib/sandboxChildren.d.ts.map +1 -0
- package/dist/lib/sandboxChildren.js +157 -0
- package/dist/plugins/vite-plugin-cedar-cell.d.ts +2 -1
- package/dist/plugins/vite-plugin-cedar-cell.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-cell.js +30 -11
- package/dist/plugins/vite-plugin-cedar-parsed-scalars.d.ts +20 -0
- package/dist/plugins/vite-plugin-cedar-parsed-scalars.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-parsed-scalars.js +60 -0
- package/dist/plugins/vite-plugin-cedar-sandbox-children.d.ts +20 -0
- package/dist/plugins/vite-plugin-cedar-sandbox-children.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-sandbox-children.js +58 -0
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts +2 -6
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-handler-als-wrapping.js +4 -7
- package/dist/rsc/rscBuildClient.d.ts +1 -1
- package/dist/rsc/rscBuildForServer.d.ts +1 -1
- package/dist/rsc/rscBuildForSsr.d.ts +1 -1
- package/dist/runFeServer.js +3 -3
- package/dist/streaming/streamHelpers.d.ts +6 -1
- package/dist/streaming/streamHelpers.d.ts.map +1 -1
- package/dist/streaming/streamHelpers.js +1 -1
- package/package.json +46 -44
package/dist/buildApp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildApp.d.ts","sourceRoot":"","sources":["../src/buildApp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"buildApp.d.ts","sourceRoot":"","sources":["../src/buildApp.ts"],"names":[],"mappings":"AAuEA,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,EAAE,CAAC,EAAE,OAAO,CAAA;CACb;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,EAClC,OAAe,EACf,SAA0B,EAC1B,EAAU,GACX,GAAE,oBAAyB,iBAyd3B"}
|
package/dist/buildApp.js
CHANGED
|
@@ -23,10 +23,14 @@ import { findApiFiles } from "@cedarjs/internal/dist/files.js";
|
|
|
23
23
|
import {
|
|
24
24
|
createPrismaClientFileMatcher,
|
|
25
25
|
getConfig,
|
|
26
|
-
getPaths
|
|
27
|
-
projectSideIsEsm
|
|
26
|
+
getPaths
|
|
28
27
|
} from "@cedarjs/project-config";
|
|
29
28
|
import { generateDiffSourceMap } from "./lib/generateDiffSourceMap.js";
|
|
29
|
+
import {
|
|
30
|
+
copySandboxChildrenIntoVercelFunctions,
|
|
31
|
+
findSandboxChildScripts,
|
|
32
|
+
SANDBOX_CHILDREN_DIR
|
|
33
|
+
} from "./lib/sandboxChildren.js";
|
|
30
34
|
import { getWorkspacePackageAliases } from "./lib/workspacePackageAliases.js";
|
|
31
35
|
import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
|
|
32
36
|
import { cedarDirectoryNamedImportPlugin } from "./plugins/vite-plugin-cedar-directory-named-import.js";
|
|
@@ -35,6 +39,7 @@ import { cedarGraphqlOptionsExtractPlugin } from "./plugins/vite-plugin-cedar-gr
|
|
|
35
39
|
import { cedarImportDirPlugin } from "./plugins/vite-plugin-cedar-import-dir.js";
|
|
36
40
|
import { cedarMockCellDataPlugin } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
|
|
37
41
|
import { cedarOtelWrappingPlugin } from "./plugins/vite-plugin-cedar-otel-wrapping.js";
|
|
42
|
+
import { cedarSandboxChildrenPlugin } from "./plugins/vite-plugin-cedar-sandbox-children.js";
|
|
38
43
|
import { cedarjsJobPathInjectorPlugin } from "./plugins/vite-plugin-cedarjs-job-path-injector.js";
|
|
39
44
|
import { handlerAlsWrappingPlugin } from "./plugins/vite-plugin-handler-als-wrapping.js";
|
|
40
45
|
function resolveWithExtensions(id) {
|
|
@@ -57,6 +62,7 @@ async function buildCedarApp({
|
|
|
57
62
|
const cedarPaths = getPaths();
|
|
58
63
|
const cedarConfig = getConfig();
|
|
59
64
|
const environments = {};
|
|
65
|
+
let sandboxChildren = {};
|
|
60
66
|
if (workspace.includes("web")) {
|
|
61
67
|
environments.client = {
|
|
62
68
|
build: {
|
|
@@ -65,8 +71,6 @@ async function buildCedarApp({
|
|
|
65
71
|
};
|
|
66
72
|
}
|
|
67
73
|
if (workspace.includes("api")) {
|
|
68
|
-
const isEsm = projectSideIsEsm("api");
|
|
69
|
-
const format = isEsm ? "es" : "cjs";
|
|
70
74
|
const apiFiles = findApiFiles();
|
|
71
75
|
const input = {};
|
|
72
76
|
for (const f of apiFiles) {
|
|
@@ -82,7 +86,7 @@ async function buildCedarApp({
|
|
|
82
86
|
rollupOptions: {
|
|
83
87
|
input,
|
|
84
88
|
output: {
|
|
85
|
-
format,
|
|
89
|
+
format: "es",
|
|
86
90
|
preserveModules: true,
|
|
87
91
|
preserveModulesRoot: cedarPaths.api.src,
|
|
88
92
|
entryFileNames: "[name].js",
|
|
@@ -100,15 +104,16 @@ async function buildCedarApp({
|
|
|
100
104
|
}
|
|
101
105
|
};
|
|
102
106
|
if (ud) {
|
|
107
|
+
sandboxChildren = findSandboxChildScripts(cedarPaths.api.src);
|
|
103
108
|
environments["ssr"] = {
|
|
104
109
|
build: {
|
|
105
110
|
ssr: true,
|
|
106
111
|
outDir: path.join(cedarPaths.api.dist, "ud"),
|
|
107
112
|
emptyOutDir: true,
|
|
108
113
|
rollupOptions: {
|
|
109
|
-
input: catchAllEntry,
|
|
114
|
+
input: { index: catchAllEntry, ...sandboxChildren },
|
|
110
115
|
output: {
|
|
111
|
-
entryFileNames: "
|
|
116
|
+
entryFileNames: "[name].js"
|
|
112
117
|
},
|
|
113
118
|
external: (id) => {
|
|
114
119
|
if (id.startsWith("virtual:")) {
|
|
@@ -204,6 +209,12 @@ async function buildCedarApp({
|
|
|
204
209
|
];
|
|
205
210
|
if (ud) {
|
|
206
211
|
plugins.push(catchAll());
|
|
212
|
+
plugins.push(
|
|
213
|
+
cedarSandboxChildrenPlugin({
|
|
214
|
+
environment: "ssr",
|
|
215
|
+
children: sandboxChildren
|
|
216
|
+
})
|
|
217
|
+
);
|
|
207
218
|
plugins.push({
|
|
208
219
|
name: "cedar-ud-verify-routes",
|
|
209
220
|
configResolved() {
|
|
@@ -261,9 +272,7 @@ async function buildCedarApp({
|
|
|
261
272
|
plugins.push(cedarDirectoryNamedImportPlugin());
|
|
262
273
|
plugins.push(cedarOtelWrappingPlugin());
|
|
263
274
|
plugins.push(cedarjsJobPathInjectorPlugin());
|
|
264
|
-
plugins.push(
|
|
265
|
-
handlerAlsWrappingPlugin({ projectIsEsm: projectSideIsEsm("api") })
|
|
266
|
-
);
|
|
275
|
+
plugins.push(handlerAlsWrappingPlugin());
|
|
267
276
|
}
|
|
268
277
|
plugins.push(cedarMockCellDataPlugin());
|
|
269
278
|
if (workspace.includes("api")) {
|
|
@@ -346,7 +355,19 @@ async function buildCedarApp({
|
|
|
346
355
|
},
|
|
347
356
|
plugins
|
|
348
357
|
});
|
|
349
|
-
|
|
358
|
+
await builder.buildApp();
|
|
359
|
+
const vercelNode = builder.environments["vercel_node"];
|
|
360
|
+
if (ud && vercelNode && Object.keys(sandboxChildren).length > 0) {
|
|
361
|
+
const outDir = path.resolve(
|
|
362
|
+
vercelNode.config.root,
|
|
363
|
+
vercelNode.config.build.outDir
|
|
364
|
+
);
|
|
365
|
+
copySandboxChildrenIntoVercelFunctions({
|
|
366
|
+
appRoot: cedarPaths.base,
|
|
367
|
+
childrenDir: path.join(cedarPaths.api.dist, "ud", SANDBOX_CHILDREN_DIR),
|
|
368
|
+
functionsDir: path.join(outDir, "functions")
|
|
369
|
+
});
|
|
370
|
+
}
|
|
350
371
|
}
|
|
351
372
|
export {
|
|
352
373
|
buildCedarApp
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import type { Paths } from '@cedarjs/project-config';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* Returns the path, relative to `web/dist/ssr/routeHooks`, that the built
|
|
10
|
-
* version of the given route hook source file is written to. The layout
|
|
11
|
-
* mirrors `web/src`, so `web/src/pages/HomePage/HomePage.routeHooks.ts` ends
|
|
12
|
-
* up at `pages/HomePage/HomePage.routeHooks.js` and `web/src/App.routeHooks.ts`
|
|
13
|
-
* at `App.routeHooks.js` (`.mjs` in a CommonJS web side, see
|
|
14
|
-
* getRouteHookDistExtension()).
|
|
3
|
+
* Returns the path, relative to `web/dist/ssr/routeHooks` and with a `.js`
|
|
4
|
+
* extension, that the built version of the given route hook source file is
|
|
5
|
+
* written to. The layout mirrors `web/src`, so
|
|
6
|
+
* `web/src/pages/HomePage/HomePage.routeHooks.ts` ends up at
|
|
7
|
+
* `pages/HomePage/HomePage.routeHooks.js` and `web/src/App.routeHooks.ts` at
|
|
8
|
+
* `App.routeHooks.js`.
|
|
15
9
|
*
|
|
16
10
|
* Used both by the build (to name the Rollup entries) and by the route
|
|
17
11
|
* manifest (so the streaming handler can find the file at request time).
|
|
18
12
|
*/
|
|
19
|
-
export declare function getRouteHookDistPath(routeHookSrcPath: string, webSrc?: string
|
|
13
|
+
export declare function getRouteHookDistPath(routeHookSrcPath: string, webSrc?: string): string;
|
|
20
14
|
/**
|
|
21
15
|
* Bundles every `web/src/** /*.routeHooks.{js,ts,tsx,jsx}` file into
|
|
22
16
|
* `web/dist/ssr/routeHooks` as a node ESM module, one output file per route
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildRouteHooks.d.ts","sourceRoot":"","sources":["../src/buildRouteHooks.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAiBpD
|
|
1
|
+
{"version":3,"file":"buildRouteHooks.d.ts","sourceRoot":"","sources":["../src/buildRouteHooks.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAiBpD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,MAAM,EACxB,MAAM,SAAqB,UAG5B;AA6BD;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,OAAO,EAAE,KAAK,iBAuEf"}
|
package/dist/buildRouteHooks.js
CHANGED
|
@@ -3,7 +3,7 @@ import { build as viteBuild } from "vite";
|
|
|
3
3
|
import { gqlPlugin as gqlTagPlugin } from "vite-plugin-graphql-tag";
|
|
4
4
|
import tsPathsMod from "vite-tsconfig-paths";
|
|
5
5
|
import { findRouteHooksSrc } from "@cedarjs/internal/dist/files.js";
|
|
6
|
-
import { getPaths
|
|
6
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
7
7
|
import { cedarApiImportGuardPlugin } from "./plugins/vite-plugin-cedar-api-import-guard.js";
|
|
8
8
|
import { cedarAutoImportsPlugin } from "./plugins/vite-plugin-cedar-auto-import.js";
|
|
9
9
|
import { cedarDirectoryNamedImportPlugin } from "./plugins/vite-plugin-cedar-directory-named-import.js";
|
|
@@ -13,11 +13,8 @@ const tsconfigPaths = (
|
|
|
13
13
|
// interop
|
|
14
14
|
tsPathsMod.default?.default || tsPathsMod.default || tsPathsMod
|
|
15
15
|
);
|
|
16
|
-
function
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
function getRouteHookDistPath(routeHookSrcPath, webSrc = getPaths().web.src, extension = getRouteHookDistExtension()) {
|
|
20
|
-
return getRouteHookEntryName(routeHookSrcPath, webSrc) + extension;
|
|
16
|
+
function getRouteHookDistPath(routeHookSrcPath, webSrc = getPaths().web.src) {
|
|
17
|
+
return getRouteHookEntryName(routeHookSrcPath, webSrc) + ".js";
|
|
21
18
|
}
|
|
22
19
|
function getRouteHookEntryName(routeHookSrcPath, webSrc) {
|
|
23
20
|
return path.relative(webSrc, routeHookSrcPath).replace(/\.(js|ts|tsx|jsx)$/, "").split(path.sep).join("/");
|
|
@@ -38,7 +35,6 @@ async function buildRouteHooks(verbose, rwPaths) {
|
|
|
38
35
|
for (const routeHook of allRouteHooks) {
|
|
39
36
|
input[getRouteHookEntryName(routeHook, rwPaths.web.src)] = routeHook;
|
|
40
37
|
}
|
|
41
|
-
const extension = getRouteHookDistExtension();
|
|
42
38
|
await viteBuild({
|
|
43
39
|
// Route hooks run in node, so the project's web/vite.config, which is set
|
|
44
40
|
// up for browser and SSR builds of React code, doesn't apply. Only the
|
|
@@ -81,9 +77,9 @@ async function buildRouteHooks(verbose, rwPaths) {
|
|
|
81
77
|
input,
|
|
82
78
|
output: {
|
|
83
79
|
format: "es",
|
|
84
|
-
entryFileNames: "[name]"
|
|
80
|
+
entryFileNames: "[name].js",
|
|
85
81
|
// Modules shared between route hooks, like the api side's db.js
|
|
86
|
-
chunkFileNames: "chunks/[name]-[hash]"
|
|
82
|
+
chunkFileNames: "chunks/[name]-[hash].js",
|
|
87
83
|
exports: "named"
|
|
88
84
|
}
|
|
89
85
|
}
|
|
@@ -100,6 +96,5 @@ async function buildRouteHooks(verbose, rwPaths) {
|
|
|
100
96
|
}
|
|
101
97
|
export {
|
|
102
98
|
buildRouteHooks,
|
|
103
|
-
getRouteHookDistExtension,
|
|
104
99
|
getRouteHookDistPath
|
|
105
100
|
};
|