@@ -2075,6 +2075,66 @@ (define-public node-flow-parser
provides the Flow parser in its compiled-to-JavaScript form for use with
Node.js and NPM.")))
+(define-public flow-remove-types
+ (package
+ (inherit node-flow-parser)
+ (name "flow-remove-types")
+ (inputs (list node-flow-parser node-vlq))
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'delete-workspace-file
+ (lambda args
+ ;; this workspace file causes NPM to try to install dependencies
+ ;; of other packages developed in this source repository
+ (delete-file "package.json")))
+ (add-after 'delete-workspace-file 'chdir
+ (lambda args
+ (chdir "packages/flow-remove-types")))
+ (add-after 'patch-dependencies 'delete-dependencies
+ (lambda args
+ (delete-dependencies '("pirates"))))
+ (add-after 'delete-dependencies 'remove-unsupported-features
+ (lambda args
+ (delete-file "register.js")
+ (with-output-to-file "register.js"
+ (lambda ()
+ (for-each
+ display
+ '("console.warn('flow-remove-types/register.js does not add"
+ " a require hook on Guix');\n"
+ "module.exports ="
+ " function setOptions(newOptions) {};\n"))))
+ (substitute* "flow-node"
+ (("var flowRemoveTypes")
+ (string-append
+ "process.stderr.write('flow-node: not yet supported"
+ " on Guix');\n"
+ "return process.exit(1);\n"
+ "var flowRemoveTypes")))
+ (substitute* "test.sh"
+ (("echo \"Test: node require hook\"")
+ "echo \"SKIPPING Test: node require hook\"")
+ (("RES=\\$[(]node -e 'require[(]\"\\./register\"[)];")
+ "RES=42 # ")
+ (("echo \"Test: flow-node\"")
+ "echo \"SKIPPING Test: flow-node\"")
+ (("FLOW_NODE=")
+ "FLOW_NODE=42 # ")
+ (("echo \"Test: flow-node with options\"")
+ "echo \"SKIPPING Test: flow-node with options\"")
+ (("FLOW_NODE_OPTS=")
+ "FLOW_NODE_OPTS=4 # ")))))))
+ (synopsis "Utility to erase Flow type annotations from JavaScript")
+ (description "Flow is a gradual type system for JavaScript. This package
+provides @command{flow-remove-types}, a command-line tool that erases Flow
+type annotations, producing standard JavaScript files. The functionality is
+also provided as a JavaScript library.
+
+Note that the Guix package does not yet support the @command{flow-node}
+command or the Node.js require hook for interactive development.")))
+
(define-public tinyproxy
(package
(name "tinyproxy")