From 695e80acff0bbe20286ef368cfec7bc14150e53b Mon Sep 17 00:00:00 2001 From: Kevin Silvester Date: Wed, 3 May 2023 16:01:35 +0100 Subject: [PATCH 1/8] install: create install script for windows --- install.ps1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 install.ps1 diff --git a/install.ps1 b/install.ps1 new file mode 100644 index 0000000..7a6cf4f --- /dev/null +++ b/install.ps1 @@ -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 + From b1f21a2bab6daae692460b28895291db38306139 Mon Sep 17 00:00:00 2001 From: KevinSilvester <56918431+KevinSilvester@users.noreply.github.com> Date: Wed, 3 May 2023 18:15:42 +0100 Subject: [PATCH 2/8] docs: add windows build script to readme --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 01deb1f..f5e03f2 100644 --- a/readme.md +++ b/readme.md @@ -22,6 +22,8 @@ require('lazy').setup { { 'barrett-ruth/import-cost.nvim', build = 'sh install.sh yarn', + -- if on windows + -- build = 'pwsh install.ps1 yarn', config = true } } From d2c93deee35fa4042fde28719ddcbad664544fcf Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 15 May 2023 14:53:07 -0500 Subject: [PATCH 3/8] fix(#11): work with failed filetypes --- lua/import-cost.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lua/import-cost.lua b/lua/import-cost.lua index 19d252d..f54d6f7 100644 --- a/lua/import-cost.lua +++ b/lua/import-cost.lua @@ -1,7 +1,11 @@ local M = {} 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) end From 2cbf2434074724ddbd0208b0f744e6973868d4e1 Mon Sep 17 00:00:00 2001 From: Dave Mackintosh Date: Thu, 14 Sep 2023 10:08:53 +0100 Subject: [PATCH 4/8] Added Svelte file type --- lua/import-cost.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/import-cost.lua b/lua/import-cost.lua index f54d6f7..d1b3515 100644 --- a/lua/import-cost.lua +++ b/lua/import-cost.lua @@ -27,6 +27,7 @@ M.config = { 'javascriptreact', 'typescript', 'typescriptreact', + 'svelte' }, format = { byte_format = '%.1fb', From 332b9870c7b22dcfb297a0be7d7a87c148181694 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrett-ruth@users.noreply.github.com> Date: Fri, 3 May 2024 17:37:21 -0400 Subject: [PATCH 5/8] Update readme.md --- readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index f5e03f2..8ee1546 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,8 @@ Display the costs of javascript imports inside neovim with the power of ## Installation 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 install.sh '' From b75f4afa7a85aba5ee2304229783a7d08369d984 Mon Sep 17 00:00:00 2001 From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com> Date: Sat, 10 Jan 2026 11:03:33 -0600 Subject: [PATCH 6/8] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 8ee1546..7e4363d 100644 --- a/readme.md +++ b/readme.md @@ -21,7 +21,7 @@ may look like the following: ```lua require('lazy').setup { { - 'barrett-ruth/import-cost.nvim', + 'barrettruth/import-cost.nvim', build = 'sh install.sh yarn', -- if on windows -- build = 'pwsh install.ps1 yarn', From 8d75f8d7d8793a9464c835924a5123722b0590af Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 10 Jan 2026 12:14:29 -0500 Subject: [PATCH 7/8] update --- doc/import-cost.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/import-cost.txt b/doc/import-cost.txt index 6ef1de5..3ea7048 100644 --- a/doc/import-cost.txt +++ b/doc/import-cost.txt @@ -1,7 +1,7 @@ *import-cost* *import-cost.txt* -Author: Barrett Ruth -Homepage: +Author: Barrett Ruth +Homepage: =============================================================================== 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, typescript, or typescriptreact files. -Author: Barrett Ruth +Author: Barrett Ruth =============================================================================== SETUP *import-cost.setup()* From d0074e4e7c986b69fc1d0e2b50995218c5daaa95 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sat, 10 Jan 2026 12:23:11 -0500 Subject: [PATCH 8/8] one more iupdate --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 7e4363d..36108bd 100644 --- a/readme.md +++ b/readme.md @@ -47,7 +47,7 @@ See `:h import-cost` for more information thus, unavoidable) 2. Long wait times - once again, the npm module may take quite a while before 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