Package Exports
- es-deps-from-string
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 (es-deps-from-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
es-deps-from-string
ECMAScript 2015+/CommonJS module dependencies array from string
This package handles es2015+ modules, and 'cause CommonJS won't go away anytime soon, it also
takes care of non-dynamic requires.
Install
npm install --save es-deps-from-stringUsage
import esDepsFromString from 'es-deps-from-string';
const input = `
// es2015+ modules
import out from 'out';
import local from './local';
console.log('modules');
// CommonJS modules
var qName = require('q');
var fsName = require('fs');
var localName = require('./local-cjs');
var n = 1;
require('yo' + 1); // dynamic requires wont work
require('globalImport');
console.log('cjs');`;
esDepsFromString(input); /* [
'out', './local',
'q', 'fs', './local-cjs', 'globalImport',
] */API
esDepsFromString(input)
input
Required
Type: String
Your JavaScript code.
License
MIT © Vladimir Starkov