kimi-code/apps/vscode/scripts/vsix-targets.mjs
qer d1ca65e1de
feat(vscode): migrate extension to Node SDK (#1769)
* feat(vscode): migrate extension to Node SDK

* fix(vscode): address CI failures

* fix(vis): handle token count records

* fix(vscode): keep chat toolbar and header readable at narrow widths

* fix(vscode): map yolo to core yolo permission and honor the global yolo setting

* docs(vscode): record Node SDK migration design

* docs(vscode): split breaking changes out of the 0.6.0 changelog

* fix(vscode): keep a resumed session's thinking effort instead of reapplying the default

* fix(vscode): announce session status when a view attaches so the display matches it

* fix(vscode): align webview thinking effort handling with the TUI
2026-07-16 17:27:21 +08:00

45 lines
1.3 KiB
JavaScript

import { dirname, join, resolve } from 'node:path';
import { fileURLToPath, pathToFileURL } from 'node:url';
export const VSIX_TARGETS = Object.freeze([
'darwin-x64',
'darwin-arm64',
'linux-x64',
'linux-arm64',
'win32-x64',
'win32-arm64',
]);
export const extensionRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
export const defaultVsixOutputDir = join(extensionRoot, 'artifacts', 'vsix');
export function vsixFileName(target) {
assertVsixTarget(target);
return `kimi-code-${target}.vsix`;
}
export function normalizeVsixTargets(values) {
const requested = values.length === 0 || values.includes('all') ? VSIX_TARGETS : values;
if (values.includes('all') && values.length > 1) {
throw new Error('Target "all" cannot be combined with an explicit VSIX target.');
}
const targets = [];
for (const target of requested) {
assertVsixTarget(target);
if (!targets.includes(target)) targets.push(target);
}
return targets;
}
export function assertVsixTarget(target) {
if (VSIX_TARGETS.includes(target)) return;
throw new Error(
`Unknown VSIX target "${target}". Expected one of: ${VSIX_TARGETS.join(', ')}`,
);
}
export function isMainModule(metaUrl) {
const argvPath = process.argv[1];
return argvPath !== undefined && pathToFileURL(resolve(argvPath)).href === metaUrl;
}