deckide 3.0.3 → 3.2.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/bin/deckide.js +286 -36
- package/{apps/server/dist → dist}/config.js +6 -11
- package/{apps/server/dist → dist}/routes/files.js +1 -1
- package/{packages/shared/dist → dist/shared}/types.js +0 -1
- package/{packages/shared/dist → dist/shared}/utils-node.js +0 -1
- package/{packages/shared/dist → dist/shared}/utils.js +0 -1
- package/{apps/server/dist → dist}/utils/error.js +1 -1
- package/{apps/server/dist → dist}/utils/path.js +1 -1
- package/package.json +67 -42
- package/apps/server/package.json +0 -26
- package/packages/shared/dist/types.d.ts +0 -124
- package/packages/shared/dist/types.d.ts.map +0 -1
- package/packages/shared/dist/types.js.map +0 -1
- package/packages/shared/dist/utils-node.d.ts +0 -22
- package/packages/shared/dist/utils-node.d.ts.map +0 -1
- package/packages/shared/dist/utils-node.js.map +0 -1
- package/packages/shared/dist/utils.d.ts +0 -90
- package/packages/shared/dist/utils.d.ts.map +0 -1
- package/packages/shared/dist/utils.js.map +0 -1
- package/packages/shared/package.json +0 -16
- /package/{apps/server/dist → dist}/index.js +0 -0
- /package/{apps/server/dist → dist}/middleware/auth.js +0 -0
- /package/{apps/server/dist → dist}/middleware/cors.js +0 -0
- /package/{apps/server/dist → dist}/middleware/security.js +0 -0
- /package/{apps/server/dist → dist}/pty-client.js +0 -0
- /package/{apps/server/dist → dist}/pty-daemon.js +0 -0
- /package/{apps/server/dist → dist}/routes/decks.js +0 -0
- /package/{apps/server/dist → dist}/routes/git.js +0 -0
- /package/{apps/server/dist → dist}/routes/settings.js +0 -0
- /package/{apps/server/dist → dist}/routes/terminals.js +0 -0
- /package/{apps/server/dist → dist}/routes/workspaces.js +0 -0
- /package/{apps/server/dist → dist}/server.js +0 -0
- /package/{apps/server/dist → dist}/types.js +0 -0
- /package/{apps/server/dist → dist}/utils/database.js +0 -0
- /package/{apps/server/dist → dist}/utils/shell.js +0 -0
- /package/{apps/server/dist → dist}/websocket.js +0 -0
- /package/{apps/web → web}/dist/assets/index-C-usl0y0.css +0 -0
- /package/{apps/web → web}/dist/assets/index-CibzlLP5.js +0 -0
- /package/{apps/web → web}/dist/index.html +0 -0
package/bin/deckide.js
CHANGED
|
@@ -3,65 +3,315 @@
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import os from 'node:os';
|
|
6
|
+
import fs from 'node:fs';
|
|
6
7
|
import { execSync } from 'node:child_process';
|
|
8
|
+
import crypto from 'node:crypto';
|
|
7
9
|
|
|
8
10
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const dataDir = path.join(os.homedir(), '.deckide');
|
|
12
|
+
const settingsFile = path.join(dataDir, 'settings.json');
|
|
13
|
+
|
|
14
|
+
// ─── Settings helpers ───────────────────────────────────────────
|
|
15
|
+
|
|
16
|
+
function loadSettings() {
|
|
17
|
+
try {
|
|
18
|
+
return JSON.parse(fs.readFileSync(settingsFile, 'utf-8'));
|
|
19
|
+
} catch {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function saveSettings(settings) {
|
|
25
|
+
fs.mkdirSync(dataDir, { recursive: true });
|
|
26
|
+
fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2) + '\n');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ─── CLI ────────────────────────────────────────────────────────
|
|
9
30
|
|
|
10
|
-
// Parse CLI arguments
|
|
11
31
|
const args = process.argv.slice(2);
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
32
|
+
const command = args[0];
|
|
33
|
+
|
|
34
|
+
// ── deckide version ──
|
|
35
|
+
if (command === '--version' || command === '-v') {
|
|
36
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
37
|
+
console.log(pkg.version);
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ── deckide help ──
|
|
42
|
+
if (command === '--help' || command === '-h' || command === 'help') {
|
|
43
|
+
console.log(`
|
|
44
|
+
Deck IDE - Browser-based IDE
|
|
45
|
+
|
|
46
|
+
Usage:
|
|
47
|
+
deckide Start the server
|
|
48
|
+
deckide config Show all settings
|
|
49
|
+
deckide config set <key> <val> Set a config value
|
|
50
|
+
deckide config get <key> Get a config value
|
|
51
|
+
deckide config reset Reset all settings
|
|
52
|
+
deckide auth on Enable basic auth (interactive)
|
|
53
|
+
deckide auth off Disable basic auth
|
|
54
|
+
deckide auth status Show auth status
|
|
55
|
+
deckide status Show server status
|
|
56
|
+
deckide stop Stop running server
|
|
57
|
+
|
|
58
|
+
Start options:
|
|
59
|
+
-p, --port <port> Port to listen on
|
|
60
|
+
--host <host> Host to bind to
|
|
61
|
+
--no-open Don't open browser
|
|
62
|
+
|
|
63
|
+
Config keys:
|
|
64
|
+
port Server port (default: 8787)
|
|
65
|
+
host Bind host (default: 0.0.0.0)
|
|
66
|
+
cors CORS origin
|
|
67
|
+
maxFileSize Max file size in bytes
|
|
68
|
+
trustProxy Trust proxy headers (true/false)
|
|
69
|
+
`);
|
|
70
|
+
process.exit(0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ── deckide config ──
|
|
74
|
+
if (command === 'config') {
|
|
75
|
+
const sub = args[1];
|
|
76
|
+
const settings = loadSettings();
|
|
77
|
+
|
|
78
|
+
if (!sub || sub === 'list') {
|
|
79
|
+
// Show all config
|
|
80
|
+
if (Object.keys(settings).length === 0) {
|
|
81
|
+
console.log('No custom settings. Using defaults.');
|
|
82
|
+
console.log(' port: 8787');
|
|
83
|
+
console.log(' host: 0.0.0.0');
|
|
84
|
+
} else {
|
|
85
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
86
|
+
if (key === 'basicAuthPassword' && value) {
|
|
87
|
+
console.log(` ${key}: ********`);
|
|
88
|
+
} else {
|
|
89
|
+
console.log(` ${key}: ${value}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
process.exit(0);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (sub === 'get') {
|
|
97
|
+
const key = args[2];
|
|
98
|
+
if (!key) {
|
|
99
|
+
console.error('Usage: deckide config get <key>');
|
|
100
|
+
process.exit(1);
|
|
101
|
+
}
|
|
102
|
+
const val = settings[key];
|
|
103
|
+
if (val === undefined) {
|
|
104
|
+
console.log(`${key}: (not set)`);
|
|
105
|
+
} else if (key === 'basicAuthPassword') {
|
|
106
|
+
console.log(`${key}: ********`);
|
|
107
|
+
} else {
|
|
108
|
+
console.log(`${key}: ${val}`);
|
|
109
|
+
}
|
|
110
|
+
process.exit(0);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (sub === 'set') {
|
|
114
|
+
const key = args[2];
|
|
115
|
+
let value = args[3];
|
|
116
|
+
if (!key || value === undefined) {
|
|
117
|
+
console.error('Usage: deckide config set <key> <value>');
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
// Type coercion
|
|
121
|
+
if (value === 'true') value = true;
|
|
122
|
+
else if (value === 'false') value = false;
|
|
123
|
+
else if (/^\d+$/.test(value)) value = parseInt(value, 10);
|
|
124
|
+
|
|
125
|
+
settings[key] = value;
|
|
126
|
+
saveSettings(settings);
|
|
127
|
+
console.log(`${key} = ${key === 'basicAuthPassword' ? '********' : value}`);
|
|
128
|
+
process.exit(0);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (sub === 'reset') {
|
|
132
|
+
saveSettings({});
|
|
133
|
+
console.log('Settings reset to defaults.');
|
|
134
|
+
process.exit(0);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
console.error(`Unknown config command: ${sub}`);
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// ── deckide auth ──
|
|
142
|
+
if (command === 'auth') {
|
|
143
|
+
const sub = args[1];
|
|
144
|
+
const settings = loadSettings();
|
|
145
|
+
|
|
146
|
+
if (sub === 'status') {
|
|
147
|
+
if (settings.basicAuthEnabled) {
|
|
148
|
+
console.log('Basic auth: enabled');
|
|
149
|
+
console.log(` user: ${settings.basicAuthUser || '(not set)'}`);
|
|
150
|
+
console.log(` password: ${settings.basicAuthPassword ? '********' : '(not set)'}`);
|
|
151
|
+
} else {
|
|
152
|
+
console.log('Basic auth: disabled');
|
|
153
|
+
}
|
|
154
|
+
process.exit(0);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (sub === 'off') {
|
|
158
|
+
settings.basicAuthEnabled = false;
|
|
159
|
+
delete settings.basicAuthUser;
|
|
160
|
+
delete settings.basicAuthPassword;
|
|
161
|
+
saveSettings(settings);
|
|
162
|
+
console.log('Basic auth disabled.');
|
|
163
|
+
process.exit(0);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (sub === 'on') {
|
|
167
|
+
const user = args[2];
|
|
168
|
+
const password = args[3];
|
|
169
|
+
|
|
170
|
+
if (!user || !password) {
|
|
171
|
+
// Generate random password if not provided
|
|
172
|
+
const genUser = user || 'admin';
|
|
173
|
+
const genPassword = crypto.randomBytes(16).toString('base64url');
|
|
174
|
+
settings.basicAuthEnabled = true;
|
|
175
|
+
settings.basicAuthUser = genUser;
|
|
176
|
+
settings.basicAuthPassword = genPassword;
|
|
177
|
+
saveSettings(settings);
|
|
178
|
+
console.log('Basic auth enabled.');
|
|
179
|
+
console.log(` user: ${genUser}`);
|
|
180
|
+
console.log(` password: ${genPassword}`);
|
|
181
|
+
console.log('');
|
|
182
|
+
console.log('Restart the server for changes to take effect.');
|
|
183
|
+
process.exit(0);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (password.length < 8) {
|
|
187
|
+
console.error('Error: password must be at least 8 characters.');
|
|
188
|
+
process.exit(1);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
settings.basicAuthEnabled = true;
|
|
192
|
+
settings.basicAuthUser = user;
|
|
193
|
+
settings.basicAuthPassword = password;
|
|
194
|
+
saveSettings(settings);
|
|
195
|
+
console.log('Basic auth enabled.');
|
|
196
|
+
console.log(` user: ${user}`);
|
|
197
|
+
console.log('Restart the server for changes to take effect.');
|
|
198
|
+
process.exit(0);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (!sub) {
|
|
202
|
+
// Default to status
|
|
203
|
+
const enabled = settings.basicAuthEnabled;
|
|
204
|
+
if (enabled) {
|
|
205
|
+
console.log('Basic auth: enabled');
|
|
206
|
+
console.log(` user: ${settings.basicAuthUser || '(not set)'}`);
|
|
207
|
+
} else {
|
|
208
|
+
console.log('Basic auth: disabled');
|
|
209
|
+
}
|
|
210
|
+
console.log('');
|
|
211
|
+
console.log('Usage:');
|
|
212
|
+
console.log(' deckide auth on [user] [password] Enable auth');
|
|
213
|
+
console.log(' deckide auth off Disable auth');
|
|
214
|
+
console.log(' deckide auth status Show status');
|
|
215
|
+
process.exit(0);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
console.error(`Unknown auth command: ${sub}`);
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// ── deckide status ──
|
|
223
|
+
if (command === 'status') {
|
|
224
|
+
const settings = loadSettings();
|
|
225
|
+
const daemonInfoPath = path.join(dataDir, 'pty-daemon.json');
|
|
226
|
+
|
|
227
|
+
console.log('Deck IDE status');
|
|
228
|
+
console.log(` data dir: ${dataDir}`);
|
|
229
|
+
console.log(` port: ${settings.port || 8787}`);
|
|
230
|
+
console.log(` auth: ${settings.basicAuthEnabled ? 'enabled' : 'disabled'}`);
|
|
231
|
+
|
|
232
|
+
// Check if server is running
|
|
233
|
+
const port = settings.port || 8787;
|
|
234
|
+
try {
|
|
235
|
+
const res = execSync(`curl -s -o /dev/null -w "%{http_code}" http://localhost:${port}/health`, {
|
|
236
|
+
timeout: 3000,
|
|
237
|
+
}).toString().trim();
|
|
238
|
+
console.log(` server: running (port ${port})`);
|
|
239
|
+
} catch {
|
|
240
|
+
console.log(' server: not running');
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Check PTY daemon
|
|
244
|
+
if (fs.existsSync(daemonInfoPath)) {
|
|
245
|
+
try {
|
|
246
|
+
const info = JSON.parse(fs.readFileSync(daemonInfoPath, 'utf-8'));
|
|
247
|
+
console.log(` pty daemon: running (pid ${info.pid}, port ${info.port})`);
|
|
248
|
+
} catch {
|
|
249
|
+
console.log(' pty daemon: unknown');
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
console.log(' pty daemon: not running');
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
process.exit(0);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// ── deckide stop ──
|
|
259
|
+
if (command === 'stop') {
|
|
260
|
+
const settings = loadSettings();
|
|
261
|
+
const port = settings.port || 8787;
|
|
262
|
+
try {
|
|
263
|
+
execSync(`curl -s -X POST http://localhost:${port}/api/shutdown -H "Content-Type: application/json" -d '{"terminateDaemon":true}'`, {
|
|
264
|
+
timeout: 5000,
|
|
265
|
+
});
|
|
266
|
+
console.log('Server stopped.');
|
|
267
|
+
} catch {
|
|
268
|
+
console.log('Server is not running or could not be reached.');
|
|
269
|
+
}
|
|
270
|
+
process.exit(0);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// ── deckide (start server) ──
|
|
274
|
+
|
|
275
|
+
// Parse start options
|
|
276
|
+
const startOptions = {
|
|
277
|
+
port: null,
|
|
278
|
+
host: null,
|
|
15
279
|
open: true,
|
|
16
280
|
};
|
|
17
281
|
|
|
18
282
|
for (let i = 0; i < args.length; i++) {
|
|
19
283
|
const arg = args[i];
|
|
20
284
|
if ((arg === '--port' || arg === '-p') && args[i + 1]) {
|
|
21
|
-
|
|
285
|
+
startOptions.port = parseInt(args[i + 1], 10);
|
|
22
286
|
i++;
|
|
23
287
|
} else if (arg === '--host' && args[i + 1]) {
|
|
24
|
-
|
|
288
|
+
startOptions.host = args[i + 1];
|
|
25
289
|
i++;
|
|
26
290
|
} else if (arg === '--no-open') {
|
|
27
|
-
|
|
28
|
-
} else if (arg
|
|
29
|
-
console.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Usage:
|
|
33
|
-
deckide [options]
|
|
34
|
-
|
|
35
|
-
Options:
|
|
36
|
-
-p, --port <port> Port to listen on (default: 8787)
|
|
37
|
-
--host <host> Host to bind to (default: 0.0.0.0)
|
|
38
|
-
--no-open Don't open browser automatically
|
|
39
|
-
-h, --help Show this help message
|
|
40
|
-
-v, --version Show version
|
|
41
|
-
`);
|
|
42
|
-
process.exit(0);
|
|
43
|
-
} else if (arg === '--version' || arg === '-v') {
|
|
44
|
-
const pkg = await import(path.join(__dirname, '..', 'package.json'), { with: { type: 'json' } });
|
|
45
|
-
console.log(pkg.default.version);
|
|
46
|
-
process.exit(0);
|
|
291
|
+
startOptions.open = false;
|
|
292
|
+
} else if (arg && !arg.startsWith('-')) {
|
|
293
|
+
console.error(`Unknown command: ${arg}`);
|
|
294
|
+
console.error('Run "deckide help" for usage.');
|
|
295
|
+
process.exit(1);
|
|
47
296
|
}
|
|
48
297
|
}
|
|
49
298
|
|
|
50
|
-
//
|
|
51
|
-
const
|
|
299
|
+
// Load settings and apply CLI overrides
|
|
300
|
+
const settings = loadSettings();
|
|
301
|
+
const port = startOptions.port || settings.port || 8787;
|
|
302
|
+
const host = startOptions.host || settings.host || '0.0.0.0';
|
|
303
|
+
|
|
52
304
|
process.env.DECKIDE_DATA_DIR = dataDir;
|
|
53
|
-
process.env.PORT = String(
|
|
54
|
-
process.env.HOST =
|
|
305
|
+
process.env.PORT = String(port);
|
|
306
|
+
process.env.HOST = host;
|
|
55
307
|
|
|
56
308
|
// Import and start the server
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const server = await createServer();
|
|
309
|
+
const { createServer } = await import(path.join(__dirname, '..', 'dist', 'server.js'));
|
|
310
|
+
await createServer();
|
|
61
311
|
|
|
62
312
|
// Open browser after server starts
|
|
63
|
-
if (
|
|
64
|
-
const url = `http://localhost:${
|
|
313
|
+
if (startOptions.open) {
|
|
314
|
+
const url = `http://localhost:${port}`;
|
|
65
315
|
setTimeout(() => {
|
|
66
316
|
try {
|
|
67
317
|
const platform = process.platform;
|
|
@@ -5,9 +5,10 @@ import { fileURLToPath } from 'node:url';
|
|
|
5
5
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
// When running as a global CLI (`deckide`), DECKIDE_DATA_DIR is set to ~/.deckide/
|
|
7
7
|
const globalDataDir = process.env.DECKIDE_DATA_DIR;
|
|
8
|
+
// New flat structure: dist/ is at root, settings.json is at root
|
|
8
9
|
export const SETTINGS_FILE = globalDataDir
|
|
9
10
|
? path.join(globalDataDir, 'settings.json')
|
|
10
|
-
: path.join(__dirname, '..', '
|
|
11
|
+
: path.join(__dirname, '..', 'settings.json');
|
|
11
12
|
let fileSettings = {};
|
|
12
13
|
try {
|
|
13
14
|
const settingsData = fsSync.readFileSync(SETTINGS_FILE, 'utf-8');
|
|
@@ -34,17 +35,11 @@ export const MAX_FILE_SIZE = parseIntEnv(process.env.MAX_FILE_SIZE, 10 * 1024 *
|
|
|
34
35
|
export const TERMINAL_BUFFER_LIMIT = parseIntEnv(process.env.TERMINAL_BUFFER_LIMIT, 500_000);
|
|
35
36
|
export const MAX_REQUEST_BODY_SIZE = parseIntEnv(process.env.MAX_REQUEST_BODY_SIZE, 1024 * 1024); // 1MB default
|
|
36
37
|
export const TRUST_PROXY = process.env.TRUST_PROXY === 'true'; // Only trust proxy headers if explicitly enabled
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
const packagedDistDir = path.resolve(__dirname, '..', 'web', 'dist');
|
|
40
|
-
const devDistDir = path.resolve(__dirname, '..', '..', 'web', 'dist');
|
|
41
|
-
export const distDir = fsSync.existsSync(packagedDistDir) ? packagedDistDir : devDistDir;
|
|
38
|
+
// Flat structure: dist/ and web/dist/ are siblings at project root
|
|
39
|
+
export const distDir = path.resolve(__dirname, '..', 'web', 'dist');
|
|
42
40
|
export const hasStatic = fsSync.existsSync(distDir);
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
export const dataDir = globalDataDir
|
|
46
|
-
? globalDataDir
|
|
47
|
-
: fsSync.existsSync(path.dirname(packagedDataDir)) && !fsSync.existsSync(devDataDir) ? packagedDataDir : devDataDir;
|
|
41
|
+
const localDataDir = path.resolve(__dirname, '..', 'data');
|
|
42
|
+
export const dataDir = globalDataDir || localDataDir;
|
|
48
43
|
export const dbPath = process.env.DB_PATH || path.join(dataDir, 'deck-ide.db');
|
|
49
44
|
// Validate critical configuration
|
|
50
45
|
if (NODE_ENV === 'production') {
|
|
@@ -5,7 +5,7 @@ import { MAX_FILE_SIZE, DEFAULT_ROOT } from '../config.js';
|
|
|
5
5
|
import { createHttpError, handleError, readJson } from '../utils/error.js';
|
|
6
6
|
import { resolveSafePath, normalizeWorkspacePath } from '../utils/path.js';
|
|
7
7
|
import { requireWorkspace } from './workspaces.js';
|
|
8
|
-
import { sortFileEntries } from '
|
|
8
|
+
import { sortFileEntries } from '../shared/utils-node.js';
|
|
9
9
|
function mapFileEntry(entry, normalizedBase) {
|
|
10
10
|
const entryPath = normalizedBase ? `${normalizedBase}/${entry.name}` : entry.name;
|
|
11
11
|
return {
|
|
@@ -32,4 +32,3 @@ export function getWorkspaceName(workspacePath, fallbackIndex) {
|
|
|
32
32
|
}
|
|
33
33
|
// Re-export browser-compatible utilities
|
|
34
34
|
export { getFileExtension, getLanguageFromPath, normalizePathSeparators, isHidden, getErrorMessage, createHttpError, truncate, shortId, formatFileSize, sortFileEntries } from './utils.js';
|
|
35
|
-
//# sourceMappingURL=utils-node.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NODE_ENV } from '../config.js';
|
|
2
|
-
import { createHttpError as sharedCreateHttpError, getErrorMessage as sharedGetErrorMessage } from '
|
|
2
|
+
import { createHttpError as sharedCreateHttpError, getErrorMessage as sharedGetErrorMessage } from '../shared/utils-node.js';
|
|
3
3
|
export function createHttpError(message, status) {
|
|
4
4
|
return sharedCreateHttpError(message, status);
|
|
5
5
|
}
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { DEFAULT_ROOT } from '../config.js';
|
|
4
4
|
import { createHttpError } from './error.js';
|
|
5
|
-
import { normalizeWorkspacePath as sharedNormalizeWorkspacePath, getWorkspaceKey as sharedGetWorkspaceKey, getWorkspaceName as sharedGetWorkspaceName } from '
|
|
5
|
+
import { normalizeWorkspacePath as sharedNormalizeWorkspacePath, getWorkspaceKey as sharedGetWorkspaceKey, getWorkspaceName as sharedGetWorkspaceName } from '../shared/utils-node.js';
|
|
6
6
|
export function normalizeWorkspacePath(inputPath = '') {
|
|
7
7
|
return sharedNormalizeWorkspacePath(inputPath || '', DEFAULT_ROOT);
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,42 +1,67 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "deckide",
|
|
3
|
-
"version": "3.0
|
|
4
|
-
"description": "Deck IDE - Browser-based IDE with terminal, file explorer, and git integration",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"deckide": "bin/deckide.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"bin/",
|
|
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
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "deckide",
|
|
3
|
+
"version": "3.2.0",
|
|
4
|
+
"description": "Deck IDE - Browser-based IDE with terminal, file explorer, and git integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"deckide": "bin/deckide.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"dist/",
|
|
12
|
+
"web/dist/"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev:web": "cd web && npx vite",
|
|
16
|
+
"dev:server": "npx tsx src/index.ts",
|
|
17
|
+
"build:web": "cd web && npx vite build",
|
|
18
|
+
"build:server": "tsc",
|
|
19
|
+
"build": "npm run build:web && npm run build:server",
|
|
20
|
+
"serve": "node dist/index.js",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@hono/node-server": "^1.12.2",
|
|
25
|
+
"hono": "^4.5.10",
|
|
26
|
+
"node-pty": "^1.0.0",
|
|
27
|
+
"simple-git": "^3.27.0",
|
|
28
|
+
"ws": "^8.17.0",
|
|
29
|
+
"zod": "^4.0.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@monaco-editor/react": "^4.6.0",
|
|
33
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
34
|
+
"@types/node": "^24.10.9",
|
|
35
|
+
"@types/react": "^18.3.12",
|
|
36
|
+
"@types/react-dom": "^18.3.1",
|
|
37
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
38
|
+
"clsx": "^2.1.1",
|
|
39
|
+
"react": "^18.3.1",
|
|
40
|
+
"react-dom": "^18.3.1",
|
|
41
|
+
"tailwindcss": "^4.2.1",
|
|
42
|
+
"tsx": "^4.19.2",
|
|
43
|
+
"typescript": "^5.6.3",
|
|
44
|
+
"vite": "^5.2.0",
|
|
45
|
+
"xterm": "^5.3.0",
|
|
46
|
+
"xterm-addon-fit": "^0.8.0",
|
|
47
|
+
"xterm-addon-unicode11": "^0.6.0",
|
|
48
|
+
"xterm-addon-web-links": "^0.9.0",
|
|
49
|
+
"xterm-addon-webgl": "^0.16.0"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=22.5.0"
|
|
53
|
+
},
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "https://github.com/tako0614/ide.git"
|
|
57
|
+
},
|
|
58
|
+
"keywords": [
|
|
59
|
+
"ide",
|
|
60
|
+
"editor",
|
|
61
|
+
"terminal",
|
|
62
|
+
"web-ide",
|
|
63
|
+
"developer-tools"
|
|
64
|
+
],
|
|
65
|
+
"author": "tako0614",
|
|
66
|
+
"license": "MIT"
|
|
67
|
+
}
|
package/apps/server/package.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "deck-ide-server",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "tsx src/index.ts",
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"serve": "node dist/index.js",
|
|
10
|
-
"start": "node dist/index.js"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@deck-ide/shared": "file:../../packages/shared",
|
|
14
|
-
"@hono/node-server": "^1.12.2",
|
|
15
|
-
"hono": "^4.5.10",
|
|
16
|
-
"node-pty": "^1.0.0",
|
|
17
|
-
"simple-git": "^3.27.0",
|
|
18
|
-
"ws": "^8.17.0",
|
|
19
|
-
"zod": "^4.0.0"
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@types/node": "^24.10.9",
|
|
23
|
-
"tsx": "^4.19.2",
|
|
24
|
-
"typescript": "^5.6.3"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
export type FileEntryType = 'file' | 'dir';
|
|
2
|
-
export interface Workspace {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
path: string;
|
|
6
|
-
createdAt: string;
|
|
7
|
-
}
|
|
8
|
-
export interface Deck {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
root: string;
|
|
12
|
-
workspaceId: string;
|
|
13
|
-
createdAt: string;
|
|
14
|
-
}
|
|
15
|
-
export interface FileSystemEntry {
|
|
16
|
-
name: string;
|
|
17
|
-
path: string;
|
|
18
|
-
type: FileEntryType;
|
|
19
|
-
}
|
|
20
|
-
export interface FileTreeNode extends FileSystemEntry {
|
|
21
|
-
expanded: boolean;
|
|
22
|
-
loading: boolean;
|
|
23
|
-
children?: FileTreeNode[];
|
|
24
|
-
}
|
|
25
|
-
export interface EditorFile {
|
|
26
|
-
id: string;
|
|
27
|
-
name: string;
|
|
28
|
-
path: string;
|
|
29
|
-
language: string;
|
|
30
|
-
contents: string;
|
|
31
|
-
dirty: boolean;
|
|
32
|
-
}
|
|
33
|
-
export interface TerminalSession {
|
|
34
|
-
id: string;
|
|
35
|
-
title: string;
|
|
36
|
-
createdAt?: string;
|
|
37
|
-
}
|
|
38
|
-
export interface WorkspaceState {
|
|
39
|
-
files: EditorFile[];
|
|
40
|
-
activeFileId: string | null;
|
|
41
|
-
tree: FileTreeNode[];
|
|
42
|
-
treeLoading: boolean;
|
|
43
|
-
treeError: string | null;
|
|
44
|
-
}
|
|
45
|
-
export interface DeckState {
|
|
46
|
-
terminals: TerminalSession[];
|
|
47
|
-
}
|
|
48
|
-
export interface ApiError {
|
|
49
|
-
error: string;
|
|
50
|
-
}
|
|
51
|
-
export interface ApiConfig {
|
|
52
|
-
defaultRoot: string;
|
|
53
|
-
}
|
|
54
|
-
export interface ApiFileResponse {
|
|
55
|
-
path: string;
|
|
56
|
-
contents: string;
|
|
57
|
-
}
|
|
58
|
-
export interface ApiFileSaveResponse {
|
|
59
|
-
path: string;
|
|
60
|
-
saved: boolean;
|
|
61
|
-
}
|
|
62
|
-
export interface ApiTerminalCreateResponse {
|
|
63
|
-
id: string;
|
|
64
|
-
title: string;
|
|
65
|
-
}
|
|
66
|
-
export interface CreateWorkspaceRequest {
|
|
67
|
-
path: string;
|
|
68
|
-
name?: string;
|
|
69
|
-
}
|
|
70
|
-
export interface CreateDeckRequest {
|
|
71
|
-
name?: string;
|
|
72
|
-
workspaceId: string;
|
|
73
|
-
}
|
|
74
|
-
export interface CreateTerminalRequest {
|
|
75
|
-
deckId: string;
|
|
76
|
-
title?: string;
|
|
77
|
-
}
|
|
78
|
-
export interface SaveFileRequest {
|
|
79
|
-
workspaceId: string;
|
|
80
|
-
path: string;
|
|
81
|
-
contents: string;
|
|
82
|
-
}
|
|
83
|
-
export interface GetFileRequest {
|
|
84
|
-
workspaceId: string;
|
|
85
|
-
path: string;
|
|
86
|
-
}
|
|
87
|
-
export interface GetFilesRequest {
|
|
88
|
-
workspaceId: string;
|
|
89
|
-
path?: string;
|
|
90
|
-
}
|
|
91
|
-
export interface GetPreviewRequest {
|
|
92
|
-
path: string;
|
|
93
|
-
subpath?: string;
|
|
94
|
-
}
|
|
95
|
-
export type GitFileStatusCode = 'modified' | 'staged' | 'untracked' | 'deleted' | 'renamed' | 'conflicted';
|
|
96
|
-
export interface GitFileStatus {
|
|
97
|
-
path: string;
|
|
98
|
-
status: GitFileStatusCode;
|
|
99
|
-
staged: boolean;
|
|
100
|
-
}
|
|
101
|
-
export interface GitStatus {
|
|
102
|
-
isGitRepo: boolean;
|
|
103
|
-
branch: string;
|
|
104
|
-
files: GitFileStatus[];
|
|
105
|
-
}
|
|
106
|
-
export interface GitDiff {
|
|
107
|
-
original: string;
|
|
108
|
-
modified: string;
|
|
109
|
-
path: string;
|
|
110
|
-
}
|
|
111
|
-
export interface GitRepoInfo {
|
|
112
|
-
path: string;
|
|
113
|
-
name: string;
|
|
114
|
-
branch: string;
|
|
115
|
-
fileCount: number;
|
|
116
|
-
}
|
|
117
|
-
export interface GitFileStatusWithRepo extends GitFileStatus {
|
|
118
|
-
repoPath: string;
|
|
119
|
-
}
|
|
120
|
-
export interface MultiRepoGitStatus {
|
|
121
|
-
repos: GitRepoInfo[];
|
|
122
|
-
files: GitFileStatusWithRepo[];
|
|
123
|
-
}
|
|
124
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,KAAK,CAAC;AAG3C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;CACrB;AAGD,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAGD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,OAAO,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ize a workspace path to an absolute path (Node.js version)
|
|
3
|
-
* @param inputPath - Input path (can be relative or absolute)
|
|
4
|
-
* @param defaultPath - Default path to use if inputPath is empty
|
|
5
|
-
* @returns Normalized absolute path
|
|
6
|
-
*/
|
|
7
|
-
export declare function normalizeWorkspacePath(inputPath: string, defaultPath: string): string;
|
|
8
|
-
/**
|
|
9
|
-
* Get a workspace key for indexing (handles case-insensitivity on Windows)
|
|
10
|
-
* @param workspacePath - Workspace path
|
|
11
|
-
* @returns Normalized key for indexing
|
|
12
|
-
*/
|
|
13
|
-
export declare function getWorkspaceKey(workspacePath: string): string;
|
|
14
|
-
/**
|
|
15
|
-
* Extract a workspace name from its path
|
|
16
|
-
* @param workspacePath - Workspace path
|
|
17
|
-
* @param fallbackIndex - Index to use for fallback name
|
|
18
|
-
* @returns Workspace name
|
|
19
|
-
*/
|
|
20
|
-
export declare function getWorkspaceName(workspacePath: string, fallbackIndex: number): string;
|
|
21
|
-
export { getFileExtension, getLanguageFromPath, normalizePathSeparators, isHidden, getErrorMessage, createHttpError, truncate, shortId, formatFileSize, sortFileEntries } from './utils.js';
|
|
22
|
-
//# sourceMappingURL=utils-node.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-node.d.ts","sourceRoot":"","sources":["../utils-node.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAIrF;AAGD,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,QAAQ,EACR,OAAO,EACP,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-node.js","sourceRoot":"","sources":["../utils-node.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,qEAAqE;AAErE,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,WAAmB;IAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,WAAW,CAAC,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,aAAqB;IACnD,MAAM,UAAU,GAAG,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACxD,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;AAC9E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,aAAqB,EAAE,aAAqB;IAC3E,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,IAAI,IAAI,WAAW,aAAa,EAAE,CAAC;AAC5C,CAAC;AAED,yCAAyC;AACzC,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,QAAQ,EACR,OAAO,EACP,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get a workspace key for indexing (handles case-insensitivity on Windows)
|
|
3
|
-
* @param workspacePath - Workspace path
|
|
4
|
-
* @returns Normalized key for indexing
|
|
5
|
-
*/
|
|
6
|
-
export declare function getWorkspaceKey(workspacePath: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Extract a workspace name from its path
|
|
9
|
-
* @param workspacePath - Workspace path
|
|
10
|
-
* @param fallbackIndex - Index to use for fallback name
|
|
11
|
-
* @returns Workspace name
|
|
12
|
-
*/
|
|
13
|
-
export declare function getWorkspaceName(workspacePath: string, fallbackIndex: number): string;
|
|
14
|
-
/**
|
|
15
|
-
* Normalize a workspace path to an absolute path
|
|
16
|
-
* Note: This function requires Node.js path module
|
|
17
|
-
* For browser usage, import from utils-node.ts instead
|
|
18
|
-
* @param inputPath - Input path (can be relative or absolute)
|
|
19
|
-
* @param defaultPath - Default path to use if inputPath is empty
|
|
20
|
-
* @returns Normalized absolute path
|
|
21
|
-
*/
|
|
22
|
-
export declare function normalizeWorkspacePath(inputPath: string, defaultPath: string): string;
|
|
23
|
-
/**
|
|
24
|
-
* Get file extension from a path
|
|
25
|
-
* @param filePath - File path
|
|
26
|
-
* @returns File extension (without dot) or empty string
|
|
27
|
-
*/
|
|
28
|
-
export declare function getFileExtension(filePath: string): string;
|
|
29
|
-
/**
|
|
30
|
-
* Map file extension to Monaco editor language
|
|
31
|
-
* @param filePath - File path
|
|
32
|
-
* @returns Monaco language identifier
|
|
33
|
-
*/
|
|
34
|
-
export declare function getLanguageFromPath(filePath: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Normalize path separators to forward slashes
|
|
37
|
-
* @param inputPath - Input path
|
|
38
|
-
* @returns Path with forward slashes
|
|
39
|
-
*/
|
|
40
|
-
export declare function normalizePathSeparators(inputPath: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* Check if a path is a hidden file or directory (starts with .)
|
|
43
|
-
* @param name - File or directory name
|
|
44
|
-
* @returns True if hidden
|
|
45
|
-
*/
|
|
46
|
-
export declare function isHidden(name: string): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Get error message from unknown error type
|
|
49
|
-
* @param error - Error object
|
|
50
|
-
* @returns Error message string
|
|
51
|
-
*/
|
|
52
|
-
export declare function getErrorMessage(error: unknown): string;
|
|
53
|
-
/**
|
|
54
|
-
* Create an HTTP error with status code
|
|
55
|
-
* @param message - Error message
|
|
56
|
-
* @param status - HTTP status code
|
|
57
|
-
* @returns Error object with status property
|
|
58
|
-
*/
|
|
59
|
-
export declare function createHttpError(message: string, status: number): Error & {
|
|
60
|
-
status: number;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Truncate string to max length with ellipsis
|
|
64
|
-
* @param str - Input string
|
|
65
|
-
* @param maxLength - Maximum length
|
|
66
|
-
* @returns Truncated string
|
|
67
|
-
*/
|
|
68
|
-
export declare function truncate(str: string, maxLength: number): string;
|
|
69
|
-
/**
|
|
70
|
-
* Generate a short ID from a UUID (first 8 characters)
|
|
71
|
-
* @param uuid - Full UUID
|
|
72
|
-
* @returns Short ID
|
|
73
|
-
*/
|
|
74
|
-
export declare function shortId(uuid: string): string;
|
|
75
|
-
/**
|
|
76
|
-
* Format file size in human-readable format
|
|
77
|
-
* @param bytes - File size in bytes
|
|
78
|
-
* @returns Formatted file size string
|
|
79
|
-
*/
|
|
80
|
-
export declare function formatFileSize(bytes: number): string;
|
|
81
|
-
/**
|
|
82
|
-
* Sort file system entries (directories first, then alphabetically)
|
|
83
|
-
* @param entries - Array of file system entries
|
|
84
|
-
* @returns Sorted array
|
|
85
|
-
*/
|
|
86
|
-
export declare function sortFileEntries<T extends {
|
|
87
|
-
name: string;
|
|
88
|
-
type: 'file' | 'dir';
|
|
89
|
-
}>(entries: T[]): T[];
|
|
90
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAK7D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAA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C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,GAAG,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAmD,OAAY;IAC5F,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC3B,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;YACtB,OAAO,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@deck-ide/shared",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"exports": {
|
|
6
|
-
"./types": "./dist/types.js",
|
|
7
|
-
"./utils": "./dist/utils.js",
|
|
8
|
-
"./utils-node": "./dist/utils-node.js"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "tsc"
|
|
12
|
-
},
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"typescript": "^5.7.2"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|