aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/mason-core/installer/UninstallRunner.lua2
-rw-r--r--lua/mason-core/installer/compiler/compilers/npm.lua5
-rw-r--r--lua/mason-core/installer/managers/npm.lua3
-rw-r--r--lua/mason-core/installer/managers/powershell.lua2
-rw-r--r--lua/mason/health.lua7
-rw-r--r--lua/mason/settings.lua9
-rw-r--r--lua/mason/version.lua4
7 files changed, 24 insertions, 8 deletions
diff --git a/lua/mason-core/installer/UninstallRunner.lua b/lua/mason-core/installer/UninstallRunner.lua
index 67ae285f..760ad88b 100644
--- a/lua/mason-core/installer/UninstallRunner.lua
+++ b/lua/mason-core/installer/UninstallRunner.lua
@@ -36,7 +36,7 @@ function UninstallRunner:execute(opts, callback)
local location = self.handle.location
log.fmt_info("Executing uninstaller for %s %s", pkg, opts)
a.run(function()
- Result.try(function(try)
+ return Result.try(function(try)
if not opts.bypass_permit then
try(self:acquire_permit()):receive()
end
diff --git a/lua/mason-core/installer/compiler/compilers/npm.lua b/lua/mason-core/installer/compiler/compilers/npm.lua
index e8489fe8..cdf6a279 100644
--- a/lua/mason-core/installer/compiler/compilers/npm.lua
+++ b/lua/mason-core/installer/compiler/compilers/npm.lua
@@ -1,6 +1,7 @@
local Result = require "mason-core.result"
local _ = require "mason-core.functional"
local providers = require "mason-core.providers"
+local settings = require "mason.settings"
---@param purl Purl
local function purl_to_npm(purl)
@@ -24,6 +25,9 @@ function M.parse(source, purl)
package = purl_to_npm(purl),
version = purl.version,
extra_packages = source.extra_packages,
+ npm = {
+ extra_args = settings.current.npm.install_args,
+ },
}
return Result.success(parsed_source)
@@ -39,6 +43,7 @@ function M.install(ctx, source)
try(npm.init())
try(npm.install(source.package, source.version, {
extra_packages = source.extra_packages,
+ install_extra_args = source.npm.extra_args,
}))
end)
end
diff --git a/lua/mason-core/installer/managers/npm.lua b/lua/mason-core/installer/managers/npm.lua
index d31fe768..93af3a85 100644
--- a/lua/mason-core/installer/managers/npm.lua
+++ b/lua/mason-core/installer/managers/npm.lua
@@ -57,7 +57,7 @@ end
---@async
---@param pkg string
---@param version string
----@param opts? { extra_packages?: string[] }
+---@param opts? { extra_packages?: string[], install_extra_args?: string[] }
function M.install(pkg, version, opts)
opts = opts or {}
log.fmt_debug("npm: install %s %s %s", pkg, version, opts)
@@ -67,6 +67,7 @@ function M.install(pkg, version, opts)
"install",
("%s@%s"):format(pkg, version),
opts.extra_packages or vim.NIL,
+ opts.install_extra_args or vim.NIL,
}
end
diff --git a/lua/mason-core/installer/managers/powershell.lua b/lua/mason-core/installer/managers/powershell.lua
index 0e7f4145..372426e8 100644
--- a/lua/mason-core/installer/managers/powershell.lua
+++ b/lua/mason-core/installer/managers/powershell.lua
@@ -8,7 +8,7 @@ local M = {}
local PWSHOPT = {
progress_preference = [[ $ProgressPreference = 'SilentlyContinue'; ]], -- https://stackoverflow.com/a/63301751
security_protocol = [[ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ]],
- error_action_preference = [[ $ErrorActionPreference = "Stop"; ]],
+ error_action_preference = [[ $ErrorActionPreference = 'Stop'; ]],
}
local powershell = _.lazy(function()
diff --git a/lua/mason/health.lua b/lua/mason/health.lua
index e439736a..557fdc5f 100644
--- a/lua/mason/health.lua
+++ b/lua/mason/health.lua
@@ -113,14 +113,15 @@ local function check_core_utils()
end
if platform.is.win then
+ local powershell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell"
check {
- cmd = "pwsh",
+ cmd = powershell,
args = {
"-NoProfile",
"-Command",
- [[$PSVersionTable.PSVersion, $PSVersionTable.OS, $PSVersionTable.Platform -join " "]],
+ [[$PSVersionTable.PSVersion, $PSVersionTable.OS, $PSVersionTable.Platform -join ' ']],
},
- name = "pwsh",
+ name = powershell,
}
check { cmd = "7z", args = { "--help" }, name = "7z", relaxed = true }
end
diff --git a/lua/mason/settings.lua b/lua/mason/settings.lua
index ebff1e0b..e70d90a4 100644
--- a/lua/mason/settings.lua
+++ b/lua/mason/settings.lua
@@ -68,6 +68,15 @@ local DEFAULT_SETTINGS = {
install_args = {},
},
+ npm = {
+ ---@since 2.3.0
+ -- These args will be added to `npm install` calls. Note that setting extra args might impact intended behavior
+ -- and is not recommended.
+ --
+ -- Example: { "--registry", "https://registry.npmjs.org/" }
+ install_args = {},
+ },
+
ui = {
---@since 1.0.0
-- Whether to automatically check for new versions when opening the :Mason window.
diff --git a/lua/mason/version.lua b/lua/mason/version.lua
index cf094f30..fb051ef4 100644
--- a/lua/mason/version.lua
+++ b/lua/mason/version.lua
@@ -1,8 +1,8 @@
local M = {}
-M.VERSION = "v2.2.0" -- x-release-please-version
+M.VERSION = "v2.2.1" -- x-release-please-version
M.MAJOR_VERSION = 2 -- x-release-please-major
M.MINOR_VERSION = 2 -- x-release-please-minor
-M.PATCH_VERSION = 0 -- x-release-please-patch
+M.PATCH_VERSION = 1 -- x-release-please-patch
return M