From 9a269e169de67c459916dcee21e1a5c37f563902 Mon Sep 17 00:00:00 2001 From: Joel Gabriel Date: Tue, 26 Mar 2024 09:57:35 +1100 Subject: [PATCH 1/4] fix: fixed this.bits undefined causing jpegs to not render in some viewers --- packages/pdfkit/src/image/jpeg.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/pdfkit/src/image/jpeg.js b/packages/pdfkit/src/image/jpeg.js index 742dbcb5b..e49c72324 100644 --- a/packages/pdfkit/src/image/jpeg.js +++ b/packages/pdfkit/src/image/jpeg.js @@ -26,6 +26,7 @@ class JPEG { } if (marker.name === 'SOF') { + this.bits ||= marker.precision; this.width ||= marker.width; this.height ||= marker.height; this.colorSpace ||= COLOR_SPACE_MAP[marker.numberOfComponents]; From 510baf24d8acb8c226f436894f559178f95e18d0 Mon Sep 17 00:00:00 2001 From: Diego Muracciole Date: Tue, 26 Mar 2024 10:12:50 +0100 Subject: [PATCH 2/4] chore: add changeset --- .changeset/wicked-jeans-switch.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/wicked-jeans-switch.md diff --git a/.changeset/wicked-jeans-switch.md b/.changeset/wicked-jeans-switch.md new file mode 100644 index 000000000..4343b480f --- /dev/null +++ b/.changeset/wicked-jeans-switch.md @@ -0,0 +1,5 @@ +--- +"@react-pdf/pdfkit": patch +--- + +fix: jpeg precision metadata From 0cb1f1f0a105a1962b5baafd4400200907082b06 Mon Sep 17 00:00:00 2001 From: Joel Gabriel Date: Wed, 27 Mar 2024 11:12:53 +1100 Subject: [PATCH 3/4] build: fixed syntax error in main.yml due to ternary in name for e2e-node --- .github/workflows/main.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0904e0be5..631ee381b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,19 +106,16 @@ jobs: - name: Run tests run: REACT_VERSION=${{ matrix.react_version }} yarn test - e2e-node: - name: Run E2E tests (Node.js ${{ matrix.node_version }}; ${{ matrix.cjs_or_esm == 'cjs' ? 'CJS' : 'ESM' }}) + name: Run E2E tests (Node.js ${{ matrix.node_version }}; ${{ matrix.cjs_or_esm }}) runs-on: ubuntu-latest strategy: matrix: cjs_or_esm: [cjs, esm] node_version: [18, 20, 21] - steps: - name: Checkout uses: actions/checkout@v4 - - name: Cache Yarn cache uses: actions/cache@v4 env: @@ -128,14 +125,11 @@ jobs: key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-${{ env.cache-name }}- - - name: Use Node.js uses: actions/setup-node@v4 with: node-version: ${{ matrix.node_version }} - - name: Install dependencies and build run: yarn --frozen-lockfile - - name: Run E2E tests run: yarn --cwd e2e/node-${{ matrix.cjs_or_esm }} run start From cb53e4e946f012230e6f56dffb1f2d487750c1d5 Mon Sep 17 00:00:00 2001 From: Joel Gabriel Date: Wed, 27 Mar 2024 11:28:10 +1100 Subject: [PATCH 4/4] build: added uppercase CJS and ESM back, just in a different way --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 631ee381b..dfefc3aba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -132,4 +132,7 @@ jobs: - name: Install dependencies and build run: yarn --frozen-lockfile - name: Run E2E tests - run: yarn --cwd e2e/node-${{ matrix.cjs_or_esm }} run start + run: | + FORMAT_UPPERCASE=$(echo "${{ matrix.cjs_or_esm }}" | tr '[:lower:]' '[:upper:]') + echo "Running E2E tests in $FORMAT_UPPERCASE mode" + yarn --cwd e2e/node-${{ matrix.cjs_or_esm }} run start