@usefragment/core 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/index.d.ts +3075 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Julien Bernard
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @usefragment/core
|
|
2
|
+
|
|
3
|
+
Le **contrat de types public** de [Fragment](https://github.com/RebornFlamme/Fragment)
|
|
4
|
+
(alias Promethium) — le module hôte `fragment` que les plugins importent.
|
|
5
|
+
|
|
6
|
+
Package **de types uniquement** : il ne contient aucun JavaScript. À l'exécution,
|
|
7
|
+
l'hôte injecte les vraies valeurs (`fragmentApi`) via son shim `require('fragment')`
|
|
8
|
+
— exactement comme le package `obsidian`. Ton bundler laisse donc `fragment` en
|
|
9
|
+
*external* ; ce package ne sert qu'à ton compilateur pour typer l'import.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install --save-dev @usefragment/core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Configuration
|
|
18
|
+
|
|
19
|
+
Ajoute le package à `types` dans ton `tsconfig.json` pour charger les modules
|
|
20
|
+
ambiants (`fragment`, et les alias `promethium` / `obsidian`) :
|
|
21
|
+
|
|
22
|
+
```jsonc
|
|
23
|
+
{
|
|
24
|
+
"compilerOptions": {
|
|
25
|
+
"types": ["@usefragment/core"]
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Et marque `fragment` en external dans ton bundler (esbuild) :
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
esbuild.build({ /* … */ external: ['fragment', 'electron', '@codemirror/*'] });
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Utilisation
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { Plugin, Notice, type Command } from 'fragment';
|
|
40
|
+
|
|
41
|
+
export default class MonPlugin extends Plugin {
|
|
42
|
+
async onload() {
|
|
43
|
+
this.addCommand({ id: 'hello', name: 'Dire bonjour', callback: () => new Notice('👋') });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Les auteurs qui écrivent des extensions CodeMirror installent en plus
|
|
49
|
+
`@codemirror/state` (peer dependency optionnelle).
|
|
50
|
+
|
|
51
|
+
## Versionnage
|
|
52
|
+
|
|
53
|
+
Publié depuis le monorepo Fragment via [Changesets](https://github.com/changesets/changesets),
|
|
54
|
+
indépendamment des versions du client. Voir le `CHANGELOG.md`.
|