vite-plugin-vercel 2.0.0 → 2.0.1

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/README.md CHANGED
@@ -14,7 +14,7 @@ Bundle your Vite application as supported by [Vercel Output API (v3)](https://ve
14
14
  - [x] [ISR/Prerender functions](https://vercel.com/docs/build-output-api/v3/primitives#prerender-functions)
15
15
  - see [`isr` config](/packages/vercel/src/types.ts#L89). Also see implementation of [vike](/packages/vike-integration/vike.ts) for example
16
16
  - [x] [Edge functions](https://vercel.com/docs/build-output-api/v3/primitives#edge-functions)
17
- - [ ] [Edge middleware](https://vercel.com/docs/functions/edge-middleware/middleware-api)
17
+ - [x] [Edge middleware](https://vercel.com/docs/functions/edge-middleware/middleware-api)
18
18
  - [ ] [Images optimization](https://vercel.com/docs/build-output-api/v3/configuration#images)
19
19
  - [ ] [Preview mode](https://vercel.com/docs/build-output-api/v3/features#preview-mode)
20
20
  - [x] [Advanced config](/packages/vercel/src/types.ts#L19)
@@ -72,6 +72,10 @@ export default async function handler() {
72
72
  > [!NOTE]
73
73
  > Please create an issue if you need other per-endpoints configurations
74
74
 
75
+ ### Edge middleware
76
+
77
+ You can use [Edge middleware as describe in the official documentation](https://vercel.com/docs/functions/edge-middleware/middleware-api) (i.e. with a `middleware.ts` file at the root of your project).
78
+
75
79
  ## Usage with vike
76
80
 
77
81
  [vike](https://vike.dev/) is supported through [@vite-plugin-vercel/vike](/packages/vike-integration/README.md) plugin.
package/dist/index.cjs CHANGED
@@ -468,20 +468,20 @@ async function removeDefaultExport(filepath) {
468
468
  }
469
469
  async function extractExports(filepath) {
470
470
  var _a;
471
- const contents = await removeDefaultExport(filepath);
472
- const buildOptions = {
473
- ...standardBuildOptions,
474
- minify: false,
475
- write: false,
476
- legalComments: "none"
477
- };
478
- buildOptions.stdin = {
479
- sourcefile: filepath,
480
- contents,
481
- loader: filepath.endsWith(".ts") ? "ts" : filepath.endsWith(".tsx") ? "tsx" : filepath.endsWith(".js") ? "js" : filepath.endsWith(".jsx") ? "jsx" : "default",
482
- resolveDir: (0, import_path3.dirname)(filepath)
483
- };
484
471
  try {
472
+ const contents = await removeDefaultExport(filepath);
473
+ const buildOptions = {
474
+ ...standardBuildOptions,
475
+ minify: false,
476
+ write: false,
477
+ legalComments: "none"
478
+ };
479
+ buildOptions.stdin = {
480
+ sourcefile: filepath,
481
+ contents,
482
+ loader: filepath.endsWith(".ts") ? "ts" : filepath.endsWith(".tsx") ? "tsx" : filepath.endsWith(".js") ? "js" : filepath.endsWith(".jsx") ? "jsx" : "default",
483
+ resolveDir: (0, import_path3.dirname)(filepath)
484
+ };
485
485
  const output = await (0, import_esbuild.build)(buildOptions);
486
486
  const bundle = new TextDecoder().decode((_a = output.outputFiles[0]) == null ? void 0 : _a.contents);
487
487
  return vercelEndpointExports.parse((0, import_eval.default)(bundle, filepath, {}, true));
package/dist/index.js CHANGED
@@ -438,20 +438,20 @@ async function removeDefaultExport(filepath) {
438
438
  }
439
439
  async function extractExports(filepath) {
440
440
  var _a;
441
- const contents = await removeDefaultExport(filepath);
442
- const buildOptions = {
443
- ...standardBuildOptions,
444
- minify: false,
445
- write: false,
446
- legalComments: "none"
447
- };
448
- buildOptions.stdin = {
449
- sourcefile: filepath,
450
- contents,
451
- loader: filepath.endsWith(".ts") ? "ts" : filepath.endsWith(".tsx") ? "tsx" : filepath.endsWith(".js") ? "js" : filepath.endsWith(".jsx") ? "jsx" : "default",
452
- resolveDir: dirname(filepath)
453
- };
454
441
  try {
442
+ const contents = await removeDefaultExport(filepath);
443
+ const buildOptions = {
444
+ ...standardBuildOptions,
445
+ minify: false,
446
+ write: false,
447
+ legalComments: "none"
448
+ };
449
+ buildOptions.stdin = {
450
+ sourcefile: filepath,
451
+ contents,
452
+ loader: filepath.endsWith(".ts") ? "ts" : filepath.endsWith(".tsx") ? "tsx" : filepath.endsWith(".js") ? "js" : filepath.endsWith(".jsx") ? "jsx" : "default",
453
+ resolveDir: dirname(filepath)
454
+ };
455
455
  const output = await build(buildOptions);
456
456
  const bundle = new TextDecoder().decode((_a = output.outputFiles[0]) == null ? void 0 : _a.contents);
457
457
  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": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",