vite-plugin-vercel 5.0.3 → 5.0.5
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/index.cjs +12 -2
- package/dist/index.js +12 -2
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -294,7 +294,7 @@ var vercelEndpointExports = import_zod3.z.object({
|
|
|
294
294
|
var import_magicast = require("magicast");
|
|
295
295
|
var import_build_utils = require("@vercel/build-utils");
|
|
296
296
|
var import_nft = require("@vercel/nft");
|
|
297
|
-
var
|
|
297
|
+
var import_find_root = require("@manypkg/find-root");
|
|
298
298
|
function getAdditionalEndpoints(resolvedConfig) {
|
|
299
299
|
var _a;
|
|
300
300
|
return (((_a = resolvedConfig.vercel) == null ? void 0 : _a.additionalEndpoints) ?? []).map((e) => ({
|
|
@@ -423,7 +423,12 @@ const __dirname = VPV_dirname(__filename);
|
|
|
423
423
|
options.plugins.push(vercelOgPlugin(ctx));
|
|
424
424
|
const output = await (0, import_esbuild.build)(options);
|
|
425
425
|
if (typeof entry.source == "string") {
|
|
426
|
-
|
|
426
|
+
let base = resolvedConfig.root;
|
|
427
|
+
try {
|
|
428
|
+
const dir = await (0, import_find_root.findRoot)(resolvedConfig.root);
|
|
429
|
+
base = dir.rootDir;
|
|
430
|
+
} catch (e) {
|
|
431
|
+
}
|
|
427
432
|
const { fileList, reasons } = await (0, import_nft.nodeFileTrace)([entry.source], {
|
|
428
433
|
base,
|
|
429
434
|
processCwd: resolvedConfig.root,
|
|
@@ -532,6 +537,11 @@ async function extractExports(filepath) {
|
|
|
532
537
|
loader: filepath.endsWith(".ts") ? "ts" : filepath.endsWith(".tsx") ? "tsx" : filepath.endsWith(".js") ? "js" : filepath.endsWith(".jsx") ? "jsx" : "default",
|
|
533
538
|
resolveDir: (0, import_path3.dirname)(filepath)
|
|
534
539
|
};
|
|
540
|
+
buildOptions.banner = {
|
|
541
|
+
js: `const __filename = ${JSON.stringify(filepath)};
|
|
542
|
+
const __dirname = ${JSON.stringify((0, import_path3.dirname)(filepath))};
|
|
543
|
+
`
|
|
544
|
+
};
|
|
535
545
|
const output = await (0, import_esbuild.build)(buildOptions);
|
|
536
546
|
const bundle = new TextDecoder().decode((_a = output.outputFiles[0]) == null ? void 0 : _a.contents);
|
|
537
547
|
return vercelEndpointExports.parse((0, import_eval.default)(bundle, filepath, {}, true));
|
package/dist/index.js
CHANGED
|
@@ -264,7 +264,7 @@ var vercelEndpointExports = z3.object({
|
|
|
264
264
|
import { generateCode, loadFile } from "magicast";
|
|
265
265
|
import { getNodeVersion } from "@vercel/build-utils";
|
|
266
266
|
import { nodeFileTrace } from "@vercel/nft";
|
|
267
|
-
import {
|
|
267
|
+
import { findRoot } from "@manypkg/find-root";
|
|
268
268
|
function getAdditionalEndpoints(resolvedConfig) {
|
|
269
269
|
var _a;
|
|
270
270
|
return (((_a = resolvedConfig.vercel) == null ? void 0 : _a.additionalEndpoints) ?? []).map((e) => ({
|
|
@@ -393,7 +393,12 @@ const __dirname = VPV_dirname(__filename);
|
|
|
393
393
|
options.plugins.push(vercelOgPlugin(ctx));
|
|
394
394
|
const output = await build(options);
|
|
395
395
|
if (typeof entry.source == "string") {
|
|
396
|
-
|
|
396
|
+
let base = resolvedConfig.root;
|
|
397
|
+
try {
|
|
398
|
+
const dir = await findRoot(resolvedConfig.root);
|
|
399
|
+
base = dir.rootDir;
|
|
400
|
+
} catch (e) {
|
|
401
|
+
}
|
|
397
402
|
const { fileList, reasons } = await nodeFileTrace([entry.source], {
|
|
398
403
|
base,
|
|
399
404
|
processCwd: resolvedConfig.root,
|
|
@@ -502,6 +507,11 @@ async function extractExports(filepath) {
|
|
|
502
507
|
loader: filepath.endsWith(".ts") ? "ts" : filepath.endsWith(".tsx") ? "tsx" : filepath.endsWith(".js") ? "js" : filepath.endsWith(".jsx") ? "jsx" : "default",
|
|
503
508
|
resolveDir: dirname(filepath)
|
|
504
509
|
};
|
|
510
|
+
buildOptions.banner = {
|
|
511
|
+
js: `const __filename = ${JSON.stringify(filepath)};
|
|
512
|
+
const __dirname = ${JSON.stringify(dirname(filepath))};
|
|
513
|
+
`
|
|
514
|
+
};
|
|
505
515
|
const output = await build(buildOptions);
|
|
506
516
|
const bundle = new TextDecoder().decode((_a = output.outputFiles[0]) == null ? void 0 : _a.contents);
|
|
507
517
|
return vercelEndpointExports.parse(_eval(bundle, filepath, {}, true));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-vercel",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"vike": "*",
|
|
24
24
|
"vite": "^4.4 || ^5.0.2",
|
|
25
|
-
"@vite-plugin-vercel/vike": "5.0.
|
|
25
|
+
"@vite-plugin-vercel/vike": "5.0.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"@vite-plugin-vercel/vike": {
|
|
@@ -34,25 +34,25 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^16.18.76",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
38
|
-
"@typescript-eslint/parser": "^7.
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
38
|
+
"@typescript-eslint/parser": "^7.5.0",
|
|
39
39
|
"eslint": "^8.57.0",
|
|
40
40
|
"tsup": "^8.0.2",
|
|
41
|
-
"typescript": "^5.4.
|
|
42
|
-
"vike": "^0.4.
|
|
43
|
-
"vite": "^5.
|
|
44
|
-
"@vite-plugin-vercel/vike": "5.0.
|
|
41
|
+
"typescript": "^5.4.3",
|
|
42
|
+
"vike": "^0.4.168",
|
|
43
|
+
"vite": "^5.2.7",
|
|
44
|
+
"@vite-plugin-vercel/vike": "5.0.3"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@brillout/libassert": "^0.5.8",
|
|
48
|
-
"@
|
|
48
|
+
"@manypkg/find-root": "^2.2.1",
|
|
49
|
+
"@vercel/build-utils": "^7.10.0",
|
|
49
50
|
"@vercel/nft": "^0.26.4",
|
|
50
51
|
"@vercel/routing-utils": "^3.1.0",
|
|
51
52
|
"esbuild": "^0.20.2",
|
|
52
53
|
"eval": "^0.1.8",
|
|
53
54
|
"fast-glob": "^3.3.2",
|
|
54
55
|
"magicast": "^0.3.3",
|
|
55
|
-
"workspace-root": "^3.2.0",
|
|
56
56
|
"zod": "^3.22.4"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|