@nomo-ai/wcode-dev-host 0.9.2

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/index.html ADDED
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>WCode Plugin Dev</title>
8
+ <style>
9
+ body {
10
+ margin: 0;
11
+ padding: 0;
12
+ width: 100vw;
13
+ height: 100vh;
14
+ overflow: hidden;
15
+ }
16
+ #app {
17
+ width: 100%;
18
+ height: 100%;
19
+ }
20
+ </style>
21
+ </head>
22
+ <body>
23
+ <div id="app"></div>
24
+ <script type="module" src="/src/main.ts"></script>
25
+ </body>
26
+ </html>
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@nomo-ai/wcode-dev-host",
3
+ "private": false,
4
+ "version": "0.9.2",
5
+ "description": "WCode plugin development host",
6
+ "author": "NomoAIT",
7
+ "license": "Apache-2.0",
8
+ "type": "module",
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "build": "vue-tsc && vite build",
12
+ "preview": "vite preview"
13
+ },
14
+ "dependencies": {
15
+ "@nomo-ai/wcode-core": "workspace:^0.9.2",
16
+ "element-plus": "^2.13.2",
17
+ "vue": "^3.5.27"
18
+ },
19
+ "peerDependencies": {
20
+ "@nomo-ai/wcode-core": "^0.9.2"
21
+ },
22
+ "devDependencies": {
23
+ "@nomo-ai/wcode-core": "workspace:*",
24
+ "@vitejs/plugin-vue": "^6.0.4",
25
+ "typescript": "^5.9.3",
26
+ "vite": "^7.3.1",
27
+ "vue-tsc": "^3.2.4"
28
+ }
29
+ }
package/src/App.vue ADDED
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div id="editor-container" ref="editorContainer" style="width: 100%; height: 100vh;"></div>
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { ref, onMounted } from 'vue';
7
+ import { WCode } from 'wcode';
8
+ import type { WCodePlugin } from 'wcode';
9
+ import * as UserPluginModule from 'virtual:user-plugin';
10
+
11
+ const editorContainer = ref<HTMLElement>();
12
+ let ide: WCode | null = null;
13
+
14
+ onMounted(() => {
15
+ if (!editorContainer.value) return;
16
+
17
+ let userPlugin: WCodePlugin | null = null;
18
+
19
+ if (UserPluginModule.default && (UserPluginModule.default as any).activate) {
20
+ userPlugin = UserPluginModule.default as WCodePlugin;
21
+ } else {
22
+ const keys = Object.keys(UserPluginModule);
23
+ for (const key of keys) {
24
+ const exportItem = (UserPluginModule as any)[key];
25
+ if (exportItem && typeof exportItem === 'object' && typeof exportItem.activate === 'function') {
26
+ userPlugin = exportItem as WCodePlugin;
27
+ break;
28
+ }
29
+ }
30
+ }
31
+
32
+ const plugins: WCodePlugin[] = [];
33
+ if (userPlugin) {
34
+ console.log('Loaded User Plugin:', userPlugin.name);
35
+ plugins.push(userPlugin);
36
+ } else {
37
+ console.warn('Could not find a valid WCodePlugin export in src/index.ts');
38
+ }
39
+
40
+ ide = new WCode(editorContainer.value, {
41
+ theme: 'dark',
42
+ layout: {
43
+ showFileTree: true,
44
+ showTabs: true,
45
+ showStatusBar: true,
46
+ showTerminal: true
47
+ },
48
+ files: [
49
+ {
50
+ path: '/welcome.txt',
51
+ name: 'welcome.txt',
52
+ type: 'file',
53
+ content: 'Welcome to WCode Plugin Development Environment!\n\nYour plugin is loaded and active.\nCheck the console for logs.'
54
+ }
55
+ ],
56
+ plugins,
57
+ terminalToken: 'dev-token-123'
58
+ });
59
+
60
+ ide.on('ready', () => {
61
+ console.log('WCode Dev Environment Ready');
62
+ });
63
+ });
64
+ </script>
65
+
66
+ <style>
67
+ :root {
68
+ color-scheme: dark;
69
+ }
70
+ </style>
package/src/env.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ declare module '*.vue' {
2
+ import type { DefineComponent } from 'vue';
3
+ const component: DefineComponent<{}, {}, any>;
4
+ export default component;
5
+ }
6
+
7
+ declare module 'virtual:user-plugin' {
8
+ import { WCodePlugin } from 'wcode';
9
+ const plugin: WCodePlugin | { [key: string]: WCodePlugin };
10
+ export default plugin;
11
+ }
package/src/main.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { createApp } from 'vue';
2
+ import App from './App.vue';
3
+ import { WCode } from '@nomo-ai/wcode-core';
4
+ import 'element-plus/dist/index.css';
5
+ import 'element-plus/theme-chalk/dark/css-vars.css';
6
+
7
+ console.log('WCode Core loaded:', WCode);
8
+
9
+ createApp(App).mount('#app');
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "baseUrl": ".",
5
+ "types": ["vite/client", "element-plus/global"],
6
+ "jsx": "preserve",
7
+ "jsxImportSource": "vue"
8
+ },
9
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
10
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,44 @@
1
+ import { defineConfig } from 'vite';
2
+ import vue from '@vitejs/plugin-vue';
3
+ import path from 'path';
4
+ import monacoEditorPlugin from 'vite-plugin-monaco-editor';
5
+
6
+ // @ts-ignore
7
+ const monacoEditorPluginDefault = monacoEditorPlugin.default || monacoEditorPlugin;
8
+
9
+ export default defineConfig({
10
+ plugins: [
11
+ vue(),
12
+ monacoEditorPluginDefault({
13
+ languageWorkers: ['editorWorkerService', 'typescript', 'json', 'html', 'css'],
14
+ }),
15
+ {
16
+ name: 'virtual-user-plugin-mock',
17
+ resolveId(id) {
18
+ if (id === 'virtual:user-plugin') {
19
+ return '\0virtual:user-plugin';
20
+ }
21
+ },
22
+ load(id) {
23
+ if (id === '\0virtual:user-plugin') {
24
+ return 'export default {}'; // Empty plugin for standalone mode
25
+ }
26
+ }
27
+ }
28
+ ],
29
+ resolve: {
30
+ alias: {
31
+ // Link to local source for development
32
+ 'wcode': path.resolve(__dirname, '../src'),
33
+ // Fix for JSZip in browser
34
+ 'jszip': 'jszip/dist/jszip.min.js',
35
+ }
36
+ },
37
+ assetsInclude: ['**/*.ttf'],
38
+ server: {
39
+ port: 3000,
40
+ fs: {
41
+ strict: false
42
+ }
43
+ }
44
+ });