@ava/babel-preset-stage-4

中文文档
4.0.0发布于 2019/08/12MIT近 30 天下载 24.6万

Efficiently applies the minimum of transforms to run stage 4 code on Node.js 6, 8 and 10

原始使用文档
文档目录4 节
  1. Install
  2. Usage
  3. Options
  4. Supported proposals

@ava/babel-preset-stage-4 Build Status

Babel preset for use with AVA

Aspires to bring finished ECMAScript proposals to AVA's test and helper files.

Efficiently applies the minimum of transforms to run the latest JavaScript syntax on Node.js 8, 10 and 12.

Built-ins are not added or extended, so features like Proxies, Array.prototype.includes or String.prototype.padStart will only be available if the Node.js version running the tests supports it. Consult node.green for details.

Sometimes a particular feature is mostly implemented in Node.js. In that case transforms are not applied.

Not all proposals can be supported via Babel transforms, see below for details. Babel may require "syntax" plugins in order to parse certain files. These plugins should be applied explicitly since this preset may not include them.

Install

$ npm install --save @ava/babel-preset-stage-4

Usage

Add @ava/stage-4 to your Babel presets.

Options

For more information on setting options for a preset, refer to the preset options documentation.

modules

By default this preset transform ES2015 modules to CommonJS. Set to false to disable this behavior. Other values are ignored.

Supported proposals

ProposalSupported
Array.prototype.includesNo
Object.values/Object.entriesNo
String paddingNo
Object.getOwnPropertyDescriptorsNo
Trailing commas in function parameter lists and callsYes
Shared memory and atomicsNo
Lifting template literal restrictionNo
s (dotAll) flag for regular expressionsYes
RegExp named capture groupsNo
RegExp Lookbehind AssertionsNo
RegExp Unicode Property EscapesNo
Promise.prototype.finallyNo
Asynchronous IterationPartially†
Optional catch bindingYes
JSON supersetNo
Symbol.prototype.descriptionNo
Function.prototype.toString revisionNo
Object.fromEntriesNo
Well-formed JSON.stringifyNo
String.prototype.{trimStart,trimEnd}No
Array.prototype.{flat,flatMap}No
String.prototype.matchAllNo
import()Yes
Promise.allSettledNo

† @babel/plugin-proposal-async-generator-functions relies on Symbol.asyncIterator, which AVA does not polyfill for you.

版本与发布记录

@ava/babel-preset-stage-4 共发布 14 个版本,首次发布于 2017/01/20;过去 12 个月发布了 0 个版本。

版本发布日期距今
4.0.0latest2019/08/127 年前
3.0.02019/04/207 年前
2.0.02018/08/298 年前
2.0.0-beta.92018/08/128 年前
2.0.0-beta.82018/06/138 年前
2.0.0-beta.72018/05/318 年前

关于 @ava/babel-preset-stage-4 的常见问题

@ava/babel-preset-stage-4 是什么?

Efficiently applies the minimum of transforms to run stage 4 code on Node.js 6, 8 and 10

如何安装 @ava/babel-preset-stage-4?

在项目目录运行 npm install @ava/babel-preset-stage-4,或使用 pnpm add / yarn add / bun add。

@ava/babel-preset-stage-4 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ava__babel-preset-stage-4 是否存在。

@ava/babel-preset-stage-4 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=8.9.4 <9 || >=10.0.0 <11 || >=12.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ava/babel-preset-stage-4 可以商用吗?

@ava/babel-preset-stage-4 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ava/babel-preset-stage-4 的下载量有多少?

根据 npm 官方下载统计,@ava/babel-preset-stage-4 在 2026/10/07 – 2026/11/05 这 30 天内被下载 245,716 次,日均约 8,191 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ava/babel-preset-stage-4 还在维护吗?

最新版本 4.0.0 发布于 2019/08/12(7 年前);至今共发布 14 个版本,其中过去 12 个月发布了 0 个;首次发布于 2017/01/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。