nf3 0.0.0 → 0.1.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/LICENSE +33 -0
- package/README.md +74 -0
- package/dist/index.d.mts +68 -0
- package/dist/index.mjs +5220 -0
- package/dist/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +430 -0
- package/dist/node_modules/@isaacs/fs-minipass/dist/commonjs/package.json +3 -0
- package/dist/node_modules/@isaacs/fs-minipass/package.json +72 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/build.js +51 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/clean.js +31 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/configure.js +52 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/info.js +37 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/install.js +234 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/main.js +125 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js +305 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/package.js +72 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/pre-binding.js +34 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/publish.js +80 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/rebuild.js +20 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/reinstall.js +19 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/reveal.js +32 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/testbinary.js +79 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/testpackage.js +52 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/unpublish.js +40 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/abi_crosswalk.json +3254 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js +93 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/handle_gyp_opts.js +102 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/log.js +9 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/napi.js +203 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html +26 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/package.json +9 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js +187 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js +341 -0
- package/dist/node_modules/@mapbox/node-pre-gyp/package.json +63 -0
- package/dist/node_modules/@rollup/pluginutils/dist/cjs/index.js +407 -0
- package/dist/node_modules/@rollup/pluginutils/package.json +99 -0
- package/dist/node_modules/@vercel/nft/out/analyze.js +1081 -0
- package/dist/node_modules/@vercel/nft/out/fs.js +106 -0
- package/dist/node_modules/@vercel/nft/out/index.js +25 -0
- package/dist/node_modules/@vercel/nft/out/node-file-trace.js +369 -0
- package/dist/node_modules/@vercel/nft/out/resolve-dependency.js +334 -0
- package/dist/node_modules/@vercel/nft/out/types.js +2 -0
- package/dist/node_modules/@vercel/nft/out/utils/ast-helpers.js +49 -0
- package/dist/node_modules/@vercel/nft/out/utils/binary-locators.js +88 -0
- package/dist/node_modules/@vercel/nft/out/utils/get-package-base.js +30 -0
- package/dist/node_modules/@vercel/nft/out/utils/interop-require.js +24 -0
- package/dist/node_modules/@vercel/nft/out/utils/node-version.js +10 -0
- package/dist/node_modules/@vercel/nft/out/utils/sharedlib-emit.js +33 -0
- package/dist/node_modules/@vercel/nft/out/utils/special-cases.js +339 -0
- package/dist/node_modules/@vercel/nft/out/utils/static-eval.js +579 -0
- package/dist/node_modules/@vercel/nft/out/utils/wrappers.js +659 -0
- package/dist/node_modules/@vercel/nft/package.json +149 -0
- package/dist/node_modules/abbrev/lib/index.js +53 -0
- package/dist/node_modules/abbrev/package.json +45 -0
- package/dist/node_modules/acorn/dist/acorn.js +6262 -0
- package/dist/node_modules/acorn/dist/acorn.mjs +6233 -0
- package/dist/node_modules/acorn/package.json +50 -0
- package/dist/node_modules/acorn-import-attributes/lib/index.js +286 -0
- package/dist/node_modules/acorn-import-attributes/package.json +49 -0
- package/dist/node_modules/agent-base/dist/helpers.js +66 -0
- package/dist/node_modules/agent-base/dist/index.js +178 -0
- package/dist/node_modules/agent-base/package.json +46 -0
- package/dist/node_modules/async-sema/lib/index.js +163 -0
- package/dist/node_modules/async-sema/package.json +53 -0
- package/dist/node_modules/balanced-match/index.js +62 -0
- package/dist/node_modules/balanced-match/package.json +48 -0
- package/dist/node_modules/bindings/bindings.js +221 -0
- package/dist/node_modules/bindings/package.json +28 -0
- package/dist/node_modules/brace-expansion/index.js +203 -0
- package/dist/node_modules/brace-expansion/package.json +49 -0
- package/dist/node_modules/chownr/dist/commonjs/index.js +93 -0
- package/dist/node_modules/chownr/dist/commonjs/package.json +3 -0
- package/dist/node_modules/chownr/package.json +69 -0
- package/dist/node_modules/consola/dist/basic.cjs +32 -0
- package/dist/node_modules/consola/dist/core.cjs +517 -0
- package/dist/node_modules/consola/dist/shared/consola.DCGIlDNP.cjs +75 -0
- package/dist/node_modules/consola/package.json +136 -0
- package/dist/node_modules/debug/package.json +64 -0
- package/dist/node_modules/debug/src/browser.js +272 -0
- package/dist/node_modules/debug/src/common.js +292 -0
- package/dist/node_modules/debug/src/index.js +10 -0
- package/dist/node_modules/debug/src/node.js +263 -0
- package/dist/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/dist/node_modules/detect-libc/lib/elf.js +39 -0
- package/dist/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/dist/node_modules/detect-libc/lib/process.js +24 -0
- package/dist/node_modules/detect-libc/package.json +44 -0
- package/dist/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
- package/dist/node_modules/estree-walker/package.json +37 -0
- package/dist/node_modules/file-uri-to-path/index.js +66 -0
- package/dist/node_modules/file-uri-to-path/package.json +32 -0
- package/dist/node_modules/glob/dist/commonjs/glob.js +247 -0
- package/dist/node_modules/glob/dist/commonjs/has-magic.js +27 -0
- package/dist/node_modules/glob/dist/commonjs/ignore.js +119 -0
- package/dist/node_modules/glob/dist/commonjs/index.js +68 -0
- package/dist/node_modules/glob/dist/commonjs/package.json +3 -0
- package/dist/node_modules/glob/dist/commonjs/pattern.js +219 -0
- package/dist/node_modules/glob/dist/commonjs/processor.js +301 -0
- package/dist/node_modules/glob/dist/commonjs/walker.js +387 -0
- package/dist/node_modules/glob/package.json +99 -0
- package/dist/node_modules/graceful-fs/clone.js +23 -0
- package/dist/node_modules/graceful-fs/graceful-fs.js +448 -0
- package/dist/node_modules/graceful-fs/legacy-streams.js +118 -0
- package/dist/node_modules/graceful-fs/package.json +53 -0
- package/dist/node_modules/graceful-fs/polyfills.js +355 -0
- package/dist/node_modules/has-flag/index.js +8 -0
- package/dist/node_modules/has-flag/package.json +46 -0
- package/dist/node_modules/https-proxy-agent/dist/index.js +180 -0
- package/dist/node_modules/https-proxy-agent/dist/parse-proxy-response.js +101 -0
- package/dist/node_modules/https-proxy-agent/package.json +50 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.js +1546 -0
- package/dist/node_modules/lru-cache/dist/commonjs/package.json +3 -0
- package/dist/node_modules/lru-cache/package.json +116 -0
- package/dist/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
- package/dist/node_modules/minimatch/dist/commonjs/ast.js +592 -0
- package/dist/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
- package/dist/node_modules/minimatch/dist/commonjs/escape.js +22 -0
- package/dist/node_modules/minimatch/dist/commonjs/index.js +1017 -0
- package/dist/node_modules/minimatch/dist/commonjs/package.json +3 -0
- package/dist/node_modules/minimatch/dist/commonjs/unescape.js +24 -0
- package/dist/node_modules/minimatch/package.json +82 -0
- package/dist/node_modules/minipass/dist/commonjs/index.js +1028 -0
- package/dist/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/dist/node_modules/minipass/package.json +82 -0
- package/dist/node_modules/minizlib/dist/commonjs/constants.js +123 -0
- package/dist/node_modules/minizlib/dist/commonjs/index.js +416 -0
- package/dist/node_modules/minizlib/dist/commonjs/package.json +3 -0
- package/dist/node_modules/minizlib/package.json +80 -0
- package/dist/node_modules/ms/index.js +162 -0
- package/dist/node_modules/ms/package.json +38 -0
- package/dist/node_modules/node-fetch/lib/index.js +1787 -0
- package/dist/node_modules/node-fetch/package.json +89 -0
- package/dist/node_modules/node-gyp-build/index.js +6 -0
- package/dist/node_modules/node-gyp-build/node-gyp-build.js +207 -0
- package/dist/node_modules/node-gyp-build/package.json +43 -0
- package/dist/node_modules/nopt/lib/debug.js +5 -0
- package/dist/node_modules/nopt/lib/nopt-lib.js +514 -0
- package/dist/node_modules/nopt/lib/nopt.js +34 -0
- package/dist/node_modules/nopt/lib/type-defs.js +91 -0
- package/dist/node_modules/nopt/package.json +52 -0
- package/dist/node_modules/path-scurry/dist/commonjs/index.js +2014 -0
- package/dist/node_modules/path-scurry/dist/commonjs/package.json +3 -0
- package/dist/node_modules/path-scurry/package.json +89 -0
- package/dist/node_modules/picomatch/index.js +17 -0
- package/dist/node_modules/picomatch/lib/constants.js +180 -0
- package/dist/node_modules/picomatch/lib/parse.js +1085 -0
- package/dist/node_modules/picomatch/lib/picomatch.js +341 -0
- package/dist/node_modules/picomatch/lib/scan.js +391 -0
- package/dist/node_modules/picomatch/lib/utils.js +72 -0
- package/dist/node_modules/picomatch/package.json +83 -0
- package/dist/node_modules/resolve-from/index.js +47 -0
- package/dist/node_modules/resolve-from/package.json +36 -0
- package/dist/node_modules/rollup/dist/es/package.json +1 -0
- package/dist/node_modules/rollup/dist/es/rollup.js +17 -0
- package/dist/node_modules/rollup/dist/es/shared/node-entry.js +23920 -0
- package/dist/node_modules/rollup/dist/es/shared/parseAst.js +2086 -0
- package/dist/node_modules/rollup/dist/es/shared/watch.js +9297 -0
- package/dist/node_modules/rollup/dist/native.js +129 -0
- package/dist/node_modules/rollup/package.json +273 -0
- package/dist/node_modules/semver/classes/comparator.js +143 -0
- package/dist/node_modules/semver/classes/range.js +556 -0
- package/dist/node_modules/semver/classes/semver.js +319 -0
- package/dist/node_modules/semver/functions/clean.js +8 -0
- package/dist/node_modules/semver/functions/cmp.js +54 -0
- package/dist/node_modules/semver/functions/coerce.js +62 -0
- package/dist/node_modules/semver/functions/compare-build.js +9 -0
- package/dist/node_modules/semver/functions/compare-loose.js +5 -0
- package/dist/node_modules/semver/functions/compare.js +7 -0
- package/dist/node_modules/semver/functions/diff.js +60 -0
- package/dist/node_modules/semver/functions/eq.js +5 -0
- package/dist/node_modules/semver/functions/gt.js +5 -0
- package/dist/node_modules/semver/functions/gte.js +5 -0
- package/dist/node_modules/semver/functions/inc.js +21 -0
- package/dist/node_modules/semver/functions/lt.js +5 -0
- package/dist/node_modules/semver/functions/lte.js +5 -0
- package/dist/node_modules/semver/functions/major.js +5 -0
- package/dist/node_modules/semver/functions/minor.js +5 -0
- package/dist/node_modules/semver/functions/neq.js +5 -0
- package/dist/node_modules/semver/functions/parse.js +18 -0
- package/dist/node_modules/semver/functions/patch.js +5 -0
- package/dist/node_modules/semver/functions/prerelease.js +8 -0
- package/dist/node_modules/semver/functions/rcompare.js +5 -0
- package/dist/node_modules/semver/functions/rsort.js +5 -0
- package/dist/node_modules/semver/functions/satisfies.js +12 -0
- package/dist/node_modules/semver/functions/sort.js +5 -0
- package/dist/node_modules/semver/functions/valid.js +8 -0
- package/dist/node_modules/semver/index.js +91 -0
- package/dist/node_modules/semver/internal/constants.js +37 -0
- package/dist/node_modules/semver/internal/debug.js +11 -0
- package/dist/node_modules/semver/internal/identifiers.js +25 -0
- package/dist/node_modules/semver/internal/lrucache.js +42 -0
- package/dist/node_modules/semver/internal/parse-options.js +17 -0
- package/dist/node_modules/semver/internal/re.js +223 -0
- package/dist/node_modules/semver/package.json +78 -0
- package/dist/node_modules/semver/preload.js +4 -0
- package/dist/node_modules/semver/ranges/gtr.js +6 -0
- package/dist/node_modules/semver/ranges/intersects.js +9 -0
- package/dist/node_modules/semver/ranges/ltr.js +6 -0
- package/dist/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/dist/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/dist/node_modules/semver/ranges/min-version.js +63 -0
- package/dist/node_modules/semver/ranges/outside.js +82 -0
- package/dist/node_modules/semver/ranges/simplify.js +49 -0
- package/dist/node_modules/semver/ranges/subset.js +249 -0
- package/dist/node_modules/semver/ranges/to-comparators.js +10 -0
- package/dist/node_modules/semver/ranges/valid.js +13 -0
- package/dist/node_modules/supports-color/index.js +135 -0
- package/dist/node_modules/supports-color/package.json +53 -0
- package/dist/node_modules/tar/dist/commonjs/create.js +83 -0
- package/dist/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/extract.js +78 -0
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/header.js +306 -0
- package/dist/node_modules/tar/dist/commonjs/index.js +54 -0
- package/dist/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
- package/dist/node_modules/tar/dist/commonjs/list.js +138 -0
- package/dist/node_modules/tar/dist/commonjs/make-command.js +61 -0
- package/dist/node_modules/tar/dist/commonjs/mkdir.js +188 -0
- package/dist/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-unicode.js +34 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
- package/dist/node_modules/tar/dist/commonjs/options.js +66 -0
- package/dist/node_modules/tar/dist/commonjs/pack.js +491 -0
- package/dist/node_modules/tar/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/dist/commonjs/parse.js +622 -0
- package/dist/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
- package/dist/node_modules/tar/dist/commonjs/pax.js +158 -0
- package/dist/node_modules/tar/dist/commonjs/read-entry.js +140 -0
- package/dist/node_modules/tar/dist/commonjs/replace.js +232 -0
- package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
- package/dist/node_modules/tar/dist/commonjs/types.js +50 -0
- package/dist/node_modules/tar/dist/commonjs/unpack.js +871 -0
- package/dist/node_modules/tar/dist/commonjs/update.js +33 -0
- package/dist/node_modules/tar/dist/commonjs/warn-method.js +31 -0
- package/dist/node_modules/tar/dist/commonjs/winchars.js +14 -0
- package/dist/node_modules/tar/dist/commonjs/write-entry.js +689 -0
- package/dist/node_modules/tar/package.json +326 -0
- package/dist/node_modules/tr46/index.js +193 -0
- package/dist/node_modules/tr46/lib/mappingTable.json +1 -0
- package/dist/node_modules/tr46/package.json +31 -0
- package/dist/node_modules/webidl-conversions/lib/index.js +189 -0
- package/dist/node_modules/webidl-conversions/package.json +23 -0
- package/dist/node_modules/whatwg-url/lib/URL-impl.js +200 -0
- package/dist/node_modules/whatwg-url/lib/URL.js +196 -0
- package/dist/node_modules/whatwg-url/lib/public-api.js +11 -0
- package/dist/node_modules/whatwg-url/lib/url-state-machine.js +1297 -0
- package/dist/node_modules/whatwg-url/lib/utils.js +20 -0
- package/dist/node_modules/whatwg-url/package.json +32 -0
- package/dist/node_modules/yallist/dist/commonjs/index.js +384 -0
- package/dist/node_modules/yallist/dist/commonjs/package.json +3 -0
- package/dist/node_modules/yallist/package.json +68 -0
- package/package.json +47 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Pooya Parsa <pooya@pi0.io>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Bundled with @vercel/nft (https://github.com/vercel/nft)
|
|
26
|
+
|
|
27
|
+
Copyright 2019 Vercel, Inc.
|
|
28
|
+
|
|
29
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
30
|
+
|
|
31
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
32
|
+
|
|
33
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# 📦 nf3
|
|
2
|
+
|
|
3
|
+
<!-- automd:badges color=yellow codecov packagephobia -->
|
|
4
|
+
|
|
5
|
+
[](https://npmjs.com/package/nf3)
|
|
6
|
+
[](https://npm.chart.dev/nf3)
|
|
7
|
+
[](https://packagephobia.com/result?p=nf3)
|
|
8
|
+
[](https://codecov.io/gh/unjs/nf3)
|
|
9
|
+
|
|
10
|
+
<!-- /automd -->
|
|
11
|
+
|
|
12
|
+
This plugin traces and copies only the `node_modules` that are actually required at runtime for your built output — powered by [@vercel/nft](https://github.com/vercel/nft).
|
|
13
|
+
|
|
14
|
+
Bundling external dependencies can sometimes fail or cause issues, especially when modules rely on relative paths, native bindings, or dynamic imports.
|
|
15
|
+
|
|
16
|
+
To solve this, the plugin analyzes your build output, traces its runtime dependencies, and copies a **tree-shaken**, **deduplicated**, and **runtime-only** subset of `node_modules` into `dist/node_modules`.
|
|
17
|
+
The result is a minimal, self-contained distribution directory that just works.
|
|
18
|
+
|
|
19
|
+
Originally extracted from [Nitro](https://nitro.build) and used for optimizing `nf3` package dist itself!
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Rollup/Rolldown plugin
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
import { rollupNodeFileTrace } from "nf3";
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
plugins: [
|
|
30
|
+
rollupNodeFileTrace({
|
|
31
|
+
// rootDir: process.cwd(),
|
|
32
|
+
// outDir: "dist",
|
|
33
|
+
// exportConditions: ["node", "import", "default"],
|
|
34
|
+
// traceAlias: {},
|
|
35
|
+
// chmod: true, // or 0o755
|
|
36
|
+
// noTrace: false,
|
|
37
|
+
// inline: [/^@my-scope\//],
|
|
38
|
+
// external: ["fsevents"],
|
|
39
|
+
// moduleDirectories: ["node_modules"],
|
|
40
|
+
// traceInclude: ["some-lib"],
|
|
41
|
+
// writePackageJson: true,
|
|
42
|
+
// traceOptions: { /* see https://github.com/vercel/nft#options */ }
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### API
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
import { traceNodeModules } from "nf3";
|
|
52
|
+
|
|
53
|
+
await traceNodeModules(["./index.mjs"], {
|
|
54
|
+
/* options */
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Development
|
|
59
|
+
|
|
60
|
+
<details>
|
|
61
|
+
|
|
62
|
+
<summary>local development</summary>
|
|
63
|
+
|
|
64
|
+
- Clone this repository
|
|
65
|
+
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
|
|
66
|
+
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
|
|
67
|
+
- Install dependencies using `pnpm install`
|
|
68
|
+
- Run interactive tests using `pnpm dev`
|
|
69
|
+
|
|
70
|
+
</details>
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
Published under the [MIT](https://github.com/unjs/nf3/blob/main/LICENSE) license.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { NodeFileTraceOptions } from "@vercel/nft";
|
|
2
|
+
import { Plugin } from "rollup";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
interface ExternalsTraceOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The root directory to use when resolving files. Defaults to `process.cwd()`.
|
|
8
|
+
*/
|
|
9
|
+
rootDir?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The output directory where traced files will be copied. Defaults to `dist`.
|
|
12
|
+
*/
|
|
13
|
+
outDir?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Options to pass to `@vercel/nft` for file tracing.
|
|
16
|
+
*
|
|
17
|
+
* @see https://github.com/vercel/nft#options
|
|
18
|
+
*/
|
|
19
|
+
traceOptions?: NodeFileTraceOptions;
|
|
20
|
+
/**
|
|
21
|
+
* Module resolution conditions to use when resolving packages.
|
|
22
|
+
*
|
|
23
|
+
* Defaults to `["node", "import", "default"]`
|
|
24
|
+
*/
|
|
25
|
+
exportConditions?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Alias for module paths when tracing files.
|
|
28
|
+
*/
|
|
29
|
+
traceAlias?: Record<string, string>;
|
|
30
|
+
/**
|
|
31
|
+
* Preserve file permissions when copying files. If set to `true`, original file permissions are preserved. If set to a number, that value is used as the permission mode (e.g., `0o755`).
|
|
32
|
+
*/
|
|
33
|
+
chmod?: boolean | number;
|
|
34
|
+
/**
|
|
35
|
+
* If `true`, writes a `package.json` file to the output directory (parent) with the traced files as dependencies.
|
|
36
|
+
*/
|
|
37
|
+
writePackageJson?: boolean;
|
|
38
|
+
}
|
|
39
|
+
interface ExternalsPluginOptions extends ExternalsTraceOptions {
|
|
40
|
+
/**
|
|
41
|
+
* If `true`, disables automatic tracing of `node_modules` dependencies and keeps them as absolute external paths.
|
|
42
|
+
*/
|
|
43
|
+
noTrace?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Patterns to always include (inline) instead of tracing them as externals.
|
|
46
|
+
*/
|
|
47
|
+
inline?: Array<string | RegExp | ((id: string, importer?: string) => Promise<boolean> | boolean)>;
|
|
48
|
+
/**
|
|
49
|
+
* Patterns to always exclude (trace) instead of inlining them as externals.
|
|
50
|
+
*/
|
|
51
|
+
external?: Array<string | RegExp | ((id: string, importer?: string) => Promise<boolean> | boolean)>;
|
|
52
|
+
/**
|
|
53
|
+
* `node_modules` directories to use when resolving packages. Defaults to `['node_modules']`.
|
|
54
|
+
*/
|
|
55
|
+
moduleDirectories?: string[];
|
|
56
|
+
/**
|
|
57
|
+
* Patterns to always include (trace) even if not resolved.
|
|
58
|
+
*/
|
|
59
|
+
traceInclude?: string[];
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/plugin.d.ts
|
|
63
|
+
declare function rollupNodeFileTrace(opts?: ExternalsPluginOptions): Plugin;
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/trace.d.ts
|
|
66
|
+
declare function traceNodeModules(input: string[], opts: ExternalsTraceOptions): Promise<void>;
|
|
67
|
+
//#endregion
|
|
68
|
+
export { type ExternalsPluginOptions, type ExternalsTraceOptions, rollupNodeFileTrace, traceNodeModules };
|