docs(sdk): éclate et étend la documentation SDK par sujet
Remplace le README monolithique par un point d'entrée vers des pages dédiées (manifest, activation/contexte, menus, commandes/feedback, layouts React, fenêtres, services, packaging/distribution) pour couvrir #142-#144 et faciliter la navigation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
76
docs/packaging-distribution.md
Normal file
76
docs/packaging-distribution.md
Normal file
@ -0,0 +1,76 @@
|
||||
# Packaging And Distribution
|
||||
|
||||
A plugin archive is a ZIP file whose root contains `idea-plugin.json`.
|
||||
|
||||
```text
|
||||
hello-plugin-0.1.0.zip
|
||||
├── idea-plugin.json
|
||||
├── README.md
|
||||
└── dist/
|
||||
├── index.js
|
||||
├── constants.js
|
||||
└── core/
|
||||
├── layout.js
|
||||
├── storage.js
|
||||
└── workspace.js
|
||||
```
|
||||
|
||||
The manifest `main` field must point to an emitted file inside the archive:
|
||||
|
||||
```json
|
||||
{
|
||||
"main": "dist/index.js"
|
||||
}
|
||||
```
|
||||
|
||||
## Module Resolution
|
||||
|
||||
IdeA loads `main` as ESM and serves package-relative imports from the plugin
|
||||
package. This is supported:
|
||||
|
||||
```js
|
||||
import { Dashboard } from "./core/layout.js";
|
||||
```
|
||||
|
||||
For React, import bare host modules normally:
|
||||
|
||||
```js
|
||||
import { useState } from "react";
|
||||
import { jsx } from "react/jsx-runtime";
|
||||
```
|
||||
|
||||
IdeA resolves React/ReactDOM bare imports to the host instance. Other bare
|
||||
dependencies are not host-resolved. Bundle or vendor third-party dependencies
|
||||
other than React/ReactDOM into package-relative files.
|
||||
|
||||
## TypeScript Build
|
||||
|
||||
The hello plugin uses plain `tsc`:
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
npm run build:hello-plugin
|
||||
```
|
||||
|
||||
For React layouts, configure JSX:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Archive Build
|
||||
|
||||
The SDK example can be packaged with:
|
||||
|
||||
```sh
|
||||
npm run package:hello-plugin
|
||||
```
|
||||
|
||||
The resulting archive has no wrapping parent directory and is ready for IdeA's
|
||||
plugin installer.
|
||||
Reference in New Issue
Block a user