nitropack-nightly 2.11.0-20250206-204748.ac78f21d → 2.11.0-20250207-024216.b15e015c

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.
@@ -1,3 +1,3 @@
1
- const version = "2.11.0-20250206-204748.ac78f21d";
1
+ const version = "2.11.0-20250207-024216.b15e015c";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "2.11.0-20250206-204748.ac78f21d";
1
+ const version = "2.11.0-20250207-024216.b15e015c";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "2.11.0-20250206-204748.ac78f21d";
1
+ const version = "2.11.0-20250207-024216.b15e015c";
2
2
 
3
3
  export { version };
@@ -35,22 +35,33 @@ const resolvePresetRuntime = (m) => join(presetRuntimeDir, `${m}.mjs`);
35
35
  export const unenvCfPreset = {
36
36
  external: nodeCompatModules.map((m) => `node:${m}`),
37
37
  alias: {
38
- // <id> => node:<id>
39
- ...Object.fromEntries(nodeCompatModules.map((m) => [m, `node:${m}`])),
40
- ...Object.fromEntries(hybridNodeCompatModules.map((m) => [m, `node:${m}`])),
41
- // node:<id> => runtime/<id>.mjs (hybrid)
38
+ // (native)
42
39
  ...Object.fromEntries(
43
- hybridNodeCompatModules.map((m) => [
44
- `node:${m}`,
45
- resolvePresetRuntime(m === "sys" ? "util" : m)
40
+ nodeCompatModules.flatMap((m) => [
41
+ [m, `node:${m}`],
42
+ [`node:${m}`, `node:${m}`]
46
43
  ])
47
44
  ),
45
+ // (hybrid)
46
+ ...Object.fromEntries(
47
+ hybridNodeCompatModules.flatMap((m) => {
48
+ const resolved = resolvePresetRuntime(m);
49
+ return [
50
+ [`node:${m}`, resolved],
51
+ [m, resolved]
52
+ ];
53
+ })
54
+ ),
48
55
  sys: resolvePresetRuntime("util"),
49
56
  "node:sys": resolvePresetRuntime("util"),
50
57
  "node-mock-http/_polyfill/events": "node:events",
51
58
  "node-mock-http/_polyfill/buffer": "node:buffer"
52
59
  },
53
60
  inject: {
61
+ // process: "TODO",
62
+ // console: "TODO",
63
+ Buffer: ["node:buffer", "Buffer"],
64
+ "global.Buffer": ["node:buffer", "Buffer"],
54
65
  "globalThis.Buffer": ["node:buffer", "Buffer"]
55
66
  }
56
67
  };
@@ -12,7 +12,7 @@ import { hash } from 'ohash';
12
12
  import { resolve, dirname, extname, relative, normalize, isAbsolute, join } from 'pathe';
13
13
  import { visualizer } from 'rollup-plugin-visualizer';
14
14
  import { isWindows, isTest } from 'std-env';
15
- import * as unenv from 'unenv';
15
+ import { defineEnv } from 'unenv';
16
16
  import unimportPlugin from 'unimport/unplugin';
17
17
  import { rollup } from 'unwasm/plugin';
18
18
  import { genImport, genSafeVariableName } from 'knitwork';
@@ -1672,23 +1672,39 @@ const getRollupConfig = (nitro) => {
1672
1672
  ".tsx",
1673
1673
  ".jsx"
1674
1674
  ];
1675
- const nodePreset = nitro.options.node === false ? unenv.nodeless : unenv.node;
1676
- const builtinPreset = {
1677
- alias: {
1678
- // General
1679
- ...nitro.options.dev ? {} : {
1680
- debug: "unenv/npm/debug",
1681
- "consola/core": "consola/core",
1682
- consola: "unenv/npm/consola"
1683
- },
1684
- ...nitro.options.node === false ? {} : {
1685
- "node-mock-http/_polyfill/events": "node:events",
1686
- "node-mock-http/_polyfill/buffer": "node:buffer"
1687
- },
1688
- ...nitro.options.alias
1675
+ const isNodeless = nitro.options.node === false;
1676
+ const { env } = defineEnv({
1677
+ nodeCompat: isNodeless,
1678
+ resolve: true,
1679
+ presets: [
1680
+ isNodeless ? {
1681
+ // Backward compatibility (remove in v2)
1682
+ // https://github.com/unjs/unenv/pull/427
1683
+ inject: {
1684
+ performance: "unenv/polyfill/performance"
1685
+ },
1686
+ polyfill: [
1687
+ "unenv/polyfill/globalthis-global",
1688
+ "unenv/polyfill/process",
1689
+ "unenv/polyfill/performance"
1690
+ ]
1691
+ } : {},
1692
+ nitro.options.unenv
1693
+ ],
1694
+ overrides: {
1695
+ alias: {
1696
+ // General
1697
+ ...nitro.options.dev ? {} : {
1698
+ debug: "unenv/npm/debug"
1699
+ },
1700
+ ...isNodeless ? {} : {
1701
+ "node-mock-http/_polyfill/events": "node:events",
1702
+ "node-mock-http/_polyfill/buffer": "node:buffer"
1703
+ },
1704
+ ...nitro.options.alias
1705
+ }
1689
1706
  }
1690
- };
1691
- const env = unenv.env(nodePreset, builtinPreset, nitro.options.unenv);
1707
+ });
1692
1708
  const buildServerDir = join(nitro.options.buildDir, "dist/server");
1693
1709
  const presetsDir = resolve(runtimeDir, "../presets");
1694
1710
  const chunkNamePrefixes = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitropack-nightly",
3
- "version": "2.11.0-20250206-204748.ac78f21d",
3
+ "version": "2.11.0-20250207-024216.b15e015c",
4
4
  "description": "Build and Deploy Universal JavaScript Servers",
5
5
  "repository": "nitrojs/nitro",
6
6
  "license": "MIT",
@@ -163,7 +163,7 @@
163
163
  "ultrahtml": "^1.5.3",
164
164
  "uncrypto": "^0.1.3",
165
165
  "unctx": "^2.4.1",
166
- "unenv": "2.0.0-rc.2",
166
+ "unenv": "2.0.0-rc.3",
167
167
  "unimport": "^4.0.0",
168
168
  "unstorage": "^1.14.4",
169
169
  "untyped": "^1.5.2",