chore: v27 migration to ESM-only package (BREAKING)#9544
Open
mmaietta wants to merge 77 commits into
Open
Conversation
… `env: { COREPACK_ENABLE_STRICT: "0", ...process.env },` to allow `npm list` to work across environments. extract fallback node collector (Traversal) to separate class due to differing parsing logic from NPM collector
# Conflicts: # packages/app-builder-lib/package.json # packages/dmg-builder/package.json # packages/electron-builder-squirrel-windows/package.json # packages/electron-builder/package.json
…m-migration # Conflicts: # packages/app-builder-lib/src/node-module-collector/bunNodeModulesCollector.ts # packages/app-builder-lib/src/node-module-collector/nodeModulesCollector.ts # packages/app-builder-lib/src/node-module-collector/npmNodeModulesCollector.ts # packages/app-builder-lib/src/util/appFileCopier.ts
# Conflicts: # packages/app-builder-lib/package.json # packages/app-builder-lib/src/asar/asarUtil.ts # packages/app-builder-lib/src/binDownload.ts # packages/app-builder-lib/src/node-module-collector/bunNodeModulesCollector.ts # packages/app-builder-lib/src/node-module-collector/index.ts # packages/app-builder-lib/src/node-module-collector/moduleCache.ts # packages/app-builder-lib/src/node-module-collector/nodeModulesCollector.ts # packages/app-builder-lib/src/node-module-collector/npmNodeModulesCollector.ts # packages/app-builder-lib/src/node-module-collector/pnpmNodeModulesCollector.ts # packages/app-builder-lib/src/node-module-collector/traversalNodeModulesCollector.ts # packages/app-builder-lib/src/node-module-collector/types.ts # packages/app-builder-lib/src/node-module-collector/yarnBerryNodeModulesCollector.ts # packages/app-builder-lib/src/node-module-collector/yarnNodeModulesCollector.ts # packages/app-builder-lib/src/publish/PublishManager.ts # packages/app-builder-lib/src/targets/FlatpakTarget.ts # packages/app-builder-lib/src/targets/archive.ts # packages/app-builder-lib/src/util/appFileCopier.ts # packages/dmg-builder/package.json # packages/dmg-builder/src/dmgUtil.ts # packages/electron-builder-squirrel-windows/package.json # packages/electron-builder/package.json # packages/electron-publish/package.json # packages/electron-updater/src/differentialDownloader/DataSplitter.ts # pnpm-lock.yaml # test/src/helpers/packTester.ts # test/src/updater/blackboxUpdateTest.ts # test/src/updater/differentialUpdateTest.ts
🦋 Changeset detectedLatest commit: 3f03227 The changes in this PR will be included in the next version bump. 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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
52191a7 to
3b38b0e
Compare
…ng the traditional `.` root export
…m-migration # Conflicts: # packages/app-builder-lib/src/util/yarn.ts # test/src/HoistedNodeModuleTest.ts
# Conflicts: # test/src/helpers/updaterTestUtil.ts
skmedix
reviewed
May 8, 2026
# Conflicts: # package.json # packages/app-builder-lib/helpers/dynamic-import.js # packages/app-builder-lib/package.json # packages/app-builder-lib/src/asar/asarFileChecker.ts # packages/app-builder-lib/src/asar/asarUtil.ts # packages/app-builder-lib/src/binDownload.ts # packages/app-builder-lib/src/codeSign/codesign.ts # packages/app-builder-lib/src/codeSign/macCodeSign.ts # packages/app-builder-lib/src/codeSign/windowsSignToolManager.ts # packages/app-builder-lib/src/configuration.ts # packages/app-builder-lib/src/electron/ElectronFramework.ts # packages/app-builder-lib/src/electron/injectFFMPEG.ts # packages/app-builder-lib/src/fileTransformer.ts # packages/app-builder-lib/src/index.ts # packages/app-builder-lib/src/linuxPackager.ts # packages/app-builder-lib/src/macPackager.ts # packages/app-builder-lib/src/node-module-collector/pnpmNodeModulesCollector.ts # packages/app-builder-lib/src/options/SnapOptions.ts # packages/app-builder-lib/src/packager.ts # packages/app-builder-lib/src/platformPackager.ts # packages/app-builder-lib/src/targets/AppxTarget.ts # packages/app-builder-lib/src/targets/FlatpakTarget.ts # packages/app-builder-lib/src/targets/FpmTarget.ts # packages/app-builder-lib/src/targets/LinuxTargetHelper.ts # packages/app-builder-lib/src/targets/MsiTarget.ts # packages/app-builder-lib/src/targets/appimage/AppImageTarget.ts # packages/app-builder-lib/src/targets/appimage/appImageUtil.ts # packages/app-builder-lib/src/targets/archive.ts # packages/app-builder-lib/src/targets/differentialUpdateInfoBuilder.ts # packages/app-builder-lib/src/targets/nsis/NsisTarget.ts # packages/app-builder-lib/src/targets/nsis/nsisUtil.ts # packages/app-builder-lib/src/targets/snap.ts # packages/app-builder-lib/src/toolsets/linux.ts # packages/app-builder-lib/src/toolsets/windows.ts # packages/app-builder-lib/src/util/config/config.ts # packages/app-builder-lib/src/util/packageDependencies.ts # packages/app-builder-lib/src/util/resolve.ts # packages/app-builder-lib/src/util/yarn.ts # packages/app-builder-lib/src/winPackager.ts # packages/builder-util-runtime/package.json # packages/builder-util-runtime/src/index.ts # packages/builder-util/package.json # packages/builder-util/src/DebugLogger.ts # packages/builder-util/src/deepAssign.ts # packages/builder-util/src/util.ts # packages/dmg-builder/package.json # packages/dmg-builder/src/dmg.ts # packages/dmg-builder/src/dmgLicense.ts # packages/dmg-builder/src/dmgUtil.ts # packages/dmg-builder/src/licenseButtons.ts # packages/electron-builder-squirrel-windows/package.json # packages/electron-builder-squirrel-windows/src/SquirrelWindowsTarget.ts # packages/electron-builder/package.json # packages/electron-builder/src/builder.ts # packages/electron-builder/src/cli/cli.ts # packages/electron-builder/src/cli/install-app-deps.ts # packages/electron-publish/package.json # packages/electron-publish/src/index.ts # packages/electron-publish/src/s3/baseS3Publisher.ts # packages/electron-publish/src/s3/s3Publisher.ts # packages/electron-publish/src/s3/spacesPublisher.ts # packages/electron-publish/src/snapStorePublisher.ts # packages/electron-updater/src/BaseUpdater.ts # pnpm-lock.yaml # scripts/fix-schema.js # scripts/renderer/src/typedoc2html.ts # test/package.json # test/snapshots/updater/blackboxUpdateTest.js.snap # test/src/ExtraBuildResourcesTest.ts # test/src/HoistedNodeModuleTest.ts # test/src/binDownloadTest.ts # test/src/helpers/downloadElectron.ts # test/src/helpers/launchAppCrossPlatform.ts # test/src/helpers/packTester.ts # test/src/linux/debTest.ts # test/src/linux/linuxPackagerTest.ts # test/src/linux/snapHeavyTest.ts # test/src/mac/macPackagerTest.ts # test/src/rebuilderTest.ts # test/src/updater/blackboxUpdateTest.ts # test/src/updater/differentialUpdateTest.ts # test/src/updater/linuxUpdaterTest.ts # test/src/windows/appxTest.ts # test/src/windows/assistedInstallerTest.ts # test/src/windows/msiTest.ts # test/src/windows/msiWrappedTest.ts # test/src/windows/portableTest.ts # test/src/windows/squirrelWindowsTest.ts # test/src/windows/webInstallerTest.ts # test/src/windows/winCodeSignTest.ts # test/src/windows/winPackagerTest.ts # test/tsconfig.json # test/vitest-scripts/cache.ts # test/vitest-scripts/file-discovery.ts # test/vitest-scripts/run-vitest.ts # test/vitest-scripts/smart-config.ts # test/vitest-scripts/smart-shard-count.ts # test/vitest-scripts/vitest-smart-sequencer.ts
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.
Resolves #9483!!
Summary
Migrates the build from
tsc --buildto tsup so every publishable package ships dual CJS + ESM with type declarations, and updates the test/tooling pipeline to match.Compiler & packaging
tsc --buildwith tsup for all 8 publishable packages, producing CJS (.js), ESM (.mjs), and declarations (.d.ts/.d.mts) indist/.exportson every package (require→ CJS,import→ ESM,types→ declarations) plus a dev-only./src/*subpath so the monorepo's tests can import un-bundled source.indexInternal.ts(./internal) entry per package for cross-package internal API access, replacing deeppkg/out/...paths."type": "module"fromelectron-updaterin favour of conditional exports.packages/tsconfig-tsup.json(nocomposite) used only by tsup's DTS worker to avoid TS6307.tsconfig-base.jsonretargeted to ESNext +moduleResolution: "bundler",useDefineForClassFields: false(preserves pre-ES2022 class-field semantics).Toolchain
ts-node→tsxfor the vitest runner scripts (works with bundler resolution, no extra flags).compilenow runspnpm -r ... build(per-package tsup) instead oftsc --build;typecheckretainstsc --buildfor whole-graph type validation.Source fixes surfaced by the stricter ESM pipeline
platformPackager.tsimported the./indexbarrel (→linuxPackager→extends PlatformPackager), which fails under ESM eager class-init. Made the barrel import type-only, sourcedPlatformfrom./core, and replacedthis instanceof LinuxPackagerwith a value-free"executableName" in thischeck.deepAssign.ts(./mapper→builder-util-runtime),AppImageTarget.ts(deleted./util/appBuilder→ inline +builder-util-runtime#objectToArgs).rollup-plugin-dtsincompatibilities:import X = NS.Ynamespace aliases →type X = NS.Y(builder-util/log.ts,electron-updater/{AppUpdater,MacUpdater,electronHttpExecutor}.ts).import.meta.dirname(Node 21.2+ ESM-only) → bundle-safe__dirname+shims: true(app-builder-libpathManager/rebuild/packageMetadata).tarinternal type path → publictar,readline/promises→node:readline/promises, yargs cast inbuilder.ts/install-app-deps.ts.Test infrastructure
resolve.aliasinrun-vitest.ts(eachpkg/pkg/internal→ itssrc/*.ts). Tests run against un-bundled source so vite handles CJS interop (e.g.fs-extra) and circular deps, andvi.mockcan intercept individual modules.pkg/out/...→pkg/src/...;cliTestmocks consolidated ontoapp-builder-lib/internal.requireexport condition (one-line patch) so tsx/Node 22 can load it via vitest's mocker.test/tsconfig.jsondrops package project-references (resolves through exports instead, avoiding mixedout/↔dist/type identities).Script/config fixes
scripts/checkDeps.js: ignoredist/, skip the dynamically-imported@electron/universaland root-onlytsup/tsx/is-ci/vitest.eslint.config.mjs: ignore**/distand**/tsup.config.ts; disable thecurly/nonblock-statement-body-positionconflict; relaxrequire-await/unbound-methodfortest/src.tsconfig.jsonno longer referencestest/website(built separately).