Package your Node.js project into an executable

Overview

Disclaimer: pkg was created for use within containers and is not intended for use in serverless environments. For those using Vercel, this means that there is no requirement to use pkg in your projects as the benefits it provides are not applicable to the platform.

Build Status Dependency Status devDependency Status

This command line interface enables you to package your Node.js project into an executable that can be run even on devices without Node.js installed.

Use Cases

  • Make a commercial version of your application without sources
  • Make a demo/evaluation/trial version of your app without sources
  • Instantly make executables for other platforms (cross-compilation)
  • Make some kind of self-extracting archive or installer
  • No need to install Node.js and npm to run the packaged application
  • No need to download hundreds of files via npm install to deploy your application. Deploy it as a single file
  • Put your assets inside the executable to make it even more portable
  • Test your app against new Node.js version without installing it

Usage

npm install -g pkg

After installing it, run pkg --help without arguments to see list of options.

The entrypoint of your project is a mandatory CLI argument. It may be:

  • Path to entry file. Suppose it is /path/app.js, then packaged app will work the same way as node /path/app.js
  • Path to package.json. Pkg will follow bin property of the specified package.json and use it as entry file.
  • Path to directory. Pkg will look for package.json in the specified directory. See above.

Targets

pkg can generate executables for several target machines at a time. You can specify a comma-separated list of targets via --targets option. A canonical target consists of 3 elements, separated by dashes, for example node12-macos-x64 or node14-linux-arm64:

  • nodeRange node${n} or latest
  • platform linux, win, macos, (freebsd, alpine)
  • arch x64, arm64, (armv6, armv7)

You may omit any element (and specify just node14 for example). The omitted elements will be taken from current platform or system-wide Node.js installation (its version and arch). There is also an alias host, that means that all 3 elements are taken from current platform/Node.js. By default targets are linux,macos,win for current Node.js version and arch.

Config

During packaging process pkg parses your sources, detects calls to require, traverses the dependencies of your project and includes them into executable. In most cases you don't need to specify anything manually.

However your code may have require(variable) calls (so called non-literal argument to require) or use non-javascript files (for example views, css, images etc).

require('./build/' + cmd + '.js');
path.join(__dirname, 'views/' + viewName);

Such cases are not handled by pkg. So you must specify the files - scripts and assets - manually in pkg property of your package.json file.

  "pkg": {
    "scripts": "build/**/*.js",
    "assets": "views/**/*",
    "targets": [ "node14-linux-arm64" ],
    "outputPath": "dist"
  }

The above example will include everything in assets/ and every .js file in build/, build only for node14-linux-arm64, and place the executable inside dist/.

You may also specify arrays of globs:

    "assets": [ "assets/**/*", "images/**/*" ]

Just be sure to call pkg package.json or pkg . to make use of package.json configuration.

Scripts

scripts is a glob or list of globs. Files specified as scripts will be compiled using v8::ScriptCompiler and placed into executable without sources. They must conform to the JS standards of those Node.js versions you target (see Targets), i.e. be already transpiled.

Assets

assets is a glob or list of globs. Files specified as assets will be packaged into executable as raw content without modifications. Javascript files may also be specified as assets. Their sources will not be stripped as it improves execution performance of the files and simplifies debugging.

See also Detecting assets in source code and Snapshot filesystem.

Options

Node.js application can be called with runtime options (belonging to Node.js or V8). To list them type node --help or node --v8-options.

You can "bake" these runtime options into packaged application. The app will always run with the options turned on. Just remove -- from option name.

You can specify multiple options by joining them in a single string, comma (,) separated:

pkg app.js --options expose-gc
pkg app.js --options max_old_space_size=4096
pkg app.js --options max-old-space-size=1024,tls-min-v1.0,expose-gc

Output

You may specify --output if you create only one executable or --out-path to place executables for multiple targets.

Debug

Pass --debug to pkg to get a log of packaging process. If you have issues with some particular file (seems not packaged into executable), it may be useful to look through the log.

Bytecode (reproducibility)

By default, your source code is precompiled to v8 bytecode before being written to the output file. To disable this feature, pass --no-bytecode to pkg.

Why would you want to do this?

If you need a reproducible build process where your executable hashes (e.g. md5, sha1, sha256, etc.) are the same value between builds. Because compiling bytecode is not deterministic (see here or here) it results in executables with differing hashed values. Disabling bytecode compilation allows a given input to always have the same output.

Why would you NOT want to do this?

While compiling to bytecode does not make your source code 100% secure, it does add a small layer of security/privacy/obscurity to your source code. Turning off bytecode compilation causes the raw source code to be written directly to the executable file. If you're on *nix machine and would like an example, run pkg with the --no-bytecode flag, and use the GNU strings tool on the output. You then should be able to grep your source code.

Other considerations

Specifying --no-bytecode will fail if there are any packages in your project that aren't explicitly marked as public by the license in their package.json. By default, pkg will check the license of each package and make sure that stuff that isn't meant for the public will only be included as bytecode.

If you do require building pkg binaries for other architectures and/or depend on a package with a broken license in its package.json, you can override this behaviour by either explicitly whitelisting packages to be public using --public-packages "packageA,packageB" or setting all packages to public using --public-packages "*"

Build

pkg has so called "base binaries" - they are actually same node executables but with some patches applied. They are used as a base for every executable pkg creates. pkg downloads precompiled base binaries before packaging your application. If you prefer to compile base binaries from source instead of downloading them, you may pass --build option to pkg. First ensure your computer meets the requirements to compile original Node.js: BUILDING.md

Environment

Var Description
PKG_CACHE_PATH Used to specify a custom path for node binaries cache folder. Default is ~/.pkg-cache
PKG_IGNORE_TAG Allows to ignore additional folder created on PKG_CACHE_PATH matching pkg-fetch version
MAKE_JOB_COUNT Allow configuring number of processes used for compiling

Examples

# 1 - Using export
export PKG_CACHE_PATH=/my/cache
pkg app.js

# 2 - Passing it before the script
PKG_CACHE_PATH=/my/cache pkg app.js

Usage of packaged app

Command line call to packaged app ./app a b is equivalent to node app.js a b

Snapshot filesystem

During packaging process pkg collects project files and places them into executable. It is called a snapshot. At run time the packaged application has access to snapshot filesystem where all that files reside.

Packaged files have /snapshot/ prefix in their paths (or C:\snapshot\ in Windows). If you used pkg /path/app.js command line, then __filename value will be likely /snapshot/path/app.js at run time. __dirname will be /snapshot/path as well. Here is the comparison table of path-related values:

value with node packaged comments
__filename /project/app.js /snapshot/project/app.js
__dirname /project /snapshot/project
process.cwd() /project /deploy suppose the app is called ...
process.execPath /usr/bin/nodejs /deploy/app-x64 app-x64 and run in /deploy
process.argv[0] /usr/bin/nodejs /deploy/app-x64
process.argv[1] /project/app.js /snapshot/project/app.js
process.pkg.entrypoint undefined /snapshot/project/app.js
process.pkg.defaultEntrypoint undefined /snapshot/project/app.js
require.main.filename /project/app.js /snapshot/project/app.js

Hence, in order to make use of a file collected at packaging time (require a javascript file or serve an asset) you should take __filename, __dirname, process.pkg.defaultEntrypoint or require.main.filename as a base for your path calculations. For javascript files you can just require or require.resolve because they use current __dirname by default. For assets use path.join(__dirname, '../path/to/asset'). Learn more about path.join in Detecting assets in source code.

On the other hand, in order to access real file system at run time (pick up a user's external javascript plugin, json configuration or even get a list of user's directory) you should take process.cwd() or path.dirname(process.execPath).

Detecting assets in source code

When pkg encounters path.join(__dirname, '../path/to/asset'), it automatically packages the file specified as an asset. See Assets. Pay attention that path.join must have two arguments and the last one must be a string literal.

This way you may even avoid creating pkg config for your project.

Native addons

Native addons (.node files) use is supported. When pkg encounters a .node file in a require call, it will package this like an asset. In some cases (like with the bindings package), the module path is generated dynamicaly and pkg won't be able to detect it. In this case, you should add the .node file directly in the assets field in package.json.

The way Node.js requires native addon is different from a classic JS file. It needs to have a file on disk to load it, but pkg only generates one file. To circumvent this, pkg will create a temporary file on the disk. These files will stay on the disk after the process has exited and will be used again on the next process launch.

When a package, that contains a native module, is being installed, the native module is compiled against current system-wide Node.js version. Then, when you compile your project with pkg, pay attention to --target option. You should specify the same Node.js version as your system-wide Node.js to make compiled executable compatible with .node files.

API

const { exec } = require('pkg')

exec(args) takes an array of command line arguments and returns a promise. For example:

await exec(['app.js', '--target', 'host', '--output', 'app.exe']);
// do something with app.exe, run, test, upload, deploy, etc

Troubleshooting

Error: ENOENT: no such file or directory, uv_chdir

This error can be caused by deleting the directory the application is run from. Or, generally, deleting process.cwd() directory when the application is running.

Error: ERR_INSPECTOR_NOT_AVAILABLE

This error can be caused by using NODE_OPTIONS variable to force to run node with the debug mode enabled. Debugging options are disallowed , as pkg executables are usually used for production environments. If you do need to use inspector, you can build a debuggable Node.js yourself.

Error: require(...).internalModuleStat is not a function

This error can be caused by using NODE_OPTIONS variable with some bootstrap or node options causing conflicts with pkg. Some IDEs, such as VS Code, may add this env variable automatically.

You could check on Unix systems (Linux/macOS) in bash:

$ printenv | grep NODE

Advanced

exploring virtual file system embedded in debug mode

When you are using the --debug flag when building your executable, pkg add the ability to display the content of the virtual file system and the symlink table on the console, when the application starts, providing that the environement variable DEBUG_PKG is set. This feature can be useful to inspect if symlinks are correctly handled, and check that all the required files for your application are properly incorporated to the final executable.

$ pkg --debug app.js -o output
$ DEBUG_PKG output

or

C:\> pkg --debug app.js -o output.exe
C:\> set DEBUG_PKG=1
C:\> output.exe

Note: make sure not to use --debug flag in production.

Comments
  • Puppeteer support?

    Puppeteer support?

    I've been able to package an application that requires Puppeteer. However the package application is unable to spawn the Chromium instance process from the bundled Chromium binary:

    events.js:182
          throw er; // Unhandled 'error' event
          ^
    
    Error: spawn /snapshot/decktape/node_modules/puppeteer/.local-chromium/mac-494755/chrome-mac/Chromium.app/Contents/MacOS/Chromium ENOENT
        at exports._errnoException (util.js:1026:11)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:189:19)
        at onErrorNT (internal/child_process.js:366:16)
        at _combinedTickCallback (internal/process/next_tick.js:102:11)
        at process._tickCallback (internal/process/next_tick.js:161:9)
        at Function.Module.runMain (pkg/prelude/bootstrap.js:1282:13)
        at startup (bootstrap_node.js:200:16)
        at bootstrap_node.js:617:3
    

    Pointing to an external Chromium binary works.

    So it seems something similar to #147 is required.

    Stale 
    opened by astefanutti 93
  • Random call stack size exceeded in binaries complied with node v12.2.0

    Random call stack size exceeded in binaries complied with node v12.2.0

    Thanks for updating pkg to support node v12!

    It seems that there is a weird bug causing random Maximum call stack size exceeded errors ONLY in binaries complied by pkg targeting node v12.2.0:

    | | Binary compiled by pkg | Run directly through node | | --- | --- | --- | | node v10.15.3 | ✅ | ✅ | | node v12.2.0 |Maximum call stack size exceeded | ✅ |

    (Tested on Linux / CentOS 7)

    Unfortunately, the original code is part of a proprietary software so I could not post it here. But since it does not deal with files, I'm pretty sure the issue is not related to the snapshot file system.

    Here are some stack trace samples, seems fully random, the only thing in common is the RangeError: Maximum call stack size exceeded:

    06:25:30 [22016]: events.js:196
    06:25:30 [22016]: Reflect.apply(handler, this, args);
    06:25:30 [22016]: ^
    06:25:30 [22016]: RangeError: Maximum call stack size exceeded
    06:25:30 [22016]: at Object.emit (events.js:196:13)
    06:25:30 [22016]: at endReadableNT (_stream_readable.js:1130:12)
    06:25:30 [22016]: at processTicksAndRejections (internal/process/task_queues.js:84:9)
    
    06:07:11 [11185]: _stream_transform.js:140
    06:07:11 [11185]: this._flush((er, data) => {
    06:07:11 [11185]: ^
    06:07:11 [11185]: RangeError: Maximum call stack size exceeded
    06:07:11 [11185]: at String.replace (<anonymous>)
    06:07:11 [11185]: at Object.prefinish (_stream_transform.js:140:10)
    06:07:11 [11185]: at Object.emit (events.js:196:13)
    
    06:18:41 [18060]: internal/timers.js:531
    06:18:41 [18060]: timer._onTimeout();
    06:18:41 [18060]: ^
    06:18:41 [18060]: RangeError: Maximum call stack size exceeded
    06:18:41 [18060]: at listOnTimeout (internal/timers.js:531:17)
    06:18:41 [18060]: at processTimers (internal/timers.js:475:7)
    
    opened by peakji 72
  • Bundling sharp doesn't work anymore since updating to 4.5.0

    Bundling sharp doesn't work anymore since updating to 4.5.0

    Since updating to version 4.5.0 it is not possible to bundle sharp anymore. Previously this was fairly simple, by just copying the node_modules/sharp folder next to the build output. But this doesn't work anymore giving the following error:

    Error:
    Something went wrong installing the "sharp" module
    
    File '/**/test/node_modules/sharp/build/Release/libvips-cpp.so.42' was not included into executable at compilation stage. Please recompile adding it as asset or script.
    
    - Remove the "node_modules/sharp" directory then run
      "npm install --ignore-scripts=false --verbose" and look for errors
    - Consult the installation documentation at https://sharp.pixelplumbing.com/install
    - Search for this error at https://github.com/lovell/sharp/issues
    
        at Object.<anonymous> (/snapshot/test/node_modules/sharp/lib/constructor.js:34:9)
        at Module._compile (pkg/prelude/bootstrap.js:1329:22)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1218:10)
        at Module.load (internal/modules/cjs/loader.js:1047:32)
        at Function.Module._load (internal/modules/cjs/loader.js:935:14)
        at Module.require (internal/modules/cjs/loader.js:1087:19)
        at Module.require (pkg/prelude/bootstrap.js:1234:31)
        at require (internal/modules/cjs/helpers.js:73:18)
        at Object.<anonymous> (/snapshot/test/node_modules/sharp/lib/index.js:3:15)
        at Module._compile (pkg/prelude/bootstrap.js:1329:22)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1218:10)
        at Module.load (internal/modules/cjs/loader.js:1047:32)
        at Function.Module._load (internal/modules/cjs/loader.js:935:14)
        at Module.require (internal/modules/cjs/loader.js:1087:19)
        at Module.require (pkg/prelude/bootstrap.js:1234:31)
        at require (internal/modules/cjs/helpers.js:73:18)
    

    I'm fairly convinced this has to do with #837 or #1066 or maybe a combination of both.

    Looking at the below error message running in CI, it seems that prebuild-install is not correctly installed or referenced, this has been added in #1066:

    > [email protected]
    > Fetching base Node.js binaries to PKG_CACHE_PATH
    > Warning Cannot include directory %1 into executable.
      The directory must be distributed with executable as %2.
      %1: node_modules/sharp/build/Release
      %2: path-to-executable/sharp/build/Release
    > Warning Cannot include directory %1 into executable.
      The directory must be distributed with executable as %2.
      %1: node_modules/sharp/vendor/lib
      %2: path-to-executable/sharp/vendor/lib
    > Warning Cannot include directory %1 into executable.
      The directory must be distributed with executable as %2.
      %1: node_modules/sharp/build/Release
      %2: path-to-executable/sharp/build/Release
    > Warning Cannot include directory %1 into executable.
      The directory must be distributed with executable as %2.
      %1: node_modules/sharp/vendor/lib
      %2: path-to-executable/sharp/vendor/lib
    /bin/sh: 1: /builds/test/node_modules/pkg/node_modules/.bin/prebuild-install: not found
    /bin/sh: 1: /builds/test/node_modules/pkg/node_modules/.bin/prebuild-install: not found
    

    I'm mentioning both @david-mohr as well as @geekuillaume hoping they have a suggestion on how to fix this.

    On a sidenote; this seems to me a breaking change so 5.0.0 would have been a more logical version for this release I suppose.

    opened by pkeuter 67
  • main executable failed strict validation when signing binary on macOS

    main executable failed strict validation when signing binary on macOS

    I'm getting an error when code-signing a binary produced by pkg on macOS:

    main executable failed strict validation

    I couldn't find much information about this on the web, but some causes can be (from https://developer.apple.com/library/content/technotes/tn2206/_index.html#//apple_ref/doc/uid/DTS40007919-CH1-TNTAG309):

    • Your Mach-O executable does not conform to modern Mach-O layout rules
    • You may be using a third party development product that hasn't been brought up to date, or post-processed your file in unsupported ways

    Do you know thay may be causing this? codesign succeeds with other binaries.

    Steps to reproduce:

    git clone https://github.com/resin-io/etcher
    cd etcher
    make cli-develop
    pkg --output etcher -t node6-macos-x64 lib/cli/etcher.js
    codesign --sign "<identity>" -fv etcher
    
    bug payload patch 
    opened by jviotti 63
  • Add support for Node native addons

    Add support for Node native addons

    This adds the supports for Nodejs native addons.

    How it works:

    • When detecting a .node file, it will package it like an asset and not output any warning.
    • On run-time, when requireing a .node file, it will use the same code as classic files to detect if the file is in the snapshot or not. If it is, it will write it to a file in the os.tmpdir() directory.
    • The filename of the temporary file will be passed to the rest of the chain.

    Potential future optimizations:

    • Write a patch for the bindings module to detect the correct modules.
    • Delete the temporary files on process exit

    Related #329 #619 #749 #663

    opened by geekuillaume 58
  • cross platform native modules didn't work for me

    cross platform native modules didn't work for me

    re: https://github.com/vercel/pkg/pull/837 - is cross-platform native module packing supposed to work, or not? Prebuild-install is supposed to do this right: https://github.com/vercel/pkg/blob/main/lib/producer.ts#L200

    pkg 5.3.2 souce os: macos 10.15.7 target: win how am I configuring pkg? Just with cmd parameters in my package.json: pkg src/my.js -t win --out-path /Volumes/[C]/bin/myname (I tried specifying the target with node version and architecture, made no difference)

    What happened?

    pkg packaged up the macos version of iconv's module: iconv.node into the windows package. When I ran the exe, Windows errored this wasn't a win32 application

    What did I expect to happen?

    From the readme or --help I wasn't sure: Either to bundle the correct file, or If the target os's native module isn't available, some automatic way to fall back to the old behaviour of expecting the right .node file to be available after compile in the location of the binary, failing that, a config setting that will give me the old behaviour or allow me to bundle the correct .node file manually (does specifying an asset override native module compilation, or not?). Currently I don't get how to achieve any of those (since i've been best with the post-compile same-location method until now)

    How did I temporarily/manually fix my problem?

    I copied the windows native module iconv.node into the location in mac's node_modules where the mac iconv.node should be, then ran the packaging again, then once the binary was made, I copied the mac iconv.node back where it should be.

    How can I automate that better, or just get the old behaviour back (easiest is just how do I stop pkg trying to bundle the .node file here?)

    Also how can we better-document what the correct approach is to cross-platform native module compilation?

    opened by tonywoode 37
  • Error! No available node version satisfies 'node11'

    Error! No available node version satisfies 'node11'

    Hey all,

    Im trying to pack my console application into an executable, im running windows 10 x64. Ive tried to reinstall node v11.3.0 for about 3 times.

    pkg . will output: > [email protected] > Targets not specified. Assuming: node11-linux-x64, node11-macos-x64, node11-win-x64 > Error! No available node version satisfies 'node11'

    node -v will output: v11.3.0

    ive searched around for a bit and didnt found a solution for this issue, i hope somebody can solve it...

    Micha de Vries

    opened by kearfy 37
  • Error: Module did not self-register while using native node module

    Error: Module did not self-register while using native node module

    I am using webworker-threads and compiled WebWorkerThreads.node with exact the same node version pkg packaged the exececutable (v6.10.3). Do I miss some todo(s) else anywhere to use a native module? I also tried pkg . -boption with the same result.

    Stale 
    opened by s-a 36
  • Changing icon in windows

    Changing icon in windows

    I tried changing the icon with Resource hacker, but the resulting .exe does not run. Actually, it runs, but freezes immediately. Here's what I tried:

    "C:/local/libs/Resource Hacker/resourcehacker.exe" -addoverwrite myapp-noicon.exe, myapp.exe, myicon.ico, ICONGROUP,MAINICON,0
    

    Is there any sort of protection on pkg that would explain that behaviour?

    bug patch internals 
    opened by brunobg 34
  • Support top-level-await

    Support top-level-await

    $ node -v
    v14.13.1
    
    $ cat index.js 
    console.log(await Promise.resolve(233));
    
    $ cat package.json 
    {
      "type": "module"
    }
    
    $ node index.js
    233
    
    $ pkg index.js -t node14
    > [email protected]
    > Error! Unexpected token, expected "," (1:18)
      /home/swwind/Repositories/tmp/index.js
    
    opened by swwind 32
  • Support ES6 Modules

    Support ES6 Modules

    I'm trying to package a node app as an exe using pkg, and I'd like to use ES6 imports.

    I have something like this in my src/app.js:

    import express from 'express'
    const app = express()
    
    const eco = (req, res) => {
      const { method, url, headers, query } = req
      res.json({ method, url, headers, query })
    }
    
    app.all('/', eco)
    
    app.listen(3000, () => console.log(`listening on http://localhost:3000`))
    

    in my package.json I have:

    {
      "name": "pkg-test",
      "version": "1.0.0",
      "description": "",
      "main": "src/app.js",
      "type": "module",
      "type": "module",
      "scripts": {
    "build": "pkg --targets=node12-win-x64 --output=iisnode-pkg.exe --options experimental-modules src/app.js",
        "start": "node --experimental-modules src/app.js",
        "test": "echo \"Error: no test specified\" && exit 1"
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "express": "^4.17.1"
      },
      "devDependencies": {
        "pkg": "^4.4.0"
      }
    
    }
    

    npm start works fine

    $ npm start
    
    > [email protected] start C:\data\devel\apps\tmp\iisnode-pkg
    > node --experimental-modules src/app.js
    
    (node:10668) ExperimentalWarning: The ESM module loader is experimental.
    welcome to iisnode-pkg
    iisnode-pkg listening on http://localhost:3000
    

    but npm run build gives a waning and then running the exe throws an error:

    >npm run build
    
    > [email protected] build C:\data\devel\apps\tmp\iisnode-pkg
    > pkg --targets=node12-win-x64 --output=iisnode-pkg.exe src/app.js --config package.json
    
    > [email protected]
    > Warning Failed to make bytecode node12-x64 for file C:\snapshot\iisnode-pkg\src\app.js
    
    >iisnode-pkg.exe
    C:\snapshot\iisnode-pkg\src\app.js:2
    import express from 'express'
           ^^^^^^^
    
    SyntaxError: Unexpected identifier
        at Module._compile (internal/modules/cjs/loader.js:701:23)
        at Module._compile (pkg/prelude/bootstrap.js:1268:32)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:768:10)
        at Module.load (internal/modules/cjs/loader.js:626:32)
        at Function.Module._load (internal/modules/cjs/loader.js:553:12)
        at Function.Module.runMain (pkg/prelude/bootstrap.js:1316:12)
        at internal/main/run_main_module.js:17:11
    

    It seems like the --options experimental-modules parameter from the build script in package.json is not beign taken into account.

    Any idea how can I use ES6 module imports from a node app packaged with pkg?

    PS: also asked at SO in case anybody wants to raise their reputation

    opened by opensas 29
Releases(5.8.0)
  • 5.8.0(Jul 13, 2022)

    Highlights

    • Support more language features, including but not limited to classPrivateMethods (#1248, #1249)
      • Note: pkg uses Babel to trace dependencies. It does NOT transform your sources. You should make sure that your code can run on the target Node.js version.

    What's Changed

    • Bump to vercel/[email protected] by @jesec in https://github.com/vercel/pkg/pull/1693
      • Add Node 14.20.0, 16.16.0 and 18.5.0 binaries
      • https://nodejs.org/en/blog/vulnerability/july-2022-security-releases
    • detector: use Babel AST and default plugins by @jesec in https://github.com/vercel/pkg/pull/1648
    • test: rearrange and fix order by @jesec in https://github.com/vercel/pkg/pull/1650
    • fix: typo in fabricator.ts by @eltociear in https://github.com/vercel/pkg/pull/1661

    New Contributors

    • @eltociear made their first contribution in https://github.com/vercel/pkg/pull/1661

    Full Changelog: https://github.com/vercel/pkg/compare/5.7.0...5.8.0

    Source code(tar.gz)
    Source code(zip)
  • 5.7.0(May 18, 2022)

    Highlights

    • Node 18 is now supported!

    What's Changed

    • Bump to vercel/[email protected] by @jesec in https://github.com/vercel/pkg/pull/1616
      • No longer take NODE_OPTIONS from the environment of the end-user. Only the users (developers who use pkg to package their project) should have control over the flags via the "bake in" (--options) mechanism (Fixes: https://github.com/vercel/pkg/issues/954, https://github.com/vercel/pkg/issues/989, https://github.com/vercel/pkg/issues/1194, https://github.com/vercel/pkg/issues/1517)
      • Patched Node: bump to 16.15.0, add 18.1.0 and drop 17
    • fix broken tests on node 12; latest pnpm requires node >= 14.19 by @kldzj in https://github.com/vercel/pkg/pull/1613
    • dependencies: bump (minor) by @jesec in https://github.com/vercel/pkg/pull/1615
    • fix(bootstrap): prevent to override existing node addon file by @renkei in https://github.com/vercel/pkg/pull/1611

    New Contributors

    • @renkei made their first contribution in https://github.com/vercel/pkg/pull/1611

    Full Changelog: https://github.com/vercel/pkg/compare/5.6.0...5.7.0

    Source code(tar.gz)
    Source code(zip)
  • 5.6.0(Apr 5, 2022)

    What's Changed

    • Update README.md by @jonaugustine in https://github.com/vercel/pkg/pull/1483
    • Copy module folders always to temporary folder by @trippier1 in https://github.com/vercel/pkg/pull/1492
    • fix: fs readdir and readdirSync (#1130/#1299) by @kldzj in https://github.com/vercel/pkg/pull/1495
    • fix: usage of .node files not in node_modules by @paul-marechal in https://github.com/vercel/pkg/pull/1435
    • Bump node-fetch from 2.6.6 to 2.6.7 by @dependabot in https://github.com/vercel/pkg/pull/1497
    • fix: copyFile and copyFileSync patch by @robertsLando in https://github.com/vercel/pkg/pull/1484
    • fix: fs.stat/fstat promises by @kldzj in https://github.com/vercel/pkg/pull/1511
    • build(deps): bump simple-get from 3.1.0 to 3.1.1 by @dependabot in https://github.com/vercel/pkg/pull/1512
    • feat: add simple type export (TS) by @louisgv in https://github.com/vercel/pkg/pull/1557
    • chore: replace deprecated String.prototype.substr() by @CommanderRoot in https://github.com/vercel/pkg/pull/1560
    • fix: bytecode option is a boolean by @paul-marechal in https://github.com/vercel/pkg/pull/1554
    • fix: do not overwrite temp .node files by @paul-marechal in https://github.com/vercel/pkg/pull/1547
    • Bump to vercel/[email protected] by @jesec in https://github.com/vercel/pkg/pull/1578

    New Contributors

    • @jonaugustine made their first contribution in https://github.com/vercel/pkg/pull/1483
    • @trippier1 made their first contribution in https://github.com/vercel/pkg/pull/1492
    • @paul-marechal made their first contribution in https://github.com/vercel/pkg/pull/1435
    • @louisgv made their first contribution in https://github.com/vercel/pkg/pull/1557
    • @CommanderRoot made their first contribution in https://github.com/vercel/pkg/pull/1560

    Full Changelog: https://github.com/vercel/pkg/compare/5.5.2...5.6.0

    Source code(tar.gz)
    Source code(zip)
  • 5.5.2(Jan 13, 2022)

  • 5.5.1(Nov 29, 2021)

  • 5.5.0(Nov 29, 2021)

    • Add support for node: protocol (#1405)
    • ldid: explicitly mark signature as ad-hoc (#1393)
    • .github: add issue templates (#1366)
    • dependencies: bump (minor) (#1360)

    Credits

    Huge thanks to @jesec, @asdfugil, and @mallardduck for helping!

    Source code(tar.gz)
    Source code(zip)
  • 5.4.1(Oct 30, 2021)

  • 5.3.3(Oct 1, 2021)

    Patches

    • Bootstrap: better support of .node files: #1321
    • CI: master -> main: df02066325c0b27b6f71d4376df8aeb498bdf7c6

    Credits

    Huge thanks to @robertsLando for helping!

    Source code(tar.gz)
    Source code(zip)
  • 5.3.2(Sep 11, 2021)

  • 5.3.1(Jul 21, 2021)

    Changes

    • Bump to vercel/[email protected]: 58130161bf31558ea03fc871eaa546d5f56431e3
    • Bump to vercel/[email protected]: 03c5e98d90600417c1f0d7c6c61335141803afd6
    • Allow to fallback to "ldid" for macOS ad-hoc signing: 8cd96a1686ab4e79e6b7d6242a52034760f75943
    • README: mention "ldid" utility on Linux for macOS signing: d65eb64e896bc4d9c95713dc4467306684c23b46
    Source code(tar.gz)
    Source code(zip)
  • 5.3.0(Jun 24, 2021)

    Changes

    • Bump browserslist from 4.16.3 to 4.16.6: 760b9c4de28846dfec6cb0597afb97d6dc50eb51
    • README: remove dead dependency badges: 9c6973d4629907bb4022209becf2eddd5bd3ce9e
    • README: use "HEAD" instead of "master" for links, see nodejs/node@26e318a32: 010cf842342cedec0910db66cc79620a585bc126
    • README: update the target list: 491941b54318075ec4fc6cf633aeeb86d6b2bbe3
    • README: link to vercel/pkg-fetch in the "Build" section: 709d7116dcacb9f21782717a75971f596025366e
    • README: add notes about building for different archs: bd5f361ba9864d4163bd86d3305bb24ec3ac6302
    • README: add notes about "macos-arm64": 447b2db7475f22f364288f93c9d584a95b6f1645
    • README: add notes about "linuxstatic" and native bindings: e8a2c634d90c506c8599d9fadca203304f0a2351
    • Squashed revert "allow to compress files in virtual file system ": #1115
    • Bootstrap: remove support for Node < 8: a22fd8017af347da7ccaf68892cc71ebeba9bd94
    • Bootstrap: use "const"/"let" instead of "var", require at top: 208e2414fbb29303b5bf981a0f03592f003678f4
    • Test-50-fs-runtime-layer-3: use "Buffer.from" instead of "new Buffer": d696260a8ded830a19ddfeafe3db9f1bf2a35eb9
    • Test: add tests for #1191 and #1192: bcec96cd95ebee70a2666344e0fb0e6a2e9f59e1
    • Producer: improve readability and remove backed up native addon at the end: 80103ddeb85786548726c8c71b348d053d21e991
    • InjectSnapshot: always use "C:\snapshot" on win: #1212
    • Eslint: use airbnb-base rules for TypeScript as well: 38a9a8c1298150bf544f3209ac8f02f2c1b61005
    • Fixes "@typescript-eslint/naming-convention": ff568722a7b0dea2cd661962b70f66ccd305e8d4
    • Fixes "no-nested-ternary": 30b25ab9ceb43914885f3ebbd24ee9270e00a412
    • Remove unused "appveyor.yml": 5c82b6d39d3dface49b35abd3d741836fcca3ce8
    • Tsconfig: bump target to "es2017" as Node 8 is the minimum: 2070696f157cb15f3e55687fd567cdf9f5156ab7
    • Revert^2 "allow to compress files in virtual file system " (#1200): #1115

    Credits

    Huge thanks to @erossignon and @jesec for helping!

    Source code(tar.gz)
    Source code(zip)
  • 5.2.1(May 24, 2021)

  • 5.2.0(May 20, 2021)

    Changes

    • Feature: allow to compress files in virtual file system: #1115
    • Test-50-fs-runtime-layer-2: remove unnecessary assertion on hint: 551d07d383eeeafc87fca960839e15aa2e1413d3
    • Feature: allow macOS code signing by including payload in str table: be5c2aee1180f59d7951ab14c5338bda07ca923a
    • Ad-hoc sign the fabricator binary temporarily to generate bytecode on macOS: 0b55f9adba1f52d2aed171ca902d44fffa114af0
    • Add support for fs.realpath.native: #1173
    • Bump hosted-git-info from 2.8.8 to 2.8.9: #1177
    • Add a warning about the macOS mandatory code signing requirement: #1176
    • Fs.createReadStream and --compress: #1158
    • Bump to vercel/[email protected]: 6fac6dc63b9215b0035f67c917e998ec74787cd9

    Credits

    Huge thanks to @erossignon, @Infern1, and @jesec for helping!

    Source code(tar.gz)
    Source code(zip)
  • 5.1.0(Apr 27, 2021)

    Changes

    • Test: bump expected major to 5: #1145
    • Improve doc to explain how to pass multiple baked options (#1133): #1132
    • Use "linuxstatic" to generate bytecode for different arch on Linux: #1144
    • Fix .node loading issue on windows (#1143): #1335
    • Support RegExp mountpoints: #1121
    • Bump to vercel/[email protected]: 36c28f9e7ec2ee676f6ab03323faf76592471cd4
    • CI: add Node 16 to matrix: 6adde0fb3c72e75f03ba29381969944744d88019
    • Test: test with Node 16: 655ee183681c770cf1e5ff146604f43c09045590

    Credits

    Huge thanks to @jesec and @phated for helping!

    Source code(tar.gz)
    Source code(zip)
  • 5.0.0(Apr 22, 2021)

    Changes

    • Update release script.: #1102
    • Update all dependencies to latest.: #1062
    • Add Windows builds on CI.: #1105
    • Add section about bytecode flag to README.md: #1106
    • Typo fix in readme: #1108
    • Feat(parser): handle template literal without expressions: #981
    • Add support for symlink and pnpm.: #1060
    • Update License Zeit -> Vercel.: #1113
    • Extend ESLint to test files.: #1107
    • Remove coverage badge from README.: #1114
    • TypeScript Rewrite: #1099
    • Skip pnpm tests when nodeversion is < 12: #1122
    • Test: add unit test for #775: #1118
    • Support mkdir at mountpoints: #1120
    • Bump to vercel/[email protected]: 14fb420fd43401de9af5f5d07a48bb3a659db56e
    • Cleanup dependencies: 5a97ee20728cc4463580c582cc92b5fb4ab90c20
    • Don't mix objects of different types: bba81480d5302fbbb7d9df1d08e36a062801fdd5
    • Fix pkg-fetch types: 247d1d523b48c4229c52bea05241df4a71574cea
    • Drop references to Node < 8: 6ecd52a2d29dcdd510e60f1108c467da68cfff6d
    • Test: add node14 to fetch-all: 63f4ce03f71f926521eb8f94dd49b24fb58190ed
    • Fix isPublic check for licenses array: #1140
    • Bump to vercel/[email protected]: 211da6e6f0e981e1f8e004b423c7e11d6e23fcd1
    • Bump to vercel/[email protected]: #1142

    pkg-fetch v2 -> v3

    vercel/[email protected]

    Credits

    Huge thanks to @erossignon, @whexberg, @BlackYuzia, @DevSide, @hipstersmoothie, @phated, @Hypfer, and @jesec for helping!

    Source code(tar.gz)
    Source code(zip)
  • 4.5.1(Mar 26, 2021)

    • Added documentation about NODE_OPTIONS: #996
    • Bootstrap: adjust for internalModuleReadJSON of newer Node.js: a20111e91d64c2380e4a10ce9a4a27848b427a5e
    • Bootstrap: support both old and new internalModuleReadJSON: 9598890350cc1d18672ddbc5032d142c4f019369
    • Chore: add ci, stale workflows and dependabot: #1074
    • Set up and run Prettier over entire codebase.: #1076
    • Drop dependabot.yml in favor of repo settings.: #1092
    • Remove incorrect \?\ prefix on windows and fs.promises fixes: #1095
    • Upgrade ESLint + move to eslint-config-airbnb-base.: #1088
    • Promisified exec and execFile should return a promise with ChildProcess instance attached: #880
    • Chore: make pkg-fetch dep static (temporarily).: #1100
    • Add pkg.outputPath as a configuration option.: #574

    Credits

    Huge thanks to @SnakeDrak, @robertsLando, @hipstersmoothie, @onip, and @Symbitic for helping!

    Source code(tar.gz)
    Source code(zip)
  • 4.5.0(Mar 22, 2021)

    • Branding change (#939)
    • Update badges in README (#949)
    • update tests test for node 14 CI (#977)
    • Bump lodash from 4.17.15 to 4.17.19 (#945)
    • Added environment var section on Readme (#684)
    • Add missing stat.isSocket (#720)
    • Fix configuration for node-notifier (#1021)
    • Add support for Node native addons (#837)
    • docs: MAKE_JOB_COUNT and PKG_IGNORE_TAG env var (#1053)
    • Bugfix for fs.readdir(), fs.readdirSync() (#992)
    • Replace deprecated assert.equal and assert.deepEqual. (#1063)
    • Update ZEIT to Vercel in package.json. (#1064)
    • Add cross-platform support for dot-node files. (#1066)
    Source code(tar.gz)
    Source code(zip)
  • 4.3.4(Aug 9, 2018)

  • 4.3.3(Jun 21, 2018)

    • switch from acorn to @babel/parser. fixes #206 (object spread)
    • switch from babel-preset-es2015 to babel-preset-env
    • switch from simple-bufferstream to into-stream. fixes #442
    • test for undo patch for PKG_INVOKE_NODEJS
    • proper error messages for node 10 emulation
    Source code(tar.gz)
    Source code(zip)
  • 4.3.2(Jun 21, 2018)

    • support node 10.4.1 and 8.11.3
    • readme: usage of max_old_space_size. fixes #447
    • refactor: pass marker separately from record to all fns
    • filter out bakes that don't influence the bytecode. fixes #308
    • dictionary: negotiator. fixes #387
    Source code(tar.gz)
    Source code(zip)
  • 4.3.1(Jun 21, 2018)

    • support exiftool.exe and exiftool.pl for dist-exiftool (#246) thanks to @mika-fischer
    • logform support (winstonjs library) (#337) thanks to @mfds
    • implement --public-packages. thanks to @szaffarano for idea
    • support object spread. update acorn, add a test for object spread
    • rename 'permissive' to 'public' to align with cli opt
    • support tiny-worker. fixes #334
    Source code(tar.gz)
    Source code(zip)
  • 4.3.0(Jun 21, 2018)

    • fix v8flags package
    • handle callbacks for exec and execFile
    • fix hanging mongoose test
    • reduce testing time by removing node0 and node4
    • fix "blessed" npm module (#314) thanks to @TooTallNate
    Source code(tar.gz)
    Source code(zip)
  • 4.2.5(Oct 6, 2017)

    Patches

    • Support node 8.6.0 by [email protected]: a1d1c5978a3a3583429de6315435a094fbde2895
    • Support puppeteer. fixes #204: 175a780c467d2d986a5fe035e5a62f1d0bd936b5
    • Support opn. fixes #207: aa6e7a490c0f6c9e21abad93a384014db3331806
    • Add syntax highlighting to readme: #217
    • Chdir to proc.env.CHDIR, that can be passed explicitly. fixes #231: 939c0dfb700fd709b05222e19dcdfe14a19d8f26

    Credits

    Huge thanks to @svenluijten for their help!

    Source code(tar.gz)
    Source code(zip)
  • 4.2.3(Aug 15, 2017)

  • 4.2.2(Aug 6, 2017)

  • 4.2.1(Aug 4, 2017)

    Patches

    • .json and .node can be specified as scripts: 9ab508a3a9ee82a4998137092e5da5980ad461db
    • Added correct deployFiles for sharp: 0648267363999af98db56c575df1d62e84c00157
    Source code(tar.gz)
    Source code(zip)
  • 4.2.0(Aug 3, 2017)

    Minor Changes

    • Dont warn Cannot resolve on non-toplevel. fixes #48 sort of: 0ae96a4e966a411f5ebdea8d929585243c282c0c

    Patches

    • Fix for google-closure-compiler. fixes #156: 3ffa4fcef2f5b46e79fa2daef4cef5dcbd565b2e
    • Apply stat of EXECPATH to stat on internal files. fixes #177: 3e0c51410a57e3558bb87ddcf3098b1a73bf16d3
    • Fix for phantomjs. fixes #147: 36231b4ed5ace37df966ab454f6775814762b9dc
    • [email protected]. fixes zeit/pkg#174 and zeit/pkg#173: a502ddd299d63a8ed4b42c805e0362be00be855c
    • Show warnings about deployFiles. fixes #72: 1986f6db8f5e6676b1b2c45cae9143132a740ff4
    • Set of patches and tests to fix #108: b6d9d1aa83b6aff3280ed32432ea9b0c2d160ea8
    • Show a warning that css gets into 'scripts'. addresses #79: e4d50db8e0a227d82b59fa4a0bb8c51fd5c824e2
    • Support electron (sort of) and nightmare. fixes #179: cd9601fc9e558217838fe2332ab48c7ab489d793
    • Support tesseract.js. fixes #183: 2e3bfad6877958f65c9bf7c185f4159effe3e80b
    Source code(tar.gz)
    Source code(zip)
  • 4.1.4(Jul 28, 2017)

    Patches

    • [email protected] fixes #171: fb6f9a3cd3bb28a8b9fc1b78d59d7389c35d25a0
    • Cover few more cases by 'insideSnapshot'. fixes #172: 36f00e959ab3238eac66049bb13b0a13f766d471
    • Better check for missing 'main' entry. fixes #162: e0226592d6732ed7cfeba6ed5779f9a08f0cbd1e
    • findNativeAddonSyncFreeFromRequire. fixes #176: f59377c6a78aa42487d806818b87791f4c95b812
    Source code(tar.gz)
    Source code(zip)
  • 4.1.3(Jul 21, 2017)

    Patches

    • Document API: 782337bd1c7f307de7260f8f998cf3e6cbe8fd28
    • --public option to disclose the sources of top-level project: c5f191bb4e8fddcbb26791aaf703c76b9a50505f
    • AllowImportExportEverywhere. partially fixes #123: da018a30b88562b71c6933b92fda87ecf6666b5c
    • More permissive licenses to improve --no-bytecode: 25466448b669a4ed35cc4b9ee59915ccaa3e1578
    • Pass package.json path as 'addition'. fixes #123: 439ea29dfa9c194db8f383d3e27aa1387991f146
    Source code(tar.gz)
    Source code(zip)
Owner
Vercel
Develop. Preview. Ship. Creators of Next.js.
Vercel
Build node packages into deployable applications

strong-build Build a node application package, preparing it for deploy to production. It is useful standalone, but is commonly used to build applicati

StrongLoop and IBM API Connect 47 Mar 3, 2022
This is a Webpack Project about Todo-list which you can add your to-dos, edit them, add mark as completed.

Todo-list-webpack This website Todo-list-webpack provides users a convenient way to keep track of their todos. Built With HTML CSS JavaScript Linters

Omar Salem 16 Jul 14, 2022
browser-side require() the node.js way

browserify require('modules') in the browser Use a node-style require() to organize your browser code and load modules installed by npm. browserify wi

null 14.3k Dec 29, 2022
A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.

InversifyJS A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript. About InversifyJS is a ligh

inversify 9.5k Jan 4, 2023
:red_circle: Functional task runner for Node.js

start ⚠️ Project has been transferred to NexTools metarepo functional – in all senses fast – parallelism and concurrency shareable – presets as publis

Kir Belevich 477 Dec 15, 2022
A toolkit to automate & enhance your workflow

The streaming build system What is gulp? Automation - gulp is a toolkit that helps you automate painful or time-consuming tasks in your development wo

gulp 32.7k Jan 6, 2023
Detect the executable python interpreter cmd in $PATH.

detect-python-interpreter Detect the executable python interpreter cmd in $PATH. Installation $ npm install --save detect-python-interpreter Usage con

Khaidi Chu 2 Apr 12, 2022
🤖 Persist the Playwright executable between Netlify builds

?? Netlify Plugin Playwright Cache Persist the Playwright executables between Netlify builds. Why netlify-plugin-playwright-cache When you install pla

Hung Viet Nguyen 14 Oct 24, 2022
An NPM package to help frontend developers get started with using SASS and SCSS on your project easily. The Package follows the 7-1 architecture project structure.

Project Title - Create SASS APP Ever wanted to code up a frontend project with SASS & SCSS and you are stuck with building the acclaimed 7-1 architect

Kelechi Okoronkwo 7 Sep 22, 2022
Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

AILI Fida Aliotti Christino 2 Mar 29, 2022
This package is for developers to be able to easily integrate bad word checking into their projects.\r This package can return bad words in array or regular expression (regex) form.

Vietnamese Bad Words This package is for developers to be able to easily integrate bad word checking into their projects. This package can return bad

Nguyễn Quang Sáng 8 Nov 3, 2022
Multi-platform node package bundle to a package.json.

dmpc Multi-platform node package bundle to a package.json. install ### npm mode npm i -g @kingsword/dmpc ### yarn mode yarn global add @kingsword/dmp

Kingsword 2 Oct 16, 2022
NPM Package to integrate ONDC into Node.js backend

ondc-node This library can be used to integrate ONDC in JavaScript based applications. Package is developed in TypeScript and will work with Node.Js &

Utkarsh Mehta 12 Dec 11, 2022
Repo for tricking NPM into not hoisting your package. No dependencies and a warning if imported.

noist (Short for No Hoist) Repo for tricking NPM into not hoisting your package. No dependencies and a warning if imported. Why? As of npm@7 NPM suppo

Zackery Griesinger 20 Oct 27, 2022
portfolio-project is a npm package to automatically update your projects section in your portfolio website. It will fetch the selected repositories directly from your GitHub account.

portfolio-project Those days of manually updating portfolio website after every new project made are gone ⚡ Yesss . . . you read that right. ?? portfo

Gaurav Gulati 15 Aug 3, 2021
A NodeJS package for voice channel interactions on Revolt. This package lets you join voice channels, play music and more!

Revoice.js - A Voice Module for Revolt This package is still in developement and lacks many features. You still are able to play sound to a voice chan

ShadowLp174 13 Dec 25, 2022
A lightweight, standalone package to integrate full PWA features into Remix 💿

Remix PWA PWA integration & support for Remix Remix PWA is a lightweight, standalone npm package that adds full Progressive Web App support to Remix ?

Abdur-Rahman 220 Jan 3, 2023
Extract a JS/TS module and its dependencies into a new package

module-extractor Extract a module and its dependencies into a new package Usage import { extractModules } from 'module-extractor' const extraction =

Alec Larson 12 Aug 9, 2022