** PRE-ALPHA **
Minor mode for displaying JavaScript module sizes inline.
This is an Emacs port of the Import Cost plugin for Visual Studio Code.
emacs >=24.4
node >=8.0.0
First clone this project:
$ git clone git@github.com:madeleinedaly/import-cost.git
Then add something like this to your Emacs config:
(add-to-list 'load-path "path/to/import-cost.el")
(require 'import-cost)
;; you can access config options once the package has loaded:
(with-eval-after-load 'import-cost
(setq import-cost-bundle-size-decoration 'gzipped))
You can enable import-cost-mode
for the current buffer interactively with M-x import-cost-mode
.
Or hook into your preferred JavaScript modes:
(add-hook 'js2-mode-hook #'import-cost-mode)
(add-hook 'rjsx-mode-hook #'import-cost-mode)
The following variables are customizable (see M-x customize-group import-cost
):
Upper size limit, in KB, that will count a package as a small package.
- Default:
50
Upper size limit, in KB, that will count a package as a medium package. Any package size above this limit will be considered large.
- Default:
100
Decoration color for small packages.
- Default:
"#7cc36e"
Decoration color for medium packages.
- Default:
"#7cc36e"
Decoration color for large packages.
- Default:
"#d44e40"
File extensions to be parsed by the TypeScript parser.
- Default:
'("\\.tsx?$")
File extensions to be parsed by the JavaScript parser.
- Default:
'("\\.jsx?$")
Which bundle size to display.
-
Default:
'both
-
Possible values:
'both
'minified
'gzipped
The name of the file in which import size decoration data gets persisted across sessions.
- Default:
"import-cost.cache"
The path to the file where import size decoration data gets persisted across sessions.
- Default:
user-emacs-directory
Lighter used in the mode-line while import-cost-mode
is active.
- Default:
" ₵"
MIT