stimulus-language-server: init

This commit is contained in:
Snoweuph 2026-06-05 03:45:00 +02:00
commit bdaaa43d26
No known key found for this signature in database
GPG key ID: BEFC41DA223CEC55
3 changed files with 102 additions and 0 deletions

View file

@ -0,0 +1,15 @@
--- a/package.json
+++ b/package.json
@@ -13,3 +13,3 @@
"dependencies": {
- "@hotwired/stimulus": "https://github.com/hotwired/dev-builds/archive/refs/tags/@hotwired/stimulus/8cbca6d.tar.gz",
+ "@hotwired/stimulus": "file:./hotwired-stimulus.tar.gz",
"dedent": "^1.5.1",
--- a/yarn.lock
+++ b/yarn.lock
@@ -27,3 +27,3 @@
-"@hotwired/stimulus@https://github.com/hotwired/dev-builds/archive/refs/tags/@hotwired/stimulus/8cbca6d.tar.gz":
+"@hotwired/stimulus@file:./hotwired-stimulus.tar.gz":
version "3.2.2"
- resolved "https://github.com/hotwired/dev-builds/archive/refs/tags/@hotwired/stimulus/8cbca6d.tar.gz#bcca3015d4e1a7e6defad94db626e11dc97e69e5"
+ resolved "file:./hotwired-stimulus.tar.gz"

View file

@ -0,0 +1,22 @@
--- a/package.json
+++ b/package.json
@@ -38,2 +38,3 @@
"devDependencies": {
+ "@types/node": "^20.0.0",
"@types/estree": "^1.0.5",
--- a/yarn.lock
+++ b/yarn.lock
@@ -307,4 +307,13 @@
vscode-uri@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.1.0.tgz#dd09ec5a66a38b5c3fffc774015713496d14e09c"
integrity sha512-/BpdSx+yCQGnCvecbyXdxHDkuk55/G3xwnC0GqY4gmQ3j+A+g8kzzgB4Nk/SINjqn6+waqw3EgbVF2QKExkRxQ==
+
+"@types/node@^20.0.0":
+ version "20.19.0"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-20.19.0.tgz#7006b097b15dfea06695c3bbdba98b268797f65b"
+
+undici-types@~6.19.2:
+ version "6.19.8"
+ resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
+ integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==

View file

@ -0,0 +1,65 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
fetchYarnDeps,
fetchurl,
yarnConfigHook,
yarnBuildHook,
yarnInstallHook,
nodejs,
runCommand,
patch,
nix-update-script,
}: let
version = "1.1.0";
upstream = fetchFromGitHub {
owner = "marcoroth";
repo = "stimulus-lsp";
tag = "v${version}";
hash = "sha256-QAXQKZoFvqhnbAIi9fnJ7pV8fXah0NjwxdrqKB5e5Vw=";
};
# `fetchYarnDeps` doesn't support tarballs so we need to patch this manually
stimulusTarball = fetchurl {
url = "https://github.com/hotwired/dev-builds/archive/refs/tags/@hotwired/stimulus/8cbca6d.tar.gz";
hash = "sha256-2iRIiwXmdcSw7y3CQNIPt6duwZuVvDvdU/FEdqcnzW4=";
};
src = runCommand "stimulus-lsp-server-patched" {nativeBuildInputs = [patch];} ''
cp -r ${upstream}/server $out
chmod -R +w $out
cp '${stimulusTarball}' $out/hotwired-stimulus.tar.gz
patch -d $out -p1 < '${./0001-use-local-hotwired.patch}'
patch -d $out -p1 < '${./0002-add-types-node.patch}'
'';
in
stdenvNoCC.mkDerivation {
pname = "stimulus-language-server";
inherit version;
src = src;
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-UvojI/Ow602Q+iiwRpSgxm4DV0IJ0sURicdgghmpBsU=";
};
nativeBuildInputs = [
yarnConfigHook
yarnBuildHook
yarnInstallHook
nodejs
];
passthru.updateScript = nix-update-script {};
meta = {
description = "Intelligent Stimulus tooling";
homepage = "https://hotwire.io/ecosystem/tooling/stimulus-lsp";
changelog = "https://github.com/marcoroth/stimulus-lsp/releases/tag/v${version}";
license = lib.licenses.mit;
mainProgram = "stimulus-language-server";
};
}