JSPM

es-deps-from-string

1.0.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q75742F
  • 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)

// esDepsFromString :: String -> Array[String]

input

Required
Type: String

Your JavaScript code.

  • es-deps — ECMAScript 2015+/CommonJS module dependencies array
  • es-deps-resolved — ECMAScript 2015+/CommonJS module dependencies resolved array
  • es-dep-unit — Constructor for ECMAScript 2015+/CommonJS dependency unit Object { requested, from, resolved }
  • es-deps-deep — ECMAScript 2015+/CommonJS module dependencies resolved in depth
  • es-dep-kit — ECMAScript 2015+/CommonJS module dependencies helpers kit

License

MIT © Vladimir Starkov