@cedarjs/internal 6.0.0-canary.2820 → 6.0.0-canary.2821
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-graphql-transforms.d.ts","sourceRoot":"","sources":["../../src/build/api-graphql-transforms.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-graphql-transforms.d.ts","sourceRoot":"","sources":["../../src/build/api-graphql-transforms.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA8GtE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,KAAK,GAAG,KAAa,GAC3B,MAAM,GAAG,IAAI,CAmFf"}
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
getPaths,
|
|
7
7
|
importStatementPath
|
|
8
8
|
} from "@cedarjs/project-config";
|
|
9
|
+
const GRAPHQL_OPTIONS_ERROR_PREFIX = "Could not read the GraphQL options in api/src/functions/graphql. Cedar needs to statically extract them so the api server can serve /graphql and its health endpoint. ";
|
|
10
|
+
const GRAPHQL_OPTIONS_ERROR_SUFFIX = " Expected a single `createGraphQLHandler({ ... })` call with the options passed directly as an object, an identifier, a call, or a ternary.";
|
|
9
11
|
function applyGraphqlOptionsExtract(code) {
|
|
10
12
|
if (code.includes("__cedar_graphqlOptions")) {
|
|
11
13
|
return null;
|
|
@@ -41,18 +43,26 @@ function applyGraphqlOptionsExtract(code) {
|
|
|
41
43
|
}
|
|
42
44
|
}).visit(program);
|
|
43
45
|
if (callExpressionPaths.length > 1) {
|
|
44
|
-
|
|
46
|
+
throw new Error(
|
|
47
|
+
GRAPHQL_OPTIONS_ERROR_PREFIX + "Found more than one call to createGraphQLHandler." + GRAPHQL_OPTIONS_ERROR_SUFFIX
|
|
48
|
+
);
|
|
45
49
|
}
|
|
46
50
|
const callExpression = callExpressionPaths[0];
|
|
47
51
|
if (!callExpression) {
|
|
48
|
-
|
|
52
|
+
throw new Error(
|
|
53
|
+
GRAPHQL_OPTIONS_ERROR_PREFIX + "createGraphQLHandler is imported but never called." + GRAPHQL_OPTIONS_ERROR_SUFFIX
|
|
54
|
+
);
|
|
49
55
|
}
|
|
50
56
|
const options = callExpression.arguments[0];
|
|
51
57
|
if (!options) {
|
|
52
|
-
|
|
58
|
+
throw new Error(
|
|
59
|
+
GRAPHQL_OPTIONS_ERROR_PREFIX + "createGraphQLHandler was called without any options." + GRAPHQL_OPTIONS_ERROR_SUFFIX
|
|
60
|
+
);
|
|
53
61
|
}
|
|
54
62
|
if (options.type !== "Identifier" && options.type !== "ObjectExpression" && options.type !== "CallExpression" && options.type !== "ConditionalExpression") {
|
|
55
|
-
|
|
63
|
+
throw new Error(
|
|
64
|
+
GRAPHQL_OPTIONS_ERROR_PREFIX + `The options argument is a ${options.type}, which can't be read statically.` + GRAPHQL_OPTIONS_ERROR_SUFFIX
|
|
65
|
+
);
|
|
56
66
|
}
|
|
57
67
|
const optionsStart = options.start;
|
|
58
68
|
const optionsEnd = options.end;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/internal",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2821",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -122,13 +122,13 @@
|
|
|
122
122
|
"@babel/plugin-transform-react-jsx": "7.29.7",
|
|
123
123
|
"@babel/plugin-transform-typescript": "^7.26.8",
|
|
124
124
|
"@babel/traverse": "7.29.7",
|
|
125
|
-
"@cedarjs/babel-config": "6.0.0-canary.
|
|
126
|
-
"@cedarjs/cli-helpers": "6.0.0-canary.
|
|
127
|
-
"@cedarjs/graphql-server": "6.0.0-canary.
|
|
128
|
-
"@cedarjs/project-config": "6.0.0-canary.
|
|
129
|
-
"@cedarjs/router": "6.0.0-canary.
|
|
130
|
-
"@cedarjs/structure": "6.0.0-canary.
|
|
131
|
-
"@cedarjs/utils": "6.0.0-canary.
|
|
125
|
+
"@cedarjs/babel-config": "6.0.0-canary.2821",
|
|
126
|
+
"@cedarjs/cli-helpers": "6.0.0-canary.2821",
|
|
127
|
+
"@cedarjs/graphql-server": "6.0.0-canary.2821",
|
|
128
|
+
"@cedarjs/project-config": "6.0.0-canary.2821",
|
|
129
|
+
"@cedarjs/router": "6.0.0-canary.2821",
|
|
130
|
+
"@cedarjs/structure": "6.0.0-canary.2821",
|
|
131
|
+
"@cedarjs/utils": "6.0.0-canary.2821",
|
|
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",
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
},
|
|
174
174
|
"devDependencies": {
|
|
175
175
|
"@arethetypeswrong/cli": "0.18.5",
|
|
176
|
-
"@cedarjs/framework-tools": "6.0.0-canary.
|
|
176
|
+
"@cedarjs/framework-tools": "6.0.0-canary.2821",
|
|
177
177
|
"concurrently": "9.2.4",
|
|
178
178
|
"graphql-tag": "2.12.6",
|
|
179
179
|
"publint": "0.3.22",
|