summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorPhilip McGrath <philip@philipmcgrath.com>2022-01-08 03:42:14 -0500
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2022-01-09 02:07:15 +0100
commite6ef40bef28b4439246b863f7d4b4c6bab780a34 (patch)
tree3f89d67ba080bbeef88ebae2786c3313f79e2a65 /gnu
parent1730209a68468077099059d1ebb9ce5ed4cd4408 (diff)
downloadguix-e6ef40bef28b4439246b863f7d4b4c6bab780a34.tar.gz
gnu: Add node-file-uri-to-path.
* gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/node-xyz.scm55
1 files changed, 55 insertions, 0 deletions
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c2e74ad685..f9a14c9d68 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -24,6 +24,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages web)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -813,3 +814,57 @@ ABI-stable across Node.js major versions.")
      "@code{node-sqlite3} provides a set of a Node.js bindings for interacting
 with SQLite3 databases.")
      (license license:bsd-3)))
+
+(define-public node-file-uri-to-path
+  (package
+    (name "node-file-uri-to-path")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/file-uri-to-path")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
+    (native-inputs
+     (list esbuild))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("@types/mocha"
+                                    "@types/node"
+                                    "@typescript-eslint/eslint-plugin"
+                                    "@typescript-eslint/parser"
+                                    "cpy-cli"
+                                    "eslint"
+                                    "eslint-config-airbnb"
+                                    "eslint-config-prettier"
+                                    "eslint-import-resolver-typescript"
+                                    "eslint-plugin-import"
+                                    "eslint-plugin-jsx-a11y"
+                                    "eslint-plugin-react"
+                                    "mocha"
+                                    "rimraf"
+                                    "typescript"))))
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (copy-recursively "src" "dist")
+             (invoke (search-input-file (or native-inputs inputs)
+                                        "/bin/esbuild")
+                     "dist/index.ts"
+                     "--outfile=dist/src/index.js"
+                     "--format=cjs"
+                     "--sourcemap"
+                     "--platform=node"))))
+       #:tests? #f))
+    (home-page "https://github.com/TooTallNate/file-uri-to-path")
+    (synopsis "Convert a @code{file:} URI to a file path")
+    (description "This package provides a function to convert a @code{file:}
+URI to a file path.  It accepts a @code{file:} URI and returns a file path
+suitable for use with the @code{fs} module functions.")
+    (license license:expat)))