Skip to content

Complete native ESM migration - #9618

Closed
dibarbet wants to merge 1 commit into
dibarbet-esm-nodenext-conversionfrom
dibarbet-esm-migration-cleanup
Closed

Complete native ESM migration#9618
dibarbet wants to merge 1 commit into
dibarbet-esm-nodenext-conversionfrom
dibarbet-esm-migration-cleanup

Conversation

@dibarbet

@dibarbet dibarbet commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • upgrade @vscode/extension-telemetry from 0.9.0 to 1.5.2 and bundle its advertised ESM entry
  • add an exact esbuild metafile audit for the remaining CommonJS runtime bridge, including first-party rejection and stale allowlist detection
  • validate the .mjs activation contract, signing coverage, and VSIX inclusion
  • preserve the TypeScript 5.7.3 NodeNext design with .ts source specifiers and rewriteRelativeImportExtensions

Bundle audit

  • development and production: 46 owners, 279 modules, 378 runtime requires
  • require("vscode") remains only in microsoft.aspnetcore.razor.vscode and vscode-languageclient
  • the createRequire bridge remains for audited CommonJS dependencies that require Node built-ins

Validation

  • targeted ESLint with --fix
  • npm run compileDev
  • npm run test:unit
  • npm run package
  • development and production bundle audits
  • npm run test:artifacts
  • npm run test:integration:untrusted
  • representative C# command-enablement activation integration test
  • VSIX inspection for extension/dist/extension.mjs
  • node --check dist/extension.mjs
  • git diff --check

@dibarbet
dibarbet requested a review from a team as a code owner August 4, 2026 00:01
@dibarbet
dibarbet force-pushed the dibarbet-esm-nodenext-conversion branch from d9a568d to 61309d9 Compare August 4, 2026 01:10
@dibarbet
dibarbet requested a review from a team as a code owner August 4, 2026 01:10
Audit the remaining CommonJS bundle bridge, prefer the telemetry ESM entry, and validate the native ESM release artifact.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 89dc5364-d759-419b-b4e5-afa454dfcd41
Copilot AI review requested due to automatic review settings August 4, 2026 01:56
@dibarbet
dibarbet force-pushed the dibarbet-esm-migration-cleanup branch from dd53025 to 96639c0 Compare August 4, 2026 01:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes the extension’s native ESM migration by upgrading @vscode/extension-telemetry, ensuring the bundled entry is the package’s ESM module, and adding automated audits/tests to prevent regressions (CommonJS bridge growth, activation/export contract, signing, and VSIX inclusion).

Changes:

  • Upgrades @vscode/extension-telemetry to ^1.5.2 and updates activation code to use the ESM-oriented import path.
  • Adds an esbuild metafile-based bundle audit (with allowlist + stale detection) and wires it into the esbuild pipeline.
  • Adds artifact tests to validate .mjs entry existence/exports, signing coverage, and VSIX packaging of the declared entry.
Show a summary per file
File Description
test/tasks/bundleAudit.test.js Adds a unit test covering bundle audit failure on first-party CommonJS runtime require usage.
test/omnisharp/omnisharpUnitTests/logging/telemetryObserver.test.ts Updates telemetry observer unit test to align with the updated error-event signature.
test/lsptoolshost/artifactTests/vsix.test.ts Enhances VSIX artifact validation to ensure the declared extension entry is present.
test/lsptoolshost/artifactTests/extensionBundle.test.ts Adds artifact-level checks for .mjs entry existence, activation export contract, and signing coverage.
test/fakes.ts Updates telemetry reporter fake to match the updated error-event API shape.
tasks/compilation/bundleAudit.mjs Introduces the runtime-require audit for bundled CommonJS dependencies (allowlist + drift detection).
src/shared/telemetryReporter.ts Updates the telemetry reporter interface to remove the unused errorProps parameter.
src/omnisharp/observers/telemetryObserver.ts Stops passing errorProps to telemetry (documenting it was ignored upstream).
src/main.ts Switches telemetry import/usage to match the upgraded telemetry package.
package.json Bumps @vscode/extension-telemetry dependency to ^1.5.2.
package-lock.json Updates lockfile for telemetry upgrade and transitive dependency changes.
esbuild.mjs Adds resolution override for telemetry ESM entry and wires in bundle audit via esbuild metafile.

Copilot's findings

  • Files reviewed: 11/12 changed files
  • Comments generated: 2

Comment thread src/main.ts
import { EventStream } from './eventStream.ts';
import { PlatformInformation } from './shared/platform.ts';
import telemetryReporterModule from '@vscode/extension-telemetry';
import { TelemetryReporter } from '@vscode/extension-telemetry';
Comment on lines +28 to +35
const entries: string[] = [];
zipFile.on('entry', (entry) => {
entries.push(entry.fileName);
zipFile.readEntry();
});
zipFile.on('end', () => resolve(entries));
zipFile.on('error', reject);
zipFile.readEntry();
@dibarbet

dibarbet commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

Superseded by #9633 on dev/esm-migration-cleanup so the updated branch trigger runs CI. The replacement PR is part of stack #9634.

@dibarbet dibarbet closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants