@cedarjs/vite 6.0.0-canary.2633 → 6.0.0-canary.2635
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/apiDevMiddleware.d.ts.map +1 -1
- package/dist/apiDevMiddleware.js +2 -1
- package/dist/cjs/apiDevMiddleware.js +2 -1
- package/dist/cjs/plugins/vite-plugin-cedar-graphql-options-extract.js +22 -7
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts +7 -3
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-cedar-graphql-options-extract.js +12 -7
- package/package.json +14 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiDevMiddleware.d.ts","sourceRoot":"","sources":["../src/apiDevMiddleware.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;AAgC7D,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA+GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"apiDevMiddleware.d.ts","sourceRoot":"","sources":["../src/apiDevMiddleware.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;AAgC7D,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA+GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CA8GlE;AA0BD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CA0EhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,KAIrB,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAoFnD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,UAAU,EAAE,aAAa,CAAA;IACzB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CACjD,CAAC,CAcD"}
|
package/dist/apiDevMiddleware.js
CHANGED
|
@@ -167,7 +167,8 @@ async function createApiViteServer() {
|
|
|
167
167
|
try {
|
|
168
168
|
let sourceCode = code;
|
|
169
169
|
if (normalizePath(id).endsWith("/graphql.ts") || normalizePath(id).endsWith("/graphql.js")) {
|
|
170
|
-
|
|
170
|
+
const extracted = applyGraphqlOptionsExtract(sourceCode);
|
|
171
|
+
sourceCode = extracted?.code ?? sourceCode;
|
|
171
172
|
sourceCode = applyGqlormInject(sourceCode, id) ?? sourceCode;
|
|
172
173
|
}
|
|
173
174
|
if (cedarConfig.experimental?.opentelemetry?.enabled && cedarConfig.experimental?.opentelemetry?.wrapApi) {
|
|
@@ -201,7 +201,8 @@ async function createApiViteServer() {
|
|
|
201
201
|
try {
|
|
202
202
|
let sourceCode = code;
|
|
203
203
|
if ((0, import_vite.normalizePath)(id).endsWith("/graphql.ts") || (0, import_vite.normalizePath)(id).endsWith("/graphql.js")) {
|
|
204
|
-
|
|
204
|
+
const extracted = (0, import_vite_plugin_cedar_graphql_options_extract.applyGraphqlOptionsExtract)(sourceCode);
|
|
205
|
+
sourceCode = extracted?.code ?? sourceCode;
|
|
205
206
|
sourceCode = (0, import_api_graphql_transforms.applyGqlormInject)(sourceCode, id) ?? sourceCode;
|
|
206
207
|
}
|
|
207
208
|
if (cedarConfig.experimental?.opentelemetry?.enabled && cedarConfig.experimental?.opentelemetry?.wrapApi) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var vite_plugin_cedar_graphql_options_extract_exports = {};
|
|
20
30
|
__export(vite_plugin_cedar_graphql_options_extract_exports, {
|
|
@@ -22,6 +32,7 @@ __export(vite_plugin_cedar_graphql_options_extract_exports, {
|
|
|
22
32
|
cedarGraphqlOptionsExtractPlugin: () => cedarGraphqlOptionsExtractPlugin
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(vite_plugin_cedar_graphql_options_extract_exports);
|
|
35
|
+
var import_magic_string = __toESM(require("magic-string"), 1);
|
|
25
36
|
var import_oxc_parser = require("oxc-parser");
|
|
26
37
|
function cedarGraphqlOptionsExtractPlugin() {
|
|
27
38
|
return {
|
|
@@ -33,12 +44,13 @@ function cedarGraphqlOptionsExtractPlugin() {
|
|
|
33
44
|
if (!code.includes("createGraphQLHandler")) {
|
|
34
45
|
return null;
|
|
35
46
|
}
|
|
36
|
-
const
|
|
37
|
-
if (!
|
|
47
|
+
const result = applyGraphqlOptionsExtract(code);
|
|
48
|
+
if (!result) {
|
|
38
49
|
return null;
|
|
39
50
|
}
|
|
40
51
|
return {
|
|
41
|
-
code:
|
|
52
|
+
code: result.code,
|
|
53
|
+
map: result.map
|
|
42
54
|
};
|
|
43
55
|
}
|
|
44
56
|
};
|
|
@@ -101,10 +113,13 @@ function applyGraphqlOptionsExtract(code) {
|
|
|
101
113
|
optionsEnd
|
|
102
114
|
)}
|
|
103
115
|
`;
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return
|
|
116
|
+
const s = new import_magic_string.default(code);
|
|
117
|
+
s.prependLeft(lineStart, optionsConst);
|
|
118
|
+
s.overwrite(optionsStart, optionsEnd, "__cedar_graphqlOptions");
|
|
119
|
+
return {
|
|
120
|
+
code: s.toString(),
|
|
121
|
+
map: s.generateMap({ hires: true })
|
|
122
|
+
};
|
|
108
123
|
}
|
|
109
124
|
// Annotate the CommonJS export names for ESM import in node:
|
|
110
125
|
0 && (module.exports = {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SourceMap } from 'magic-string';
|
|
1
2
|
import type { Plugin } from 'vite';
|
|
2
3
|
/**
|
|
3
4
|
* Vite plugin that extracts options passed to createGraphQLHandler into an
|
|
@@ -21,8 +22,8 @@ import type { Plugin } from 'vite';
|
|
|
21
22
|
export declare function cedarGraphqlOptionsExtractPlugin(): Plugin;
|
|
22
23
|
/**
|
|
23
24
|
* Extracts the options argument from createGraphQLHandler calls and stores
|
|
24
|
-
* them in an exported variable. Returns the transformed code
|
|
25
|
-
* transformation was needed.
|
|
25
|
+
* them in an exported variable. Returns the transformed code with a sourcemap,
|
|
26
|
+
* or null if no transformation was needed.
|
|
26
27
|
*
|
|
27
28
|
* Transforms:
|
|
28
29
|
* export const handler = createGraphQLHandler({ options })
|
|
@@ -34,5 +35,8 @@ export declare function cedarGraphqlOptionsExtractPlugin(): Plugin;
|
|
|
34
35
|
* logic can run inside the Vite plugin pipeline without depending on internal's
|
|
35
36
|
* build output.
|
|
36
37
|
*/
|
|
37
|
-
export declare function applyGraphqlOptionsExtract(code: string):
|
|
38
|
+
export declare function applyGraphqlOptionsExtract(code: string): {
|
|
39
|
+
code: string;
|
|
40
|
+
map: SourceMap;
|
|
41
|
+
} | null;
|
|
38
42
|
//# sourceMappingURL=vite-plugin-cedar-graphql-options-extract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-graphql-options-extract.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-graphql-options-extract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-graphql-options-extract.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-graphql-options-extract.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gCAAgC,IAAI,MAAM,CA2BzD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,SAAS,CAAA;CAAE,GAAG,IAAI,CAgGzC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import MagicString from "magic-string";
|
|
1
2
|
import { parseSync, Visitor } from "oxc-parser";
|
|
2
3
|
function cedarGraphqlOptionsExtractPlugin() {
|
|
3
4
|
return {
|
|
@@ -9,12 +10,13 @@ function cedarGraphqlOptionsExtractPlugin() {
|
|
|
9
10
|
if (!code.includes("createGraphQLHandler")) {
|
|
10
11
|
return null;
|
|
11
12
|
}
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
13
|
+
const result = applyGraphqlOptionsExtract(code);
|
|
14
|
+
if (!result) {
|
|
14
15
|
return null;
|
|
15
16
|
}
|
|
16
17
|
return {
|
|
17
|
-
code:
|
|
18
|
+
code: result.code,
|
|
19
|
+
map: result.map
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
22
|
};
|
|
@@ -77,10 +79,13 @@ function applyGraphqlOptionsExtract(code) {
|
|
|
77
79
|
optionsEnd
|
|
78
80
|
)}
|
|
79
81
|
`;
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
82
|
+
const s = new MagicString(code);
|
|
83
|
+
s.prependLeft(lineStart, optionsConst);
|
|
84
|
+
s.overwrite(optionsStart, optionsEnd, "__cedar_graphqlOptions");
|
|
85
|
+
return {
|
|
86
|
+
code: s.toString(),
|
|
87
|
+
map: s.generateMap({ hires: true })
|
|
88
|
+
};
|
|
84
89
|
}
|
|
85
90
|
export {
|
|
86
91
|
applyGraphqlOptionsExtract,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2635",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
"@babel/parser": "7.29.7",
|
|
64
64
|
"@babel/traverse": "7.29.7",
|
|
65
65
|
"@babel/types": "7.29.7",
|
|
66
|
-
"@cedarjs/api": "6.0.0-canary.
|
|
67
|
-
"@cedarjs/babel-config": "6.0.0-canary.
|
|
68
|
-
"@cedarjs/context": "6.0.0-canary.
|
|
69
|
-
"@cedarjs/cookie-jar": "6.0.0-canary.
|
|
70
|
-
"@cedarjs/graphql-server": "6.0.0-canary.
|
|
71
|
-
"@cedarjs/internal": "6.0.0-canary.
|
|
72
|
-
"@cedarjs/project-config": "6.0.0-canary.
|
|
73
|
-
"@cedarjs/server-store": "6.0.0-canary.
|
|
74
|
-
"@cedarjs/testing": "6.0.0-canary.
|
|
66
|
+
"@cedarjs/api": "6.0.0-canary.2635",
|
|
67
|
+
"@cedarjs/babel-config": "6.0.0-canary.2635",
|
|
68
|
+
"@cedarjs/context": "6.0.0-canary.2635",
|
|
69
|
+
"@cedarjs/cookie-jar": "6.0.0-canary.2635",
|
|
70
|
+
"@cedarjs/graphql-server": "6.0.0-canary.2635",
|
|
71
|
+
"@cedarjs/internal": "6.0.0-canary.2635",
|
|
72
|
+
"@cedarjs/project-config": "6.0.0-canary.2635",
|
|
73
|
+
"@cedarjs/server-store": "6.0.0-canary.2635",
|
|
74
|
+
"@cedarjs/testing": "6.0.0-canary.2635",
|
|
75
75
|
"@fastify/url-data": "6.0.3",
|
|
76
76
|
"@swc/core": "1.15.41",
|
|
77
77
|
"@universal-deploy/store": "^0.2.1",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"find-my-way": "8.2.2",
|
|
93
93
|
"http-proxy-middleware": "3.0.7",
|
|
94
94
|
"isbot": "5.1.43",
|
|
95
|
+
"magic-string": "0.30.21",
|
|
95
96
|
"oxc-parser": "0.137.0",
|
|
96
97
|
"react": "19.2.3",
|
|
97
98
|
"react-server-dom-webpack": "19.2.4",
|
|
@@ -106,9 +107,9 @@
|
|
|
106
107
|
},
|
|
107
108
|
"devDependencies": {
|
|
108
109
|
"@arethetypeswrong/cli": "0.18.5",
|
|
109
|
-
"@cedarjs/auth": "6.0.0-canary.
|
|
110
|
-
"@cedarjs/router": "6.0.0-canary.
|
|
111
|
-
"@cedarjs/web": "6.0.0-canary.
|
|
110
|
+
"@cedarjs/auth": "6.0.0-canary.2635",
|
|
111
|
+
"@cedarjs/router": "6.0.0-canary.2635",
|
|
112
|
+
"@cedarjs/web": "6.0.0-canary.2635",
|
|
112
113
|
"@hyrious/esbuild-plugin-commonjs": "0.2.6",
|
|
113
114
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
114
115
|
"@types/aws-lambda": "8.10.162",
|