@cedarjs/internal 7.0.0-canary.2984 → 7.0.0-canary.2985
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/build/api.d.ts.map +1 -1
- package/dist/build/api.js +5 -19
- package/dist/build/esbuild-plugin-api-graphql.d.ts.map +1 -1
- package/dist/build/esbuild-plugin-api-graphql.js +2 -4
- package/dist/build/esbuild-plugin-handler-als-wrapping.d.ts +1 -3
- package/dist/build/esbuild-plugin-handler-als-wrapping.d.ts.map +1 -1
- package/dist/build/esbuild-plugin-handler-als-wrapping.js +2 -3
- package/package.json +10 -10
package/dist/build/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/build/api.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,YAAY,EAAe,MAAM,SAAS,CAAA;AAwCtE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAI9D,eAAO,MAAM,QAAQ,4DAIpB,CAAA;AAED,eAAO,MAAM,UAAU,4DAStB,CAAA;AAED,eAAO,MAAM,aAAa,qBAGzB,CAAA;AA8UD,eAAO,MAAM,gBAAgB,iHA+D5B,CAAA;AAcD,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAoDf"}
|
package/dist/build/api.js
CHANGED
|
@@ -14,12 +14,7 @@ import {
|
|
|
14
14
|
getApiSideBabelPluginsForVite,
|
|
15
15
|
transformWithBabel
|
|
16
16
|
} from "@cedarjs/babel-config";
|
|
17
|
-
import {
|
|
18
|
-
getConfig,
|
|
19
|
-
getPaths,
|
|
20
|
-
projectSideIsEsm,
|
|
21
|
-
resolveFile
|
|
22
|
-
} from "@cedarjs/project-config";
|
|
17
|
+
import { getConfig, getPaths, resolveFile } from "@cedarjs/project-config";
|
|
23
18
|
import { findApiFiles } from "../files.js";
|
|
24
19
|
import {
|
|
25
20
|
applyGqlormInject,
|
|
@@ -79,7 +74,6 @@ const runCedarBabelTransformsPlugin = {
|
|
|
79
74
|
fileContents = applyJobPathInjector(fileContents, args.path, getPaths().api.jobs) ?? fileContents;
|
|
80
75
|
const normalizedPath = normalizePath(args.path);
|
|
81
76
|
const cedarPaths = getPaths();
|
|
82
|
-
const isEsm = projectSideIsEsm("api");
|
|
83
77
|
const apiBabelConfigPath = getApiSideBabelConfigPath();
|
|
84
78
|
let code = fileContents;
|
|
85
79
|
if (apiBabelConfigPath) {
|
|
@@ -98,9 +92,7 @@ const runCedarBabelTransformsPlugin = {
|
|
|
98
92
|
code = applyImportExtensions(code, args.path);
|
|
99
93
|
const functionsDir = normalizePath(cedarPaths.api.functions);
|
|
100
94
|
if (normalizedPath.startsWith(functionsDir + "/")) {
|
|
101
|
-
code = applyHandlerAlsWrapping(code
|
|
102
|
-
projectIsEsm: isEsm
|
|
103
|
-
}) ?? code;
|
|
95
|
+
code = applyHandlerAlsWrapping(code) ?? code;
|
|
104
96
|
}
|
|
105
97
|
if (normalizedPath.startsWith(normalizePath(cedarPaths.api.src) + "/")) {
|
|
106
98
|
code = applyOtelWrapping(code, args.path, cedarPaths.api.src) ?? code;
|
|
@@ -178,7 +170,6 @@ function createDirectoryNamedImportVitePlugin() {
|
|
|
178
170
|
}
|
|
179
171
|
function createCedarViteApiPlugin() {
|
|
180
172
|
const cedarConfig = getConfig();
|
|
181
|
-
const isEsm = projectSideIsEsm("api");
|
|
182
173
|
return {
|
|
183
174
|
name: "cedar-vite-api-babel-transform",
|
|
184
175
|
enforce: "pre",
|
|
@@ -223,9 +214,7 @@ function createCedarViteApiPlugin() {
|
|
|
223
214
|
outputCode = applyImportExtensions(outputCode, id);
|
|
224
215
|
const functionsDir = normalizePath(cedarPaths.api.functions);
|
|
225
216
|
if (normalizedId.startsWith(functionsDir + "/")) {
|
|
226
|
-
outputCode = applyHandlerAlsWrapping(outputCode
|
|
227
|
-
projectIsEsm: isEsm
|
|
228
|
-
}) ?? outputCode;
|
|
217
|
+
outputCode = applyHandlerAlsWrapping(outputCode) ?? outputCode;
|
|
229
218
|
}
|
|
230
219
|
if (!transformedCode) {
|
|
231
220
|
if (outputCode === code) {
|
|
@@ -245,8 +234,6 @@ function createCedarViteApiPlugin() {
|
|
|
245
234
|
}
|
|
246
235
|
const buildApiWithVite = async () => {
|
|
247
236
|
const cedarPaths = getPaths();
|
|
248
|
-
const isEsm = projectSideIsEsm("api");
|
|
249
|
-
const format = isEsm ? "es" : "cjs";
|
|
250
237
|
const apiFiles = findApiFiles();
|
|
251
238
|
const input = {};
|
|
252
239
|
for (const f of apiFiles) {
|
|
@@ -263,7 +250,7 @@ const buildApiWithVite = async () => {
|
|
|
263
250
|
rollupOptions: {
|
|
264
251
|
input,
|
|
265
252
|
output: {
|
|
266
|
-
format,
|
|
253
|
+
format: "es",
|
|
267
254
|
preserveModules: true,
|
|
268
255
|
preserveModulesRoot: cedarPaths.api.src,
|
|
269
256
|
entryFileNames: "[name].js",
|
|
@@ -344,13 +331,12 @@ async function fixSourceMaps(distDir, srcDir) {
|
|
|
344
331
|
}
|
|
345
332
|
function getEsbuildOptions(files) {
|
|
346
333
|
const cedarPaths = getPaths();
|
|
347
|
-
const format = projectSideIsEsm("api") ? "esm" : "cjs";
|
|
348
334
|
return {
|
|
349
335
|
absWorkingDir: cedarPaths.api.base,
|
|
350
336
|
entryPoints: files,
|
|
351
337
|
platform: "node",
|
|
352
338
|
target: "node24",
|
|
353
|
-
format,
|
|
339
|
+
format: "esm",
|
|
354
340
|
allowOverwrite: true,
|
|
355
341
|
bundle: false,
|
|
356
342
|
// Registration order matters: cedarApiGraphqlPlugin (narrow filter) must
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild-plugin-api-graphql.d.ts","sourceRoot":"","sources":["../../src/build/esbuild-plugin-api-graphql.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAsB1C,eAAO,MAAM,qBAAqB;;iBAEnB,WAAW;
|
|
1
|
+
{"version":3,"file":"esbuild-plugin-api-graphql.d.ts","sourceRoot":"","sources":["../../src/build/esbuild-plugin-api-graphql.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAsB1C,eAAO,MAAM,qBAAqB;;iBAEnB,WAAW;CA8GzB,CAAA"}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getApiSideBabelPluginsForVite,
|
|
6
6
|
transformWithBabel
|
|
7
7
|
} from "@cedarjs/babel-config";
|
|
8
|
-
import { getConfig, getPaths
|
|
8
|
+
import { getConfig, getPaths } from "@cedarjs/project-config";
|
|
9
9
|
import {
|
|
10
10
|
applyGqlormInject,
|
|
11
11
|
applyGraphqlOptionsExtract
|
|
@@ -59,9 +59,7 @@ const cedarApiGraphqlPlugin = {
|
|
|
59
59
|
if (cedarConfig.experimental?.opentelemetry?.enabled && cedarConfig.experimental?.opentelemetry?.wrapApi) {
|
|
60
60
|
code = applyOtelWrapping(code, args.path, getPaths().api.src) ?? code;
|
|
61
61
|
}
|
|
62
|
-
code = applyHandlerAlsWrapping(code
|
|
63
|
-
projectIsEsm: projectSideIsEsm("api")
|
|
64
|
-
}) ?? code;
|
|
62
|
+
code = applyHandlerAlsWrapping(code) ?? code;
|
|
65
63
|
return {
|
|
66
64
|
contents: code,
|
|
67
65
|
// Babel output is always plain JS. Without Babel the contents are
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export declare function applyHandlerAlsWrapping(code: string
|
|
2
|
-
projectIsEsm?: boolean;
|
|
3
|
-
}): string | null;
|
|
1
|
+
export declare function applyHandlerAlsWrapping(code: string): string | null;
|
|
4
2
|
//# sourceMappingURL=esbuild-plugin-handler-als-wrapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/build/esbuild-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAOA,wBAAgB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"esbuild-plugin-handler-als-wrapping.d.ts","sourceRoot":"","sources":["../../src/build/esbuild-plugin-handler-als-wrapping.ts"],"names":[],"mappings":"AAOA,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsCnE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function applyHandlerAlsWrapping(code
|
|
1
|
+
function applyHandlerAlsWrapping(code) {
|
|
2
2
|
const handlerRe = /^export\s+(?:const|let|var)\s+handler(?:[^=]|=>)*?=(?![>=])/m;
|
|
3
3
|
const handlerMatch = handlerRe.exec(code);
|
|
4
4
|
if (!handlerMatch) {
|
|
@@ -6,8 +6,7 @@ function applyHandlerAlsWrapping(code, { projectIsEsm = false } = {}) {
|
|
|
6
6
|
}
|
|
7
7
|
const afterEquals = code.slice(handlerMatch.index + handlerMatch[0].length).trimStart();
|
|
8
8
|
const isAsync = /^async(?:\s*[\(\*]|\s+function)/.test(afterEquals);
|
|
9
|
-
const
|
|
10
|
-
const importStatement = `import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '${storePath}'
|
|
9
|
+
const importStatement = `import { getAsyncStoreInstance as __cedar_getAsyncStoreInstance } from '@cedarjs/context/dist/store.js'
|
|
11
10
|
`;
|
|
12
11
|
const handlerStart = handlerMatch.index;
|
|
13
12
|
const before = code.slice(0, handlerStart);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/internal",
|
|
3
|
-
"version": "7.0.0-canary.
|
|
3
|
+
"version": "7.0.0-canary.2985",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -121,14 +121,14 @@
|
|
|
121
121
|
"@babel/parser": "7.29.8",
|
|
122
122
|
"@babel/plugin-transform-typescript": "^7.26.8",
|
|
123
123
|
"@babel/traverse": "7.29.8",
|
|
124
|
-
"@cedarjs/api": "7.0.0-canary.
|
|
125
|
-
"@cedarjs/babel-config": "7.0.0-canary.
|
|
126
|
-
"@cedarjs/cli-helpers": "7.0.0-canary.
|
|
127
|
-
"@cedarjs/graphql-server": "7.0.0-canary.
|
|
128
|
-
"@cedarjs/project-config": "7.0.0-canary.
|
|
129
|
-
"@cedarjs/router": "7.0.0-canary.
|
|
130
|
-
"@cedarjs/structure": "7.0.0-canary.
|
|
131
|
-
"@cedarjs/utils": "7.0.0-canary.
|
|
124
|
+
"@cedarjs/api": "7.0.0-canary.2985",
|
|
125
|
+
"@cedarjs/babel-config": "7.0.0-canary.2985",
|
|
126
|
+
"@cedarjs/cli-helpers": "7.0.0-canary.2985",
|
|
127
|
+
"@cedarjs/graphql-server": "7.0.0-canary.2985",
|
|
128
|
+
"@cedarjs/project-config": "7.0.0-canary.2985",
|
|
129
|
+
"@cedarjs/router": "7.0.0-canary.2985",
|
|
130
|
+
"@cedarjs/structure": "7.0.0-canary.2985",
|
|
131
|
+
"@cedarjs/utils": "7.0.0-canary.2985",
|
|
132
132
|
"@graphql-codegen/add": "6.0.1",
|
|
133
133
|
"@graphql-codegen/cli": "6.3.1",
|
|
134
134
|
"@graphql-codegen/client-preset": "5.3.0",
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
"vite-tsconfig-paths": "^6.1.1"
|
|
167
167
|
},
|
|
168
168
|
"devDependencies": {
|
|
169
|
-
"@cedarjs/framework-tools": "7.0.0-canary.
|
|
169
|
+
"@cedarjs/framework-tools": "7.0.0-canary.2985",
|
|
170
170
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
171
171
|
"@oxc-project/types": "^0.144.0",
|
|
172
172
|
"concurrently": "9.2.4",
|