@rynt/extension-build 0.9.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/README.md +151 -0
- package/bin/pack.mjs +101 -0
- package/package.json +49 -0
- package/scripts/write-host-shims.mjs +68 -0
- package/shims/rynt-sdk-extension.host-shim.js +135 -0
- package/shims/rynt-sdk-host.host-shim.js +33 -0
- package/shims/rynt-sdk-models.host-shim.d.ts +12 -0
- package/shims/rynt-sdk-registries.host-shim.d.ts +4 -0
- package/shims/rynt-sdk-session.host-shim.d.ts +2 -0
- package/shims/rynt-sdk-session.host-shim.js +24 -0
- package/shims/rynt-sdk.host-shim.js +225 -0
- package/shims/tiptap-core.host-shim.js +146 -0
- package/shims/vue-router.host-shim.js +44 -0
- package/shims/vue.host-shim.js +192 -0
- package/src/extension-dev-bridge.ts +132 -0
- package/src/extension-icon.ts +120 -0
- package/src/extension-manifest.ts +187 -0
- package/src/index.ts +320 -0
- package/tsconfig.json +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# @rynt/extension-build
|
|
2
|
+
|
|
3
|
+
Пресет **Vite** и утилиты упаковки для авторов расширений **Rynt Launcher**: ESM-бандл, host-shim’ы на `vue` и `@rynt/sdk/*`, манифест в `dist/`, архив **`.ryntextension`**.
|
|
4
|
+
|
|
5
|
+
**Документация:** [https://docs.rynt.space](https://docs.rynt.space)
|
|
6
|
+
**SDK:** [`@rynt/sdk`](https://www.npmjs.com/package/@rynt/sdk)
|
|
7
|
+
**Создать проект:** [`@rynt/create-extension`](https://www.npmjs.com/package/@rynt/create-extension)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Установка
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -D @rynt/extension-build @rynt/sdk vite vue @vitejs/plugin-vue typescript vue-tsc
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Рекомендуется начать с шаблона:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm create @rynt/create-extension@latest my-extension
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Быстрый старт
|
|
26
|
+
|
|
27
|
+
### `vite.config.ts`
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import path from 'node:path';
|
|
31
|
+
import { fileURLToPath } from 'node:url';
|
|
32
|
+
import { ryntExtensionViteConfig } from '@rynt/extension-build';
|
|
33
|
+
|
|
34
|
+
const root = path.dirname(fileURLToPath(import.meta.url));
|
|
35
|
+
|
|
36
|
+
export default ryntExtensionViteConfig({
|
|
37
|
+
root,
|
|
38
|
+
manifest: {
|
|
39
|
+
id: '@acme/my-extension',
|
|
40
|
+
name: 'My Extension',
|
|
41
|
+
description: 'Краткое описание',
|
|
42
|
+
icon: './assets/icon.png',
|
|
43
|
+
author: 'Your Name',
|
|
44
|
+
main: 'index.js',
|
|
45
|
+
engines: { rynt: '>=0.9.0' },
|
|
46
|
+
extensionApi: '1',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Отдельный `manifest.json` в корне **не нужен**: после `vite build` лаунчер читает **`dist/manifest.json`**.
|
|
52
|
+
|
|
53
|
+
### Entry `src/index.ts`
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { defineRyntExtension } from '@rynt/sdk/extension';
|
|
57
|
+
|
|
58
|
+
export default defineRyntExtension((ctx) => {
|
|
59
|
+
// регистрация страниц, меню, реестров…
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Скрипты в `package.json`
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"scripts": {
|
|
68
|
+
"build": "vite build && rynt-extension-pack",
|
|
69
|
+
"dev": "vite build --watch",
|
|
70
|
+
"typecheck": "vue-tsc -p tsconfig.json --noEmit"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
| Команда | Результат |
|
|
76
|
+
|---------|-----------|
|
|
77
|
+
| **`pnpm dev`** | watch-сборка + [Extension Dev Bridge](https://docs.rynt.space/extensions/dev-workflow) (hot reload в лаунчере) |
|
|
78
|
+
| **`pnpm build`** | `dist/` + файл **`{id-slug}-{version}.ryntextension`** |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Иконка
|
|
83
|
+
|
|
84
|
+
В `manifest.icon` укажите **локальный путь** (PNG, JPG, WebP, SVG):
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
icon: './assets/icon.png',
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
При сборке растровая иконка масштабируется до **512×512** и попадает в `dist/icon.png`. SVG копируется как `dist/icon.svg`. URL и `data:` URI не изменяются.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Host-shim’ы
|
|
95
|
+
|
|
96
|
+
Расширение **не** тащит свой `vue` и не дублирует SDK: bare-импорты
|
|
97
|
+
|
|
98
|
+
`vue`, `vue-router`, `@rynt/sdk`, `@rynt/sdk/extension`, …
|
|
99
|
+
|
|
100
|
+
подменяются на шимы, которые берут модули с **`globalThis.__RYNT_EXTENSION_HOST_MODULES__`** в рантайме лаунчера.
|
|
101
|
+
|
|
102
|
+
В коде расширения вызывайте привычные API (`usePageRegistry().register`, `defineRyntExtension`, импорт UI из `@rynt/sdk`) — **`extensionId`** для записей в реестр подставляется автоматически из **`manifest.id`** в Vite-конфиге.
|
|
103
|
+
|
|
104
|
+
Подробнее: [модель реестров](https://docs.rynt.space/extensions/advanced/registry-model).
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Dev-режим (Extension Dev Bridge)
|
|
109
|
+
|
|
110
|
+
1. В лаунчере: **Управление расширениями** → включить dev-hub (`127.0.0.1:39217`).
|
|
111
|
+
2. В каталоге расширения: **`pnpm dev`**.
|
|
112
|
+
3. После каждой пересборки расширение перерегистрируется в лаунчере.
|
|
113
|
+
|
|
114
|
+
| Переменная | Описание |
|
|
115
|
+
|------------|----------|
|
|
116
|
+
| `RYNT_DEV=1` | явно включить bridge |
|
|
117
|
+
| `RYNT_DEV_BRIDGE=0` | отключить |
|
|
118
|
+
| `RYNT_LAUNCHER_DEV_HUB` | URL hub (по умолчанию `http://127.0.0.1:39217`) |
|
|
119
|
+
|
|
120
|
+
Dev-версия с тем же `manifest.id` перекрывает установленную с диска.
|
|
121
|
+
|
|
122
|
+
→ [Dev-режим в документации](https://docs.rynt.space/extensions/dev-workflow)
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## CLI `rynt-extension-pack`
|
|
127
|
+
|
|
128
|
+
Упаковывает содержимое **`dist/`** в **`.ryntextension`** (zip):
|
|
129
|
+
|
|
130
|
+
- читает **`dist/manifest.json`**;
|
|
131
|
+
- имя файла: **`{slug}-{version}.ryntextension`**, slug из `manifest.id`.
|
|
132
|
+
|
|
133
|
+
Вызывается в скрипте `build` после `vite build`.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## TipTap в расширениях
|
|
138
|
+
|
|
139
|
+
| Импорт | Поведение |
|
|
140
|
+
|--------|-----------|
|
|
141
|
+
| `@tiptap/core` | host-shim (один экземпляр с лаунчером) |
|
|
142
|
+
| `@tiptap/extension-*` | в `dependencies` расширения, собирается в бандл |
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## См. также
|
|
147
|
+
|
|
148
|
+
- [Сборка и установка](https://docs.rynt.space/extensions/build-install)
|
|
149
|
+
- [Сборка и упаковка (детали)](https://docs.rynt.space/extensions/build-pipeline)
|
|
150
|
+
- [Манифест](https://docs.rynt.space/extensions/advanced/manifest)
|
|
151
|
+
- [npm-пакеты экосистемы](https://docs.rynt.space/get-started/npm-packages)
|
package/bin/pack.mjs
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Упаковывает содержимое `dist/` в архив `.ryntextension` (включая `index.js`, стили и `manifest.json` из пресета).
|
|
4
|
+
* Запуск из каталога расширения после `vite build`.
|
|
5
|
+
*/
|
|
6
|
+
import archiver from 'archiver';
|
|
7
|
+
import {
|
|
8
|
+
createReadStream,
|
|
9
|
+
createWriteStream,
|
|
10
|
+
existsSync,
|
|
11
|
+
readFileSync,
|
|
12
|
+
readdirSync,
|
|
13
|
+
statSync,
|
|
14
|
+
} from 'node:fs';
|
|
15
|
+
import { join } from 'node:path';
|
|
16
|
+
import { cwd } from 'node:process';
|
|
17
|
+
|
|
18
|
+
const root = cwd();
|
|
19
|
+
const distManifestPath = join(root, 'dist', 'manifest.json');
|
|
20
|
+
if (!existsSync(distManifestPath)) {
|
|
21
|
+
console.error(
|
|
22
|
+
'[rynt-extension-pack] Нет dist/manifest.json — сначала vite build (манифест задаётся в ryntExtensionViteConfig({ manifest }))',
|
|
23
|
+
);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
const manifestPath = distManifestPath;
|
|
27
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
|
|
28
|
+
|
|
29
|
+
function versionFromPackageJsonFile() {
|
|
30
|
+
const pkgPath = join(root, 'package.json');
|
|
31
|
+
if (!existsSync(pkgPath)) return null;
|
|
32
|
+
try {
|
|
33
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
34
|
+
const v = pkg?.version;
|
|
35
|
+
if (v == null) return null;
|
|
36
|
+
const s = String(v).trim();
|
|
37
|
+
return s.length > 0 ? s : null;
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function manifestVersion(m) {
|
|
44
|
+
const v = m?.version;
|
|
45
|
+
if (typeof v === 'string' && v.trim()) return v.trim();
|
|
46
|
+
if (typeof v === 'number' && Number.isFinite(v)) return String(v);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const slug = String(manifest.id ?? manifest.name)
|
|
51
|
+
.replace(/^@/, '')
|
|
52
|
+
.replace(/[^a-zA-Z0-9._-]+/g, '-');
|
|
53
|
+
const version =
|
|
54
|
+
manifestVersion(manifest) ?? versionFromPackageJsonFile() ?? '0.0.0';
|
|
55
|
+
if (!manifestVersion(manifest)) {
|
|
56
|
+
console.warn(
|
|
57
|
+
'[rynt-extension-pack] В dist/manifest.json нет version — взято из package.json или 0.0.0. Пересоберите расширение (vite build), чтобы manifest был полным.',
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
const outName = `${slug}-${version}.ryntextension`;
|
|
61
|
+
const outPath = join(root, outName);
|
|
62
|
+
|
|
63
|
+
const distDir = join(root, 'dist');
|
|
64
|
+
if (!statSync(distDir).isDirectory()) {
|
|
65
|
+
console.error('[rynt-extension-pack] Ожидалась директория dist/ — сначала выполните vite build');
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const output = createWriteStream(outPath);
|
|
70
|
+
const archive = archiver('zip', { zlib: { level: 9 } });
|
|
71
|
+
|
|
72
|
+
archive.on('error', (err) => {
|
|
73
|
+
console.error('[rynt-extension-pack]', err);
|
|
74
|
+
process.exit(1);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
output.on('close', () => {
|
|
78
|
+
console.info(`[rynt-extension-pack] ${outPath} (${archive.pointer()} bytes)`);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
archive.pipe(output);
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {string} absDir
|
|
85
|
+
* @param {string} [zipPrefix]
|
|
86
|
+
*/
|
|
87
|
+
function addDirectoryRecursive(absDir, zipPrefix = '') {
|
|
88
|
+
for (const name of readdirSync(absDir)) {
|
|
89
|
+
const abs = join(absDir, name);
|
|
90
|
+
const rel = zipPrefix ? `${zipPrefix}/${name}` : name;
|
|
91
|
+
if (statSync(abs).isDirectory()) {
|
|
92
|
+
addDirectoryRecursive(abs, rel);
|
|
93
|
+
} else {
|
|
94
|
+
archive.append(createReadStream(abs), { name: rel });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
addDirectoryRecursive(distDir);
|
|
100
|
+
|
|
101
|
+
await archive.finalize();
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rynt/extension-build",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Vite preset, host-shims and .ryntextension packer for Rynt Launcher extensions",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"default": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"rynt-extension-pack": "./bin/pack.mjs"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
17
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
18
|
+
"archiver": "^7.0.1",
|
|
19
|
+
"jimp": "^1.6.0",
|
|
20
|
+
"jiti": "^2.4.2",
|
|
21
|
+
"tailwindcss": "^4.1.11",
|
|
22
|
+
"vite": "^6.0.10",
|
|
23
|
+
"vue": "^3.5.13"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"typescript": "^5"
|
|
27
|
+
},
|
|
28
|
+
"peerDependenciesMeta": {
|
|
29
|
+
"typescript": {
|
|
30
|
+
"optional": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@rynt/sdk": "workspace:^",
|
|
35
|
+
"@tiptap/core": "^3.20.4",
|
|
36
|
+
"rollup": "^4.50.1",
|
|
37
|
+
"typescript": "~5.7.2",
|
|
38
|
+
"vue-router": "^4.6.4"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"gen-host-shims": "node ./scripts/write-host-shims.mjs",
|
|
42
|
+
"build": "tsc -p tsconfig.json",
|
|
43
|
+
"prepare": "pnpm run build"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"license": "ISC"
|
|
49
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Генерирует `shims/*.host-shim.js`: реэкспорт с `globalThis.__RYNT_EXTENSION_HOST_MODULES__`.
|
|
3
|
+
*
|
|
4
|
+
* Запуск: `pnpm --filter @rynt/extension-build run gen-host-shims`
|
|
5
|
+
*/
|
|
6
|
+
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
7
|
+
import { dirname, join } from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
import * as tiptapCore from '@tiptap/core';
|
|
11
|
+
import * as vue from 'vue';
|
|
12
|
+
import * as vueRouter from 'vue-router';
|
|
13
|
+
|
|
14
|
+
/** @type {readonly string[]} */
|
|
15
|
+
export const RYNT_EXTENSION_HOST_TIPTAP_SPECIFIERS = ['@tiptap/core'];
|
|
16
|
+
|
|
17
|
+
const root = dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
const shimsDir = join(root, '..', 'shims');
|
|
19
|
+
mkdirSync(shimsDir, { recursive: true });
|
|
20
|
+
|
|
21
|
+
const banner = `/* eslint-disable -- generated by write-host-shims.mjs */\n`;
|
|
22
|
+
|
|
23
|
+
const header = `${banner}
|
|
24
|
+
const HOST = '__RYNT_EXTENSION_HOST_MODULES__';
|
|
25
|
+
|
|
26
|
+
function registry() {
|
|
27
|
+
const r = globalThis[HOST];
|
|
28
|
+
if (!r) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
'[rynt/extension-build] Missing globalThis.' +
|
|
31
|
+
HOST +
|
|
32
|
+
' — call registerRyntExtensionHostModules() in the launcher before loading extensions.',
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
return r;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} fileBase
|
|
41
|
+
* @param {string} slot
|
|
42
|
+
* @param {Record<string, unknown>} mod
|
|
43
|
+
*/
|
|
44
|
+
function writeNamespaceShim(fileBase, slot, mod) {
|
|
45
|
+
const keys = Object.keys(mod).filter(
|
|
46
|
+
(k) => k !== '__esModule' && k !== 'default',
|
|
47
|
+
);
|
|
48
|
+
const lines = [
|
|
49
|
+
header,
|
|
50
|
+
`const $ = registry()['${slot}'];`,
|
|
51
|
+
`if (!$) {`,
|
|
52
|
+
` throw new Error('[rynt/extension-build] Host did not register module ${slot}');`,
|
|
53
|
+
`}`,
|
|
54
|
+
'',
|
|
55
|
+
...keys.map((k) => `export const ${k} = $.${k};`),
|
|
56
|
+
'',
|
|
57
|
+
];
|
|
58
|
+
writeFileSync(join(shimsDir, `${fileBase}.host-shim.js`), lines.join('\n'));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
writeNamespaceShim('vue', 'vue', vue);
|
|
62
|
+
writeNamespaceShim('vue-router', 'vue-router', vueRouter);
|
|
63
|
+
writeNamespaceShim('tiptap-core', '@tiptap/core', tiptapCore);
|
|
64
|
+
|
|
65
|
+
console.info(
|
|
66
|
+
'[write-host-shims] wrote vue, vue-router, @tiptap/core →',
|
|
67
|
+
shimsDir,
|
|
68
|
+
);
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/* eslint-disable -- Rynt host bridge for `@rynt/sdk/extension` */
|
|
2
|
+
const HOST = '__RYNT_EXTENSION_HOST_MODULES__';
|
|
3
|
+
|
|
4
|
+
function registry() {
|
|
5
|
+
const r = globalThis[HOST];
|
|
6
|
+
if (!r) {
|
|
7
|
+
throw new Error(
|
|
8
|
+
'[rynt/extension-build] Missing globalThis.' +
|
|
9
|
+
HOST +
|
|
10
|
+
' — call registerRyntExtensionHostModules() in the launcher before loading extensions.',
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return r;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const $ = registry()['@rynt/sdk/extension'];
|
|
17
|
+
if (!$) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
'[rynt/extension-build] Host did not register @rynt/sdk/extension',
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ===== Plugin & Extension Definition =====
|
|
24
|
+
export const defineRyntExtension = $.defineRyntExtension;
|
|
25
|
+
export const defineStore = $.defineStore;
|
|
26
|
+
|
|
27
|
+
// ===== Extension Expose =====
|
|
28
|
+
export const extensionExposeRevision = $.extensionExposeRevision;
|
|
29
|
+
export const getExtensionExpose = $.getExtensionExpose;
|
|
30
|
+
export const useExtensionExpose = $.useExtensionExpose;
|
|
31
|
+
|
|
32
|
+
// ===== Registry Management =====
|
|
33
|
+
export const defineExtensionRegistry = $.defineExtensionRegistry;
|
|
34
|
+
export const getExtensionRegistry = $.getExtensionRegistry;
|
|
35
|
+
export const applyValidatedRyntContributesToManifest = $.applyValidatedRyntContributesToManifest;
|
|
36
|
+
export const clearExtensionUiRegistries = $.clearExtensionUiRegistries;
|
|
37
|
+
export const clearRegistryBucket = $.clearRegistryBucket;
|
|
38
|
+
export const deleteRegistryItem = $.deleteRegistryItem;
|
|
39
|
+
export const ensureCoreExtensionRegistries = $.ensureCoreExtensionRegistries;
|
|
40
|
+
export const extensionRegistriesRevision = $.extensionRegistriesRevision;
|
|
41
|
+
export const getCurrentExtensionId = $.getCurrentExtensionId;
|
|
42
|
+
export const getRegistry = $.getRegistry;
|
|
43
|
+
export const getRegistryEntryMeta = $.getRegistryEntryMeta;
|
|
44
|
+
export const getRegistryItem = $.getRegistryItem;
|
|
45
|
+
export const hasRegistryItem = $.hasRegistryItem;
|
|
46
|
+
export const HOST_EXTENSION_ID = $.HOST_EXTENSION_ID;
|
|
47
|
+
export const listRegistryEntries = $.listRegistryEntries;
|
|
48
|
+
export const listRegistryKeys = $.listRegistryKeys;
|
|
49
|
+
export const listRegistryValuesSorted = $.listRegistryValuesSorted;
|
|
50
|
+
export const popExtensionScope = $.popExtensionScope;
|
|
51
|
+
export const pushExtensionScope = $.pushExtensionScope;
|
|
52
|
+
export const resetExtensionRegistries = $.resetExtensionRegistries;
|
|
53
|
+
export const setRegistryItem = $.setRegistryItem;
|
|
54
|
+
export const unregisterRegistryEntriesForExtension = $.unregisterRegistryEntriesForExtension;
|
|
55
|
+
export const validateRyntManifestContributes = $.validateRyntManifestContributes;
|
|
56
|
+
export const withExtensionScope = $.withExtensionScope;
|
|
57
|
+
|
|
58
|
+
// ===== Builtin Registry Composables =====
|
|
59
|
+
export const useExtensionNavRegistry = $.useExtensionNavRegistry;
|
|
60
|
+
export const useExtensionPageRegistry = $.useExtensionPageRegistry;
|
|
61
|
+
export const useExtensionShellRegistry = $.useExtensionShellRegistry;
|
|
62
|
+
export const useExtensionSidebarRegistry = $.useExtensionSidebarRegistry;
|
|
63
|
+
export const useExtensionUserStripRegistry = $.useExtensionUserStripRegistry;
|
|
64
|
+
export const useLoaderRegistry = $.useLoaderRegistry;
|
|
65
|
+
export const useModProviderRegistry = $.useModProviderRegistry;
|
|
66
|
+
export const useThemeRegistry = $.useThemeRegistry;
|
|
67
|
+
|
|
68
|
+
// ===== Extension Routing =====
|
|
69
|
+
export const extensionRouteSlug = $.extensionRouteSlug;
|
|
70
|
+
export const resolvedNavigationPath = $.resolvedNavigationPath;
|
|
71
|
+
|
|
72
|
+
// ===== Launcher Entities =====
|
|
73
|
+
export const registerLauncherEntity = $.registerLauncherEntity;
|
|
74
|
+
export const clearLauncherEntityRegistry = $.clearLauncherEntityRegistry;
|
|
75
|
+
export const RYNT_LAUNCHER_ENTITY_KEYS = $.RYNT_LAUNCHER_ENTITY_KEYS;
|
|
76
|
+
|
|
77
|
+
// ===== Launcher Models =====
|
|
78
|
+
export const useModel = $.useModel;
|
|
79
|
+
export const RYNT_LAUNCHER_MODEL_KEYS = $.RYNT_LAUNCHER_MODEL_KEYS;
|
|
80
|
+
|
|
81
|
+
// ===== Router Bridge =====
|
|
82
|
+
export const attachExtensionRoutes = $.attachExtensionRoutes;
|
|
83
|
+
export const detachExtensionRoutes = $.detachExtensionRoutes;
|
|
84
|
+
export const syncExtensionRoutes = $.syncExtensionRoutes;
|
|
85
|
+
|
|
86
|
+
// ===== Minecraft Loader =====
|
|
87
|
+
export const BaseLoader = $.BaseLoader;
|
|
88
|
+
export const loaderRegistry = $.loaderRegistry;
|
|
89
|
+
|
|
90
|
+
// ===== Manifest & Extensions =====
|
|
91
|
+
export const parseRyntManifestJson = $.parseRyntManifestJson;
|
|
92
|
+
export const topoSortExtensions = $.topoSortExtensions;
|
|
93
|
+
export const EXTENSION_API_VERSION = $.EXTENSION_API_VERSION;
|
|
94
|
+
export const parseExtensionApiMajor = $.parseExtensionApiMajor;
|
|
95
|
+
export const normalizeExtensionApiInManifest = $.normalizeExtensionApiInManifest;
|
|
96
|
+
export const checkExtensionApi = $.checkExtensionApi;
|
|
97
|
+
export const RYNT_EXTENSION_DISABLED_DIR_SUFFIX = $.RYNT_EXTENSION_DISABLED_DIR_SUFFIX;
|
|
98
|
+
export const isRyntExtensionBundleDirDisabled = $.isRyntExtensionBundleDirDisabled;
|
|
99
|
+
export const ryntExtensionBundleDirBaseLabel = $.ryntExtensionBundleDirBaseLabel;
|
|
100
|
+
export const ryntExtensionBundleDisabledFolderName = $.ryntExtensionBundleDisabledFolderName;
|
|
101
|
+
|
|
102
|
+
// ===== Mod Marketplace =====
|
|
103
|
+
export const markModMarketplaceProvider = $.markModMarketplaceProvider;
|
|
104
|
+
export const registerModMarketplaceProvider = $.registerModMarketplaceProvider;
|
|
105
|
+
|
|
106
|
+
// ===== Entity Components =====
|
|
107
|
+
export const EntityBuildCard = $.EntityBuildCard;
|
|
108
|
+
export const EntityModItem = $.EntityModItem;
|
|
109
|
+
export const EntityModListItem = $.EntityModListItem;
|
|
110
|
+
export const EntityModManageItem = $.EntityModManageItem;
|
|
111
|
+
export const EntityAccountAvatar = $.EntityAccountAvatar;
|
|
112
|
+
export const EntityAccountCard = $.EntityAccountCard;
|
|
113
|
+
export const EntityAccountItem = $.EntityAccountItem;
|
|
114
|
+
export const EntityAccountItemMin = $.EntityAccountItemMin;
|
|
115
|
+
export const EntityAccountListItem = $.EntityAccountListItem;
|
|
116
|
+
export const EntityAuthProviderItem = $.EntityAuthProviderItem;
|
|
117
|
+
export const EntityBuildListItem = $.EntityBuildListItem;
|
|
118
|
+
export const EntityEventCard = $.EntityEventCard;
|
|
119
|
+
export const EntityEventListItem = $.EntityEventListItem;
|
|
120
|
+
export const EntityPostCard = $.EntityPostCard;
|
|
121
|
+
export const EntityPostCardMin = $.EntityPostCardMin;
|
|
122
|
+
export const EntityResourcepackItem = $.EntityResourcepackItem;
|
|
123
|
+
export const EntityResourcepackListItem = $.EntityResourcepackListItem;
|
|
124
|
+
export const EntityResourcepackManageItem = $.EntityResourcepackManageItem;
|
|
125
|
+
export const EntityServerCard = $.EntityServerCard;
|
|
126
|
+
export const EntityServerMemberItem = $.EntityServerMemberItem;
|
|
127
|
+
export const EntityServerMemberManageItem = $.EntityServerMemberManageItem;
|
|
128
|
+
export const EntityUserAvatar = $.EntityUserAvatar;
|
|
129
|
+
export const EntityUserCurrent = $.EntityUserCurrent;
|
|
130
|
+
export const EntityUserItem = $.EntityUserItem;
|
|
131
|
+
export const EntityUserItemMin = $.EntityUserItemMin;
|
|
132
|
+
export const EntityUserListItem = $.EntityUserListItem;
|
|
133
|
+
export const EntityUserStatusDisplay = $.EntityUserStatusDisplay;
|
|
134
|
+
export const EntityVersionListItem = $.EntityVersionListItem;
|
|
135
|
+
export const EntityVersionListItemMin = $.EntityVersionListItemMin;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable -- Rynt host bridge for `@rynt/sdk/host` */
|
|
2
|
+
const HOST = '__RYNT_EXTENSION_HOST_MODULES__';
|
|
3
|
+
|
|
4
|
+
function registry() {
|
|
5
|
+
const r = globalThis[HOST];
|
|
6
|
+
if (!r) {
|
|
7
|
+
throw new Error(
|
|
8
|
+
'[rynt/extension-build] Missing globalThis.' +
|
|
9
|
+
HOST +
|
|
10
|
+
' — call registerRyntExtensionHostModules() in the launcher before loading extensions.',
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return r;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const $ = registry()['@rynt/sdk/host'];
|
|
17
|
+
if (!$) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
'[rynt/extension-build] Host did not register @rynt/sdk/host',
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ===== Extensions Initialization =====
|
|
24
|
+
export const initializeRyntExtensions = $.initializeRyntExtensions;
|
|
25
|
+
export const useRyntExtensionLoader = $.useRyntExtensionLoader;
|
|
26
|
+
|
|
27
|
+
// ===== Launcher Model Registration =====
|
|
28
|
+
export const registerModel = $.registerModel;
|
|
29
|
+
export const clearLauncherModelRegistry = $.clearLauncherModelRegistry;
|
|
30
|
+
|
|
31
|
+
// ===== Launcher Entity Registration =====
|
|
32
|
+
export const registerLauncherEntity = $.registerLauncherEntity;
|
|
33
|
+
export const clearLauncherEntityRegistry = $.clearLauncherEntityRegistry;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Рантайм-модуль — `rynt-sdk-models.host-shim.js` (мост через `globalThis`).
|
|
3
|
+
* Объявления нужны редактору/vue-tsc: при alias Vite типы брались бы только из JS без `.d.ts`.
|
|
4
|
+
*/
|
|
5
|
+
import type {
|
|
6
|
+
LauncherModelApis,
|
|
7
|
+
RyntLauncherModelKey,
|
|
8
|
+
} from '@rynt/sdk/extension';
|
|
9
|
+
|
|
10
|
+
export declare function useModel<K extends RyntLauncherModelKey>(
|
|
11
|
+
key: K,
|
|
12
|
+
): LauncherModelApis[K];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* eslint-disable -- Rynt host bridge for `@rynt/sdk/session` */
|
|
2
|
+
const HOST = '__RYNT_EXTENSION_HOST_MODULES__';
|
|
3
|
+
|
|
4
|
+
function registry() {
|
|
5
|
+
const r = globalThis[HOST];
|
|
6
|
+
if (!r) {
|
|
7
|
+
throw new Error(
|
|
8
|
+
'[rynt/extension-build] Missing globalThis.' +
|
|
9
|
+
HOST +
|
|
10
|
+
' — call registerRyntExtensionHostModules() in the launcher before loading extensions.',
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
return r;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const $ = registry()['@rynt/sdk/session'];
|
|
17
|
+
if (!$) {
|
|
18
|
+
throw new Error(
|
|
19
|
+
'[rynt/extension-build] Host did not register @rynt/sdk/session',
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ===== Session Token =====
|
|
24
|
+
export const getSessionToken = $.getSessionToken;
|