@@ -1712,3 +1712,84 @@ (define-public node-is-what
functions for JavaScript, such as @code{isString}, @code{isDate}, and
@code{isPlainObject}.")
(license license:expat)))
+
+(define-public node-copy-anything
+ (package
+ (name "node-copy-anything")
+ (version "3.0.5")
+ (source
+ (origin (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/mesqueeb/copy-anything")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "1lpjqanjl04k088banpns4yvp6hgf97snaj7gfbfancjpd3i8gk6"))
+ (snippet
+ #~(for-each delete-file
+ '("dist/cjs/index.cjs"
+ "dist/index.js")))
+ (file-name (git-file-name name version))))
+ (build-system node-build-system)
+ (native-inputs (list esbuild))
+ (inputs (list node-is-what))
+ (arguments
+ (list
+ #:tests? #f ; needs more dependencies
+ #:modules
+ `((guix build node-build-system)
+ (ice-9 match)
+ (guix build utils))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'patch-dependencies 'delete-dependencies
+ (lambda args
+ (delete-dependencies
+ '(;; devDependencies
+ "@typescript-eslint/eslint-plugin"
+ "@typescript-eslint/parser"
+ "del-cli"
+ "eslint"
+ "eslint-config-prettier"
+ "eslint-plugin-tree-shaking"
+ "np"
+ "prettier"
+ "rollup"
+ "rollup-plugin-dts"
+ "rollup-plugin-esbuild"
+ "rollup-plugin-typescript2"
+ "typescript"
+ "vitest"))))
+ (add-after 'delete-dependencies 'patch-build-script
+ (lambda args
+ (define esbuild
+ "esbuild --bundle --platform=node --external:is-what")
+ (define new-build-script
+ (string-append
+ esbuild
+ " --format=cjs --outfile=dist/cjs/index.cjs src/index.ts"
+ " && "
+ esbuild
+ " --format=esm --outfile=dist/index.js src/index.ts"))
+ (with-atomic-json-file-replacement "package.json"
+ (match-lambda
+ (('@ . alist)
+ (cons '@
+ (map (match-lambda
+ (("scripts" @ . alist)
+ `("scripts" @ ,@(map (match-lambda
+ (("build" . _)
+ (cons "build"
+ new-build-script))
+ (other
+ other))
+ alist)))
+ (other
+ other))
+ alist))))))))))
+ (home-page "https://npmjs.com/copy-anything")
+ (synopsis "JavaScript library for copying objects and arrays")
+ (description "This library provides deep copying for JavaScript objects
+and arrays. Its design emphasizes speed, simplicity, and correctness in the
+face of complications like special objects, symbols, and non-enumerable
+properties.")
+ (license license:expat)))