Files
vscode/src/bootstrap-meta.ts
2026-02-17 14:14:39 +00:00

44 lines
1.8 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 { createRequire } from 'node:module';
import type { IProductConfiguration } from './vs/base/common/product.js';
import type { INodeProcess } from './vs/base/common/platform.js';
const require = createRequire(import.meta.url);
let productObj: Partial<IProductConfiguration> & { BUILD_INSERT_PRODUCT_CONFIGURATION?: string } = { BUILD_INSERT_PRODUCT_CONFIGURATION: 'BUILD_INSERT_PRODUCT_CONFIGURATION' }; // DO NOT MODIFY, PATCHED DURING BUILD
if (productObj['BUILD_INSERT_PRODUCT_CONFIGURATION']) {
productObj = require('../product.json'); // Running out of sources
}
let pkgObj = { BUILD_INSERT_PACKAGE_CONFIGURATION: 'BUILD_INSERT_PACKAGE_CONFIGURATION' }; // DO NOT MODIFY, PATCHED DURING BUILD
if (pkgObj['BUILD_INSERT_PACKAGE_CONFIGURATION']) {
pkgObj = require('../package.json'); // Running out of sources
}
// Load sub files
if ((process as INodeProcess).isEmbeddedApp) {
try {
const productSubObj = require('../product.sub.json');
productObj = Object.assign(productObj, productSubObj);
} catch (error) { /* ignore */ }
try {
const pkgSubObj = require('../package.sub.json');
pkgObj = Object.assign(pkgObj, pkgSubObj);
} catch (error) { /* ignore */ }
}
let productOverridesObj = {};
if (process.env['VSCODE_DEV']) {
try {
productOverridesObj = require('../product.overrides.json');
productObj = Object.assign(productObj, productOverridesObj);
} catch (error) { /* ignore */ }
}
export const product = productObj;
export const pkg = pkgObj;