mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Just make it a const, env var controlled for later use
This commit is contained in:
parent
66b407b8f5
commit
5edb40e7a4
@ -175,7 +175,6 @@ async function runDtsBundler(entrypoint, output) {
|
||||
* @property {boolean} [exportIsTsObject]
|
||||
* @property {boolean} [treeShaking]
|
||||
* @property {boolean} [usePublicAPI]
|
||||
* @property {boolean} [tsgoCompat]
|
||||
* @property {() => void} [onWatchRebuild]
|
||||
*/
|
||||
function createBundler(entrypoint, outfile, taskOptions = {}) {
|
||||
@ -197,9 +196,6 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
|
||||
treeShaking: taskOptions.treeShaking,
|
||||
packages: "external",
|
||||
logLevel: "warning",
|
||||
define: {
|
||||
__TSGO_COMPAT__: taskOptions.tsgoCompat ? "true" : "false",
|
||||
},
|
||||
// legalComments: "none", // If we add copyright headers to the source files, uncomment.
|
||||
};
|
||||
|
||||
@ -236,8 +232,7 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
|
||||
const require = "require";
|
||||
const fakeName = "Q".repeat(require.length);
|
||||
const fakeNameRegExp = new RegExp(fakeName, "g");
|
||||
options.define = options.define || {};
|
||||
options.define[require] = fakeName;
|
||||
options.define = { [require]: fakeName };
|
||||
|
||||
// For historical reasons, TypeScript does not set __esModule. Hack esbuild's __toCommonJS to be a noop.
|
||||
// We reference `__copyProps` to ensure the final bundle doesn't have any unreferenced code.
|
||||
@ -546,7 +541,6 @@ const { main: tests, watch: watchTests } = entrypointBuildTask({
|
||||
output: testRunner,
|
||||
mainDeps: [generateLibs],
|
||||
bundlerOptions: {
|
||||
tsgoCompat: true,
|
||||
// Ensure we never drop any dead code, which might be helpful while debugging.
|
||||
treeShaking: false,
|
||||
onWatchRebuild() {
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import {
|
||||
__String,
|
||||
__TSGO_COMPAT__,
|
||||
AccessExpression,
|
||||
AccessFlags,
|
||||
AccessorDeclaration,
|
||||
|
||||
@ -5,11 +5,10 @@ export const versionMajorMinor = "5.7";
|
||||
/** The version of the TypeScript compiler release */
|
||||
export const version: string = `${versionMajorMinor}.0-dev`;
|
||||
|
||||
declare global {
|
||||
var __TSGO_COMPAT__: boolean | undefined; // eslint-disable-line no-var, @typescript-eslint/naming-convention
|
||||
}
|
||||
const tsgoCompatEnv = typeof process !== "undefined" && process.env ? process.env.TSGO_COMPAT : undefined;
|
||||
|
||||
globalThis.__TSGO_COMPAT__ ??= false;
|
||||
/** @internal */
|
||||
export const __TSGO_COMPAT__: boolean = tsgoCompatEnv ? tsgoCompatEnv === "true" : true;
|
||||
|
||||
/**
|
||||
* Type of objects whose values are all of the same type.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user