The `common-js-file-extensions` package provides two static arrays, `code` and `config`, listing various file extensions associated with JavaScript code and configuration files, respectively. It includes extensions for a wide range of JavaScript dialects and transpiled languages, such as standard `.js`, `.mjs`, `.cjs`, as well as older or less common ones like `.coffee`, `.ts`, `.iced`, `.es6`, `.jsx`, and `.json5`. Currently at version 1.0.4, the package appears to be stable but likely no longer actively maintained, given its last update years ago (copyright 2016). Its primary utility lies in offering a comprehensive, if somewhat dated, reference for tools needing to identify JavaScript-related files without needing to parse package manifests or project configurations for specific language tooling.
npm install common-js-file-extensionsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import the `code` and `config` arrays and iterate through the listed extensions. It also includes a basic example of checking a file's extension against these lists.
For ES Modules, use `import extensions from 'common-js-file-extensions'; const { code, config } = extensions;`. For CommonJS, `const { code, config } = require('common-js-file-extensions');` is correct.Developers should filter or curate the `code` and `config` arrays to include only the extensions relevant to their specific project or environment if broad inclusion is not desired.
For applications requiring an up-to-date list of JavaScript file extensions, consider manually curating a list or finding a more actively maintained library, though for its specific historical data, this package remains functional.
Import the module's default export first, then destructure from it: `import extensions from 'common-js-file-extensions'; const { code, config } = extensions;`If your project is ESM-first, use `import` syntax: `import extensions from 'common-js-file-extensions'; const { code, config } = extensions;`. If you must use `require` in an ESM file, you might need to use `createRequire` from the `module` built-in module, but it's generally recommended to stick to `import`.No dependency data recorded yet.