@browserify/acorn5-object-spread

中文文档
5.0.1发布于 2018/01/07MITCommonJS近 30 天下载 4569

Support for rest and spread properties in acorn 5

原始使用文档
文档目录3 节
  1. Usage
  2. Differences to acorn-object-rest-spread
  3. License

Spread and rest properties support in acorn 5

NPM version

This is plugin for Acorn - a tiny, fast JavaScript parser, written completely in JavaScript.

Fork of https://github.com/adrianheine/acorn5-object-spread to support old versions of node until acorn adopts rest-spread

It implements support for spread and rest properties as defined in the stage 3 proposal Object Rest/Spread Properties for ECMAScript.

Usage

You can use this module directly in order to get an Acorn instance with the plugin installed:

var acorn = require('@browserify/acorn5-object-spread-es3');

Or you can use inject.js for injecting the plugin into your own version of Acorn like this:

var acorn = require('@browserify/acorn5-object-spread/inject')(require('./custom-acorn'));

Then, use the plugins option whenever you need to support object spread or rest while parsing:

var ast = acorn.parse(code, {
  plugins: { objectSpread: true }
});

Differences to acorn-object-rest-spread

acorn-object-rest-spread is another acorn plugin implementing the same spec. There are some differences, though:

  • acorn-object-rest-spread overwrites acorn's parseObj with a modified copy from acorn 4, so that an acorn instance with that plugin cannot for example parse ({async, foo}) and wrongly complains about duplicate property names in patterns.
  • acorn-object-rest-spread emits SpreadElements with a non-standard value property
  • acorn-object-rest-spread emits SpreadElements in arrow function argument patterns and nested object patterns were it should emit RestElements
  • acorn-object-rest-spread doesn't check for invalid trailing commas in rest properties

License

This plugin is issued under the MIT license.

With <3 by UXtemple.

版本与发布记录

@browserify/acorn5-object-spread 共发布 1 个版本,首次发布于 2018/01/07;过去 12 个月发布了 0 个版本。

版本发布日期距今
5.0.1latest2018/01/078 年前

关于 @browserify/acorn5-object-spread 的常见问题

@browserify/acorn5-object-spread 是什么?

Support for rest and spread properties in acorn 5

如何安装 @browserify/acorn5-object-spread?

在项目目录运行 npm install @browserify/acorn5-object-spread,或使用 pnpm add / yarn add / bun add。

@browserify/acorn5-object-spread 支持 TypeScript 吗?

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

@browserify/acorn5-object-spread 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@browserify/acorn5-object-spread 可以商用吗?

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

@browserify/acorn5-object-spread 的下载量有多少?

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

@browserify/acorn5-object-spread 还在维护吗?

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