From 1c0e0d40ca6f6e52d860e3c1e646687cf60dae23 Mon Sep 17 00:00:00 2001
From: Joe Hildebrand Importing External Rules
grammar, NOT the source. Grammars MUST be compiled by a version that
supports imports in order to be imported. Only rules that are allowed
start rules are valid. It can be useful to specify
- --allowed-start-rules \*
in library grammars. All of the
- following are valid:
--allowed-start-rules \*
in library grammars. Imports are
+ only valid in output formats "es" and "commonjs". If you
+ use imports, you should use { output: "source" }
; the default
+ output of "parser" will call `eval` on the source which fails immediately
+ for some formats (e.g. "es") and will not find modules in the expected
+ places for others (e.g. "commonjs"). The
+ ["from-mem"](https://github.com/peggyjs/from-mem/) project is used by
+ the Peggy CLI to resolve these issues, but note well its relatively severe
+ limitations.
+ All of the following are valid:
import * as num from "number.js" // Call with num.number
import num from "number.js" // Calls the default rule
All of the following are valid:
import * as num from "number.js" // Call with num.number