Skip to content
This repository has been archived by the owner on Feb 13, 2021. It is now read-only.

SpringType node module dependency resolution implementation. Used by SpringType Bundler/Compiler.

Notifications You must be signed in to change notification settings

springtype-org/st-node-resolve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

st-node-resolve

Resolves dependencies in JavaScript/TypeScript projects. Useful for bundlers and compilers. Based on enhanced-resolve.

@springtype/st-node-resolve detects which module file is the entry file to resolve to for any type of require(...) import(...) and import ... from "..." imports (basically what Node.js does internally).

It handles node_modules file-system hierarchy, relative imports, non-code file imports, deep imports and organization module imports well.

Usage

    import { resolve } from "@springtype/st-node-resolve";

    const moduleFile = await resolve(
        '@webcomponents/custom-elements/src/native-shim', './__test__/fixture/submodule/some-import.ts'
    );

    // -> ./__test__/fixture/submodule/node_modules/@webcomponents/custom-elements/src/native-shim.js

Test

To run the tests, enter the directories: __test__/fixture and __test__/fixture/submodule and run: yarn to install the dependencies. These tests are based on jest but are in fact real-world / end-2-end tests.

About

SpringType node module dependency resolution implementation. Used by SpringType Bundler/Compiler.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published