diff --git a/.eslintrc.js b/.eslintrc.js index 6531783903..b6dcece1e8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -447,8 +447,11 @@ module.exports = { rules: { 'no-extra-semi': 'off', 'no-restricted-syntax': ['error', { - selector: 'ImportDeclaration[importKind="type"][source.value=/^(\\.+|@uppy\\x2F[a-z-0-9]+)\\x2F/]:not([source.value=/^@uppy\\x2Futils\\x2F/]):not([source.value=/\\.js$/])', - message: 'Use ".js" file extension for import type declarations', + selector: 'ImportDeclaration[importKind="type"][source.value=/^@uppy\\x2F[a-z-0-9]+\\x2F/]:not([source.value=/^@uppy\\x2Futils\\x2F/]):not([source.value=/\\.js$/])', + message: 'Use ".js" file extension for import type declarations from a different package', + }, { + selector: 'ImportDeclaration[importKind="type"][source.value=/^\\.\\.?\\x2F.+\\.js$/]', + message: 'Do not use ".js" file extension for relative import type declarations', }, { selector: 'ImportDeclaration[source.value=/^@uppy\\x2Futils\\x2Flib\\x2F.+\\.[mc]?[jt]sx?$/]', message: 'Do not use file extension when importing from @uppy/utils', @@ -497,6 +500,14 @@ module.exports = { 'no-unused-vars': 'off', }, }, + { + files: [ + 'packages/@uppy/svelte/**', + ], + parserOptions: { + sourceType: 'module', + }, + }, { files: ['e2e/**/*.ts'], extends: ['plugin:cypress/recommended'], diff --git a/.github/workflows/bundlers.yml b/.github/workflows/bundlers.yml index 7f186ac5ba..8f96efd6de 100644 --- a/.github/workflows/bundlers.yml +++ b/.github/workflows/bundlers.yml @@ -105,7 +105,7 @@ jobs: } from "@rollup/plugin-node-resolve"; export default { - input: "./index.mjs", + input: "./lib/index.js", output: { file: "/dev/null", }, @@ -137,9 +137,9 @@ jobs: - run: npx webpack --version - name: Create Webpack config file run: - echo - 'module.exports={mode:"production",target:"web",entry:"./index.mjs"}' - > webpack.config.js + echo 'export default + {mode:"production",target:"web",entry:"./lib/index.js"}' > + webpack.config.js - name: Bundle run: npx webpack @@ -171,7 +171,7 @@ jobs: run: npm i --save-dev parcel@${{matrix.bundler-version}} - run: npx parcel --version - name: Bundle - run: npx parcel build index.mjs + run: npx parcel build lib/index.js vite: needs: isolate_uppy @@ -194,7 +194,7 @@ jobs: - name: Create index.html run: echo '' > index.html + src="./lib/index.js">' > index.html - name: Bundle run: npx vite build @@ -217,6 +217,6 @@ jobs: run: npm i --save-dev esbuild@${{matrix.bundler-version}} - run: npx esbuild --version - name: Bundle - run: npx esbuild index.mjs --bundle --outfile=/dev/null + run: npx esbuild lib/index.js --bundle --outfile=/dev/null # Browserify: doesn't support ESM. diff --git a/.github/workflows/companion-deploy.yml b/.github/workflows/companion-deploy.yml index 9221f2d623..debc6b18a5 100644 --- a/.github/workflows/companion-deploy.yml +++ b/.github/workflows/companion-deploy.yml @@ -55,15 +55,15 @@ jobs: tags: | type=edge type=raw,value=latest,enable=false - - uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0 + - uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 - uses: docker/setup-buildx-action@v3 - name: Log in to DockerHub - uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: username: ${{secrets.DOCKER_USERNAME}} password: ${{secrets.DOCKER_PASSWORD}} - name: Build and push - uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12 # v6.4.1 + uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 with: push: true context: . diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 364f3e47bb..7aa5390f84 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -151,15 +151,15 @@ jobs: type=semver,pattern={{version}},value=${{ needs.release.outputs.companionWasReleased }} # set latest tag for default branch type=raw,value=latest,enable=true - - uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0 + - uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 - uses: docker/setup-buildx-action@v3 - name: Log in to DockerHub - uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 with: username: ${{secrets.DOCKER_USERNAME}} password: ${{secrets.DOCKER_PASSWORD}} - name: Build and push - uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12 # v6.4.1 + uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 with: push: true context: . diff --git a/.gitignore b/.gitignore index 8abab34b11..a158168623 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ tsconfig.build.tsbuildinfo dist/ lib/ +# @uppy/svelte needs lib inside src +!src/lib coverage/ examples/dev/bundle.js examples/aws-php/vendor/* diff --git a/.yarn/patches/p-queue-npm-7.4.1-e0cf0a6f17.patch b/.yarn/patches/p-queue-npm-8.0.1-fe1ddcd827.patch similarity index 57% rename from .yarn/patches/p-queue-npm-7.4.1-e0cf0a6f17.patch rename to .yarn/patches/p-queue-npm-8.0.1-fe1ddcd827.patch index aaef0b1243..200198f91b 100644 --- a/.yarn/patches/p-queue-npm-7.4.1-e0cf0a6f17.patch +++ b/.yarn/patches/p-queue-npm-8.0.1-fe1ddcd827.patch @@ -1,5 +1,5 @@ diff --git a/package.json b/package.json -index 8367745346fffd144a817ccf04912bb799e18b66..66dd17a4cd736089a332d72a70040701b0cd9c93 100644 +index d4133284745349488cf0e623b983c78fd7cc7fb7..52433fa0ecea99ebbfe5b94a8023f73350896f7d 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ @@ -7,6 +7,6 @@ index 8367745346fffd144a817ccf04912bb799e18b66..66dd17a4cd736089a332d72a70040701 "funding": "https://github.com/sponsors/sindresorhus", "type": "module", + "main": "./dist/index.js", - "exports": "./dist/index.js", - "engines": { - "node": ">=12" + "exports": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" diff --git a/BUNDLE-README.md b/BUNDLE-README.md index 248e1cf636..e16ca46dde 100644 --- a/BUNDLE-README.md +++ b/BUNDLE-README.md @@ -2,7 +2,7 @@ Hi, thanks for trying out the bundled version of the Uppy File Uploader. You can use this from a CDN -(``) +(``) or bundle it with your webapp. Note that the recommended way to use Uppy is to install it with yarn/npm and use @@ -83,14 +83,12 @@ inline into the page. This, and many more configuration options can be found here: . Uppy has many more Plugins besides Xhr and the Dashboard. For example, you can -enable Webcam, Instagram, or video encoding support. For a full list of Plugins -check here: . - -Note that for some Plugins, you will need to run a server side component called: -Companion. Those plugins are marked with a (c) symbol. Alternatively, you can -sign up for a free Transloadit account. Transloadit runs Companion for you, tusd -servers to handle resumable file uploads, and can post-process files to scan for -viruses, recognize faces, etc. Check: . +enable Webcam, Instagram, or video encoding support. Note that for some Plugins, +you will need to run a server side component called: Companion. Those plugins +are marked with a (c) symbol. Alternatively, you can sign up for a free +Transloadit account. Transloadit runs Companion for you, tusd servers to handle +resumable file uploads, and can post-process files to scan for viruses, +recognize faces, etc. Check: . ## Getting help diff --git a/CHANGELOG.md b/CHANGELOG.md index a63513834a..a46debf337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,143 @@ Please add your entries in this format: In the current stage we aim to release a new version at least every month. +## 4.4.1 + +Released: 2024-09-30 + +| Package | Version | Package | Version | +| ----------------- | ------- | ----------------- | ------- | +| @uppy/core | 4.2.1 | uppy | 4.4.1 | +| @uppy/transloadit | 4.1.2 | | | + +- @uppy/transloadit: fix multiple upload batches & run again (Merlijn Vos / #5478) +- meta: build(deps): bump docker/build-push-action from 6.7.0 to 6.8.0 (dependabot[bot] / #5477) +- meta: build(deps): bump vite from 5.2.11 to 5.4.8 (dependabot[bot] / #5471) +- @uppy/svelte: build(deps-dev): bump rollup from 4.18.0 to 4.22.4 (dependabot[bot] / #5470) +- meta: build(deps): bump vite from 5.2.11 to 5.4.6 (dependabot[bot] / #5466) + + +## 4.4.0 + +Released: 2024-09-20 + +| Package | Version | Package | Version | +| ----------------- | ------- | ----------------- | ------- | +| @uppy/companion | 5.1.1 | @uppy/tus | 4.1.1 | +| @uppy/svelte | 4.0.2 | @uppy/xhr-upload | 4.2.0 | +| @uppy/transloadit | 4.1.1 | uppy | 4.4.0 | + +- @uppy/tus: fix retry check for status code 400 (Merlijn Vos / #5461) +- meta: Merge branch 'main' of https://github.com/transloadit/uppy (Murderlon) +- meta: fix AwsS3 endpoint option in private/dev (Murderlon) +- examples: build(deps): bump body-parser from 1.20.2 to 1.20.3 (dependabot[bot] / #5462) +- examples: build(deps-dev): bump vite from 5.3.1 to 5.3.6 (dependabot[bot] / #5459) +- @uppy/tus: set response from tus-js-client (Merlijn Vos / #5456) +- docs: fix assemblyOptions example for React (Merlijn Vos / #5450) +- docs: rename Edgly to Smart CDN (Merlijn Vos / #5449) +- @uppy/tus: correctly type tus on UppyFile (Merlijn Vos / #5454) +- docs: remove old legacy CDN reference (Murderlon) +- @uppy/xhr-upload: pass files to onBeforeRequest (Merlijn Vos / #5447) +- @uppy/svelte: fix generated module to not bundle Svelte (Antoine du Hamel / #5446) +- examples,@uppy/svelte: Bump svelte from 4.2.18 to 4.2.19 (dependabot[bot] / #5440) +- meta: bump Yarn to 4.4.1 (Antoine du Hamel / #5445) +- docs: fix broken links in locale docs (Serghei Cebotari / #5441) + + +## 4.3.0 + +Released: 2024-08-29 + +| Package | Version | Package | Version | +| ---------------------- | ------- | ---------------------- | ------- | +| @uppy/aws-s3 | 4.1.0 | @uppy/informer | 4.1.0 | +| @uppy/box | 3.1.0 | @uppy/instagram | 4.1.0 | +| @uppy/companion | 5.1.0 | @uppy/locales | 4.1.0 | +| @uppy/companion-client | 4.1.0 | @uppy/onedrive | 4.1.0 | +| @uppy/compressor | 2.1.0 | @uppy/remote-sources | 2.2.0 | +| @uppy/core | 4.2.0 | @uppy/screen-capture | 4.1.0 | +| @uppy/dashboard | 4.1.0 | @uppy/tus | 4.1.0 | +| @uppy/dropbox | 4.1.0 | @uppy/unsplash | 4.1.0 | +| @uppy/facebook | 4.1.0 | @uppy/url | 4.1.0 | +| @uppy/google-drive | 4.1.0 | @uppy/xhr-upload | 4.1.0 | +| @uppy/google-photos | 0.3.0 | @uppy/zoom | 3.1.0 | +| @uppy/image-editor | 3.1.0 | uppy | 4.3.0 | + +- @uppy/core,@uppy/dashboard: Pass container to `UIPlugin.render` for non-Preact integration (Merlijn Vos / #5437) +- @uppy/companion: do not use unsafe call to `JSON.stringify` (Antoine du Hamel / #5422) +- meta: Fix yarn.lock (Murderlon) +- @uppy/locales: Fix locale-pack for en_US (Merlijn Vos / #5431) +- meta: Add tsconfig to packages in private/ (Merlijn Vos / #5432) +- @uppy/remote-sources: support companionKeysParams (Merlijn Vos / #5434) +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) +- docs: correctly list exported components (Merlijn Vos / #5417) + + +## 4.2.1 + +Released: 2024-08-26 + +| Package | Version | Package | Version | +| ----------- | ------- | ----------- | ------- | +| @uppy/react | 4.0.2 | uppy | 4.2.1 | + +- @uppy/react: fix `use-sync-external-store` import (Merlijn Vos / #5426) +- docs: fix Golden Retriever service worker import (mkabatek / #5425) + + +## 4.2.0 + +Released: 2024-08-20 + +| Package | Version | Package | Version | +| ----------------- | ------- | ----------------- | ------- | +| @uppy/core | 4.1.2 | @uppy/transloadit | 4.1.0 | +| @uppy/status-bar | 4.0.3 | uppy | 4.2.0 | +| @uppy/svelte | 4.0.1 | | | + +- @uppy/status-bar: show upload button when files are recovered (Merlijn Vos / #5418) +- meta: Bump docker/build-push-action from 6.6.1 to 6.7.0 (dependabot[bot] / #5413) +- docs: remove stale reference to plugins page (Merlijn Vos / #5414) +- @uppy/transloadit: add execution_progress to AssemblyResponse type (Merlijn Vos / #5420) +- @uppy/svelte: fix exports condition (Merlijn Vos / #5416) +- @uppy/transloadit: fix check if all files have been removed (Merlijn Vos / #5419) +- examples: remove `useUppy` from React Native example (Mikael Finstad / #5405) + + +## 4.1.1 + +Released: 2024-08-15 + +| Package | Version | Package | Version | +| ---------------------- | ------- | ---------------------- | ------- | +| @uppy/aws-s3 | 4.0.3 | @uppy/provider-views | 4.0.1 | +| @uppy/companion | 5.0.5 | @uppy/status-bar | 4.0.2 | +| @uppy/companion-client | 4.0.1 | @uppy/transloadit | 4.0.2 | +| @uppy/core | 4.1.1 | @uppy/tus | 4.0.1 | +| @uppy/dashboard | 4.0.3 | @uppy/utils | 6.0.2 | +| @uppy/drag-drop | 4.0.2 | @uppy/vue | 2.0.1 | +| @uppy/file-input | 4.0.1 | uppy | 4.1.1 | +| @uppy/image-editor | 3.0.1 | | | + +- @uppy/transloadit: fix issue with `allowMultipleUploadBatches` (Mikael Finstad / #5400) +- meta: Bump elliptic from 6.5.5 to 6.5.7 (dependabot[bot] / #5410) +- meta: add back patch for `p-queue` (Antoine du Hamel / #5409) +- @uppy/transloadit: fix many lurking `TypeError` (Mikael Finstad / #5399) +- docs: improve `corsOrigins` documentation (Mikael Finstad / #5390) +- docs: add `ViewEncapsulation` to Angular example (Aaron Russell / #5395) +- @uppy/companion: fix code for custom providers (Mikael Finstad / #5398) +- docs: add note about throwing in `cancelAll` and `destroy()` (Mikael Finstad / #5408) +- meta: Bump docker/login-action from 3.2.0 to 3.3.0 (dependabot[bot] / #5372) +- meta: Bump docker/setup-qemu-action from 3.1.0 to 3.2.0 (dependabot[bot] / #5370) +- docs: make hosted Companion more clear (Merlijn Vos / #5394) +- meta: Bump docker/build-push-action from 6.4.1 to 6.6.1 (dependabot[bot] / #5403) +- meta: bump p-queue to latest, remove patch (Mikael Finstad / #5391) +- meta: enforce `.ts` extension for relative import types (Antoine du Hamel / #5393) +- @uppy/tus: Fix onShouldRetry type signature (Trent Nadeau / #5387) +- @uppy/dashboard,@uppy/drag-drop,@uppy/file-input: Transform the `accept` prop into a string everywhere (Evgenia Karunus / #5380) +- docs: fix getTemporarySecurityCredentials in aws-s3 (Merlijn Vos / #5363) + + ## 4.1.0 Released: 2024-07-30 @@ -6060,7 +6197,7 @@ Released: 2018-02-11. - dashboard: Use more accessible tip lib microtip (#536 / @arturi) - docs: Add PHP snippets to XHRUpload docs (#567 / @goto-bus-stop) - meta: Added instruction to fork the repo first (#512 / muhammadInam) -- meta: Automatically host releases on edgly and use that as our main CDN (#558 / @kvz) +- meta: Automatically host releases on Smart CDN and use that as our main CDN (#558 / @kvz) - meta: Dependency version updates (#523 / @goto-bus-stop) - meta: Remove unused files from published package (#586 / @goto-bus-stop) - s3: Respect `limit` option for upload parameter requests too; fix isXml() check when no content-type is available (#545, #544, #528 / @goto-bus-stop) diff --git a/README.md b/README.md index 77a7c7dfa8..6eaaab3ab2 100644 --- a/README.md +++ b/README.md @@ -87,13 +87,12 @@ npm install @uppy/core @uppy/dashboard @uppy/tus ``` Add CSS -[uppy.min.css](https://releases.transloadit.com/uppy/v4.1.0/uppy.min.css), +[uppy.min.css](https://releases.transloadit.com/uppy/v4.4.1/uppy.min.css), either to your HTML page’s `` or include in JS, if your bundler of choice supports it. -Alternatively, you can also use a pre-built bundle from Transloadit’s CDN: -Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` -object. +Alternatively, you can also use a pre-built bundle from Transloadit’s CDN: Smart +CDN. In that case `Uppy` will attach itself to the global `window.Uppy` object. > ⚠️ The bundle consists of most Uppy plugins, so this method is not recommended > for production, as your users will have to download all plugins when you are @@ -102,7 +101,7 @@ object. ```html @@ -113,7 +112,7 @@ object. Uppy, Dashboard, Tus, - } from 'https://releases.transloadit.com/uppy/v4.1.0/uppy.min.mjs' + } from 'https://releases.transloadit.com/uppy/v4.4.1/uppy.min.mjs' const uppy = new Uppy() uppy.use(Dashboard, { target: '#files-drag-drop' }) @@ -124,8 +123,6 @@ object. ## Documentation - [Uppy](https://uppy.io/docs/uppy/) — full list of options, methods and events -- [Plugins](https://uppy.io/docs/plugins/) — list of Uppy plugins and their - options - [Companion](https://uppy.io/docs/companion/) — setting up and running a Companion instance, which adds support for Instagram, Dropbox, Box, Google Drive and remote URLs @@ -136,8 +133,6 @@ object. ## Plugins -[List of plugins and their common options](https://uppy.io/docs/plugins/) - ### UI Elements - [`Dashboard`](https://uppy.io/docs/dashboard/) — universal UI with previews, @@ -306,69 +301,69 @@ Use Uppy in your project? dependabot[bot]kiloreuxsamuelayosadovnychyirichardwillarsajkachnic zcallanYukeshShrjankooliverpoolBotzmcallistertyler mokutsu-courseradschmidtDJWassinkmrbatistataoqftimodwhit -tim-koseltocieartuoxiansppaulnMikeKovariktoadkicker -ap--tranvansangLiviaMedeirosbertho-zerojuliangruberHawxy -gavboultonmejiaejelenalapedominicedenAcconutjhen0409 -stephentusobencergazdaa-kriyayonahforststanislavcervenaksksavant -ogtfabernndevstudioMatthiasKunnenmanuelkiesslingdargmueslijohnnyperkins -ofhopeyaegorzhuangyasparanoidThomasG77subha1206 -schonertSlavikTraktorscottbesslerjrschumacherrosenfeldrdimartino -ahmedkandelYoussef1313allenfantasyZyclotrop-janarkbdirito -darthf1fortriebfrederikhorsheocoijareymuhammadInam -rettgerstmkabatekjukakoskiolemoignbtrice5idereal +tuoxianspeltocieartim-kospaulnMikeKovariktoadkicker +dominicedenap--tranvansangLiviaMedeirosbertho-zerojuliangruber +HawxyelenalapegavboultonmejiaejAcconutjhen0409 +mkabatekstephentusobencergazdaa-kriyayonahforststanislav-cervenak +sksavantogtfabernndevstudioMatthiasKunnendargmueslimanuelkiessling +johnnyperkinsofhopeyaegorzhuangyasparanoidThomasG77 +subha1206schonertSlavikTraktorscottbesslerjrschumacherrosenfeld +rdimartinoahmedkandelYoussef1313allenfantasyZyclotrop-janark +bdiritodarthf1fortriebfrederikhorsheocoijarey +muhammadInamrettgerstjukakoskiolemoign5iderealbtrice AndrwMbehnammodiBePo65bradedelmancamiloforerocommand-tab craig-jenningsdavekissdenysdesignethanwillisfrobinsonjrichmeij richartkeilpaescujmsandmartiuslimMartin005mskelton -mactavishzlafedogrockerjedwoodjasonboscogeertclerx -ghasrfakhriJimmyLvrossngscherromanrobwilson1SxDx -reforaulibanezluarmreman8519pedantic-gitPzoco -ppadmavilasomphillipalexanderpmusarajpedrofsplnetopatricklindsay -Mitchell8210Tashowstajstrayersjauldsteverob -amaituquigebowaptikSpazzMarticusszhsergei-zelinsky -sebasegovia01sdebackerRattonesamuelcolburnfortunto2GNURub -rartachmiralken-kuromilannakummkopinskymhulet -hrshmauricioribeiromatthewhartstongemjesuelemattfikmateuscruz -masumulu28masaokmartin-brennanmarcusforsbergmarcosthejewmperrando -pascalwengerterParsaArvanehPAcryptic022Ozodbek1405leftdevelnil1511 -coreprocessnicojonestrungcva10a6tnnaveed-ahmadnadeemcpleasespammelater -marton-laszlo-attilanavruzmmogzolshahimcltmnafeesboudra -netdownmosi-khamaddy-jomdxiaohumagumbojx-zyf -kode-ninjasontixyoujur-ngjohnmanjiro13jyoungbloodgreen-mike -gaelicwinterfrancklfingulelliotsayesdzcpydkisic -zanzlenderolitomasyoann-hellopretvedran555tusharjkhuntthanhthot -stduhpfslawexxx44rtaiebrmoura-92rlebosserhymes -lunttaphil714ordagoodselsevierninesaltneuronet77 -craigcbrunnerweston-sankey-mark43dwnstenagyvstiigvalentinoli -viallybodryityler-dot-earthtrivikrtop-mastertvaliasek -tomekptomsaleebaWIStudenttmaierTiarhaitwarlop -tcgjcodehero7386christianwengertcgoinglovecanvasbhc0b41 -avallaargghalfatvagreene-courseraaduh95-test-accountsartoshi-foot-dao -zackbloomzlawson-utzachconneryafkariYehudaKremerxhocquet -willycamargosercraigardeoisCommanderRootczjcbush06 -Aarbelcfracspranceprattcmpsubvertallchrischarlybillaud -Cretezychaocellvinchungcartfiskcyubryanjswift -bedgerottoeliOcsyoldarefbautistaemuellEdgarSantiago93 -sweetrojeetissDennisKofflardhoangsvitdavilima6akizor -KaminskiDaniellCantabarmrboomerdanilatdanschalowdanmichaelo -CruaierwbaaronfunctinoamitporttekacsDogfalo -alirezahiaalepisalexnjasmt3ahmadissaadritasharma -Adrreiadityapatadiaadamvigneaultajh-sradamdottvabannach -superhawk610ajschmidt8Quorafindbducharmeazizkazeemba -ayhankesiciogluavneetmalhotraThe-Flashatsawinash-jc-allenapuyou -arthurdennerAbourasstyndriaanthony0030andychongyzandrii-bodnar -superandrew213radarherekidonngkevin-west-10xkergekacsafiresharkstudios -kaspermeinematykaroljveltenmellow-fellowjmontoyaajcalonso -jbelejjszobodyjorgeepcjondewoojonathanarbelyjsanchez034 -Jokcychromacomaonhatemarc-mabeLucklj521lucax88x -lucaperretombrlouimdolphinigleleomelzerleods92 -galli-leodvirylarowlanleaanthonyhoangbitslabohkip81 -kyleparisielkebabprofsmallpineIanVShuydodHussainAlkhalifah -HughbertDhiromi2424giacomocerquoneroenschggjungbgeoffappleford -gabiganamfuadscodesdtrucsferdiusafgallinariGkleinereva -epexaEnricoSottileelliotdickisontheJoeBizJmalesjessica-coursera -vithjanwiltsjanklimojamestiotiojcjmccleanJbithell -JakubHaladejjakemcallistergaejabongJacobMGEvansmazorussGreenJimmy -intenziveNaxYoishendyweb +mactavishzlafedogrockerjedwoodjasonboscoghasrfakhri +geertclerxtcgjrartrossngscherromanrobwilson1 +SxDxreforaulibanezluarmreman8519pedantic-git +Pzocoppadmavilasomphillipalexanderpmusarajpedrofsplneto +patricklindsayTashowstajstrayersjauldsteverob +amaituquigebowaptikSpazzMarticusszhscebotari66 +sergei-zelinskysebasegovia01sdebackerRattonesamuelcolburnfortunto2 +GNURubMitchell8210achmiralken-kuromilannakummkopinsky +mhulethrshmauricioribeiromatthewhartstongemjesuelemattfik +mateuscruzmasum-ulumasaokmartin-brennanmarcusforsbergmarcosthejew +eliOcspascalwengerterParsaArvanehPAcryptic022Ozodbek1405leftdevel +nil1511coreprocessnicojonestrungcva10a6tnnaveed-ahmadnadeemc +pleasespammelatermarton-laszlo-attilanavruzmmogzolshahimcltmnafees +boudraJimmyLvnetdownmosi-khamaddy-jomdxiaohu +magumbojx-zyfkode-ninjasontixyoujur-ngjohnmanjiro13 +jyoungbloodgreen-mikegaelicwinterfrancklfingulelliotsayes +dzcpydkisiczanzlenderolitomasyoann-hellopretvedran555 +tusharjkhuntthanhthotstduhpfslawexxx44rtaiebrmoura-92 +rlebosserhymeslunttaphil714ordagoodselsevier +ninesaltneuronet77craigcbrunnerweston-sankey-mark43dwnstenagyv +stiigvalentinoliviallybodryityler-dot-earthtrivikr +tanadeautop-mastertvaliasektomekptomsaleebaWIStudent +tmaierTiarhaitwarlopcodehero7386christianwengertcgoinglove +canvasbhc0b41avallaargghalfatvagreene-coursera +aduh95-test-accountsartoshi-foot-daozackbloomzlawson-utzachconneryafkari +YehudaKremerxhocquetwillycamargoardeoisCommanderRootczj +cbush06Aarbelcfracspranceprattcmpsubvertallchris +charlybillaudCretezychaocellvinchungcartfiskcyu +bryanjswiftbedgerottowbaaronyoldarefbautistaemuell +EdgarSantiago93sweetrojeetissDennisKofflardhoangsvitdavilima6 +akizorKaminskiDaniellCantabarmrboomerdanilatdanschalow +danmichaeloCruaiersercraigQuorafindamitporttekacs +Dogfaloalirezahiaalepisalexnjasmt3ahmadissa +adritasharmaAdrreiadityapatadiaadamvigneaultajh-sradamdottv +abannachaaron-russellsuperhawk610ajschmidt8bducharmeazizk +azeembaayhankesiciogluavneetmalhotraThe-Flashatsawinash-jc-allen +apuyouarthurdennerAbourasstyndriaanthony0030andychongyz +andrii-bodnarsuperandrew213radarherefunctinomperrandokidonng +kevin-west-10xkergekacsafiresharkstudioskaspermeinematykaroljvelten +mellow-fellowjmontoyaajcalonsojbelejjszobodyjorgeepc +jondewoojonathanarbelyjsanchez034Jokcychromacomaonhate +marc-mabeLucklj521lucax88xlucaperretombrlouim +dolphinigleleomelzerleods92galli-leodvirylarowlan +leaanthonyhoangbitslabohkip81kyleparisielkebabprofsmallpine +IanVShuydodHussainAlkhalifahHughbertDhiromi2424giacomocerquone +roenschggjungbgeoffapplefordgabiganamfuadscodesdtrucs +ferdiusafgallinariGkleinerevaepexaEnricoSottileelliotdickison +theJoeBizJmalesjessica-courseravithjanwiltsjanklimo +jamestiotiojcjmccleanJbithellJakubHaladejjakemcallistergaejabong +JacobMGEvansmazorussGreenJimmyintenziveNaxYoishendyweb diff --git a/bin/build-bundle.mjs b/bin/build-bundle.mjs index 79bad41b35..19f7a63f8e 100644 --- a/bin/build-bundle.mjs +++ b/bin/build-bundle.mjs @@ -34,7 +34,7 @@ await fs.mkdir(new URL('./uppy/dist', PACKAGES_ROOT), { recursive: true }) const methods = [ buildBundle( - './packages/uppy/index.mjs', + './packages/uppy/src/bundle.ts', './packages/uppy/dist/uppy.min.mjs', { standalone: 'Uppy (ESM)', format: 'esm' }, ), diff --git a/docs/companion.md b/docs/companion.md index 824c86e16e..e58c00a6ee 100644 --- a/docs/companion.md +++ b/docs/companion.md @@ -67,6 +67,42 @@ files to arrive at Transloadit servers, much like Uppy. ::: +To do so each provider plugin must be configured with Transloadit’s Companion +URLs: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Dropbox from '@uppy/dropbox'; + +uppy.use(Dropbox, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Dropbox from '@uppy/dropbox'; + +uppy.use(Dropbox, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ## Installation & use Companion is installed from npm. Depending on how you want to run Companion, the @@ -644,14 +680,15 @@ the for `postMessage` calls in the context of OAuth. Setting it to `true` treats any origin as a trusted one, making it easier to -impersonate your brand. Setting it to `false` disables cross-origin supports, -use this if you’re serving Companion and Uppy from the same domain name. +impersonate your brand. Setting it to `false` disables cross-origin support, use +this if you’re serving Companion and Uppy from the same domain name. ##### `COMPANION_CLIENT_ORIGINS` -A comma-separated string of origins, or `'true'` (which will be interpreted as -the boolean value `true`), or `'false'` (which will be interpreted as the -boolean value `false`). +Stand-alone alternative to the `corsOrigins` option. A comma-separated string of +origins, or `'true'` (which will be interpreted as the boolean value `true`), or +`'false'` (which will be interpreted as the boolean value `false`). +`COMPANION_CLIENT_ORIGINS_REGEX` will be ignored if this option is used. ##### `COMPANION_CLIENT_ORIGINS_REGEX` @@ -664,9 +701,8 @@ make sure you’re validating the entirety of the string. ::: -Like COMPANION_CLIENT_ORIGINS, but allows a single regex instead. -`COMPANION_CLIENT_ORIGINS` will be ignored if this is used. This is a -standalone-only option. +Stand-alone alternative to the `corsOrigins` option. Like +`COMPANION_CLIENT_ORIGINS`, but allows a single regex instead. #### `chunkSize` `COMPANION_CHUNK_SIZE` @@ -949,3 +985,5 @@ automatically restart when files are changed. [url]: /docs/url [zoom]: /docs/zoom [transloadit]: https://transloadit.com +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/framework-integrations/angular.mdx b/docs/framework-integrations/angular.mdx index 6c6b747659..bcb154e42f 100644 --- a/docs/framework-integrations/angular.mdx +++ b/docs/framework-integrations/angular.mdx @@ -48,10 +48,16 @@ instance can be passed into components as a `props` prop. The following plugins are available as Angular component wrappers: -- `` renders [`@uppy/dashboard`](/docs/dashboard) -- `` renders [`@uppy/drag-drop`](/docs/drag-drop) -- `` renders [`@uppy/progress-bar`](/docs/progress-bar) -- `` renders [`@uppy/status-bar`](/docs/status-bar) +- Import `UppyAngularDashboardModule` used as `` renders + [`@uppy/dashboard`](/docs/dashboard) +- Import `UppyAngularDashboardModalModule` used as `` + renders [`@uppy/dashboard`](/docs/dashboard) as a modal +- Import `UppyAngularProgressBarModule` used as `` renders + [`@uppy/progress-bar`](/docs/progress-bar) +- Import `UppyAngularStatusBarModule` used as `` renders + [`@uppy/status-bar`](/docs/status-bar) +- Import `UppyAngularDragDropModule` used as `` renders + [`@uppy/drag-drop`](/docs/drag-drop) Each component takes a `props` prop that will be passed to the UI Plugin. @@ -96,8 +102,11 @@ decorator. You can find the CSS import statements in the docs of the UI plugin you want to use. For instance, for `@uppy/dashboard`: ```typescript +import { Component, ViewEncapsulation } from '@angular/core'; +//... @Component({ // ... + encapsulation: ViewEncapsulation.None, styleUrls: [ '../node_modules/@uppy/core/dist/style.css', '../node_modules/@uppy/dashboard/dist/style.css', diff --git a/docs/framework-integrations/react.mdx b/docs/framework-integrations/react.mdx index 6be7bfd227..5d2267ea33 100644 --- a/docs/framework-integrations/react.mdx +++ b/docs/framework-integrations/react.mdx @@ -57,6 +57,7 @@ and looking at our examples below. The following components are exported from `@uppy/react`: - `` renders [`@uppy/dashboard`](/docs/dashboard) +- `` renders [`@uppy/dashboard`](/docs/dashboard) as a modal - `` renders [`@uppy/drag-drop`](/docs/drag-drop) - `` renders [`@uppy/progress-bar`](/docs/progress-bar) - `` renders [`@uppy/status-bar`](/docs/status-bar) @@ -214,21 +215,24 @@ params. ```js // ... -function createUppy(userId) { - return new Uppy({ meta: { userId } }).use(Transloadit, { - async assemblyOptions(file) { +function createUppy() { + const uppy = new Uppy(); + uppy.use(Transloadit, { + async assemblyOptions() { // You can send meta data along for use in your template. // https://transloadit.com/docs/topics/assembly-instructions/#form-fields-in-instructions - const body = JSON.stringify({ userId: file.meta.userId }); + const { meta } = uppy.getState(); + const body = JSON.stringify({ userId: meta.userId }); const res = await fetch('/transloadit-params', { method: 'POST', body }); return response.json(); }, }); + return uppy; } function Component({ userId }) { // IMPORTANT: passing an initializer function to prevent Uppy from being reinstantiated on every render. - const [uppy] = useState(() => createUppy(userId)); + const [uppy] = useState(createUppy); useEffect(() => { if (userId) { diff --git a/docs/framework-integrations/svelte.mdx b/docs/framework-integrations/svelte.mdx index a0735f7cac..6d8922bc36 100644 --- a/docs/framework-integrations/svelte.mdx +++ b/docs/framework-integrations/svelte.mdx @@ -41,6 +41,7 @@ You also need to install the UI plugin you want to use. For instance, The following plugins are available as Svelte component wrappers: - `` renders [`@uppy/dashboard`](/docs/dashboard) +- `` renders [`@uppy/dashboard`](/docs/dashboard) as a modal - `` renders [`@uppy/drag-drop`](/docs/drag-drop) - `` renders [`@uppy/progress-bar`](/docs/progress-bar) - `` renders [`@uppy/status-bar`](/docs/status-bar) diff --git a/docs/golden-retriever.mdx b/docs/golden-retriever.mdx index bc5a245a38..33387d2804 100644 --- a/docs/golden-retriever.mdx +++ b/docs/golden-retriever.mdx @@ -106,7 +106,7 @@ store references to large files. ::: ```js title="sw.js" - import('@uppy/golden-retriever/lib/ServiceWorker'); + import '@uppy/golden-retriever/lib/ServiceWorker'; ``` 2. Register it in your app’s entry point: diff --git a/docs/guides/browser-support.mdx b/docs/guides/browser-support.mdx index 4537f47f18..aa963d51bd 100644 --- a/docs/guides/browser-support.mdx +++ b/docs/guides/browser-support.mdx @@ -49,14 +49,3 @@ window.ResizeObserver ??= ResizeObserver; export { default } from '@uppy/core'; export * from '@uppy/core'; ``` - -## Legacy CDN bundle - - - {` - import { Uppy, DragDrop, Tus } from "{{UPPY_JS_URL}}" - const uppy = new Uppy() - uppy.use(DragDrop, { target: '#uppy' }) - uppy.use(Tus, { endpoint: '//tusd.tusdemo.net/files/' }) - `} - diff --git a/docs/guides/migration-guides.md b/docs/guides/migration-guides.md index 360be6af28..b8ba53799b 100644 --- a/docs/guides/migration-guides.md +++ b/docs/guides/migration-guides.md @@ -6,10 +6,10 @@ These cover all the major Uppy versions and how to migrate to them. - End-of-Life versions of Node.js are no longer supported (use latest 18.x LTS, 20.x LTS, or 22.x current). -- Setting the `corsOrigin` option is now required. You should define the list of - origins you expect your app to be served from, otherwise it can be - impersonated from a different origin you don’t control. Set it to `true` if - you don’t care about impersonating. +- Setting the `corsOrigin` (`COMPANION_CLIENT_ORIGINS`) option is now required. + You should define the list of origins you expect your app to be served from, + otherwise it can be impersonated from a different origin you don’t control. + Set it to `true` if you don’t care about impersonating. - `COMPANION_REDIS_EXPRESS_SESSION_PREFIX` now defaults to `companion-session:` (before `sess:`). To revert keep backwards compatibility, set the environment variable `COMPANION_REDIS_EXPRESS_SESSION_PREFIX=sess:`. diff --git a/docs/locales.mdx b/docs/locales.mdx index 89917aeb3d..b3b7c6c21f 100644 --- a/docs/locales.mdx +++ b/docs/locales.mdx @@ -121,11 +121,11 @@ uppy.use(DragDrop, { ✏️{' '} - ar_SA.js + ar_SA.ts @@ -157,11 +157,11 @@ uppy.use(DragDrop, { ✏️{' '} - bg_BG.js + bg_BG.ts @@ -193,11 +193,11 @@ uppy.use(DragDrop, { ✏️{' '} - zh_CN.js + zh_CN.ts @@ -229,11 +229,11 @@ uppy.use(DragDrop, { ✏️{' '} - zh_TW.js + zh_TW.ts @@ -265,11 +265,11 @@ uppy.use(DragDrop, { ✏️{' '} - hr_HR.js + hr_HR.ts @@ -301,11 +301,11 @@ uppy.use(DragDrop, { ✏️{' '} - cs_CZ.js + cs_CZ.ts @@ -337,11 +337,11 @@ uppy.use(DragDrop, { ✏️{' '} - da_DK.js + da_DK.ts @@ -373,11 +373,11 @@ uppy.use(DragDrop, { ✏️{' '} - nl_NL.js + nl_NL.ts @@ -409,11 +409,11 @@ uppy.use(DragDrop, { ✏️{' '} - en_US.js + en_US.ts @@ -445,11 +445,11 @@ uppy.use(DragDrop, { ✏️{' '} - fi_FI.js + fi_FI.ts @@ -481,11 +481,11 @@ uppy.use(DragDrop, { ✏️{' '} - fr_FR.js + fr_FR.ts @@ -517,11 +517,11 @@ uppy.use(DragDrop, { ✏️{' '} - gl_ES.js + gl_ES.ts @@ -553,11 +553,11 @@ uppy.use(DragDrop, { ✏️{' '} - de_DE.js + de_DE.ts @@ -589,11 +589,11 @@ uppy.use(DragDrop, { ✏️{' '} - el_GR.js + el_GR.ts @@ -625,11 +625,11 @@ uppy.use(DragDrop, { ✏️{' '} - he_IL.js + he_IL.ts @@ -661,11 +661,11 @@ uppy.use(DragDrop, { ✏️{' '} - hi_IN.js + hi_IN.ts @@ -697,11 +697,11 @@ uppy.use(DragDrop, { ✏️{' '} - hu_HU.js + hu_HU.ts @@ -733,11 +733,11 @@ uppy.use(DragDrop, { ✏️{' '} - is_IS.js + is_IS.ts @@ -769,11 +769,11 @@ uppy.use(DragDrop, { ✏️{' '} - id_ID.js + id_ID.ts @@ -805,11 +805,11 @@ uppy.use(DragDrop, { ✏️{' '} - it_IT.js + it_IT.ts @@ -841,11 +841,11 @@ uppy.use(DragDrop, { ✏️{' '} - ja_JP.js + ja_JP.ts @@ -877,11 +877,11 @@ uppy.use(DragDrop, { ✏️{' '} - ko_KR.js + ko_KR.ts @@ -913,11 +913,11 @@ uppy.use(DragDrop, { ✏️{' '} - nb_NO.js + nb_NO.ts @@ -949,11 +949,11 @@ uppy.use(DragDrop, { ✏️{' '} - fa_IR.js + fa_IR.ts @@ -985,11 +985,11 @@ uppy.use(DragDrop, { ✏️{' '} - pl_PL.js + pl_PL.ts @@ -1021,11 +1021,11 @@ uppy.use(DragDrop, { ✏️{' '} - pt_BR.js + pt_BR.ts @@ -1057,11 +1057,11 @@ uppy.use(DragDrop, { ✏️{' '} - pt_PT.js + pt_PT.ts @@ -1093,11 +1093,11 @@ uppy.use(DragDrop, { ✏️{' '} - ro_RO.js + ro_RO.ts @@ -1129,11 +1129,11 @@ uppy.use(DragDrop, { ✏️{' '} - ru_RU.js + ru_RU.ts @@ -1166,11 +1166,11 @@ uppy.use(DragDrop, { ✏️{' '} - sr_RS_Cyrillic.js + sr_RS_Cyrillic.ts @@ -1203,11 +1203,11 @@ uppy.use(DragDrop, { ✏️{' '} - sr_RS_Latin.js + sr_RS_Latin.ts @@ -1239,11 +1239,11 @@ uppy.use(DragDrop, { ✏️{' '} - sk_SK.js + sk_SK.ts @@ -1275,11 +1275,11 @@ uppy.use(DragDrop, { ✏️{' '} - es_ES.js + es_ES.ts @@ -1311,11 +1311,11 @@ uppy.use(DragDrop, { ✏️{' '} - es_MX.js + es_MX.ts @@ -1347,11 +1347,11 @@ uppy.use(DragDrop, { ✏️{' '} - sv_SE.js + sv_SE.ts @@ -1383,11 +1383,11 @@ uppy.use(DragDrop, { ✏️{' '} - th_TH.js + th_TH.ts @@ -1419,11 +1419,11 @@ uppy.use(DragDrop, { ✏️{' '} - tr_TR.js + tr_TR.ts @@ -1455,11 +1455,11 @@ uppy.use(DragDrop, { ✏️{' '} - uk_UA.js + uk_UA.ts @@ -1491,11 +1491,11 @@ uppy.use(DragDrop, { ✏️{' '} - uz_UZ.js + uz_UZ.ts @@ -1527,11 +1527,11 @@ uppy.use(DragDrop, { ✏️{' '} - vi_VN.js + vi_VN.ts diff --git a/docs/presets/remote-sources.mdx b/docs/presets/remote-sources.mdx index 676972e453..5bcb0423d0 100644 --- a/docs/presets/remote-sources.mdx +++ b/docs/presets/remote-sources.mdx @@ -81,6 +81,42 @@ new Uppy(); .use(RemoteSources, { companionUrl: 'https://your-companion-url' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import RemoteSources from '@uppy/remote-sources'; + +uppy.use(RemoteSources, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import RemoteSources from '@uppy/remote-sources'; + +uppy.use(RemoteSources, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + GoogleDrive: { key: '...', credentialsName: '...' }, + Dropbox: { key: '...', credentialsName: '...' }, + // ...etc + }, +}); +``` + ## API ### Options @@ -139,3 +175,5 @@ DOM element, CSS selector, or plugin to place the drag and drop area into [`request.credentials` value]: https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/box.mdx b/docs/sources/companion-plugins/box.mdx index aabde9c9ef..9312bbdbd9 100644 --- a/docs/sources/companion-plugins/box.mdx +++ b/docs/sources/companion-plugins/box.mdx @@ -81,6 +81,41 @@ new Uppy() .use(Box, { companionUrl: 'https://your-companion.com' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Box from '@uppy/box'; + +uppy.use(Box, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Box from '@uppy/box'; + +uppy.use(Box, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion You can create a Box App on the @@ -186,3 +221,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/dropbox.mdx b/docs/sources/companion-plugins/dropbox.mdx index b5c52dd86c..4a111f35d5 100644 --- a/docs/sources/companion-plugins/dropbox.mdx +++ b/docs/sources/companion-plugins/dropbox.mdx @@ -81,6 +81,41 @@ new Uppy() .use(Dropbox, { companionUrl: 'https://your-companion.com' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Dropbox from '@uppy/dropbox'; + +uppy.use(Dropbox, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Dropbox from '@uppy/dropbox'; + +uppy.use(Dropbox, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion You can create a Dropbox App on the @@ -186,3 +221,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/facebook.mdx b/docs/sources/companion-plugins/facebook.mdx index e0d87bf8a2..dcc4968094 100644 --- a/docs/sources/companion-plugins/facebook.mdx +++ b/docs/sources/companion-plugins/facebook.mdx @@ -81,6 +81,41 @@ new Uppy() .use(Facebook, { companionUrl: 'https://your-companion.com' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Facebook from '@uppy/facebook'; + +uppy.use(Facebook, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Facebook from '@uppy/facebook'; + +uppy.use(Facebook, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion You can create a Facebook App on the @@ -183,3 +218,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/google-drive.mdx b/docs/sources/companion-plugins/google-drive.mdx index b7332e5c56..c682464ecb 100644 --- a/docs/sources/companion-plugins/google-drive.mdx +++ b/docs/sources/companion-plugins/google-drive.mdx @@ -81,6 +81,41 @@ new Uppy() .use(GoogleDrive, { companionUrl: 'https://your-companion.com' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import GoogleDrive from '@uppy/google-drive'; + +uppy.use(GoogleDrive, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import GoogleDrive from '@uppy/google-drive'; + +uppy.use(GoogleDrive, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion To sign up for API keys, go to the @@ -187,3 +222,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/google-photos.mdx b/docs/sources/companion-plugins/google-photos.mdx index 23d92928a3..e90cfb6e65 100644 --- a/docs/sources/companion-plugins/google-photos.mdx +++ b/docs/sources/companion-plugins/google-photos.mdx @@ -84,6 +84,41 @@ new Uppy() }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import GooglePhotos from '@uppy/google-photos'; + +uppy.use(GooglePhotos, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import GooglePhotos from '@uppy/google-photos'; + +uppy.use(GooglePhotos, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion To sign up for API keys, go to the @@ -183,3 +218,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/instagram.mdx b/docs/sources/companion-plugins/instagram.mdx index caa8f5a422..ca920d86cf 100644 --- a/docs/sources/companion-plugins/instagram.mdx +++ b/docs/sources/companion-plugins/instagram.mdx @@ -81,6 +81,41 @@ new Uppy() .use(Instagram, { companionUrl: 'https://your-companion.com' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Instagram from '@uppy/instagram'; + +uppy.use(Instagram, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Instagram from '@uppy/instagram'; + +uppy.use(Instagram, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion To sign up for API keys, go to the @@ -196,3 +231,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/onedrive.mdx b/docs/sources/companion-plugins/onedrive.mdx index a58af32b39..b91c3931e3 100644 --- a/docs/sources/companion-plugins/onedrive.mdx +++ b/docs/sources/companion-plugins/onedrive.mdx @@ -81,6 +81,41 @@ new Uppy() .use(OneDrive, { companionUrl: 'https://your-companion.com' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import OneDrive from '@uppy/onedrive'; + +uppy.use(OneDrive, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import OneDrive from '@uppy/onedrive'; + +uppy.use(OneDrive, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion To sign up for API keys, go to the @@ -100,15 +135,14 @@ If you are using Transloadit hosted Companion: https://api2.transloadit.com/companion/onedrive/redirect ``` -Go to the “Manifest” tab, and find the `"signInAudience"` key. -Change it to `"signInAudience": "AzureADandPersonalMicrosoftAccount"`, and click -“Save”. +Go to the “Manifest” tab, and find the `"signInAudience"` key. Change it to +`"signInAudience": "AzureADandPersonalMicrosoftAccount"`, and click “Save”. -Go to the “Overview” tab. -Copy the `Application (client) ID` field - this will be your Oauth client ID. +Go to the “Overview” tab. Copy the `Application (client) ID` field - this will +be your Oauth client ID. -Go to the “Certificates & secrets” tab, and click “+ New client secret”. -Copy the `Value` field - this will be your OAuth client secret. +Go to the “Certificates & secrets” tab, and click “+ New client secret”. Copy +the `Value` field - this will be your OAuth client secret. Configure the OneDrive key and secret in Companion. With the standalone Companion server, specify environment variables: @@ -185,3 +219,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/unsplash.mdx b/docs/sources/companion-plugins/unsplash.mdx index 7bb1f59d14..1287729aeb 100644 --- a/docs/sources/companion-plugins/unsplash.mdx +++ b/docs/sources/companion-plugins/unsplash.mdx @@ -81,6 +81,41 @@ new Uppy() .use(Unsplash, { companionUrl: 'https://your-companion.com' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Unsplash from '@uppy/unsplash'; + +uppy.use(Unsplash, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Unsplash from '@uppy/unsplash'; + +uppy.use(Unsplash, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion You can create a Unsplash App on the @@ -162,3 +197,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/url.mdx b/docs/sources/companion-plugins/url.mdx index 0f3a6cd5cc..52892db586 100644 --- a/docs/sources/companion-plugins/url.mdx +++ b/docs/sources/companion-plugins/url.mdx @@ -89,6 +89,41 @@ new Uppy() .use(Url, { companionUrl: 'https://your-companion.com' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Url from '@uppy/url'; + +uppy.use(Url, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Url from '@uppy/url'; + +uppy.use(Url, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion Companion supports this plugin out-of-the-box, however it must be enabled in @@ -148,3 +183,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/sources/companion-plugins/zoom.mdx b/docs/sources/companion-plugins/zoom.mdx index e30eb455bc..83dbbc7c04 100644 --- a/docs/sources/companion-plugins/zoom.mdx +++ b/docs/sources/companion-plugins/zoom.mdx @@ -84,6 +84,41 @@ new Uppy() .use(Zoom, { companionUrl: 'https://your-companion.com' }); ``` +### Use with Transloadit + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Zoom from '@uppy/zoom'; + +uppy.use(Zoom, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, +}); +``` + +You may also hit rate limits, because the OAuth application is shared between +everyone using Transloadit. + +To solve that, you can use your own OAuth keys with Transloadit’s hosted +Companion servers by using Transloadit Template Credentials. [Create a Template +Credential][template-credentials] on the Transloadit site. Select “Companion +OAuth” for the service, and enter the key and secret for the provider you want +to use. Then you can pass the name of the new credentials to that provider: + +```js +import { COMPANION_URL, COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'; +import Zoom from '@uppy/zoom'; + +uppy.use(Zoom, { + companionUrl: COMPANION_URL, + companionAllowedHosts: COMPANION_ALLOWED_HOSTS, + companionKeysParams: { + key: 'YOUR_TRANSLOADIT_API_KEY', + credentialsName: 'my_companion_dropbox_creds', + }, +}); +``` + ### Use in Companion To sign up for API keys, go through the following steps: @@ -187,3 +222,6 @@ export default { }, }; ``` + +[template-credentials]: + https://transloadit.com/docs/#how-to-create-template-credentials diff --git a/docs/uploader/transloadit.mdx b/docs/uploader/transloadit.mdx index 4464ca25a3..4113406b9c 100644 --- a/docs/uploader/transloadit.mdx +++ b/docs/uploader/transloadit.mdx @@ -242,7 +242,7 @@ signature and return your configuration. ```js uppy.use(Transloadit, { - async assemblyOptions(file) { + async assemblyOptions() { const res = await fetch('/transloadit-params'); return res.json(); }, diff --git a/docs/uploader/tus.mdx b/docs/uploader/tus.mdx index 9c3abf39fd..3f0e95b306 100644 --- a/docs/uploader/tus.mdx +++ b/docs/uploader/tus.mdx @@ -81,6 +81,30 @@ new Uppy() .use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' }); ``` +### TypeScript + +If you want the `response` argument on the `upload-success` event and +`file.response.body` to be typed, you have to pass a generic to the Uppy class. + +```ts showLineNumbers +// ... +import Tus, { type TusBody } from '@uppy/tus'; + +type MyMeta = { + /* your added meta data */ +}; + +const uppy = new Uppy().use(Tus, { + endpoint: 'https://tusd.tusdemo.net/files/', +}); + +const [firstFile] = uppy.getFiles(); + +// Correctly typed as XMLHttpRequest. +// Populated after uppy.upload() +firstFile.response.body.xhr; +``` + ## API ### Options diff --git a/docs/uploader/xhr.mdx b/docs/uploader/xhr.mdx index d65c7e3e44..c62c2aed45 100644 --- a/docs/uploader/xhr.mdx +++ b/docs/uploader/xhr.mdx @@ -217,7 +217,10 @@ credentials (`boolean`, default: `false`). #### `onBeforeRequest` An optional function that will be called before a HTTP request is sent out -(`(xhr: XMLHttpRequest, retryCount: number) => void | Promise`). +(`(xhr: XMLHttpRequest, retryCount: number, files: UppyFile[]) => void | Promise`). + +The third argument, `files`, is an array of all Uppy files when `bundle` is +`true`. When `false`, it only contains one file. #### `shouldRetry` diff --git a/docs/uppy-core.mdx b/docs/uppy-core.mdx index c37e2344e1..d00a7160bd 100644 --- a/docs/uppy-core.mdx +++ b/docs/uppy-core.mdx @@ -704,7 +704,8 @@ uppy.removeFile('uppyteamkongjpg1501851828779'); #### `clear()` Clear the state. Can be useful for manually resetting Uppy after a successful -upload. +upload. Note that this method might throw an error if you try to call it while +an upload is ongoing. Upload plugins may choose to throw an error if called during an upload. @@ -773,7 +774,9 @@ Retry all uploads (after an error, for example). #### `cancelAll()` -Cancel all uploads, reset progress and remove all files. +Cancel all uploads, reset progress and remove all files. If you are using the +Transloadit plugin, this will also cancel all running assemblies, even after an +upload has finished. #### `setState(patch)` @@ -880,7 +883,9 @@ uppy.getPlugin('Dashboard').setOptions({ #### `destroy()` Uninstall all plugins and close down this Uppy instance. Also runs -`uppy.cancelAll()` before uninstalling. +`uppy.cancelAll()` before uninstalling. Note that this method should not +normally be used. If you only want reset the Uppy instance so that you can start +a new upload, you probably want to use `clear()` method instead. #### `logout()` diff --git a/e2e/cypress/integration/dashboard-transloadit.spec.ts b/e2e/cypress/integration/dashboard-transloadit.spec.ts index 311d42b116..faee0a33dc 100644 --- a/e2e/cypress/integration/dashboard-transloadit.spec.ts +++ b/e2e/cypress/integration/dashboard-transloadit.spec.ts @@ -65,14 +65,14 @@ describe('Dashboard with Transloadit', () => { cy.get('.uppy-StatusBar-actionBtn--upload').click() cy.wait(['@createAssemblies', '@tusCreate']).then(() => { - const plugin = getPlugin(uppy) + const { assembly } = getPlugin(uppy) - expect(plugin.assembly.closed).to.be.false + expect(assembly.closed).to.be.false uppy.cancelAll() cy.wait(['@delete', '@tusDelete']).then(() => { - expect(plugin.assembly.closed).to.be.true + expect(assembly.closed).to.be.true }) }) }) diff --git a/examples/aws-companion/package.json b/examples/aws-companion/package.json index 49f1819c94..8af34fe01a 100644 --- a/examples/aws-companion/package.json +++ b/examples/aws-companion/package.json @@ -11,14 +11,14 @@ }, "devDependencies": { "@uppy/companion": "workspace:*", - "body-parser": "^1.20.0", + "body-parser": "^1.20.3", "cookie-parser": "^1.4.6", "cors": "^2.8.5", "dotenv": "^16.0.1", "express": "^4.19.2", "express-session": "^1.17.3", "npm-run-all": "^4.1.5", - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "engines": { diff --git a/examples/aws-nodejs/package.json b/examples/aws-nodejs/package.json index ed07df7f8c..7cf824ef9a 100644 --- a/examples/aws-nodejs/package.json +++ b/examples/aws-nodejs/package.json @@ -13,7 +13,7 @@ "@aws-sdk/client-s3": "^3.338.0", "@aws-sdk/client-sts": "^3.338.0", "@aws-sdk/s3-request-presigner": "^3.338.0", - "body-parser": "^1.20.0", + "body-parser": "^1.20.3", "dotenv": "^16.0.0", "express": "^4.19.2" } diff --git a/examples/cdn-example/index.html b/examples/cdn-example/index.html index 15d1ebcda7..5c2a60381f 100644 --- a/examples/cdn-example/index.html +++ b/examples/cdn-example/index.html @@ -5,7 +5,7 @@ @@ -19,7 +19,7 @@ Dashboard, Webcam, Tus, - } from 'https://releases.transloadit.com/uppy/v4.1.0/uppy.min.mjs' + } from 'https://releases.transloadit.com/uppy/v4.4.1/uppy.min.mjs' const uppy = new Uppy({ debug: true, autoProceed: false }) .use(Dashboard, { trigger: '#uppyModalOpener' }) diff --git a/examples/custom-provider/package.json b/examples/custom-provider/package.json index afcf1b175e..1429899e6e 100644 --- a/examples/custom-provider/package.json +++ b/examples/custom-provider/package.json @@ -16,12 +16,12 @@ }, "devDependencies": { "@uppy/companion": "workspace:*", - "body-parser": "^1.18.2", + "body-parser": "^1.20.3", "dotenv": "^16.0.1", "express": "^4.19.2", "express-session": "^1.15.6", "npm-run-all": "^4.1.2", - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "scripts": { diff --git a/examples/digitalocean-spaces/package.json b/examples/digitalocean-spaces/package.json index 2339161ec7..3fd2bdb85d 100644 --- a/examples/digitalocean-spaces/package.json +++ b/examples/digitalocean-spaces/package.json @@ -6,13 +6,13 @@ "@uppy/aws-s3": "workspace:*", "@uppy/core": "workspace:*", "@uppy/dashboard": "workspace:*", - "body-parser": "^1.18.3", + "body-parser": "^1.20.3", "cors": "^2.8.5" }, "devDependencies": { "dotenv": "^16.0.1", "express": "^4.19.2", - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "scripts": { diff --git a/examples/multiple-instances/package.json b/examples/multiple-instances/package.json index 7fdd29d025..b9b91a9cfb 100644 --- a/examples/multiple-instances/package.json +++ b/examples/multiple-instances/package.json @@ -8,7 +8,7 @@ "@uppy/golden-retriever": "workspace:*" }, "devDependencies": { - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "scripts": { diff --git a/examples/node-xhr/package.json b/examples/node-xhr/package.json index 6eb0a2b5c3..853572e9aa 100644 --- a/examples/node-xhr/package.json +++ b/examples/node-xhr/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "npm-run-all": "^4.1.3", - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "scripts": { diff --git a/examples/php-xhr/package.json b/examples/php-xhr/package.json index b36a825077..f0ba4a0997 100644 --- a/examples/php-xhr/package.json +++ b/examples/php-xhr/package.json @@ -10,7 +10,7 @@ }, "devDependencies": { "npm-run-all": "^4.1.3", - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "scripts": { diff --git a/examples/python-xhr/package.json b/examples/python-xhr/package.json index 4d4afcd720..53b32a2977 100644 --- a/examples/python-xhr/package.json +++ b/examples/python-xhr/package.json @@ -10,7 +10,7 @@ }, "devDependencies": { "npm-run-all": "^4.1.3", - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "scripts": { diff --git a/examples/react-example/App.tsx b/examples/react-example/App.tsx index e7636f1dbe..3387e8045c 100644 --- a/examples/react-example/App.tsx +++ b/examples/react-example/App.tsx @@ -1,16 +1,60 @@ /* eslint-disable */ import React from 'react' -import Uppy from '@uppy/core' +import { createRoot } from 'react-dom/client' +import Uppy, { + UIPlugin, + type Meta, + type Body, + type UIPluginOptions, + type State, +} from '@uppy/core' import Tus from '@uppy/tus' import Webcam from '@uppy/webcam' -import RemoteSources from '@uppy/remote-sources' import { Dashboard, useUppyState } from '@uppy/react' import '@uppy/core/dist/style.css' import '@uppy/dashboard/dist/style.css' -import '@uppy/drag-drop/dist/style.css' -import '@uppy/file-input/dist/style.css' -import '@uppy/progress-bar/dist/style.css' +import '@uppy/webcam/dist/style.css' + +interface MyPluginOptions extends UIPluginOptions {} + +interface MyPluginState extends Record {} + +// Custom plugin example inside React +class MyPlugin extends UIPlugin< + MyPluginOptions, + M, + B, + MyPluginState +> { + container!: HTMLElement + + constructor(uppy: Uppy, opts?: MyPluginOptions) { + super(uppy, opts) + this.type = 'acquirer' + this.id = this.opts.id || 'TEST' + this.title = 'Test' + } + + override install() { + const { target } = this.opts + if (target) { + this.mount(target, this) + } + } + + override uninstall() { + this.unmount() + } + + override render(state: State, container: HTMLElement) { + // Important: during the initial render is not defined. Safely return. + if (!container) return + createRoot(container).render( +

React component inside Uppy's Preact UI

, + ) + } +} const metaFields = [ { id: 'license', name: 'License', placeholder: 'specify license' }, @@ -20,9 +64,7 @@ function createUppy() { return new Uppy({ restrictions: { requiredMetaFields: ['license'] } }) .use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' }) .use(Webcam) - .use(RemoteSources, { - companionUrl: 'https://companion.uppy.io', - }) + .use(MyPlugin) } export default function App() { diff --git a/examples/react-example/main.tsx b/examples/react-example/main.tsx index bf7e150561..5969f2d933 100644 --- a/examples/react-example/main.tsx +++ b/examples/react-example/main.tsx @@ -3,4 +3,4 @@ import React from 'react' import { createRoot } from 'react-dom/client' import App from './App.tsx' -createRoot(document.querySelector('#app')).render() +createRoot(document.querySelector('#app')!).render() diff --git a/examples/react-example/package.json b/examples/react-example/package.json index d0f96ca09c..131ccf8a6b 100644 --- a/examples/react-example/package.json +++ b/examples/react-example/package.json @@ -19,6 +19,6 @@ }, "devDependencies": { "@vitejs/plugin-react": "^4.0.0", - "vite": "^5.0.0" + "vite": "^5.3.6" } } diff --git a/examples/react-native-expo/App.js b/examples/react-native-expo/App.js index d5784fb0ed..f380b4251a 100644 --- a/examples/react-native-expo/App.js +++ b/examples/react-native-expo/App.js @@ -4,7 +4,6 @@ import AsyncStorage from '@react-native-async-storage/async-storage' import Uppy from '@uppy/core' import Tus from '@uppy/tus' import FilePicker from '@uppy/react-native' -import useUppy from '@uppy/react/lib/useUppy' import FileList from './FileList' import PauseResumeButton from './PauseResumeButton' import ProgressBar from './ProgressBar' @@ -27,15 +26,13 @@ export default function App () { const setState = useCallback((newState) => _setState((oldState) => ({ ...oldState, ...newState })), []) - const uppy = useUppy(() => { - return new Uppy({ autoProceed: true, debug: true }) + const [uppy] = useState(() => new Uppy({ autoProceed: true, debug: true }) .use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/', urlStorage: AsyncStorage, fileReader: getTusFileReader, chunkSize: 10 * 1024 * 1024, // keep the chunk size small to avoid memory exhaustion - }) - }) + })); useEffect(() => { uppy.on('upload-progress', (file, progress) => { diff --git a/examples/redux/package.json b/examples/redux/package.json index 501dd89419..e9d0ecf0e6 100644 --- a/examples/redux/package.json +++ b/examples/redux/package.json @@ -12,7 +12,7 @@ "redux-logger": "^3.0.6" }, "devDependencies": { - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "scripts": { diff --git a/examples/svelte-example/package.json b/examples/svelte-example/package.json index 003d7ed236..b19338ccc9 100644 --- a/examples/svelte-example/package.json +++ b/examples/svelte-example/package.json @@ -16,11 +16,11 @@ "@sveltejs/vite-plugin-svelte": "^3.0.0", "@types/formidable": "^3", "npm-run-all": "^4.1.5", - "svelte": "^4.2.7", + "svelte": "^4.2.19", "svelte-check": "^3.6.0", "tslib": "^2.4.1", "typescript": "~5.4", - "vite": "^5.0.0" + "vite": "^5.3.6" }, "dependencies": { "@uppy/core": "workspace:*", diff --git a/examples/transloadit-markdown-bin/package.json b/examples/transloadit-markdown-bin/package.json index 00a956f540..6c48fb8e14 100644 --- a/examples/transloadit-markdown-bin/package.json +++ b/examples/transloadit-markdown-bin/package.json @@ -13,7 +13,7 @@ "marked": "^12.0.0" }, "devDependencies": { - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "scripts": { diff --git a/examples/transloadit/index.html b/examples/transloadit/index.html index ac0cf2a5e1..a3919ae1f8 100644 --- a/examples/transloadit/index.html +++ b/examples/transloadit/index.html @@ -37,7 +37,7 @@

Uppy Transloadit diff --git a/examples/transloadit/package.json b/examples/transloadit/package.json index 205b2f3734..dc122287fe 100644 --- a/examples/transloadit/package.json +++ b/examples/transloadit/package.json @@ -4,7 +4,7 @@ "type": "module", "devDependencies": { "npm-run-all": "^4.1.5", - "vite": "^5.0.0" + "vite": "^5.3.6" }, "dependencies": { "@uppy/core": "workspace:*", diff --git a/examples/uppy-with-companion/client/index.html b/examples/uppy-with-companion/client/index.html index 02175938fe..6cf3673beb 100644 --- a/examples/uppy-with-companion/client/index.html +++ b/examples/uppy-with-companion/client/index.html @@ -5,7 +5,7 @@ @@ -19,7 +19,7 @@ Instagram, GoogleDrive, Tus, - } from 'https://releases.transloadit.com/uppy/v4.1.0/uppy.min.mjs' + } from 'https://releases.transloadit.com/uppy/v4.4.1/uppy.min.mjs' const uppy = new Uppy({ debug: true, autoProceed: false }) .use(Dashboard, { trigger: '#uppyModalOpener' }) diff --git a/examples/uppy-with-companion/package.json b/examples/uppy-with-companion/package.json index 310e183cb1..5f0bb6969e 100644 --- a/examples/uppy-with-companion/package.json +++ b/examples/uppy-with-companion/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "dependencies": { "@uppy/companion": "workspace:*", - "body-parser": "^1.18.2", + "body-parser": "^1.20.3", "express": "^4.19.2", "express-session": "^1.15.6", "light-server": "^2.4.0", diff --git a/examples/vue3/package.json b/examples/vue3/package.json index 0b0eaec358..f578294693 100644 --- a/examples/vue3/package.json +++ b/examples/vue3/package.json @@ -19,6 +19,6 @@ }, "devDependencies": { "@vitejs/plugin-vue": "^5.0.0", - "vite": "^5.0.0" + "vite": "^5.3.6" } } diff --git a/examples/xhr-bundle/package.json b/examples/xhr-bundle/package.json index 2899a4f4d1..c07458a628 100644 --- a/examples/xhr-bundle/package.json +++ b/examples/xhr-bundle/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "npm-run-all": "^4.1.5", - "vite": "^5.0.0" + "vite": "^5.3.6" }, "private": true, "scripts": { diff --git a/package.json b/package.json index e1615307cd..39d067e66a 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "node": "^16.15.0 || >=18.0.0", "yarn": "3.6.1" }, - "packageManager": "yarn@4.3.1+sha224.934d21773e22af4b69a7032a2d3b4cb38c1f7c019624777cc9916b23", + "packageManager": "yarn@4.4.1+sha224.fd21d9eb5fba020083811af1d4953acc21eeb9f6ff97efd1b3f9d4de", "workspaces": [ "examples/*", "packages/@uppy/*", @@ -118,9 +118,9 @@ "build:angular": "yarn workspace angular build", "build:js:typeless": "npm-run-all build:lib build:companion build:svelte", "build:js": "npm-run-all build:js:typeless build:locale-pack build:angular build:bundle", - "build:ts": "yarn workspaces list --no-private --json | yarn tsc -b && yarn workspace @uppy/svelte validate", + "build:ts": "yarn workspaces list --no-private --json | yarn tsc -b && yarn workspace @uppy/svelte check", "build:lib": "yarn node ./bin/build-lib.js", - "build:locale-pack": "yarn workspace @uppy-dev/locale-pack build && eslint packages/@uppy/locales/src/en_US.js --fix && yarn workspace @uppy-dev/locale-pack test unused", + "build:locale-pack": "yarn workspace @uppy-dev/locale-pack build && eslint packages/@uppy/locales/src/en_US.ts --fix && yarn workspace @uppy-dev/locale-pack test unused", "build": "npm-run-all --serial build:ts --parallel build:js build:css --serial size", "contributors:save": "yarn node ./bin/update-contributors.mjs", "dev:with-companion": "npm-run-all --parallel start:companion dev", @@ -168,7 +168,7 @@ "@types/react": "^18", "@types/webpack-dev-server": "^4", "@vitest/utils": "patch:@vitest/utils@npm%3A1.2.1#./.yarn/patches/@vitest-utils-npm-1.2.1-3028846845.patch", - "p-queue": "patch:p-queue@npm%3A7.4.1#./.yarn/patches/p-queue-npm-7.4.1-e0cf0a6f17.patch", + "p-queue": "patch:p-queue@npm%3A8.0.1#~/.yarn/patches/p-queue-npm-8.0.1-fe1ddcd827.patch", "pre-commit": "patch:pre-commit@npm:1.2.2#.yarn/patches/pre-commit-npm-1.2.2-f30af83877.patch", "preact": "patch:preact@npm:10.10.0#.yarn/patches/preact-npm-10.10.0-dd04de05e8.patch", "start-server-and-test": "patch:start-server-and-test@npm:1.14.0#.yarn/patches/start-server-and-test-npm-1.14.0-841aa34fdf.patch", diff --git a/packages/@uppy/angular/projects/uppy/angular/README.md b/packages/@uppy/angular/projects/uppy/angular/README.md index 17fff277a5..24875eb67e 100644 --- a/packages/@uppy/angular/projects/uppy/angular/README.md +++ b/packages/@uppy/angular/projects/uppy/angular/README.md @@ -20,7 +20,7 @@ Uppy is being developed by the folks at [Transloadit](https://transloadit.com), $ npm install @uppy/angular --save ``` -Alternatively, you can also use this plugin in a pre-built bundle from Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. +Alternatively, you can also use this plugin in a pre-built bundle from Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/audio/README.md b/packages/@uppy/audio/README.md index 5a56280169..b5dec29459 100644 --- a/packages/@uppy/audio/README.md +++ b/packages/@uppy/audio/README.md @@ -30,8 +30,8 @@ $ npm install @uppy/audio ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/aws-s3/CHANGELOG.md b/packages/@uppy/aws-s3/CHANGELOG.md index 4f9e289f71..b4c9d3feb9 100644 --- a/packages/@uppy/aws-s3/CHANGELOG.md +++ b/packages/@uppy/aws-s3/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/aws-s3 +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 4.0.2 Released: 2024-07-30 diff --git a/packages/@uppy/aws-s3/README.md b/packages/@uppy/aws-s3/README.md index d3707973c4..9274a56519 100644 --- a/packages/@uppy/aws-s3/README.md +++ b/packages/@uppy/aws-s3/README.md @@ -34,8 +34,8 @@ $ npm install @uppy/aws-s3 ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/aws-s3/package.json b/packages/@uppy/aws-s3/package.json index ad224a2701..38efe2bdcb 100644 --- a/packages/@uppy/aws-s3/package.json +++ b/packages/@uppy/aws-s3/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/aws-s3", "description": "Upload to Amazon S3 with Uppy", - "version": "4.0.2", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/aws-s3/src/HTTPCommunicationQueue.ts b/packages/@uppy/aws-s3/src/HTTPCommunicationQueue.ts index 3347d47f52..58f7f6eee7 100644 --- a/packages/@uppy/aws-s3/src/HTTPCommunicationQueue.ts +++ b/packages/@uppy/aws-s3/src/HTTPCommunicationQueue.ts @@ -4,10 +4,10 @@ import type { WrapPromiseFunctionType, } from '@uppy/utils/lib/RateLimitedQueue' import { pausingUploadReason, type Chunk } from './MultipartUploader.ts' -import type AwsS3Multipart from './index.js' +import type AwsS3Multipart from './index.ts' import { throwIfAborted } from './utils.ts' -import type { UploadPartBytesResult, UploadResult } from './utils.js' -import type { AwsS3MultipartOptions, uploadPartBytes } from './index.js' +import type { UploadPartBytesResult, UploadResult } from './utils.ts' +import type { AwsS3MultipartOptions, uploadPartBytes } from './index.ts' function removeMetadataFromURL(urlString: string) { const urlObject = new URL(urlString) diff --git a/packages/@uppy/aws-s3/src/MultipartUploader.ts b/packages/@uppy/aws-s3/src/MultipartUploader.ts index 2ca8fdf5b4..6f5397a7fd 100644 --- a/packages/@uppy/aws-s3/src/MultipartUploader.ts +++ b/packages/@uppy/aws-s3/src/MultipartUploader.ts @@ -1,7 +1,7 @@ import type { Uppy } from '@uppy/core' import { AbortController } from '@uppy/utils/lib/AbortController' import type { Meta, Body, UppyFile } from '@uppy/utils/lib/UppyFile' -import type { HTTPCommunicationQueue } from './HTTPCommunicationQueue.js' +import type { HTTPCommunicationQueue } from './HTTPCommunicationQueue.ts' const MB = 1024 * 1024 diff --git a/packages/@uppy/aws-s3/src/index.ts b/packages/@uppy/aws-s3/src/index.ts index be08c9db7e..8f47632174 100644 --- a/packages/@uppy/aws-s3/src/index.ts +++ b/packages/@uppy/aws-s3/src/index.ts @@ -21,7 +21,7 @@ import type { UploadResultWithSignal, MultipartUploadResultWithSignal, UploadPartBytesResult, -} from './utils.js' +} from './utils.ts' import createSignedURL from './createSignedURL.ts' import { HTTPCommunicationQueue } from './HTTPCommunicationQueue.ts' // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -277,6 +277,8 @@ export type AwsS3MultipartOptions< | AWSS3MaybeMultipartWithoutCompanion ) +export type { AwsS3MultipartOptions as AwsS3Options } + const defaultOptions = { allowedMetaFields: true, limit: 6, diff --git a/packages/@uppy/aws-s3/src/utils.ts b/packages/@uppy/aws-s3/src/utils.ts index 835d457dcc..278ca6054f 100644 --- a/packages/@uppy/aws-s3/src/utils.ts +++ b/packages/@uppy/aws-s3/src/utils.ts @@ -1,7 +1,7 @@ import { createAbortError } from '@uppy/utils/lib/AbortController' import type { Body } from '@uppy/utils/lib/UppyFile' -import type { AwsS3Part } from './index.js' +import type { AwsS3Part } from './index.ts' export function throwIfAborted(signal?: AbortSignal | null): void { if (signal?.aborted) { diff --git a/packages/@uppy/box/CHANGELOG.md b/packages/@uppy/box/CHANGELOG.md index fc8d81937e..cfde0231a8 100644 --- a/packages/@uppy/box/CHANGELOG.md +++ b/packages/@uppy/box/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/box +## 3.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 3.0.0-beta.1 Released: 2024-03-28 diff --git a/packages/@uppy/box/README.md b/packages/@uppy/box/README.md index baefa9e003..0b8df87f97 100644 --- a/packages/@uppy/box/README.md +++ b/packages/@uppy/box/README.md @@ -36,8 +36,8 @@ $ npm install @uppy/box ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/box/package.json b/packages/@uppy/box/package.json index 2bca2412ba..adb2763029 100644 --- a/packages/@uppy/box/package.json +++ b/packages/@uppy/box/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/box", "description": "Import files from Box, into Uppy.", - "version": "3.0.0", + "version": "3.1.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/box/src/index.ts b/packages/@uppy/box/src/index.ts index 08b1d2fcf2..60192cdf13 100644 --- a/packages/@uppy/box/src/index.ts +++ b/packages/@uppy/box/src/index.ts @@ -1 +1,2 @@ export { default } from './Box.tsx' +export type { BoxOptions } from './Box.tsx' diff --git a/packages/@uppy/companion-client/package.json b/packages/@uppy/companion-client/package.json index 23161d2f63..6c168731a8 100644 --- a/packages/@uppy/companion-client/package.json +++ b/packages/@uppy/companion-client/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/companion-client", "description": "Client library for communication with Companion. Intended for use in Uppy plugins.", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/companion-client/src/CompanionPluginOptions.ts b/packages/@uppy/companion-client/src/CompanionPluginOptions.ts index e7630e1844..751357f7f4 100644 --- a/packages/@uppy/companion-client/src/CompanionPluginOptions.ts +++ b/packages/@uppy/companion-client/src/CompanionPluginOptions.ts @@ -1,11 +1,11 @@ import type { UIPluginOptions } from '@uppy/core' -import type { tokenStorage } from './index.js' +import type { tokenStorage } from './index.ts' export interface CompanionPluginOptions extends UIPluginOptions { storage?: typeof tokenStorage companionUrl: string companionHeaders?: Record - companionKeysParams?: Record + companionKeysParams?: { key: string; credentialsName: string } companionCookiesRule?: 'same-origin' | 'include' companionAllowedHosts?: string | RegExp | (string | RegExp)[] } diff --git a/packages/@uppy/companion-client/src/Provider.ts b/packages/@uppy/companion-client/src/Provider.ts index 2f76eae70e..bd0fb96214 100644 --- a/packages/@uppy/companion-client/src/Provider.ts +++ b/packages/@uppy/companion-client/src/Provider.ts @@ -7,7 +7,7 @@ import type { } from '@uppy/utils/lib/CompanionClientProvider' import type { UnknownProviderPlugin } from '@uppy/core/lib/Uppy.js' import RequestClient, { authErrorStatusCode } from './RequestClient.ts' -import type { CompanionPluginOptions } from './index.js' +import type { CompanionPluginOptions } from './index.ts' export interface Opts extends PluginOpts, CompanionPluginOptions { pluginId: string diff --git a/packages/@uppy/companion/CHANGELOG.md b/packages/@uppy/companion/CHANGELOG.md index 1de5a68b9f..24ce4f0268 100644 --- a/packages/@uppy/companion/CHANGELOG.md +++ b/packages/@uppy/companion/CHANGELOG.md @@ -1,5 +1,19 @@ # @uppy/companion +## 5.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/companion: do not use unsafe call to `JSON.stringify` (Antoine du Hamel / #5422) + +## 5.0.5 + +Released: 2024-08-15 +Included in: Uppy v4.1.1 + +- @uppy/companion: fix code for custom providers (Mikael Finstad / #5398) + ## 5.0.3 Released: 2024-07-15 diff --git a/packages/@uppy/companion/package.json b/packages/@uppy/companion/package.json index c4a718a059..8369c1affb 100644 --- a/packages/@uppy/companion/package.json +++ b/packages/@uppy/companion/package.json @@ -1,6 +1,6 @@ { "name": "@uppy/companion", - "version": "5.0.4", + "version": "5.1.1", "description": "OAuth helper and remote fetcher for Uppy's (https://uppy.io) extensible file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Dropbox and Google Drive, S3 and more :dog:", "main": "lib/companion.js", "types": "lib/companion.d.ts", @@ -33,7 +33,7 @@ "@aws-sdk/lib-storage": "^3.338.0", "@aws-sdk/s3-presigned-post": "^3.338.0", "@aws-sdk/s3-request-presigner": "^3.338.0", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "common-tags": "1.8.2", "connect-redis": "7.1.1", "content-disposition": "^0.5.4", @@ -45,6 +45,7 @@ "express-interceptor": "1.2.0", "express-prom-bundle": "7.0.0", "express-session": "1.18.0", + "fast-safe-stringify": "^2.1.1", "got": "^13.0.0", "grant": "5.4.22", "helmet": "^7.1.0", diff --git a/packages/@uppy/companion/src/companion.js b/packages/@uppy/companion/src/companion.js index b42c1e9a6c..01f55c2fa5 100644 --- a/packages/@uppy/companion/src/companion.js +++ b/packages/@uppy/companion/src/companion.js @@ -150,7 +150,7 @@ module.exports.app = (optionsArg = {}) => { logger.info(`Returning dynamic OAuth2 credentials for ${providerName}`) // for simplicity, we just return the normal credentials for the provider, but in a real-world scenario, // we would query based on parameters - const { key, secret } = options.providerOptions[providerName] + const { key, secret } = options.providerOptions[providerName] ?? { __proto__: null } function getRedirectUri() { const oauthProvider = getOauthProvider(providerName) diff --git a/packages/@uppy/companion/src/server/controllers/preauth.js b/packages/@uppy/companion/src/server/controllers/preauth.js index c1f2d267da..c8eddec7f7 100644 --- a/packages/@uppy/companion/src/server/controllers/preauth.js +++ b/packages/@uppy/companion/src/server/controllers/preauth.js @@ -8,7 +8,7 @@ function preauth (req, res) { } const providerConfig = req.companion.options.providerOptions[req.params.providerName] - if (!providerConfig.credentialsURL) { + if (!providerConfig?.credentialsURL) { return res.sendStatus(501) } diff --git a/packages/@uppy/companion/src/server/controllers/refresh-token.js b/packages/@uppy/companion/src/server/controllers/refresh-token.js index ed6d7a4748..868f6fd2db 100644 --- a/packages/@uppy/companion/src/server/controllers/refresh-token.js +++ b/packages/@uppy/companion/src/server/controllers/refresh-token.js @@ -8,7 +8,7 @@ const logger = require('../logger') async function refreshToken (req, res, next) { const { providerName } = req.params - const { key: clientId, secret: clientSecret } = req.companion.options.providerOptions[providerName] + const { key: clientId, secret: clientSecret } = req.companion.options.providerOptions[providerName] ?? { __proto__: null } const { redirect_uri: redirectUri } = req.companion.providerGrantConfig const { providerUserSession } = req.companion diff --git a/packages/@uppy/companion/src/server/emitter/redis-emitter.js b/packages/@uppy/companion/src/server/emitter/redis-emitter.js index ca2bce68ab..0aa145432b 100644 --- a/packages/@uppy/companion/src/server/emitter/redis-emitter.js +++ b/packages/@uppy/companion/src/server/emitter/redis-emitter.js @@ -1,7 +1,13 @@ const { EventEmitter } = require('node:events') +const { default: safeStringify } = require('fast-safe-stringify') const logger = require('../logger') +function replacer(key, value) { + // Remove the circular structure and internal ones + return key[0] === '_' || value === '[Circular]' ? undefined : value +} + /** * This module simulates the builtin events.EventEmitter but with the use of redis. * This is useful for when companion is running on multiple instances and events need @@ -14,54 +20,69 @@ const logger = require('../logger') module.exports = (redisClient, redisPubSubScope) => { const prefix = redisPubSubScope ? `${redisPubSubScope}:` : '' const getPrefixedEventName = (eventName) => `${prefix}${eventName}` - const publisher = redisClient.duplicate({ lazyConnect: true }) - publisher.on('error', err => logger.error('publisher redis error', err.toString())) - /** @type {import('ioredis').Redis} */ - let subscriber - - const connectedPromise = publisher.connect().then(() => { - subscriber = publisher.duplicate() - subscriber.on('error', err => logger.error('subscriber redis error', err.toString())) - return subscriber.connect() - }) - - const handlersByEvent = new Map() const errorEmitter = new EventEmitter() const handleError = (err) => errorEmitter.emit('error', err) - connectedPromise.catch((err) => handleError(err)) + async function makeRedis() { + const publisher = redisClient.duplicate({ lazyConnect: true }) + publisher.on('error', err => logger.error('publisher redis error', err.toString())) + const subscriber = publisher.duplicate() + subscriber.on('error', err => logger.error('subscriber redis error', err.toString())) + await publisher.connect() + await subscriber.connect() + return { subscriber, publisher } + } + const redisPromise = makeRedis() + redisPromise.catch((err) => handleError(err)) + + /** + * + * @param {(a: Awaited) => void} fn + */ async function runWhenConnected (fn) { try { - await connectedPromise - await fn() + await fn(await redisPromise) } catch (err) { handleError(err) } } + // because each event can have multiple listeners, we need to keep track of them + /** @type {Map unknown, () => unknown>>} */ + const handlersByEventName = new Map() + /** * Remove an event listener * * @param {string} eventName name of the event * @param {any} handler the handler of the event to remove */ - function removeListener (eventName, handler) { - if (eventName === 'error') return errorEmitter.removeListener('error', handler) + async function removeListener (eventName, handler) { + if (eventName === 'error') { + errorEmitter.removeListener('error', handler) + return + } - return runWhenConnected(() => { - const handlersByThisEventName = handlersByEvent.get(eventName) - if (handlersByThisEventName == null) return undefined + const actualHandlerByHandler = handlersByEventName.get(eventName) + if (actualHandlerByHandler == null) return - const actualHandler = handlersByThisEventName.get(handler) - if (actualHandler == null) return undefined + const actualHandler = actualHandlerByHandler.get(handler) + if (actualHandler == null) return - handlersByThisEventName.delete(handler) - if (handlersByThisEventName.size === 0) handlersByEvent.delete(eventName) + actualHandlerByHandler.delete(handler) + const didRemoveLastListener = actualHandlerByHandler.size === 0 + if (didRemoveLastListener) { + handlersByEventName.delete(eventName) + } + + await runWhenConnected(async ({ subscriber }) => { subscriber.off('pmessage', actualHandler) - return subscriber.punsubscribe(getPrefixedEventName(eventName)) + if (didRemoveLastListener) { + await subscriber.punsubscribe(getPrefixedEventName(eventName)) + } }) } @@ -71,7 +92,13 @@ module.exports = (redisClient, redisPubSubScope) => { * @param {*} handler * @param {*} _once */ - function addListener (eventName, handler, _once = false) { + async function addListener (eventName, handler, _once = false) { + if (eventName === 'error') { + if (_once) errorEmitter.once('error', handler) + else errorEmitter.addListener('error', handler) + return + } + function actualHandler (pattern, channel, message) { if (pattern !== getPrefixedEventName(eventName)) { return @@ -85,19 +112,20 @@ module.exports = (redisClient, redisPubSubScope) => { handleError(new Error(`Invalid JSON received! Channel: ${eventName} Message: ${message}`)) return } + handler(...args) } - let handlersByThisEventName = handlersByEvent.get(eventName) - if (handlersByThisEventName == null) { - handlersByThisEventName = new WeakMap() - handlersByEvent.set(eventName, handlersByThisEventName) + let actualHandlerByHandler = handlersByEventName.get(eventName) + if (actualHandlerByHandler == null) { + actualHandlerByHandler = new Map() + handlersByEventName.set(eventName, actualHandlerByHandler) } - handlersByThisEventName.set(handler, actualHandler) + actualHandlerByHandler.set(handler, actualHandler) - runWhenConnected(() => { + await runWhenConnected(async ({ subscriber }) => { subscriber.on('pmessage', actualHandler) - return subscriber.psubscribe(getPrefixedEventName(eventName)) + await subscriber.psubscribe(getPrefixedEventName(eventName)) }) } @@ -107,10 +135,8 @@ module.exports = (redisClient, redisPubSubScope) => { * @param {string} eventName name of the event * @param {any} handler the handler of the event */ - function on (eventName, handler) { - if (eventName === 'error') return errorEmitter.on('error', handler) - - return addListener(eventName, handler) + async function on (eventName, handler) { + await addListener(eventName, handler) } /** @@ -119,8 +145,8 @@ module.exports = (redisClient, redisPubSubScope) => { * @param {string} eventName name of the event * @param {any} handler the handler of the event */ - function off (eventName, handler) { - return removeListener(eventName, handler) + async function off (eventName, handler) { + await removeListener(eventName, handler) } /** @@ -129,10 +155,8 @@ module.exports = (redisClient, redisPubSubScope) => { * @param {string} eventName name of the event * @param {any} handler the handler of the event */ - function once (eventName, handler) { - if (eventName === 'error') return errorEmitter.once('error', handler) - - return addListener(eventName, handler, true) + async function once (eventName, handler) { + await addListener(eventName, handler, true) } /** @@ -140,8 +164,10 @@ module.exports = (redisClient, redisPubSubScope) => { * * @param {string} eventName name of the event */ - function emit (eventName, ...args) { - runWhenConnected(() => publisher.publish(getPrefixedEventName(eventName), JSON.stringify(args))) + async function emit (eventName, ...args) { + await runWhenConnected(async ({ publisher }) => ( + publisher.publish(getPrefixedEventName(eventName), safeStringify(args, replacer)) + )) } /** @@ -149,13 +175,18 @@ module.exports = (redisClient, redisPubSubScope) => { * * @param {string} eventName name of the event */ - function removeAllListeners (eventName) { - if (eventName === 'error') return errorEmitter.removeAllListeners(eventName) + async function removeAllListeners (eventName) { + if (eventName === 'error') { + errorEmitter.removeAllListeners(eventName) + return + } - return runWhenConnected(() => { - handlersByEvent.delete(eventName) - return subscriber.punsubscribe(getPrefixedEventName(eventName)) - }) + const actualHandlerByHandler = handlersByEventName.get(eventName) + if (actualHandlerByHandler != null) { + for (const handler of actualHandlerByHandler.keys()) { + await removeListener(eventName, handler) + } + } } return { diff --git a/packages/@uppy/companion/src/server/middlewares.js b/packages/@uppy/companion/src/server/middlewares.js index 2ecb4620a9..9388204d2f 100644 --- a/packages/@uppy/companion/src/server/middlewares.js +++ b/packages/@uppy/companion/src/server/middlewares.js @@ -92,14 +92,15 @@ exports.verifyToken = (req, res, next) => { if (!isOAuthProviderReq(req)) { const { providerOptions } = req.companion.options const { providerName } = req.params - if (!providerOptions[providerName] || !providerOptions[providerName].key) { + const key = providerOptions[providerName]?.key; + if (!key) { logger.info(`unconfigured credentials for ${providerName}`, 'non.oauth.token.load.unset', req.id) res.sendStatus(501) return } req.companion.providerUserSession = { - accessToken: providerOptions[providerName].key, + accessToken: key, } next() } diff --git a/packages/@uppy/companion/src/server/provider/index.js b/packages/@uppy/companion/src/server/provider/index.js index 9c72eaf061..52c707dac0 100644 --- a/packages/@uppy/companion/src/server/provider/index.js +++ b/packages/@uppy/companion/src/server/provider/index.js @@ -52,7 +52,7 @@ module.exports.getProviderMiddleware = (providers, grantConfig) => { req.companion.providerGrantConfig = providerGrantConfig } - const { secret } = providerOptions[providerName] + const secret = providerOptions[providerName]?.secret req.companion.provider = new ProviderClass({ secret, providerName, providerGrantConfig, allowLocalUrls }) req.companion.providerClass = ProviderClass } else { diff --git a/packages/@uppy/compressor/CHANGELOG.md b/packages/@uppy/compressor/CHANGELOG.md index 7eac00762e..3622b53801 100644 --- a/packages/@uppy/compressor/CHANGELOG.md +++ b/packages/@uppy/compressor/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/compressor +## 2.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 2.0.1 Released: 2024-07-30 diff --git a/packages/@uppy/compressor/README.md b/packages/@uppy/compressor/README.md index aecb028f9e..e0993002ca 100644 --- a/packages/@uppy/compressor/README.md +++ b/packages/@uppy/compressor/README.md @@ -35,8 +35,8 @@ as [Parcel](https://parceljs.org/), [Vite](https://vitejs.dev/) or [Webpack](https://webpack.js.org/). Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/compressor/package.json b/packages/@uppy/compressor/package.json index 4b626f088c..5b94176b9f 100644 --- a/packages/@uppy/compressor/package.json +++ b/packages/@uppy/compressor/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/compressor", "description": "Uppy plugin that compresses images before upload, saving up to 60% in size", - "version": "2.0.1", + "version": "2.1.0", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/compressor/src/index.ts b/packages/@uppy/compressor/src/index.ts index 7b714e7c45..c57fea1664 100644 --- a/packages/@uppy/compressor/src/index.ts +++ b/packages/@uppy/compressor/src/index.ts @@ -21,6 +21,8 @@ export interface CompressorOpts extends PluginOpts, CompressorJS.Options { limit?: number } +export type { CompressorOpts as CompressorOptions } + const defaultOptions = { quality: 0.6, limit: 10, diff --git a/packages/@uppy/core/CHANGELOG.md b/packages/@uppy/core/CHANGELOG.md index 830e09bacb..2266fca048 100644 --- a/packages/@uppy/core/CHANGELOG.md +++ b/packages/@uppy/core/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/core +## 4.2.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/core,@uppy/dashboard: Pass container to `UIPlugin.render` for non-Preact integration (Merlijn Vos / #5437) + ## 4.1.0 Released: 2024-07-30 diff --git a/packages/@uppy/core/README.md b/packages/@uppy/core/README.md index 1e9be10554..580110f347 100644 --- a/packages/@uppy/core/README.md +++ b/packages/@uppy/core/README.md @@ -38,8 +38,8 @@ $ npm install @uppy/core ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/core/package.json b/packages/@uppy/core/package.json index 9337a036bd..ac38e1bc84 100644 --- a/packages/@uppy/core/package.json +++ b/packages/@uppy/core/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/core", "description": "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:", - "version": "4.1.0", + "version": "4.2.1", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/core/src/BasePlugin.ts b/packages/@uppy/core/src/BasePlugin.ts index 708865be80..8713e6ee49 100644 --- a/packages/@uppy/core/src/BasePlugin.ts +++ b/packages/@uppy/core/src/BasePlugin.ts @@ -16,7 +16,7 @@ import type { OptionalPluralizeLocale, } from '@uppy/utils/lib/Translator' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' -import type { State, UnknownPlugin, Uppy } from './Uppy.js' +import type { State, UnknownPlugin, Uppy } from './Uppy.ts' export type PluginOpts = { locale?: Locale diff --git a/packages/@uppy/core/src/EventManager.ts b/packages/@uppy/core/src/EventManager.ts index bb556a9cfe..529c38fe62 100644 --- a/packages/@uppy/core/src/EventManager.ts +++ b/packages/@uppy/core/src/EventManager.ts @@ -1,5 +1,5 @@ import type { Meta, Body, UppyFile } from '@uppy/utils/lib/UppyFile' -import type { Uppy, UppyEventMap, _UppyEventMap } from './Uppy.js' +import type { Uppy, UppyEventMap, _UppyEventMap } from './Uppy.ts' /** * Create a wrapper around an event emitter with a `remove` method to remove diff --git a/packages/@uppy/core/src/Restricter.ts b/packages/@uppy/core/src/Restricter.ts index a0a490890a..09c8622a20 100644 --- a/packages/@uppy/core/src/Restricter.ts +++ b/packages/@uppy/core/src/Restricter.ts @@ -5,7 +5,7 @@ import prettierBytes from '@transloadit/prettier-bytes' import match from 'mime-match' import type { Body, Meta, UppyFile } from '@uppy/utils/lib/UppyFile' import type { I18n } from '@uppy/utils/lib/Translator' -import type { State, NonNullableUppyOptions } from './Uppy.js' +import type { State, NonNullableUppyOptions } from './Uppy.ts' export type Restrictions = { maxFileSize: number | null diff --git a/packages/@uppy/core/src/UIPlugin.ts b/packages/@uppy/core/src/UIPlugin.ts index 74a68fccba..7aa3614e0f 100644 --- a/packages/@uppy/core/src/UIPlugin.ts +++ b/packages/@uppy/core/src/UIPlugin.ts @@ -1,12 +1,12 @@ /* eslint-disable class-methods-use-this */ -import { render, type ComponentChild } from 'preact' +import { render } from 'preact' import findDOMElement from '@uppy/utils/lib/findDOMElement' import getTextDirection from '@uppy/utils/lib/getTextDirection' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' import BasePlugin from './BasePlugin.ts' -import type { PluginOpts } from './BasePlugin.js' -import type { State } from './Uppy.js' +import type { PluginOpts } from './BasePlugin.ts' +import type { State } from './Uppy.ts' /** * Defer a frequent call to the microtask queue. @@ -112,7 +112,7 @@ class UIPlugin< // so it could still be called even after uppy.removePlugin or uppy.destroy // hence the check if (!this.uppy.getPlugin(this.id)) return - render(this.render(state), uppyRootElement) + render(this.render(state, uppyRootElement), uppyRootElement) this.afterUpdate() }) @@ -127,7 +127,10 @@ class UIPlugin< targetElement.innerHTML = '' } - render(this.render(this.uppy.getState()), uppyRootElement) + render( + this.render(this.uppy.getState(), uppyRootElement), + uppyRootElement, + ) this.el = uppyRootElement targetElement.appendChild(uppyRootElement) @@ -176,8 +179,12 @@ class UIPlugin< * so this.el and this.parent might not be available in `install`. * This is the case with @uppy/react plugins, for example. */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - render(state: Record): ComponentChild { + render( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + state: Record, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + container?: HTMLElement, + ): any { throw new Error( 'Extend the render method to add your plugin to a DOM element', ) diff --git a/packages/@uppy/core/src/Uppy.ts b/packages/@uppy/core/src/Uppy.ts index f41356f3de..f8e25e538e 100644 --- a/packages/@uppy/core/src/Uppy.ts +++ b/packages/@uppy/core/src/Uppy.ts @@ -45,8 +45,8 @@ import { import packageJson from '../package.json' import locale from './locale.ts' -import type BasePlugin from './BasePlugin.js' -import type { Restrictions, ValidateableFile } from './Restricter.js' +import type BasePlugin from './BasePlugin.ts' +import type { Restrictions, ValidateableFile } from './Restricter.ts' type Processor = ( fileIDs: string[], @@ -639,6 +639,11 @@ export class Uppy< ...files[fileID].progress, ...defaultProgress, }, + // @ts-expect-error these typed are inserted + // into the namespace in their respective packages + // but core isn't ware of those + tus: undefined, + transloadit: undefined, } }) @@ -1799,7 +1804,7 @@ export class Uppy< const msg = `Already found a plugin named '${existsPluginAlready.id}'. ` + `Tried to use: '${pluginId}'.\n` + - 'Uppy plugins must have unique `id` options. See https://uppy.io/docs/plugins/#id.' + 'Uppy plugins must have unique `id` options.' throw new Error(msg) } diff --git a/packages/@uppy/core/src/__snapshots__/Uppy.test.ts.snap b/packages/@uppy/core/src/__snapshots__/Uppy.test.ts.snap index c9094b96c7..04fa170a76 100644 --- a/packages/@uppy/core/src/__snapshots__/Uppy.test.ts.snap +++ b/packages/@uppy/core/src/__snapshots__/Uppy.test.ts.snap @@ -8,7 +8,7 @@ exports[`src/Core > plugins > should not be able to add an invalid plugin 1`] = exports[`src/Core > plugins > should prevent the same plugin from being added more than once 1`] = ` [Error: Already found a plugin named 'TestSelector1'. Tried to use: 'TestSelector1'. -Uppy plugins must have unique \`id\` options. See https://uppy.io/docs/plugins/#id.] +Uppy plugins must have unique \`id\` options.] `; exports[`src/Core > uploading a file > should only upload files that are not already assigned to another upload id 1`] = ` diff --git a/packages/@uppy/core/src/mocks/acquirerPlugin1.ts b/packages/@uppy/core/src/mocks/acquirerPlugin1.ts index 6d0b967240..0f3516690d 100644 --- a/packages/@uppy/core/src/mocks/acquirerPlugin1.ts +++ b/packages/@uppy/core/src/mocks/acquirerPlugin1.ts @@ -1,6 +1,6 @@ import { vi } from 'vitest' // eslint-disable-line import/no-extraneous-dependencies import UIPlugin from '../UIPlugin.ts' -import type Uppy from '../Uppy.js' +import type Uppy from '../Uppy.ts' type mock = ReturnType diff --git a/packages/@uppy/core/src/mocks/acquirerPlugin2.ts b/packages/@uppy/core/src/mocks/acquirerPlugin2.ts index d841bdeb72..9d2290b69d 100644 --- a/packages/@uppy/core/src/mocks/acquirerPlugin2.ts +++ b/packages/@uppy/core/src/mocks/acquirerPlugin2.ts @@ -1,6 +1,6 @@ import { vi } from 'vitest' // eslint-disable-line import/no-extraneous-dependencies import UIPlugin from '../UIPlugin.ts' -import type Uppy from '../Uppy.js' +import type Uppy from '../Uppy.ts' type mock = ReturnType diff --git a/packages/@uppy/core/src/mocks/invalidPluginWithoutId.ts b/packages/@uppy/core/src/mocks/invalidPluginWithoutId.ts index 8d6789eff0..d2c02e30dc 100644 --- a/packages/@uppy/core/src/mocks/invalidPluginWithoutId.ts +++ b/packages/@uppy/core/src/mocks/invalidPluginWithoutId.ts @@ -1,5 +1,5 @@ import UIPlugin from '../UIPlugin.ts' -import type Uppy from '../Uppy.js' +import type Uppy from '../Uppy.ts' export default class InvalidPluginWithoutName extends UIPlugin { public type: string diff --git a/packages/@uppy/core/src/mocks/invalidPluginWithoutType.ts b/packages/@uppy/core/src/mocks/invalidPluginWithoutType.ts index 8485f491ed..4baeb573c9 100644 --- a/packages/@uppy/core/src/mocks/invalidPluginWithoutType.ts +++ b/packages/@uppy/core/src/mocks/invalidPluginWithoutType.ts @@ -1,5 +1,5 @@ import UIPlugin from '../UIPlugin.ts' -import type Uppy from '../Uppy.js' +import type Uppy from '../Uppy.ts' export default class InvalidPluginWithoutType extends UIPlugin { public id: string diff --git a/packages/@uppy/dashboard/CHANGELOG.md b/packages/@uppy/dashboard/CHANGELOG.md index aaa7e9fdec..10b47425e5 100644 --- a/packages/@uppy/dashboard/CHANGELOG.md +++ b/packages/@uppy/dashboard/CHANGELOG.md @@ -1,5 +1,19 @@ # @uppy/dashboard +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/core,@uppy/dashboard: Pass container to `UIPlugin.render` for non-Preact integration (Merlijn Vos / #5437) + +## 4.0.3 + +Released: 2024-08-15 +Included in: Uppy v4.1.1 + +- @uppy/dashboard,@uppy/drag-drop,@uppy/file-input: Transform the `accept` prop into a string everywhere (Evgenia Karunus / #5380) + ## 4.0.2 Released: 2024-07-30 diff --git a/packages/@uppy/dashboard/README.md b/packages/@uppy/dashboard/README.md index b879713137..9eb66b92da 100644 --- a/packages/@uppy/dashboard/README.md +++ b/packages/@uppy/dashboard/README.md @@ -44,8 +44,8 @@ $ npm install @uppy/dashboard ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/dashboard/package.json b/packages/@uppy/dashboard/package.json index db1cf62185..2516e6358e 100644 --- a/packages/@uppy/dashboard/package.json +++ b/packages/@uppy/dashboard/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/dashboard", "description": "Universal UI plugin for Uppy.", - "version": "4.0.2", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/dashboard/src/Dashboard.tsx b/packages/@uppy/dashboard/src/Dashboard.tsx index 4b731173ea..dc9a7f5768 100644 --- a/packages/@uppy/dashboard/src/Dashboard.tsx +++ b/packages/@uppy/dashboard/src/Dashboard.tsx @@ -17,6 +17,7 @@ import toArray from '@uppy/utils/lib/toArray' import getDroppedFiles from '@uppy/utils/lib/getDroppedFiles' import { defaultPickerIcon } from '@uppy/provider-views' +import type { TargetedEvent } from 'preact/compat' import { nanoid } from 'nanoid/non-secure' import memoizeOne from 'memoize-one' import * as trapFocus from './utils/trapFocus.ts' @@ -782,9 +783,11 @@ export default class Dashboard extends UIPlugin< } } - private handleInputChange = (event: Event) => { + private handleInputChange = ( + event: TargetedEvent, + ) => { event.preventDefault() - const files = toArray((event.target as HTMLInputElement).files!) + const files = toArray(event.currentTarget.files || []) if (files.length > 0) { this.uppy.log('[Dashboard] Files selected through input') this.addFiles(files) diff --git a/packages/@uppy/dashboard/src/components/AddFiles.tsx b/packages/@uppy/dashboard/src/components/AddFiles.tsx index 13e57e582c..68bd75ca4d 100644 --- a/packages/@uppy/dashboard/src/components/AddFiles.tsx +++ b/packages/@uppy/dashboard/src/components/AddFiles.tsx @@ -2,13 +2,14 @@ import { h, Component, Fragment, type ComponentChild } from 'preact' import type { I18n } from '@uppy/utils/lib/Translator' import type Translator from '@uppy/utils/lib/Translator' -import type { DashboardState, TargetWithRender } from '../Dashboard.js' +import type { TargetedEvent } from 'preact/compat' +import type { DashboardState, TargetWithRender } from '../Dashboard' interface AddFilesProps { i18n: I18n i18nArray: Translator['translateArray'] acquirers: TargetWithRender[] - handleInputChange: (event: Event) => void + handleInputChange: (event: TargetedEvent) => void maxNumberOfFiles: number | null allowedFileTypes: string[] | null showNativePhotoCameraButton: boolean @@ -47,16 +48,15 @@ class AddFiles extends Component { this.mobilePhotoFileInput?.click() } - private onFileInputChange = (event: Event) => { + private onFileInputChange = ( + event: TargetedEvent, + ) => { this.props.handleInputChange(event) - // We clear the input after a file is selected, because otherwise - // change event is not fired in Chrome and Safari when a file - // with the same name is selected. - // ___Why not use value="" on instead? - // Because if we use that method of clearing the input, - // Chrome will not trigger change if we drop the same file twice (Issue #768). - ;(event.target as HTMLInputElement).value = '' // eslint-disable-line no-param-reassign + // Clear the input so that Chrome/Safari/etc. can detect file section when the same file is repeatedly selected + // (see https://github.com/transloadit/uppy/issues/768#issuecomment-2264902758) + // eslint-disable-next-line no-param-reassign + event.currentTarget.value = '' } private renderHiddenInput = ( diff --git a/packages/@uppy/dashboard/src/components/Dashboard.tsx b/packages/@uppy/dashboard/src/components/Dashboard.tsx index 18ca201e5c..36d185e3f9 100644 --- a/packages/@uppy/dashboard/src/components/Dashboard.tsx +++ b/packages/@uppy/dashboard/src/components/Dashboard.tsx @@ -6,6 +6,7 @@ import type { Body, Meta, UppyFile } from '@uppy/utils/lib/UppyFile' import type { State, UIPlugin, UIPluginOptions, Uppy } from '@uppy/core' import type { I18n } from '@uppy/utils/lib/Translator' import type Translator from '@uppy/utils/lib/Translator' +import type { TargetedEvent } from 'preact/compat' import FileList from './FileList.tsx' import AddFiles from './AddFiles.tsx' import AddFilesPanel from './AddFilesPanel.tsx' @@ -14,7 +15,7 @@ import EditorPanel from './EditorPanel.tsx' import PanelTopBar from './PickerPanelTopBar.tsx' import FileCard from './FileCard/index.tsx' import Slide from './Slide.tsx' -import type { DashboardState, TargetWithRender } from '../Dashboard.js' +import type { DashboardState, TargetWithRender } from '../Dashboard' // http://dev.edenspiekermann.com/2016/02/11/introducing-accessible-modal-dialog // https://github.com/ghosh/micromodal @@ -63,7 +64,7 @@ type DashboardUIProps = { id: string closeModal: () => void handleClickOutside: () => void - handleInputChange: (event: Event) => void + handleInputChange: (event: TargetedEvent) => void handlePaste: (event: ClipboardEvent) => void inline: boolean showPanel: (id: string) => void diff --git a/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.tsx b/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.tsx index e39ee3831d..53b0d32b56 100644 --- a/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.tsx +++ b/packages/@uppy/dashboard/src/components/FileItem/Buttons/index.tsx @@ -3,7 +3,7 @@ import type { Body, Meta, UppyFile } from '@uppy/utils/lib/UppyFile' import type Uppy from '@uppy/core' import type { I18n } from '@uppy/utils/lib/Translator' import copyToClipboard from '../../../utils/copyToClipboard.ts' -import type { DashboardState } from '../../../Dashboard.js' +import type { DashboardState } from '../../../Dashboard.ts' type $TSFixMe = any diff --git a/packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.tsx b/packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.tsx index d1fd1930f3..555f2364c0 100644 --- a/packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.tsx +++ b/packages/@uppy/dashboard/src/components/FileItem/FileInfo/index.tsx @@ -5,7 +5,7 @@ import truncateString from '@uppy/utils/lib/truncateString' import type { I18n } from '@uppy/utils/lib/Translator' import type { UppyFile } from '@uppy/core' import MetaErrorMessage from '../MetaErrorMessage.tsx' -import type { DashboardState } from '../../../Dashboard.js' +import type { DashboardState } from '../../../Dashboard.ts' const renderFileName = (props: { file: UppyFile diff --git a/packages/@uppy/dashboard/src/components/FileItem/index.tsx b/packages/@uppy/dashboard/src/components/FileItem/index.tsx index 9065f0fce8..ab284fd19b 100644 --- a/packages/@uppy/dashboard/src/components/FileItem/index.tsx +++ b/packages/@uppy/dashboard/src/components/FileItem/index.tsx @@ -10,7 +10,7 @@ import FilePreviewAndLink from './FilePreviewAndLink/index.tsx' import FileProgress from './FileProgress/index.tsx' import FileInfo from './FileInfo/index.tsx' import Buttons from './Buttons/index.tsx' -import type { DashboardState } from '../../Dashboard.js' +import type { DashboardState } from '../../Dashboard.ts' type Props = { file: UppyFile diff --git a/packages/@uppy/dashboard/src/components/FileList.tsx b/packages/@uppy/dashboard/src/components/FileList.tsx index d848e6378e..2f6c34bd49 100644 --- a/packages/@uppy/dashboard/src/components/FileList.tsx +++ b/packages/@uppy/dashboard/src/components/FileList.tsx @@ -7,7 +7,7 @@ import type { UppyFile, Uppy, State } from '@uppy/core' import type { I18n } from '@uppy/utils/lib/Translator' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' import FileItem from './FileItem/index.tsx' -import type { DashboardState } from '../Dashboard.js' +import type { DashboardState } from '../Dashboard.ts' type FileListProps = { id: string diff --git a/packages/@uppy/dashboard/src/components/PickerPanelContent.tsx b/packages/@uppy/dashboard/src/components/PickerPanelContent.tsx index ad3677f815..7a795ec9f1 100644 --- a/packages/@uppy/dashboard/src/components/PickerPanelContent.tsx +++ b/packages/@uppy/dashboard/src/components/PickerPanelContent.tsx @@ -1,5 +1,6 @@ import { h } from 'preact' import classNames from 'classnames' +import { useRef } from 'preact/hooks' import ignoreEvent from '../utils/ignoreEvent.ts' type $TSFixMe = any @@ -12,6 +13,7 @@ function PickerPanelContent({ state, uppy, }: $TSFixMe) { + const ref = useRef(null) return (
-
- {uppy.getPlugin(activePickerPanel.id).render(state)} + +
+ {uppy.getPlugin(activePickerPanel.id).render(state, ref.current)}
) diff --git a/packages/@uppy/drag-drop/CHANGELOG.md b/packages/@uppy/drag-drop/CHANGELOG.md index 2d48c87e79..a8ef5f7916 100644 --- a/packages/@uppy/drag-drop/CHANGELOG.md +++ b/packages/@uppy/drag-drop/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/drag-drop +## 4.0.2 + +Released: 2024-08-15 +Included in: Uppy v4.1.1 + +- @uppy/dashboard,@uppy/drag-drop,@uppy/file-input: Transform the `accept` prop into a string everywhere (Evgenia Karunus / #5380) + ## 4.0.1 Released: 2024-07-15 diff --git a/packages/@uppy/drag-drop/README.md b/packages/@uppy/drag-drop/README.md index 7566041fcd..c1abf835d1 100644 --- a/packages/@uppy/drag-drop/README.md +++ b/packages/@uppy/drag-drop/README.md @@ -33,8 +33,8 @@ $ npm install @uppy/drag-drop ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/drag-drop/package.json b/packages/@uppy/drag-drop/package.json index 33653cf720..1d7f151493 100644 --- a/packages/@uppy/drag-drop/package.json +++ b/packages/@uppy/drag-drop/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/drag-drop", "description": "Droppable zone UI for Uppy. Drag and drop files into it to upload.", - "version": "4.0.1", + "version": "4.0.2", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/drag-drop/src/DragDrop.tsx b/packages/@uppy/drag-drop/src/DragDrop.tsx index 1bc94200cc..cfdc95b7ae 100644 --- a/packages/@uppy/drag-drop/src/DragDrop.tsx +++ b/packages/@uppy/drag-drop/src/DragDrop.tsx @@ -2,7 +2,7 @@ import { UIPlugin, type Uppy } from '@uppy/core' import type { DefinePluginOpts } from '@uppy/core/lib/BasePlugin.js' import type { UIPluginOptions } from '@uppy/core/lib/UIPlugin.js' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' -import type { ChangeEvent } from 'preact/compat' +import type { TargetedEvent } from 'preact/compat' import toArray from '@uppy/utils/lib/toArray' import isDragDropSupported from '@uppy/utils/lib/isDragDropSupported' import getDroppedFiles from '@uppy/utils/lib/getDroppedFiles' @@ -80,22 +80,17 @@ export default class DragDrop extends UIPlugin< } } - private onInputChange = (event: ChangeEvent) => { - const files = toArray((event.target as HTMLInputElement).files!) + private onInputChange = (event: TargetedEvent) => { + const files = toArray(event.currentTarget.files || []) if (files.length > 0) { this.uppy.log('[DragDrop] Files selected through input') this.addFiles(files) } - // We clear the input after a file is selected, because otherwise - // change event is not fired in Chrome and Safari when a file - // with the same name is selected. - // ___Why not use value="" on instead? - // Because if we use that method of clearing the input, - // Chrome will not trigger change if we drop the same file twice (Issue #768). - // @ts-expect-error TS freaks out, but this is fine + // Clear the input so that Chrome can detect file section when the same file is repeatedly selected + // (see https://github.com/transloadit/uppy/issues/768#issuecomment-2264902758) // eslint-disable-next-line no-param-reassign - event.target.value = null + event.currentTarget.value = '' } private handleDragOver = (event: DragEvent) => { diff --git a/packages/@uppy/dropbox/CHANGELOG.md b/packages/@uppy/dropbox/CHANGELOG.md index 768ea4a0ae..d9d0d83314 100644 --- a/packages/@uppy/dropbox/CHANGELOG.md +++ b/packages/@uppy/dropbox/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/dropbox +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 4.0.0-beta.6 Released: 2024-05-14 diff --git a/packages/@uppy/dropbox/README.md b/packages/@uppy/dropbox/README.md index fa47f5039f..022a3f69cd 100644 --- a/packages/@uppy/dropbox/README.md +++ b/packages/@uppy/dropbox/README.md @@ -36,8 +36,8 @@ $ npm install @uppy/dropbox ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/dropbox/package.json b/packages/@uppy/dropbox/package.json index 0f64815fd7..379fdf1e06 100644 --- a/packages/@uppy/dropbox/package.json +++ b/packages/@uppy/dropbox/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/dropbox", "description": "Import files from Dropbox, into Uppy.", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/dropbox/src/index.ts b/packages/@uppy/dropbox/src/index.ts index d896f6e294..cabbf5f31f 100644 --- a/packages/@uppy/dropbox/src/index.ts +++ b/packages/@uppy/dropbox/src/index.ts @@ -1 +1,2 @@ export { default } from './Dropbox.tsx' +export type { DropboxOptions } from './Dropbox.tsx' diff --git a/packages/@uppy/facebook/CHANGELOG.md b/packages/@uppy/facebook/CHANGELOG.md index 83f0b04325..0c854d28b7 100644 --- a/packages/@uppy/facebook/CHANGELOG.md +++ b/packages/@uppy/facebook/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/facebook +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 4.0.0-beta.1 Released: 2024-03-28 diff --git a/packages/@uppy/facebook/README.md b/packages/@uppy/facebook/README.md index e2a2edd7e9..b031bfa2a5 100644 --- a/packages/@uppy/facebook/README.md +++ b/packages/@uppy/facebook/README.md @@ -37,8 +37,8 @@ $ npm install @uppy/facebook ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/facebook/package.json b/packages/@uppy/facebook/package.json index 117f79b9a9..3c6c2ded2b 100644 --- a/packages/@uppy/facebook/package.json +++ b/packages/@uppy/facebook/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/facebook", "description": "Import files from Facebook, into Uppy.", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/facebook/src/index.ts b/packages/@uppy/facebook/src/index.ts index 03f7627249..0d5614e9ab 100644 --- a/packages/@uppy/facebook/src/index.ts +++ b/packages/@uppy/facebook/src/index.ts @@ -1 +1,2 @@ export { default } from './Facebook.tsx' +export type { FacebookOptions } from './Facebook.tsx' diff --git a/packages/@uppy/file-input/CHANGELOG.md b/packages/@uppy/file-input/CHANGELOG.md index 95839c22c5..c7aefce91c 100644 --- a/packages/@uppy/file-input/CHANGELOG.md +++ b/packages/@uppy/file-input/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/file-input +## 4.0.1 + +Released: 2024-08-15 +Included in: Uppy v4.1.1 + +- @uppy/dashboard,@uppy/drag-drop,@uppy/file-input: Transform the `accept` prop into a string everywhere (Evgenia Karunus / #5380) + ## 4.0.0-beta.4 Released: 2024-04-29 diff --git a/packages/@uppy/file-input/README.md b/packages/@uppy/file-input/README.md index 71b872e725..db42c0c2a3 100644 --- a/packages/@uppy/file-input/README.md +++ b/packages/@uppy/file-input/README.md @@ -35,8 +35,8 @@ $ npm install @uppy/file-input ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/file-input/package.json b/packages/@uppy/file-input/package.json index 9d0160b460..00e06ccc5e 100644 --- a/packages/@uppy/file-input/package.json +++ b/packages/@uppy/file-input/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/file-input", "description": "Simple UI of a file input button that works with Uppy right out of the box", - "version": "4.0.0", + "version": "4.0.1", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/file-input/src/FileInput.tsx b/packages/@uppy/file-input/src/FileInput.tsx index 09cc9fbc0e..e952fd6ba2 100644 --- a/packages/@uppy/file-input/src/FileInput.tsx +++ b/packages/@uppy/file-input/src/FileInput.tsx @@ -4,7 +4,7 @@ import { UIPlugin, Uppy, type UIPluginOptions } from '@uppy/core' import toArray from '@uppy/utils/lib/toArray' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' import type { DefinePluginOpts } from '@uppy/core/lib/BasePlugin.js' - +import type { TargetedEvent } from 'preact/compat' // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore We don't want TS to generate types for the package.json import packageJson from '../package.json' @@ -65,19 +65,15 @@ export default class FileInput extends UIPlugin< } } - private handleInputChange(event: Event) { + private handleInputChange(event: TargetedEvent) { this.uppy.log('[FileInput] Something selected through input...') - const files = toArray((event.target as HTMLFileInputElement).files) + const files = toArray(event.currentTarget.files || []) this.addFiles(files) - // We clear the input after a file is selected, because otherwise - // change event is not fired in Chrome and Safari when a file - // with the same name is selected. - // ___Why not use value="" on instead? - // Because if we use that method of clearing the input, - // Chrome will not trigger change if we drop the same file twice (Issue #768). - // @ts-expect-error yes - event.target.value = null // eslint-disable-line no-param-reassign + // Clear the input so that Chrome can detect file section when the same file is repeatedly selected + // (see https://github.com/transloadit/uppy/issues/768#issuecomment-2264902758) + // eslint-disable-next-line no-param-reassign + event.currentTarget.value = '' } private handleClick() { diff --git a/packages/@uppy/form/README.md b/packages/@uppy/form/README.md index 33b478eeef..1f006c87b6 100644 --- a/packages/@uppy/form/README.md +++ b/packages/@uppy/form/README.md @@ -38,8 +38,8 @@ $ npm install @uppy/form ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/golden-retriever/README.md b/packages/@uppy/golden-retriever/README.md index c634040d3d..96eb8494c5 100644 --- a/packages/@uppy/golden-retriever/README.md +++ b/packages/@uppy/golden-retriever/README.md @@ -35,8 +35,8 @@ $ npm install @uppy/golden-retriever ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/google-drive/CHANGELOG.md b/packages/@uppy/google-drive/CHANGELOG.md index 6c124d52c8..3d6f24a9eb 100644 --- a/packages/@uppy/google-drive/CHANGELOG.md +++ b/packages/@uppy/google-drive/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/google-drive +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 4.0.0-beta.1 Released: 2024-03-28 diff --git a/packages/@uppy/google-drive/README.md b/packages/@uppy/google-drive/README.md index 0ea7370304..3a9621ca46 100644 --- a/packages/@uppy/google-drive/README.md +++ b/packages/@uppy/google-drive/README.md @@ -37,8 +37,8 @@ $ npm install @uppy/google-drive ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/google-drive/package.json b/packages/@uppy/google-drive/package.json index 8cb05b95b9..aa0b9f2074 100644 --- a/packages/@uppy/google-drive/package.json +++ b/packages/@uppy/google-drive/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/google-drive", "description": "The Google Drive plugin for Uppy lets users import files from their Google Drive account", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/google-drive/src/index.ts b/packages/@uppy/google-drive/src/index.ts index 55e0f30fdf..29eebdb0df 100644 --- a/packages/@uppy/google-drive/src/index.ts +++ b/packages/@uppy/google-drive/src/index.ts @@ -1 +1,2 @@ export { default } from './GoogleDrive.tsx' +export type { GoogleDriveOptions } from './GoogleDrive.tsx' diff --git a/packages/@uppy/google-photos/CHANGELOG.md b/packages/@uppy/google-photos/CHANGELOG.md index 5c1e537482..57d023745d 100644 --- a/packages/@uppy/google-photos/CHANGELOG.md +++ b/packages/@uppy/google-photos/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/google-photos +## 0.3.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 0.2.0-beta.2 Released: 2024-06-27 diff --git a/packages/@uppy/google-photos/README.md b/packages/@uppy/google-photos/README.md index 4cc652ee12..1d6b73e071 100644 --- a/packages/@uppy/google-photos/README.md +++ b/packages/@uppy/google-photos/README.md @@ -37,8 +37,8 @@ $ npm install @uppy/google-photos ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/google-photos/package.json b/packages/@uppy/google-photos/package.json index 0641f661fc..36b08ee2f7 100644 --- a/packages/@uppy/google-photos/package.json +++ b/packages/@uppy/google-photos/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/google-photos", "description": "The Google Photos plugin for Uppy lets users import photos from their Google Photos account", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/google-photos/src/index.ts b/packages/@uppy/google-photos/src/index.ts index 7535efaaca..d511fae8c1 100644 --- a/packages/@uppy/google-photos/src/index.ts +++ b/packages/@uppy/google-photos/src/index.ts @@ -1 +1,2 @@ export { default } from './GooglePhotos.tsx' +export type { GooglePhotosOptions } from './GooglePhotos.tsx' diff --git a/packages/@uppy/image-editor/CHANGELOG.md b/packages/@uppy/image-editor/CHANGELOG.md index a65dd5040b..73aea5e2e5 100644 --- a/packages/@uppy/image-editor/CHANGELOG.md +++ b/packages/@uppy/image-editor/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/image-editor +## 3.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 3.0.0-beta.2 Released: 2024-04-29 diff --git a/packages/@uppy/image-editor/README.md b/packages/@uppy/image-editor/README.md index 56628466d0..ca5281cb74 100644 --- a/packages/@uppy/image-editor/README.md +++ b/packages/@uppy/image-editor/README.md @@ -37,8 +37,8 @@ $ npm install @uppy/image-editor ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/image-editor/package.json b/packages/@uppy/image-editor/package.json index e7ba7c6185..92ec2fb6a5 100644 --- a/packages/@uppy/image-editor/package.json +++ b/packages/@uppy/image-editor/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/image-editor", "description": "Image editor and cropping UI", - "version": "3.0.0", + "version": "3.1.0", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/image-editor/src/Editor.tsx b/packages/@uppy/image-editor/src/Editor.tsx index 83a6407d3b..9164d88e00 100644 --- a/packages/@uppy/image-editor/src/Editor.tsx +++ b/packages/@uppy/image-editor/src/Editor.tsx @@ -7,7 +7,7 @@ import getCanvasDataThatFitsPerfectlyIntoContainer from './utils/getCanvasDataTh import getScaleFactorThatRemovesDarkCorners from './utils/getScaleFactorThatRemovesDarkCorners.ts' import limitCropboxMovementOnMove from './utils/limitCropboxMovementOnMove.ts' import limitCropboxMovementOnResize from './utils/limitCropboxMovementOnResize.ts' -import type ImageEditor from './ImageEditor.js' +import type ImageEditor from './ImageEditor.ts' type Props = { currentImage: UppyFile diff --git a/packages/@uppy/image-editor/src/ImageEditor.tsx b/packages/@uppy/image-editor/src/ImageEditor.tsx index 7517bd2057..ea896a380d 100644 --- a/packages/@uppy/image-editor/src/ImageEditor.tsx +++ b/packages/@uppy/image-editor/src/ImageEditor.tsx @@ -36,7 +36,7 @@ declare module '@uppy/core' { } } -interface Opts extends UIPluginOptions { +export interface Opts extends UIPluginOptions { quality?: number cropperOptions?: Cropper.Options & { croppedCanvasOptions?: Cropper.GetCroppedCanvasOptions diff --git a/packages/@uppy/image-editor/src/index.ts b/packages/@uppy/image-editor/src/index.ts index 4986bf7bb3..c30fd39721 100644 --- a/packages/@uppy/image-editor/src/index.ts +++ b/packages/@uppy/image-editor/src/index.ts @@ -1 +1,2 @@ export { default } from './ImageEditor.tsx' +export type { Opts as ImageEditorOptions } from './ImageEditor.tsx' diff --git a/packages/@uppy/informer/CHANGELOG.md b/packages/@uppy/informer/CHANGELOG.md index 910094ea71..b38bb753db 100644 --- a/packages/@uppy/informer/CHANGELOG.md +++ b/packages/@uppy/informer/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/informer +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 3.1.0 Released: 2024-02-28 diff --git a/packages/@uppy/informer/README.md b/packages/@uppy/informer/README.md index eb3d2a37d1..6ce4c13844 100644 --- a/packages/@uppy/informer/README.md +++ b/packages/@uppy/informer/README.md @@ -32,8 +32,8 @@ $ npm install @uppy/informer ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/informer/package.json b/packages/@uppy/informer/package.json index 1f710fe4be..041d8f2300 100644 --- a/packages/@uppy/informer/package.json +++ b/packages/@uppy/informer/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/informer", "description": "A notification and error pop-up bar for Uppy.", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/informer/src/index.ts b/packages/@uppy/informer/src/index.ts index 4fdd12b2f5..8a1b4b634b 100644 --- a/packages/@uppy/informer/src/index.ts +++ b/packages/@uppy/informer/src/index.ts @@ -1 +1,2 @@ export { default } from './Informer.tsx' +export type { InformerOptions } from './Informer.tsx' diff --git a/packages/@uppy/instagram/CHANGELOG.md b/packages/@uppy/instagram/CHANGELOG.md index baaa7b3d6a..3032c78675 100644 --- a/packages/@uppy/instagram/CHANGELOG.md +++ b/packages/@uppy/instagram/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/instagram +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 4.0.0-beta.1 Released: 2024-03-28 diff --git a/packages/@uppy/instagram/README.md b/packages/@uppy/instagram/README.md index 283741b427..8cdf192855 100644 --- a/packages/@uppy/instagram/README.md +++ b/packages/@uppy/instagram/README.md @@ -34,8 +34,8 @@ $ npm install @uppy/instagram ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/instagram/package.json b/packages/@uppy/instagram/package.json index e76a2d4c3d..0006b1024e 100644 --- a/packages/@uppy/instagram/package.json +++ b/packages/@uppy/instagram/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/instagram", "description": "Import photos and videos from Instagram, into Uppy.", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/instagram/src/index.ts b/packages/@uppy/instagram/src/index.ts index 7ae3c53f13..55b55b3302 100644 --- a/packages/@uppy/instagram/src/index.ts +++ b/packages/@uppy/instagram/src/index.ts @@ -1 +1,2 @@ export { default } from './Instagram.tsx' +export type { InstagramOptions } from './Instagram.tsx' diff --git a/packages/@uppy/locales/CHANGELOG.md b/packages/@uppy/locales/CHANGELOG.md index 06d883ee4c..af20d957ba 100644 --- a/packages/@uppy/locales/CHANGELOG.md +++ b/packages/@uppy/locales/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/locales +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/locales: Fix locale-pack for en_US (Merlijn Vos / #5431) + ## 4.0.0-beta.4 Released: 2024-06-18 diff --git a/packages/@uppy/locales/package.json b/packages/@uppy/locales/package.json index f9a6e7c8a8..b5120fdf07 100644 --- a/packages/@uppy/locales/package.json +++ b/packages/@uppy/locales/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/locales", "description": "Uppy language packs", - "version": "4.0.3", + "version": "4.1.0", "license": "MIT", "type": "module", "keywords": [ diff --git a/packages/@uppy/locales/src/en_US.ts b/packages/@uppy/locales/src/en_US.ts index 3d00e18033..76324ee4be 100644 --- a/packages/@uppy/locales/src/en_US.ts +++ b/packages/@uppy/locales/src/en_US.ts @@ -1,9 +1,10 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ import type { Locale } from '@uppy/utils/lib/Translator' const en_US: Locale<0 | 1> = { strings: {}, - pluralize(count) { - if (count === 1) { + pluralize(n) { + if (n === 1) { return 0 } return 1 @@ -21,6 +22,8 @@ en_US.strings = { '%{count} additional restrictions were not fulfilled', addMore: 'Add more', addMoreFiles: 'Add more files', + aggregateExceedsSize: + 'You selected %{size} of files, but maximum allowed size is %{sizeAllowed}', allFilesFromFolderNamed: 'All files from folder %{name}', allowAccessDescription: 'In order to take pictures or record video with your camera, please allow camera access for this site.', @@ -70,8 +73,8 @@ en_US.strings = { dropPasteImportFiles: 'Drop files here, %{browseFiles} or import from:', dropPasteImportFolders: 'Drop files here, %{browseFolders} or import from:', editFile: 'Edit file', - editImage: 'Edit image', editFileWithFilename: 'Edit file %{file}', + editImage: 'Edit image', editing: 'Editing %{file}', emptyFolderAdded: 'No files were added from empty folder', encoding: 'Encoding...', @@ -90,7 +93,7 @@ en_US.strings = { }, filter: 'Filter', finishEditingFile: 'Finish editing file', - flipHorizontal: 'Flip horizontal', + flipHorizontal: 'Flip horizontally', folderAdded: { '0': 'Added %{smart_count} file from %{folder}', '1': 'Added %{smart_count} files from %{folder}', @@ -134,8 +137,12 @@ en_US.strings = { pluginNameDropbox: 'Dropbox', pluginNameFacebook: 'Facebook', pluginNameGoogleDrive: 'Google Drive', + pluginNameGooglePhotos: 'Google Photos', pluginNameInstagram: 'Instagram', pluginNameOneDrive: 'OneDrive', + pluginNameScreenCapture: 'Screencast', + pluginNameUnsplash: 'Unsplash', + pluginNameUrl: 'Link', pluginNameZoom: 'Zoom', poweredBy: 'Powered by %{uppy}', processingXFiles: { @@ -160,8 +167,8 @@ en_US.strings = { resumeUpload: 'Resume upload', retry: 'Retry', retryUpload: 'Retry upload', - revert: 'Revert', - rotate: 'Rotate', + revert: 'Reset', + rotate: 'Rotate 90°', save: 'Save', saveChanges: 'Save changes', search: 'Search', @@ -185,7 +192,7 @@ en_US.strings = { submitRecordedFile: 'Submit recorded file', takePicture: 'Take a picture', takePictureBtn: 'Take Picture', - timedOut: 'Upload stalled for %{seconds} seconds, aborting.', + unnamed: 'Unnamed', upload: 'Upload', uploadComplete: 'Upload complete', uploadFailed: 'Upload failed', @@ -227,4 +234,10 @@ en_US.strings = { zoomOut: 'Zoom out', } +// @ts-ignore untyped +if (typeof Uppy !== 'undefined') { + // @ts-ignore untyped + globalThis.Uppy.locales.en_US = en_US +} + export default en_US diff --git a/packages/@uppy/locales/src/fr_FR.ts b/packages/@uppy/locales/src/fr_FR.ts index 7080d4ab2d..37804a52ab 100644 --- a/packages/@uppy/locales/src/fr_FR.ts +++ b/packages/@uppy/locales/src/fr_FR.ts @@ -12,13 +12,17 @@ const fr_FR: Locale<0 | 1> = { fr_FR.strings = { addBulkFilesFailed: { - '0': 'L’ajout de %{smart_count} fichier a échoué', - '1': 'L’ajout de %{smart_count} fichiers a échoué', + '0': 'L’ajout de %{smart_count} fichier a échoué en raison d’une erreur interne', + '1': 'L’ajout de %{smart_count} fichiers a échoué en raison d’erreurs internes', }, addedNumFiles: '%{numFiles} fichier(s) ajouté(s)', addingMoreFiles: 'Ajout de fichiers', + additionalRestrictionsFailed: + '%{count} restrictions supplémentaires n’ont pas été respectées', addMore: 'Ajouter d’autres', addMoreFiles: 'Ajouter d’autres fichiers', + aggregateExceedsSize: + 'Vous avez sélectionné %{size} de fichiers, mais la taille maximale autorisée est %{sizeAllowed}', allFilesFromFolderNamed: 'Tous les fichiers du dossier %{name}', allowAccessDescription: 'Pour prendre des photos ou enregistrer une vidéo, veuillez autoriser l’accès à votre caméra pour ce site.', @@ -29,7 +33,8 @@ fr_FR.strings = { 'Veuillez vous authentifier avec %{pluginName} pour sélectionner les fichiers', back: 'Retour', browse: 'naviguer', - browseFiles: 'naviguer', + browseFiles: 'naviguer dans les fichiers', + browseFolders: 'naviguer dans les dossiers', cancel: 'Annuler', cancelUpload: 'Annuler le téléversement', chooseFiles: 'Choisir des fichiers', @@ -71,7 +76,8 @@ fr_FR.strings = { enterCorrectUrl: 'Lien incorrect: Assurez-vous que vous entrez un lien direct vers le fichier', enterUrlToImport: 'Entrez le lien pour importer un fichier', - exceedsSize: 'Ce fichier dépasse la taille maximale autorisée de %{size}', + exceedsSize: + 'Le fichier %{file} dépasse la taille maximale autorisée de %{size}', failedToFetch: 'Companion a échoué à récupérer ce lien, assurez-vous qu’il est correct', failedToUpload: 'Le téléversement de %{file} a échoué', @@ -89,15 +95,20 @@ fr_FR.strings = { generatingThumbnails: 'Génération des vignettes…', import: 'Importer', importFrom: 'Importer de %{name}', + inferiorSize: 'Ce fichier est plus petit que la taille autorisée de %{size}', loading: 'Chargement…', logOut: 'Déconnexion', micDisabled: 'Accès au micro refusé par l’utilisateur', myDevice: 'Mon Appareil', + noCameraDescription: + 'Pour prendre des photos ou enregistrer une vidéo, veuillez connecter une caméra', noDuplicates: 'Impossible d’ajouter le fichier "%{fileName}", il existe déjà', noFilesFound: 'Vous n’avez aucun fichier ou dossier ici', noInternetConnection: 'Pas de connexion à Internet', noMoreFilesAllowed: 'Impossible d’ajouter de nouveaux fichiers: en cours de chargement ', + noSearchResults: + 'Malheureusement, il n’y a aucun résultat pour cette recherche', openFolderNamed: 'Ouvrir %{name}', pause: 'Pause', pauseUpload: 'Mettre en pause le téléversement', @@ -111,12 +122,19 @@ fr_FR.strings = { recordingLength: 'Durée d’enregistrement %{recording_length}', recordingStoppedMaxSize: 'L’enregistrement s’est arrété car la taille du fichier dépasse la limite', + recoveredAllFiles: + 'Nous avons restauré tous les fichiers. Vous pouvez maintenant reprendre le téléversement.', + recoveredXFiles: { + '0': 'Nous n’avons pas pu récupérer entièrement 1 fichier. Veuillez le resélectionner et reprendre le téléversement.', + '1': 'Nous n’avons pas pu récupérer entièrement %{smart_count} fichiers. Veuillez les resélectionner et reprendre le téléversement.', + }, removeFile: 'Effacer le fichier %{file}', resetFilter: 'Réinitialiser filtre', resume: 'Reprendre', resumeUpload: 'Reprendre le téléversement', retry: 'Réessayer', retryUpload: 'Réessayer le téléversement', + reSelect: 'Resélectionner', save: 'Sauvegarder', saveChanges: 'Sauvegarder les modifications', selectFileNamed: 'Sélectionner le fichier %{name}', @@ -124,6 +142,8 @@ fr_FR.strings = { '0': 'Sélectionner %{smart_count}', '1': 'Sélectionner %{smart_count}', }, + sessionRestored: 'Session restaurée', + signInWithGoogle: 'Se connecter avec Google', smile: 'Souriez !', startRecording: 'Commencer l’enregistrement vidéo', stopRecording: 'Arrêter l’enregistrement vidéo', diff --git a/packages/@uppy/locales/template.js b/packages/@uppy/locales/template.js deleted file mode 100644 index 2bf26d705f..0000000000 --- a/packages/@uppy/locales/template.js +++ /dev/null @@ -1,16 +0,0 @@ -const en_US = { - pluralize (count) { - if (count === 1) { - return 0 - } - return 1 - }, -} - -en_US.strings = {} - -if (typeof Uppy !== 'undefined') { - globalThis.Uppy.locales.en_US = en_US -} - -export default en_US diff --git a/packages/@uppy/locales/template.ts b/packages/@uppy/locales/template.ts new file mode 100644 index 0000000000..82010883af --- /dev/null +++ b/packages/@uppy/locales/template.ts @@ -0,0 +1,22 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import type { Locale } from '@uppy/utils/lib/Translator' + +const en_US: Locale<0 | 1> = { + strings: {}, + pluralize(n) { + if (n === 1) { + return 0 + } + return 1 + }, +} + +en_US.strings = {} + +// @ts-ignore untyped +if (typeof Uppy !== 'undefined') { + // @ts-ignore untyped + globalThis.Uppy.locales.en_US = en_US +} + +export default en_US diff --git a/packages/@uppy/onedrive/CHANGELOG.md b/packages/@uppy/onedrive/CHANGELOG.md index 41fcaac0c8..83a1329830 100644 --- a/packages/@uppy/onedrive/CHANGELOG.md +++ b/packages/@uppy/onedrive/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/onedrive +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 4.0.0-beta.1 Released: 2024-03-28 diff --git a/packages/@uppy/onedrive/README.md b/packages/@uppy/onedrive/README.md index 9279d4d8a4..8a643ee21d 100644 --- a/packages/@uppy/onedrive/README.md +++ b/packages/@uppy/onedrive/README.md @@ -37,8 +37,8 @@ $ npm install @uppy/onedrive ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/onedrive/package.json b/packages/@uppy/onedrive/package.json index 69b6b9c736..11a322724b 100644 --- a/packages/@uppy/onedrive/package.json +++ b/packages/@uppy/onedrive/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/onedrive", "description": "Import files from OneDrive, into Uppy.", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/onedrive/src/index.ts b/packages/@uppy/onedrive/src/index.ts index a57387758c..65ee4feddb 100644 --- a/packages/@uppy/onedrive/src/index.ts +++ b/packages/@uppy/onedrive/src/index.ts @@ -1 +1,2 @@ export { default } from './OneDrive.tsx' +export type { OneDriveOptions } from './OneDrive.tsx' diff --git a/packages/@uppy/progress-bar/README.md b/packages/@uppy/progress-bar/README.md index ec07a9e5ea..e711d5c1ea 100644 --- a/packages/@uppy/progress-bar/README.md +++ b/packages/@uppy/progress-bar/README.md @@ -33,8 +33,8 @@ $ npm install @uppy/progress-bar ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/provider-views/package.json b/packages/@uppy/provider-views/package.json index 5b3b26e561..52dd934a4b 100644 --- a/packages/@uppy/provider-views/package.json +++ b/packages/@uppy/provider-views/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/provider-views", "description": "View library for Uppy remote provider plugins.", - "version": "4.0.0", + "version": "4.0.1", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/provider-views/src/Breadcrumbs.tsx b/packages/@uppy/provider-views/src/Breadcrumbs.tsx index 16f2c39e21..621033da3c 100644 --- a/packages/@uppy/provider-views/src/Breadcrumbs.tsx +++ b/packages/@uppy/provider-views/src/Breadcrumbs.tsx @@ -1,7 +1,7 @@ import type { PartialTreeFolder } from '@uppy/core/lib/Uppy.js' import { h, Fragment } from 'preact' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' -import type ProviderView from './ProviderView/index.js' +import type ProviderView from './ProviderView/index.ts' type BreadcrumbsProps = { openFolder: ProviderView['openFolder'] diff --git a/packages/@uppy/provider-views/src/ProviderView/AuthView.tsx b/packages/@uppy/provider-views/src/ProviderView/AuthView.tsx index 5f04b9a4f1..3a8d5c9377 100644 --- a/packages/@uppy/provider-views/src/ProviderView/AuthView.tsx +++ b/packages/@uppy/provider-views/src/ProviderView/AuthView.tsx @@ -2,8 +2,8 @@ import { h } from 'preact' import { useCallback } from 'preact/hooks' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' import type Translator from '@uppy/utils/lib/Translator' -import type { Opts } from './ProviderView.js' -import type ProviderViews from './ProviderView.js' +import type { Opts } from './ProviderView.ts' +import type ProviderViews from './ProviderView.ts' type AuthViewProps = { loading: boolean | string diff --git a/packages/@uppy/provider-views/src/ProviderView/Header.tsx b/packages/@uppy/provider-views/src/ProviderView/Header.tsx index 486d15d19d..3184e44497 100644 --- a/packages/@uppy/provider-views/src/ProviderView/Header.tsx +++ b/packages/@uppy/provider-views/src/ProviderView/Header.tsx @@ -6,7 +6,7 @@ import type { PartialTreeFolder } from '@uppy/core/lib/Uppy.js' import classNames from 'classnames' import User from './User.tsx' import Breadcrumbs from '../Breadcrumbs.tsx' -import type ProviderView from './ProviderView.js' +import type ProviderView from './ProviderView.ts' type HeaderProps = { showBreadcrumbs: boolean diff --git a/packages/@uppy/provider-views/src/utils/PartialTreeUtils/afterFill.ts b/packages/@uppy/provider-views/src/utils/PartialTreeUtils/afterFill.ts index 87eefd2151..af087b789f 100644 --- a/packages/@uppy/provider-views/src/utils/PartialTreeUtils/afterFill.ts +++ b/packages/@uppy/provider-views/src/utils/PartialTreeUtils/afterFill.ts @@ -6,6 +6,9 @@ import type { PartialTreeId, } from '@uppy/core/lib/Uppy.js' import type { CompanionFile } from '@uppy/utils/lib/CompanionFile' +// p-queue does not have a `"main"` field in its `package.json`, and that makes `import/no-unresolved` freak out. +// We can safely ignore it because bundlers will happily use the `"exports"` field instead. +// eslint-disable-next-line import/no-unresolved import PQueue from 'p-queue' import shallowClone from './shallowClone.ts' diff --git a/packages/@uppy/react/CHANGELOG.md b/packages/@uppy/react/CHANGELOG.md index bde9e91920..2b92303042 100644 --- a/packages/@uppy/react/CHANGELOG.md +++ b/packages/@uppy/react/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/react +## 4.0.2 + +Released: 2024-08-26 +Included in: Uppy v4.2.1 + +- @uppy/react: fix `use-sync-external-store` import (Merlijn Vos / #5426) + ## 4.0.0 Released: 2024-07-10 diff --git a/packages/@uppy/react/README.md b/packages/@uppy/react/README.md index 7817cd437d..b10339f8ff 100644 --- a/packages/@uppy/react/README.md +++ b/packages/@uppy/react/README.md @@ -48,8 +48,8 @@ $ npm install @uppy/react ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/react/package.json b/packages/@uppy/react/package.json index 9be4c08e74..96c4b2aaf0 100644 --- a/packages/@uppy/react/package.json +++ b/packages/@uppy/react/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/react", "description": "React component wrappers around Uppy's official UI plugins.", - "version": "4.0.1", + "version": "4.0.2", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/react/src/useUppyState.ts b/packages/@uppy/react/src/useUppyState.ts index e69a63a420..b811e89a77 100644 --- a/packages/@uppy/react/src/useUppyState.ts +++ b/packages/@uppy/react/src/useUppyState.ts @@ -1,7 +1,7 @@ import type { Uppy, State } from '@uppy/core' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' import { useMemo, useCallback } from 'react' -import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector' +import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector.js' export default function useUppyState< M extends Meta = Meta, diff --git a/packages/@uppy/redux-dev-tools/README.md b/packages/@uppy/redux-dev-tools/README.md index 53b071c07d..d774af6b19 100644 --- a/packages/@uppy/redux-dev-tools/README.md +++ b/packages/@uppy/redux-dev-tools/README.md @@ -30,8 +30,8 @@ $ npm install @uppy/redux-dev-tools ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/remote-sources/CHANGELOG.md b/packages/@uppy/remote-sources/CHANGELOG.md index acc7d0ca24..8477797f69 100644 --- a/packages/@uppy/remote-sources/CHANGELOG.md +++ b/packages/@uppy/remote-sources/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/remote-sources +## 2.2.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/remote-sources: support companionKeysParams (Merlijn Vos / #5434) + ## 2.1.0 Released: 2024-07-30 diff --git a/packages/@uppy/remote-sources/README.md b/packages/@uppy/remote-sources/README.md index a1f3337fe0..39f669fa98 100644 --- a/packages/@uppy/remote-sources/README.md +++ b/packages/@uppy/remote-sources/README.md @@ -28,8 +28,8 @@ yarn add @uppy/remote-sources ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy.RemoteSources` will attach itself -to the global `window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy.RemoteSources` will attach +itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/remote-sources/package.json b/packages/@uppy/remote-sources/package.json index 296174ca78..4846362cd6 100644 --- a/packages/@uppy/remote-sources/package.json +++ b/packages/@uppy/remote-sources/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/remote-sources", "description": "Uppy plugin that includes all remote sources that Uppy+Companion offer, like Instagram, Google Drive, Dropox, Box, Unsplash, Url etc", - "version": "2.1.0", + "version": "2.2.0", "license": "MIT", "main": "lib/index.js", "type": "module", diff --git a/packages/@uppy/remote-sources/src/index.test.ts b/packages/@uppy/remote-sources/src/index.test.ts index 261bc89a67..09f2f09374 100644 --- a/packages/@uppy/remote-sources/src/index.test.ts +++ b/packages/@uppy/remote-sources/src/index.test.ts @@ -50,4 +50,19 @@ describe('RemoteSources', () => { 'Invalid plugin: "Webcam" is not one of: Box, Dropbox, Facebook, GoogleDrive, GooglePhotos, Instagram, OneDrive, Unsplash, Url, or Zoom.', ) }) + + it('should pass companionKeysParams', () => { + const core = new Core() + const companionKeysParams = { + GoogleDrive: { key: 'google', credentialsName: 'google' }, + } + core.use(Dashboard) + core.use(RemoteSources, { + companionUrl: 'https://example.com', + companionKeysParams, + }) + expect(core.getPlugin('GoogleDrive')?.opts.companionKeysParams).toEqual( + companionKeysParams.GoogleDrive, + ) + }) }) diff --git a/packages/@uppy/remote-sources/src/index.ts b/packages/@uppy/remote-sources/src/index.ts index b62a26eaed..460e6123ef 100644 --- a/packages/@uppy/remote-sources/src/index.ts +++ b/packages/@uppy/remote-sources/src/index.ts @@ -32,14 +32,33 @@ const availablePlugins = { Zoom, } -export interface RemoteSourcesOptions extends CompanionPluginOptions { - sources?: Array> +type AvailablePluginsKeys = + | 'Box' + | 'Dropbox' + | 'Facebook' + | 'GoogleDrive' + | 'GooglePhotos' + | 'Instagram' + | 'OneDrive' + | 'Unsplash' + | 'Url' + | 'Zoom' + +type NestedCompanionKeysParams = { + [key in AvailablePluginsKeys]?: CompanionPluginOptions['companionKeysParams'] +} + +export interface RemoteSourcesOptions + extends Omit { + sources?: Array + // Individual remote source plugins set the `key` and `credentialsName` + // in `companionKeysParams` but because this is a preset we need to change + // this to a record of plugin IDs to their respective `companionKeysParams`. + companionKeysParams?: NestedCompanionKeysParams } const defaultOptions = { - sources: Object.keys(availablePlugins) as Array< - keyof Omit - >, + sources: Object.keys(availablePlugins) as Array, } satisfies Partial type Opts = DefinePluginOpts @@ -72,7 +91,12 @@ export default class RemoteSources< install(): void { this.opts.sources.forEach((pluginId) => { - const optsForRemoteSourcePlugin = { ...this.opts, sources: undefined } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { sources, ...rest } = this.opts + const optsForRemoteSourcePlugin: CompanionPluginOptions = { + ...rest, + companionKeysParams: this.opts.companionKeysParams?.[pluginId], + } const plugin = availablePlugins[pluginId] if (plugin == null) { const pluginNames = Object.keys(availablePlugins) diff --git a/packages/@uppy/screen-capture/CHANGELOG.md b/packages/@uppy/screen-capture/CHANGELOG.md index aa2ee1d053..7cd7423f3c 100644 --- a/packages/@uppy/screen-capture/CHANGELOG.md +++ b/packages/@uppy/screen-capture/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/screen-capture +## 4.1.0 + +Released: 2024-08-29 +Included in: Uppy v4.3.0 + +- @uppy/aws-s3,@uppy/box,@uppy/compressor,@uppy/dropbox,@uppy/facebook,@uppy/google-drive,@uppy/google-photos,@uppy/image-editor,@uppy/informer,@uppy/instagram,@uppy/onedrive,@uppy/screen-capture,@uppy/tus,@uppy/unsplash,@uppy/url,@uppy/xhr-upload,@uppy/zoom: export plugin options (Antoine du Hamel / #5433) + ## 4.0.0-beta.5 Released: 2024-05-14 diff --git a/packages/@uppy/screen-capture/README.md b/packages/@uppy/screen-capture/README.md index 55e0cb4373..1cb9ae6808 100644 --- a/packages/@uppy/screen-capture/README.md +++ b/packages/@uppy/screen-capture/README.md @@ -30,8 +30,8 @@ $ npm install @uppy/screen-capture ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/screen-capture/package.json b/packages/@uppy/screen-capture/package.json index 2e6af6d3f9..28c4d46d3e 100644 --- a/packages/@uppy/screen-capture/package.json +++ b/packages/@uppy/screen-capture/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/screen-capture", "description": "Uppy plugin that captures video from display or application.", - "version": "4.0.0", + "version": "4.1.0", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/screen-capture/src/index.ts b/packages/@uppy/screen-capture/src/index.ts index 7b8367c9f9..60ff953d37 100644 --- a/packages/@uppy/screen-capture/src/index.ts +++ b/packages/@uppy/screen-capture/src/index.ts @@ -1 +1,2 @@ export { default } from './ScreenCapture.tsx' +export type { ScreenCaptureOptions } from './ScreenCapture.tsx' diff --git a/packages/@uppy/status-bar/CHANGELOG.md b/packages/@uppy/status-bar/CHANGELOG.md index dc10bb5053..86b50232de 100644 --- a/packages/@uppy/status-bar/CHANGELOG.md +++ b/packages/@uppy/status-bar/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/status-bar +## 4.0.3 + +Released: 2024-08-20 +Included in: Uppy v4.2.0 + +- @uppy/status-bar: show upload button when files are recovered (Merlijn Vos / #5418) + ## 4.0.1 Released: 2024-07-30 diff --git a/packages/@uppy/status-bar/README.md b/packages/@uppy/status-bar/README.md index 69d7e34639..c0e529a819 100644 --- a/packages/@uppy/status-bar/README.md +++ b/packages/@uppy/status-bar/README.md @@ -40,8 +40,8 @@ $ npm install @uppy/status-bar ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/status-bar/package.json b/packages/@uppy/status-bar/package.json index 4954635771..f9aee10144 100644 --- a/packages/@uppy/status-bar/package.json +++ b/packages/@uppy/status-bar/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/status-bar", "description": "A progress bar for Uppy, with many bells and whistles.", - "version": "4.0.1", + "version": "4.0.3", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/status-bar/src/StatusBar.tsx b/packages/@uppy/status-bar/src/StatusBar.tsx index c445f8035a..9083288378 100644 --- a/packages/@uppy/status-bar/src/StatusBar.tsx +++ b/packages/@uppy/status-bar/src/StatusBar.tsx @@ -11,7 +11,7 @@ import StatusBarUI, { type StatusBarUIProps } from './StatusBarUI.tsx' // @ts-ignore We don't want TS to generate types for the package.json import packageJson from '../package.json' import locale from './locale.ts' -import type { StatusBarOptions } from './StatusBarOptions.js' +import type { StatusBarOptions } from './StatusBarOptions.ts' const speedFilterHalfLife = 2000 const ETAFilterHalfLife = 2000 diff --git a/packages/@uppy/status-bar/src/StatusBarOptions.ts b/packages/@uppy/status-bar/src/StatusBarOptions.ts index 83e157da91..dcda6b4337 100644 --- a/packages/@uppy/status-bar/src/StatusBarOptions.ts +++ b/packages/@uppy/status-bar/src/StatusBarOptions.ts @@ -1,5 +1,5 @@ import type { UIPluginOptions } from '@uppy/core/lib/UIPlugin.js' -import type StatusBarLocale from './locale.js' +import type StatusBarLocale from './locale.ts' export interface StatusBarOptions extends UIPluginOptions { showProgressDetails?: boolean diff --git a/packages/@uppy/status-bar/src/StatusBarUI.tsx b/packages/@uppy/status-bar/src/StatusBarUI.tsx index b4bbf76f7c..6f5cc4480f 100644 --- a/packages/@uppy/status-bar/src/StatusBarUI.tsx +++ b/packages/@uppy/status-bar/src/StatusBarUI.tsx @@ -140,8 +140,7 @@ export default function StatusBarUI({ const showUploadBtn = !error && newFiles && - !isUploadInProgress && - !isAllPaused && + ((!isUploadInProgress && !isAllPaused) || recoveredState) && allowNewUpload && !hideUploadButton diff --git a/packages/@uppy/store-default/README.md b/packages/@uppy/store-default/README.md index d4319b18a9..c36cf72f1e 100644 --- a/packages/@uppy/store-default/README.md +++ b/packages/@uppy/store-default/README.md @@ -31,8 +31,8 @@ $ npm install @uppy/store-default ``` Alternatively, you can also use this package in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/store-redux/README.md b/packages/@uppy/store-redux/README.md index 13d1589ae8..0e1fd70113 100644 --- a/packages/@uppy/store-redux/README.md +++ b/packages/@uppy/store-redux/README.md @@ -41,8 +41,8 @@ $ npm install @uppy/store-redux ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions. ## Documentation diff --git a/packages/@uppy/svelte/.gitignore b/packages/@uppy/svelte/.gitignore index 0aac31a3a0..2a53a910ea 100644 --- a/packages/@uppy/svelte/.gitignore +++ b/packages/@uppy/svelte/.gitignore @@ -1,3 +1,5 @@ .DS_Store /dist/ /src/empty.* +.svelte-kit +!src/lib diff --git a/packages/@uppy/svelte/CHANGELOG.md b/packages/@uppy/svelte/CHANGELOG.md index 13757cdea5..1fc0f788dc 100644 --- a/packages/@uppy/svelte/CHANGELOG.md +++ b/packages/@uppy/svelte/CHANGELOG.md @@ -1,5 +1,20 @@ # @uppy/svelte +## 4.0.2 + +Released: 2024-09-20 +Included in: Uppy v4.4.0 + +- @uppy/svelte: fix generated module to not bundle Svelte (Antoine du Hamel / #5446) +- examples,@uppy/svelte: Bump svelte from 4.2.18 to 4.2.19 (dependabot[bot] / #5440) + +## 4.0.1 + +Released: 2024-08-20 +Included in: Uppy v4.2.0 + +- @uppy/svelte: fix exports condition (Merlijn Vos / #5416) + ## 4.0.0-beta.2 Released: 2024-04-29 diff --git a/packages/@uppy/svelte/package.json b/packages/@uppy/svelte/package.json index e207152628..2461b35612 100644 --- a/packages/@uppy/svelte/package.json +++ b/packages/@uppy/svelte/package.json @@ -1,20 +1,11 @@ { "name": "@uppy/svelte", + "version": "4.0.2", "description": "Uppy plugin that helps integrate Uppy into your Svelte project.", "type": "module", - "version": "4.0.0", - "scripts": { - "build": "rollup -c", - "prepublishOnly": "yarn run build", - "validate": "svelte-check" - }, - "exports": { - ".": { - "svelte": "./src/index.js", - "default": "./lib/index.js" - }, - "./package.json": "./package.json" - }, + "svelte": "./dist/index.js", + "types": "./dist/index.d.ts", + "main": "./dist/index.js", "homepage": "https://uppy.io", "bugs": { "url": "https://github.com/transloadit/uppy/issues" @@ -23,18 +14,37 @@ "type": "git", "url": "git+https://github.com/transloadit/uppy.git" }, - "dependencies": { - "@uppy/utils": "workspace:^" + "keywords": [ + "file uploader", + "uppy", + "uppy-plugin", + "svelte" + ], + "files": [ + "src", + "dist" + ], + "exports": { + ".": { + "types": "./dist/index.d.ts", + "svelte": "./dist/index.js" + } + }, + "scripts": { + "build": "svelte-kit sync && svelte-package", + "prepublishOnly": "yarn run package", + "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json" }, "devDependencies": { - "@rollup/plugin-node-resolve": "^13.0.0", - "@tsconfig/svelte": "^5.0.0", - "rollup": "^4.0.0", - "rollup-plugin-svelte": "^7.0.0", - "rollup-plugin-svelte-types": "^1.0.6", - "svelte": "^4.0.0", - "svelte-check": "^3.0.0", - "svelte-preprocess": "^5.0.0" + "@sveltejs/adapter-auto": "^3.0.0", + "@sveltejs/kit": "^2.0.0", + "@sveltejs/package": "^2.0.0", + "@sveltejs/vite-plugin-svelte": "^3.0.0", + "svelte": "^4.2.7", + "svelte-check": "^3.6.0", + "tslib": "^2.4.1", + "typescript": "^5.0.0", + "vite": "^5.0.11" }, "peerDependencies": { "@uppy/core": "workspace:^", @@ -46,16 +56,5 @@ }, "publishConfig": { "access": "public" - }, - "keywords": [ - "file uploader", - "uppy", - "uppy-plugin", - "svelte" - ], - "files": [ - "src", - "lib", - "typings" - ] + } } diff --git a/packages/@uppy/svelte/rollup.config.js b/packages/@uppy/svelte/rollup.config.js deleted file mode 100644 index f19675b8e8..0000000000 --- a/packages/@uppy/svelte/rollup.config.js +++ /dev/null @@ -1,34 +0,0 @@ -import svelte from 'rollup-plugin-svelte' -import resolve from '@rollup/plugin-node-resolve' -import preprocess from 'svelte-preprocess' -import svelteDts from 'rollup-plugin-svelte-types'; - -const globals = { - '@uppy/dashboard': 'Dashboard', - '@uppy/drag-drop': 'DragDrop', - '@uppy/progress-bar': 'ProgressBar', - '@uppy/status-bar': 'StatusBar', -} - -export default { - input: 'src/index.ts', - output: [ - { - file: 'lib/index.js', - format: 'es', - globals, - }, - ], - plugins: [ - svelte({ - include: 'src/**/*.svelte', - preprocess: preprocess(), - }), - resolve({ - resolveOnly: ['svelte'], - }), - svelteDts.default({ - declarationDir: './lib/' - }) - ], -} diff --git a/packages/@uppy/svelte/src/components/DashboardModal.svelte b/packages/@uppy/svelte/src/components/DashboardModal.svelte deleted file mode 100644 index 21fae02514..0000000000 --- a/packages/@uppy/svelte/src/components/DashboardModal.svelte +++ /dev/null @@ -1,54 +0,0 @@ - -
\ No newline at end of file diff --git a/packages/@uppy/svelte/src/components/DragDrop.svelte b/packages/@uppy/svelte/src/components/DragDrop.svelte deleted file mode 100644 index 2292446352..0000000000 --- a/packages/@uppy/svelte/src/components/DragDrop.svelte +++ /dev/null @@ -1,39 +0,0 @@ - -
diff --git a/packages/@uppy/svelte/src/components/Dashboard.svelte b/packages/@uppy/svelte/src/lib/components/Dashboard.svelte similarity index 52% rename from packages/@uppy/svelte/src/components/Dashboard.svelte rename to packages/@uppy/svelte/src/lib/components/Dashboard.svelte index 0974beab84..64befbddfb 100644 --- a/packages/@uppy/svelte/src/components/Dashboard.svelte +++ b/packages/@uppy/svelte/src/lib/components/Dashboard.svelte @@ -1,14 +1,17 @@ - -
\ No newline at end of file + +
diff --git a/packages/@uppy/svelte/src/lib/components/DashboardModal.svelte b/packages/@uppy/svelte/src/lib/components/DashboardModal.svelte new file mode 100644 index 0000000000..0dd57dc280 --- /dev/null +++ b/packages/@uppy/svelte/src/lib/components/DashboardModal.svelte @@ -0,0 +1,58 @@ + + +
diff --git a/packages/@uppy/svelte/src/lib/components/DragDrop.svelte b/packages/@uppy/svelte/src/lib/components/DragDrop.svelte new file mode 100644 index 0000000000..3e116b0e4d --- /dev/null +++ b/packages/@uppy/svelte/src/lib/components/DragDrop.svelte @@ -0,0 +1,43 @@ + + +
diff --git a/packages/@uppy/svelte/src/components/ProgressBar.svelte b/packages/@uppy/svelte/src/lib/components/ProgressBar.svelte similarity index 51% rename from packages/@uppy/svelte/src/components/ProgressBar.svelte rename to packages/@uppy/svelte/src/lib/components/ProgressBar.svelte index 701eb31223..68287980b0 100644 --- a/packages/@uppy/svelte/src/components/ProgressBar.svelte +++ b/packages/@uppy/svelte/src/lib/components/ProgressBar.svelte @@ -1,27 +1,30 @@ - -
\ No newline at end of file + +
diff --git a/packages/@uppy/svelte/src/components/StatusBar.svelte b/packages/@uppy/svelte/src/lib/components/StatusBar.svelte similarity index 51% rename from packages/@uppy/svelte/src/components/StatusBar.svelte rename to packages/@uppy/svelte/src/lib/components/StatusBar.svelte index e7ae6ee277..b217ca37db 100644 --- a/packages/@uppy/svelte/src/components/StatusBar.svelte +++ b/packages/@uppy/svelte/src/lib/components/StatusBar.svelte @@ -1,27 +1,30 @@ - -
\ No newline at end of file + +
diff --git a/packages/@uppy/svelte/src/index.ts b/packages/@uppy/svelte/src/lib/index.ts similarity index 100% rename from packages/@uppy/svelte/src/index.ts rename to packages/@uppy/svelte/src/lib/index.ts diff --git a/packages/@uppy/svelte/svelte.config.js b/packages/@uppy/svelte/svelte.config.js new file mode 100644 index 0000000000..4698292e1e --- /dev/null +++ b/packages/@uppy/svelte/svelte.config.js @@ -0,0 +1,20 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import adapter from '@sveltejs/adapter-auto' +// eslint-disable-next-line import/no-unresolved +import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' + +/** @type {import('@sveltejs/kit').Config} */ +const config = { + // Consult https://kit.svelte.dev/docs/integrations#preprocessors + // for more information about preprocessors + preprocess: vitePreprocess(), + + kit: { + // adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list. + // If your environment is not supported, or you settled on a specific environment, switch out the adapter. + // See https://kit.svelte.dev/docs/adapters for more information about adapters. + adapter: adapter(), + }, +} + +export default config diff --git a/packages/@uppy/svelte/tsconfig.json b/packages/@uppy/svelte/tsconfig.json index 309b580c81..b8bfd5859b 100644 --- a/packages/@uppy/svelte/tsconfig.json +++ b/packages/@uppy/svelte/tsconfig.json @@ -1,14 +1,17 @@ { - "extends": [ - "../../../tsconfig.shared.json", - "@tsconfig/svelte/tsconfig.json", - ], + "extends": "./.svelte-kit/tsconfig.json", "compilerOptions": { - "noEmit": true, - "emitDeclarationOnly": false, - "rootDir": "./src", - "outDir": "./lib", + "allowJs": true, + "checkJs": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "sourceMap": true, + "strict": true, + "module": "NodeNext", + "moduleResolution": "NodeNext", }, - "include": ["./src/**/*.*", "./typings/index.d.ts"], - "exclude": ["node_modules/*"], + "include": ["./package.json", "./src/**/*.*"], + "exclude": ["node_modules/*", "./src/lib/empty.ts"], } diff --git a/packages/@uppy/svelte/typings/index.d.ts b/packages/@uppy/svelte/typings/index.d.ts deleted file mode 100644 index 0cce06400e..0000000000 --- a/packages/@uppy/svelte/typings/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module '*.svelte' { - import { SvelteComponent } from 'svelte' - - export default class extends SvelteComponent {} -} diff --git a/packages/@uppy/svelte/vite.config.js b/packages/@uppy/svelte/vite.config.js new file mode 100644 index 0000000000..67c0dad1bd --- /dev/null +++ b/packages/@uppy/svelte/vite.config.js @@ -0,0 +1,8 @@ +// eslint-disable-next-line import/no-unresolved +import { sveltekit } from '@sveltejs/kit/vite' +// eslint-disable-next-line import/no-extraneous-dependencies +import { defineConfig } from 'vite' + +export default defineConfig({ + plugins: [sveltekit()], +}) diff --git a/packages/@uppy/thumbnail-generator/README.md b/packages/@uppy/thumbnail-generator/README.md index 13c6825f3d..4540ed1e14 100644 --- a/packages/@uppy/thumbnail-generator/README.md +++ b/packages/@uppy/thumbnail-generator/README.md @@ -31,8 +31,8 @@ $ npm install @uppy/thumbnail-generator ``` Alternatively, you can also use this plugin in a pre-built bundle from -Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global -`window.Uppy` object. See the +Transloadit’s CDN: Smart CDN. In that case `Uppy` will attach itself to the +global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions.