|
| 1 | +import type { Preset } from "unenv"; |
| 2 | + |
| 3 | +export const common: Preset = { |
| 4 | + alias: { |
| 5 | + "node-fetch": "unenv/npm/node-fetch", |
| 6 | + "cross-fetch": "unenv/npm/cross-fetch", |
| 7 | + "cross-fetch/polyfill": "unenv/mock/empty", |
| 8 | + "isomorphic-fetch": "unenv/mock/empty", |
| 9 | + debug: "unenv/npm/debug", |
| 10 | + // buffer (npm) |
| 11 | + buffer: "node:buffer", |
| 12 | + "buffer/": "node:buffer", |
| 13 | + "buffer/index": "node:buffer", |
| 14 | + "buffer/index.js": "node:buffer", |
| 15 | + }, |
| 16 | +}; |
| 17 | + |
| 18 | +export const node: Preset = { |
| 19 | + alias: { |
| 20 | + "node-mock-http/_polyfill/events": "node:events", |
| 21 | + "node-mock-http/_polyfill/buffer": "node:buffer", |
| 22 | + }, |
| 23 | +}; |
| 24 | + |
| 25 | +export const nodeless: Preset = { |
| 26 | + alias: { |
| 27 | + fsevents: "unenv/npm/fsevents", |
| 28 | + inherits: "unenv/npm/inherits", |
| 29 | + "whatwg-url": "unenv/npm/whatwg-url", |
| 30 | + }, |
| 31 | + inject: { |
| 32 | + performance: "unenv/polyfill/performance", |
| 33 | + global: "unenv/polyfill/globalthis", |
| 34 | + process: "unenv/node/process", |
| 35 | + Buffer: ["unenv/node/buffer", "Buffer"], |
| 36 | + }, |
| 37 | + polyfill: [ |
| 38 | + // Backward compatibility (remove in v2) |
| 39 | + // https://github.com/unjs/unenv/pull/427 |
| 40 | + "unenv/polyfill/globalthis-global", |
| 41 | + "unenv/polyfill/process", |
| 42 | + "unenv/polyfill/performance", |
| 43 | + ], |
| 44 | +}; |
0 commit comments