Skip to content

Commit c5a67f5

Browse files
committed
Clarify plugin implementation boundaries
1 parent c8509c4 commit c5a67f5

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

โ€Ž.agents/PLUGINS.mdโ€Ž

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ Read the writing-a-plugin docs first:
88
- [Inputs][2] โ€” the `Input` type and helpers like `toEntry` and `toDependency`
99
- [Argument Parsing][3] โ€” `Plugin.args` for binaries and arguments in scripts
1010

11-
Consider implementing `resolve*` functions only for custom plugin-specific needs
12-
(core takes care of module resolution, imports, exports, external dependencies).
11+
## Implementation
12+
13+
- Consider implementing `resolve*` functions for custom plugin-specific needs.
14+
Leave regular module resolution and tracking imports, exports and external
15+
dependencies to the core routine.
16+
- Keep fixes local to the plugin and its tests. Discuss changes to core modules,
17+
inputs, import flags, caches before implementing them.
18+
- Use the existing plugin lifecycle. Do not add core machinery solely to carry
19+
one plugin's state.
1320

1421
## Creating a new plugin
1522

@@ -72,6 +79,10 @@ webpack/rspack `require.context`), `addScript` (execa, nano-spawn),
7279
Enabled-only, zero cost when off. Factories in `plugins/[name]/visitors/`,
7380
shared in `_custom-elements/`.
7481

82+
Visitors collect syntax facts through `ctx`. Keep filesystem access, discovery,
83+
and module resolution outside AST traversal; discuss unavoidable exceptions
84+
first.
85+
7586
## Fixtures
7687

7788
See [TESTS.md][5] for fixture conventions, including plugin fixtures.

0 commit comments

Comments
ย (0)