cdeops 13.4.1 → 13.5.1-alpha.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/client.d.ts +817 -817
- package/package.json +5 -2
- package/server.d.ts +816 -816
- package/server.js +55 -55
- package/server.mjs +46 -46
package/server.js
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
// This is the module that is bundled with extensions when they use `import ... from 'cdeops/server'` or
|
|
2
|
-
// `require('cdeops/server')`. It delegates to the extension host's runtime implementation of this module by calling
|
|
3
|
-
// `global.require` (which ensures that the extension host's `require` is called at runtime).
|
|
4
|
-
//
|
|
5
|
-
// When running outside an extension host (e.g., standalone CLI execution), this module provides a
|
|
6
|
-
// lightweight fallback that captures registerCommand handlers so they can be invoked directly.
|
|
7
|
-
//
|
|
8
|
-
// This dummy file is used when extension is bundled with a JavaScript bundler that lacks support for externals
|
|
9
|
-
// (or when `cdeops/server` is not configured as an external module). Parcel does not support extenals
|
|
10
|
-
// (https://github.com/parcel-bundler/parcel/issues/144). Webpack, Rollup, and Microbundle support externals.
|
|
11
|
-
|
|
12
|
-
// Try the extension host first; fall back to a standalone shim for CLI use.
|
|
13
|
-
let hostModule;
|
|
14
|
-
try {
|
|
15
|
-
// In the extension host, global.require('cdeops/server') returns the real API.
|
|
16
|
-
// Outside the host this will either throw or return this same module (circular), so we detect both.
|
|
17
|
-
const candidate = global.require('cdeops/server');
|
|
18
|
-
if (candidate && candidate !== module.exports && candidate !== exports && typeof candidate.commands === 'object') {
|
|
19
|
-
hostModule = candidate;
|
|
20
|
-
}
|
|
21
|
-
} catch (_) {
|
|
22
|
-
// No extension host — use standalone fallback below.
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (hostModule) {
|
|
26
|
-
module.exports = hostModule;
|
|
27
|
-
} else {
|
|
28
|
-
// ── Standalone fallback ─────────────────────────────────────────────────────
|
|
29
|
-
// Provides just enough of the cdeops/server API for extensions to activate
|
|
30
|
-
// and register command handlers when executed by the CLI outside the IDE.
|
|
31
|
-
const _handlers = Object.create(null);
|
|
32
|
-
|
|
33
|
-
const commands = {
|
|
34
|
-
_handlers,
|
|
35
|
-
registerCommand(id, handler) {
|
|
36
|
-
_handlers[id] = handler;
|
|
37
|
-
return {
|
|
38
|
-
dispose() {
|
|
39
|
-
delete _handlers[id];
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
executeCommand(id) {
|
|
44
|
-
const args = Array.prototype.slice.call(arguments, 1);
|
|
45
|
-
const h = _handlers[id];
|
|
46
|
-
if (!h) throw new Error('Command not found: ' + id);
|
|
47
|
-
return h.apply(null, args);
|
|
48
|
-
},
|
|
49
|
-
getCommands() {
|
|
50
|
-
return Promise.resolve(Object.keys(_handlers));
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
module.exports = { commands: commands, _handlers: _handlers };
|
|
55
|
-
}
|
|
1
|
+
// This is the module that is bundled with extensions when they use `import ... from 'cdeops/server'` or
|
|
2
|
+
// `require('cdeops/server')`. It delegates to the extension host's runtime implementation of this module by calling
|
|
3
|
+
// `global.require` (which ensures that the extension host's `require` is called at runtime).
|
|
4
|
+
//
|
|
5
|
+
// When running outside an extension host (e.g., standalone CLI execution), this module provides a
|
|
6
|
+
// lightweight fallback that captures registerCommand handlers so they can be invoked directly.
|
|
7
|
+
//
|
|
8
|
+
// This dummy file is used when extension is bundled with a JavaScript bundler that lacks support for externals
|
|
9
|
+
// (or when `cdeops/server` is not configured as an external module). Parcel does not support extenals
|
|
10
|
+
// (https://github.com/parcel-bundler/parcel/issues/144). Webpack, Rollup, and Microbundle support externals.
|
|
11
|
+
|
|
12
|
+
// Try the extension host first; fall back to a standalone shim for CLI use.
|
|
13
|
+
let hostModule;
|
|
14
|
+
try {
|
|
15
|
+
// In the extension host, global.require('cdeops/server') returns the real API.
|
|
16
|
+
// Outside the host this will either throw or return this same module (circular), so we detect both.
|
|
17
|
+
const candidate = global.require('cdeops/server');
|
|
18
|
+
if (candidate && candidate !== module.exports && candidate !== exports && typeof candidate.commands === 'object') {
|
|
19
|
+
hostModule = candidate;
|
|
20
|
+
}
|
|
21
|
+
} catch (_) {
|
|
22
|
+
// No extension host — use standalone fallback below.
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (hostModule) {
|
|
26
|
+
module.exports = hostModule;
|
|
27
|
+
} else {
|
|
28
|
+
// ── Standalone fallback ─────────────────────────────────────────────────────
|
|
29
|
+
// Provides just enough of the cdeops/server API for extensions to activate
|
|
30
|
+
// and register command handlers when executed by the CLI outside the IDE.
|
|
31
|
+
const _handlers = Object.create(null);
|
|
32
|
+
|
|
33
|
+
const commands = {
|
|
34
|
+
_handlers,
|
|
35
|
+
registerCommand(id, handler) {
|
|
36
|
+
_handlers[id] = handler;
|
|
37
|
+
return {
|
|
38
|
+
dispose() {
|
|
39
|
+
delete _handlers[id];
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
executeCommand(id) {
|
|
44
|
+
const args = Array.prototype.slice.call(arguments, 1);
|
|
45
|
+
const h = _handlers[id];
|
|
46
|
+
if (!h) throw new Error('Command not found: ' + id);
|
|
47
|
+
return h.apply(null, args);
|
|
48
|
+
},
|
|
49
|
+
getCommands() {
|
|
50
|
+
return Promise.resolve(Object.keys(_handlers));
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
module.exports = { commands: commands, _handlers: _handlers };
|
|
55
|
+
}
|
package/server.mjs
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
// This is the module that is bundled with extensions when they use `import ... from 'cdeops/server'`.
|
|
2
|
-
// It delegates to the extension host's runtime implementation of this module by calling
|
|
3
|
-
// `globalThis.require` (which ensures that the extension host's `require` is called at runtime).
|
|
4
|
-
//
|
|
5
|
-
// When running outside an extension host (e.g., standalone CLI execution), this module provides a
|
|
6
|
-
// lightweight fallback that captures registerCommand handlers so they can be invoked directly.
|
|
7
|
-
//
|
|
8
|
-
// This dummy file is used when extension is bundled with a JavaScript bundler that lacks support for externals
|
|
9
|
-
// (or when `cdeops/server` is not configured as an external module). Parcel does not support externals
|
|
10
|
-
// (https://github.com/parcel-bundler/parcel/issues/144). Webpack, Rollup, and Microbundle support externals.
|
|
11
|
-
|
|
12
|
-
// Try the extension host first; fall back to a standalone shim for CLI use.
|
|
13
|
-
let cdeopsServer;
|
|
14
|
-
try {
|
|
15
|
-
const candidate = globalThis.require('cdeops/server');
|
|
16
|
-
if (candidate && typeof candidate.commands === 'object') {
|
|
17
|
-
cdeopsServer = candidate;
|
|
18
|
-
}
|
|
19
|
-
} catch (_) {
|
|
20
|
-
// No extension host — use standalone fallback below.
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (!cdeopsServer) {
|
|
24
|
-
// ── Standalone fallback ─────────────────────────────────────────────────────
|
|
25
|
-
const _handlers = Object.create(null);
|
|
26
|
-
const commands = {
|
|
27
|
-
_handlers,
|
|
28
|
-
registerCommand(id, handler) {
|
|
29
|
-
_handlers[id] = handler;
|
|
30
|
-
return { dispose() { delete _handlers[id]; } };
|
|
31
|
-
},
|
|
32
|
-
executeCommand(id, ...args) {
|
|
33
|
-
const h = _handlers[id];
|
|
34
|
-
if (!h) throw new Error('Command not found: ' + id);
|
|
35
|
-
return h(...args);
|
|
36
|
-
},
|
|
37
|
-
getCommands() {
|
|
38
|
-
return Promise.resolve(Object.keys(_handlers));
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
cdeopsServer = { commands, _handlers };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default cdeopsServer;
|
|
45
|
-
export const commands = cdeopsServer.commands;
|
|
46
|
-
export const _handlers = cdeopsServer._handlers;
|
|
1
|
+
// This is the module that is bundled with extensions when they use `import ... from 'cdeops/server'`.
|
|
2
|
+
// It delegates to the extension host's runtime implementation of this module by calling
|
|
3
|
+
// `globalThis.require` (which ensures that the extension host's `require` is called at runtime).
|
|
4
|
+
//
|
|
5
|
+
// When running outside an extension host (e.g., standalone CLI execution), this module provides a
|
|
6
|
+
// lightweight fallback that captures registerCommand handlers so they can be invoked directly.
|
|
7
|
+
//
|
|
8
|
+
// This dummy file is used when extension is bundled with a JavaScript bundler that lacks support for externals
|
|
9
|
+
// (or when `cdeops/server` is not configured as an external module). Parcel does not support externals
|
|
10
|
+
// (https://github.com/parcel-bundler/parcel/issues/144). Webpack, Rollup, and Microbundle support externals.
|
|
11
|
+
|
|
12
|
+
// Try the extension host first; fall back to a standalone shim for CLI use.
|
|
13
|
+
let cdeopsServer;
|
|
14
|
+
try {
|
|
15
|
+
const candidate = globalThis.require('cdeops/server');
|
|
16
|
+
if (candidate && typeof candidate.commands === 'object') {
|
|
17
|
+
cdeopsServer = candidate;
|
|
18
|
+
}
|
|
19
|
+
} catch (_) {
|
|
20
|
+
// No extension host — use standalone fallback below.
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!cdeopsServer) {
|
|
24
|
+
// ── Standalone fallback ─────────────────────────────────────────────────────
|
|
25
|
+
const _handlers = Object.create(null);
|
|
26
|
+
const commands = {
|
|
27
|
+
_handlers,
|
|
28
|
+
registerCommand(id, handler) {
|
|
29
|
+
_handlers[id] = handler;
|
|
30
|
+
return { dispose() { delete _handlers[id]; } };
|
|
31
|
+
},
|
|
32
|
+
executeCommand(id, ...args) {
|
|
33
|
+
const h = _handlers[id];
|
|
34
|
+
if (!h) throw new Error('Command not found: ' + id);
|
|
35
|
+
return h(...args);
|
|
36
|
+
},
|
|
37
|
+
getCommands() {
|
|
38
|
+
return Promise.resolve(Object.keys(_handlers));
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
cdeopsServer = { commands, _handlers };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default cdeopsServer;
|
|
45
|
+
export const commands = cdeopsServer.commands;
|
|
46
|
+
export const _handlers = cdeopsServer._handlers;
|