Filtered namespace support for static imports&re-rexports#29
Filtered namespace support for static imports&re-rexports#29
Conversation
ec444e3 to
06afee9
Compare
|
I noticed that step 1 of InitializeEnvironment calls ResolveExport on all of its re-exports, thus initializing the I'll change the initialization lazyness to only apply to |
|
Uhmm there is actually a larger problem. When we have a cycle like this: // entrypoint
export defer { x } as ns from "./dep";
import "./dep";
// dep
import { ns } from "./entrypoint"
export let x = 1;We first run InitializeEnvironment on |
|
|
fb10845 to
e57c0a5
Compare
|
Those last 2 changes LGTM. |
|
Regarding this |
7088549 to
21f7599
Compare
These changes adds support for syntax and semantics of
`import {prop1, prop2} as ns from "mod"`, that will generate a namespace
object with only exports selected in the braces. We are calling
them filtered namespace, and there's support for static imports
`import [defer] {} as ns from "mod"`, and support for re-exports
`export [defer] {...} as ns from "mod"`.
---------
Co-authored-by: Caio Lima <caiolima@igalia.com>
605a641 to
6c0dd87
Compare
6c0dd87 to
7b1e863
Compare
This PR is a joint work from me and @nicolo-ribaudo.
It adds support for syntax and semantics of
import {prop1, prop2} as ns from "mod", that will generate a namespace object with only exports selected in the braces. We are calling them filtered namespace, and there's support for static importsimport [defer] {} as ns from "mod", and support for re-exportsexport [defer] {...} as ns from "mod".For
import {prop1} as ns from "mod",nsis a new object declared locally in the module that uses the{ … } as nssyntax, rather than being shared across different importers that use the same keys. It avoids a complex cache keyed on the sorted list of names, and it also satisfies some requirements we've got from TG3's feedbacks.Aliasing (
import { foo as bar } as obj) is not supported because the import names do not introduce bindings, so there is no conflict risk.TODO:
import {valid_export, non_valid_export} as ns from "mod"export defer {valid_export, non_valid_export} as ns from "mod", only ifnsis imported