mirror of
https://github.com/microsoft/vscode.git
synced 2026-10-06 05:07:29 +01:00
nls: precompute translation cache identity during packaging Stamp the commit and NLS table fingerprint in product metadata and pass it through bootstrap. Reuse cached translations without reading or hashing default tables, while isolating different target tables and preserving legacy product compatibility. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
31 lines
1.7 KiB
TypeScript
31 lines
1.7 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import './bootstrap-server.js'; // this MUST come before other imports as it changes global state
|
|
import { join } from 'node:path';
|
|
import { devInjectNodeModuleLookupPath } from './bootstrap-node.js';
|
|
import { bootstrapESM } from './bootstrap-esm.js';
|
|
import { resolveNLSConfiguration } from './vs/base/node/nls.js';
|
|
import { product } from './bootstrap-meta.js';
|
|
|
|
// NLS
|
|
const nlsConfiguration = await resolveNLSConfiguration({ userLocale: 'en', osLocale: 'en', commit: product.commit, nlsMetadataHash: product.nlsMetadataHash, userDataPath: '', nlsMetadataPath: import.meta.dirname });
|
|
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfiguration); // required for `bootstrap-esm` to pick up NLS messages
|
|
|
|
if (process.env['VSCODE_DEV']) {
|
|
// When running out of sources, we need to load node modules from remote/node_modules,
|
|
// which are compiled against nodejs, not electron
|
|
process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] = process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'] || join(import.meta.dirname, '..', 'remote', 'node_modules');
|
|
devInjectNodeModuleLookupPath(process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH']);
|
|
} else {
|
|
delete process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH'];
|
|
}
|
|
|
|
// Bootstrap ESM
|
|
await bootstrapESM();
|
|
|
|
// Load Server
|
|
await import('./vs/server/node/server.cli.js');
|