babel-plugin-pure-calls-annotation
TypeScript icon, indicating that this package has built-in type declarations

0.4.2 • Public • Published

babel-plugin-pure-calls-annotation

test codecov npm dep

Automated annotate /*#__PURE__*/ to call expression which in variable declarator, assignment expression, arguments of call expression and other expressions as values

Purpose

help to annotate /*#__PURE__*/ to drop dead code in Webpack for uglyfiy and tree shaking

Will transform

export const call = (s) => {
    return "call" + s
}

export const stringA = call("a")
export const stringB = (() => call("b"))()

to

export const call = (s) => {
    return "call" + s
}

export const stringA = /*#__PURE__*/call("a")
export const stringB = /*#__PURE__*/(() => call("b"))()

Notice:

code like below will not be pure call

const a = setInterval(() => {
    console.log(a)
}, 1000)

Readme

Keywords

none

Package Sidebar

Install

npm i babel-plugin-pure-calls-annotation

Weekly Downloads

65

Version

0.4.2

License

WTFPL

Unpacked Size

26.6 kB

Total Files

9

Last publish

Collaborators

  • morlay_null