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

@kdujs/babel-preset-app

v5.0.10

Published

babel-preset-app for kdu-cli

Downloads

45

Readme

@kdujs/babel-preset-app

This is the default Babel preset used in all Kdu CLI projects. Note: this preset is meant to be used exclusively in projects created via Kdu CLI and does not consider external use cases.

Included Features

@babel/preset-env

preset-env automatically determines the transforms and polyfills to apply based on your browser target. See Browser Compatibility section in docs for more details.

  • modules: false
    • auto set to 'commonjs' in Jest tests
  • useBuiltIns: 'usage'
  • targets:
  • Includes Promise polyfill by default so that they are usable even in non-transpiled dependencies (only for environments that need it)

Stage 3 or Below

Only the following stage 3 or below features are supported (object rest spread is supported as part of preset-env):

If you need additional stage 3 or below features, you need to install and configure it yourself.

Kdu JSX support

@babel/plugin-transform-runtime

transform-runtime avoids inlining helpers in every file. This is enabled for helpers only, since polyfills are handled by babel-preset-env.

Options

  • All options from @babel/preset-env are supported, with some of them having smarter defaults.

modules

  • Default:
    • false when building with webpack
    • 'commonjs' when running tests in Jest.

Explicitly set modules option for babel-preset-env. See babel-preset-env docs for more details.

targets

Explicitly set targets option for babel-preset-env. See babel-preset-env docs for more details.

useBuiltIns

  • Default: 'usage'
  • Allowed values: 'usage' | 'entry' | false

Explicitly set useBuiltIns option for babel-preset-env.

The default value is 'usage', which adds imports to polyfills based on the usage in transpiled code. For example, if you use Object.assign in your code, the corresponding polyfill will be auto-imported if your target environment does not supports it.

If you are building a library or web component instead of an app, you probably want to set this to false and let the consuming app be responsible for the polyfills.

Note that the usage detection does not apply to your dependencies (which are excluded by cli-plugin-babel by default). If one of your dependencies need polyfills, you have a few options:

  1. If the dependency is written in an ES version that your target environments do not support: Add that dependency to the transpileDependencies option in kdu.config.js. This would enable both syntax transforms and usage-based polyfill detection for that dependency.

  2. If the dependency ships ES5 code and explicitly lists the polyfills needed: you can pre-include the needed polyfills using the polyfills option for this preset.

  3. If the dependency ships ES5 code, but uses ES6+ features without explicitly listing polyfill requirements (e.g. Kdutify): Use useBuiltIns: 'entry' and then add import '@babel/polyfill' to your entry file. This will import ALL polyfills based on your browserslist targets so that you don't need to worry about dependency polyfills anymore, but will likely increase your final bundle size with some unused polyfills.

See @babel/preset-env docs for more details.

polyfills

  • Default: ['es.array.iterator', 'es.promise', 'es.object.assign', 'es.promise.finally']

A list of core-js polyfills to pre-include when using useBuiltIns: 'usage'. These polyfills are automatically excluded if they are not needed for your target environments.

Use this option when you have 3rd party dependencies that are not processed by Babel but have specific polyfill requirements (e.g. Axios and Kdux require Promise support).

jsx

  • Default: true.

Set to false to disable JSX support. Or you can toggle @kdujs/babel-preset-jsx (or @kdujs/babel-plugin-jsx for Kdu 3 projects) features here.

loose

  • Default: false.

Setting this to true will generate code that is more performant but less spec-compliant.

entryFiles

  • Default: []

Multi page repo use entryFiles to ensure inject polyfills to all entry file.