[![npm version](https://badge.fury.io/js/%40gustavnikolaj%2Ffind-relations-in-js.svg)](https://www.npmjs.com/package/@gustavnikolaj/find-relations-in-js) ![CI Build status](https://github.com/gustavnikolaj/find-relations-in-js/workflows/ci/badge.svg) [![C

Usage no npm install needed!

<script type="module">
  import gustavnikolajFindRelationsInJs from 'https://cdn.skypack.dev/@gustavnikolaj/find-relations-in-js';


find relations in javascript

npm version CI Build status Coverage Status

$ npm install @gustavnikolaj/find-relations-in-js

Using the acorn tokenizer it will enumerate files that have been referenced from esm import or commonjs require.

const findRelationsInJs = require("@gustavnikolaj/find-relations-in-js");

  import foo from './bar.js';
`); /* => [
    type: 'import',
    value: './bar.js',
    source: 'import foo from \'./bar.js\'',
    offset: { start: 3, end: 29 }
    type: 'require',
    value: './baz',
    source: 'require(\'./baz\')',
    offset: { start: 33, end: 57 }
] */