JSPM

es-deps-from-string

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q74507F
  • License MIT

ECMAScript 2015+/CommonJS module dependencies array from string

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

NPM version Build Status Coveralls Status Dependency Status

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-string

Usage

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