Parcel 2.0.0 alpha release, Web application packaging tool

Parcel is a speed, zero-configuration of Web application packaging tool. This version is more scalable than Parcel 1, more scalable and more reliable, while retaining the ease of use and developer experience obtained from the Parcel. Details are as follows:

  • Scalability: Parcel 2 is fully extended from end to end. Plug-in type has been extended to allow the use of the pipeline to expand and easy to configure covering almost all of the core behavior.
  • Scalability: Although Parcel been using parallelism and cache to be extended to large applications, but in Parcel 2, this step deeper. This version now caching and parallelism more Parcel work, especially the construction of the cache can be extended to a larger application.
  • Reliability: Parcel 2 cache improves reliability, while increasing performance to the maximum. This version uses a new cross-platform file system monitor, which detects changes in file size Parcel is not running, the cache of building performance and monitoring modes have almost identical.

Configuration 

Parcel is a zero-configuration. This does not mean non-configurable, just as much Parcel inferred from the code itself, and the existing configuration files for other tools (such as .babelrc).

Parcel 2 is a selectable configuration. Parcel 2 CLI built into the default configuration for most applications are sufficient, and contains all the support of Parcel 1, and more configuration, but Parcel 2 support through each stage as the core of a specially designed set of Parcel additional plug-in type to extend the core functionality.

  • Resolvers: Resolvers introducing (e.g., import './ foo' or import'rep ') to a full file path /my/project/foo.js like. The default parser Parcel 2 includes support for node analysis algorithm, however, if you want to extend or override the parsing algorithm project, this version can use a parser plug-ins.
  • Transformers: Transformers and asset compiled code from one language to another language, or just some way to convert the file. For example, the type of recording type converter converts the JavaScript, and JavaScript Babel converter into a different JavaScript. Transformers are also responsible for extracting the code from the dependencies, for example, import statements and requires a call, the call is passed back to the resolver, the other converter and the like.
  • Bundlers: Bundler widget to FIG asset as input, and output is similar to FIG asset FIG bundle, but the asset will be grouped. The default Bundler will have a similar file types (such as JavaScript and CSS) of the asset together, and executes the code division, and some other optimizations.
  • Namers: Namer plug-in is responsible for determining the output file name for each package. The default name of the plug-ins include content that hash to the long-term accessibility of the asset carried out, and the same naming rules Parcel 1.
  • Runtimes: Runtime widget allows constructing the code into the package
  • Packagers: packagers a common type of asset can be loaded into one of the output in the browser package. For example, JSPackager the JavaScript files together, to execute them at the right time in the right order.
  • Optimizers: Optimizer widget somehow optimized package, such as a minimum or a compressed file. For example, Terser optimizer will minimize packet JavaScript
  • Validators: Validator widget run in the background to perform authentication codes, e.g. Linting (e.g. eslint) or type checking (e.g. type of the recording).
  • Reporters: Reporter Plug-event with status information and log events throughout the bundling process.

All this is a very simple .parcelrc a JSON file configuration. 

Small Core

Everything in this edition Parcel have been broken down into plug-in, so Parcel core is very small. Now, it's basically just a chart based on the file your application, in a purposeful manner and optimized to run other tools needed. Everything is designed to be parallel, and is cacheable, whether local or final, are across the machine.

Worker farm has been updated to use the built-in available to the Node new in 12  WORKER_THREADS , compared with the previous versions of multiple processes used in the back-end, lower the cost of the module.

In addition to a new core and plugin system, Packcel 2 There are many new features, including support for multiple targets. Parcel 2 allows you to configure the plurality of constructed goals, which will be built in parallel. For example, you might want to build a modern version of the application is browser has a modern syntax, to build a version of the application with more features conversion overflow legacy browser. Or if you want to build a library for the node and browser. This version can do this by configuring the target Package.json.

{
  "browser": "dist/legacy/index.js",
  "browserModern": "dist/modern/index.js",
  "targets": {
    "browserModern": {
      "engines": {
        "browsers": [
          "last 1 Chrome version"
        ]
      }
    },
    "browser": {
      "engines": {
        "browsers": [
          "> 0.25%"
        ]
      }
    }
  }
}

Parcel 2 also supports advanced packet optimization, it is automatically split into their own package React common dependencies and other libraries such as these packages can be loaded in parallel, with the rest of the code and a separate cache.

Other updates, see the release notes

Guess you like

Origin www.oschina.net/news/109064/parcel-2-0-0-alpha-released