[WIP] Replace shopify/web-worker dependency with native web api implementation#26
Conversation
|
Size Change: +1.83 kB (+0.09%) Total Size: 1.93 MB
ℹ️ View Unchanged
|
shopify/web-worker dependency with native web api implementationshopify/web-worker dependency with native web api implementation
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the deprecated @shopify/web-worker dependency with a native inline‐worker implementation, adds a simple RPC utility for worker communication, and updates Vips‐related store utilities to use the new factory. It also introduces a global Worker mock for Node.js tests and removes obsolete approval action types and documentation.
- Introduce
WorkerRpcandWorkerRpcHandlerfor promise‐based worker RPC - Provide
createWorkerFactorywith inline worker code and remove@shopify/web-worker - Update Vips store utilities (
vips.ts) to use the new factory, add error handling and debug logging
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/config/global-mocks.js | Added global MockWorker for Node.js test environment |
| packages/upload-media/src/workers/vips-worker.ts | Placeholder VIPS worker script with debug logs |
| packages/upload-media/src/utils/worker-rpc.ts | Implemented WorkerRpc class for main‐to‐worker messaging |
| packages/upload-media/src/utils/worker-factory.ts | Created createWorkerFactory with inline worker script |
| packages/upload-media/src/store/utils/vips.ts | Updated Vips calls to use new factory, wrapped in getVipsWorker, added error handling and logs |
| packages/upload-media/src/store/types.ts | Removed deprecated approval action types |
| packages/upload-media/src/store/private-actions.ts | Added debug logging, toggled generate_sub_sizes default |
| packages/upload-media/src/store/actions.ts | Removed approval actions and added logs in addItems |
| packages/upload-media/package.json | Removed @shopify/web-worker dependency |
| packages/upload-media/README.md | Removed outdated grantApproval/rejectApproval docs |
Comments suppressed due to low confidence (3)
test/unit/config/global-mocks.js:67
- [nitpick] The
MockWorkeralways returns anullresult in tests. To cover real‐world scenarios, consider allowing tests to inject custom response data or error cases.
setTimeout( () => {
packages/upload-media/src/store/utils/vips.ts:6
- The function
getExtensionis used later in this module but not imported. Please addimport { getExtension } from '../../utils';to avoid runtime errors.
import { createWorkerFactory } from '../../utils/worker-factory';
packages/upload-media/src/workers/vips-worker.ts:1
- This worker file only contains debug logs and appears unused by the new factory. Consider removing it or integrating its logic into the factory to prevent stale code.
console.log('[VIPS Worker Debug] Worker script starting...');
…ia-uploads-try-alternative
…ia-uploads-try-alternative
…ia-uploads-try-alternative
…ia-uploads-try-alternative
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
What?
This PR replaces the deprecated
shopify/web-workerpackage in WordPress#70623 with a native web implementation..
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast