mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-15 07:28:05 +00:00
Fix import and use clearer file name
This commit is contained in:
@@ -54,7 +54,7 @@ const esbuild_1 = __importDefault(require("esbuild"));
|
||||
const gulp_sourcemaps_1 = __importDefault(require("gulp-sourcemaps"));
|
||||
const fancy_log_1 = __importDefault(require("fancy-log"));
|
||||
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
||||
const tsconfig_1 = require("./tsconfig");
|
||||
const tsconfigUtils_1 = require("./tsconfigUtils");
|
||||
const REPO_ROOT_PATH = path_1.default.join(__dirname, '../..');
|
||||
const DEFAULT_FILE_HEADER = [
|
||||
'/*!--------------------------------------------------------',
|
||||
@@ -226,6 +226,6 @@ function minifyTask(src, sourceMapBaseUrl) {
|
||||
}
|
||||
function getBuildTarget() {
|
||||
const tsconfigPath = path_1.default.join(REPO_ROOT_PATH, 'src', 'tsconfig.base.json');
|
||||
return (0, tsconfig_1.getTargetStringFromTsConfig)(tsconfigPath);
|
||||
return (0, tsconfigUtils_1.getTargetStringFromTsConfig)(tsconfigPath);
|
||||
}
|
||||
//# sourceMappingURL=optimize.js.map
|
||||
@@ -15,7 +15,7 @@ import esbuild from 'esbuild';
|
||||
import sourcemaps from 'gulp-sourcemaps';
|
||||
import fancyLog from 'fancy-log';
|
||||
import ansiColors from 'ansi-colors';
|
||||
import { getTargetStringFromTsConfig } from './tsconfig';
|
||||
import { getTargetStringFromTsConfig } from './tsconfigUtils';
|
||||
|
||||
declare module 'gulp-sourcemaps' {
|
||||
interface WriteOptions {
|
||||
|
||||
@@ -13,7 +13,7 @@ const typescript_1 = __importDefault(require("typescript"));
|
||||
const node_worker_threads_1 = __importDefault(require("node:worker_threads"));
|
||||
const vinyl_1 = __importDefault(require("vinyl"));
|
||||
const node_os_1 = require("node:os");
|
||||
const tsconfig_1 = require("../tsconfig");
|
||||
const tsconfigUtils_1 = require("../tsconfigUtils");
|
||||
function transpile(tsSrc, options) {
|
||||
const isAmd = /\n(import|export)/m.test(tsSrc);
|
||||
if (!isAmd && options.compilerOptions?.module === typescript_1.default.ModuleKind.AMD) {
|
||||
@@ -241,7 +241,7 @@ class ESBuildTranspiler {
|
||||
_logFn('Transpile', `will use ESBuild to transpile source files`);
|
||||
this._outputFileNames = new OutputFileNameOracle(_cmdLine, configFilePath);
|
||||
const isExtension = configFilePath.includes('extensions');
|
||||
const target = (0, tsconfig_1.getTargetStringFromTsConfig)(configFilePath);
|
||||
const target = (0, tsconfigUtils_1.getTargetStringFromTsConfig)(configFilePath);
|
||||
this._transformOpts = {
|
||||
target: [target],
|
||||
format: isExtension ? 'cjs' : 'esm',
|
||||
|
||||
@@ -8,7 +8,7 @@ import ts from 'typescript';
|
||||
import threads from 'node:worker_threads';
|
||||
import Vinyl from 'vinyl';
|
||||
import { cpus } from 'node:os';
|
||||
import { getTargetStringFromTsConfig } from '../tsconfig';
|
||||
import { getTargetStringFromTsConfig } from '../tsconfigUtils';
|
||||
|
||||
interface TranspileReq {
|
||||
readonly tsSrcs: string[];
|
||||
|
||||
28
build/lib/tsconfigUtils.js
Normal file
28
build/lib/tsconfigUtils.js
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getTargetStringFromTsConfig = getTargetStringFromTsConfig;
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
const path_1 = require("path");
|
||||
const typescript_1 = __importDefault(require("typescript"));
|
||||
/**
|
||||
* Get the target (e.g. 'ES2024') from a tsconfig.json file.
|
||||
*/
|
||||
function getTargetStringFromTsConfig(configFilePath) {
|
||||
const parsed = typescript_1.default.readConfigFile(configFilePath, typescript_1.default.sys.readFile);
|
||||
if (parsed.error) {
|
||||
throw new Error(`Cannot determine target from ${configFilePath}. TS error: ${parsed.error.messageText}`);
|
||||
}
|
||||
const cmdLine = typescript_1.default.parseJsonConfigFileContent(parsed.config, typescript_1.default.sys, (0, path_1.dirname)(configFilePath), {});
|
||||
const resolved = typeof cmdLine.options.target !== 'undefined' ? typescript_1.default.ScriptTarget[cmdLine.options.target] : undefined;
|
||||
if (!resolved) {
|
||||
throw new Error(`Could not resolve target in ${configFilePath}`);
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
//# sourceMappingURL=tsconfigUtils.js.map
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { dirname } from 'path/posix';
|
||||
import { dirname } from 'path';
|
||||
import ts from 'typescript';
|
||||
|
||||
/**
|
||||
Reference in New Issue
Block a user