tc39 / proposal-source-phase-imports

Proposal to enable importing modules at the source phase
https://tc39.es/proposal-source-phase-imports/
MIT License
129 stars 9 forks source link

dynamic import phase syntax #45

Closed guybedford closed 1 year ago

guybedford commented 1 year ago

This updates the dynamic import form from import(specifier, { phase: source }) to import.source(specifier), as per @rbuckton's suggestion.

Initially I thought this would be a meta property, but meta properties are values that can be assigned to variables, while dynamic import calls are explicitly not assignable functions, so it's a variation of the ImportCall production instead.

The overall spec changes work out fairly straightforwardly in line with the current phase structures and attributes refactorings of dynamic import.

Resolves https://github.com/tc39/proposal-import-reflection/issues/40.

nicolo-ribaudo commented 1 year ago

(I'll review this in a couple of minutes)