Migrate github extension to ESM (2nd attempt) (#248312)

* Revert "GitHub - revert ESM migration (#247322)"

This reverts commit 2047ab0fff.

* use `"@vscode/extension-telemetry": "^1.0.0"` which doesn't use default export anymore
This commit is contained in:
Johannes Rieken
2025-05-07 15:52:46 +02:00
committed by GitHub
parent 146b12cdd0
commit cb0950e9d7
22 changed files with 227 additions and 283 deletions

View File

@@ -14,7 +14,6 @@ import { Stream } from 'stream';
import File from 'vinyl';
import { createStatsStream } from './stats';
import * as util2 from './util';
const vzip = require('gulp-vinyl-zip');
import filter from 'gulp-filter';
import rename from 'gulp-rename';
import fancyLog from 'fancy-log';
@@ -26,6 +25,7 @@ import { getProductionDependencies } from './dependencies';
import { IExtensionDefinition, getExtensionStream } from './builtInExtensions';
import { getVersion } from './getVersion';
import { fetchUrls, fetchGithub } from './fetch';
const vzip = require('gulp-vinyl-zip');
const root = path.dirname(path.dirname(__dirname));
const commit = getVersion(root);
@@ -62,7 +62,12 @@ function updateExtensionPackageJSON(input: Stream, update: (data: any) => any):
}
function fromLocal(extensionPath: string, forWeb: boolean, disableMangle: boolean): Stream {
const webpackConfigFileName = forWeb ? 'extension-browser.webpack.config.js' : 'extension.webpack.config.js';
const esm = JSON.parse(fs.readFileSync(path.join(extensionPath, 'package.json'), 'utf8')).type === 'module';
const webpackConfigFileName = forWeb
? `extension-browser.webpack.config.${!esm ? 'js' : 'cjs'}`
: `extension.webpack.config.${!esm ? 'js' : 'cjs'}`;
const isWebPacked = fs.existsSync(path.join(extensionPath, webpackConfigFileName));
let input = isWebPacked