Skip to content

Expose export conditions #216

Closed
Closed
@ghost

Description

My loader analyzes source to determine module shape. It uses the nextResolve and nextLoad routines to access the source. To ensure correct results from these routines, I pass export conditions to them. They're extracted by the resolve hook.

async function resolve (specifier, context, next) {
  // Retain export conditions for analysis
  state.conditions ??= [...context.conditions]
  ...

I think (?) export conditions are static across a run (modulo require vs import signaling which loader it's from).

It would be cleaner if there were some global access to these, so they don't need extracting.

function initialize (port, conditions) {
  state.conditions = conditions
  ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions