-
Notifications
You must be signed in to change notification settings - Fork 2k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@uppy/core: use variadic arguments for uppy.use
#4888
Merged
Merged
Conversation
This file contains 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
Diff output filesdiff --git a/packages/@uppy/core/lib/Uppy.js b/packages/@uppy/core/lib/Uppy.js
index 49d6503..708c152 100644
--- a/packages/@uppy/core/lib/Uppy.js
+++ b/packages/@uppy/core/lib/Uppy.js
@@ -790,13 +790,16 @@ export class Uppy {
getID() {
return this.opts.id;
}
- use(Plugin, opts) {
+ use(Plugin) {
if (typeof Plugin !== "function") {
const msg = `Expected a plugin class, but got ${Plugin === null ? "null" : typeof Plugin}.`
+ " Please verify that the plugin was imported and spelled correctly.";
throw new TypeError(msg);
}
- const plugin = new Plugin(this, opts);
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
+ args[_key2 - 1] = arguments[_key2];
+ }
+ const plugin = new Plugin(this, ...args);
const pluginId = plugin.id;
if (!pluginId) {
throw new Error("Your plugin must have an id"); |
I don't understand the benefit of this 🤔 |
See the types error, it already shows issues with our types (where the |
Murderlon
reviewed
Jan 23, 2024
Murderlon
approved these changes
Jan 24, 2024
Co-authored-by: Merlijn Vos <merlijn@soverin.net>
Do we want to merge this into |
It seems safer to keep it for |
38 tasks
aduh95
added a commit
that referenced
this pull request
Apr 11, 2024
github-actions bot
added a commit
that referenced
this pull request
Apr 11, 2024
| Package | Version | Package | Version | | ------------------------- | ------------ | ------------------------- | ------------ | | @uppy/angular | 0.7.0-beta.2 | @uppy/instagram | 4.0.0-beta.2 | | @uppy/audio | 2.0.0-beta.2 | @uppy/onedrive | 4.0.0-beta.2 | | @uppy/aws-s3 | 4.0.0-beta.2 | @uppy/progress-bar | 4.0.0-beta.2 | | @uppy/aws-s3-multipart | 4.0.0-beta.2 | @uppy/provider-views | 4.0.0-beta.2 | | @uppy/box | 3.0.0-beta.2 | @uppy/react | 4.0.0-beta.2 | | @uppy/companion | 5.0.0-beta.2 | @uppy/remote-sources | 2.0.0-beta.2 | | @uppy/companion-client | 4.0.0-beta.2 | @uppy/screen-capture | 4.0.0-beta.2 | | @uppy/compressor | 2.0.0-beta.2 | @uppy/status-bar | 4.0.0-beta.2 | | @uppy/core | 4.0.0-beta.2 | @uppy/thumbnail-generator | 4.0.0-beta.2 | | @uppy/dashboard | 4.0.0-beta.2 | @uppy/transloadit | 4.0.0-beta.2 | | @uppy/drag-drop | 4.0.0-beta.2 | @uppy/tus | 4.0.0-beta.2 | | @uppy/drop-target | 3.0.0-beta.2 | @uppy/unsplash | 4.0.0-beta.2 | | @uppy/dropbox | 4.0.0-beta.2 | @uppy/url | 4.0.0-beta.2 | | @uppy/facebook | 4.0.0-beta.2 | @uppy/utils | 6.0.0-beta.2 | | @uppy/file-input | 4.0.0-beta.2 | @uppy/webcam | 4.0.0-beta.2 | | @uppy/golden-retriever | 4.0.0-beta.2 | @uppy/zoom | 3.0.0-beta.2 | | @uppy/google-drive | 4.0.0-beta.2 | uppy | 4.0.0-beta.2 | - @uppy/aws-s3: default to multipart depending on the size of input (Antoine du Hamel / #5076) - @uppy/aws-s3: remove deprecated `prepareUploadParts` option (Antoine du Hamel / #5075) - @uppy/core: use variadic arguments for `uppy.use` (Antoine du Hamel / #4888) - @uppy/aws-s3: remove legacy plugin (Antoine du Hamel / #5070) - @uppy/locales: do not build `dist/` folder (Merlijn Vos / #5055) - @uppy/angular: fix Angular version requirement in peerDeps (Antoine du Hamel / #5067) - @uppy/transloadit: remove deprecated options (Merlijn Vos / #5056) | Package | Version | Package | Version | | ---------------- | ------- | ---------------- | ------- | | @uppy/companion | 4.13.1 | uppy | 3.24.1 | | @uppy/file-input | 3.1.1 | | | - @uppy/companion: upgrade redis (Mikael Finstad / #5065) - meta: fix `watch:*` scripts (Antoine du Hamel / #5046) - meta: include more packages in `compare_diff` CI (Antoine du Hamel / #5044) - @uppy/file-input: add missing export (Antoine du Hamel / #5045) - meta: Bump express from 4.18.1 to 4.19.2 in /packages/@uppy/companion (dependabot[bot] / #5036) - @uppy/companion: Bump express from 4.18.1 to 4.19.2 (dependabot[bot] / #5037)
Murderlon
added a commit
that referenced
this pull request
Apr 17, 2024
* 4.x: (34 commits) Release: uppy@3.24.3 (#5091) docs: add back markdown files (#5064) meta: fix custom provider example (#5079) @uppy/utils: add fetcher (#5073) Fix prettier @uppy/dashboard: add missing `x-zip-compress` archive type (#5081) Bump docker/metadata-action from 4 to 5 (#5086) Bump actions/setup-node from 3 to 4 (#5087) Bump docker/setup-qemu-action from 2 to 3 (#5089) meta: bump supercharge/redis-github-action from 1.4.0 to 1.8.0 (#5090) meta: bump actions/cache from 3 to 4 (#5088) Release: uppy@4.0.0-beta.3 (#5085) meta: add `dependabot.yml` to keep GHA up-to-date (#5083) Release: uppy@3.24.2 (#5084) @uppy/core: fix `setOptions` not re-rendereing plugin UI (#5082) Release: uppy@4.0.0-beta.2 (#5077) @uppy/aws-s3: default to multipart depending on the size of input (#5076) @uppy/aws-s3: remove deprecated `prepareUploadParts` option (#5075) fixup! @uppy/core: use variadic arguments for `uppy.use` (#4888) @uppy/core: use variadic arguments for `uppy.use` (#4888) ...
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.
We want TS to report an error when
opts
is defined as mandatory in the plugin constructor and missing from the.use
call.