Resolve Javascript Modules
This plugin for Sublime Text 3 adds completions for es modules, import file paths and browser api's.
Details
Installs
- Total 1K
- Win 717
- Mac 148
- Linux 206
Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | Nov 7 | Nov 6 | Nov 5 | Nov 4 | Nov 3 | Nov 2 | Nov 1 | Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Resolve JS Modules
This plugin for Sublime Text 3 adds completions for es modules, import file paths and browser api's.
How to use
use relative imports: import * as xyz from './relative/path.js'
the import path is checked when writing xyz.
, if the file does not exist or could not be parsed the path is underlined. You can remove any error by fixing the problems and requesting the object again.
How it works
The imports are parsed from the beginning of the file, it looks at wildcard imports of the form import * as xyz from './relative/path.js'
. Then the module is parsed using a python port of esprima
and cached for later use. The implementation is fully written in python without external dependencies.
Why
There are other plugins available but I find that they have performance problems and bugs. This plugin focuses on performance and javascript specific functionality.
Regenerating browser completions
Open get_browser_completions.html
in a browser and copy the console.log to a file browser_completions.json
. You can also change the file contents to {}
to disable browser completions or add your own there.
limitations
- nested objects are not completed fully
- re-exports are ignored
- parsing is done on the main thread (but is cached)
- only supports relative paths for imports
esprima
esprima python port is found at: https://github.com/Kronuz/esprima-python esprima itself is found at: https://esprima.org/