npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@lite-v3/babel-preset

v1.4.0

Published

Babel preset for tokopedia web services

Downloads

3,061

Readme

@lite-v3/babel-preset

A babel preset for tokopedia web services and packages

The standard preset for web services and packages in tokopedia environment.

Install

$ npm install --save-dev @lite-v3/babel-preset

Or using Yarn

$ yarn add --dev @lite-v3/babel-preset

Usage

Via .babelrc (Recommended)

.babelrc

{
  "presets": ["@lite-v3/babel-preset"]
}

Via CLI

$ babel script.js --presets @lite-v3/babel-preset

Via Node API

require('@babel/core').transform('code', {
  presets: ['@lite-v3/babel-preset'],
});

Options

modules

Enable transformation of ES module syntax to another module type. Setting this to false will preserve ES modules. Use this only if you intend to ship native ES Modules to browsers. If you are using a bundler with Babel, the default modules: "auto" is always preferred.

useBuiltIns and corejs

This option only has an effect when used alongside useBuiltIns: usage or useBuiltIns: entry, and ensures @babel/preset-env injects the polyfills supported by your core-js version. It is recommended to specify the minor version otherwise "3" will be interpreted as "3.0" which may not include polyfills for the latest features.

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "corejs": 3,
        "useBuiltIns: "entry"
      }
    ]
  ]
}

targets

This module uses @babel/preset-env to target specific environments.

Please refer to @babel/preset-env#targets for a list of available options.

For a list of browsers please see browserlist.

You may override our default list of targets by providing your own targets key.

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "targets": {
          "chrome": 50,
          "ie": 11,
          "firefox": 45
        }
      }
    ]
  ]
}

The following transpiles only for Node v6.

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "targets": {
          "node": 6
        }
      }
    ]
  ]
}

exclude

This option is useful for "blacklisting" a transform like @babel/plugin-transform-regenerator if you don't use generators and don't want to include regeneratorRuntime (when using useBuiltIns) or for using another plugin like fast-async instead of Babel's async-to-gen.

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "exclude": ["es.promise", "es.promise.finally", "transform-typeof-symbol"]
      }
    ]
  ]
}

service

This option will enable default babel plugins that will be compatible for web services. Set to true if you are service author, otherwise the plugins are only intended for packages/pluggbales.

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "service": true
      }
    ]
  ]
}

modern

modern option will allow you to build with presets that is intended only for modern browsers. This option requires service to be true. This is useful for differential serving.

style

style option is only for babel-plugin-imports especially for packages or services that using antd for its design system. Please refer to this link for more details about the option.

useAntd

Provide presets and its corresponding plugins to support antd design system. Please refer to Receipts to how to use it, and presets and plugins to know more about which plugins/preset that be provided.

useTypeScript

Provide presets and its corresponding plugins to support TypeScript. Please refer to Receipts to how to use it, and presets and plugins to know more about which plugins/preset that be provided.

useReact

Provide presets and its corresponding plugins to support React. Please refer to Receipts to how to use it, and presets and plugins to know more about which plugins/preset that be provided.

useGraphQL

Provide presets and its corresponding plugins to support GraphQL. Please refer to Receipts to how to use it, and presets and plugins to know more about which plugins/preset that be provided.

debug

You may be interested to log non-throwing-errors or warnings by setting debug to true.

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "debug": true
      }
    ]
  ]
}

runtimeHelpers

Toggles whether or not inlined Babel helpers (classCallCheck, extends, etc.) are replaced with calls to moduleName. The default is true.

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "runtimeHelpers": false
      }
    ]
  ]
}

runtimeRegenerator

Toggles whether or not generator functions are transformed to use a regenerator runtime that does not pollute the global scope. The default is true.

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "runtimeRegenerator": false
      }
    ]
  ]
}

Presets

| Types | Presets| |:---: |:---:| | default | @babel/preset-env| | React | @babel/preset-react| | TyepScript | @babel/preset-typescript|

Plugins

Client (Service)

Legacy

  • babel-plugin-macros
  • babel-plugin-lodash
  • babel-plugin-console
  • @babel/plugin-proposal-decorators
  • @babel/plugin-proposal-class-properties
  • @babel/plugin-proposal-private-methods
  • @babel/plugin-proposal-export-default-from
  • @babel/plugin-proposal-export-namespace-from
  • @babel/plugin-proposal-object-rest-spread
  • @babel/plugin-proposal-nullish-coalescing-operator
  • @babel/plugin-transform-runtime
  • @babel/plugin-transform-destructuring
  • @babel/plugin-syntax-dynamic-import
  • @babel/plugin-syntax-async-generators

Modern

  • babel-plugin-macros
  • babel-plugin-lodash
  • babel-plugin-console
  • @babel/plugin-proposal-numeric-separator
  • @babel/plugin-proposal-nullish-coalescing-operator
  • @babel/plugin-proposal-export-default-from
  • @babel/plugin-syntax-dynamic-import
  • @babel/plugin-transform-runtime

React

  • @loadable/babel-plugin
  • babel-plugin-emotion
  • react-hot-loader/babel
  • babel-plugin-transform-react-remove-prop-types

Client (Package or Pluggables)

  • @babel/plugin-proposal-decorators
  • @babel/plugin-proposal-private-methods
  • @babel/plugin-proposal-class-properties
  • @babel/plugin-proposal-export-default-from
  • @babel/plugin-proposal-export-namespace-from
  • @babel/plugin-proposal-object-rest-spread
  • @babel/plugin-proposal-optional-chaining
  • @babel/plugin-proposal-nullish-coalescing-operator
  • @babel/plugin-syntax-async-generators
  • @babel/plugin-syntax-dynamic-import
  • @babel/plugin-transform-destructuring
  • @babel/plugin-transform-runtime
  • babel-plugin-lodash

Server (Service)

Base

  • babel-plugin-macros
  • babel-plugin-lodash
  • babel-plugin-console
  • @babel/plugin-proposal-decorators
  • @babel/plugin-proposal-class-properties
  • @babel/plugin-proposal-private-methods
  • @babel/plugin-proposal-export-default-from
  • @babel/plugin-proposal-export-namespace-from
  • @babel/plugin-proposal-object-rest-spread
  • @babel/plugin-proposal-nullish-coalescing-operator
  • @babel/plugin-proposal-optional-chaining
  • @babel/plugin-transform-runtime
  • @babel/plugin-transform-destructuring
  • @babel/plugin-syntax-dynamic-import
  • @babel/plugin-syntax-async-generators

React

  • babel-plugin-emotion
  • @babel/plugin-transform-react-constant-elements
  • @babel/plugin-transform-react-inline-elements
  • babel-plugin-transform-react-remove-prop-types
  • @loadable/babel-plugin

Server (Packages or Pluggables)

  • @babel/plugin-proposal-decorators
  • @babel/plugin-proposal-private-methods
  • @babel/plugin-proposal-class-properties
  • @babel/plugin-proposal-export-default-from
  • @babel/plugin-proposal-export-namespace-from
  • @babel/plugin-proposal-object-rest-spread
  • @babel/plugin-proposal-optional-chaining
  • @babel/plugin-proposal-nullish-coalescing-operator
  • @babel/plugin-syntax-async-generators
  • @babel/plugin-syntax-dynamic-import
  • @babel/plugin-transform-destructuring
  • @babel/plugin-transform-runtime
  • babel-plugin-lodash

Receipts

Using TypeScript and React for your service

.babelrc

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "service": true,
        "useReact": true,
        "useTypeScript": true,
      }
    ]
  ]
}

Using antd for service

.babelrc

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "service": true,
        "useReact": true,
        "useAntd": true,
      }
    ]
  ]
}

Package for Node environment

.babelrc

{
  "presets": [
    [
      "@lite-v3/babel-preset",
      {
        "modules": "commonjs",
      }
    ]
  ]
}