@cedarjs/vite 7.0.1-next.467 → 7.1.0-rc.32
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 +11 -32
- package/dist/buildRouteHooks.d.ts +13 -7
- package/dist/buildRouteHooks.d.ts.map +1 -1
- package/dist/buildRouteHooks.js +10 -5
- package/dist/bundled/react-server-dom-webpack.server.js +29125 -2264
- package/dist/devFeServer.js +3 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/jobsDevMiddleware.d.ts.map +1 -1
- package/dist/jobsDevMiddleware.js +2 -29
- package/dist/plugins/vite-plugin-cedar-cell.d.ts +1 -2
- package/dist/plugins/vite-plugin-cedar-cell.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-cell.js +11 -30
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts +6 -2
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-handler-als-wrapping.js +7 -4
- 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 +1 -6
- package/dist/streaming/streamHelpers.d.ts.map +1 -1
- package/dist/streaming/streamHelpers.js +1 -1
- package/package.json +44 -46
- package/dist/lib/sandboxChildren.d.ts +0 -58
- package/dist/lib/sandboxChildren.d.ts.map +0 -1
- package/dist/lib/sandboxChildren.js +0 -157
- package/dist/plugins/vite-plugin-cedar-parsed-scalars.d.ts +0 -20
- package/dist/plugins/vite-plugin-cedar-parsed-scalars.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-parsed-scalars.js +0 -60
- package/dist/plugins/vite-plugin-cedar-sandbox-children.d.ts +0 -20
- package/dist/plugins/vite-plugin-cedar-sandbox-children.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-sandbox-children.js +0 -58
package/dist/devFeServer.js
CHANGED
|
@@ -25,7 +25,7 @@ async function createServer() {
|
|
|
25
25
|
const rwPaths = getPaths();
|
|
26
26
|
const rscEnabled = getConfig().experimental.rsc?.enabled ?? false;
|
|
27
27
|
const serverStorage = createServerStorage();
|
|
28
|
-
app.use((req, _res, next) => {
|
|
28
|
+
app.use("*", (req, _res, next) => {
|
|
29
29
|
const fullUrl = getFullUrl(req, rscEnabled);
|
|
30
30
|
const perReqStore = createPerRequestMap({
|
|
31
31
|
// Convert express headers to fetch header
|
|
@@ -102,8 +102,8 @@ async function createServer() {
|
|
|
102
102
|
},
|
|
103
103
|
vite
|
|
104
104
|
);
|
|
105
|
-
app.get("
|
|
106
|
-
app.post("
|
|
105
|
+
app.get("*", createServerAdapter(routeHandler));
|
|
106
|
+
app.post("*", handleWithMiddleware());
|
|
107
107
|
const port = getConfig().web.port;
|
|
108
108
|
console.log(`Started server on http://localhost:${port}`);
|
|
109
109
|
return app.listen(port);
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ export { cedarRemoveFromBundle } from './plugins/vite-plugin-cedar-remove-from-b
|
|
|
19
19
|
export { cedarjsResolveCedarStyleImportsPlugin } from './plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js';
|
|
20
20
|
export { cedarjsJobPathInjectorPlugin } from './plugins/vite-plugin-cedarjs-job-path-injector.js';
|
|
21
21
|
export { cedarMockCellDataPlugin } from './plugins/vite-plugin-cedar-mock-cell-data.js';
|
|
22
|
-
export { cedarParsedScalarsPlugin } from './plugins/vite-plugin-cedar-parsed-scalars.js';
|
|
23
22
|
export { cedarMergedConfig } from './plugins/vite-plugin-merged-config.js';
|
|
24
23
|
export { cedarNetlifySkewProtectionPlugin } from './plugins/vite-plugin-cedar-netlify-skew-protection.js';
|
|
25
24
|
export { cedarSwapApolloProvider } from './plugins/vite-plugin-swap-apollo-provider.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAoCxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAA;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,EAAE,gCAAgC,EAAE,MAAM,wDAAwD,CAAA;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAA;AACtF,OAAO,EACL,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,uDAAuD,CAAA;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAA;AAC/E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4DAA4D,CAAA;AACzG,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAA;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAA;AACzF,OAAO,EAAE,qCAAqC,EAAE,MAAM,8DAA8D,CAAA;AACpH,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAA;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC1E,OAAO,EAAE,gCAAgC,EAAE,MAAM,wDAAwD,CAAA;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAA;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iDAAiD,CAAA;AAC5F,OAAO,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAA;AAE1F,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAE,aAAkB,GAAG,YAAY,EAAE,CA+CzE;AAED,8DAA8D;AAC9D,eAAe,KAAK,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,6 @@ import { cedarDataUriShim } from "./plugins/vite-plugin-cedar-data-uri-shim.js";
|
|
|
20
20
|
import { cedarEntryInjectionPlugin } from "./plugins/vite-plugin-cedar-entry-injection.js";
|
|
21
21
|
import { cedarHtmlEnvPlugin } from "./plugins/vite-plugin-cedar-html-env.js";
|
|
22
22
|
import { cedarMockCellDataPlugin } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
|
|
23
|
-
import { cedarParsedScalarsPlugin } from "./plugins/vite-plugin-cedar-parsed-scalars.js";
|
|
24
23
|
import { cedarRemoveDevFatalErrorPage } from "./plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js";
|
|
25
24
|
import { cedarRemoveFromBundle } from "./plugins/vite-plugin-cedar-remove-from-bundle.js";
|
|
26
25
|
import { cedarRoutesAutoLoaderPlugin } from "./plugins/vite-plugin-cedar-routes-auto-loader.js";
|
|
@@ -50,7 +49,6 @@ import { cedarRemoveFromBundle as cedarRemoveFromBundle2 } from "./plugins/vite-
|
|
|
50
49
|
import { cedarjsResolveCedarStyleImportsPlugin as cedarjsResolveCedarStyleImportsPlugin2 } from "./plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js";
|
|
51
50
|
import { cedarjsJobPathInjectorPlugin } from "./plugins/vite-plugin-cedarjs-job-path-injector.js";
|
|
52
51
|
import { cedarMockCellDataPlugin as cedarMockCellDataPlugin2 } from "./plugins/vite-plugin-cedar-mock-cell-data.js";
|
|
53
|
-
import { cedarParsedScalarsPlugin as cedarParsedScalarsPlugin2 } from "./plugins/vite-plugin-cedar-parsed-scalars.js";
|
|
54
52
|
import { cedarMergedConfig as cedarMergedConfig2 } from "./plugins/vite-plugin-merged-config.js";
|
|
55
53
|
import { cedarNetlifySkewProtectionPlugin } from "./plugins/vite-plugin-cedar-netlify-skew-protection.js";
|
|
56
54
|
import { cedarSwapApolloProvider as cedarSwapApolloProvider2 } from "./plugins/vite-plugin-swap-apollo-provider.js";
|
|
@@ -82,7 +80,6 @@ function cedar({ mode, babel } = {}) {
|
|
|
82
80
|
cedarMergedConfig(),
|
|
83
81
|
cedarjsResolveCedarStyleImportsPlugin(),
|
|
84
82
|
cedarSwapApolloProvider(),
|
|
85
|
-
cedarParsedScalarsPlugin(),
|
|
86
83
|
cedarCellTransform(),
|
|
87
84
|
cedarRemoveFromBundle(),
|
|
88
85
|
cedarRemoveDevFatalErrorPage(),
|
|
@@ -112,7 +109,6 @@ export {
|
|
|
112
109
|
cedarMockCellDataPlugin2 as cedarMockCellDataPlugin,
|
|
113
110
|
cedarNetlifySkewProtectionPlugin,
|
|
114
111
|
cedarOtelWrappingPlugin,
|
|
115
|
-
cedarParsedScalarsPlugin2 as cedarParsedScalarsPlugin,
|
|
116
112
|
cedarRemoveDevFatalErrorPage2 as cedarRemoveDevFatalErrorPage,
|
|
117
113
|
cedarRemoveFromBundle2 as cedarRemoveFromBundle,
|
|
118
114
|
cedarRoutesAutoLoaderPlugin2 as cedarRoutesAutoLoaderPlugin,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobsDevMiddleware.d.ts","sourceRoot":"","sources":["../src/jobsDevMiddleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jobsDevMiddleware.d.ts","sourceRoot":"","sources":["../src/jobsDevMiddleware.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AAyEzC,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC1B;AAKD,KAAK,eAAe,GAAG,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC,CAAA;AAE3D;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,eAAe,GAC1B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA8FhC"}
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import { hostname } from "node:os";
|
|
3
|
-
import path from "node:path";
|
|
4
1
|
import { pathToFileURL } from "node:url";
|
|
5
2
|
import ansis from "ansis";
|
|
6
3
|
import {
|
|
7
|
-
isJobModuleFile,
|
|
8
4
|
JobNotFoundError,
|
|
9
5
|
JobsLibNotFoundError,
|
|
10
|
-
jobsFromModules,
|
|
11
6
|
setJobLoaderOverrides
|
|
12
7
|
} from "@cedarjs/jobs";
|
|
13
8
|
import { getPaths } from "@cedarjs/project-config";
|
|
@@ -45,27 +40,10 @@ async function loadJobViaVite(viteServer, { name: jobName, path: jobPath }) {
|
|
|
45
40
|
}
|
|
46
41
|
return mod[jobName];
|
|
47
42
|
}
|
|
48
|
-
async function loadAllJobsViaVite(viteServer) {
|
|
49
|
-
const jobsDir = getPaths().api.jobs;
|
|
50
|
-
if (!fs.existsSync(jobsDir)) {
|
|
51
|
-
return [];
|
|
52
|
-
}
|
|
53
|
-
const files = fs.readdirSync(jobsDir, { recursive: true, encoding: "utf-8" }).filter(isJobModuleFile).sort();
|
|
54
|
-
const modules = [];
|
|
55
|
-
for (const file of files) {
|
|
56
|
-
modules.push(
|
|
57
|
-
await viteServer.ssrLoadModule(
|
|
58
|
-
pathToFileURL(path.join(jobsDir, file)).href
|
|
59
|
-
)
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
return jobsFromModules(modules);
|
|
63
|
-
}
|
|
64
43
|
async function startJobsDevWorkers(viteServer) {
|
|
65
44
|
setJobLoaderOverrides({
|
|
66
45
|
loadJobsManager: () => loadJobsManagerViaVite(viteServer),
|
|
67
|
-
loadJob: (computedProperties) => loadJobViaVite(viteServer, computedProperties)
|
|
68
|
-
loadAllJobs: () => loadAllJobsViaVite(viteServer)
|
|
46
|
+
loadJob: (computedProperties) => loadJobViaVite(viteServer, computedProperties)
|
|
69
47
|
});
|
|
70
48
|
let jobsManager;
|
|
71
49
|
try {
|
|
@@ -83,17 +61,12 @@ async function startJobsDevWorkers(viteServer) {
|
|
|
83
61
|
setJobLoaderOverrides(void 0);
|
|
84
62
|
return null;
|
|
85
63
|
}
|
|
86
|
-
try {
|
|
87
|
-
await jobsManager.syncSchedules();
|
|
88
|
-
} catch (e) {
|
|
89
|
-
logger.error("[CedarJS Jobs] Could not sync the declared schedules", e);
|
|
90
|
-
}
|
|
91
64
|
logger.warn(
|
|
92
65
|
`[CedarJS Jobs] Starting ${numWorkers.length} worker(s) in-process (Unified Dev)...`
|
|
93
66
|
);
|
|
94
67
|
const workers = numWorkers.map(([index, id]) => {
|
|
95
68
|
const workerConfig = jobsManager.workers[index];
|
|
96
|
-
const processName = `ud-jobs.${[workerConfig.queue].flat().join("-")}.${id}
|
|
69
|
+
const processName = `ud-jobs.${[workerConfig.queue].flat().join("-")}.${id}`;
|
|
97
70
|
return jobsManager.createWorker({
|
|
98
71
|
index,
|
|
99
72
|
clear: false,
|
|
@@ -16,8 +16,7 @@ import type { Plugin } from 'vite';
|
|
|
16
16
|
* export const QUERY = gql`...`
|
|
17
17
|
* export const Loading = () => <div>Loading...</div>
|
|
18
18
|
* export const Success = ({ data }) => <div>{data}</div>
|
|
19
|
-
*
|
|
20
|
-
* export default MyCell
|
|
19
|
+
* export default createCell({ QUERY, Loading, Success, displayName: 'MyCell' })
|
|
21
20
|
* ```
|
|
22
21
|
*/
|
|
23
22
|
export declare function cedarCellTransform(): Plugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-cell.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAqBlC
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-cell.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-cell.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAqBlC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAsK3C"}
|
|
@@ -23,7 +23,6 @@ function cedarCellTransform() {
|
|
|
23
23
|
if (!id.match(/Cell\.[jt]sx?$/)) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
|
-
const cellComponentName = parsePath(id).name;
|
|
27
26
|
try {
|
|
28
27
|
const ast = parse(code, {
|
|
29
28
|
sourceType: "module",
|
|
@@ -112,38 +111,20 @@ function cedarCellTransform() {
|
|
|
112
111
|
computed: false
|
|
113
112
|
}
|
|
114
113
|
];
|
|
115
|
-
const cellVariableDeclaration = {
|
|
116
|
-
type: "VariableDeclaration",
|
|
117
|
-
kind: "const",
|
|
118
|
-
declarations: [
|
|
119
|
-
{
|
|
120
|
-
type: "VariableDeclarator",
|
|
121
|
-
id: {
|
|
122
|
-
type: "Identifier",
|
|
123
|
-
name: cellComponentName
|
|
124
|
-
},
|
|
125
|
-
init: {
|
|
126
|
-
type: "CallExpression",
|
|
127
|
-
callee: {
|
|
128
|
-
type: "Identifier",
|
|
129
|
-
name: createCellHookName
|
|
130
|
-
},
|
|
131
|
-
arguments: [
|
|
132
|
-
{
|
|
133
|
-
type: "ObjectExpression",
|
|
134
|
-
properties: objectProperties
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
]
|
|
140
|
-
};
|
|
141
|
-
path.node.body.push(cellVariableDeclaration);
|
|
142
114
|
const exportDefaultDeclaration = {
|
|
143
115
|
type: "ExportDefaultDeclaration",
|
|
144
116
|
declaration: {
|
|
145
|
-
type: "
|
|
146
|
-
|
|
117
|
+
type: "CallExpression",
|
|
118
|
+
callee: {
|
|
119
|
+
type: "Identifier",
|
|
120
|
+
name: createCellHookName
|
|
121
|
+
},
|
|
122
|
+
arguments: [
|
|
123
|
+
{
|
|
124
|
+
type: "ObjectExpression",
|
|
125
|
+
properties: objectProperties
|
|
126
|
+
}
|
|
127
|
+
]
|
|
147
128
|
}
|
|
148
129
|
};
|
|
149
130
|
path.node.body.push(exportDefaultDeclaration);
|
|
@@ -25,7 +25,9 @@ import type { Plugin } from 'vite';
|
|
|
25
25
|
* This replaces `babel-plugin-handler-als-wrapping` for Vite builds.
|
|
26
26
|
* The babel plugin is still used for Jest and prerender.
|
|
27
27
|
*/
|
|
28
|
-
export declare function handlerAlsWrappingPlugin(
|
|
28
|
+
export declare function handlerAlsWrappingPlugin({ projectIsEsm, }?: {
|
|
29
|
+
projectIsEsm?: boolean;
|
|
30
|
+
}): Plugin;
|
|
29
31
|
/**
|
|
30
32
|
* Wraps the `handler` export of an API function file with an async context
|
|
31
33
|
* store guard. Returns the transformed code, or `null` if the file does not
|
|
@@ -36,5 +38,7 @@ export declare function handlerAlsWrappingPlugin(): Plugin;
|
|
|
36
38
|
* function so it can be applied from build pipelines that don't go through
|
|
37
39
|
* Vite's plugin pipeline (e.g. the legacy esbuild API build).
|
|
38
40
|
*/
|
|
39
|
-
export declare function applyHandlerAlsWrapping(code: string
|
|
41
|
+
export declare function applyHandlerAlsWrapping(code: string, { projectIsEsm }?: {
|
|
42
|
+
projectIsEsm?: boolean;
|
|
43
|
+
}): string | null;
|
|
40
44
|
//# sourceMappingURL=vite-plugin-handler-als-wrapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"vite-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,YAAoB,GACrB,GAAE;IACD,YAAY,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,MAAM,CAuBd;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,EAAE,YAAoB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACxD,MAAM,GAAG,IAAI,CAsDf"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { normalizePath } from "vite";
|
|
3
3
|
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
-
function handlerAlsWrappingPlugin(
|
|
4
|
+
function handlerAlsWrappingPlugin({
|
|
5
|
+
projectIsEsm = false
|
|
6
|
+
} = {}) {
|
|
5
7
|
return {
|
|
6
8
|
name: "handler-als-wrapping",
|
|
7
9
|
transform(code, id) {
|
|
@@ -15,12 +17,12 @@ function handlerAlsWrappingPlugin() {
|
|
|
15
17
|
if (!normalizePath(id).startsWith(functionsDir + "/")) {
|
|
16
18
|
return null;
|
|
17
19
|
}
|
|
18
|
-
const wrapped = applyHandlerAlsWrapping(code);
|
|
20
|
+
const wrapped = applyHandlerAlsWrapping(code, { projectIsEsm });
|
|
19
21
|
return wrapped ? { code: wrapped, map: null } : null;
|
|
20
22
|
}
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
|
-
function applyHandlerAlsWrapping(code) {
|
|
25
|
+
function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
|
|
24
26
|
const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
|
|
25
27
|
const handlerMatch = handlerRe.exec(code);
|
|
26
28
|
if (!handlerMatch) {
|
|
@@ -28,7 +30,8 @@ function applyHandlerAlsWrapping(code) {
|
|
|
28
30
|
}
|
|
29
31
|
const afterEquals = code.slice(handlerMatch.index + handlerMatch[0].length).trimStart();
|
|
30
32
|
const isAsync = /^async(?:\s*[\(\*]|\s+function)/.test(afterEquals);
|
|
31
|
-
const
|
|
33
|
+
const storePath = projectIsEsm ? "@cedarjs/context/dist/store.js" : "@cedarjs/context/dist/store";
|
|
34
|
+
const importStatement = `import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '${storePath}'
|
|
32
35
|
`;
|
|
33
36
|
const handlerStart = handlerMatch.index;
|
|
34
37
|
const before = code.slice(0, handlerStart);
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* buildFeServer -> buildRscFeServer -> rscBuildClient
|
|
4
4
|
* Generate the client bundle
|
|
5
5
|
*/
|
|
6
|
-
export declare function rscBuildClient(clientEntryFiles: Record<string, string>): Promise<[import("rollup").OutputChunk, ...(import("rollup").
|
|
6
|
+
export declare function rscBuildClient(clientEntryFiles: Record<string, string>): Promise<[import("rollup").OutputChunk, ...(import("rollup").OutputChunk | import("rollup").OutputAsset)[]]>;
|
|
7
7
|
//# sourceMappingURL=rscBuildClient.d.ts.map
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* buildFeServer -> buildRscFeServer -> rscBuildForServer
|
|
4
4
|
* Generate the output to be used by the rsc worker (not the actual server!)
|
|
5
5
|
*/
|
|
6
|
-
export declare function rscBuildForServer(clientEntryFiles: Record<string, string>, serverEntryFiles: Record<string, string>, customModules: Record<string, string>): Promise<[import("rollup").OutputChunk, ...(import("rollup").
|
|
6
|
+
export declare function rscBuildForServer(clientEntryFiles: Record<string, string>, serverEntryFiles: Record<string, string>, customModules: Record<string, string>): Promise<[import("rollup").OutputChunk, ...(import("rollup").OutputChunk | import("rollup").OutputAsset)[]]>;
|
|
7
7
|
//# sourceMappingURL=rscBuildForServer.d.ts.map
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
export declare function rscBuildForSsr({ clientEntryFiles, verbose, }: {
|
|
6
6
|
clientEntryFiles: Record<string, string>;
|
|
7
7
|
verbose?: boolean;
|
|
8
|
-
}): Promise<[import("rollup").OutputChunk, ...(import("rollup").
|
|
8
|
+
}): Promise<[import("rollup").OutputChunk, ...(import("rollup").OutputChunk | import("rollup").OutputAsset)[]]>;
|
|
9
9
|
//# sourceMappingURL=rscBuildForSsr.d.ts.map
|
package/dist/runFeServer.js
CHANGED
|
@@ -67,7 +67,7 @@ async function runFeServer() {
|
|
|
67
67
|
"/assets",
|
|
68
68
|
express.static(rwPaths.web.distBrowser + "/assets", { index: false })
|
|
69
69
|
);
|
|
70
|
-
app.use((req, _res, next) => {
|
|
70
|
+
app.use("*", (req, _res, next) => {
|
|
71
71
|
const fullUrl = getFullUrl(req, rscEnabled);
|
|
72
72
|
const headers = convertExpressHeaders(req.headersDistinct);
|
|
73
73
|
const perReqStore = createPerRequestMap({ headers, fullUrl });
|
|
@@ -99,8 +99,8 @@ async function runFeServer() {
|
|
|
99
99
|
getStylesheetLinks,
|
|
100
100
|
getMiddlewareRouter: async () => middlewareRouter
|
|
101
101
|
});
|
|
102
|
-
app.get("
|
|
103
|
-
app.post("
|
|
102
|
+
app.get("*", createServerAdapter(routeHandler));
|
|
103
|
+
app.post("*", handleWithMiddleware());
|
|
104
104
|
app.listen(rwConfig.web.port);
|
|
105
105
|
console.log(
|
|
106
106
|
`Started production FE server on http://localhost:${rwConfig.web.port}`
|
|
@@ -3,14 +3,9 @@ import type { ServerAuthState } from '@cedarjs/auth/dist/AuthProvider/ServerAuth
|
|
|
3
3
|
import type { TagDescriptor } from '@cedarjs/web';
|
|
4
4
|
import type { MiddlewareResponse } from '@cedarjs/web/middleware';
|
|
5
5
|
import type { ServerEntryType } from '../types.js';
|
|
6
|
-
interface FallbackDocumentProps {
|
|
7
|
-
css: string[];
|
|
8
|
-
meta: TagDescriptor[];
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
}
|
|
11
6
|
interface RenderToStreamArgs {
|
|
12
7
|
ServerEntry: ServerEntryType;
|
|
13
|
-
FallbackDocument: React.FunctionComponent
|
|
8
|
+
FallbackDocument: React.FunctionComponent;
|
|
14
9
|
currentUrl: URL;
|
|
15
10
|
metaTags: TagDescriptor[];
|
|
16
11
|
cssLinks: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamHelpers.d.ts","sourceRoot":"","sources":["../../src/streaming/streamHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAYlD,UAAU,
|
|
1
|
+
{"version":3,"file":"streamHelpers.d.ts","sourceRoot":"","sources":["../../src/streaming/streamHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAYlD,UAAU,kBAAkB;IAC1B,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACzC,UAAU,EAAE,GAAG,CAAA;IACf,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,eAAe,CAAA;CAC3B;AAED,UAAU,aAAa;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;CAC/B;AA2BD,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,kBAAkB,EACzB,aAAa,EAAE,kBAAkB,EACjC,aAAa,EAAE,aAAa,qBAgM7B;AA2BD,wBAAsB,YAAY,CAChC,GAAG,EACC,WAAW,GACX,kBAAkB,GAClB,qBAAqB,GACrB,iCAAiC,GACjC,0BAA0B,gBA6B/B"}
|
|
@@ -137,7 +137,7 @@ async function reactRenderToStreamResponse(mwRes, renderOptions, streamOptions)
|
|
|
137
137
|
console.error("\u{1F53B} Failed to render shell");
|
|
138
138
|
streamOptions.onError?.(e);
|
|
139
139
|
const fallbackShell = await renderToReadableStream(
|
|
140
|
-
|
|
140
|
+
FallbackDocument({
|
|
141
141
|
children: null,
|
|
142
142
|
css: cssLinks,
|
|
143
143
|
meta: metaTags
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0-rc.32",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,82 +48,80 @@
|
|
|
48
48
|
"test:watch": "vitest watch"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@babel/core": "^7.26.10",
|
|
52
51
|
"@babel/generator": "7.29.8",
|
|
53
52
|
"@babel/parser": "7.29.9",
|
|
54
|
-
"@babel/
|
|
55
|
-
"@babel/traverse": "7.29.10",
|
|
53
|
+
"@babel/traverse": "7.29.8",
|
|
56
54
|
"@babel/types": "7.29.8",
|
|
57
|
-
"@cedarjs/api": "7.0
|
|
58
|
-
"@cedarjs/api-server": "7.0
|
|
59
|
-
"@cedarjs/babel-config": "7.0
|
|
60
|
-
"@cedarjs/context": "7.0
|
|
61
|
-
"@cedarjs/graphql-server": "7.0
|
|
62
|
-
"@cedarjs/internal": "7.0
|
|
63
|
-
"@cedarjs/jobs": "7.0
|
|
64
|
-
"@cedarjs/project-config": "7.0
|
|
65
|
-
"@cedarjs/server-store": "7.0
|
|
66
|
-
"@cedarjs/structure": "7.0
|
|
67
|
-
"@cedarjs/testing": "7.0
|
|
68
|
-
"@swc/core": "1.16.
|
|
69
|
-
"@universal-deploy/store": "^0.
|
|
70
|
-
"@universal-deploy/vite": "^0.
|
|
55
|
+
"@cedarjs/api": "7.1.0-rc.32",
|
|
56
|
+
"@cedarjs/api-server": "7.1.0-rc.32",
|
|
57
|
+
"@cedarjs/babel-config": "7.1.0-rc.32",
|
|
58
|
+
"@cedarjs/context": "7.1.0-rc.32",
|
|
59
|
+
"@cedarjs/graphql-server": "7.1.0-rc.32",
|
|
60
|
+
"@cedarjs/internal": "7.1.0-rc.32",
|
|
61
|
+
"@cedarjs/jobs": "7.1.0-rc.32",
|
|
62
|
+
"@cedarjs/project-config": "7.1.0-rc.32",
|
|
63
|
+
"@cedarjs/server-store": "7.1.0-rc.32",
|
|
64
|
+
"@cedarjs/structure": "7.1.0-rc.32",
|
|
65
|
+
"@cedarjs/testing": "7.1.0-rc.32",
|
|
66
|
+
"@swc/core": "1.16.2",
|
|
67
|
+
"@universal-deploy/store": "^0.2.1",
|
|
68
|
+
"@universal-deploy/vite": "^0.1.9",
|
|
71
69
|
"@vitejs/plugin-react": "4.7.0",
|
|
72
|
-
"@whatwg-node/fetch": "0.
|
|
73
|
-
"@whatwg-node/server": "0.
|
|
74
|
-
"acorn": "8.
|
|
70
|
+
"@whatwg-node/fetch": "0.10.13",
|
|
71
|
+
"@whatwg-node/server": "0.11.0",
|
|
72
|
+
"acorn": "8.18.0",
|
|
75
73
|
"acorn-loose": "8.5.2",
|
|
76
74
|
"ansis": "4.4.0",
|
|
77
75
|
"busboy": "^1.6.0",
|
|
78
76
|
"dotenv-defaults": "5.0.2",
|
|
79
|
-
"express": "
|
|
77
|
+
"express": "4.22.2",
|
|
80
78
|
"fast-glob": "3.3.3",
|
|
81
|
-
"find-my-way": "9.
|
|
79
|
+
"find-my-way": "9.9.0",
|
|
82
80
|
"http-proxy-middleware": "3.0.7",
|
|
83
81
|
"isbot": "5.2.2",
|
|
84
82
|
"magic-string": "0.30.21",
|
|
85
|
-
"oxc-parser": "0.
|
|
86
|
-
"react-server-dom-webpack": "19.
|
|
83
|
+
"oxc-parser": "0.151.0",
|
|
84
|
+
"react-server-dom-webpack": "19.2.8",
|
|
87
85
|
"unimport": "5.7.0",
|
|
88
86
|
"unplugin-auto-import": "19.3.0",
|
|
89
|
-
"vite": "7.3.
|
|
87
|
+
"vite": "7.3.6",
|
|
90
88
|
"vite-plugin-cjs-interop": "2.4.4",
|
|
91
89
|
"vite-plugin-graphql-tag": "0.1.1",
|
|
92
90
|
"vite-tsconfig-paths": "^6.1.1",
|
|
93
|
-
"ws": "8.
|
|
91
|
+
"ws": "8.21.3",
|
|
94
92
|
"yargs-parser": "21.1.1"
|
|
95
93
|
},
|
|
96
94
|
"devDependencies": {
|
|
97
|
-
"@cedarjs/auth": "7.0
|
|
98
|
-
"@cedarjs/framework-tools": "7.0
|
|
99
|
-
"@cedarjs/router": "7.0
|
|
100
|
-
"@cedarjs/web": "7.0
|
|
95
|
+
"@cedarjs/auth": "7.1.0-rc.32",
|
|
96
|
+
"@cedarjs/framework-tools": "7.1.0-rc.32",
|
|
97
|
+
"@cedarjs/router": "7.1.0-rc.32",
|
|
98
|
+
"@cedarjs/web": "7.1.0-rc.32",
|
|
101
99
|
"@dr.pogodin/react-helmet": "2.0.4",
|
|
102
100
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
103
101
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
104
|
-
"@oxc-project/types": "^0.
|
|
105
|
-
"@types/aws-lambda": "8.10.
|
|
102
|
+
"@oxc-project/types": "^0.151.0",
|
|
103
|
+
"@types/aws-lambda": "8.10.163",
|
|
106
104
|
"@types/busboy": "^1",
|
|
107
|
-
"@types/express": "
|
|
108
|
-
"@types/react": "^
|
|
105
|
+
"@types/express": "4",
|
|
106
|
+
"@types/react": "^18.2.55",
|
|
109
107
|
"@types/ws": "^8",
|
|
110
108
|
"@types/yargs-parser": "21.0.3",
|
|
111
|
-
"concurrently": "9.2.
|
|
112
|
-
"memfs": "4.
|
|
113
|
-
"publint": "0.3.
|
|
114
|
-
"react": "
|
|
115
|
-
"react-dom": "
|
|
116
|
-
"rollup": "4.
|
|
109
|
+
"concurrently": "9.2.4",
|
|
110
|
+
"memfs": "4.78.1",
|
|
111
|
+
"publint": "0.3.24",
|
|
112
|
+
"react": "18.3.1",
|
|
113
|
+
"react-dom": "18.3.1",
|
|
114
|
+
"rollup": "4.63.4",
|
|
117
115
|
"ts-dedent": "2.3.0",
|
|
118
116
|
"typescript": "5.9.3",
|
|
119
117
|
"vitest": "4.1.11"
|
|
120
118
|
},
|
|
121
119
|
"peerDependencies": {
|
|
122
|
-
"@cedarjs/auth": "7.0
|
|
123
|
-
"@cedarjs/router": "7.0
|
|
124
|
-
"@cedarjs/web": "7.0
|
|
125
|
-
"react": "
|
|
126
|
-
"react-dom": "
|
|
120
|
+
"@cedarjs/auth": "7.1.0-rc.32",
|
|
121
|
+
"@cedarjs/router": "7.1.0-rc.32",
|
|
122
|
+
"@cedarjs/web": "7.1.0-rc.32",
|
|
123
|
+
"react": "18.3.1",
|
|
124
|
+
"react-dom": "18.3.1"
|
|
127
125
|
},
|
|
128
126
|
"engines": {
|
|
129
127
|
"node": ">=24"
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The folder in `api/dist/ud` a bundled API build puts every sandboxed
|
|
3
|
-
* child script in, as `<name>.child.js`, with a `node_modules` holding the
|
|
4
|
-
* packages they import. `findChildScript()` in `@cedarjs/api/sandbox`
|
|
5
|
-
* looks for `api/dist/ud/sandbox-children` from its caller's folder up.
|
|
6
|
-
*/
|
|
7
|
-
export declare const SANDBOX_CHILDREN_DIR = "sandbox-children";
|
|
8
|
-
/**
|
|
9
|
-
* Every sandboxed child script in `apiSrc` (`**\/*.child.{ts,js,mts,mjs}`),
|
|
10
|
-
* as `{ 'sandbox-children/<name>.child': file }`, for a bundled build's
|
|
11
|
-
* `input`. Throws when two have the same name: in a bundle they all go in
|
|
12
|
-
* one folder, and `findChildScript()` finds them by name.
|
|
13
|
-
*/
|
|
14
|
-
export declare function findSandboxChildScripts(apiSrc: string): Record<string, string>;
|
|
15
|
-
export interface SandboxChildImports {
|
|
16
|
-
/** The child script's source file, which its imports resolve from */
|
|
17
|
-
source: string;
|
|
18
|
-
/** What it imports: package names and Node builtins */
|
|
19
|
-
imports: string[];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Copies the packages the child scripts import, and everything those
|
|
23
|
-
* depend on, into `<childrenDir>/node_modules`, so the folder runs on its
|
|
24
|
-
* own wherever it's deployed: a serverless function's file tracing doesn't
|
|
25
|
-
* follow a child script (nothing imports it), and it would miss what
|
|
26
|
-
* native packages load at run time anyway (sharp's libvips).
|
|
27
|
-
*
|
|
28
|
-
* Follows each package's `dependencies`, and the `optionalDependencies`
|
|
29
|
-
* and `peerDependencies` that are installed, which is how native packages
|
|
30
|
-
* ship their platform's binaries (`@img/sharp-linux-x64`,
|
|
31
|
-
* `@img/sharp-libvips-linux-x64`).
|
|
32
|
-
*
|
|
33
|
-
* The copy keeps each package's choices, so it finds the same versions
|
|
34
|
-
* it does in the app: a dependency nested in a package's own
|
|
35
|
-
* `node_modules` is copied into the copy's `node_modules`; one beside it
|
|
36
|
-
* in a `node_modules` (pnpm's layout), or shadowed in the copy by another
|
|
37
|
-
* version, goes next to the dependent's copy; one in the app's own
|
|
38
|
-
* `node_modules` folders goes at the top. A package already reachable from
|
|
39
|
-
* the dependent's copy is reused. When two versions would still need the
|
|
40
|
-
* same place, it throws instead of letting one overwrite the other. So
|
|
41
|
-
* does a package or regular dependency that isn't installed: the child
|
|
42
|
-
* couldn't import it either.
|
|
43
|
-
*/
|
|
44
|
-
export declare function vendorSandboxChildPackages(childrenDir: string, children: SandboxChildImports[]): void;
|
|
45
|
-
/**
|
|
46
|
-
* Copies the bundled build's sandboxed children (and their `node_modules`)
|
|
47
|
-
* into every Node function in a Vercel Build Output API folder
|
|
48
|
-
* (`.vercel/output/functions/*.func`), at the same path as in the app
|
|
49
|
-
* (`api/dist/ud/sandbox-children`). Each Vercel function is a single
|
|
50
|
-
* bundled file with nothing else from the app, and `findChildScript()`
|
|
51
|
-
* looks for the children from the function's folder up.
|
|
52
|
-
*/
|
|
53
|
-
export declare function copySandboxChildrenIntoVercelFunctions({ appRoot, childrenDir, functionsDir, }: {
|
|
54
|
-
appRoot: string;
|
|
55
|
-
childrenDir: string;
|
|
56
|
-
functionsDir: string;
|
|
57
|
-
}): string[];
|
|
58
|
-
//# sourceMappingURL=sandboxChildren.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sandboxChildren.d.ts","sourceRoot":"","sources":["../../src/lib/sandboxChildren.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,qBAAqB,CAAA;AAEtD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAyBxB;AA6CD,MAAM,WAAW,mBAAmB;IAClC,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAA;IACd,uDAAuD;IACvD,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,mBAAmB,EAAE,QA+GhC;AAgBD;;;;;;;GAOG;AACH,wBAAgB,sCAAsC,CAAC,EACrD,OAAO,EACP,WAAW,EACX,YAAY,GACb,EAAE;IACD,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;CACrB,YAgCA"}
|