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

babel-preset-cozy-app

v2.1.0

Published

Babel preset for Cozy Application (Cozy Cloud)

Downloads

5,960

Readme

What's babel-preset-cozy-app?

A shareable configuration for Cozy Applications or Scripts.

This package is a Babel preset already used by create-cozy-app.

To install:

yarn add --dev babel-preset-cozy-app

Usage with a Create Cozy App projects

If you started your project using create-cozy-app, you don't need to do anything, you should already have a .babelrc configured to used this preset.

Usage with other projects

If you want to use this preset, you first need to have Babel installed (cf documentation).

Then, in a file named .babelrc (the Babel configuration file), you can use the preset using the following way:

{
    "presets": ["cozy-app"]
}

Options

node (boolean): false by default

By default, this babel preset targets browsers but you can target node by using the node option:

{
    "presets": [
        ["cozy-app", {
            "node": true
        }]
    ]
}

react (boolean): true by default

By default, this babel preset uses the react preset (babel-preset-react) but you can disable this behaviour with the react option to false as following:

{
    "presets": [
        ["cozy-app", {
            "react": false
        }]
    ]
}

transformRegenerator (boolean): true by default (for browsers only)

By default, this babel preset uses babel-plugin-transform-runtime to transform regenerator functions on the runtime. But sometimes (not always) it could break CSPs due to some eval usage so you can disable this behaviour with the transformRegenerator option to false as following:

{
    "presets": [
        ["cozy-app", {
            "transformRegenerator": false
        }]
    ]
}

Lib option

When the lib option is activated, import/export nodes are not transpiled. This gives the downstream bundler the ability to prune unused module away. It works by configuring babel-preset-env with {"modules": false}.

Advanced

You can have control on the options passed to babel-preset-env and babel-plugin-transform-runtime:

  • presetEnv will be passed to babel-preset-env
  • transformRuntime will be passed to babel-plugin-transform-runtime
{
  "presets": [
    ["cozy-app", {
      "presetEnv": { "modules": false },
      "transformRuntime": { "helpers": true }
    }]
  ]
}

In this case, we do not want preset-env to touch to import/export and want the inlined Babel helpers to be replaced by imports from babel-runtime.

See the options on the official docs :

https://babeljs.io/docs/en/babel-preset-env#modules https://babeljs.io/docs/en/babel-plugin-transform-runtime#helpers

Community

What's Cozy?

Cozy is a platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one's tracking you.

Get in touch

You can reach the Cozy Community by:

License

babel-preset-cozy-app is distributed under the MIT license.