summaryrefslogtreecommitdiff
path: root/gnu/packages/node.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/node.scm')
-rw-r--r--gnu/packages/node.scm91
1 files changed, 49 insertions, 42 deletions
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 68447c7e750..74fc1fa2c59 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -579,7 +579,7 @@ Node.js and web browsers.")
579 579
580(define-public node-llparse-frontend-bootstrap 580(define-public node-llparse-frontend-bootstrap
581 (package 581 (package
582 (name "node-llparse-frontend") 582 (name "node-llparse-frontend-bootstrap")
583 (version "3.0.0") 583 (version "3.0.0")
584 (source 584 (source
585 (origin 585 (origin
@@ -589,51 +589,58 @@ Node.js and web browsers.")
589 (commit (string-append "v" version)))) 589 (commit (string-append "v" version))))
590 (file-name (git-file-name name version)) 590 (file-name (git-file-name name version))
591 (sha256 591 (sha256
592 (base32 "1rm9g4ifyip30svm5cgnf0gx7d45jgh4mpf2hkd092xhngmfvicc")) 592 (base32 "1rm9g4ifyip30svm5cgnf0gx7d45jgh4mpf2hkd092xhngmfvicc"))))
593 (modules '((guix build utils))) 593 (build-system gnu-build-system)
594 (snippet
595 '(begin
596 ;; Fix imports for esbuild.
597 ;; https://github.com/evanw/esbuild/issues/477
598 (substitute* '("src/frontend.ts"
599 "src/code/field-value.ts"
600 "src/container/index.ts"
601 "src/container/wrap.ts"
602 "src/node/sequence.ts"
603 "src/node/single.ts"
604 "src/node/table-lookup.ts"
605 "src/trie/index.ts")
606 (("\\* as assert") "assert")
607 (("\\* as debugAPI") "debugAPI"))
608 #t))))
609 (build-system node-build-system)
610 (arguments 594 (arguments
611 `(#:node ,node-bootstrap 595 (list
612 #:tests? #f 596 #:tests? #f
613 #:phases 597 #:phases
614 (modify-phases %standard-phases 598 #~(modify-phases #$bootstrap-node-phases
615 (add-after 'patch-dependencies 'delete-dependencies 599 (add-after 'unpack 'fix-imports-for-esbuild
616 (lambda args 600 ;; https://github.com/evanw/esbuild/issues/477
617 (modify-json (delete-dependencies 601 (lambda _
618 `("@types/debug" 602 (substitute* '("src/frontend.ts"
619 "@types/mocha" 603 "src/code/field-value.ts"
620 "@types/node" 604 "src/container/index.ts"
621 "mocha" 605 "src/container/wrap.ts"
622 "ts-node" 606 "src/node/sequence.ts"
623 "tslint" 607 "src/node/single.ts"
624 "typescript"))))) 608 "src/node/table-lookup.ts"
625 (replace 'build 609 "src/trie/index.ts")
626 (lambda* (#:key inputs #:allow-other-keys) 610 (("\\* as assert") "assert")
627 (let ((esbuild (search-input-file inputs "/bin/esbuild"))) 611 (("\\* as debugAPI") "debugAPI"))))
628 (invoke esbuild 612 (add-before 'configure 'patch-dependencies
629 "--platform=node" 613 (lambda* (#:key inputs #:allow-other-keys)
630 "--outfile=lib/frontend.js" 614 #$(delete-dependencies* (list "@types/debug"
631 "--bundle" 615 "@types/mocha"
632 "src/frontend.ts"))))))) 616 "@types/node"
617 "mocha"
618 "ts-node"
619 "tslint"
620 "typescript"))
621 ;; Resolve dependencies manually.
622 (let* ((debug-path "lib/node_modules/debug")
623 (debug (search-input-directory inputs debug-path))
624 (builder-path "lib/node_modules/llparse-builder")
625 (builder (search-input-directory inputs builder-path)))
626 (substitute* "package.json"
627 (("\"debug\": \".*")
628 (format #f "\"debug\": \"file://~a\"," debug))
629 (("\"llparse-builder\": \".*")
630 (format #f "\"llparse-builder\": \"file://~a\""
631 builder))))))
632 (add-before 'repack 'build
633 (lambda* (#:key inputs #:allow-other-keys)
634 (let ((esbuild (search-input-file inputs "/bin/esbuild")))
635 (invoke esbuild
636 "--platform=node"
637 "--outfile=lib/frontend.js"
638 "--bundle"
639 "src/frontend.ts")))))))
633 (inputs 640 (inputs
634 (list node-debug-bootstrap node-llparse-builder-bootstrap)) 641 (list node-debug-bootstrap node-llparse-builder-bootstrap))
635 (native-inputs 642 (native-inputs
636 (list esbuild)) 643 (list esbuild node-bootstrap))
637 (home-page "https://github.com/nodejs/llparse-frontend#readme") 644 (home-page "https://github.com/nodejs/llparse-frontend#readme")
638 (properties '((hidden? . #t))) 645 (properties '((hidden? . #t)))
639 (synopsis "Frontend for the llparse compiler") 646 (synopsis "Frontend for the llparse compiler")