Scoped: updated numerous docs with scoped packages change [skip ci]

This commit is contained in:
Mateusz Burzyński 2017-10-17 00:28:03 +02:00 committed by Henry Zhu
parent 919bdf5e79
commit 859ea4b175
35 changed files with 80 additions and 87 deletions

View File

@ -3,22 +3,22 @@
A monorepo, muhahahahahaha. See the [monorepo design doc](/doc/design/monorepo.md) for reasoning. A monorepo, muhahahahahaha. See the [monorepo design doc](/doc/design/monorepo.md) for reasoning.
- [Core Packages](#core-packages) - [Core Packages](#core-packages)
- [Other](#other) - [Other](#other)
- [Presets](#presets) - [Presets](#presets)
- [Plugins](#plugins) - [Plugins](#plugins)
- [Transform Plugins](#transform-plugins) - [Transform Plugins](#transform-plugins)
- [Syntax Plugins](#syntax-plugins) - [Syntax Plugins](#syntax-plugins)
### Core Packages ### Core Packages
| Package | Version | Dependencies | | Package | Version | Dependencies |
|--------|-------|------------| |--------|-------|------------|
| [`babel-core`](/packages/babel-core) | [![npm](https://img.shields.io/npm/v/babel-core.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-core) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-core)](https://david-dm.org/babel/babel?path=packages/babel-core) | | [`babel-core`](/packages/babel-core) | [![npm](https://img.shields.io/npm/v/babel-core.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-core) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-core)](https://david-dm.org/babel/babel?path=packages/babel-core) |
| [`babylon`](https://github.com/babel/babylon) | [![npm](https://img.shields.io/npm/v/babylon.svg?maxAge=2592000)](https://www.npmjs.com/package/babylon) | [![Dependency Status](https://david-dm.org/babel/babylon.svg)](https://david-dm.org/babel/babylon) | | [`babylon`](https://github.com/babel/babylon) | [![npm](https://img.shields.io/npm/v/babylon.svg?maxAge=2592000)](https://www.npmjs.com/package/babylon) | [![Dependency Status](https://david-dm.org/babel/babylon.svg)](https://david-dm.org/babel/babylon) |
| [`babel-traverse`](/packages/babel-traverse) | [![npm](https://img.shields.io/npm/v/babel-traverse.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-traverse) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-traverse)](https://david-dm.org/babel/babel?path=packages/babel-traverse) | | [`@babel/traverse`](/packages/babel-traverse) | [![npm](https://img.shields.io/npm/v/babel-traverse.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-traverse) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-traverse)](https://david-dm.org/babel/babel?path=packages/babel-traverse) |
| [`babel-generator`](/packages/babel-generator) | [![npm](https://img.shields.io/npm/v/babel-generator.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-generator) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-generator)](https://david-dm.org/babel/babel?path=packages/babel-generator) | | [`@babel/generator`](/packages/babel-generator) | [![npm](https://img.shields.io/npm/v/babel-generator.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-generator) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-generator)](https://david-dm.org/babel/babel?path=packages/babel-generator) |
[`babel-core`](/packages/babel-core) is the Babel compiler itself; it exposes the `babel.transform` method, where `transformedCode = transform(src).code`. [`@babel/core`](/packages/babel-core) is the Babel compiler itself; it exposes the `babel.transform` method, where `transformedCode = transform(src).code`.
The compiler can be broken down into 3 parts: The compiler can be broken down into 3 parts:
- The parser: [`babylon`](https://github.com/babel/babylon) (moved to a separate repo and versioned independently) - The parser: [`babylon`](https://github.com/babel/babylon) (moved to a separate repo and versioned independently)
@ -36,23 +36,23 @@ Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/
| Package | Version | Dependencies | | Package | Version | Dependencies |
|--------|-------|------------| |--------|-------|------------|
| [`babel-cli`](/packages/babel-cli) | [![npm](https://img.shields.io/npm/v/babel-cli.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-cli) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-cli)](https://david-dm.org/babel/babel?path=packages/babel-cli) | | [`@babel/cli`](/packages/babel-cli) | [![npm](https://img.shields.io/npm/v/babel-cli.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-cli) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-cli)](https://david-dm.org/babel/babel?path=packages/babel-cli) |
| [`babel-types`](/packages/babel-types) | [![npm](https://img.shields.io/npm/v/babel-types.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-types) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-types)](https://david-dm.org/babel/babel?path=packages/babel-types) | | [`@babel/types`](/packages/babel-types) | [![npm](https://img.shields.io/npm/v/babel-types.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-types) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-types)](https://david-dm.org/babel/babel?path=packages/babel-types) |
| [`babel-polyfill`](/packages/babel-polyfill) | [![npm](https://img.shields.io/npm/v/babel-polyfill.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-polyfill) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-polyfill)](https://david-dm.org/babel/babel?path=packages/babel-polyfill) | | [`@babel/polyfill`](/packages/babel-polyfill) | [![npm](https://img.shields.io/npm/v/babel-polyfill.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-polyfill) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-polyfill)](https://david-dm.org/babel/babel?path=packages/babel-polyfill) |
| [`babel-runtime`](/packages/babel-runtime) | [![npm](https://img.shields.io/npm/v/babel-runtime.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-runtime) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-runtime)](https://david-dm.org/babel/babel?path=packages/babel-runtime) | | [`@babel/runtime`](/packages/babel-runtime) | [![npm](https://img.shields.io/npm/v/babel-runtime.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-runtime) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-runtime)](https://david-dm.org/babel/babel?path=packages/babel-runtime) |
| [`babel-register`](/packages/babel-register) | [![npm](https://img.shields.io/npm/v/babel-register.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-register) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-register)](https://david-dm.org/babel/babel?path=packages/babel-register) | | [`@babel/register`](/packages/babel-register) | [![npm](https://img.shields.io/npm/v/babel-register.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-register) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-register)](https://david-dm.org/babel/babel?path=packages/babel-register) |
| [`babel-template`](/packages/babel-template) | [![npm](https://img.shields.io/npm/v/babel-template.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-template) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-template)](https://david-dm.org/babel/babel?path=packages/babel-template) | | [`@babel/template`](/packages/babel-template) | [![npm](https://img.shields.io/npm/v/babel-template.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-template) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-template)](https://david-dm.org/babel/babel?path=packages/babel-template) |
| [`babel-helpers`](/packages/babel-helpers) | [![npm](https://img.shields.io/npm/v/babel-helpers.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-helpers) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-helpers)](https://david-dm.org/babel/babel?path=packages/babel-helpers) | | [`@babel/helpers`](/packages/babel-helpers) | [![npm](https://img.shields.io/npm/v/babel-helpers.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-helpers) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-helpers)](https://david-dm.org/babel/babel?path=packages/babel-helpers) |
| [`babel-code-frame`](/packages/babel-code-frame) | [![npm](https://img.shields.io/npm/v/babel-code-frame.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-code-frame) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-code-frame)](https://david-dm.org/babel/babel?path=packages/babel-code-frame) | | [`@babel/code-frame`](/packages/babel-code-frame) | [![npm](https://img.shields.io/npm/v/babel-code-frame.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-code-frame) | [![Dependency Status](https://david-dm.org/babel/babel.svg?path=packages/babel-code-frame)](https://david-dm.org/babel/babel?path=packages/babel-code-frame) |
- [`babel-cli`](/packages/babel-cli) is the CLI tool that runs `babel-core` and helps with outputting to a directory, a file, stdout and more (also includes `babel-node`). Check out the [docs](https://babeljs.io/docs/usage/cli/). - [`@babel/cli`](/packages/babel-cli) is the CLI tool that runs `@babel/core` and helps with outputting to a directory, a file, stdout and more (also includes `babel-node`). Check out the [docs](https://babeljs.io/docs/usage/cli/).
- [`babel-types`](/packages/babel-types) is used to validate, build and change AST nodes. - [`@babel/types`](/packages/babel-types) is used to validate, build and change AST nodes.
- [`babel-polyfill`](/packages/babel-polyfill) is [literally a wrapper](https://github.com/babel/babel/blob/master/packages/babel-polyfill/src/index.js) around [`core-js`](https://github.com/zloirock/core-js) and [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime). Check out the [docs](https://babeljs.io/docs/usage/polyfill/). - [`@babel/polyfill`](/packages/babel-polyfill) is [literally a wrapper](https://github.com/babel/babel/blob/master/packages/babel-polyfill/src/index.js) around [`core-js`](https://github.com/zloirock/core-js) and [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime). Check out the [docs](https://babeljs.io/docs/usage/polyfill/).
- [`babel-runtime`](/packages/babel-runtime) is similar to the polyfill except that it doesn't modify the global scope and is to be used with [`babel-plugin-transform-runtime`](/packages/babel-plugin-transform-runtime) (usually in library/plugin code). Check out the [docs](https://babeljs.io/docs/plugins/transform-runtime/). - [`@babel/runtime`](/packages/babel-runtime) is similar to the polyfill except that it doesn't modify the global scope and is to be used with [`@babel/plugin-transform-runtime`](/packages/babel-plugin-transform-runtime) (usually in library/plugin code). Check out the [docs](https://babeljs.io/docs/plugins/transform-runtime/).
- [`babel-register`](/packages/babel-register) is a way to automatically compile files with Babel on the fly by binding to Node.js `require`. Check out the [docs](http://babeljs.io/docs/usage/require/). - [`@babel/register`](/packages/babel-register) is a way to automatically compile files with Babel on the fly by binding to Node.js `require`. Check out the [docs](http://babeljs.io/docs/usage/require/).
- [`babel-template`](/packages/babel-template) is a helper function that allows constructing AST nodes from a string presentation of the code; this eliminates the tedium of using `babel-types` for building AST nodes. - [`@babel/template`](/packages/babel-template) is a helper function that allows constructing AST nodes from a string presentation of the code; this eliminates the tedium of using `@babel/types` for building AST nodes.
- [`babel-helpers`](/packages/babel-helpers) is a set of pre-made `babel-template` functions that are used in some Babel plugins. - [`@babel/helpers`](/packages/babel-helpers) is a set of pre-made `@babel/template` functions that are used in some Babel plugins.
- [`babel-code-frame`](/packages/babel-code-frame) is a standalone package used to generate errors that print the source code and point to error locations. - [`@babel/code-frame`](/packages/babel-code-frame) is a standalone package used to generate errors that print the source code and point to error locations.
### [Presets](http://babeljs.io/docs/plugins/#presets) ### [Presets](http://babeljs.io/docs/plugins/#presets)
@ -62,7 +62,7 @@ The transformer[s] used in Babel are the independent pieces of code that transfo
| Package | Version | Dependencies | Description | | Package | Version | Dependencies | Description |
|--------|-------|------------|---| |--------|-------|------------|---|
| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [![npm](https://img.shields.io/npm/v/babel-preset-env.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-env) | [![Dependency Status](https://david-dm.org/babel/babel-preset-env.svg)](https://david-dm.org/babel/babel-preset-env) | automatically determines plugins and polyfills you need based on your supported environments | | [`@babel/preset-env`](https://github.com/babel/babel-preset-env) | [![npm](https://img.shields.io/npm/v/babel-preset-env.svg?maxAge=2592000)](https://www.npmjs.com/package/babel-preset-env) | [![Dependency Status](https://david-dm.org/babel/babel-preset-env.svg)](https://david-dm.org/babel/babel-preset-env) | automatically determines plugins and polyfills you need based on your supported environments |
> You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset) > You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset)
@ -78,8 +78,8 @@ There are many kinds of plugins: ones that convert ES6/ES2015 to ES5, transform
#### Syntax Plugins #### Syntax Plugins
These just enable the transform plugins to be able to parse certain features (the transform plugins already include the syntax plugins so you don't need both): `babel-plugin-syntax-x`. Check out our [website for more](http://babeljs.io/docs/plugins/#syntax-plugins). These just enable the transform plugins to be able to parse certain features (the transform plugins already include the syntax plugins so you don't need both): `@babel/plugin-syntax-x`. Check out our [website for more](http://babeljs.io/docs/plugins/#syntax-plugins).
### Helpers ### Helpers
These are mostly for internal use in various plugins: `babel-helper-x`. These are mostly for internal use in various plugins: `@babel/helper-x`.

View File

@ -2,7 +2,7 @@
> Babel command line. > Babel command line.
In addition, various entry point scripts live in the top-level package at `babel-cli/bin`. In addition, various entry point scripts live in the top-level package at `@babel/cli/bin`.
There are some shell-executable utility scripts, `babel-external-helpers.js` and `babel-node.js`, and the main Babel cli script, `babel.js`. There are some shell-executable utility scripts, `babel-external-helpers.js` and `babel-node.js`, and the main Babel cli script, `babel.js`.

View File

@ -1,3 +0,0 @@
#!/usr/bin/env node
throw new Error("babel-doctor has been removed.");

View File

@ -33,7 +33,6 @@
"@babel/helper-fixtures": "7.0.0-beta.3" "@babel/helper-fixtures": "7.0.0-beta.3"
}, },
"bin": { "bin": {
"babel-doctor": "./bin/babel-doctor.js",
"babel": "./bin/babel.js", "babel": "./bin/babel.js",
"babel-external-helpers": "./bin/babel-external-helpers.js" "babel-external-helpers": "./bin/babel-external-helpers.js"
} }

View File

@ -123,7 +123,7 @@ commander.option(
"specify a custom name for module ids", "specify a custom name for module ids",
); );
// "babel" command specific arguments that are not passed to babel-core. // "babel" command specific arguments that are not passed to @babel/core.
commander.option( commander.option(
"-x, --extensions [extensions]", "-x, --extensions [extensions]",
"List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]",
@ -165,7 +165,7 @@ commander.option(
); );
/* eslint-enable max-len */ /* eslint-enable max-len */
commander.version(pkg.version + " (babel-core " + version + ")"); commander.version(pkg.version + " (@babel/core " + version + ")");
commander.usage("[options] <files ...>"); commander.usage("[options] <files ...>");
commander.parse(process.argv); commander.parse(process.argv);
@ -229,7 +229,7 @@ if (opts.configFile) {
opts.extends = opts.configFile; opts.extends = opts.configFile;
} }
// Delete options that are specific to babel-cli and shouldn't be passed to babel-core. // Delete options that are specific to @babel/cli and shouldn't be passed to @babel/core.
delete opts.version; delete opts.version;
delete opts.extensions; delete opts.extensions;
delete opts.watch; delete opts.watch;
@ -244,7 +244,7 @@ delete opts.deleteDirOnStart;
delete opts.keepFileExtension; delete opts.keepFileExtension;
// Commander will default the "--no-" arguments to true, but we want to leave them undefined so that // Commander will default the "--no-" arguments to true, but we want to leave them undefined so that
// babel-core can handle the default-assignment logic on its own. // @babel/core can handle the default-assignment logic on its own.
if (opts.babelrc === true) opts.babelrc = undefined; if (opts.babelrc === true) opts.babelrc = undefined;
if (opts.comments === true) opts.comments = undefined; if (opts.comments === true) opts.comments = undefined;
if (opts.highlightCode === true) opts.highlightCode = undefined; if (opts.highlightCode === true) opts.highlightCode = undefined;

View File

@ -251,7 +251,7 @@ export default function(
deprecationWarningShown = true; deprecationWarningShown = true;
const deprecationError = new Error( const deprecationError = new Error(
"Passing lineNumber and colNumber is deprecated to babel-code-frame. Please use `codeFrameColumns`.", "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.",
); );
deprecationError.name = "DeprecationWarning"; deprecationError.name = "DeprecationWarning";

View File

@ -97,7 +97,7 @@ Following is a table of the options you can use:
| `extends` | `null` | A path to a `.babelrc` file to extend | | `extends` | `null` | A path to a `.babelrc` file to extend |
| `filename` | `"unknown"` | Filename for use in errors etc | | `filename` | `"unknown"` | Filename for use in errors etc |
| `filenameRelative` | `(filename)` | Filename relative to `sourceRoot` | | `filenameRelative` | `(filename)` | Filename relative to `sourceRoot` |
| `generatorOpts` | `{}` | An object containing the options to be passed down to the babel code generator, babel-generator | | `generatorOpts` | `{}` | An object containing the options to be passed down to the babel code generator, @babel/generator |
| `getModuleId` | `null` | Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used | | `getModuleId` | `null` | Specify a custom callback to generate a module id with. Called as `getModuleId(moduleName)`. If falsy value is returned then the generated module id is used |
| `highlightCode` | `true` | ANSI highlight syntax error code frames | | `highlightCode` | `true` | ANSI highlight syntax error code frames |
| `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified | | `ignore` | `null` | Opposite to the `only` option. `ignore` is disregarded if `only` is specified |

View File

@ -106,7 +106,7 @@ const readConfigJS = makeStrongCache((filepath, cache) => {
return null; return null;
} }
// The `require()` call below can make this code reentrant if a require hook like babel-register has been // The `require()` call below can make this code reentrant if a require hook like @babel/register has been
// loaded into the system. That would cause Babel to attempt to compile the `.babelrc.js` file as it loads // loaded into the system. That would cause Babel to attempt to compile the `.babelrc.js` file as it loads
// below. To cover this case, we auto-ignore re-entrant config processing. // below. To cover this case, we auto-ignore re-entrant config processing.
if (LOADING_CONFIGS.has(filepath)) { if (LOADING_CONFIGS.has(filepath)) {

View File

@ -25,9 +25,6 @@ export default {
message: message:
"use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/", "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/",
}, },
// "keepModuleIdExtensions": {
// "message": ""
// },
loose: { loose: {
message: message:
"Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option.", "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option.",

View File

@ -39,8 +39,8 @@ export { default as transformFile } from "./transform-file";
export { default as transformFileSync } from "./transform-file-sync"; export { default as transformFileSync } from "./transform-file-sync";
/** /**
* Recommended set of compilable extensions. Not used in babel-core directly, but meant as * Recommended set of compilable extensions. Not used in @babel/core directly, but meant as
* as an easy source for tooling making use of babel-core. * as an easy source for tooling making use of @babel/core.
*/ */
export const DEFAULT_EXTENSIONS = Object.freeze([ export const DEFAULT_EXTENSIONS = Object.freeze([
".js", ".js",

View File

@ -9,7 +9,7 @@ let LOADED_PLUGIN: Plugin | void;
export default function loadBlockHoistPlugin(): Plugin { export default function loadBlockHoistPlugin(): Plugin {
if (!LOADED_PLUGIN) { if (!LOADED_PLUGIN) {
// Lazy-init the internal plugin to remove the init-time circular // Lazy-init the internal plugin to remove the init-time circular
// dependency between plugins being passed babel-core's export object, // dependency between plugins being passed @babel/core's export object,
// which loads this file, and this 'loadConfig' loading plugins. // which loads this file, and this 'loadConfig' loading plugins.
const config = loadConfig({ const config = loadConfig({
babelrc: false, babelrc: false,

View File

@ -1,5 +1,5 @@
/* /*
Copies tests from babylon's TypeScript test suite to babel-generator. Copies tests from babylon's TypeScript test suite to @babel/generator.
This script assumes that the "babylon" repository is adjacent to "babel". This script assumes that the "babylon" repository is adjacent to "babel".
*/ */

View File

@ -23,7 +23,7 @@ traverse(file, {
## Caveat with UglifyJS pre v3.1.0 ## Caveat with UglifyJS pre v3.1.0
`babel-helper-annotate-as-pure` will append any existing leading comments to the `#__PURE__` annotation. Versions of UglifyJS prior to v3.1.0 will **ignore** these annotations, as they only check the _last_ leading comment for the annotation. `@babel/helper-annotate-as-pure` will append any existing leading comments to the `#__PURE__` annotation. Versions of UglifyJS prior to v3.1.0 will **ignore** these annotations, as they only check the _last_ leading comment for the annotation.
For example, using the `Usage` snippet above: For example, using the `Usage` snippet above:

View File

@ -3,7 +3,7 @@
## Installation ## Installation
```sh ```sh
npm install babel-helper-module-imports --save npm install @babel/helper-module-imports --save
``` ```
## Usage ## Usage

View File

@ -1,7 +1,7 @@
{ {
"name": "@babel/helper-transform-fixture-test-runner", "name": "@babel/helper-transform-fixture-test-runner",
"version": "7.0.0-beta.3", "version": "7.0.0-beta.3",
"description": "Transform test runner for babel-helper-fixtures module", "description": "Transform test runner for @babel/helper-fixtures module",
"author": "Sebastian McKenzie <sebmck@gmail.com>", "author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/", "homepage": "https://babeljs.io/",
"license": "MIT", "license": "MIT",

View File

@ -44,7 +44,7 @@ runModuleInTestContext("@babel/polyfill", __filename);
runCodeInTestContext(buildExternalHelpers()); runCodeInTestContext(buildExternalHelpers());
/** /**
* A basic implementation of CommonJS so we can execute `babel-polyfill` inside our test context. * A basic implementation of CommonJS so we can execute `@babel/polyfill` inside our test context.
* This allows us to run our unittests * This allows us to run our unittests
*/ */
function runModuleInTestContext(id: string, relativeFilename: string) { function runModuleInTestContext(id: string, relativeFilename: string) {

View File

@ -5,7 +5,7 @@
## Install ## Install
```sh ```sh
npm install --save-dev babel-helpers npm install --save-dev @babel/helpers
``` ```
## Usage ## Usage

View File

@ -7,7 +7,7 @@ babel-node is a CLI that works exactly the same as the Node.js CLI, with the add
## Install ## Install
```sh ```sh
npm install --save-dev babel-node npm install --save-dev @babel/node
``` ```
## Usage ## Usage

View File

@ -24,7 +24,7 @@ repl: "a" is read-only
## Installation ## Installation
```sh ```sh
npm install --save-dev babel-plugin-check-es2015-constants npm install --save-dev @babel/plugin-check-es2015-constants
``` ```
## Usage ## Usage

View File

@ -3,7 +3,7 @@
## Installation ## Installation
```sh ```sh
npm install --save-dev babel-plugin-external-helpers npm install --save-dev @babel/plugin-external-helpers
``` ```
## Usage ## Usage

View File

@ -93,7 +93,7 @@ require("@babel/core").transform("code", {
If you need to further compile ES2015 Decimal, Binary, Hex and Octal number representations to their pre-ES2015 numeric literal form, add the [`"transform-es2015-literals"`](http://babeljs.io/docs/plugins/transform-es2015-literals/) plugin: If you need to further compile ES2015 Decimal, Binary, Hex and Octal number representations to their pre-ES2015 numeric literal form, add the [`"transform-es2015-literals"`](http://babeljs.io/docs/plugins/transform-es2015-literals/) plugin:
> `transform-es2015-literals` is already included in [babel-preset-env](https://github.com/babel/babel-preset-env) and babel-preset-es2015. > `transform-es2015-literals` is already included in [@babel/preset-env](https://github.com/babel/babel/tree/master/experimental/babel-preset-env) and @babel/preset-es2015.
### Via `.babelrc` (Recommended) ### Via `.babelrc` (Recommended)

View File

@ -2,7 +2,7 @@
> This plugin will transform all `Object.setPrototypeOf` calls to a method that will do a shallow defaults of all properties. > This plugin will transform all `Object.setPrototypeOf` calls to a method that will do a shallow defaults of all properties.
**NOTE:** There are some caveats when using this plugin, see the [`babel-plugin-transform-proto-to-assign` README](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-proto-to-assign) for more information.. **NOTE:** There are some caveats when using this plugin, see the [`@babel/plugin-transform-proto-to-assign` README](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-proto-to-assign) for more information.
## Example ## Example

View File

@ -8,7 +8,7 @@ When used alongside `transform-runtime`, polyfills (by default including `Symbol
Even if `['transform-runtime', { helpers: true, polyfill: false }]` is specified, it might still break, since `helpers` come precompiled. Even if `['transform-runtime', { helpers: true, polyfill: false }]` is specified, it might still break, since `helpers` come precompiled.
In this case, we recommend importing/requiring `babel-polyfill` in the entry point of your application and using `babel-preset-env` with the `useBuiltIns` option to only include the polyfills your targets need. Alternatively, you can also import/require `core-js/modules/es6.symbol` by itself. In this case, we recommend importing/requiring `@babel/polyfill` in the entry point of your application and using `@babel/preset-env` with the `useBuiltIns` option to only include the polyfills your targets need. Alternatively, you can also import/require `core-js/modules/es6.symbol` by itself.
This transform **should be enabled only in production** (e.g., just before minifying your code) because, although it improves runtime performance, it makes warning messages more cryptic and skips important checks that happen in development mode, including propTypes. This transform **should be enabled only in production** (e.g., just before minifying your code) because, although it improves runtime performance, it makes warning messages more cryptic and skips important checks that happen in development mode, including propTypes.

View File

@ -2,15 +2,15 @@
> Externalise references to helpers and built-ins, automatically polyfilling your code without polluting globals. (This plugin is recommended in a library/tool) > Externalise references to helpers and built-ins, automatically polyfilling your code without polluting globals. (This plugin is recommended in a library/tool)
NOTE: Instance methods such as `"foobar".includes("foo")` will not work since that would require modification of existing built-ins (Use [`babel-polyfill`](http://babeljs.io/docs/usage/polyfill) for that). NOTE: Instance methods such as `"foobar".includes("foo")` will not work since that would require modification of existing built-ins (Use [`@babel/polyfill`](http://babeljs.io/docs/usage/polyfill) for that).
## Why? ## Why?
Babel uses very small helpers for common functions such as `_extend`. By default this will be added to every file that requires it. This duplication is sometimes unnecessary, especially when your application is spread out over multiple files. Babel uses very small helpers for common functions such as `_extend`. By default this will be added to every file that requires it. This duplication is sometimes unnecessary, especially when your application is spread out over multiple files.
This is where the `transform-runtime` plugin comes in: all of the helpers will reference the module `babel-runtime` to avoid duplication across your compiled output. The runtime will be compiled into your build. This is where the `transform-runtime` plugin comes in: all of the helpers will reference the module `@babel/runtime` to avoid duplication across your compiled output. The runtime will be compiled into your build.
Another purpose of this transformer is to create a sandboxed environment for your code. If you use [babel-polyfill](http://babeljs.io/docs/usage/polyfill/) and the built-ins it provides such as `Promise`, `Set` and `Map`, those will pollute the global scope. While this might be ok for an app or a command line tool, it becomes a problem if your code is a library which you intend to publish for others to use or if you can't exactly control the environment in which your code will run. Another purpose of this transformer is to create a sandboxed environment for your code. If you use [@babel/polyfill](http://babeljs.io/docs/usage/polyfill/) and the built-ins it provides such as `Promise`, `Set` and `Map`, those will pollute the global scope. While this might be ok for an app or a command line tool, it becomes a problem if your code is a library which you intend to publish for others to use or if you can't exactly control the environment in which your code will run.
The transformer will alias these built-ins to `core-js` so you can use them seamlessly without having to require the polyfill. The transformer will alias these built-ins to `core-js` so you can use them seamlessly without having to require the polyfill.
@ -20,16 +20,16 @@ See the [technical details](#technical-details) section for more information on
**NOTE - Production vs. development dependencies** **NOTE - Production vs. development dependencies**
In most cases, you should install `babel-plugin-transform-runtime` as a development dependency (with `--save-dev`). In most cases, you should install `@babel/plugin-transform-runtime` as a development dependency (with `--save-dev`).
```sh ```sh
npm install --save-dev @babel/plugin-transform-runtime npm install --save-dev @babel/plugin-transform-runtime
``` ```
and `babel-runtime` as a production dependency (with `--save`). and `@babel/runtime` as a production dependency (with `--save`).
```sh ```sh
npm install --save babel-runtime npm install --save @babel/runtime
``` ```
The transformation plugin is typically used only in development, but the runtime itself will be depended on by your deployed/published code. See the examples below for more details. The transformation plugin is typically used only in development, but the runtime itself will be depended on by your deployed/published code. See the examples below for more details.
@ -105,7 +105,7 @@ For more information, see [Regenerator aliasing](#regenerator-aliasing).
### `moduleName` ### `moduleName`
`string`, defaults to `"babel-runtime"`. `string`, defaults to `"@babel/runtime"`.
Sets the name/path of the module used when importing helpers. Sets the name/path of the module used when importing helpers.
@ -200,13 +200,13 @@ export default function (instance, Constructor) {
The `runtime` transformer plugin does three things: The `runtime` transformer plugin does three things:
* Automatically requires `babel-runtime/regenerator` when you use generators/async functions. * Automatically requires `@babel/runtime/regenerator` when you use generators/async functions.
* Automatically requires `babel-runtime/core-js` and maps ES6 static methods and built-ins. * Automatically requires `@babel/runtime/core-js` and maps ES6 static methods and built-ins.
* Removes the inline Babel helpers and uses the module `babel-runtime/helpers` instead. * Removes the inline Babel helpers and uses the module `@babel/runtime/helpers` instead.
What does this actually mean though? Basically, you can use built-ins such as `Promise`, `Set`, `Symbol`, etc., as well use all the Babel features that require a polyfill seamlessly, without global pollution, making it extremely suitable for libraries. What does this actually mean though? Basically, you can use built-ins such as `Promise`, `Set`, `Symbol`, etc., as well use all the Babel features that require a polyfill seamlessly, without global pollution, making it extremely suitable for libraries.
Make sure you include `babel-runtime` as a dependency. Make sure you include `@babel/runtime` as a dependency.
### Regenerator aliasing ### Regenerator aliasing

View File

@ -2,7 +2,7 @@
> This plugin places a `"use strict";` directive at the top of all files to enable [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode). > This plugin places a `"use strict";` directive at the top of all files to enable [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode).
This plugin may be enabled via `babel-plugin-transform-es2015-modules-commonjs`. This plugin may be enabled via `@babel/plugin-transform-es2015-modules-commonjs`.
If you wish to disable it you can either turn `strict` off or pass If you wish to disable it you can either turn `strict` off or pass
`strictMode: false` as an option to the commonjs transform. `strictMode: false` as an option to the commonjs transform.

View File

@ -1,5 +1,5 @@
if (global._babelPolyfill) { if (global._babelPolyfill) {
throw new Error("only one instance of babel-polyfill is allowed"); throw new Error("only one instance of @babel/polyfill is allowed");
} }
global._babelPolyfill = true; global._babelPolyfill = true;

View File

@ -77,7 +77,7 @@ require("@babel/core").transform("code", {
`boolean`, defaults to `false`. `boolean`, defaults to `false`.
Toggles plugins that aid in development, such as [`babel-plugin-transform-react-jsx-self`](https://babeljs.io/docs/plugins/transform-react-jsx-self/) and [`babel-plugin-transform-react-jsx-source`](https://babeljs.io/docs/plugins/transform-react-jsx-source/). Toggles plugins that aid in development, such as [`@babel/plugin-transform-react-jsx-self`](https://babeljs.io/docs/plugins/transform-react-jsx-self/) and [`@babel/plugin-transform-react-jsx-source`](https://babeljs.io/docs/plugins/transform-react-jsx-source/).
This is useful when combined with either a `babelrc.js` or [env option in a .babelrc](https://babeljs.io/docs/usage/babelrc/#env-option) configuration: This is useful when combined with either a `babelrc.js` or [env option in a .babelrc](https://babeljs.io/docs/usage/babelrc/#env-option) configuration:

View File

@ -79,7 +79,7 @@ to each file still applies, and takes precedence over any options you pass in he
## Environment variables ## Environment variables
By default `babel-node` and `babel-register` will save to a json cache in your By default `babel-node` and `@babel/register` will save to a json cache in your
temporary directory. temporary directory.
This will heavily improve with the startup and compilation of your files. There This will heavily improve with the startup and compilation of your files. There

View File

@ -63,7 +63,7 @@ function adjustImportPath(node, relativePath) {
if (helpers.list.indexOf(node.value) >= 0) { if (helpers.list.indexOf(node.value) >= 0) {
node.value = `./${node.value}`; node.value = `./${node.value}`;
} else { } else {
node.value = node.value.replace(/^babel-runtime/, relativePath) node.value = node.value.replace(/^@babel\/runtime/, relativePath);
} }
} }
@ -91,7 +91,7 @@ function buildRuntimeRewritePlugin(relativePath, helperName, dependencies) {
return; return;
} }
// replace any reference to babel-runtime and other helpers // replace any reference to @babel/runtime and other helpers
// with a relative path // with a relative path
adjustImportPath(path.get("arguments")[0].node, relativePath); adjustImportPath(path.get("arguments")[0].node, relativePath);
}, },

View File

@ -1,12 +1,12 @@
babel-standalone @babel/standalone
================ ================
babel-standalone is a standalone build of Babel for use in non-Node.js environments, including browsers. It's bundled with all the standard Babel plugins and presets, and [a build of babili (babel-minify)](http://dl.vc/babili-standalone) is optionally available too. @babel/standalone is a standalone build of Babel for use in non-Node.js environments, including browsers. It's bundled with all the standard Babel plugins and presets, and [a build of babili (babel-minify)](http://dl.vc/babili-standalone) is optionally available too.
But why?! But why?!
========= =========
It's true that using Babel through Webpack, Browserify or Gulp should be sufficient for most use cases. However, there are some valid use cases for babel-standalone: It's true that using Babel through Webpack, Browserify or Gulp should be sufficient for most use cases. However, there are some valid use cases for @babel/standalone:
- Sites like [JSFiddle](https://jsfiddle.net/), [JS Bin](https://jsbin.com/), the [REPL on the Babel site](http://babeljs.io/repl/), etc. These sites compile user-provided JavaScript in real-time. - Sites like [JSFiddle](https://jsfiddle.net/), [JS Bin](https://jsbin.com/), the [REPL on the Babel site](http://babeljs.io/repl/), etc. These sites compile user-provided JavaScript in real-time.
- Apps that embed a JavaScript engine such as V8 directly, and want to use Babel for compilation - Apps that embed a JavaScript engine such as V8 directly, and want to use Babel for compilation
@ -16,11 +16,11 @@ It's true that using Babel through Webpack, Browserify or Gulp should be suffici
Installation Installation
============ ============
There are several ways to get a copy of babel-standalone. Pick whichever one you like: There are several ways to get a copy of @babel/standalone. Pick whichever one you like:
- Use it via UNPKG: https://unpkg.com/babel-standalone@6/babel.min.js. This is a simple way to embed it on a webpage without having to do any other setup. - Use it via UNPKG: https://unpkg.com/@babel/standalone@6/babel.min.js. This is a simple way to embed it on a webpage without having to do any other setup.
- Install via Bower: `bower install babel-standalone` - Install via Bower: `bower install @babel/standalone`
- Install via NPM: `npm install --save babel-standalone` - Install via NPM: `npm install --save @babel/standalone`
- Manually grab `babel.js` and/or `babel.min.js` from the [GitHub releases page](https://github.com/Daniel15/babel-standalone/releases). Every release includes these files. - Manually grab `babel.js` and/or `babel.min.js` from the [GitHub releases page](https://github.com/Daniel15/babel-standalone/releases). Every release includes these files.
- Install it via Git: You can use the repo at https://github.com/Daniel15/babel-standalone-bower to pull a prebuilt version from Git. Note that this is generally only advised for systems that *must* pull artifacts from Git, such as Bower. - Install it via Git: You can use the repo at https://github.com/Daniel15/babel-standalone-bower to pull a prebuilt version from Git. Note that this is generally only advised for systems that *must* pull artifacts from Git, such as Bower.
@ -34,11 +34,11 @@ var input = 'const getMessage = () => "Hello World";';
var output = Babel.transform(input, { presets: ['es2015'] }).code; var output = Babel.transform(input, { presets: ['es2015'] }).code;
``` ```
When loaded in a browser, babel-standalone will automatically compile and execute all script tags with type `text/babel` or `text/jsx`: When loaded in a browser, @babel/standalone will automatically compile and execute all script tags with type `text/babel` or `text/jsx`:
```html ```html
<div id="output"></div> <div id="output"></div>
<!-- Load Babel --> <!-- Load Babel -->
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> <script src="https://unpkg.com/@babel/standalone@6/babel.min.js"></script>
<!-- Your custom script here --> <!-- Your custom script here -->
<script type="text/babel"> <script type="text/babel">
const getMessage = () => "Hello World"; const getMessage = () => "Hello World";
@ -56,7 +56,7 @@ Loading external scripts via `src` attribute is supported too:
<script type="text/babel" src="foo.js"></script> <script type="text/babel" src="foo.js"></script>
``` ```
Note that `.babelrc` doesn't work in babel-standalone, as no file system access is available. The presets and/or plugins to use **must** be specified in the options passed to `Babel.transform`. Note that `.babelrc` doesn't work in @babel/standalone, as no file system access is available. The presets and/or plugins to use **must** be specified in the options passed to `Babel.transform`.
Customisation Customisation
============= =============

View File

@ -1,7 +1,7 @@
const assert = require("assert"); const assert = require("assert");
const Babel = require("../babel"); const Babel = require("../babel");
// Basic smoke tests for babel-standalone // Basic smoke tests for @babel/standalone
describe("@babel/standalone", () => { describe("@babel/standalone", () => {
it("handles the es2015-no-commonjs preset", () => { it("handles the es2015-no-commonjs preset", () => {
const output = Babel.transform('const getMessage = () => "Hello World"', { const output = Babel.transform('const getMessage = () => "Hello World"', {

View File

@ -43,7 +43,7 @@ Type: `string`
#### options #### options
`babel-template` accepts all of the options from [babylon], and specifies `@babel/template` accepts all of the options from [babylon], and specifies
some defaults of its own: some defaults of its own:
* `allowReturnOutsideFunction` is set to `true` by default. * `allowReturnOutsideFunction` is set to `true` by default.
@ -58,7 +58,7 @@ Set this to `true` to preserve any comments from the `code` parameter.
#### Return value #### Return value
`babel-template` returns a `function` which is invoked with an optional object `@babel/template` returns a `function` which is invoked with an optional object
of replacements. See the usage section for an example. of replacements. See the usage section for an example.
[babylon]: https://github.com/babel/babylon#options [babylon]: https://github.com/babel/babylon#options

View File

@ -1,6 +1,6 @@
# @babel/traverse # @babel/traverse
> babel-traverse maintains the overall tree state, and is responsible for replacing, removing, and adding nodes. > @babel/traverse maintains the overall tree state, and is responsible for replacing, removing, and adding nodes.
## Install ## Install

View File

@ -10,7 +10,7 @@ import clone from "lodash/clone";
* The various shorthands are: * The various shorthands are:
* * `Identifier() { ... }` -> `Identifier: { enter() { ... } }` * * `Identifier() { ... }` -> `Identifier: { enter() { ... } }`
* * `"Identifier|NumericLiteral": { ... }` -> `Identifier: { ... }, NumericLiteral: { ... }` * * `"Identifier|NumericLiteral": { ... }` -> `Identifier: { ... }, NumericLiteral: { ... }`
* * Aliases in `babel-types`: e.g. `Property: { ... }` -> `ObjectProperty: { ... }, ClassProperty: { ... }` * * Aliases in `@babel/types`: e.g. `Property: { ... }` -> `ObjectProperty: { ... }, ClassProperty: { ... }`
* *
* Other normalizations are: * Other normalizations are:
* * Visitors of virtual types are wrapped, so that they are only visited when * * Visitors of virtual types are wrapped, so that they are only visited when

View File

@ -351,7 +351,7 @@ defineType("FunctionExpression", {
export const patternLikeCommon = { export const patternLikeCommon = {
typeAnnotation: { typeAnnotation: {
// TODO: babel-plugin-transform-flow-comments puts a Noop here, is there a better way? // TODO: @babel/plugin-transform-flow-comments puts a Noop here, is there a better way?
validate: assertNodeType("TypeAnnotation", "TSTypeAnnotation", "Noop"), validate: assertNodeType("TypeAnnotation", "TSTypeAnnotation", "Noop"),
optional: true, optional: true,
}, },