@cedarjs/vite 5.0.3 → 5.0.4-next.167
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/api/vite-plugin-cedar-vitest-api-preset.d.ts.map +1 -1
- package/dist/api/vite-plugin-cedar-vitest-api-preset.js +4 -0
- package/dist/apiDevMiddleware.d.ts.map +1 -1
- package/dist/apiDevMiddleware.js +105 -9
- package/dist/buildApp.d.ts.map +1 -1
- package/dist/buildApp.js +79 -18
- package/dist/buildRouteHooks.d.ts.map +1 -1
- package/dist/buildRouteHooks.js +36 -4
- package/dist/bundled/react-server-dom-webpack.server.js +192 -99
- package/dist/cedar-unified-dev.d.ts +18 -0
- package/dist/cedar-unified-dev.d.ts.map +1 -1
- package/dist/cedar-unified-dev.js +39 -5
- package/dist/devFeServer.js +3 -8
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -19
- package/dist/lib/generateDiffSourceMap.d.ts +18 -0
- package/dist/lib/generateDiffSourceMap.d.ts.map +1 -0
- package/dist/lib/generateDiffSourceMap.js +151 -0
- package/dist/lib/getMergedConfig.d.ts.map +1 -1
- package/dist/lib/getMergedConfig.js +4 -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 +8 -1
- package/dist/plugins/vite-plugin-cedar-cell.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-cell.js +2 -1
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts +3 -0
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-data-uri-shim.js +43 -0
- package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts +12 -0
- package/dist/plugins/vite-plugin-cedar-directory-named-import.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-directory-named-import.js +35 -0
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts +29 -0
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-gqlorm-inject.js +76 -0
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts +42 -0
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.js +93 -0
- package/dist/plugins/vite-plugin-cedar-import-dir.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-import-dir.js +33 -15
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts +28 -0
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-log-formatter-dev.js +67 -0
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts +28 -0
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-mock-cell-data.js +247 -0
- package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts +39 -0
- package/dist/plugins/vite-plugin-cedar-otel-wrapping.d.ts.map +1 -0
- package/dist/plugins/vite-plugin-cedar-otel-wrapping.js +200 -0
- package/dist/plugins/vite-plugin-cedar-universal-deploy.js +1 -1
- 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 +14 -0
- package/dist/plugins/{vite-plugin-cedar-context-wrapping.d.ts → vite-plugin-handler-als-wrapping.d.ts} +12 -12
- package/dist/plugins/vite-plugin-handler-als-wrapping.d.ts.map +1 -0
- package/dist/plugins/{vite-plugin-cedar-context-wrapping.js → vite-plugin-handler-als-wrapping.js} +16 -16
- package/dist/plugins/vite-plugin-swap-apollo-provider.d.ts +3 -0
- 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 +3 -5
- package/dist/streaming/buildForStreamingServer.d.ts.map +1 -1
- package/dist/streaming/buildForStreamingServer.js +3 -5
- package/package.json +42 -52
- package/dist/cjs/ClientRouter.d.ts +0 -1
- package/dist/cjs/api/vite-plugin-cedar-vitest-api-preset.js +0 -37
- package/dist/cjs/apiDevMiddleware.js +0 -371
- package/dist/cjs/build/build.d.ts +0 -1
- package/dist/cjs/build/build.js +0 -58
- package/dist/cjs/buildApp.js +0 -306
- package/dist/cjs/buildFeServer.d.ts +0 -1
- package/dist/cjs/buildFeServer.js +0 -63
- package/dist/cjs/buildRouteHooks.js +0 -80
- package/dist/cjs/buildRouteManifest.js +0 -92
- package/dist/cjs/buildRscClientAndServer.js +0 -54
- package/dist/cjs/cedar-unified-dev.js +0 -310
- package/dist/cjs/client.d.ts +0 -1
- package/dist/cjs/clientSsr.d.ts +0 -1
- package/dist/cjs/devFeServer.js +0 -157
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -141
- package/dist/cjs/lib/StatusError.js +0 -37
- package/dist/cjs/lib/entries.js +0 -52
- package/dist/cjs/lib/getMergedConfig.js +0 -185
- package/dist/cjs/lib/onWarn.js +0 -36
- package/dist/cjs/lib/registerFwGlobalsAndShims.js +0 -102
- package/dist/cjs/lib/workspacePackageAliases.js +0 -107
- package/dist/cjs/middleware/index.js +0 -22
- package/dist/cjs/middleware/invokeMiddleware.js +0 -52
- package/dist/cjs/middleware/register.js +0 -105
- package/dist/cjs/middleware/types.js +0 -16
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/plugins/vite-plugin-cedar-auto-import.js +0 -107
- package/dist/cjs/plugins/vite-plugin-cedar-cell.js +0 -183
- package/dist/cjs/plugins/vite-plugin-cedar-cjs-compat.js +0 -341
- package/dist/cjs/plugins/vite-plugin-cedar-context-wrapping.js +0 -95
- package/dist/cjs/plugins/vite-plugin-cedar-entry-injection.js +0 -107
- package/dist/cjs/plugins/vite-plugin-cedar-html-env.js +0 -67
- package/dist/cjs/plugins/vite-plugin-cedar-import-dir.js +0 -118
- package/dist/cjs/plugins/vite-plugin-cedar-node-polyfills.js +0 -43
- package/dist/cjs/plugins/vite-plugin-cedar-remove-dev-fatal-error-page.js +0 -61
- package/dist/cjs/plugins/vite-plugin-cedar-remove-from-bundle.js +0 -76
- package/dist/cjs/plugins/vite-plugin-cedar-routes-auto-loader.js +0 -126
- package/dist/cjs/plugins/vite-plugin-cedar-universal-deploy.js +0 -346
- package/dist/cjs/plugins/vite-plugin-cedar-wait-for-api-server.js +0 -134
- package/dist/cjs/plugins/vite-plugin-cedarjs-job-path-injector.js +0 -134
- package/dist/cjs/plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js +0 -106
- package/dist/cjs/plugins/vite-plugin-jsx-loader.js +0 -42
- package/dist/cjs/plugins/vite-plugin-merged-config.js +0 -39
- package/dist/cjs/plugins/vite-plugin-rsc-analyze.js +0 -104
- package/dist/cjs/plugins/vite-plugin-rsc-reload.js +0 -75
- package/dist/cjs/plugins/vite-plugin-rsc-routes-auto-loader.js +0 -159
- package/dist/cjs/plugins/vite-plugin-rsc-routes-imports.js +0 -125
- package/dist/cjs/plugins/vite-plugin-rsc-ssr-router-import.js +0 -75
- package/dist/cjs/plugins/vite-plugin-rsc-transform-client.js +0 -228
- package/dist/cjs/plugins/vite-plugin-rsc-transform-server.js +0 -398
- package/dist/cjs/plugins/vite-plugin-swap-apollo-provider.js +0 -46
- package/dist/cjs/rsc/rscBuildAnalyze.js +0 -126
- package/dist/cjs/rsc/rscBuildClient.js +0 -91
- package/dist/cjs/rsc/rscBuildCopyCssAssets.js +0 -56
- package/dist/cjs/rsc/rscBuildEntriesFile.js +0 -115
- package/dist/cjs/rsc/rscBuildForServer.js +0 -168
- package/dist/cjs/rsc/rscBuildForSsr.js +0 -173
- package/dist/cjs/rsc/rscBuildRwEnvVars.js +0 -56
- package/dist/cjs/rsc/rscRenderer.js +0 -165
- package/dist/cjs/rsc/rscRequestHandler.js +0 -162
- package/dist/cjs/rsc/rscStudioHandlers.js +0 -156
- package/dist/cjs/runFeServer.js +0 -165
- package/dist/cjs/streaming/buildForStreamingServer.js +0 -65
- package/dist/cjs/streaming/collectCss.js +0 -52
- package/dist/cjs/streaming/createReactStreamingHandler.js +0 -173
- package/dist/cjs/streaming/streamHelpers.js +0 -230
- package/dist/cjs/streaming/transforms/bufferedTransform.js +0 -61
- package/dist/cjs/streaming/transforms/cancelTimeoutTransform.js +0 -34
- package/dist/cjs/streaming/transforms/encode-decode.js +0 -36
- package/dist/cjs/streaming/transforms/serverInjectionTransform.js +0 -84
- package/dist/cjs/streaming/triggerRouteHooks.js +0 -96
- package/dist/cjs/types.js +0 -16
- package/dist/cjs/utils.js +0 -92
- package/dist/package.json +0 -1
- package/dist/plugins/vite-plugin-cedar-context-wrapping.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts +0 -3
- package/dist/plugins/vite-plugin-cedar-node-polyfills.d.ts.map +0 -1
- package/dist/plugins/vite-plugin-cedar-node-polyfills.js +0 -19
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { parseSync } from "oxc-parser";
|
|
2
|
+
import { normalizePath } from "vite";
|
|
3
|
+
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
+
function cedarOtelWrappingPlugin() {
|
|
5
|
+
return {
|
|
6
|
+
name: "cedar-otel-wrapping",
|
|
7
|
+
transform(code, id) {
|
|
8
|
+
let apiSrc;
|
|
9
|
+
try {
|
|
10
|
+
apiSrc = normalizePath(getPaths().api.src);
|
|
11
|
+
} catch {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (!normalizePath(id).startsWith(apiSrc + "/")) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
const relativePath = normalizePath(id).slice(apiSrc.length + 1);
|
|
18
|
+
const apiFolder = relativePath.split("/")[0] ?? "?";
|
|
19
|
+
const result = applyOtelWrapping(code, id, apiFolder);
|
|
20
|
+
return result ? { code: result, map: null } : null;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function applyOtelWrapping(code, filename, apiFolder) {
|
|
25
|
+
const parseResult = parseSync(filename, code, { sourceType: "module" });
|
|
26
|
+
const replacements = [];
|
|
27
|
+
for (const node of parseResult.program.body) {
|
|
28
|
+
if (node.type !== "ExportNamedDeclaration") {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const decl = node.declaration;
|
|
32
|
+
if (decl?.type !== "VariableDeclaration") {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const declarator = decl.declarations[0];
|
|
36
|
+
if (!declarator) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const fn = declarator.init;
|
|
40
|
+
if (fn?.type !== "ArrowFunctionExpression") {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
if (declarator.id.type !== "Identifier") {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const fnName = declarator.id.name;
|
|
47
|
+
const innerArgs = buildInnerArgs(fn.params);
|
|
48
|
+
if (innerArgs === null) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const fnHeader = code.slice(fn.start, fn.body.start);
|
|
52
|
+
const originalFnSrc = code.slice(fn.start, fn.end);
|
|
53
|
+
const isAsync = fn.async;
|
|
54
|
+
const awaitKw = isAsync ? "await " : "";
|
|
55
|
+
const asyncKw = isAsync ? "async " : "";
|
|
56
|
+
replacements.push({
|
|
57
|
+
start: node.start,
|
|
58
|
+
end: node.end,
|
|
59
|
+
src: buildWrappedExport(
|
|
60
|
+
fnName,
|
|
61
|
+
fnHeader,
|
|
62
|
+
originalFnSrc,
|
|
63
|
+
innerArgs,
|
|
64
|
+
awaitKw,
|
|
65
|
+
asyncKw,
|
|
66
|
+
apiFolder,
|
|
67
|
+
filename
|
|
68
|
+
)
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (replacements.length === 0) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
let output = code;
|
|
75
|
+
for (let i = replacements.length - 1; i >= 0; i--) {
|
|
76
|
+
const r = replacements[i];
|
|
77
|
+
output = output.slice(0, r.start) + r.src + output.slice(r.end);
|
|
78
|
+
}
|
|
79
|
+
return `import { trace as OTEL_TRACE } from '@opentelemetry/api'
|
|
80
|
+
` + output;
|
|
81
|
+
}
|
|
82
|
+
function buildInnerArgs(params) {
|
|
83
|
+
const args = [];
|
|
84
|
+
for (const param of params) {
|
|
85
|
+
if (param.type === "RestElement" || param.type === "ArrayPattern" || param.type === "TSParameterProperty") {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
if (param.type === "Identifier") {
|
|
89
|
+
args.push(param.name);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (param.type === "ObjectPattern") {
|
|
93
|
+
for (const prop of param.properties) {
|
|
94
|
+
if (prop.type === "RestElement") {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
if (prop.key.type !== "Identifier") {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const value = prop.value;
|
|
101
|
+
if (value.type !== "Identifier" && value.type !== "AssignmentPattern" && value.type !== "ObjectPattern") {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
if (value.type === "AssignmentPattern") {
|
|
105
|
+
if (value.left.type !== "Identifier" && value.left.type !== "ObjectPattern") {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const obj = buildObjectCallArg(param);
|
|
111
|
+
if (obj === null) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
args.push(obj);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (param.type === "AssignmentPattern") {
|
|
118
|
+
const ap = param;
|
|
119
|
+
if (ap.left.type === "Identifier") {
|
|
120
|
+
args.push(ap.left.name);
|
|
121
|
+
} else if (ap.left.type === "ObjectPattern") {
|
|
122
|
+
const obj = buildObjectCallArg(ap.left);
|
|
123
|
+
if (obj === null) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
args.push(obj);
|
|
127
|
+
} else {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
return args.join(", ");
|
|
135
|
+
}
|
|
136
|
+
function buildObjectCallArg(pattern) {
|
|
137
|
+
const keys = [];
|
|
138
|
+
for (const prop of pattern.properties) {
|
|
139
|
+
if (prop.type === "RestElement") {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
if (prop.key.type !== "Identifier") {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
const keyName = prop.key.name;
|
|
146
|
+
let valueName = null;
|
|
147
|
+
if (prop.value.type === "Identifier") {
|
|
148
|
+
valueName = prop.value.name;
|
|
149
|
+
} else if (prop.value.type === "AssignmentPattern") {
|
|
150
|
+
if (prop.value.left.type === "Identifier") {
|
|
151
|
+
valueName = prop.value.left.name;
|
|
152
|
+
} else {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
} else {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
if (valueName !== keyName) {
|
|
159
|
+
keys.push(`${keyName}: ${valueName}`);
|
|
160
|
+
} else {
|
|
161
|
+
keys.push(keyName);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return `{ ${keys.join(", ")} }`;
|
|
165
|
+
}
|
|
166
|
+
function buildWrappedExport(fnName, fnHeader, originalFnSrc, innerArgs, awaitKw, asyncKw, apiFolder, filename) {
|
|
167
|
+
const privateName = `__${fnName}`;
|
|
168
|
+
const spanName = `redwoodjs:api:${apiFolder}:${fnName}`;
|
|
169
|
+
return `export const ${fnName} = ${fnHeader}{
|
|
170
|
+
const ${privateName} = ${originalFnSrc}
|
|
171
|
+
const OTEL_TRACER = OTEL_TRACE.getTracer('redwoodjs')
|
|
172
|
+
const OTEL_RESULT = ${awaitKw}OTEL_TRACER.startActiveSpan(
|
|
173
|
+
'${spanName}',
|
|
174
|
+
${asyncKw}(span) => {
|
|
175
|
+
span.setAttribute('code.function', '${fnName}')
|
|
176
|
+
span.setAttribute('code.filepath', ${JSON.stringify(filename)})
|
|
177
|
+
try {
|
|
178
|
+
const OTEL_INNER_RESULT = ${awaitKw}${privateName}(${innerArgs})
|
|
179
|
+
span.end()
|
|
180
|
+
return OTEL_INNER_RESULT
|
|
181
|
+
} catch (error) {
|
|
182
|
+
span.recordException(error)
|
|
183
|
+
span.setStatus({
|
|
184
|
+
code: 2,
|
|
185
|
+
message:
|
|
186
|
+
error?.message?.split('\\n')[0] ??
|
|
187
|
+
error?.toString()?.split('\\n')[0],
|
|
188
|
+
})
|
|
189
|
+
span.end()
|
|
190
|
+
throw error
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
return OTEL_RESULT
|
|
195
|
+
}`;
|
|
196
|
+
}
|
|
197
|
+
export {
|
|
198
|
+
applyOtelWrapping,
|
|
199
|
+
cedarOtelWrappingPlugin
|
|
200
|
+
};
|
|
@@ -296,7 +296,7 @@ async function generateFunctionModule(distPath) {
|
|
|
296
296
|
const ctx = await buildCedarContext(request);
|
|
297
297
|
// Wrap the handler in an AsyncLocalStorage run so the global
|
|
298
298
|
// @cedarjs/context is available inside it (and isolated per request).
|
|
299
|
-
// Mirrors the GraphQL module above and the
|
|
299
|
+
// Mirrors the GraphQL module above and the handlerAlsWrappingPlugin
|
|
300
300
|
// used for non-UD builds.
|
|
301
301
|
const { getAsyncStoreInstance } = await import(
|
|
302
302
|
'@cedarjs/context/dist/store'
|
|
@@ -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,CA2F9D"}
|
|
@@ -52,6 +52,20 @@ function cedarjsResolveCedarStyleImportsPlugin() {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
if (cedarPaths && id.startsWith("$api/")) {
|
|
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
|
+
}
|
|
55
69
|
const resolvedPath = path.resolve(path.dirname(importer), id);
|
|
56
70
|
if (fs.existsSync(resolvedPath)) {
|
|
57
71
|
const stats = fs.statSync(resolvedPath);
|
|
@@ -8,24 +8,24 @@ import type { Plugin } from 'vite';
|
|
|
8
8
|
* For each file in `api/src/functions/` that exports a `handler`, this plugin:
|
|
9
9
|
*
|
|
10
10
|
* 1. Adds an import at the top of the file:
|
|
11
|
-
* import { getAsyncStoreInstance as
|
|
11
|
+
* import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '@cedarjs/context/dist/store'
|
|
12
12
|
*
|
|
13
13
|
* 2. Renames the original handler:
|
|
14
|
-
* const
|
|
14
|
+
* const __cedar_handler = <original handler value>
|
|
15
15
|
*
|
|
16
16
|
* 3. Replaces the handler export with a wrapper that checks context isolation:
|
|
17
|
-
* export const handler = (
|
|
18
|
-
* const
|
|
19
|
-
* if (
|
|
20
|
-
* return
|
|
17
|
+
* export const handler = (__cedar_event, __cedar_context) => {
|
|
18
|
+
* const __cedar_contextStore = __cedar_getAsyncStoreInstance().getStore()
|
|
19
|
+
* if (__cedar_contextStore === undefined) {
|
|
20
|
+
* return __cedar_getAsyncStoreInstance().run(new Map(), __cedar_handler, __cedar_event, __cedar_context)
|
|
21
21
|
* }
|
|
22
|
-
* return
|
|
22
|
+
* return __cedar_handler(__cedar_event, __cedar_context)
|
|
23
23
|
* }
|
|
24
24
|
*
|
|
25
|
-
* This replaces `babel-plugin-
|
|
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
|
|
28
|
+
export declare function handlerAlsWrappingPlugin({ projectIsEsm, }?: {
|
|
29
29
|
projectIsEsm?: boolean;
|
|
30
30
|
}): Plugin;
|
|
31
31
|
/**
|
|
@@ -34,11 +34,11 @@ export declare function cedarContextWrappingPlugin({ projectIsEsm, }?: {
|
|
|
34
34
|
* export a `handler`.
|
|
35
35
|
*
|
|
36
36
|
* This is the context-isolation safeguard that used to be performed by
|
|
37
|
-
* `babel-plugin-
|
|
37
|
+
* `babel-plugin-handler-als-wrapping`. It is exported as a standalone
|
|
38
38
|
* function so it can be applied from build pipelines that don't go through
|
|
39
39
|
* Vite's plugin pipeline (e.g. the legacy esbuild API build).
|
|
40
40
|
*/
|
|
41
|
-
export declare function
|
|
41
|
+
export declare function applyHandlerAlsWrapping(code: string, { projectIsEsm }?: {
|
|
42
42
|
projectIsEsm?: boolean;
|
|
43
43
|
}): string | null;
|
|
44
|
-
//# sourceMappingURL=vite-plugin-
|
|
44
|
+
//# sourceMappingURL=vite-plugin-handler-als-wrapping.d.ts.map
|
|
@@ -0,0 +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,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"}
|
package/dist/plugins/{vite-plugin-cedar-context-wrapping.js → vite-plugin-handler-als-wrapping.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { normalizePath } from "vite";
|
|
3
3
|
import { getPaths } from "@cedarjs/project-config";
|
|
4
|
-
function
|
|
4
|
+
function handlerAlsWrappingPlugin({
|
|
5
5
|
projectIsEsm = false
|
|
6
6
|
} = {}) {
|
|
7
7
|
return {
|
|
8
|
-
name: "
|
|
8
|
+
name: "handler-als-wrapping",
|
|
9
9
|
transform(code, id) {
|
|
10
10
|
let paths;
|
|
11
11
|
try {
|
|
@@ -17,12 +17,12 @@ function cedarContextWrappingPlugin({
|
|
|
17
17
|
if (!normalizePath(id).startsWith(functionsDir + "/")) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
const wrapped =
|
|
20
|
+
const wrapped = applyHandlerAlsWrapping(code, { projectIsEsm });
|
|
21
21
|
return wrapped ? { code: wrapped, map: null } : null;
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
|
|
26
26
|
const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
|
|
27
27
|
const handlerMatch = handlerRe.exec(code);
|
|
28
28
|
if (!handlerMatch) {
|
|
@@ -31,30 +31,30 @@ function applyContextWrapping(code, { projectIsEsm = false } = {}) {
|
|
|
31
31
|
const afterEquals = code.slice(handlerMatch.index + handlerMatch[0].length).trimStart();
|
|
32
32
|
const isAsync = /^async(?:\s*[\(\*]|\s+function)/.test(afterEquals);
|
|
33
33
|
const storePath = projectIsEsm ? "@cedarjs/context/dist/store.js" : "@cedarjs/context/dist/store";
|
|
34
|
-
const importStatement = `import { getAsyncStoreInstance as
|
|
34
|
+
const importStatement = `import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '${storePath}'
|
|
35
35
|
`;
|
|
36
36
|
const handlerStart = handlerMatch.index;
|
|
37
37
|
const before = code.slice(0, handlerStart);
|
|
38
38
|
const after = code.slice(handlerStart);
|
|
39
|
-
const renamed = after.replace(handlerRe, "const
|
|
39
|
+
const renamed = after.replace(handlerRe, "const __cedar_handler =");
|
|
40
40
|
const wrappedHandler = `
|
|
41
|
-
export const handler = ${isAsync ? "async " : ""}(
|
|
41
|
+
export const handler = ${isAsync ? "async " : ""}(__cedar_event, __cedar_context) => {
|
|
42
42
|
// The store will be undefined if no context isolation has been performed yet
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
return
|
|
43
|
+
const __cedar_contextStore = __cedar_getAsyncStoreInstance().getStore()
|
|
44
|
+
if (__cedar_contextStore === undefined) {
|
|
45
|
+
return __cedar_getAsyncStoreInstance().run(
|
|
46
46
|
new Map(),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
__cedar_handler,
|
|
48
|
+
__cedar_event,
|
|
49
|
+
__cedar_context
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
|
-
return
|
|
52
|
+
return __cedar_handler(__cedar_event, __cedar_context)
|
|
53
53
|
}
|
|
54
54
|
`;
|
|
55
55
|
return before + importStatement + renamed + wrappedHandler;
|
|
56
56
|
}
|
|
57
57
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
applyHandlerAlsWrapping,
|
|
59
|
+
handlerAlsWrappingPlugin
|
|
60
60
|
};
|
|
@@ -5,6 +5,9 @@ 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"
|
|
8
11
|
*/
|
|
9
12
|
export declare function cedarSwapApolloProvider(): Plugin | undefined;
|
|
10
13
|
//# 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;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAyB5D"}
|
|
@@ -5,11 +5,11 @@ function cedarSwapApolloProvider() {
|
|
|
5
5
|
return void 0;
|
|
6
6
|
}
|
|
7
7
|
return {
|
|
8
|
-
name: "
|
|
8
|
+
name: "cedar-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(?:\/CedarApolloProvider)?/g,
|
|
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,+GA6IA"}
|
|
@@ -51,11 +51,9 @@ 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/*"
|
|
57
|
-
"@cedarjs/auth-*-api",
|
|
58
|
-
"@cedarjs/auth-!(dbauth)-web"
|
|
54
|
+
// Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware,
|
|
55
|
+
// rwjs/router, rwjs/auth-*-api, rwjs/auth-*-web, rwjs/forms
|
|
56
|
+
"@cedarjs/prerender/*"
|
|
59
57
|
]
|
|
60
58
|
}),
|
|
61
59
|
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,iBAgCA"}
|
|
@@ -14,11 +14,9 @@ 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/*"
|
|
20
|
-
"@cedarjs/auth-*-api",
|
|
21
|
-
"@cedarjs/auth-!(dbauth)-web"
|
|
17
|
+
// Skip ESM modules: rwjs/auth, rwjs/web, rwjs/auth-*-middleware,
|
|
18
|
+
// rwjs/router, rwjs/auth-*-api, rwjs/auth-*-web, rwjs/forms
|
|
19
|
+
"@cedarjs/prerender/*"
|
|
22
20
|
]
|
|
23
21
|
})
|
|
24
22
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4-next.167",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,27 +12,17 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
"./package.json": "./package.json",
|
|
14
14
|
".": {
|
|
15
|
-
"
|
|
15
|
+
"default": {
|
|
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"
|
|
22
18
|
}
|
|
23
19
|
},
|
|
24
20
|
"./api": {
|
|
25
21
|
"types": "./dist/api/vite-plugin-cedar-vitest-api-preset.d.ts",
|
|
26
22
|
"default": "./dist/api/vite-plugin-cedar-vitest-api-preset.js"
|
|
27
23
|
},
|
|
28
|
-
"./buildFeServer":
|
|
29
|
-
|
|
30
|
-
"import": "./dist/buildFeServer.js"
|
|
31
|
-
},
|
|
32
|
-
"./build": {
|
|
33
|
-
"import": "./dist/build/build.js",
|
|
34
|
-
"default": "./dist/cjs/build/build.js"
|
|
35
|
-
},
|
|
24
|
+
"./buildFeServer": "./dist/buildFeServer.js",
|
|
25
|
+
"./build": "./dist/build/build.js",
|
|
36
26
|
"./bins/cedar-vite-build.mjs": "./bins/cedar-vite-build.mjs"
|
|
37
27
|
},
|
|
38
28
|
"bin": {
|
|
@@ -49,67 +39,68 @@
|
|
|
49
39
|
"inject"
|
|
50
40
|
],
|
|
51
41
|
"scripts": {
|
|
52
|
-
"build": "node ./build.ts
|
|
42
|
+
"build": "node ./build.ts",
|
|
53
43
|
"build:pack": "yarn pack -o cedarjs-vite.tgz",
|
|
54
44
|
"build:types": "tsc --build --verbose ./tsconfig.build.json",
|
|
55
|
-
"check:attw": "
|
|
45
|
+
"check:attw": "yarn cedar-fwtools-attw --exclude-entrypoints ./bins/cedar-vite-build.mjs",
|
|
56
46
|
"check:package": "concurrently npm:check:attw yarn:publint",
|
|
57
47
|
"test": "vitest run",
|
|
58
48
|
"test:watch": "vitest watch"
|
|
59
49
|
},
|
|
60
50
|
"dependencies": {
|
|
61
|
-
"@ast-grep/napi": "0.
|
|
51
|
+
"@ast-grep/napi": "0.45.0",
|
|
62
52
|
"@babel/generator": "7.29.7",
|
|
63
53
|
"@babel/parser": "7.29.7",
|
|
64
54
|
"@babel/traverse": "7.29.7",
|
|
65
55
|
"@babel/types": "7.29.7",
|
|
66
|
-
"@cedarjs/api": "5.0.
|
|
67
|
-
"@cedarjs/
|
|
68
|
-
"@cedarjs/
|
|
69
|
-
"@cedarjs/
|
|
70
|
-
"@cedarjs/graphql-server": "5.0.
|
|
71
|
-
"@cedarjs/internal": "5.0.
|
|
72
|
-
"@cedarjs/project-config": "5.0.
|
|
73
|
-
"@cedarjs/server-store": "5.0.
|
|
74
|
-
"@cedarjs/
|
|
75
|
-
"@
|
|
76
|
-
"@swc/core": "1.15.
|
|
56
|
+
"@cedarjs/api": "5.0.4-next.167",
|
|
57
|
+
"@cedarjs/api-server": "5.0.4-next.167",
|
|
58
|
+
"@cedarjs/babel-config": "5.0.4-next.167",
|
|
59
|
+
"@cedarjs/context": "5.0.4-next.167",
|
|
60
|
+
"@cedarjs/graphql-server": "5.0.4-next.167",
|
|
61
|
+
"@cedarjs/internal": "5.0.4-next.167",
|
|
62
|
+
"@cedarjs/project-config": "5.0.4-next.167",
|
|
63
|
+
"@cedarjs/server-store": "5.0.4-next.167",
|
|
64
|
+
"@cedarjs/structure": "5.0.4-next.167",
|
|
65
|
+
"@cedarjs/testing": "5.0.4-next.167",
|
|
66
|
+
"@swc/core": "1.15.46",
|
|
77
67
|
"@universal-deploy/store": "^0.2.1",
|
|
78
68
|
"@universal-deploy/vite": "^0.1.9",
|
|
79
69
|
"@vitejs/plugin-react": "4.7.0",
|
|
80
70
|
"@whatwg-node/fetch": "0.10.13",
|
|
81
|
-
"@whatwg-node/server": "0.
|
|
82
|
-
"acorn": "8.
|
|
71
|
+
"@whatwg-node/server": "0.11.0",
|
|
72
|
+
"acorn": "8.17.0",
|
|
83
73
|
"acorn-loose": "8.5.2",
|
|
84
|
-
"ansis": "4.
|
|
85
|
-
"buffer": "6.0.3",
|
|
74
|
+
"ansis": "4.3.1",
|
|
86
75
|
"busboy": "^1.6.0",
|
|
87
|
-
"cookie": "1.1.1",
|
|
88
76
|
"dotenv-defaults": "5.0.2",
|
|
89
|
-
"execa": "5.1.1",
|
|
90
77
|
"express": "4.22.2",
|
|
91
|
-
"
|
|
92
|
-
"fastify-raw-body": "5.0.0",
|
|
78
|
+
"fast-glob": "3.3.3",
|
|
93
79
|
"find-my-way": "8.2.2",
|
|
94
80
|
"http-proxy-middleware": "3.0.7",
|
|
95
|
-
"isbot": "5.1
|
|
81
|
+
"isbot": "5.2.1",
|
|
82
|
+
"magic-string": "0.30.21",
|
|
83
|
+
"oxc-parser": "0.141.0",
|
|
96
84
|
"react": "18.3.1",
|
|
97
|
-
"react-server-dom-webpack": "19.2.
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"vite": "7.3.
|
|
85
|
+
"react-server-dom-webpack": "19.2.7",
|
|
86
|
+
"unimport": "5.7.0",
|
|
87
|
+
"unplugin-auto-import": "19.3.0",
|
|
88
|
+
"vite": "7.3.6",
|
|
101
89
|
"vite-plugin-cjs-interop": "2.4.4",
|
|
102
|
-
"vite-plugin-
|
|
90
|
+
"vite-plugin-graphql-tag": "0.1.1",
|
|
91
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
103
92
|
"ws": "8.20.0",
|
|
104
93
|
"yargs-parser": "21.1.1"
|
|
105
94
|
},
|
|
106
95
|
"devDependencies": {
|
|
107
|
-
"@
|
|
108
|
-
"@cedarjs/
|
|
109
|
-
"@cedarjs/router": "5.0.
|
|
110
|
-
"@cedarjs/web": "5.0.
|
|
96
|
+
"@cedarjs/auth": "5.0.4-next.167",
|
|
97
|
+
"@cedarjs/framework-tools": "5.0.4-next.167",
|
|
98
|
+
"@cedarjs/router": "5.0.4-next.167",
|
|
99
|
+
"@cedarjs/web": "5.0.4-next.167",
|
|
100
|
+
"@dr.pogodin/react-helmet": "2.0.4",
|
|
111
101
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
112
102
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
103
|
+
"@oxc-project/types": "^0.141.0",
|
|
113
104
|
"@types/aws-lambda": "8.10.162",
|
|
114
105
|
"@types/busboy": "^1",
|
|
115
106
|
"@types/express": "4",
|
|
@@ -117,18 +108,17 @@
|
|
|
117
108
|
"@types/ws": "^8",
|
|
118
109
|
"@types/yargs-parser": "21.0.3",
|
|
119
110
|
"concurrently": "9.2.4",
|
|
120
|
-
"glob": "11.1.0",
|
|
121
111
|
"memfs": "4.64.0",
|
|
122
|
-
"publint": "0.3.
|
|
112
|
+
"publint": "0.3.22",
|
|
123
113
|
"rollup": "4.60.4",
|
|
124
114
|
"ts-dedent": "2.3.0",
|
|
125
115
|
"typescript": "5.9.3",
|
|
126
|
-
"vitest": "
|
|
116
|
+
"vitest": "4.1.10"
|
|
127
117
|
},
|
|
128
118
|
"peerDependencies": {
|
|
129
|
-
"@cedarjs/auth": "5.0.
|
|
130
|
-
"@cedarjs/router": "5.0.
|
|
131
|
-
"@cedarjs/web": "5.0.
|
|
119
|
+
"@cedarjs/auth": "5.0.4-next.167",
|
|
120
|
+
"@cedarjs/router": "5.0.4-next.167",
|
|
121
|
+
"@cedarjs/web": "5.0.4-next.167"
|
|
132
122
|
},
|
|
133
123
|
"engines": {
|
|
134
124
|
"node": ">=24"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type * from "../ClientRouter.d.ts"
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var vite_plugin_cedar_vitest_api_preset_exports = {};
|
|
20
|
-
__export(vite_plugin_cedar_vitest_api_preset_exports, {
|
|
21
|
-
cedarVitestPreset: () => cedarVitestPreset
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(vite_plugin_cedar_vitest_api_preset_exports);
|
|
24
|
-
var import_vitest = require("@cedarjs/testing/api/vitest");
|
|
25
|
-
var import_vite_plugin_cedarjs_resolve_cedar_style_imports = require("../plugins/vite-plugin-cedarjs-resolve-cedar-style-imports.js");
|
|
26
|
-
function cedarVitestPreset() {
|
|
27
|
-
return [
|
|
28
|
-
(0, import_vitest.cedarVitestApiConfigPlugin)(),
|
|
29
|
-
(0, import_vitest.autoImportsPlugin)(),
|
|
30
|
-
(0, import_vite_plugin_cedarjs_resolve_cedar_style_imports.cedarjsResolveCedarStyleImportsPlugin)(),
|
|
31
|
-
(0, import_vitest.trackDbImportsPlugin)()
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {
|
|
36
|
-
cedarVitestPreset
|
|
37
|
-
});
|