Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sea: snapshot support in single executable applications #46824

Merged
merged 4 commits into from
Jul 20, 2023

Commits on Jul 20, 2023

  1. src: support snapshot in single executable applications

    This patch adds snapshot support to single executable applications.
    To build a snapshot from the main script when preparing the
    blob that will be injected into the single executable application,
    add `"useSnapshot": true` to the configuration passed to
    `--experimental-sea-config`. For example:
    
    ```
    {
        "main": "snapshot.js",
        "output": "sea-prep.blob",
        "useSnapshot": true
    }
    ```
    
    The main script used to build the snapshot must invoke
    `v8.startupSnapshot.setDeserializeMainFunction()` to configure the
    entry point. The generated startup snapshot would be part of the
    preparation blob and get injected into the final executable.
    
    When the single executable application is launched, instead of running
    the `main` script from scratch, Node.js would instead deserialize the
    snapshot to get to the state initialized during build-time directly.
    joyeecheung committed Jul 20, 2023
    Configuration menu
    Copy the full SHA
    7679435 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c392064 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a5bc23d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    c481fd5 View commit details
    Browse the repository at this point in the history