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 ๐Ÿ™

ยฉ 2025 โ€“ Pkg Stats / Ryan Hefner

@putout/plugin-esm

v2.3.0

Published

๐ŸŠPutout plugin improves ability to transform ESM code

Downloads

13,050

Readme

@putout/plugin-esm NPM version

The static import statement is used to import read only live bindings which are exported by another module. The imported bindings are called live bindings because they are updated by the module that exported the binding, but cannot be re-assigned by the importing module.

(c) MDN

๐ŸŠPutout plugin adds ability to transform to new Node.js API and apply best practices.

Install

npm i putout @putout/plugin-esm -D

Rules

Config

{
    "rules": {
        "esm/apply-export-from": "on",
        "esm/declare-imports-first": "on",
        "esm/group-imports-by-source": "on",
        "esm/merge-duplicate-imports": "on",
        "esm/remove-quotes-from-import-assertions": "on",
        "esm/remove-empty-export": "on",
        "esm/remove-empty-import": ["on", {
            "ignore": []
        }],
        "esm/sort-imports-by-specifiers": "on"
    }
}

apply-export-from

The export declaration is used to export values from a JavaScript module.

(c) MDN

Check out in ๐ŸŠPutout Editor.

โŒ Example of incorrect code

import * as ns_1 from 'x';

export {
    ns_1 as ns,
};

โœ… Example of correct code

export * as ns from 'x';

declare-imports-first

Check out in ๐ŸŠPutout Editor. For CommonJS use nodejs/declare-after-require.

โŒ Example of incorrect code

const [arg] = process.argv;
import esbuild from 'esbuild';

โœ… Example of correct code

import esbuild from 'esbuild';

const [arg] = process.argv;

group-imports-by-source

Group order:

  • โœ… builtins;
  • โœ… external;
  • โœ… hashed;
  • โœ… internal;

Checkout in ๐ŸŠPutout Editor.

โŒ Example of incorrect code

import fs from 'node:fs';
import {lodash} from 'lodash';
import react from 'react';
import d from '../hello.js';
import ss from '../../bb/ss.js';
import b from './ss.js';
import parse from '#parser';

const c = 5;

โœ… Example of correct code

import fs from 'node:fs';
import react from 'react';
import {lodash} from 'lodash';
import parse from '#parser';
import b from './ss.js';
import d from '../hello.js';
import ss from '../../bb/ss.js';

const c = 5;

merge-duplicate-imports

join

To disable use:

{
    "rules": {
        "esm/merge-duplicate-imports-join": "off"
    }
}

โŒ Example of incorrect code

import test from 'supertape';
import {stub} from 'supertape';

โœ… Example of correct code

import test, {stub} from 'supertape';

rename

Checkout in ๐ŸŠPutout Editor.

To disable use:

{
    "rules": {
        "esm/merge-duplicate-imports-rename": "off"
    }
}

โŒ Example of incorrect code

import putout from './putout.js';
import all from './putout.js';
import x from './putout.js';

console.log(all);
console.log(x);

โœ… Example of correct code

import putout from './putout.js';

console.log(putout);
console.log(putout);

remove-empty-export

-export {};

remove-empty-import

-import 'abc';

remove-quotes-from-import-assertions

Checkout in ๐ŸŠPutout Editor.

โŒ Example of incorrect code

import json from './mod.json' with { type: 'json' };

โœ… Example of correct code

import json from './mod.json' with { type: 'json' };

sort-imports-by-specifiers

Checkout in ๐ŸŠPutout Editor.

โŒ Example of incorrect code

import {
    a,
    b,
    c,
    d,
} from 'd';
import a1 from 'a1';

โœ… Example of correct code

import a1 from 'a1';
import {
    a,
    b,
    c,
    d,
} from 'd';

convert-assert-to-with

This feature would ideally use the with keyword to denote attributes, but there are existing implementations based on a previous version of the proposal using the assert keyword. Due to potential web compatibility risks, the proposal still includes assert marked as deprecated. Usage of the old syntax is discouraged, and its removal is being investigated.

(c) tc39

Check out in ๐ŸŠPutout Editor.

โŒ Example of incorrect code

import json from './foo.json' assert { type: 'json' };

import('foo.json', {
    assert: {
        type: 'json',
    },
});

โœ… Example of correct code

import json from './foo.json' with { type: 'json' };

import('foo.json', {
    with: {
        type: 'json',
    },
});

License

MIT