@cedarjs/vite 5.0.7-next.338 → 5.0.7
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/bins/cedar-vite-dev.mjs +1 -14
- package/dist/api/vite-plugin-cedar-vitest-api-preset.d.ts.map +1 -1
- package/dist/api/vite-plugin-cedar-vitest-api-preset.js +0 -4
- package/dist/apiDevMiddleware.d.ts.map +1 -1
- package/dist/apiDevMiddleware.js +15 -117
- package/dist/buildApp.d.ts.map +1 -1
- package/dist/buildApp.js +18 -77
- package/dist/buildRouteHooks.d.ts.map +1 -1
- package/dist/buildRouteHooks.js +4 -36
- package/dist/bundled/react-server-dom-webpack.server.js +99 -192
- package/dist/cedar-unified-dev.d.ts +0 -19
- package/dist/cedar-unified-dev.d.ts.map +1 -1
- package/dist/cedar-unified-dev.js +9 -74
- package/dist/cjs/ClientRouter.d.ts +1 -0
- package/dist/cjs/api/vite-plugin-cedar-vitest-api-preset.js +37 -0
- package/dist/cjs/apiDevMiddleware.js +371 -0
- package/dist/cjs/build/build.d.ts +1 -0
- package/dist/cjs/build/build.js +58 -0
- package/dist/cjs/buildApp.js +306 -0
- package/dist/cjs/buildFeServer.d.ts +1 -0
- package/dist/cjs/buildFeServer.js +63 -0
- package/dist/cjs/buildRouteHooks.js +80 -0
- package/dist/cjs/buildRouteManifest.js +92 -0
- package/dist/cjs/buildRscClientAndServer.js +54 -0
- package/dist/cjs/cedar-unified-dev.js +310 -0
- package/dist/cjs/client.d.ts +1 -0
- package/dist/cjs/clientSsr.d.ts +1 -0
- package/dist/cjs/devFeServer.js +157 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +141 -0
- package/dist/cjs/lib/StatusError.js +37 -0
- package/dist/cjs/lib/entries.js +52 -0
- package/dist/cjs/lib/getMergedConfig.js +185 -0
- package/dist/cjs/lib/onWarn.js +36 -0
- package/dist/cjs/lib/registerFwGlobalsAndShims.js +102 -0
- package/dist/cjs/lib/workspacePackageAliases.js +107 -0
- package/dist/cjs/middleware/index.js +22 -0
- package/dist/cjs/middleware/invokeMiddleware.js +52 -0
- package/dist/cjs/middleware/register.js +105 -0
- package/dist/cjs/middleware/types.js +16 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/plugins/vite-plugin-cedar-auto-import.js +107 -0
- package/dist/cjs/plugins/vite-plugin-cedar-cell.js +183 -0
- package/dist/cjs/plugins/vite-plugin-cedar-cjs-compat.js +341 -0
- package/dist/cjs/plugins/vite-plugin-cedar-context-wrapping.js +95 -0
- package/dist/cjs/plugins/vite-plugin-cedar-entry-injection.js +107 -0
- package/dist/cjs/plugins/vite-plugin-cedar-html-env.js +67 -0
- package/dist/cjs/plugins/vite-plugin-cedar-import-dir.js +118 -0
- package/dist/cjs/plugins/vite-plugin-cedar-node-polyfills.js +43 -0
- package/dist/cjs/plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js +61 -0
- package/dist/cjs/plugins/vite-plugin-cedar-remove-from-bundle.js +76 -0
- package/dist/cjs/plugins/vite-plugin-cedar-routes-auto-loader.js +126 -0
- package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +346 -0
- package/dist/cjs/plugins/vite-plugin-cedar-wait-for-api-server.js +134 -0
- package/dist/cjs/plugins/vite-plugin-cedarjs-job-path-injector.js +134 -0
- package/dist/cjs/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +106 -0
- package/dist/cjs/plugins/vite-plugin-jsx-loader.js +42 -0
- package/dist/cjs/plugins/vite-plugin-merged-config.js +39 -0
- package/dist/cjs/plugins/vite-plugin-rsc-analyze.js +104 -0
- package/dist/cjs/plugins/vite-plugin-rsc-reload.js +75 -0
- package/dist/cjs/plugins/vite-plugin-rsc-routes-auto-loader.js +159 -0
- package/dist/cjs/plugins/vite-plugin-rsc-routes-imports.js +125 -0
- package/dist/cjs/plugins/vite-plugin-rsc-ssr-router-import.js +75 -0
- package/dist/cjs/plugins/vite-plugin-rsc-transform-client.js +228 -0
- package/dist/cjs/plugins/vite-plugin-rsc-transform-server.js +398 -0
- package/dist/cjs/plugins/vite-plugin-swap-apollo-provider.js +46 -0
- package/dist/cjs/rsc/rscBuildAnalyze.js +126 -0
- package/dist/cjs/rsc/rscBuildClient.js +91 -0
- package/dist/cjs/rsc/rscBuildCopyCssAssets.js +56 -0
- package/dist/cjs/rsc/rscBuildEntriesFile.js +115 -0
- package/dist/cjs/rsc/rscBuildForServer.js +168 -0
- package/dist/cjs/rsc/rscBuildForSsr.js +173 -0
- package/dist/cjs/rsc/rscBuildRwEnvVars.js +56 -0
- package/dist/cjs/rsc/rscRenderer.js +165 -0
- package/dist/cjs/rsc/rscRequestHandler.js +162 -0
- package/dist/cjs/rsc/rscStudioHandlers.js +156 -0
- package/dist/cjs/runFeServer.js +165 -0
- package/dist/cjs/streaming/buildForStreamingServer.js +65 -0
- package/dist/cjs/streaming/collectCss.js +52 -0
- package/dist/cjs/streaming/createReactStreamingHandler.js +173 -0
- package/dist/cjs/streaming/streamHelpers.js +230 -0
- package/dist/cjs/streaming/transforms/bufferedTransform.js +61 -0
- package/dist/cjs/streaming/transforms/cancelTimeoutTransform.js +34 -0
- package/dist/cjs/streaming/transforms/encode-decode.js +36 -0
- package/dist/cjs/streaming/transforms/serverInjectionTransform.js +84 -0
- package/dist/cjs/streaming/triggerRouteHooks.js +96 -0
- package/dist/cjs/types.js +16 -0
- package/dist/cjs/utils.js +92 -0
- package/dist/devFeServer.js +8 -3
- package/dist/index.d.ts +4 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -51
- package/dist/lib/getMergedConfig.d.ts.map +1 -1
- package/dist/lib/getMergedConfig.js +6 -16
- package/dist/lib/registerFwGlobalsAndShims.d.ts.map +1 -1
- package/dist/lib/registerFwGlobalsAndShims.js +4 -14
- package/dist/package.json +1 -0
- package/dist/plugins/vite-plugin-cedar-auto-import.d.ts +1 -1
- package/dist/plugins/vite-plugin-cedar-auto-import.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-auto-import.js +1 -8
- package/dist/plugins/vite-plugin-cedar-cell.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-cell.js +1 -2
- package/dist/plugins/{vite-plugin-handler-als-wrapping.d.ts → vite-plugin-cedar-context-wrapping.d.ts} +12 -12
- package/dist/plugins/vite-plugin-cedar-context-wrapping.d.ts.map +1 -0
- package/dist/plugins/{vite-plugin-handler-als-wrapping.js → vite-plugin-cedar-context-wrapping.js} +16 -16
- package/dist/plugins/vite-plugin-cedar-import-dir.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-import-dir.js +31 -44
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts +3 -0
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-node-polyfills.js +19 -0
- package/dist/plugins/vite-plugin-cedar-universal-deploy.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-universal-deploy.js +90 -92
- package/dist/plugins/vite-plugin-cedarjs-job-path-injector.d.ts +0 -29
- package/dist/plugins/vite-plugin-cedarjs-job-path-injector.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedarjs-job-path-injector.js +81 -63
- package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +0 -14
- package/dist/plugins/vite-plugin-rsc-analyze.js +1 -2
- package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts +0 -3
- package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-swap-apollo-provider.js +2 -2
- package/dist/rsc/rscBuildForSsr.d.ts.map +1 -1
- package/dist/rsc/rscBuildForSsr.js +5 -3
- package/dist/streaming/buildForStreamingServer.d.ts.map +1 -1
- package/dist/streaming/buildForStreamingServer.js +5 -3
- package/package.json +57 -47
- package/dist/jobsDevMiddleware.d.ts +0 -17
- package/dist/jobsDevMiddleware.d.ts.map +0 -1
- package/dist/jobsDevMiddleware.js +0 -106
- package/dist/lib/generateDiffSourceMap.d.ts +0 -18
- package/dist/lib/generateDiffSourceMap.d.ts.map +0 -1
- package/dist/lib/generateDiffSourceMap.js +0 -151
- package/dist/plugins/vite-plugin-cedar-api-import-guard.d.ts +0 -13
- package/dist/plugins/vite-plugin-cedar-api-import-guard.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-api-import-guard.js +0 -17
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts +0 -3
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.js +0 -43
- package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts +0 -12
- package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-directory-named-import.js +0 -35
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts +0 -29
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.js +0 -76
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts +0 -42
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.js +0 -103
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts +0 -28
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.js +0 -67
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts +0 -28
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.js +0 -247
- package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts +0 -39
- package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-otel-wrapping.js +0 -200
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import
|
|
3
|
-
import { parseSync } from "oxc-parser";
|
|
2
|
+
import { parse, Lang } from "@ast-grep/napi";
|
|
4
3
|
import { getPaths } from "@cedarjs/project-config";
|
|
5
4
|
function cedarjsJobPathInjectorPlugin() {
|
|
6
5
|
return {
|
|
@@ -9,74 +8,93 @@ function cedarjsJobPathInjectorPlugin() {
|
|
|
9
8
|
if (!code.includes("createJob")) {
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
12
|
-
const
|
|
13
|
-
|
|
11
|
+
const isTypescript = id.endsWith(".ts") || id.endsWith(".tsx");
|
|
12
|
+
const language = isTypescript ? Lang.TypeScript : Lang.JavaScript;
|
|
13
|
+
let ast;
|
|
14
|
+
try {
|
|
15
|
+
ast = parse(language, code);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.warn("Failed to parse file:", id);
|
|
18
|
+
console.warn(error);
|
|
14
19
|
return null;
|
|
15
20
|
}
|
|
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
|
-
|
|
46
|
-
|
|
21
|
+
const paths = getPaths();
|
|
22
|
+
const edits = [];
|
|
23
|
+
const root = ast.root();
|
|
24
|
+
const createJobCalls = root.findAll({
|
|
25
|
+
rule: {
|
|
26
|
+
pattern: "export const $VAR_NAME = $OBJ.createJob({ $$$PROPS })"
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
for (const callNode of createJobCalls) {
|
|
30
|
+
const varNameNode = callNode.getMatch("VAR_NAME");
|
|
31
|
+
const propsNodes = callNode.getMultipleMatches("PROPS");
|
|
32
|
+
if (!varNameNode) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const importName = varNameNode.text();
|
|
36
|
+
const importPath = path.relative(paths.api.jobs, id);
|
|
37
|
+
const importPathWithoutExtension = importPath.replace(/\.[^/.]+$/, "");
|
|
38
|
+
const pathProperty = `path: ${JSON.stringify(importPathWithoutExtension)}`;
|
|
39
|
+
const nameProperty = `name: ${JSON.stringify(importName)}`;
|
|
40
|
+
let insertText = "";
|
|
41
|
+
if (propsNodes.length > 0) {
|
|
42
|
+
const objectLiteral = callNode.find({
|
|
43
|
+
rule: {
|
|
44
|
+
kind: "object",
|
|
45
|
+
inside: {
|
|
46
|
+
kind: "arguments"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (objectLiteral) {
|
|
51
|
+
insertText = `, ${pathProperty}, ${nameProperty}`;
|
|
52
|
+
const objectText = objectLiteral.text();
|
|
53
|
+
const closeBraceIndex = objectText.lastIndexOf("}");
|
|
54
|
+
if (closeBraceIndex !== -1) {
|
|
55
|
+
const range = objectLiteral.range();
|
|
56
|
+
edits.push({
|
|
57
|
+
startPos: range.start.index + closeBraceIndex,
|
|
58
|
+
endPos: range.start.index + closeBraceIndex,
|
|
59
|
+
insertedText: insertText
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
const objectLiteral = callNode.find({
|
|
65
|
+
rule: {
|
|
66
|
+
kind: "object",
|
|
67
|
+
inside: {
|
|
68
|
+
kind: "arguments"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
if (objectLiteral) {
|
|
73
|
+
insertText = `${pathProperty}, ${nameProperty}`;
|
|
74
|
+
const objectText = objectLiteral.text();
|
|
75
|
+
const openBraceIndex = objectText.indexOf("{");
|
|
76
|
+
if (openBraceIndex !== -1) {
|
|
77
|
+
const range = objectLiteral.range();
|
|
78
|
+
edits.push({
|
|
79
|
+
startPos: range.start.index + openBraceIndex + 1,
|
|
80
|
+
endPos: range.start.index + openBraceIndex + 1,
|
|
81
|
+
insertedText: insertText
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
47
86
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
const callee = init.callee;
|
|
53
|
-
if (callee.type !== "MemberExpression" || callee.computed || callee.property.type !== "Identifier" || callee.property.name !== "createJob") {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
const configArg = init.arguments[0];
|
|
57
|
-
if (configArg?.type !== "ObjectExpression") {
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
hasTransformations = true;
|
|
61
|
-
const pathProperty = `path: ${JSON.stringify(importPathWithoutExtension)}`;
|
|
62
|
-
const nameProperty = `name: ${JSON.stringify(declarator.id.name)}`;
|
|
63
|
-
const lastProperty = configArg.properties.at(-1);
|
|
64
|
-
if (lastProperty) {
|
|
65
|
-
s.appendLeft(lastProperty.end, `, ${pathProperty}, ${nameProperty}`);
|
|
66
|
-
} else {
|
|
67
|
-
s.appendLeft(configArg.start + 1, `${pathProperty}, ${nameProperty}`);
|
|
87
|
+
if (edits.length === 0) {
|
|
88
|
+
return null;
|
|
68
89
|
}
|
|
90
|
+
const modifiedCode = root.commitEdits(edits);
|
|
91
|
+
return {
|
|
92
|
+
code: modifiedCode,
|
|
93
|
+
map: null
|
|
94
|
+
};
|
|
69
95
|
}
|
|
70
|
-
}
|
|
71
|
-
if (!hasTransformations) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
code: s.toString(),
|
|
76
|
-
map: s.generateMap({ hires: true })
|
|
77
96
|
};
|
|
78
97
|
}
|
|
79
98
|
export {
|
|
80
|
-
applyJobPathInjector,
|
|
81
99
|
cedarjsJobPathInjectorPlugin
|
|
82
100
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAiClC,wBAAgB,qCAAqC,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedarjs-resolve-cedar-style-imports.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAiClC,wBAAgB,qCAAqC,IAAI,MAAM,CAkE9D"}
|
|
@@ -52,20 +52,6 @@ function cedarjsResolveCedarStyleImportsPlugin() {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
if (cedarPaths && id.startsWith("$api/") && this.environment?.name !== "client") {
|
|
56
|
-
const resolved = resolveFromAbsolutePath(
|
|
57
|
-
path.join(cedarPaths.api.base, id.slice("$api/".length))
|
|
58
|
-
);
|
|
59
|
-
if (resolved) {
|
|
60
|
-
return normalizePath(resolved);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (cedarPaths && id.startsWith("api/")) {
|
|
64
|
-
const resolved = resolveFromAbsolutePath(path.join(cedarPaths.base, id));
|
|
65
|
-
if (resolved) {
|
|
66
|
-
return normalizePath(resolved);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
55
|
const resolvedPath = path.resolve(path.dirname(importer), id);
|
|
70
56
|
if (fs.existsSync(resolvedPath)) {
|
|
71
57
|
const stats = fs.statSync(resolvedPath);
|
|
@@ -31,8 +31,7 @@ function rscAnalyzePlugin(clientEntryCallback, serverEntryCallback) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
function isServerAction(node) {
|
|
34
|
-
|
|
35
|
-
return !!body && "stmts" in body && body.stmts.some(
|
|
34
|
+
return node.body?.type === "BlockStatement" && node.body.stmts.some(
|
|
36
35
|
(s) => s.type === "ExpressionStatement" && s.expression.type === "StringLiteral" && s.expression.value === "use server"
|
|
37
36
|
);
|
|
38
37
|
}
|
|
@@ -5,9 +5,6 @@ import type { Plugin } from 'vite';
|
|
|
5
5
|
*
|
|
6
6
|
* import { RedwoodApolloProvider } from "@cedarjs/web/apollo" ->
|
|
7
7
|
* import { RedwoodApolloProvider } from "@cedarjs/web/dist/apollo/suspense"
|
|
8
|
-
*
|
|
9
|
-
* import { CedarApolloProvider } from "@cedarjs/web/apollo/CedarApolloProvider" ->
|
|
10
|
-
* import { CedarApolloProvider } from "@cedarjs/web/dist/apollo/suspense"
|
|
11
8
|
*/
|
|
12
9
|
export declare function cedarSwapApolloProvider(): Plugin | undefined;
|
|
13
10
|
//# sourceMappingURL=vite-plugin-swap-apollo-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-swap-apollo-provider.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-swap-apollo-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC
|
|
1
|
+
{"version":3,"file":"vite-plugin-swap-apollo-provider.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-swap-apollo-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAoB5D"}
|
|
@@ -5,11 +5,11 @@ function cedarSwapApolloProvider() {
|
|
|
5
5
|
return void 0;
|
|
6
6
|
}
|
|
7
7
|
return {
|
|
8
|
-
name: "
|
|
8
|
+
name: "redwood-swap-apollo-provider",
|
|
9
9
|
async transform(code, id) {
|
|
10
10
|
if (/web\/src\/App\.(ts|tsx|js|jsx)$/.test(id)) {
|
|
11
11
|
return code.replace(
|
|
12
|
-
|
|
12
|
+
"@cedarjs/web/apollo",
|
|
13
13
|
"@cedarjs/web/dist/apollo/suspense"
|
|
14
14
|
);
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rscBuildForSsr.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForSsr.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,cAAc,CAAC,EACnC,gBAAgB,EAChB,OAAe,GAChB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,+
|
|
1
|
+
{"version":3,"file":"rscBuildForSsr.d.ts","sourceRoot":"","sources":["../../src/rsc/rscBuildForSsr.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wBAAsB,cAAc,CAAC,EACnC,gBAAgB,EAChB,OAAe,GAChB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACxC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,+GA+IA"}
|
|
@@ -51,9 +51,11 @@ async function rscBuildForSsr({
|
|
|
51
51
|
plugins: [
|
|
52
52
|
cjsInterop({
|
|
53
53
|
dependencies: [
|
|
54
|
-
// Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware,
|
|
55
|
-
|
|
56
|
-
"@cedarjs/prerender/*"
|
|
54
|
+
// Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware, rwjs/router
|
|
55
|
+
"@cedarjs/forms",
|
|
56
|
+
"@cedarjs/prerender/*",
|
|
57
|
+
"@cedarjs/auth-*-api",
|
|
58
|
+
"@cedarjs/auth-!(dbauth)-web"
|
|
57
59
|
]
|
|
58
60
|
}),
|
|
59
61
|
rscRoutesAutoLoader(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildForStreamingServer.d.ts","sourceRoot":"","sources":["../../src/streaming/buildForStreamingServer.ts"],"names":[],"mappings":"AAKA,wBAAsB,uBAAuB,CAAC,EAC5C,OAAe,GAChB,EAAE;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,
|
|
1
|
+
{"version":3,"file":"buildForStreamingServer.d.ts","sourceRoot":"","sources":["../../src/streaming/buildForStreamingServer.ts"],"names":[],"mappings":"AAKA,wBAAsB,uBAAuB,CAAC,EAC5C,OAAe,GAChB,EAAE;IACD,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,iBAkCA"}
|
|
@@ -14,9 +14,11 @@ async function buildForStreamingServer({
|
|
|
14
14
|
plugins: [
|
|
15
15
|
cjsInterop({
|
|
16
16
|
dependencies: [
|
|
17
|
-
// Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware,
|
|
18
|
-
|
|
19
|
-
"@cedarjs/prerender/*"
|
|
17
|
+
// Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware, rwjs/router
|
|
18
|
+
"@cedarjs/forms",
|
|
19
|
+
"@cedarjs/prerender/*",
|
|
20
|
+
"@cedarjs/auth-*-api",
|
|
21
|
+
"@cedarjs/auth-!(dbauth)-web"
|
|
20
22
|
]
|
|
21
23
|
})
|
|
22
24
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "5.0.7
|
|
3
|
+
"version": "5.0.7",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,17 +12,27 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
"./package.json": "./package.json",
|
|
14
14
|
".": {
|
|
15
|
-
"
|
|
15
|
+
"import": {
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"types": "./dist/cjs/index.d.ts",
|
|
21
|
+
"default": "./dist/cjs/index.js"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
20
24
|
"./api": {
|
|
21
25
|
"types": "./dist/api/vite-plugin-cedar-vitest-api-preset.d.ts",
|
|
22
26
|
"default": "./dist/api/vite-plugin-cedar-vitest-api-preset.js"
|
|
23
27
|
},
|
|
24
|
-
"./buildFeServer":
|
|
25
|
-
|
|
28
|
+
"./buildFeServer": {
|
|
29
|
+
"require": "./dist/cjs/buildFeServer.js",
|
|
30
|
+
"import": "./dist/buildFeServer.js"
|
|
31
|
+
},
|
|
32
|
+
"./build": {
|
|
33
|
+
"import": "./dist/build/build.js",
|
|
34
|
+
"default": "./dist/cjs/build/build.js"
|
|
35
|
+
},
|
|
26
36
|
"./bins/cedar-vite-build.mjs": "./bins/cedar-vite-build.mjs"
|
|
27
37
|
},
|
|
28
38
|
"bin": {
|
|
@@ -39,68 +49,67 @@
|
|
|
39
49
|
"inject"
|
|
40
50
|
],
|
|
41
51
|
"scripts": {
|
|
42
|
-
"build": "node ./build.ts",
|
|
52
|
+
"build": "node ./build.ts && yarn build:types",
|
|
43
53
|
"build:pack": "yarn pack -o cedarjs-vite.tgz",
|
|
44
54
|
"build:types": "tsc --build --verbose ./tsconfig.build.json",
|
|
45
|
-
"check:attw": "
|
|
55
|
+
"check:attw": "node ./attw.ts",
|
|
46
56
|
"check:package": "concurrently npm:check:attw yarn:publint",
|
|
47
57
|
"test": "vitest run",
|
|
48
58
|
"test:watch": "vitest watch"
|
|
49
59
|
},
|
|
50
60
|
"dependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@babel/
|
|
53
|
-
"@babel/
|
|
54
|
-
"@babel/
|
|
55
|
-
"@
|
|
56
|
-
"@cedarjs/api
|
|
57
|
-
"@cedarjs/babel-config": "5.0.7
|
|
58
|
-
"@cedarjs/context": "5.0.7
|
|
59
|
-
"@cedarjs/
|
|
60
|
-
"@cedarjs/
|
|
61
|
-
"@cedarjs/
|
|
62
|
-
"@cedarjs/project-config": "5.0.7
|
|
63
|
-
"@cedarjs/server-store": "5.0.7
|
|
64
|
-
"@cedarjs/
|
|
65
|
-
"@
|
|
66
|
-
"@swc/core": "1.
|
|
61
|
+
"@ast-grep/napi": "0.43.0",
|
|
62
|
+
"@babel/generator": "7.29.7",
|
|
63
|
+
"@babel/parser": "7.29.7",
|
|
64
|
+
"@babel/traverse": "7.29.7",
|
|
65
|
+
"@babel/types": "7.29.7",
|
|
66
|
+
"@cedarjs/api": "5.0.7",
|
|
67
|
+
"@cedarjs/babel-config": "5.0.7",
|
|
68
|
+
"@cedarjs/context": "5.0.7",
|
|
69
|
+
"@cedarjs/cookie-jar": "5.0.7",
|
|
70
|
+
"@cedarjs/graphql-server": "5.0.7",
|
|
71
|
+
"@cedarjs/internal": "5.0.7",
|
|
72
|
+
"@cedarjs/project-config": "5.0.7",
|
|
73
|
+
"@cedarjs/server-store": "5.0.7",
|
|
74
|
+
"@cedarjs/testing": "5.0.7",
|
|
75
|
+
"@fastify/url-data": "6.0.3",
|
|
76
|
+
"@swc/core": "1.15.41",
|
|
67
77
|
"@universal-deploy/store": "^0.2.1",
|
|
68
78
|
"@universal-deploy/vite": "^0.1.9",
|
|
69
79
|
"@vitejs/plugin-react": "4.7.0",
|
|
70
80
|
"@whatwg-node/fetch": "0.10.13",
|
|
71
|
-
"@whatwg-node/server": "0.
|
|
72
|
-
"acorn": "8.
|
|
81
|
+
"@whatwg-node/server": "0.10.18",
|
|
82
|
+
"acorn": "8.16.0",
|
|
73
83
|
"acorn-loose": "8.5.2",
|
|
74
|
-
"ansis": "4.
|
|
84
|
+
"ansis": "4.2.0",
|
|
85
|
+
"buffer": "6.0.3",
|
|
75
86
|
"busboy": "^1.6.0",
|
|
87
|
+
"cookie": "1.1.1",
|
|
76
88
|
"dotenv-defaults": "5.0.2",
|
|
89
|
+
"execa": "5.1.1",
|
|
77
90
|
"express": "4.22.2",
|
|
78
|
-
"
|
|
91
|
+
"fastify": "5.8.5",
|
|
92
|
+
"fastify-raw-body": "5.0.0",
|
|
79
93
|
"find-my-way": "8.2.2",
|
|
80
94
|
"http-proxy-middleware": "3.0.7",
|
|
81
|
-
"isbot": "5.
|
|
82
|
-
"magic-string": "0.30.21",
|
|
83
|
-
"oxc-parser": "0.144.0",
|
|
95
|
+
"isbot": "5.1.43",
|
|
84
96
|
"react": "18.3.1",
|
|
85
|
-
"react-server-dom-webpack": "19.2.
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"vite": "7.3.
|
|
97
|
+
"react-server-dom-webpack": "19.2.4",
|
|
98
|
+
"rimraf": "6.1.3",
|
|
99
|
+
"rou3": "^0.8.1",
|
|
100
|
+
"vite": "7.3.5",
|
|
89
101
|
"vite-plugin-cjs-interop": "2.4.4",
|
|
90
|
-
"vite-plugin-
|
|
91
|
-
"vite-tsconfig-paths": "^6.1.1",
|
|
102
|
+
"vite-plugin-node-polyfills": "0.26.0",
|
|
92
103
|
"ws": "8.20.0",
|
|
93
104
|
"yargs-parser": "21.1.1"
|
|
94
105
|
},
|
|
95
106
|
"devDependencies": {
|
|
96
|
-
"@
|
|
97
|
-
"@cedarjs/
|
|
98
|
-
"@cedarjs/router": "5.0.7
|
|
99
|
-
"@cedarjs/web": "5.0.7
|
|
100
|
-
"@dr.pogodin/react-helmet": "2.0.4",
|
|
107
|
+
"@arethetypeswrong/cli": "0.18.4",
|
|
108
|
+
"@cedarjs/auth": "5.0.7",
|
|
109
|
+
"@cedarjs/router": "5.0.7",
|
|
110
|
+
"@cedarjs/web": "5.0.7",
|
|
101
111
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
102
112
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
103
|
-
"@oxc-project/types": "^0.144.0",
|
|
104
113
|
"@types/aws-lambda": "8.10.162",
|
|
105
114
|
"@types/busboy": "^1",
|
|
106
115
|
"@types/express": "4",
|
|
@@ -108,17 +117,18 @@
|
|
|
108
117
|
"@types/ws": "^8",
|
|
109
118
|
"@types/yargs-parser": "21.0.3",
|
|
110
119
|
"concurrently": "9.2.4",
|
|
111
|
-
"
|
|
112
|
-
"
|
|
120
|
+
"glob": "11.1.0",
|
|
121
|
+
"memfs": "4.64.0",
|
|
122
|
+
"publint": "0.3.21",
|
|
113
123
|
"rollup": "4.60.4",
|
|
114
124
|
"ts-dedent": "2.3.0",
|
|
115
125
|
"typescript": "5.9.3",
|
|
116
|
-
"vitest": "
|
|
126
|
+
"vitest": "3.2.6"
|
|
117
127
|
},
|
|
118
128
|
"peerDependencies": {
|
|
119
|
-
"@cedarjs/auth": "5.0.7
|
|
120
|
-
"@cedarjs/router": "5.0.7
|
|
121
|
-
"@cedarjs/web": "5.0.7
|
|
129
|
+
"@cedarjs/auth": "5.0.7",
|
|
130
|
+
"@cedarjs/router": "5.0.7",
|
|
131
|
+
"@cedarjs/web": "5.0.7"
|
|
122
132
|
},
|
|
123
133
|
"engines": {
|
|
124
134
|
"node": ">=24"
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ViteDevServer } from 'vite';
|
|
2
|
-
export interface JobsWorkerPool {
|
|
3
|
-
stop: () => Promise<void>;
|
|
4
|
-
}
|
|
5
|
-
type SsrModuleLoader = Pick<ViteDevServer, 'ssrLoadModule'>;
|
|
6
|
-
/**
|
|
7
|
-
* Starts the configured background jobs workers in-process, loading both the
|
|
8
|
-
* jobs config and job implementations through the given (already-running)
|
|
9
|
-
* api Vite dev server instead of from compiled `api/dist` output.
|
|
10
|
-
*
|
|
11
|
-
* Returns `null` (and logs nothing) when no jobs are configured, mirroring
|
|
12
|
-
* the "just works, opt-in already happened at `cedar setup jobs` time"
|
|
13
|
-
* behaviour of classic dev's nodemon-wrapped worker.
|
|
14
|
-
*/
|
|
15
|
-
export declare function startJobsDevWorkers(viteServer: SsrModuleLoader): Promise<JobsWorkerPool | null>;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=jobsDevMiddleware.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,106 +0,0 @@
|
|
|
1
|
-
import { pathToFileURL } from "node:url";
|
|
2
|
-
import ansis from "ansis";
|
|
3
|
-
import {
|
|
4
|
-
JobNotFoundError,
|
|
5
|
-
JobsLibNotFoundError,
|
|
6
|
-
setJobLoaderOverrides
|
|
7
|
-
} from "@cedarjs/jobs";
|
|
8
|
-
import { getPaths } from "@cedarjs/project-config";
|
|
9
|
-
function buildNumWorkers(workers) {
|
|
10
|
-
const numWorkers = [];
|
|
11
|
-
workers.forEach((worker, index) => {
|
|
12
|
-
const count = worker.count ?? 1;
|
|
13
|
-
for (let id = 0; id < count; id++) {
|
|
14
|
-
numWorkers.push([index, id]);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return numWorkers;
|
|
18
|
-
}
|
|
19
|
-
async function loadJobsManagerViaVite(viteServer) {
|
|
20
|
-
const jobsConfigPath = getPaths().api.jobsConfig;
|
|
21
|
-
if (!jobsConfigPath) {
|
|
22
|
-
throw new JobsLibNotFoundError();
|
|
23
|
-
}
|
|
24
|
-
const mod = await viteServer.ssrLoadModule(pathToFileURL(jobsConfigPath).href);
|
|
25
|
-
if (!mod.jobs) {
|
|
26
|
-
throw new JobsLibNotFoundError();
|
|
27
|
-
}
|
|
28
|
-
return mod.jobs;
|
|
29
|
-
}
|
|
30
|
-
async function loadJobViaVite(viteServer, { name: jobName, path: jobPath }) {
|
|
31
|
-
const completeJobPath = `${getPaths().api.jobs}/${jobPath}`;
|
|
32
|
-
let mod;
|
|
33
|
-
try {
|
|
34
|
-
mod = await viteServer.ssrLoadModule(pathToFileURL(completeJobPath).href);
|
|
35
|
-
} catch {
|
|
36
|
-
throw new JobNotFoundError(jobName);
|
|
37
|
-
}
|
|
38
|
-
if (!mod[jobName]) {
|
|
39
|
-
throw new JobNotFoundError(jobName);
|
|
40
|
-
}
|
|
41
|
-
return mod[jobName];
|
|
42
|
-
}
|
|
43
|
-
async function startJobsDevWorkers(viteServer) {
|
|
44
|
-
setJobLoaderOverrides({
|
|
45
|
-
loadJobsManager: () => loadJobsManagerViaVite(viteServer),
|
|
46
|
-
loadJob: (computedProperties) => loadJobViaVite(viteServer, computedProperties)
|
|
47
|
-
});
|
|
48
|
-
let jobsManager;
|
|
49
|
-
try {
|
|
50
|
-
jobsManager = await loadJobsManagerViaVite(viteServer);
|
|
51
|
-
} catch (e) {
|
|
52
|
-
if (e instanceof JobsLibNotFoundError) {
|
|
53
|
-
setJobLoaderOverrides(void 0);
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
throw e;
|
|
57
|
-
}
|
|
58
|
-
const numWorkers = buildNumWorkers(jobsManager.workers);
|
|
59
|
-
const logger = jobsManager.logger ?? console;
|
|
60
|
-
if (numWorkers.length === 0) {
|
|
61
|
-
setJobLoaderOverrides(void 0);
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
logger.warn(
|
|
65
|
-
`[CedarJS Jobs] Starting ${numWorkers.length} worker(s) in-process (Unified Dev)...`
|
|
66
|
-
);
|
|
67
|
-
const workers = numWorkers.map(([index, id]) => {
|
|
68
|
-
const workerConfig = jobsManager.workers[index];
|
|
69
|
-
const processName = `ud-jobs.${[workerConfig.queue].flat().join("-")}.${id}`;
|
|
70
|
-
return jobsManager.createWorker({
|
|
71
|
-
index,
|
|
72
|
-
clear: false,
|
|
73
|
-
workoff: false,
|
|
74
|
-
processName
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
const workerRunPromises = workers.map(
|
|
78
|
-
(worker) => worker.run().catch((e) => {
|
|
79
|
-
logger.error("[CedarJS Jobs] A worker stopped unexpectedly", e);
|
|
80
|
-
})
|
|
81
|
-
);
|
|
82
|
-
console.log(
|
|
83
|
-
ansis.dim.italic(
|
|
84
|
-
`[CedarJS Jobs] ${workers.length} worker(s) running: ` + workers.map((w) => w.processName).join(", ")
|
|
85
|
-
)
|
|
86
|
-
);
|
|
87
|
-
const stop = async () => {
|
|
88
|
-
console.log(
|
|
89
|
-
ansis.dim.italic(
|
|
90
|
-
"[CedarJS Jobs] Waiting for in-progress jobs to finish..."
|
|
91
|
-
)
|
|
92
|
-
);
|
|
93
|
-
workers.forEach((worker) => {
|
|
94
|
-
worker.forever = false;
|
|
95
|
-
});
|
|
96
|
-
try {
|
|
97
|
-
await Promise.all(workerRunPromises);
|
|
98
|
-
} finally {
|
|
99
|
-
setJobLoaderOverrides(void 0);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
return { stop };
|
|
103
|
-
}
|
|
104
|
-
export {
|
|
105
|
-
startJobsDevWorkers
|
|
106
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { SourceMap } from 'magic-string';
|
|
2
|
-
/**
|
|
3
|
-
* Generates a sourcemap for a string transform by diffing its input and
|
|
4
|
-
* output. Used for transforms that don't produce a map themselves.
|
|
5
|
-
*
|
|
6
|
-
* The diff first anchors on the common prefix and suffix lines, then aligns
|
|
7
|
-
* the remaining lines with an LCS so that unchanged lines *inside* the
|
|
8
|
-
* changed region (e.g. statements inside a newly inserted wrapper) also map
|
|
9
|
-
* exactly. Aligned line pairs that differ are refined with a character-level
|
|
10
|
-
* prefix/suffix diff, which gives exact column mappings for in-place
|
|
11
|
-
* rewrites (e.g. import specifier rewrites) — including the columns after
|
|
12
|
-
* the rewritten span. Only lines with no counterpart at all map coarsely, to
|
|
13
|
-
* the start of their surrounding edit.
|
|
14
|
-
*
|
|
15
|
-
* Returns null when the input and output are identical.
|
|
16
|
-
*/
|
|
17
|
-
export declare function generateDiffSourceMap(original: string, transformed: string): SourceMap | null;
|
|
18
|
-
//# sourceMappingURL=generateDiffSourceMap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateDiffSourceMap.d.ts","sourceRoot":"","sources":["../../src/lib/generateDiffSourceMap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAc7C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAClB,SAAS,GAAG,IAAI,CA0DlB"}
|