@cedarjs/vite 5.0.0-canary.2468 → 5.0.0-canary.2469
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.
|
@@ -174,10 +174,9 @@ function cedarUniversalDeployPlugin(options = {}) {
|
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
async function bundleDistFile(distPath) {
|
|
177
|
+
async function bundleDistFile(distPath, options = {}) {
|
|
178
178
|
const { build } = await import("esbuild");
|
|
179
|
-
const
|
|
180
|
-
entryPoints: [distPath],
|
|
179
|
+
const buildOptions = {
|
|
181
180
|
bundle: true,
|
|
182
181
|
write: false,
|
|
183
182
|
format: "esm",
|
|
@@ -200,7 +199,25 @@ async function bundleDistFile(distPath) {
|
|
|
200
199
|
}
|
|
201
200
|
],
|
|
202
201
|
logLevel: "silent"
|
|
203
|
-
}
|
|
202
|
+
};
|
|
203
|
+
if (options.include && options.include.length > 0) {
|
|
204
|
+
const resolveDir = import_node_path.default.dirname(distPath);
|
|
205
|
+
const relativeDistPath = "./" + import_node_path.default.basename(distPath);
|
|
206
|
+
const exportList = options.include.join(", ");
|
|
207
|
+
buildOptions.stdin = {
|
|
208
|
+
// Use stdin to define a synthetic entry point that exports only the
|
|
209
|
+
// requested named exports
|
|
210
|
+
contents: `export { ${exportList} } from ${JSON.stringify(relativeDistPath)}`,
|
|
211
|
+
resolveDir,
|
|
212
|
+
loader: "js"
|
|
213
|
+
};
|
|
214
|
+
} else {
|
|
215
|
+
buildOptions.entryPoints = [distPath];
|
|
216
|
+
}
|
|
217
|
+
const result = await build(buildOptions);
|
|
218
|
+
if (!result.outputFiles || result.outputFiles.length === 0) {
|
|
219
|
+
throw new Error("esbuild bundle produced no output files");
|
|
220
|
+
}
|
|
204
221
|
let text = result.outputFiles[0].text;
|
|
205
222
|
const exportBlock = text.match(/\nexport\s*\{([^}]*)\};\s*$/);
|
|
206
223
|
if (exportBlock) {
|
|
@@ -218,17 +235,15 @@ const __cedar_default = ${defaultBinding};`;
|
|
|
218
235
|
return text;
|
|
219
236
|
}
|
|
220
237
|
async function generateGraphQLModule(distPath) {
|
|
221
|
-
const bundledCode = await bundleDistFile(distPath
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
"\n"
|
|
225
|
-
);
|
|
238
|
+
const bundledCode = await bundleDistFile(distPath, {
|
|
239
|
+
include: ["__cedar_graphqlOptions"]
|
|
240
|
+
});
|
|
226
241
|
return `
|
|
227
242
|
import { buildCedarContext, requestToLegacyEvent } from '@cedarjs/api/runtime';
|
|
228
243
|
import { createGraphQLYoga } from '@cedarjs/graphql-server';
|
|
229
244
|
|
|
230
245
|
// Inlined bundle of ${import_node_path.default.basename(distPath)} (node_modules kept external)
|
|
231
|
-
${
|
|
246
|
+
${bundledCode}
|
|
232
247
|
|
|
233
248
|
let yogaInitPromise = null;
|
|
234
249
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin-cedar-universal-deploy.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-universal-deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vite-plugin-cedar-universal-deploy.d.ts","sourceRoot":"","sources":["../../src/plugins/vite-plugin-cedar-universal-deploy.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAMlC,MAAM,WAAW,iCAAiC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAuJD,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,iCAAsC,GAC9C,MAAM,CAuHR"}
|
|
@@ -141,10 +141,9 @@ function cedarUniversalDeployPlugin(options = {}) {
|
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
async function bundleDistFile(distPath) {
|
|
144
|
+
async function bundleDistFile(distPath, options = {}) {
|
|
145
145
|
const { build } = await import("esbuild");
|
|
146
|
-
const
|
|
147
|
-
entryPoints: [distPath],
|
|
146
|
+
const buildOptions = {
|
|
148
147
|
bundle: true,
|
|
149
148
|
write: false,
|
|
150
149
|
format: "esm",
|
|
@@ -167,7 +166,25 @@ async function bundleDistFile(distPath) {
|
|
|
167
166
|
}
|
|
168
167
|
],
|
|
169
168
|
logLevel: "silent"
|
|
170
|
-
}
|
|
169
|
+
};
|
|
170
|
+
if (options.include && options.include.length > 0) {
|
|
171
|
+
const resolveDir = path.dirname(distPath);
|
|
172
|
+
const relativeDistPath = "./" + path.basename(distPath);
|
|
173
|
+
const exportList = options.include.join(", ");
|
|
174
|
+
buildOptions.stdin = {
|
|
175
|
+
// Use stdin to define a synthetic entry point that exports only the
|
|
176
|
+
// requested named exports
|
|
177
|
+
contents: `export { ${exportList} } from ${JSON.stringify(relativeDistPath)}`,
|
|
178
|
+
resolveDir,
|
|
179
|
+
loader: "js"
|
|
180
|
+
};
|
|
181
|
+
} else {
|
|
182
|
+
buildOptions.entryPoints = [distPath];
|
|
183
|
+
}
|
|
184
|
+
const result = await build(buildOptions);
|
|
185
|
+
if (!result.outputFiles || result.outputFiles.length === 0) {
|
|
186
|
+
throw new Error("esbuild bundle produced no output files");
|
|
187
|
+
}
|
|
171
188
|
let text = result.outputFiles[0].text;
|
|
172
189
|
const exportBlock = text.match(/\nexport\s*\{([^}]*)\};\s*$/);
|
|
173
190
|
if (exportBlock) {
|
|
@@ -185,17 +202,15 @@ const __cedar_default = ${defaultBinding};`;
|
|
|
185
202
|
return text;
|
|
186
203
|
}
|
|
187
204
|
async function generateGraphQLModule(distPath) {
|
|
188
|
-
const bundledCode = await bundleDistFile(distPath
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"\n"
|
|
192
|
-
);
|
|
205
|
+
const bundledCode = await bundleDistFile(distPath, {
|
|
206
|
+
include: ["__cedar_graphqlOptions"]
|
|
207
|
+
});
|
|
193
208
|
return `
|
|
194
209
|
import { buildCedarContext, requestToLegacyEvent } from '@cedarjs/api/runtime';
|
|
195
210
|
import { createGraphQLYoga } from '@cedarjs/graphql-server';
|
|
196
211
|
|
|
197
212
|
// Inlined bundle of ${path.basename(distPath)} (node_modules kept external)
|
|
198
|
-
${
|
|
213
|
+
${bundledCode}
|
|
199
214
|
|
|
200
215
|
let yogaInitPromise = null;
|
|
201
216
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/vite",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2469",
|
|
4
4
|
"description": "Vite configuration package for CedarJS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -69,17 +69,17 @@
|
|
|
69
69
|
"@babel/generator": "7.29.1",
|
|
70
70
|
"@babel/parser": "7.29.3",
|
|
71
71
|
"@babel/traverse": "7.29.0",
|
|
72
|
-
"@cedarjs/api": "5.0.0-canary.
|
|
73
|
-
"@cedarjs/auth": "5.0.0-canary.
|
|
74
|
-
"@cedarjs/babel-config": "5.0.0-canary.
|
|
75
|
-
"@cedarjs/context": "5.0.0-canary.
|
|
76
|
-
"@cedarjs/cookie-jar": "5.0.0-canary.
|
|
77
|
-
"@cedarjs/graphql-server": "5.0.0-canary.
|
|
78
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
79
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
80
|
-
"@cedarjs/server-store": "5.0.0-canary.
|
|
81
|
-
"@cedarjs/testing": "5.0.0-canary.
|
|
82
|
-
"@cedarjs/web": "5.0.0-canary.
|
|
72
|
+
"@cedarjs/api": "5.0.0-canary.2469",
|
|
73
|
+
"@cedarjs/auth": "5.0.0-canary.2469",
|
|
74
|
+
"@cedarjs/babel-config": "5.0.0-canary.2469",
|
|
75
|
+
"@cedarjs/context": "5.0.0-canary.2469",
|
|
76
|
+
"@cedarjs/cookie-jar": "5.0.0-canary.2469",
|
|
77
|
+
"@cedarjs/graphql-server": "5.0.0-canary.2469",
|
|
78
|
+
"@cedarjs/internal": "5.0.0-canary.2469",
|
|
79
|
+
"@cedarjs/project-config": "5.0.0-canary.2469",
|
|
80
|
+
"@cedarjs/server-store": "5.0.0-canary.2469",
|
|
81
|
+
"@cedarjs/testing": "5.0.0-canary.2469",
|
|
82
|
+
"@cedarjs/web": "5.0.0-canary.2469",
|
|
83
83
|
"@fastify/url-data": "6.0.3",
|
|
84
84
|
"@swc/core": "1.15.33",
|
|
85
85
|
"@universal-deploy/store": "^0.2.1",
|