Package Exports
- js-module-formats
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (js-module-formats) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Javascript Module Formats
Microlibrary to detect different types of javascript modules formats from a javascript file.
Goals, Overview & Features
With the new ES Module syntax arrival, projects will comence the transition to write modules in ES format, and in some cases, rewrite/adjust modules to be ES module. As a result, complex applications might ended up having multiple module formats in their application, while the proper transpile process will be necessary. This microlibrary will help you to detect what type of module does a javascript file defines, and take the appropiate steps based on that information.
Installation
Install using npm:
$ npm install js-module-formatsUsage
Detect the module format of a file called file.js:
var detect = require('js-module-formats').detect,
console.log(detect(__dirname + '/file.js')); // output: `amd` or `yui` or `es` or `undefined`Note: ES modules without import or export statements will not be detected.
License
This software is free to use under the Yahoo! Inc. BSD license. See the LICENSE file for license text and copyright information.


