@cedarjs/internal 5.0.4-next.167 → 5.0.4
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/ast.d.ts +0 -1
- package/dist/ast.d.ts.map +1 -1
- package/dist/ast.js +0 -21
- package/dist/build/api.d.ts +0 -2
- package/dist/build/api.d.ts.map +1 -1
- package/dist/build/api.js +39 -202
- package/dist/build/esbuild-plugin-cedar-context-wrapping.d.ts +4 -0
- package/dist/build/esbuild-plugin-cedar-context-wrapping.d.ts.map +1 -0
- package/dist/build/{esbuild-plugin-handler-als-wrapping.js → esbuild-plugin-cedar-context-wrapping.js} +12 -12
- package/dist/cjs/ast.d.ts +26 -0
- package/dist/cjs/ast.d.ts.map +1 -0
- package/dist/cjs/ast.js +201 -0
- package/dist/cjs/build/api.d.ts +7 -0
- package/dist/cjs/build/api.d.ts.map +1 -0
- package/dist/cjs/build/api.js +251 -0
- package/dist/cjs/build/esbuild-plugin-cedar-context-wrapping.d.ts +4 -0
- package/dist/cjs/build/esbuild-plugin-cedar-context-wrapping.d.ts.map +1 -0
- package/dist/cjs/build/esbuild-plugin-cedar-context-wrapping.js +59 -0
- package/dist/cjs/cliLogger.d.ts +11 -0
- package/dist/cjs/cliLogger.d.ts.map +1 -0
- package/dist/cjs/cliLogger.js +36 -0
- package/dist/cjs/dev.d.ts +2 -0
- package/dist/cjs/dev.d.ts.map +1 -0
- package/dist/cjs/dev.js +41 -0
- package/dist/cjs/files.d.ts +56 -0
- package/dist/cjs/files.d.ts.map +1 -0
- package/dist/cjs/files.js +230 -0
- package/dist/cjs/generate/clientPreset.d.ts +17 -0
- package/dist/cjs/generate/clientPreset.d.ts.map +1 -0
- package/dist/cjs/generate/clientPreset.js +84 -0
- package/dist/cjs/generate/generate.d.ts +10 -0
- package/dist/cjs/generate/generate.d.ts.map +1 -0
- package/dist/cjs/generate/generate.js +97 -0
- package/dist/cjs/generate/gqlormSchema.d.ts +113 -0
- package/dist/cjs/generate/gqlormSchema.d.ts.map +1 -0
- package/dist/cjs/generate/gqlormSchema.js +1061 -0
- package/dist/cjs/generate/graphqlCodeGen.d.ts +16 -0
- package/dist/cjs/generate/graphqlCodeGen.d.ts.map +1 -0
- package/dist/cjs/generate/graphqlCodeGen.js +380 -0
- package/dist/cjs/generate/graphqlSchema.d.ts +8 -0
- package/dist/cjs/generate/graphqlSchema.d.ts.map +1 -0
- package/dist/cjs/generate/graphqlSchema.js +157 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/index.d.ts +7 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/index.d.ts.map +1 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/index.js +65 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/visitor.d.ts +10 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/visitor.d.ts.map +1 -0
- package/dist/cjs/generate/plugins/rw-typescript-resolvers/visitor.js +92 -0
- package/dist/cjs/generate/possibleTypes.d.ts +36 -0
- package/dist/cjs/generate/possibleTypes.d.ts.map +1 -0
- package/dist/cjs/generate/possibleTypes.js +106 -0
- package/dist/cjs/generate/templates/all-currentUser.d.ts.template +30 -0
- package/dist/cjs/generate/templates/all-gqlorm.d.ts.template +7 -0
- package/dist/cjs/generate/templates/api-globImports.d.ts.template +9 -0
- package/dist/cjs/generate/templates/api-globalContext.d.ts.template +7 -0
- package/dist/cjs/generate/templates/api-scenarios.d.ts.template +10 -0
- package/dist/cjs/generate/templates/api-test-globals.d.ts.template +5 -0
- package/dist/cjs/generate/templates/mirror-cell.d.ts.template +13 -0
- package/dist/cjs/generate/templates/mirror-directoryNamedModule.d.ts.template +5 -0
- package/dist/cjs/generate/templates/web-routerRoutes.d.ts.template +20 -0
- package/dist/cjs/generate/templates/web-routesPages.d.ts.template +13 -0
- package/dist/cjs/generate/templates/web-test-globals.d.ts.template +7 -0
- package/dist/cjs/generate/templates.d.ts +6 -0
- package/dist/cjs/generate/templates.d.ts.map +1 -0
- package/dist/cjs/generate/templates.js +68 -0
- package/dist/cjs/generate/trustedDocuments.d.ts +3 -0
- package/dist/cjs/generate/trustedDocuments.d.ts.map +1 -0
- package/dist/cjs/generate/trustedDocuments.js +95 -0
- package/dist/cjs/generate/typeDefinitions.d.ts +31 -0
- package/dist/cjs/generate/typeDefinitions.d.ts.map +1 -0
- package/dist/cjs/generate/typeDefinitions.js +372 -0
- package/dist/cjs/generate/types.d.ts +6 -0
- package/dist/cjs/generate/types.d.ts.map +1 -0
- package/dist/cjs/generate/types.js +16 -0
- package/dist/cjs/generate/watch.d.ts +3 -0
- package/dist/cjs/generate/watch.d.ts.map +1 -0
- package/dist/cjs/generate/watch.js +132 -0
- package/dist/cjs/gql.d.ts +14 -0
- package/dist/cjs/gql.d.ts.map +1 -0
- package/dist/cjs/gql.js +108 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/jsx.d.ts +16 -0
- package/dist/cjs/jsx.d.ts.map +1 -0
- package/dist/cjs/jsx.js +101 -0
- package/dist/cjs/jsxAttributeValue.d.ts +2 -0
- package/dist/cjs/jsxAttributeValue.d.ts.map +1 -0
- package/dist/cjs/jsxAttributeValue.js +129 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/project.d.ts +8 -0
- package/dist/cjs/project.d.ts.map +1 -0
- package/dist/cjs/project.js +82 -0
- package/dist/cjs/routes.d.ts +42 -0
- package/dist/cjs/routes.d.ts.map +1 -0
- package/dist/cjs/routes.js +111 -0
- package/dist/cjs/ts2js.d.ts +40 -0
- package/dist/cjs/ts2js.d.ts.map +1 -0
- package/dist/cjs/ts2js.js +159 -0
- package/dist/cjs/validateSchema.d.ts +14 -0
- package/dist/cjs/validateSchema.d.ts.map +1 -0
- package/dist/cjs/validateSchema.js +195 -0
- package/dist/generate/clientPreset.d.ts.map +1 -1
- package/dist/generate/clientPreset.js +3 -10
- package/dist/generate/typeDefinitions.d.ts.map +1 -1
- package/dist/generate/typeDefinitions.js +1 -15
- package/dist/gql.d.ts +0 -20
- package/dist/gql.d.ts.map +1 -1
- package/dist/gql.js +0 -24
- package/package.json +80 -48
- package/dist/build/api-graphql-transforms.d.ts +0 -34
- package/dist/build/api-graphql-transforms.d.ts.map +0 -1
- package/dist/build/api-graphql-transforms.js +0 -119
- package/dist/build/auto-import.d.ts +0 -10
- package/dist/build/auto-import.d.ts.map +0 -1
- package/dist/build/auto-import.js +0 -120
- package/dist/build/directory-named-import.d.ts +0 -2
- package/dist/build/directory-named-import.d.ts.map +0 -1
- package/dist/build/directory-named-import.js +0 -26
- package/dist/build/esbuild-plugin-api-graphql.d.ts +0 -6
- package/dist/build/esbuild-plugin-api-graphql.d.ts.map +0 -1
- package/dist/build/esbuild-plugin-api-graphql.js +0 -80
- package/dist/build/esbuild-plugin-cedar-otel-wrapping.d.ts +0 -13
- package/dist/build/esbuild-plugin-cedar-otel-wrapping.d.ts.map +0 -1
- package/dist/build/esbuild-plugin-cedar-otel-wrapping.js +0 -180
- package/dist/build/esbuild-plugin-handler-als-wrapping.d.ts +0 -4
- package/dist/build/esbuild-plugin-handler-als-wrapping.d.ts.map +0 -1
- package/dist/build/esm-extensions.d.ts +0 -33
- package/dist/build/esm-extensions.d.ts.map +0 -1
- package/dist/build/esm-extensions.js +0 -37
- package/dist/build/import-dir.d.ts +0 -22
- package/dist/build/import-dir.d.ts.map +0 -1
- package/dist/build/import-dir.js +0 -54
- package/dist/build/job-path-injector.d.ts +0 -15
- package/dist/build/job-path-injector.d.ts.map +0 -1
- package/dist/build/job-path-injector.js +0 -69
- package/dist/build/src-alias.d.ts +0 -14
- package/dist/build/src-alias.d.ts.map +0 -1
- package/dist/build/src-alias.js +0 -17
- package/dist/build/tsconfig-paths.d.ts +0 -2
- package/dist/build/tsconfig-paths.d.ts.map +0 -1
- package/dist/build/tsconfig-paths.js +0 -72
- package/dist/generate/templates/mirror-cell-fragment.d.ts.template +0 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/internal",
|
|
3
|
-
"version": "5.0.4
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -10,88 +10,124 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"
|
|
13
|
+
"import": {
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
15
|
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"require": {
|
|
18
|
+
"types": "./dist/cjs/index.d.ts",
|
|
19
|
+
"default": "./dist/cjs/index.js"
|
|
16
20
|
}
|
|
17
21
|
},
|
|
18
22
|
"./package.json": "./package.json",
|
|
19
23
|
"./dist/dev": {
|
|
20
|
-
"
|
|
24
|
+
"import": {
|
|
21
25
|
"types": "./dist/dev.d.ts",
|
|
22
26
|
"default": "./dist/dev.js"
|
|
27
|
+
},
|
|
28
|
+
"require": {
|
|
29
|
+
"types": "./dist/cjs/dev.d.ts",
|
|
30
|
+
"default": "./dist/cjs/dev.js"
|
|
23
31
|
}
|
|
24
32
|
},
|
|
25
33
|
"./dist/files": {
|
|
26
|
-
"
|
|
34
|
+
"import": {
|
|
27
35
|
"types": "./dist/files.d.ts",
|
|
28
36
|
"default": "./dist/files.js"
|
|
37
|
+
},
|
|
38
|
+
"require": {
|
|
39
|
+
"types": "./dist/cjs/files.d.ts",
|
|
40
|
+
"default": "./dist/cjs/files.js"
|
|
29
41
|
}
|
|
30
42
|
},
|
|
31
43
|
"./dist/files.js": {
|
|
32
|
-
"
|
|
44
|
+
"import": {
|
|
33
45
|
"types": "./dist/files.d.ts",
|
|
34
46
|
"default": "./dist/files.js"
|
|
47
|
+
},
|
|
48
|
+
"require": {
|
|
49
|
+
"types": "./dist/cjs/files.d.ts",
|
|
50
|
+
"default": "./dist/cjs/files.js"
|
|
35
51
|
}
|
|
36
52
|
},
|
|
37
53
|
"./dist/gql": {
|
|
38
|
-
"
|
|
54
|
+
"import": {
|
|
39
55
|
"types": "./dist/gql.d.ts",
|
|
40
56
|
"default": "./dist/gql.js"
|
|
57
|
+
},
|
|
58
|
+
"require": {
|
|
59
|
+
"types": "./dist/cjs/gql.d.ts",
|
|
60
|
+
"default": "./dist/cjs/gql.js"
|
|
41
61
|
}
|
|
42
62
|
},
|
|
43
63
|
"./dist/project": {
|
|
44
|
-
"
|
|
64
|
+
"import": {
|
|
45
65
|
"types": "./dist/project.d.ts",
|
|
46
66
|
"default": "./dist/project.js"
|
|
67
|
+
},
|
|
68
|
+
"require": {
|
|
69
|
+
"types": "./dist/cjs/project.d.ts",
|
|
70
|
+
"default": "./dist/cjs/project.js"
|
|
47
71
|
}
|
|
48
72
|
},
|
|
49
73
|
"./dist/routes.js": {
|
|
50
|
-
"
|
|
74
|
+
"import": {
|
|
51
75
|
"types": "./dist/routes.d.ts",
|
|
52
76
|
"default": "./dist/routes.js"
|
|
77
|
+
},
|
|
78
|
+
"require": {
|
|
79
|
+
"types": "./dist/cjs/routes.d.ts",
|
|
80
|
+
"default": "./dist/cjs/routes.js"
|
|
53
81
|
}
|
|
54
82
|
},
|
|
55
83
|
"./dist/ts2js": {
|
|
56
|
-
"
|
|
84
|
+
"import": {
|
|
57
85
|
"types": "./dist/ts2js.d.ts",
|
|
58
86
|
"default": "./dist/ts2js.js"
|
|
87
|
+
},
|
|
88
|
+
"require": {
|
|
89
|
+
"types": "./dist/cjs/ts2js.d.ts",
|
|
90
|
+
"default": "./dist/cjs/ts2js.js"
|
|
59
91
|
}
|
|
60
92
|
},
|
|
61
93
|
"./dist/validateSchema": {
|
|
62
|
-
"
|
|
94
|
+
"import": {
|
|
63
95
|
"types": "./dist/validateSchema.d.ts",
|
|
64
96
|
"default": "./dist/validateSchema.js"
|
|
97
|
+
},
|
|
98
|
+
"require": {
|
|
99
|
+
"types": "./dist/cjs/validateSchema.d.ts",
|
|
100
|
+
"default": "./dist/cjs/validateSchema.js"
|
|
65
101
|
}
|
|
66
102
|
},
|
|
67
103
|
"./dist/build/api": {
|
|
68
|
-
"
|
|
104
|
+
"import": {
|
|
69
105
|
"types": "./dist/build/api.d.ts",
|
|
70
106
|
"default": "./dist/build/api.js"
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"types": "./dist/build/api.d.ts",
|
|
76
|
-
"default": "./dist/build/api.js"
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
"./dist/build/api-graphql-transforms.js": {
|
|
80
|
-
"default": {
|
|
81
|
-
"types": "./dist/build/api-graphql-transforms.d.ts",
|
|
82
|
-
"default": "./dist/build/api-graphql-transforms.js"
|
|
107
|
+
},
|
|
108
|
+
"require": {
|
|
109
|
+
"types": "./dist/cjs/build/api.d.ts",
|
|
110
|
+
"default": "./dist/cjs/build/api.js"
|
|
83
111
|
}
|
|
84
112
|
},
|
|
85
113
|
"./dist/generate/generate": {
|
|
86
|
-
"
|
|
114
|
+
"import": {
|
|
87
115
|
"types": "./dist/generate/generate.d.ts",
|
|
88
116
|
"default": "./dist/generate/generate.js"
|
|
117
|
+
},
|
|
118
|
+
"require": {
|
|
119
|
+
"types": "./dist/cjs/generate/generate.d.ts",
|
|
120
|
+
"default": "./dist/cjs/generate/generate.js"
|
|
89
121
|
}
|
|
90
122
|
},
|
|
91
123
|
"./dist/generate/gqlormSchema": {
|
|
92
|
-
"
|
|
124
|
+
"import": {
|
|
93
125
|
"types": "./dist/generate/gqlormSchema.d.ts",
|
|
94
126
|
"default": "./dist/generate/gqlormSchema.js"
|
|
127
|
+
},
|
|
128
|
+
"require": {
|
|
129
|
+
"types": "./dist/cjs/generate/gqlormSchema.d.ts",
|
|
130
|
+
"default": "./dist/cjs/generate/gqlormSchema.js"
|
|
95
131
|
}
|
|
96
132
|
}
|
|
97
133
|
},
|
|
@@ -108,6 +144,7 @@
|
|
|
108
144
|
"build:clean-dist": "rimraf 'dist/**/*/__tests__' --glob",
|
|
109
145
|
"build:pack": "yarn pack -o cedarjs-internal.tgz",
|
|
110
146
|
"build:types": "tsc --build --verbose ./tsconfig.build.json",
|
|
147
|
+
"build:types-cjs": "tsc --build --verbose ./tsconfig.cjs.json",
|
|
111
148
|
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx\" --ignore dist --exec \"yarn build\"",
|
|
112
149
|
"check:attw": "yarn cedar-fwtools-attw",
|
|
113
150
|
"check:package": "concurrently npm:check:attw yarn:publint",
|
|
@@ -122,13 +159,13 @@
|
|
|
122
159
|
"@babel/plugin-transform-react-jsx": "7.29.7",
|
|
123
160
|
"@babel/plugin-transform-typescript": "^7.26.8",
|
|
124
161
|
"@babel/traverse": "7.29.7",
|
|
125
|
-
"@cedarjs/babel-config": "5.0.4
|
|
126
|
-
"@cedarjs/cli-helpers": "5.0.4
|
|
127
|
-
"@cedarjs/graphql-server": "5.0.4
|
|
128
|
-
"@cedarjs/project-config": "5.0.4
|
|
129
|
-
"@cedarjs/router": "5.0.4
|
|
130
|
-
"@cedarjs/structure": "5.0.4
|
|
131
|
-
"@cedarjs/utils": "5.0.4
|
|
162
|
+
"@cedarjs/babel-config": "5.0.4",
|
|
163
|
+
"@cedarjs/cli-helpers": "5.0.4",
|
|
164
|
+
"@cedarjs/graphql-server": "5.0.4",
|
|
165
|
+
"@cedarjs/project-config": "5.0.4",
|
|
166
|
+
"@cedarjs/router": "5.0.4",
|
|
167
|
+
"@cedarjs/structure": "5.0.4",
|
|
168
|
+
"@cedarjs/utils": "5.0.4",
|
|
132
169
|
"@graphql-codegen/add": "6.0.1",
|
|
133
170
|
"@graphql-codegen/cli": "6.3.1",
|
|
134
171
|
"@graphql-codegen/client-preset": "5.3.0",
|
|
@@ -142,23 +179,21 @@
|
|
|
142
179
|
"@graphql-codegen/typescript-react-apollo": "4.4.2",
|
|
143
180
|
"@graphql-codegen/typescript-resolvers": "5.1.8",
|
|
144
181
|
"@graphql-codegen/visitor-plugin-common": "6.3.0",
|
|
145
|
-
"@graphql-tools/code-file-loader": "8.1.
|
|
182
|
+
"@graphql-tools/code-file-loader": "8.1.29",
|
|
146
183
|
"@graphql-tools/documents": "1.0.1",
|
|
147
|
-
"@graphql-tools/graphql-file-loader": "8.1.
|
|
148
|
-
"@graphql-tools/load": "8.1.
|
|
149
|
-
"@graphql-tools/merge": "9.
|
|
184
|
+
"@graphql-tools/graphql-file-loader": "8.1.12",
|
|
185
|
+
"@graphql-tools/load": "8.1.8",
|
|
186
|
+
"@graphql-tools/merge": "9.1.9",
|
|
150
187
|
"@prisma/dmmf": "7.8.0",
|
|
151
188
|
"@prisma/internals": "7.8.0",
|
|
152
189
|
"@sdl-codegen/node": "2.0.1",
|
|
153
|
-
"ansis": "4.
|
|
190
|
+
"ansis": "4.2.0",
|
|
154
191
|
"deepmerge": "4.3.1",
|
|
155
|
-
"esbuild": "0.
|
|
192
|
+
"esbuild": "0.27.7",
|
|
156
193
|
"execa": "5.1.1",
|
|
157
194
|
"fast-glob": "3.3.3",
|
|
158
195
|
"graphql": "16.14.2",
|
|
159
196
|
"kill-port": "1.6.1",
|
|
160
|
-
"magic-string": "0.30.21",
|
|
161
|
-
"oxc-parser": "0.141.0",
|
|
162
197
|
"prettier": "3.8.4",
|
|
163
198
|
"rimraf": "6.1.3",
|
|
164
199
|
"source-map": "0.7.6",
|
|
@@ -166,19 +201,16 @@
|
|
|
166
201
|
"systeminformation": "5.31.7",
|
|
167
202
|
"termi-link": "1.1.0",
|
|
168
203
|
"ts-node": "10.9.2",
|
|
169
|
-
"tsconfig-paths": "4.2.0",
|
|
170
204
|
"typescript": "5.9.3",
|
|
171
|
-
"vite": "7.3.
|
|
172
|
-
"vite-tsconfig-paths": "^6.1.1"
|
|
205
|
+
"vite": "7.3.5"
|
|
173
206
|
},
|
|
174
207
|
"devDependencies": {
|
|
175
|
-
"@arethetypeswrong/cli": "0.18.
|
|
176
|
-
"@cedarjs/framework-tools": "5.0.4
|
|
208
|
+
"@arethetypeswrong/cli": "0.18.4",
|
|
209
|
+
"@cedarjs/framework-tools": "5.0.4",
|
|
177
210
|
"concurrently": "9.2.4",
|
|
178
211
|
"graphql-tag": "2.12.6",
|
|
179
|
-
"publint": "0.3.
|
|
180
|
-
"
|
|
181
|
-
"vitest": "4.1.10"
|
|
212
|
+
"publint": "0.3.21",
|
|
213
|
+
"vitest": "3.2.6"
|
|
182
214
|
},
|
|
183
215
|
"engines": {
|
|
184
216
|
"node": ">=24"
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts the options argument from createGraphQLHandler calls and stores
|
|
3
|
-
* them in an exported variable. Returns the transformed code, or null if no
|
|
4
|
-
* transformation was needed.
|
|
5
|
-
*
|
|
6
|
-
* Transforms:
|
|
7
|
-
* export const handler = createGraphQLHandler({ options })
|
|
8
|
-
* into:
|
|
9
|
-
* export const __cedar_graphqlOptions = { options }
|
|
10
|
-
* export const handler = createGraphQLHandler(__cedar_graphqlOptions)
|
|
11
|
-
*/
|
|
12
|
-
export declare function applyGraphqlOptionsExtract(code: string): string | null;
|
|
13
|
-
/**
|
|
14
|
-
* Injects the auto-generated gqlorm backend into graphql.ts at build time.
|
|
15
|
-
*
|
|
16
|
-
* When `experimental.gqlorm.enabled = true` and `.cedar/gqlorm/backend.ts`
|
|
17
|
-
* exists, this function:
|
|
18
|
-
*
|
|
19
|
-
* 1. Adds imports at the top of graphql.ts:
|
|
20
|
-
* import * as __gqlorm_sdl__ from '../../../.cedar/gqlorm/backend'
|
|
21
|
-
* import { db as __gqlorm_db__ } from 'src/lib/db'
|
|
22
|
-
*
|
|
23
|
-
* 2. Inserts a statement immediately before the `createGraphQLHandler` call:
|
|
24
|
-
* Object.assign(sdls, {
|
|
25
|
-
* __gqlorm__: {
|
|
26
|
-
* schema: __gqlorm_sdl__.schema,
|
|
27
|
-
* resolvers: __gqlorm_sdl__.createGqlormResolvers(__gqlorm_db__),
|
|
28
|
-
* },
|
|
29
|
-
* })
|
|
30
|
-
*
|
|
31
|
-
* Returns the transformed code, or null if no transformation was needed.
|
|
32
|
-
*/
|
|
33
|
-
export declare function applyGqlormInject(code: string, id: string, dbExt?: '.ts' | '.js'): string | null;
|
|
34
|
-
//# sourceMappingURL=api-graphql-transforms.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api-graphql-transforms.d.ts","sourceRoot":"","sources":["../../src/build/api-graphql-transforms.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA6FtE;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"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { parseSync, Visitor } from "oxc-parser";
|
|
4
|
-
import {
|
|
5
|
-
getConfig,
|
|
6
|
-
getPaths,
|
|
7
|
-
importStatementPath
|
|
8
|
-
} from "@cedarjs/project-config";
|
|
9
|
-
function applyGraphqlOptionsExtract(code) {
|
|
10
|
-
if (code.includes("__cedar_graphqlOptions")) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const { program } = parseSync("graphql.ts", code, {
|
|
14
|
-
// lang is only a parse hint; 'ts' also parses JS (the graphql handler can
|
|
15
|
-
// be graphql.js in JS projects), so this is safe for both file types.
|
|
16
|
-
lang: "ts",
|
|
17
|
-
sourceType: "module"
|
|
18
|
-
});
|
|
19
|
-
const importNames = /* @__PURE__ */ new Set();
|
|
20
|
-
for (const node of program.body) {
|
|
21
|
-
if (node.type === "ImportDeclaration") {
|
|
22
|
-
if (node.source.value !== "@cedarjs/graphql-server") {
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
for (const specifier of node.specifiers) {
|
|
26
|
-
if (specifier.type === "ImportSpecifier" && specifier.imported.type === "Identifier" && specifier.imported.name === "createGraphQLHandler") {
|
|
27
|
-
importNames.add(specifier.local.name);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (importNames.size === 0) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
const callExpressionPaths = [];
|
|
36
|
-
new Visitor({
|
|
37
|
-
CallExpression(node) {
|
|
38
|
-
if (node.callee.type === "Identifier" && importNames.has(node.callee.name)) {
|
|
39
|
-
callExpressionPaths.push(node);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}).visit(program);
|
|
43
|
-
if (callExpressionPaths.length > 1) {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
const callExpression = callExpressionPaths[0];
|
|
47
|
-
if (!callExpression) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
const options = callExpression.arguments[0];
|
|
51
|
-
if (!options) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
if (options.type !== "Identifier" && options.type !== "ObjectExpression" && options.type !== "CallExpression" && options.type !== "ConditionalExpression") {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
const optionsStart = options.start;
|
|
58
|
-
const optionsEnd = options.end;
|
|
59
|
-
const lineStart = code.lastIndexOf("\n", callExpression.start) + 1;
|
|
60
|
-
const indentMatch = /^[ \t]*/.exec(code.slice(lineStart));
|
|
61
|
-
const indent = indentMatch ? indentMatch[0] : "";
|
|
62
|
-
const optionsConst = `${indent}export const __cedar_graphqlOptions = ${code.slice(
|
|
63
|
-
optionsStart,
|
|
64
|
-
optionsEnd
|
|
65
|
-
)}
|
|
66
|
-
`;
|
|
67
|
-
const before = code.slice(0, lineStart);
|
|
68
|
-
const between = code.slice(lineStart, optionsStart);
|
|
69
|
-
const after = code.slice(optionsEnd);
|
|
70
|
-
return before + optionsConst + between + "__cedar_graphqlOptions" + after;
|
|
71
|
-
}
|
|
72
|
-
function applyGqlormInject(code, id, dbExt = ".ts") {
|
|
73
|
-
if (code.includes("__gqlorm_sdl__")) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
if (!code.includes("createGraphQLHandler")) {
|
|
77
|
-
return null;
|
|
78
|
-
}
|
|
79
|
-
if (!getConfig().experimental?.gqlorm?.enabled) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
const backendPathWithoutExt = path.join(
|
|
83
|
-
getPaths().generated.base,
|
|
84
|
-
"gqlorm",
|
|
85
|
-
"backend"
|
|
86
|
-
);
|
|
87
|
-
if (!fs.existsSync(backendPathWithoutExt + ".ts")) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
const handlerPattern = /^export\s+const\s+(\w+)\s*=\s*createGraphQLHandler\s*\(/m;
|
|
91
|
-
const handlerMatch = handlerPattern.exec(code);
|
|
92
|
-
if (!handlerMatch) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
const handlerLineStart = code.lastIndexOf("\n", handlerMatch.index) + 1;
|
|
96
|
-
const relPath = importStatementPath(
|
|
97
|
-
path.relative(path.dirname(id), backendPathWithoutExt)
|
|
98
|
-
) + ".ts";
|
|
99
|
-
const dbSrcPath = path.join(getPaths().api.src, "lib", "db");
|
|
100
|
-
const relDbPath = importStatementPath(path.relative(path.dirname(id), dbSrcPath)) + dbExt;
|
|
101
|
-
const importDb = `import { db as __gqlorm_db__ } from '${relDbPath}'`;
|
|
102
|
-
const importSdl = `import * as __gqlorm_sdl__ from '${relPath}'`;
|
|
103
|
-
const importsToAdd = `${importDb}
|
|
104
|
-
${importSdl}
|
|
105
|
-
`;
|
|
106
|
-
const sdlsMutation = `Object.assign(sdls, {
|
|
107
|
-
__gqlorm__: {
|
|
108
|
-
schema: __gqlorm_sdl__.schema,
|
|
109
|
-
resolvers: __gqlorm_sdl__.createGqlormResolvers(__gqlorm_db__),
|
|
110
|
-
},
|
|
111
|
-
})
|
|
112
|
-
`;
|
|
113
|
-
const transformed = importsToAdd + code.slice(0, handlerLineStart) + sdlsMutation + code.slice(handlerLineStart);
|
|
114
|
-
return transformed;
|
|
115
|
-
}
|
|
116
|
-
export {
|
|
117
|
-
applyGqlormInject,
|
|
118
|
-
applyGraphqlOptionsExtract
|
|
119
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Injects imports for `gql` and `context` into API source files that reference
|
|
3
|
-
* them without importing them. Uses an oxc-parser AST walk to check bindings,
|
|
4
|
-
* so local declarations never receive a conflicting import.
|
|
5
|
-
*
|
|
6
|
-
* This replaces `babel-plugin-auto-import` for the esbuild API build path,
|
|
7
|
-
* matching the behavior of `cedarAutoImportsPlugin` in Vite builds.
|
|
8
|
-
*/
|
|
9
|
-
export declare function applyAutoImports(code: string): string;
|
|
10
|
-
//# sourceMappingURL=auto-import.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auto-import.d.ts","sourceRoot":"","sources":["../../src/build/auto-import.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoBrD"}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { parseSync, Visitor } from "oxc-parser";
|
|
2
|
-
function applyAutoImports(code) {
|
|
3
|
-
const result = parseSync("temp.ts", code, {
|
|
4
|
-
lang: "ts",
|
|
5
|
-
sourceType: "module"
|
|
6
|
-
});
|
|
7
|
-
const needsGql = checkNeeds("gql", result.program, code);
|
|
8
|
-
const needsContext = checkNeeds("context", result.program, code);
|
|
9
|
-
let resultCode = code;
|
|
10
|
-
if (needsGql) {
|
|
11
|
-
resultCode = "import gql from 'graphql-tag'\n" + resultCode;
|
|
12
|
-
}
|
|
13
|
-
if (needsContext) {
|
|
14
|
-
resultCode = "import { context } from '@cedarjs/context'\n" + resultCode;
|
|
15
|
-
}
|
|
16
|
-
return resultCode;
|
|
17
|
-
}
|
|
18
|
-
function bindingInDeclarators(name, declarations) {
|
|
19
|
-
for (const decl of declarations) {
|
|
20
|
-
if (bindingPatternContains(decl.id, name)) {
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
function bindingPatternContains(pattern, name) {
|
|
27
|
-
if (pattern.type === "Identifier") {
|
|
28
|
-
return pattern.name === name;
|
|
29
|
-
}
|
|
30
|
-
if (pattern.type === "ObjectPattern") {
|
|
31
|
-
for (const prop of pattern.properties) {
|
|
32
|
-
if (prop.type === "RestElement") {
|
|
33
|
-
if (bindingPatternContains(prop.argument, name)) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
} else {
|
|
37
|
-
if (bindingPatternContains(prop.value, name)) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
if (pattern.type === "ArrayPattern") {
|
|
45
|
-
for (const el of pattern.elements) {
|
|
46
|
-
if (el) {
|
|
47
|
-
if (el.type === "RestElement") {
|
|
48
|
-
if (bindingPatternContains(el.argument, name)) {
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
} else if (bindingPatternContains(el, name)) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
if (pattern.type === "AssignmentPattern") {
|
|
59
|
-
return bindingPatternContains(pattern.left, name);
|
|
60
|
-
}
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
function checkNeeds(name, program, code) {
|
|
64
|
-
if (!code.includes(name)) {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
let isBound = false;
|
|
68
|
-
let hasUsage = false;
|
|
69
|
-
for (const node of program.body) {
|
|
70
|
-
if (node.type === "ImportDeclaration") {
|
|
71
|
-
for (const specifier of node.specifiers) {
|
|
72
|
-
if (specifier.type === "ImportSpecifier") {
|
|
73
|
-
if (specifier.imported.type === "Identifier" && specifier.imported.name === name || specifier.local.name === name) {
|
|
74
|
-
isBound = true;
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
} else if (specifier.type === "ImportDefaultSpecifier") {
|
|
78
|
-
if (specifier.local.name === name) {
|
|
79
|
-
isBound = true;
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
} else if (specifier.type === "ImportNamespaceSpecifier") {
|
|
83
|
-
if (specifier.local.name === name) {
|
|
84
|
-
isBound = true;
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (node.type === "VariableDeclaration") {
|
|
91
|
-
if (bindingInDeclarators(name, node.declarations)) {
|
|
92
|
-
isBound = true;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (node.type === "FunctionDeclaration" && node.id?.name === name) {
|
|
96
|
-
isBound = true;
|
|
97
|
-
}
|
|
98
|
-
if (node.type === "ExportNamedDeclaration" && node.declaration) {
|
|
99
|
-
if (node.declaration.type === "VariableDeclaration") {
|
|
100
|
-
if (bindingInDeclarators(name, node.declaration.declarations)) {
|
|
101
|
-
isBound = true;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (isBound) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
new Visitor({
|
|
110
|
-
Identifier(node) {
|
|
111
|
-
if (node.name === name) {
|
|
112
|
-
hasUsage = true;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}).visit(program);
|
|
116
|
-
return hasUsage;
|
|
117
|
-
}
|
|
118
|
-
export {
|
|
119
|
-
applyAutoImports
|
|
120
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"directory-named-import.d.ts","sourceRoot":"","sources":["../../src/build/directory-named-import.ts"],"names":[],"mappings":"AAiCA,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,MAAM,CAyBR"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { importStatementPath, resolveFile } from "@cedarjs/project-config";
|
|
3
|
-
const RELATIVE_IMPORT_RE = /^(\s*(?:import|export)\s[^'"]*?)(['"])(\.\.?\/[^'"]+)\2/gm;
|
|
4
|
-
function applyDirectoryNamedImport(code, filePath) {
|
|
5
|
-
const fileDir = path.dirname(filePath);
|
|
6
|
-
return code.replace(
|
|
7
|
-
RELATIVE_IMPORT_RE,
|
|
8
|
-
(match, prefix, quote, importPath) => {
|
|
9
|
-
const absolutePath = path.join(fileDir, importPath);
|
|
10
|
-
if (resolveFile(absolutePath)) {
|
|
11
|
-
return match;
|
|
12
|
-
}
|
|
13
|
-
if (resolveFile(path.join(absolutePath, "index"))) {
|
|
14
|
-
return `${prefix}${quote}${importStatementPath(importPath + "/index")}${quote}`;
|
|
15
|
-
}
|
|
16
|
-
const basename = path.basename(absolutePath);
|
|
17
|
-
if (resolveFile(path.join(absolutePath, basename))) {
|
|
18
|
-
return `${prefix}${quote}${importStatementPath(importPath + "/" + basename)}${quote}`;
|
|
19
|
-
}
|
|
20
|
-
return match;
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
applyDirectoryNamedImport
|
|
26
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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;CAiHzB,CAAA"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import {
|
|
4
|
-
getApiSideBabelConfigPath,
|
|
5
|
-
getApiSideBabelPluginsForVite,
|
|
6
|
-
transformWithBabel
|
|
7
|
-
} from "@cedarjs/babel-config";
|
|
8
|
-
import { getConfig, getPaths, projectSideIsEsm } from "@cedarjs/project-config";
|
|
9
|
-
import {
|
|
10
|
-
applyGqlormInject,
|
|
11
|
-
applyGraphqlOptionsExtract
|
|
12
|
-
} from "./api-graphql-transforms.js";
|
|
13
|
-
import { applyAutoImports } from "./auto-import.js";
|
|
14
|
-
import { applyDirectoryNamedImport } from "./directory-named-import.js";
|
|
15
|
-
import { applyOtelWrapping } from "./esbuild-plugin-cedar-otel-wrapping.js";
|
|
16
|
-
import { applyHandlerAlsWrapping } from "./esbuild-plugin-handler-als-wrapping.js";
|
|
17
|
-
import { applyEsmExtensions } from "./esm-extensions.js";
|
|
18
|
-
import { applyImportDir } from "./import-dir.js";
|
|
19
|
-
import { applySrcAlias } from "./src-alias.js";
|
|
20
|
-
import { applyTsconfigPaths } from "./tsconfig-paths.js";
|
|
21
|
-
const cedarApiGraphqlPlugin = {
|
|
22
|
-
name: "cedar-api-graphql",
|
|
23
|
-
setup(build) {
|
|
24
|
-
build.onLoad({ filter: /[/\\]graphql\.(ts|js)$/ }, async (args) => {
|
|
25
|
-
const cedarConfig = getConfig();
|
|
26
|
-
let fileContents = await fs.promises.readFile(args.path, "utf-8");
|
|
27
|
-
fileContents = applySrcAlias(
|
|
28
|
-
fileContents,
|
|
29
|
-
path.dirname(
|
|
30
|
-
path.relative(build.initialOptions.absWorkingDir + "/src", args.path)
|
|
31
|
-
)
|
|
32
|
-
);
|
|
33
|
-
fileContents = applyTsconfigPaths(
|
|
34
|
-
fileContents,
|
|
35
|
-
args.path,
|
|
36
|
-
getPaths().api.base
|
|
37
|
-
);
|
|
38
|
-
fileContents = applyDirectoryNamedImport(fileContents, args.path);
|
|
39
|
-
fileContents = applyGraphqlOptionsExtract(fileContents) ?? fileContents;
|
|
40
|
-
fileContents = applyGqlormInject(fileContents, args.path, ".js") ?? fileContents;
|
|
41
|
-
fileContents = applyAutoImports(fileContents);
|
|
42
|
-
fileContents = applyImportDir(fileContents, args.path)?.code ?? fileContents;
|
|
43
|
-
const apiBabelConfigPath = getApiSideBabelConfigPath();
|
|
44
|
-
let code = fileContents;
|
|
45
|
-
if (apiBabelConfigPath) {
|
|
46
|
-
const transformedCode = await transformWithBabel(
|
|
47
|
-
fileContents,
|
|
48
|
-
args.path,
|
|
49
|
-
getApiSideBabelPluginsForVite(),
|
|
50
|
-
"inline",
|
|
51
|
-
true
|
|
52
|
-
);
|
|
53
|
-
if (!transformedCode?.code) {
|
|
54
|
-
throw new Error(`Could not transform file: ${args.path}`);
|
|
55
|
-
}
|
|
56
|
-
code = transformedCode.code;
|
|
57
|
-
}
|
|
58
|
-
if (projectSideIsEsm("api")) {
|
|
59
|
-
code = applyEsmExtensions(code, args.path);
|
|
60
|
-
}
|
|
61
|
-
if (cedarConfig.experimental?.opentelemetry?.enabled && cedarConfig.experimental?.opentelemetry?.wrapApi) {
|
|
62
|
-
code = applyOtelWrapping(code, args.path, getPaths().api.src) ?? code;
|
|
63
|
-
}
|
|
64
|
-
code = applyHandlerAlsWrapping(code, {
|
|
65
|
-
projectIsEsm: projectSideIsEsm("api")
|
|
66
|
-
}) ?? code;
|
|
67
|
-
return {
|
|
68
|
-
contents: code,
|
|
69
|
-
// Babel output is always plain JS. Without Babel the contents are
|
|
70
|
-
// still TypeScript when the source file is graphql.ts, so pick the
|
|
71
|
-
// matching loader and let esbuild do the stripping. (The onLoad
|
|
72
|
-
// filter only matches .ts and .js files.)
|
|
73
|
-
loader: !apiBabelConfigPath && args.path.endsWith(".ts") ? "ts" : "js"
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
export {
|
|
79
|
-
cedarApiGraphqlPlugin
|
|
80
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standalone esbuild equivalent of the Vite cedarOtelWrappingPlugin. Applied
|
|
3
|
-
* inline in the esbuild API build and the standalone-Vite API build so neither
|
|
4
|
-
* path depends on a Babel OTel plugin.
|
|
5
|
-
*
|
|
6
|
-
* For each `export const fn = (async?) (...) => {...}` in an API file, this
|
|
7
|
-
* wraps it with an OpenTelemetry span.
|
|
8
|
-
*
|
|
9
|
-
* Keep this in sync with
|
|
10
|
-
* packages/vite/src/plugins/vite-plugin-cedar-otel-wrapping.ts.
|
|
11
|
-
*/
|
|
12
|
-
export declare function applyOtelWrapping(code: string, filename: string, apiSrc: string): string | null;
|
|
13
|
-
//# sourceMappingURL=esbuild-plugin-cedar-otel-wrapping.d.ts.map
|