Compare commits

..

10 commits

Author SHA1 Message Date
d0074e4e7c one more iupdate 2026-01-10 12:23:11 -05:00
8d75f8d7d8 update 2026-01-10 12:14:29 -05:00
Barrett Ruth
b75f4afa7a
Update readme.md 2026-01-10 11:03:33 -06:00
Barrett Ruth
332b9870c7
Update readme.md 2024-05-03 17:37:21 -04:00
Barrett Ruth
39ef36f438
Merge pull request #13 from davemackintosh/patch-1
Added Svelte file type
2023-09-14 19:16:02 -04:00
Dave Mackintosh
2cbf243407
Added Svelte file type 2023-09-14 10:08:53 +01:00
d2c93deee3 fix(#11): work with failed filetypes 2023-05-15 14:53:07 -05:00
Barrett Ruth
09257b8eaf
Merge pull request #10 from KevinSilvester/main
install: create install script for windows
2023-05-03 15:37:09 -04:00
KevinSilvester
b1f21a2bab
docs: add windows build script to readme 2023-05-03 18:15:42 +01:00
Kevin Silvester
695e80acff install: create install script for windows 2023-05-03 16:01:35 +01:00
4 changed files with 34 additions and 7 deletions

View file

@ -1,7 +1,7 @@
*import-cost* *import-cost.txt* *import-cost* *import-cost.txt*
Author: Barrett Ruth <https://barrett-ruth.github.io> Author: Barrett Ruth <https://barrettruth.github.io>
Homepage: <https://github.com/barrett-ruth/import-cost.nvim> Homepage: <https://github.com/barrettruth/import-cost.nvim>
=============================================================================== ===============================================================================
INTRODUCTION *import-cost.nvim* INTRODUCTION *import-cost.nvim*
@ -10,7 +10,7 @@ import-cost.nvim displays the costs of javascript imports inside neovim.
It works with ES6 and CommonJS modules in any javascript, javascriptreact, It works with ES6 and CommonJS modules in any javascript, javascriptreact,
typescript, or typescriptreact files. typescript, or typescriptreact files.
Author: Barrett Ruth <https://barrett-ruth.github.io> Author: Barrett Ruth <https://barrettruth.com>
=============================================================================== ===============================================================================
SETUP *import-cost.setup()* SETUP *import-cost.setup()*

19
install.ps1 Normal file
View file

@ -0,0 +1,19 @@
Param(
[Parameter(Mandatory=$true)]
[ValidateSet('npm','yarn','pnpm', ErrorMessage = 'Must provide node.js package manager')]
[string]$package_manager
)
git clone 'https://github.com/wix/import-cost.git'
if (-not $?) {
Write-Host 'Failed to clone wix/import-cost' -ForegroundColor Red
exit 1
}
cd import-cost
if (-not $?) { exit 1 }
iex "$package_manager install"
cd ..
cp .\index.js .\import-cost\index.js

View file

@ -1,7 +1,11 @@
local M = {} local M = {}
local function is_ic_buf(bufnr) local function is_ic_buf(bufnr)
local filetype = vim.api.nvim_buf_get_option(bufnr, 'filetype') local ok, filetype = pcall(vim.api.nvim_buf_get_option, bufnr, 'filetype')
if not ok then
return false
end
return vim.tbl_contains(M.config.filetypes, filetype) return vim.tbl_contains(M.config.filetypes, filetype)
end end
@ -23,6 +27,7 @@ M.config = {
'javascriptreact', 'javascriptreact',
'typescript', 'typescript',
'typescriptreact', 'typescriptreact',
'svelte'
}, },
format = { format = {
byte_format = '%.1fb', byte_format = '%.1fb',

View file

@ -8,7 +8,8 @@ Display the costs of javascript imports inside neovim with the power of
## Installation ## Installation
1. Install regularly with your neovim package manager 1. Install regularly with your neovim package manager
2. Run `install.sh` with your node.js package manager to setup import-cost: - *NOTE*: pnpm is not supported because [import-cost](https://github.com/wix/import-cost) does not.
3. Run `install.sh` with your node.js package manager to setup import-cost:
```sh ```sh
sh install.sh '<your-package-manager>' sh install.sh '<your-package-manager>'
@ -20,8 +21,10 @@ may look like the following:
```lua ```lua
require('lazy').setup { require('lazy').setup {
{ {
'barrett-ruth/import-cost.nvim', 'barrettruth/import-cost.nvim',
build = 'sh install.sh yarn', build = 'sh install.sh yarn',
-- if on windows
-- build = 'pwsh install.ps1 yarn',
config = true config = true
} }
} }
@ -44,7 +47,7 @@ See `:h import-cost` for more information
thus, unavoidable) thus, unavoidable)
2. Long wait times - once again, the npm module may take quite a while before 2. Long wait times - once again, the npm module may take quite a while before
fully parsing packages fully parsing packages
3. [pnpm problems](https://github.com/barrett-ruth/import-cost.nvim/issues/5) 3. [pnpm problems](https://github.com/barrettruth/import-cost.nvim/issues/5)
## Acknowledgements ## Acknowledgements