nf3 0.3.15 → 0.3.16

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.
@@ -5,7 +5,6 @@ import * as fsp from "node:fs/promises";
5
5
  import { readFile, writeFile } from "node:fs/promises";
6
6
  import { nodeFileTrace } from "@vercel/nft";
7
7
  import semver from "semver";
8
- //#region \0rolldown/runtime.js
9
8
  var __defProp = Object.defineProperty;
10
9
  var __exportAll = (all, no_symbols) => {
11
10
  let target = {};
@@ -16,8 +15,6 @@ var __exportAll = (all, no_symbols) => {
16
15
  if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
17
16
  return target;
18
17
  };
19
- //#endregion
20
- //#region src/_utils.ts
21
18
  const isWindows = process.platform === "win32";
22
19
  const NODE_MODULES_RE = /^(?<dir>.+[\\/]node_modules[\\/])(?<name>[^@\\/]+|@[^\\/]+[\\/][^\\/]+)(?:[\\/](?<subpath>.+))?$/;
23
20
  function parseNodeModulePath(path) {
@@ -88,8 +85,6 @@ function toPathRegExp(input) {
88
85
  if (typeof input === "string") return new RegExp(pathRegExp(input));
89
86
  throw new TypeError("Expected a string or RegExp", { cause: input });
90
87
  }
91
- //#endregion
92
- //#region src/trace.ts
93
88
  var trace_exports = /* @__PURE__ */ __exportAll({
94
89
  DEFAULT_CONDITIONS: () => DEFAULT_CONDITIONS,
95
90
  applyProductionCondition: () => applyProductionCondition,
@@ -204,6 +199,24 @@ async function traceNodeModules(input, opts) {
204
199
  };
205
200
  }
206
201
  }
202
+ const nativeLoaderRE = /(?:^|\/)(node-gyp-build(?:-optional-packages)?|bindings|prebuild-install|node-pre-gyp)$/;
203
+ for (const tracedPackage of Object.values(tracedPackages)) for (const versionEntry of Object.values(tracedPackage.versions)) {
204
+ const deps = {
205
+ ...versionEntry.pkgJSON.dependencies,
206
+ ...versionEntry.pkgJSON.devDependencies
207
+ };
208
+ if (!Object.keys(deps).some((d) => nativeLoaderRE.test(d)) && !versionEntry.pkgJSON.gypfile) {
209
+ const install = versionEntry.pkgJSON.scripts?.install;
210
+ if (!install || !/node-gyp|pre-gyp|prebuild|napi/.test(install)) continue;
211
+ }
212
+ if (fsp.glob) for await (const file of fsp.glob("**/*.node", {
213
+ cwd: versionEntry.path,
214
+ exclude: (name) => name === "node_modules"
215
+ })) {
216
+ const fullPath = join(versionEntry.path, file);
217
+ if (!versionEntry.files.includes(fullPath) && await isFile(fullPath)) versionEntry.files.push(fullPath);
218
+ }
219
+ }
207
220
  await opts?.hooks?.tracedPackages?.(tracedPackages);
208
221
  const usedAliases = {};
209
222
  const outDir = resolve(rootDir, opts.outDir || "dist", "node_modules");
@@ -335,5 +348,4 @@ async function isFile(file) {
335
348
  throw error;
336
349
  }
337
350
  }
338
- //#endregion
339
351
  export { pathRegExp as a, guessSubpath as i, traceNodeModules as n, toImport as o, trace_exports as r, toPathRegExp as s, DEFAULT_CONDITIONS as t };
@@ -1,7 +1,5 @@
1
1
  import { t as PackageJson } from "./libs/pkg-types.mjs";
2
2
  import { NodeFileTraceOptions, NodeFileTraceResult } from "@vercel/nft";
3
-
4
- //#region src/types.d.ts
5
3
  interface ExternalsPluginOptions {
6
4
  /**
7
5
  * The root directory to use when resolving files. Defaults to `process.cwd()`.
@@ -115,5 +113,4 @@ interface TraceHooks {
115
113
  tracedFiles?: (files: Record<string, TracedFile>) => void | Promise<void>;
116
114
  tracedPackages?: (packages: Record<string, TracedPackage>) => void | Promise<void>;
117
115
  }
118
- //#endregion
119
116
  export { ExternalsTraceOptions as n, ExternalsPluginOptions as t };
package/dist/db.d.mts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/db.d.ts
2
1
  /**
3
2
  * Known packages that include native code and require platform-specific builds.
4
3
  *
@@ -18,5 +17,4 @@ declare const FullTracePackages: readonly ["usb", "sodium-native", "aws-crt", "y
18
17
  * due to bundler compatibility issues with their module format or dynamic imports.
19
18
  */
20
19
  declare const NonBundleablePackages: string[];
21
- //#endregion
22
20
  export { FullTracePackages, NodeNativePackages, NonBundleablePackages };
package/dist/db.mjs CHANGED
@@ -1,9 +1,3 @@
1
- //#region src/db.ts
2
- /**
3
- * Known packages that include native code and require platform-specific builds.
4
- *
5
- * These packages cannot be bundled and should be traced as external dependencies most of the time.
6
- */
7
1
  const NodeNativePackages = Object.freeze([
8
2
  "canvas",
9
3
  "sharp",
@@ -12,6 +6,7 @@ const NodeNativePackages = Object.freeze([
12
6
  "@napi-rs/canvas",
13
7
  "@napi-rs/image",
14
8
  "@takumi-rs/core",
9
+ "@resvg/resvg-js",
15
10
  "bcrypt",
16
11
  "kerberos",
17
12
  "scrypt",
@@ -20,38 +15,93 @@ const NodeNativePackages = Object.freeze([
20
15
  "argon2",
21
16
  "@node-rs/argon2",
22
17
  "@node-rs/bcrypt",
18
+ "@node-rs/jsonwebtoken",
23
19
  "cpu-features",
24
20
  "farmhash",
25
21
  "@node-rs/xxhash",
26
22
  "@node-rs/crc32",
23
+ "bigint-buffer",
24
+ "keytar",
27
25
  "better-sqlite3",
26
+ "better-sqlite3-multiple-ciphers",
27
+ "sqlite3",
28
28
  "leveldown",
29
+ "classic-level",
29
30
  "lmdb",
30
- "sqlite3",
31
31
  "libsql",
32
- "node-rdkafka",
33
- "couchbase",
34
32
  "duckdb",
33
+ "rocksdb",
34
+ "level-rocksdb",
35
+ "pg-native",
36
+ "oracledb",
37
+ "mongodb-client-encryption",
38
+ "odbc",
39
+ "ibm_db",
40
+ "hiredis",
41
+ "couchbase",
35
42
  "realm",
43
+ "node-rdkafka",
36
44
  "lz4",
45
+ "lz4-napi",
37
46
  "zlib-sync",
38
47
  "snappy",
39
48
  "@napi-rs/snappy",
40
- "lz4-napi",
41
- "msgpackr-extract",
49
+ "@napi-rs/lzma",
42
50
  "@mongodb-js/zstd",
43
- "deasync",
44
- "node-sass",
45
- "@parcel/watcher",
46
- "@parcel/source-map",
47
- "@swc/core",
51
+ "msgpackr-extract",
52
+ "cbor-extract",
53
+ "@napi-rs/tar",
48
54
  "esbuild",
55
+ "rolldown",
56
+ "vite",
57
+ "@rspack/core",
58
+ "@swc/core",
59
+ "@swc-node/register",
49
60
  "lightningcss",
61
+ "@parcel/css",
62
+ "@parcel/watcher",
63
+ "@parcel/source-map",
50
64
  "@biomejs/biome",
65
+ "oxfmt",
66
+ "oxlint",
67
+ "oxc-parser",
68
+ "oxc-transform",
69
+ "oxc-resolver",
70
+ "@ast-grep/napi",
71
+ "@napi-rs/cli",
72
+ "@node-rs/deno-lint",
73
+ "vize",
74
+ "node-sass",
51
75
  "tree-sitter",
52
76
  "re2",
77
+ "rollup",
78
+ "sass-embedded",
79
+ "@tailwindcss/oxide",
80
+ "turbo",
81
+ "deasync",
82
+ "@xenova/transformers",
83
+ "node-llama-cpp",
84
+ "llama-node",
53
85
  "onnxruntime-node",
54
- "edge-js",
86
+ "@tensorflow/tfjs-node",
87
+ "@sentry/profiling-node",
88
+ "@datadog/native-metrics",
89
+ "@datadog/native-appsec",
90
+ "@datadog/native-iast-taint-tracking",
91
+ "@datadog/pprof",
92
+ "@newrelic/native-metrics",
93
+ "@appsignal/nodejs",
94
+ "@statsig/statsig-node-core",
95
+ "v8-profiler-next",
96
+ "heapdump",
97
+ "grpc",
98
+ "zeromq",
99
+ "unix-dgram",
100
+ "ssh2",
101
+ "aws-crt",
102
+ "node-libcurl",
103
+ "bufferutil",
104
+ "utf-8-validate",
55
105
  "fsevents",
56
106
  "node-pty",
57
107
  "usb",
@@ -63,53 +113,34 @@ const NodeNativePackages = Object.freeze([
63
113
  "microtime",
64
114
  "node-datachannel",
65
115
  "zigpty",
116
+ "edge-js",
117
+ "nsfw",
118
+ "native-reg",
119
+ "diskusage",
120
+ "@napi-rs/clipboard",
121
+ "@napi-rs/nice",
122
+ "@napi-rs/webcodecs",
123
+ "workerd",
124
+ "node-web-audio-api",
66
125
  "ffi-napi",
67
126
  "ref-napi",
68
127
  "ref-struct-napi",
69
128
  "ref-union-napi",
70
- "grpc",
71
- "zeromq",
72
- "unix-dgram",
73
- "ssh2",
74
- "aws-crt",
129
+ "iconv",
75
130
  "libxmljs2",
76
131
  "node-expat",
77
- "@xenova/transformers",
78
- "bufferutil",
79
- "utf-8-validate",
80
- "keytar",
81
- "iconv",
82
- "nodegit",
83
- "@sentry/profiling-node",
84
- "@napi-rs/clipboard",
85
- "better-sqlite3-multiple-ciphers",
86
- "cbor-extract",
87
- "diskusage",
88
- "nsfw",
89
- "native-reg",
90
- "integer",
132
+ "@node-rs/jieba",
91
133
  "md4x/napi",
92
- "node-web-audio-api",
93
- "@appsignal/nodejs",
94
- "@statsig/statsig-node-core"
134
+ "@discordjs/opus",
135
+ "nodegit",
136
+ "integer"
95
137
  ]);
96
- /**
97
- * Packages that should be fully traced (all files copied, not just NFT-detected ones).
98
- *
99
- * These packages use dynamic requires, runtime asset loading, or other patterns
100
- * that prevent static analysis from detecting all required files.
101
- * Can be passed to the plugin's `traceInclude` option to ensure they are always traced.
102
- */
103
138
  const FullTracePackages = [
104
139
  "usb",
105
140
  "sodium-native",
106
141
  "aws-crt",
107
142
  "youch"
108
143
  ];
109
- /**
110
- * Packages that must be externalized (traced as dependencies) rather than bundled,
111
- * due to bundler compatibility issues with their module format or dynamic imports.
112
- */
113
144
  const NonBundleablePackages = [
114
145
  "youch",
115
146
  "pg-native",
@@ -131,5 +162,4 @@ const NonBundleablePackages = [
131
162
  "import-in-the-middle",
132
163
  "require-in-the-middle"
133
164
  ];
134
- //#endregion
135
165
  export { FullTracePackages, NodeNativePackages, NonBundleablePackages };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,4 @@
1
1
  import { NodeNativePackages } from "./db.mjs";
2
2
  import { n as ExternalsTraceOptions } from "./_chunks/types.mjs";
3
-
4
- //#region src/trace.d.ts
5
3
  declare function traceNodeModules(input: string[], opts: ExternalsTraceOptions): Promise<void>;
6
- //#endregion
7
4
  export { type ExternalsTraceOptions, NodeNativePackages, traceNodeModules };
package/dist/plugin.d.mts CHANGED
@@ -1,7 +1,4 @@
1
1
  import { t as ExternalsPluginOptions } from "./_chunks/types.mjs";
2
2
  import { Plugin } from "rollup";
3
-
4
- //#region src/plugin.d.ts
5
3
  declare function externals(opts: ExternalsPluginOptions): Plugin;
6
- //#endregion
7
4
  export { type ExternalsPluginOptions, externals };
package/dist/plugin.mjs CHANGED
@@ -3,7 +3,6 @@ import { n as isAbsolute, o as resolve } from "./_chunks/libs/pathe.mjs";
3
3
  import { t as resolveModulePath } from "./_chunks/libs/exsolve.mjs";
4
4
  import { builtinModules } from "node:module";
5
5
  import { pathToFileURL } from "node:url";
6
- //#region src/plugin.ts
7
6
  const PLUGIN_NAME = "nitro:externals";
8
7
  function externals(opts) {
9
8
  const rootDir = resolve(opts.rootDir || ".");
@@ -92,5 +91,4 @@ function externals(opts) {
92
91
  }
93
92
  };
94
93
  }
95
- //#endregion
96
94
  export { externals };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nf3",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "repository": "unjs/nf3",
@@ -36,7 +36,7 @@
36
36
  "changelogen": "^0.6.2",
37
37
  "eslint-config-unjs": "^0.6.2",
38
38
  "exsolve": "^1.0.8",
39
- "obuild": "^0.4.32",
39
+ "obuild": "^0.4.33",
40
40
  "oxc-minify": "^0.123.0",
41
41
  "oxfmt": "^0.43.0",
42
42
  "oxlint": "^1.58.0",