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

extensify

v1.0.3

Published

Rewrite .jsx files without the file extension in browserify

Downloads

10

Readme

extensify Build Status

Extensify is a browserify transform that allows you to require non-standard files (such as .jsx) without specifying the file extension. It is built using the browserify-transform-tools.

  • Clean up your require calls!
  • Supports all file extensions
  • Keep the .jsx extension on your files so IDEs use correct syntax highlighting and linting
  • Works with directories - require a directory and it will automatically convert it

Purpose

When developing with React and Browserify, you ideally want the following to be possible:

  • Require JavaScript files like normal (without having to specify a file extension)
  • Have your IDE correctly identify the file as JSX so it lints and does syntax checking correctly
  • Keep your code explicit; if a file has JSX in it, you want it to have the .jsx extension

Sadly, you cannot have all these three things:

  • If you want to require a non-standard file extension such as a .jsx file, you need to include the file extension or browserify won't know what to do with it
  • If you don't have the file extension as .jsx, it is likely that your IDE won't correctly identify the source as JSX and will highlight everything as an error
  • If you name your JSX file .js your code becomes less explicit

Extensify fixes this. It allows you to require non-standard files without the extension by rewriting the require calls before browserify bundles your project together, making it possible to do this:

var HomeComponent = require("./components/home");

instead of this:

var HomeComponent = require("./components/home.jsx");

Installation

npm install --save-dev extensify

Usage

Usage is identical to any other browserify-transform-tools transforms. If you are using modules such as pkgify, aliasify or remapify make sure extensify runs after them in the transform process.

package.json

Directly in package.json:

{
  "extensify": {
    "extensions": ["jsx"]
  }
}

or using referencing a separate JS file in package.json:

{
  "extensify": "./pkgifyConfig.js"
}

Browserify API

var extensify = require("extensify");

b.transform(extensify, {
  extensions: ["jsx"]
});

Contributing

Setup

make bootstrap

Running tests

make test

Commit messages

  • Use the present tense ("Add feature" not "Added feature")
  • Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
  • Limit the first line to 72 characters or less
  • Reference issues and pull requests liberally
  • Consider starting the commit message with an applicable emoji:
    • :lipstick: :lipstick: when improving the format/structure of the code
    • :racehorse: :racehorse: when improving performance
    • :non-potable_water: :non-potable_water: when plugging memory leaks
    • :memo: :memo: when writing docs
    • :penguin: :penguin: when fixing something on Linux
    • :apple: :apple: when fixing something on Mac OS
    • :checkered_flag: :checkered_flag: when fixing something on Windows
    • :bug: :bug: when fixing a bug
    • :fire: :fire: when removing code or files
    • :green_heart: :green_heart: when fixing the CI build
    • :white_check_mark: :white_check_mark: when adding tests
    • :lock: :lock: when dealing with security
    • :arrow_up: :arrow_up: when upgrading dependencies
    • :arrow_down: :arrow_down: when downgrading dependencies

(From atom)