-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplugin.ts
More file actions
67 lines (59 loc) · 1.84 KB
/
plugin.ts
File metadata and controls
67 lines (59 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* ObjectStack Console Plugin
*
* Serves the pre-built Console SPA as a static UI plugin.
* HonoServerPlugin auto-discovers this plugin via `type: 'ui-plugin'`
* and mounts it at `/<slug>` (i.e. `/console`).
*
* The SPA is built with base path '/'.
*
* Usage in any ObjectStack application:
*
* import { ConsolePlugin } from '@object-ui/console';
*
* export default {
* plugins: [
* new HonoServerPlugin({ port: 3000 }),
* new ConsolePlugin(),
* ],
* };
*
* @see https://github.com/objectstack-ai/objectui
*/
import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
/** Absolute path to the built SPA assets (dist/) */
export const staticPath = resolve(__dirname, 'dist');
export class ConsolePlugin {
readonly name = '@object-ui/console';
readonly version = '1.0.0';
readonly type = 'ui-plugin' as const;
readonly slug = 'console';
readonly staticPath = staticPath;
readonly default = true;
readonly description = 'ObjectStack Console - The standard runtime UI for ObjectStack applications';
readonly metadata = {
author: 'ObjectUI Team',
license: 'MIT',
homepage: 'https://www.objectui.org',
repository: 'https://github.com/objectstack-ai/objectui',
capabilities: [
'ui-rendering',
'crud-operations',
'multi-app-support',
'dynamic-navigation',
'theme-support',
],
};
init() {
// No initialization needed — HonoServerPlugin handles static serving & SPA fallback
}
async start(_ctx: any) {
// Static file serving and SPA fallback are handled automatically by
// HonoServerPlugin's auto-discovery (type: 'ui-plugin', slug: 'console').
// No custom route registration needed.
}
}
export default ConsolePlugin;