Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the codebase by extracting RequestError and FileExceptionMessages from file.ts into a new dedicated file file-errors.ts, updating all dependent files to import from this new location. Additionally, it updates the build scripts in package.json to separate the CJS and ESM post-compile steps, and adds a new step in cloudbuild.yaml to run ESM system tests using Node 24. There are no review comments to address.
Contributor
Author
|
This is just preliminary test-run work on this one. |
This branch has not been deployed
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.
Description
Fixes storage ESM initialization bugs and enables system-test:esm in Cloud Build.
Impact
Prevents Node 24 ESM crashes and adds ESM system test coverage.
Changes
RequestErrorandFileExceptionMessagesfromhandwritten/storage/src/file.tsinto a zero-import leaf modulehandwritten/storage/src/file-errors.tsand re-export them fromsrc/file.tsfor full backwards compatibility.src/resumable-upload.ts,src/hash-stream-validator.ts, andsrc/transfer-manager.tsto importRequestErrorandFileExceptionMessagesfrom./file-errors.js, and convertFileMetadatainsrc/resumable-upload.tstoimport type, breaking theresumable-upload.js -> file.js -> storage.js -> file.jsESM Temporal Dead Zone cycle.postcompile:esminhandwritten/storage/package.jsonto copysrc/package-json-helper.cjsintobuild/esm/srcsocompile:esmworks on a cleanbuild/directory.run-system-tests-esmstep tohandwritten/storage/cloudbuild.yamlto runpnpm run system-test:esmafterrun-system-tests.Testing
rm -rf build && pnpm run compile:esm) copiespackage-json-helper.cjsintobuild/esm/src.build/esm/system-test --dry-runloads all 3 suites (install.js,kitchen.js,storage.js, 258 total tests) on both Node 24 (v24.15.0) and Node 22 (v22.16.0) without TDZ errors or dropped files.build/esm/system-test/kitchen.js(should create an upload URI) on Node 24 against GCS: passed.pnpm --dir handwritten/storage test: 1,103 passing, 0 failing.bin/linter.mjs --strictand direct ESLint across all 5 touched.tsfiles: 0 errors, 0 warnings.core/test-utilsbreaking-change check: no breaking public TypeScript interface changes detected.Alternatives
pnpm run system-test:esmintocloudbuild.yamlwithout fixing these two bugs fails on Node 24 (ReferenceError: Cannot access 'File' before initializationandERR_MODULE_NOT_FOUNDon clean builds).