vite-plugin-vercel 0.1.7 → 0.2.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/dist/index.cjs CHANGED
@@ -321,6 +321,15 @@ async function buildFn(resolvedConfig, entry, buildOptions) {
321
321
  options.stdin = entry.source;
322
322
  }
323
323
  }
324
+ if (entry.edge) {
325
+ options.conditions = [
326
+ "edge-light",
327
+ "browser",
328
+ "module",
329
+ "import",
330
+ "require"
331
+ ];
332
+ }
324
333
  await (0, import_esbuild.build)(options);
325
334
  await writeVcConfig(resolvedConfig, entry.destination, Boolean(entry.edge));
326
335
  }
@@ -478,25 +487,24 @@ async function getIsrConfig(resolvedConfig) {
478
487
  var import_path5 = __toESM(require("path"), 1);
479
488
  function vercelPlugin() {
480
489
  let resolvedConfig;
490
+ let vpsFound = false;
481
491
  return {
482
492
  apply: "build",
483
493
  name: "vite-plugin-vercel",
484
494
  enforce: "post",
485
495
  configResolved(config) {
486
496
  resolvedConfig = config;
487
- },
488
- async buildStart() {
489
- if (process.env.VERCEL_ENV === "production" && !process.env.ENABLE_VC_BUILD) {
490
- throw new Error(
491
- "Missing ENABLE_VC_BUILD=1 to your environment variables in your project settings"
492
- );
493
- }
497
+ vpsFound = resolvedConfig.plugins.some(
498
+ (p) => p.name.startsWith("vite-plugin-ssr:")
499
+ );
494
500
  },
495
501
  async writeBundle() {
496
502
  var _a;
497
503
  if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr)) {
498
504
  await cleanOutputDirectory(resolvedConfig);
499
- return;
505
+ if (vpsFound) {
506
+ return;
507
+ }
500
508
  }
501
509
  const overrides = await execPrerender(resolvedConfig);
502
510
  const userOverrides = await computeStaticHtmlOverrides(resolvedConfig);
@@ -550,5 +558,3 @@ async function getStaticHtmlFiles(src) {
550
558
  function allPlugins() {
551
559
  return [vercelPlugin()];
552
560
  }
553
- // Annotate the CommonJS export names for ESM import in node:
554
- 0 && (module.exports = {});
package/dist/index.js CHANGED
@@ -287,6 +287,15 @@ async function buildFn(resolvedConfig, entry, buildOptions) {
287
287
  options.stdin = entry.source;
288
288
  }
289
289
  }
290
+ if (entry.edge) {
291
+ options.conditions = [
292
+ "edge-light",
293
+ "browser",
294
+ "module",
295
+ "import",
296
+ "require"
297
+ ];
298
+ }
290
299
  await build(options);
291
300
  await writeVcConfig(resolvedConfig, entry.destination, Boolean(entry.edge));
292
301
  }
@@ -444,25 +453,24 @@ async function getIsrConfig(resolvedConfig) {
444
453
  import path5 from "path";
445
454
  function vercelPlugin() {
446
455
  let resolvedConfig;
456
+ let vpsFound = false;
447
457
  return {
448
458
  apply: "build",
449
459
  name: "vite-plugin-vercel",
450
460
  enforce: "post",
451
461
  configResolved(config) {
452
462
  resolvedConfig = config;
453
- },
454
- async buildStart() {
455
- if (process.env.VERCEL_ENV === "production" && !process.env.ENABLE_VC_BUILD) {
456
- throw new Error(
457
- "Missing ENABLE_VC_BUILD=1 to your environment variables in your project settings"
458
- );
459
- }
463
+ vpsFound = resolvedConfig.plugins.some(
464
+ (p) => p.name.startsWith("vite-plugin-ssr:")
465
+ );
460
466
  },
461
467
  async writeBundle() {
462
468
  var _a;
463
469
  if (!((_a = resolvedConfig.build) == null ? void 0 : _a.ssr)) {
464
470
  await cleanOutputDirectory(resolvedConfig);
465
- return;
471
+ if (vpsFound) {
472
+ return;
473
+ }
466
474
  }
467
475
  const overrides = await execPrerender(resolvedConfig);
468
476
  const userOverrides = await computeStaticHtmlOverrides(resolvedConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-vercel",
3
- "version": "0.1.7",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -24,19 +24,19 @@
24
24
  "vite": "^4.2.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@types/node": "^16.18.21",
28
- "@typescript-eslint/eslint-plugin": "^5.56.0",
29
- "@typescript-eslint/parser": "^5.56.0",
30
- "eslint": "^8.36.0",
27
+ "@types/node": "^16.18.37",
28
+ "@typescript-eslint/eslint-plugin": "^5.60.1",
29
+ "@typescript-eslint/parser": "^5.60.1",
30
+ "eslint": "^8.43.0",
31
31
  "tsup": "^6.7.0",
32
- "typescript": "^5.0.2",
33
- "vite": "^4.2.1"
32
+ "typescript": "^5.1.6",
33
+ "vite": "^4.3.9"
34
34
  },
35
35
  "dependencies": {
36
36
  "@brillout/libassert": "^0.5.8",
37
- "@vercel/routing-utils": "^2.1.11",
38
- "esbuild": "^0.17.14",
39
- "fast-glob": "^3.2.12",
37
+ "@vercel/routing-utils": "^2.2.1",
38
+ "esbuild": "^0.17.19",
39
+ "fast-glob": "^3.3.0",
40
40
  "zod": "^3.21.4"
41
41
  },
42
42
  "scripts": {