Files
Charles KWON OhJun 8ddd6abc69 feat(fnode): --go-replace and --module for BEGINDUMP-import use cases
Two CLI knobs that together let PRG #pragma BEGINDUMP blocks import
private Go modules and their internal/* packages:

  --go-replace pkg=path
    Adds `require pkg v0.0.0` + `replace pkg => path` to the temp
    go.mod, so `go mod tidy` doesn't try (and fail) to fetch a
    module that lives only on local disk or behind a private
    forge (Gitea, etc.).

  --module <name>
    Overrides the temp-build module name (default fnode_build).
    Use when the BEGINDUMP block needs to reach into another
    module's internal/ packages — Go's internal-visibility rule
    requires the importer to share a parent path with the
    importee, so the build module needs to live somewhere under
    that parent.

Worked example (solmade integration PoC):

  fnode build /tmp/poc_dartapi.prg \\
    --go-replace gitea.fivego.org/kwon_ai/solmade=/Users/charleskwon/solmade \\
    --module gitea.fivego.org/kwon_ai/solmade/_fnode_build \\
    -o poc_dart

A 4-line BEGINDUMP block now imports
"gitea.fivego.org/kwon_ai/solmade/internal/dartapi", links its
AllAliases() function, and returns the real count (3) at run time.
Single 23 MB Go binary, no Node, no FFI.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 14:33:39 +09:00
..