guix_mirror_bot pushed a commit to branch javascript-team
in repository guix.

commit 728408c2b08defad444bfe50856b0f00399f2231
Author: Maxim Cournoyer <[email protected]>
AuthorDate: Sun Aug 2 18:18:30 2026 +0900

    build/node: Clean-up deprecation.
    
    (guix build json-utils): should not be deprecating things that are to be
    deprecated in (guix build node-build-system).  For things now defined in 
(guix
    build json-utils), opt to re-export rather than define a deprecation, as 
this
    would otherwise cause warnings that cannot be resolved (due to the 
conflicting
    definitions).
    
    * guix/build/json-utils.scm: Export with-atomic-json-file-replacement*. Do 
not
    define/export delete-fields, replace-fields and add-fields.  Avoid double
    definition of with-atomic-json-file-replacement and modify-json.
    * guix/build/node-build-system.scm: Streamline imports/re-exports.  Do not
    deprecate things that were newly added to (guix build json-utils).
    * tests/node.scm: Add (guix build json-utils) import.
---
 guix/build/json-utils.scm        | 20 +++++-------------
 guix/build/node-build-system.scm | 44 ++++++++++------------------------------
 tests/node.scm                   |  1 +
 3 files changed, 17 insertions(+), 48 deletions(-)

diff --git a/guix/build/json-utils.scm b/guix/build/json-utils.scm
index 5090daf770e..027f919bdab 100644
--- a/guix/build/json-utils.scm
+++ b/guix/build/json-utils.scm
@@ -35,14 +35,12 @@
   #:use-module (srfi srfi-26)
   #:use-module (srfi srfi-34)
   #:use-module (srfi srfi-35)
-  #:export (with-atomic-json-file-replacement
+  #:export (with-atomic-json-file-replacement  ;deprecated
+            with-atomic-json-file-replacement*
             modify-json
             modify-json-fields
-            delete-fields
             delete-json-fields
-            replace-fields
             replace-json-fields
-            add-fields
             add-json-fields
 
             &modify-json-invalid-field-value-error
@@ -65,13 +63,11 @@ a value to be written as JSON to the replacement FILE."
 ;; removed in favor of with-atomic-json-file-replacement*'s content eventually.
 ;; On removal, also remove the (guix deprecation) modules and their closures
 ;; from node-build-system imported-modules.
-(define* (with-atomic-json-file-replacement proc
-                                            #:optional (file "package.json"))
+(define-deprecated (with-atomic-json-file-replacement proc
+                     #:optional (file "package.json"))
+  with-atomic-json-file-replacement*
   (with-atomic-json-file-replacement* file proc))
 
-(define-deprecated/public-alias with-atomic-json-file-replacement
-  with-atomic-json-file-replacement*)
-
 ;; This is the function we eventually want to migrate to.
 (define* (modify-json* file #:rest modifications)
   "Modify JSON FILE with successive callbacks."
@@ -205,8 +201,6 @@ invalid field value provided, expected string or list of 
strings, got ~s~%")
      (assoc-remove! data key))
    #:strict? strict?))
 
-(define-deprecated/alias delete-fields delete-json-fields)
-
 (define* (replace-json-fields fields #:key (strict? #t) insert?)
   "Provides a lambda to supply to modify-json which replaces the value of the
  supplied field. `fields` is a list of pairs, where the first element is the
@@ -225,14 +219,10 @@ invalid field value provided, expected string or list of 
strings, got ~s~%")
    #:insert? insert?
    #:strict? strict?))
 
-(define-deprecated/alias replace-fields replace-json-fields)
-
 (define* (add-json-fields fields)
   "Like `replace-json-fields', but can insert new fields as well."
   (replace-json-fields fields #:insert? #t))
 
-(define-deprecated/alias add-fields add-json-fields)
-
 ;;; Local Variables:
 ;;; eval: (put 'with-atomic-json-file-replacement 'scheme-indent-function 1)
 ;;; eval: (put 'modify-json* 'scheme-indent-function 1)
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 102fc1e0cf1..3767ae68a39 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -25,15 +25,8 @@
 
 (define-module (guix build node-build-system)
   #:use-module ((guix build gnu-build-system) #:prefix gnu:)
-  #:use-module ((guix build json-utils)
-                #:select ((modify-json . modify-json*)
-                          (modify-json-fields . modify-json-fields*)
-                          (delete-json-fields . delete-json-fields*)
-                          (replace-json-fields . replace-json-fields*)
-                          (add-json-fields . add-json-fields*)
-                          (with-atomic-json-file-replacement
-                              . with-atomic-json-file-replacement*)))
   #:use-module (guix deprecation)
+  #:use-module (guix build json-utils)
   #:use-module (guix build utils)
   #:use-module (ice-9 format)
   #:use-module (ice-9 ftw)
@@ -49,16 +42,16 @@
             delete-dev-dependencies
             delete-dev-dependencies/except
             node-build
-            modify-json
+
+            ;; The following are deprecated and have been moved to the (guix
+            ;; build json-utils) module.
+            ;; TODO: Remove after 2027/08.
             delete-fields
             replace-fields
             add-fields)
-  #:re-export ((modify-json-fields* . modify-json-fields)
-               (delete-json-fields* . delete-json-fields)
-               (replace-json-fields* . replace-json-fields)
-               (add-json-fields* . add-json-fields)
-               (with-atomic-json-file-replacement*
-                . with-atomic-json-file-replacement)))
+  ;; Also deprecated.
+  #:re-export (with-atomic-json-file-replacement
+               modify-json))
 
 ;;;
 ;;; Helpers
@@ -74,33 +67,18 @@
   '("devDependencies"
     "peerDependencies"))
 
-(define-deprecated/alias with-atomic-json-file-replacement
-  (@ (guix build json-utils) with-atomic-json-file-replacement))
-
-(define-deprecated/alias modify-json
-  (@ (guix build json-utils) modify-json))
-
 (define-deprecated/alias modify-json-fields
   (@ (guix build json-utils) modify-json-fields))
 
 (define-deprecated/alias delete-fields
   (@ (guix build json-utils) delete-json-fields))
 
-(define-deprecated/alias delete-json-fields
-  (@ (guix build json-utils) delete-json-fields))
-
 (define-deprecated/alias replace-fields
   (@ (guix build json-utils) replace-json-fields))
 
-(define-deprecated/alias replace-json-fields
-  (@ (guix build json-utils) replace-json-fields))
-
 (define-deprecated/alias add-fields
   (@ (guix build json-utils) add-json-fields))
 
-(define-deprecated/alias add-json-fields
-  (@ (guix build json-utils) add-json-fields))
-
 (define* (delete-dependencies dependencies-to-remove
                               #:key negate?
                               (dependency-keys %dependency-keys))
@@ -142,8 +120,8 @@ dependencies."
                               #:dependency-keys %dev-dependency-keys))
 
 (define (delete-dev-dependencies)
-  (delete-json-fields* (list "devDependencies" "peerDependencies")
-                       #:strict? #f))
+  (delete-json-fields (list "devDependencies" "peerDependencies")
+                      #:strict? #f))
 
 ;;;
 ;;; Phases.
@@ -200,7 +178,7 @@ dependencies."
       (assoc-set! pkg-meta key
                   (resolve-dependencies (getter pkg-meta)))))
 
-  (modify-json* "package.json"
+  (modify-json "package.json"
    (resolve "devDependencies"
             (lambda (pkg-meta)
               (or (assoc-ref pkg-meta "devDependencies") '())))
diff --git a/tests/node.scm b/tests/node.scm
index 96048cf5cb5..a833bbfe35b 100644
--- a/tests/node.scm
+++ b/tests/node.scm
@@ -17,6 +17,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (use-modules (json)
+             (guix build json-utils)
              (guix build node-build-system)
              (guix tests)
              (srfi srfi-64))

Reply via email to