Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(useWebWorkerFn): support local dependencies #3316

Closed
wants to merge 4 commits into from

Conversation

dvh91
Copy link
Contributor

@dvh91 dvh91 commented Aug 15, 2023

Description

fixes #2005

useWebWorkerFn used to support remote dependencies for the function passed but not local functions.
the library which this function is a port of (useWorker by Alessio Koci) have the support of local dependencies.

The addition is also very much a port of useWorker implementation.

Additional context

In order to support this feature, I've added a new dependency on core package called isoworker. as the core package is very light with dependencies, im unsure if thats fine or it's enough for us to split it into integration package of its own. open for thoughts


馃 Generated by Copilot at 7e11dfb

This pull request adds a new feature to the useWebWorkerFn hook that allows users to pass local dependencies to the web worker. It uses the isoworker module to create a context for the dependencies and inject them into the worker blob URL. It also updates the documentation, the demo code, and the dependencies for the @vueuse/core package.

馃 Generated by Copilot at 7e11dfb

  • Add isoworker dependency to @vueuse/core package to support local dependencies in useWebWorkerFn hook (link, link, link)
  • Add localDependencies option to useWebWorkerFn hook and pass it to createWorkerBlobUrl function (link, link, link, link)
  • Use isoworker module to create a context for local dependencies and inject it into the web worker code in createWorkerBlobUrl function (link, link)
  • Rename section title in useWebWorkerFn documentation from With dependencies to With remote dependencies and add a new section for With local dependencies with an example code snippet (link, link)
  • Modify demo code for useWebWorkerFn hook to use a different heavy task function that uses two local dependencies: pow and randomNumber (link)
  • Update version of resolve dependency from 1.22.2 to 1.22.3 in pnpm-lock.yaml file, affecting several packages that depend on it (link, link, link, link, link, link, link)
  • Add requiresBuild property to @vueuse/core package in pnpm-lock.yaml file, indicating that the package needs to be built before being used (link)
  • Correct a mistake in pnpm-lock.yaml file that marked @vueuse/core package as a dev dependency instead of a dependency (link, link)

@@ -1,3 +1,4 @@
import * as isoworker from 'isoworker'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core package should be dependency-free. If this is required, then it's probably out-scope and should be implemented on userland, or as a separate package

Copy link

stale bot commented Dec 6, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extend useWebWorkerFn to also accept an array of local dependencies
2 participants