From b740d9861d5744f3635de78f766e21bd64c11ed8 Mon Sep 17 00:00:00 2001
From: Evan Wallace
Date: Fri, 24 May 2024 22:45:30 -0400
Subject: [PATCH] document new `with` uses in plugins
---
src/content/plugins.yml | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/content/plugins.yml b/src/content/plugins.yml
index b5ba985..5342f6d 100644
--- a/src/content/plugins.yml
+++ b/src/content/plugins.yml
@@ -363,6 +363,7 @@ body:
resolveDir: string;
kind: ResolveKind;
pluginData: any;
+ with: Record;
}
type ResolveKind =
@@ -384,6 +385,7 @@ body:
ResolveDir string
Kind ResolveKind
PluginData interface{}
+ With map[string]string
}
const (
@@ -458,6 +460,17 @@ body:
[on-load callback](#on-load) that loaded this file.
+ - >
+ `with`
+
+ 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 with { type: 'json' }
+ will provide a `with` value of { type: 'json' }
to plugins.
+ You can use this to resolve to a different path depending on the import
+ attributes.
+
+
- h3: On-resolve results
- p: >
@@ -1602,6 +1615,7 @@ body:
namespace?: string;
resolveDir?: string;
pluginData?: any;
+ with?: Record;
}
type ResolveKind =
@@ -1620,6 +1634,7 @@ body:
Namespace string
ResolveDir string
PluginData interface{}
+ With map[string]string
}
const (
@@ -1678,6 +1693,16 @@ body:
match this import path. The meaning of this data is left entirely up to you.
+ - >
+ `with`
+
+ 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
+ { type: 'json' }
would be appropriate for a module imported using
+ with { type: 'json' }
attributes on the import statement.
+ This information isn't used by esbuild but may be used by [on-resolve callbacks](#on-resolve).
+
+
- h3: Resolve results
- p: >