Complete native ESM migration - #9633
Closed
dibarbet wants to merge 1 commit into
Closed
Conversation
dibarbet
force-pushed
the
dev/esm-nodenext-conversion
branch
from
August 4, 2026 22:56
26b5aed to
c6cd3b8
Compare
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c66ed411-9132-42f1-8a24-83a5aa049ab3
dibarbet
force-pushed
the
dev/esm-migration-cleanup
branch
from
August 4, 2026 23:15
144c03e to
739dd57
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the extension’s native ESM migration by upgrading telemetry to an ESM-capable version, enforcing bundle/runtime-require invariants via an esbuild metafile audit, and tightening artifact validation to ensure the VSIX and bundle activation contract align with the .mjs entrypoint.
Changes:
- Upgrade
@vscode/extension-telemetryto^1.5.2and switch to the package’s ESMTelemetryReporterexport. - Add a bundle audit (
auditBundle) and wire it intoesbuild.mjsto enforce a stable/allowlistedcreateRequirebridge surface. - Add/extend Jest artifact tests to validate the
.mjsentrypoint, signing coverage, and VSIX contents.
Show a summary per file
| File | Description |
|---|---|
| test/tasks/bundleAudit.test.js | Adds a unit test ensuring the new bundle audit rejects first-party CommonJS runtime requires. |
| test/omnisharp/omnisharpUnitTests/logging/telemetryObserver.test.ts | Updates telemetry observer tests to align with the new error-event reporting signature (no errorProps). |
| test/lsptoolshost/artifactTests/vsix.test.ts | Extends VSIX artifact validation to ensure the declared extension entrypoint exists inside the VSIX. |
| test/lsptoolshost/artifactTests/extensionBundle.test.ts | Adds artifact tests validating .mjs entrypoint, activation export contract, and signing includes .mjs. |
| test/fakes.ts | Updates telemetry fakes to the updated sendTelemetryErrorEvent signature. |
| tasks/compilation/bundleAudit.mjs | Introduces a metafile-based runtime-require audit with an allowlist and activation-contract checks. |
| src/shared/telemetryReporter.ts | Updates the telemetry reporter interface signature to remove errorProps. |
| src/omnisharp/observers/telemetryObserver.ts | Stops passing errorProps to telemetry and documents the behavior change. |
| src/main.ts | Switches to named TelemetryReporter import (ESM) instead of CommonJS default-wrapper logic. |
| package.json | Bumps @vscode/extension-telemetry dependency to ^1.5.2. |
| package-lock.json | Updates lockfile to reflect the telemetry upgrade and transitive dependency changes. |
| esbuild.mjs | Adds an ESM-resolve plugin for telemetry and enforces the new bundle audit during builds via an esbuild plugin. |
Copilot's findings
- Files reviewed: 11/12 changed files
- Comments generated: 2
Comment on lines
+69
to
+79
| function getPackageOwner(inputPath) { | ||
| const normalizedPath = inputPath.replaceAll('\\', '/'); | ||
| const marker = 'node_modules/'; | ||
| const markerIndex = normalizedPath.indexOf(marker); | ||
| if (markerIndex < 0) { | ||
| return undefined; | ||
| } | ||
|
|
||
| const [firstSegment, secondSegment] = normalizedPath.slice(markerIndex + marker.length).split('/'); | ||
| return firstSegment.startsWith('@') ? `${firstSegment}/${secondSegment}` : firstSegment; | ||
| } |
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(); |
Member
Author
|
Superseded by #9635, which consolidates the complete native ESM migration into one final-state commit and removes intermediate workaround history. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dev/*stack, targeting replacement layer 3 from Convert TypeScript sources to NodeNext ESM #9632out/test/jestProjectNames.mjsviaallowJsand narrow compiler inputs; no copy task or post-tsccopy step remains@vscode/extension-telemetryto 1.5.2 and explicitly select its advertised ESM entrycreateRequirecompatibility bridge.mjsactivation, signing, and VSIX artifact contractDev CI validates this replacement chain against
dev/esm-nodenext-conversion; the layer-4 replay retains the same stable patch ID as old layer commit96639c04.Bundle audit
require("vscode")remains limited tomicrosoft.aspnetcore.razor.vscodeandvscode-languageclientValidation
--fixnpm run compileDevtscsupport-file audit:out/test/jestProjectNames.mjsexists and no Jest configs are emittednpm run test:unit(12 suites, 515 tests)npm run packagenpm run test:artifacts(2 suites, 7 tests)extension/package.jsondeclares./dist/extension.mjs,extension/dist/extension.mjsis present, and legacyextension.jsis absentnpm run test:integration:untrusted(1 suite, 1 test)npm run test:integration:csharp(21 suites; 73 passed, 3 skipped)node --check dist/extension.mjsgit diff --check, stable patch-id, andgit range-diff