summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Graves <ngraves@ngraves.fr>2026-03-18 09:18:02 +0100
committerMaxim Cournoyer <maxim@guixotic.coop>2026-08-27 10:59:21 +0900
commitddb9990e21c6f113a5cb66bad571af5ce47afd13 (patch)
tree684a493005ca07471470ceb83d6f9b03ef1f8887
parente8e49ddeacd69759a7760fc94fdc39f6202d5103 (diff)
gnu: packages: Replace delete-fields by delete-json-fields.
* gnu/packages/node-xyz.scm: Replace all uses of delete-fields by delete-json-fields. * gnu/packages/web.scm: Likewise. * guix/build/node-build-system.scm: Likewise. Change-Id: I7134d68a8cd101078ea1010d5e3e42e34b799114 Signed-off-by: Jelle Licht <jlicht@fsfe.org>
-rw-r--r--gnu/packages/node-xyz.scm224
-rw-r--r--gnu/packages/web.scm4
2 files changed, 117 insertions, 111 deletions
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9aec88e468c..aa28311249a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -71,7 +71,8 @@
71 ;; We need to remove the prepare script from "package.json", as 71 ;; We need to remove the prepare script from "package.json", as
72 ;; it would try to use the build environment and would block the 72 ;; it would try to use the build environment and would block the
73 ;; automatic building by other packages making use of node-acorn. 73 ;; automatic building by other packages making use of node-acorn.
74 (modify-json (delete-fields '(("scripts" "prepare")))))) 74 (modify-json "package.json"
75 (delete-json-fields '(("scripts" "prepare"))))))
75 (replace 'build 76 (replace 'build
76 (lambda* (#:key inputs native-inputs #:allow-other-keys) 77 (lambda* (#:key inputs native-inputs #:allow-other-keys)
77 (let ((esbuild (search-input-file (or native-inputs inputs) 78 (let ((esbuild (search-input-file (or native-inputs inputs)
@@ -346,7 +347,8 @@ addons in a wide array of potential locations.")
346 #~(modify-phases %standard-phases 347 #~(modify-phases %standard-phases
347 (add-after 'unpack 'neuter-prepare-script 348 (add-after 'unpack 'neuter-prepare-script
348 (lambda _ 349 (lambda _
349 (modify-json (delete-fields '("scripts.prepare")))))))) 350 (modify-json "package.json"
351 (delete-json-fields '("scripts.prepare"))))))))
350 (native-inputs (list node-typescript)) 352 (native-inputs (list node-typescript))
351 (home-page "https://github.com/fb55/boolbase") 353 (home-page "https://github.com/fb55/boolbase")
352 (synopsis "Two functions: One that returns true, one that returns false") 354 (synopsis "Two functions: One that returns true, one that returns false")
@@ -906,10 +908,12 @@ text differences, similar to Unix diff.")
906 #~(modify-phases %standard-phases 908 #~(modify-phases %standard-phases
907 (add-after 'unpack 'neuter-prepare-script 909 (add-after 'unpack 'neuter-prepare-script
908 (lambda _ 910 (lambda _
909 (modify-json (delete-fields '("scripts.prepare"))))) 911 (modify-json "package.json"
912 (delete-json-fields '("scripts.prepare")))))
910 (add-after 'patch-dependencies 'delete-dev-dependencies 913 (add-after 'patch-dependencies 'delete-dev-dependencies
911 (lambda _ 914 (lambda _
912 (modify-json (delete-dev-dependencies))))))) 915 (modify-json "package.json"
916 (delete-dev-dependencies)))))))
913 (native-inputs (list node-typescript)) 917 (native-inputs (list node-typescript))
914 (home-page "https://github.com/fb55/domelementtype") 918 (home-page "https://github.com/fb55/domelementtype")
915 (synopsis "Node.js types for htmlparser2's DOM") 919 (synopsis "Node.js types for htmlparser2's DOM")
@@ -1255,27 +1259,29 @@ It can handle big files (tested up to 100mb). XML Entities, HTML entities, and D
1255 (guix build utils) 1259 (guix build utils)
1256 (ice-9 match)) 1260 (ice-9 match))
1257 #:tests? #f ; FIXME: Tests require 'jest'. 1261 #:tests? #f ; FIXME: Tests require 'jest'.
1258 #:phases #~(modify-phases %standard-phases 1262 #:phases
1259 (add-before 'patch-dependencies 'modify-package (lambda _ 1263 #~(modify-phases %standard-phases
1260 (modify-json 1264 (add-before 'patch-dependencies 'modify-package
1261 (delete-dev-dependencies) 1265 (lambda _
1262 (delete-fields (list 1266 (modify-json "package.json"
1263 "scripts.prepare" 1267 (delete-dev-dependencies)
1264 "scripts.build"))))) 1268 (delete-json-fields (list "scripts.prepare" "scripts.build")))))
1265 (replace 'build (lambda _ 1269 (replace 'build
1266 (for-each 1270 (lambda _
1267 (match-lambda ((format outdir parameters) 1271 (for-each
1268 (apply invoke (append 1272 (match-lambda
1269 (list 1273 ((format outdir parameters)
1270 "esbuild" 1274 (apply invoke (append
1271 "mod.ts" 1275 (list
1272 (string-append "--format=" format) 1276 "esbuild"
1273 "--target=es2015" 1277 "mod.ts"
1274 (string-append "--outdir=" outdir)) 1278 (string-append "--format=" format)
1275 parameters)))) 1279 "--target=es2015"
1276 (list 1280 (string-append "--outdir=" outdir))
1277 (list "esm" "esm" (list "--sourcemap")) 1281 parameters))))
1278 (list "cjs" "." (list "--platform=node"))))))))) 1282 (list
1283 (list "esm" "esm" (list "--sourcemap"))
1284 (list "cjs" "." (list "--platform=node")))))))))
1279 (synopsis "Fastest Levenshtein distance implementation in JS") 1285 (synopsis "Fastest Levenshtein distance implementation in JS")
1280 (description "Fastest JS/TS implemenation of Levenshtein distance. 1286 (description "Fastest JS/TS implemenation of Levenshtein distance.
1281Measure the difference between two strings.") 1287Measure the difference between two strings.")
@@ -1388,35 +1394,35 @@ suitable for use with the @code{fs} module functions.")
1388 (guix build utils) 1394 (guix build utils)
1389 (ice-9 match)) 1395 (ice-9 match))
1390 #:tests? #f ; FIXME: Tests require 'c8' and 'tap'. 1396 #:tests? #f ; FIXME: Tests require 'c8' and 'tap'.
1391 #:phases #~(modify-phases %standard-phases 1397 #:phases
1392 (add-before 'patch-dependencies 'modify-package 1398 #~(modify-phases %standard-phases
1393 (lambda _ 1399 (add-before 'patch-dependencies 'modify-package
1394 (modify-json 1400 (lambda _
1395 (delete-dev-dependencies) 1401 (modify-json "package.json"
1396 (delete-fields (list 1402 (delete-dev-dependencies)
1397 "scripts.prepare")) 1403 (delete-json-fields (list "scripts.prepare"))
1398 (delete-dependencies (list 1404 ;; Not currently used in other packages, but if there are
1399 ; Not currently used in other packages, but if there are 1405 ;; issues we may need to add this in.
1400 ; issues we may need to add this in. 1406 (delete-dependencies (list "fs.realpath")))))
1401 "fs.realpath"))))) 1407 (replace 'build
1402 (replace 'build 1408 (lambda _
1403 (lambda _ 1409 (define output "output")
1404 (define output "output") 1410 (for-each
1405 (for-each 1411 (match-lambda
1406 (match-lambda ((format directory) 1412 ((format directory)
1407 (invoke 1413 (invoke
1408 "esbuild" 1414 "esbuild"
1409 "src/*.ts" 1415 "src/*.ts"
1410 "--platform=node" 1416 "--platform=node"
1411 (string-append "--format=" format) 1417 (string-append "--format=" format)
1412 "--target=es2022" 1418 "--target=es2022"
1413 "--sourcemap" 1419 "--sourcemap"
1414 (string-append "--outdir=" output "/dist/" directory)))) 1420 (string-append "--outdir=" output "/dist/" directory))))
1415 (list (list "cjs" "cjs") (list "esm" "mjs"))) 1421 (list (list "cjs" "cjs") (list "esm" "mjs")))
1416 (for-each 1422 (for-each
1417 (lambda (file) (install-file file output)) 1423 (lambda (file) (install-file file output))
1418 (list "LICENSE" "README.md" "package.json")) 1424 (list "LICENSE" "README.md" "package.json"))
1419 (chdir output)))))) 1425 (chdir output))))))
1420 (synopsis "Match files using the patterns the shell uses") 1426 (synopsis "Match files using the patterns the shell uses")
1421 (description "The most correct and second fastest glob implementation in JavaScript.") 1427 (description "The most correct and second fastest glob implementation in JavaScript.")
1422 (home-page (git-reference-url (origin-uri source))) 1428 (home-page (git-reference-url (origin-uri source)))
@@ -2062,8 +2068,7 @@ user-land JavaScript.")
2062 (lambda _ 2068 (lambda _
2063 (modify-json 2069 (modify-json
2064 (delete-dev-dependencies) 2070 (delete-dev-dependencies)
2065 (delete-fields (list 2071 (delete-json-fields (list "scripts.prepare")))))
2066 "scripts.prepare")))))
2067 (replace 'build 2072 (replace 'build
2068 (lambda _ 2073 (lambda _
2069 (define output "output") 2074 (define output "output")
@@ -2147,9 +2152,9 @@ random number generator.")
2147 ;; from mime-db. These files are already generated during the Guix 2152 ;; from mime-db. These files are already generated during the Guix
2148 ;; build. Remove the script to prevent npm from trying to re-run it 2153 ;; build. Remove the script to prevent npm from trying to re-run it
2149 ;; when this package is used as a file: dependency. 2154 ;; when this package is used as a file: dependency.
2150 (modify-json #:file (string-append (assoc-ref outputs "out") 2155 (modify-json (string-append (assoc-ref outputs "out")
2151 "/lib/node_modules/mime/package.json") 2156 "/lib/node_modules/mime/package.json")
2152 (delete-fields '(("scripts" "prepare"))))))))) 2157 (delete-json-fields '(("scripts" "prepare")))))))))
2153 (home-page "https://github.com/broofa/mime") 2158 (home-page "https://github.com/broofa/mime")
2154 (synopsis "Comprehensive MIME type mapping API") 2159 (synopsis "Comprehensive MIME type mapping API")
2155 (description "This package provides a library for MIME type mapping based 2160 (description "This package provides a library for MIME type mapping based
@@ -2211,8 +2216,7 @@ JavaScript.")
2211 (lambda _ 2216 (lambda _
2212 (modify-json 2217 (modify-json
2213 (delete-dev-dependencies) 2218 (delete-dev-dependencies)
2214 (delete-fields (list 2219 (delete-json-fields (list "scripts.prepare")))))
2215 "scripts.prepare")))))
2216 (replace 'build 2220 (replace 'build
2217 (lambda _ 2221 (lambda _
2218 (define output "output") 2222 (define output "output")
@@ -2284,22 +2288,22 @@ It works by converting glob expressions into JavaScript RegExp objects.")
2284 (build-system node-build-system) 2288 (build-system node-build-system)
2285 (arguments (list 2289 (arguments (list
2286 #:tests? #f ; FIXME: Tests require 'tap'. 2290 #:tests? #f ; FIXME: Tests require 'tap'.
2287 #:phases #~(modify-phases %standard-phases 2291 #:phases
2288 (add-before 'patch-dependencies 'modify-package 2292 #~(modify-phases %standard-phases
2289 (lambda _ 2293 (add-before 'patch-dependencies 'modify-package
2290 (modify-json 2294 (lambda _
2291 (delete-dev-dependencies) 2295 (modify-json "package.json"
2292 (delete-fields (list 2296 (delete-dev-dependencies)
2293 "scripts.prepare"))))) 2297 (delete-json-fields (list "scripts.prepare")))))
2294 (replace 'build 2298 (replace 'build
2295 (lambda _ 2299 (lambda _
2296 (define output "output") 2300 (define output "output")
2297 (mkdir output) 2301 (mkdir output)
2298 (invoke "node" "./scripts/transpile-to-esm.js") 2302 (invoke "node" "./scripts/transpile-to-esm.js")
2299 (for-each 2303 (for-each
2300 (lambda (file) (install-file file output)) 2304 (lambda (file) (install-file file output))
2301 (list "index.js" "index.mjs" "LICENSE" "package.json" "README.md")) 2305 (list "index.js" "index.mjs" "LICENSE" "package.json" "README.md"))
2302 (chdir output)))))) 2306 (chdir output))))))
2303 (synopsis "Minimal implementation of a PassThrough stream") 2307 (synopsis "Minimal implementation of a PassThrough stream")
2304 (description "A very minimal implementation of a PassThrough stream 2308 (description "A very minimal implementation of a PassThrough stream
2305It's very fast for objects, strings, and buffers. 2309It's very fast for objects, strings, and buffers.
@@ -2340,32 +2344,33 @@ This is not a through or through2 stream. It doesn't transform the data, it just
2340 (guix build utils) 2344 (guix build utils)
2341 (ice-9 match)) 2345 (ice-9 match))
2342 #:tests? #f ; FIXME: Tests require 'tap'. 2346 #:tests? #f ; FIXME: Tests require 'tap'.
2343 #:phases #~(modify-phases %standard-phases 2347 #:phases
2344 (add-before 'patch-dependencies 'modify-package 2348 #~(modify-phases %standard-phases
2345 (lambda _ 2349 (add-before 'patch-dependencies 'modify-package
2346 (modify-json 2350 (lambda _
2347 (delete-dev-dependencies) 2351 (modify-json "package.json"
2348 (delete-fields (list 2352 (delete-dev-dependencies)
2349 "scripts.prepare"))))) 2353 (delete-json-fields (list "scripts.prepare")))))
2350 (replace 'build 2354 (replace 'build
2351 (lambda _ 2355 (lambda _
2352 (define output "output") 2356 (define output "output")
2353 (for-each 2357 (for-each
2354 (match-lambda ((format directory type) 2358 (match-lambda
2355 (define target-output (string-append output "/dist/" directory)) 2359 ((format directory type)
2356 (invoke 2360 (define target-output (string-append output "/dist/" directory))
2357 "esbuild" 2361 (invoke "esbuild"
2358 "src/index.ts" 2362 "src/index.ts"
2359 "--platform=node" 2363 "--platform=node"
2360 "--target=es2022" 2364 "--target=es2022"
2361 (string-append "--format=" format) 2365 (string-append "--format=" format)
2362 "--jsx=transform" 2366 "--jsx=transform"
2363 "--sourcemap" 2367 "--sourcemap"
2364 (string-append "--outdir=" target-output)) 2368 (string-append "--outdir=" target-output))
2365 (with-output-to-file 2369 (call-with-output-file
2366 (string-append target-output "/package.json") 2370 (string-append target-output "/package.json")
2367 (lambda _ (display (string-append "{\"type\": \"" type "\"}")))))) 2371 (lambda (port)
2368 (list 2372 (format port "{type: ~s}" type)))))
2373 (list
2369 (list "cjs" "commonjs" "commonjs") 2374 (list "cjs" "commonjs" "commonjs")
2370 (list "esm" "esm" "module"))) 2375 (list "esm" "esm" "module")))
2371 (for-each 2376 (for-each
@@ -2683,7 +2688,7 @@ particular cross-platform spellings of the PATH environment variable key.")
2683 (lambda _ 2688 (lambda _
2684 (modify-json 2689 (modify-json
2685 (delete-dev-dependencies) 2690 (delete-dev-dependencies)
2686 (delete-fields (list "scripts.prepare"))))) 2691 (delete-json-fields (list "scripts.prepare")))))
2687 (replace 'build 2692 (replace 'build
2688 (lambda _ 2693 (lambda _
2689 (define output "output") 2694 (define output "output")
@@ -3562,8 +3567,9 @@ it to make a new binding for a different platform or underling technology.")))
3562 "node-abi"))))) 3567 "node-abi")))))
3563 (add-after 'chdir 'avoid-prebuild-install 3568 (add-after 'chdir 'avoid-prebuild-install
3564 (lambda args 3569 (lambda args
3565 (modify-json (delete-fields '(("scripts" "install"))) 3570 (modify-json "package.json"
3566 (replace-fields '(("gypfile" . #f))))))) 3571 (delete-json-fields '(("scripts" "install")))
3572 (replace-fields '(("gypfile" . #f)))))))
3567 #:tests? #f)) 3573 #:tests? #f))
3568 (synopsis "Abstract base class for Node SerialPort bindings") 3574 (synopsis "Abstract base class for Node SerialPort bindings")
3569 (description "Node SerialPort is a modular suite of Node.js packages for 3575 (description "Node SerialPort is a modular suite of Node.js packages for
@@ -3836,7 +3842,7 @@ connection.")))
3836 (modify-json 3842 (modify-json
3837 (delete-dev-dependencies) 3843 (delete-dev-dependencies)
3838 ; Build only builds browser-source-map-support.js which we don't currently use 3844 ; Build only builds browser-source-map-support.js which we don't currently use
3839 (delete-fields (list "scripts.build")))))))) 3845 (delete-json-fields (list "scripts.build"))))))))
3840 (synopsis "Fixes stack traces for files with source maps") 3846 (synopsis "Fixes stack traces for files with source maps")
3841 (description "This module provides source map support for stack traces in node via\ 3847 (description "This module provides source map support for stack traces in node via\
3842 the V8 stack trace API. It uses the source-map module to replace the paths and line\ 3848 the V8 stack trace API. It uses the source-map module to replace the paths and line\
@@ -3957,7 +3963,7 @@ connection.")))
3957 ;; We need to remove the install script from "package.json", 3963 ;; We need to remove the install script from "package.json",
3958 ;; as it would try to use node-pre-gyp and would block the 3964 ;; as it would try to use node-pre-gyp and would block the
3959 ;; automatic building performed by `npm install`. 3965 ;; automatic building performed by `npm install`.
3960 (delete-fields `(("scripts" "install"))))))))) 3966 (delete-json-fields `(("scripts" "install")))))))))
3961 (home-page "https://github.com/mapbox/node-sqlite3") 3967 (home-page "https://github.com/mapbox/node-sqlite3")
3962 (synopsis "Node.js bindings for SQLite3") 3968 (synopsis "Node.js bindings for SQLite3")
3963 (description 3969 (description
@@ -4140,7 +4146,7 @@ sequences.")
4140 (add-before 'patch-dependencies 'modify-package (lambda _ 4146 (add-before 'patch-dependencies 'modify-package (lambda _
4141 (modify-json 4147 (modify-json
4142 (delete-dev-dependencies) 4148 (delete-dev-dependencies)
4143 (delete-fields (list "type")) 4149 (delete-json-fields (list "type"))
4144 (replace-fields (list (cons "version" #$version)))))) 4150 (replace-fields (list (cons "version" #$version))))))
4145 (replace 'build (lambda _ 4151 (replace 'build (lambda _
4146 (define problem-file "strnum.js") 4152 (define problem-file "strnum.js")
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 029c9ad9b17..4419049deeb 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -2650,8 +2650,8 @@ directions.")
2650 (add-after 'unpack 'chdir (lambda _ 2650 (add-after 'unpack 'chdir (lambda _
2651 (chdir "npm/esbuild"))) 2651 (chdir "npm/esbuild")))
2652 (add-before 'patch-dependencies 'modify-package (lambda _ 2652 (add-before 'patch-dependencies 'modify-package (lambda _
2653 (modify-json 2653 (modify-json "package.json"
2654 (delete-fields '("optionalDependencies" "scripts"))) 2654 (delete-json-fields '("optionalDependencies" "scripts")))
2655 (substitute* "../../lib/npm/node-platform.ts" 2655 (substitute* "../../lib/npm/node-platform.ts"
2656 (("^export var ESBUILD_BINARY_PATH:.+$") 2656 (("^export var ESBUILD_BINARY_PATH:.+$")
2657 (string-append "export var ESBUILD_BINARY_PATH: string" 2657 (string-append "export var ESBUILD_BINARY_PATH: string"