feat(worker): sharp pipeline with orientation, variants, exif strip

Task 20: services/worker package (@photo/worker, commonjs) with jest
unit/e2e configs mirroring api conventions (root .env via test/load-env.ts,
moduleNameMapper to @photo/contracts/db-cn/storage TS sources, maxWorkers 1,
test/reset.ts = MySQL TRUNCATE + MinIO photo-live/dev prefix wipe) and the
sharp processing pipeline runPipeline(): metadata whitelist gate
(jpeg/png/webp/avif/heif/tiff, else PipelineError UNSUPPORTED_TYPE),
decode failures mapped to PipelineError DECODE_FAILED, no-arg .rotate()
auto-orientation (EXIF 5-8 swaps stored width/height), thumb <=480w q75
and browse <=1920 q82 JPEG variants with withoutEnlargement, and no
withMetadata so outputs carry no EXIF/GPS at all. sharp 0.35 prebuilt
loads script-free under pnpm 10; its win32 libvips lacks a HEVC encoder,
so the HEVC-HEIF unit case self-skips with a console note (G2 verifies
with real iPhone samples) while the AV1-HEIF case covers the same
libheif decode path / 'heif' format bucket.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-17 23:16:20 +08:00
parent f5f1855b58
commit 64a2cec788
10 changed files with 820 additions and 6 deletions
+9
View File
@@ -0,0 +1,9 @@
// services/worker/jest.e2e.config.cjs —— e2e(test/*.e2e-spec.ts,Task 21 发布事务/
// 补偿扫描),复用单测配置仅切换 testMatch;隔离工具见 test/reset.ts。
/** @type {import('jest').Config} */
module.exports = {
// CJS 配置文件复用基础配置只能经 require(node10 互操作),局部豁免 lint 规则。
// eslint-disable-next-line @typescript-eslint/no-require-imports
...require('./jest.config.cjs'),
testMatch: ['<rootDir>/test/**/*.e2e-spec.ts'],
};