Repository navigation
chore(deps): upgrade docx to 9.15.2 - #9895
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues remain. SummaryUpgrades
No new actionable issues were found. Tests were inspected but not run during this review. Reviews (2) · Last reviewed commit: "fix(sandbox): provide btoa and atob to s..." · Reviewed by Greptile |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 10 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
docx 9.15 packs with fflate and encodes base64 with the global btoa, which the isolated-vm sandbox does not provide, so the docx-generate finalize (Packer.toBase64String + hand-rolled decode) threw ReferenceError. Pack with Packer.toArrayBuffer instead, like the pptx/pdf tasks, and cover the real bundle + bootstrap + finalize in a bare isolate-shaped context. docx now drops XML-1.0-illegal control characters itself, so the Word block's pre-strip before Markdown parsing is removed. Regenerated the docx sandbox bundle.
docx 9.15 encodes base64 through the global btoa/atob, so in the task isolate Packer.toBase64String and patchDocument's base64 output (which worked on 9.7.1) and password protection threw ReferenceError. The worker now bridges btoa/atob to Node's native WHATWG implementations, like the text codecs, and the bare verification context mirrors them.
waleedlatif1
force-pushed
the
chore/deps-docx
branch
from
November 11, 2026 21:35
9b75042 to
8e53750
Compare
Collaborator
Author
Collaborator
Author
|
@cubic-dev-ai review this PR |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
This branch was successfully 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.
Summary
docx9.7.1 → 9.15.2 (apps/sim). The upstream changes: charts, shapes, layout,docx/html, macros. 9.13 replacedxml/xml-jswith docx's own XML reader/writer. 9.15 replacedjszip/hash.jswithfflateand docx's own hashing. Transitive deps dropped:xml,xml-js,hash.js,minimalistic-assert. Added:fflate@0.8.3.Packer.toBase64Stringwith the globalbtoa. The isolated-vm sandbox doesn't havebtoa, sodocx-generate's finalize threwReferenceError: btoa is not defined, which means every in-app docx generation would fail. The finalize now packs withPacker.toArrayBuffer, the same way the pptx/pdf tasks return raw bytes. That also removes the hand-rolled base64 decoder, which only existed because JSZip's browser build had no binary output.bundles/verify.test.ts: it runs the checked-indocx.cjswith the realdocxGenerateTaskbootstrap and finalize in a bare, isolate-shaped context.createBareSandboxContextis now factored out ofverify.ts. The test fails on the old finalize (btoa is not defined) and passes on the new one. The existing bundle check only asserts constructors exist, so it couldn't catch this.buildDocxFromContentis removed. The existing test that asserts this behavior still passes.stripInvalidXmlCharsis still used for the hand-written append/replace XML.bundles/docx.cjs(448 KB → 330 KB). The bundle no longer contains the esbuild__requireshim, so I reworded the comments that blamed docx for it. The polyfill itself is unchanged, because it's inlined into every bundle.Type of Change
Testing
buildDocxFromContentplusappendParagraphsToDocx,replaceTextInDocxandextractDocxTexton its output, andrunSandboxTask('docx-generate')through the real isolated-vm worker. Content: headings, bullets, numbered lists, a table with shading, two images (with and without alt text), an external hyperlink, a footer page-number field, two sections,& < > " ', accents, CJK/Arabic, ZWJ emoji, control chars, and long text.word/document.xmlis byte-identical before and after for build, append and replace. Extracted text and the append/replace counts are also identical.\x01lands indocument.xml, so lxml and python-docx both reject it. Both images also gotwp:docPr id="1", which is a duplicate. After (9.15.2): well-formed, opens in python-docx, the control char is stripped, docPr ids are unique (1, 2) and the empty alt text is omitted. Text, tables, 2 inline images and 2 sections all read back correctly.theme1.xmlpart is addedcomments.xmlis only written when the document has commentsNormalparagraph style, plusTableNormal,Caption,BibliographyandTOC1–TOC9w:defaultTabStop=720is added to settingsw15:tentative→w:tentativein numberingsectPrgoes into its last paragraph instead of an extra empty paragraphimage1.pnginstead of a hashvitest:microsoft-word/document.server.test.ts,sandbox/bundles/verify.test.ts,file-parsers/registry.test.ts,file-parsers/sniff.test.ts,mothership/vfs/document-style.test.ts: 82 passed.bun install --frozen-lockfileis clean.check:test-patternsandcheck:comment-hygienepass. Biome is clean on the changed files.compile.ts,require('docx')) uses the docx installed in the E2B template, not this lockfile.Checklist
🤖 Generated with Claude Code