Skip to content

MD-2245 Publish an ESM build Node can resolve without a bundler - #32

Merged
jayfeng0625 merged 3 commits into
mainfrom
bug/MD-2245-esm-build-node-resolution
Aug 7, 2026
Merged

jayfeng0625 merged 3 commits into
mainfrom
bug/MD-2245-esm-build-node-resolution

Conversation

@jayfeng0625

Copy link
Copy Markdown
Contributor

No description provided.

@jayfeng0625
jayfeng0625 requested a review from Copilot July 28, 2026 12:43
@changeset-bot

changeset-bot Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 49797da

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@monetizationos/proxy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Enables the package’s ESM output and declarations to resolve in plain Node.js without a bundler.

Changes:

  • Migrates TypeScript to NodeNext and adds explicit .ts source specifiers.
  • Adds packaged-consumer verification on Node 22 and 24.
  • Updates release automation, documentation, and changeset metadata.

Reviewed changes

Copilot reviewed 57 out of 58 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsconfig.json Enables NodeNext resolution and import rewriting.
test/surfaceDecisionCookies.spec.ts Updates relative imports.
test/stages/surfaceDecisions.spec.ts Updates relative imports.
test/stages/surfaceComponents.spec.ts Updates relative imports.
test/stages/surfaceBehavior.spec.ts Updates relative imports.
test/stages/shouldIgnorePath.spec.ts Updates relative imports.
test/stages/pageMetadata.spec.ts Updates relative imports.
test/stages/originRequest.spec.ts Updates relative imports.
test/stages/originLinkRewriter.spec.ts Updates relative imports.
test/stages/linkRewriting.spec.ts Updates relative imports.
test/stages/isRedirectResponse.spec.ts Updates relative imports.
test/stages/getTargetUrl.spec.ts Updates relative imports.
test/stages/fetchSurfaceDecisions.spec.ts Updates relative imports.
test/stages/customEndpoint.spec.ts Updates relative imports.
test/MOSProxy.spec.ts Updates imports, including the adapter barrel.
test/hostPathMatcher.spec.ts Updates relative imports.
test/fakes/PassthroughHtmlRewriter.ts Updates adapter type import.
test/fakes/MockFetcher.ts Updates adapter type import.
test/fakes/MemoryLogger.ts Updates logger type import.
test/fakes/LolHtmlRewriter.ts Updates adapter type import.
test/configResolution.spec.ts Updates relative imports.
test/configOverrides.spec.ts Updates relative imports.
test/config.spec.ts Updates relative imports.
test/clientRuntime.spec.ts Updates relative imports.
test/clientIPProvider.spec.ts Updates relative import.
test/apiRequestHeaders.spec.ts Adds JSON import attributes and .ts import.
test/adapters/IdentityProvider.spec.ts Updates relative imports.
src/stages/surfaceDecisions.ts Makes stage imports NodeNext-compatible.
src/stages/surfaceComponents.ts Makes stage imports NodeNext-compatible.
src/stages/surfaceBehavior.ts Makes stage imports NodeNext-compatible.
src/stages/shouldIgnorePath.ts Makes context import NodeNext-compatible.
src/stages/pageMetadata.ts Makes type imports NodeNext-compatible.
src/stages/originRequest.ts Makes stage imports NodeNext-compatible.
src/stages/mosAuthenticatedApi.ts Uses explicit adapter barrel and extensions.
src/stages/linkRewriting.ts Makes stage imports NodeNext-compatible.
src/stages/findMarkerPositions.ts Makes type imports NodeNext-compatible.
src/stages/fetchSurfaceDecisions.ts Makes stage imports NodeNext-compatible.
src/stages/elements.ts Makes type imports NodeNext-compatible.
src/stages/customEndpoint.ts Makes stage imports NodeNext-compatible.
src/stages/ContentElementHandler.ts Makes handler imports NodeNext-compatible.
src/stages/buildReplacementHandlers.ts Makes helper imports NodeNext-compatible.
src/MOSProxyBuilder.ts Updates builder dependencies for NodeNext.
src/MOSProxy.ts Updates orchestrator dependencies for NodeNext.
src/index.ts Updates public barrel specifiers.
src/hostPathMatcher.ts Updates type imports.
src/context.ts Updates type imports.
src/configResolution.ts Updates configuration imports.
src/config.ts Updates configuration imports.
src/apiRequestHeaders.ts Updates runtime helper import.
src/adapters/ResourceProvider.ts Updates shared type import.
src/adapters/index.ts Updates adapter barrel specifiers.
src/adapters/IdentityProvider.ts Updates shared type imports.
src/adapters/ConfigFactory.ts Updates configuration type import.
scripts/verify-package-resolution.mjs Verifies packed runtime and declaration resolution.
package.json Adds package verification to scripts and publishing.
.github/workflows/ci.yml Tests package resolution on supported Node versions.
.github/copilot-instructions.md Documents ESM and verification conventions.
.changeset/esm-node-resolution.md Records the consumer-facing patch.

Comment thread .github/copilot-instructions.md Outdated
@jayfeng0625
jayfeng0625 marked this pull request as ready for review July 28, 2026 12:49
@jayfeng0625
jayfeng0625 requested a review from benney July 28, 2026 12:49
@jayfeng0625
jayfeng0625 force-pushed the bug/MD-2245-esm-build-node-resolution branch from e6dcca8 to c36a9c7 Compare July 28, 2026 15:19
@benney

benney commented Jul 28, 2026

Copy link
Copy Markdown
Member

Don't love that verify:package also builds as it feels less explicit, but good to have direct Node installs fixed

jayfeng0625 commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Yeah I need to verify if this breaks v8, but shouldn't
(Edit: verified with branch prototype/md-2245-workerd-resolution)

@jayfeng0625
jayfeng0625 requested a review from JFL110 August 4, 2026 17:57
registry-url: https://registry.npmjs.org

- run: pnpm install --frozen-lockfile
- run: pnpm run typecheck

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.

Why would we not do these steps on release?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

They are moved into prepublishOnly, pnpm run release deals with the lifecycle

@jayfeng0625
jayfeng0625 merged commit d812852 into main Aug 7, 2026
3 checks passed
@jayfeng0625
jayfeng0625 deleted the bug/MD-2245-esm-build-node-resolution branch August 7, 2026 15:22
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.

4 participants