Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@masx200/acorn-parse-escodegen-generate-esm-broweser

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@masx200/acorn-parse-escodegen-generate-esm-broweser

在浏览器中使用 acorn和escodegen 来 进行 javascript 源代码 和 抽象语法树的相互转换的ES模块

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

acorn-parse-escodegen-generate-esm-broweser

可以在浏览器中运行,不需要nodejs环境,压缩后体积为155KB

使用 acornescodegen 来 进行 javascript 源代码 和 抽象语法树的相互转换的ES模块,

escodegenestraverseesutils模块都从commonjs模块改成ES模块,acorn使用自带的ES模块

并且使用rollup 打包,并开启tree-shaking和使用terser代码压缩

依赖的模块

{
  "dependencies": {
    "acorn": "^6.2.1",
    "escodegen": "^1.11.1",
    "estraverse": "^4.2.0",
    "esutils": "^2.0.3"
  }
}

获取已压缩模块

ES 模块

从 cdn 获取

https://cdn.jsdelivr.net/gh/masx200/acorn-parse-escodegen-generate-esm-broweser@latest/dist/acorn-parse-escodegen-generate.esm.min.js

<script type="module">
  import {
    parse,
    generate
  } from "https://cdn.jsdelivr.net/gh/masx200/acorn-parse-escodegen-generate-esm-broweser@latest/dist/acorn-parse-escodegen-generate.esm.min.js";
</script>

安装模块

npm install --save https://github.com/masx200/acorn-parse-escodegen-generate-esm-broweser.git

或者

yarn add https://github.com/masx200/acorn-parse-escodegen-generate-esm-broweser.git

import { parse, generate } from "acorn-parse-escodegen-generate-esm-broweser";
var code = "var b=3";
var ast = parse(code);
var text = generate(ast);

A small, fast, JavaScript-based JavaScript parser

https://github.com/acornjs/acorn

https://npm.taobao.org/package/acorn

ECMAScript code generator

https://npm.taobao.org/package/escodegen

https://github.com/estools/escodegen

FAQs

Package last updated on 11 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc