Skip to content

Commit

Permalink
document new with uses in plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed May 25, 2024
1 parent dcbd466 commit b740d98
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/content/plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ body:
resolveDir: string;
kind: ResolveKind;
pluginData: any;
with: Record<string, string>;
}
type ResolveKind =
Expand All @@ -384,6 +385,7 @@ body:
ResolveDir string
Kind ResolveKind
PluginData interface{}
With map[string]string
}
const (
Expand Down Expand Up @@ -458,6 +460,17 @@ body:
[on-load callback](#on-load) that loaded this file.
</p>
- >
`with`
<p>
This contains a map of the [import attributes](https://github.com/tc39/proposal-import-attributes)
that were present on the import statement used to import this module. For
example, a module imported using <code>with { <wbr>type: <wbr>'json' }</code>
will provide a `with` value of <code>{ type: <wbr>'json' }</code> to plugins.
You can use this to resolve to a different path depending on the import
attributes.
</p>
- h3: On-resolve results

- p: >
Expand Down Expand Up @@ -1602,6 +1615,7 @@ body:
namespace?: string;
resolveDir?: string;
pluginData?: any;
with?: Record<string, string>;
}
type ResolveKind =
Expand All @@ -1620,6 +1634,7 @@ body:
Namespace string
ResolveDir string
PluginData interface{}
With map[string]string
}
const (
Expand Down Expand Up @@ -1678,6 +1693,16 @@ body:
match this import path. The meaning of this data is left entirely up to you.
</p>
- >
`with`
<p>
This is the [import attributes](https://github.com/tc39/proposal-import-attributes)
assocated with the import statement for this path. For example, a `with` value of
<code>{ type: <wbr>'json' }</code> would be appropriate for a module imported using
<code>with { <wbr>type: <wbr>'json' }</code> attributes on the import statement.
This information isn't used by esbuild but may be used by [on-resolve callbacks](#on-resolve).
</p>
- h3: Resolve results

- p: >
Expand Down

0 comments on commit b740d98

Please sign in to comment.