Sfoglia il codice sorgente

deps: remove `qs-stringify` from dependencies (#3077)

Antoine du Hamel 3 anni fa
parent
commit
b5411ff78c

+ 11 - 25
package-lock.json

@@ -148,7 +148,7 @@
         "eslint": "^7.22.0",
         "eslint-plugin-import": "^2.22.1",
         "eslint-plugin-jsdoc": "^35.4.1",
-        "eslint-plugin-prefer-arrow": "*",
+        "eslint-plugin-prefer-arrow": "latest",
         "jasmine-core": "~3.6.0",
         "jasmine-spec-reporter": "~5.0.0",
         "karma": "~6.1.0",
@@ -640,7 +640,7 @@
         "preact-render-to-string": "^4.1.0",
         "react": "^16.8.6",
         "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
-        "react-native-svg-uri": "git+ssh://git@github.com/gaboelnuevo/react-native-svg-uri.git#473e4f958e8846cbd5c69ce5cf59753cd5cea748"
+        "react-native-svg-uri": "gaboelnuevo/react-native-svg-uri#473e4f958e8846cbd5c69ce5cf59753cd5cea748"
       }
     },
     "examples/redux": {
@@ -60050,11 +60050,6 @@
         "node": ">=0.6"
       }
     },
-    "node_modules/qs-stringify": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/qs-stringify/-/qs-stringify-1.2.1.tgz",
-      "integrity": "sha512-2N5xGLGZUxpgAYq1fD1LmBSCbxQVsXYt5JU0nU3FuPWO8PlCnKNFQwXkZgyB6mrTdg7IbexX4wxIR403dJw9pw=="
-    },
     "node_modules/query-selector-shadow-dom": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/query-selector-shadow-dom/-/query-selector-shadow-dom-1.0.0.tgz",
@@ -75636,7 +75631,7 @@
         "eslint": "^7.22.0",
         "eslint-plugin-import": "^2.22.1",
         "eslint-plugin-jsdoc": "^35.4.1",
-        "eslint-plugin-prefer-arrow": "*",
+        "eslint-plugin-prefer-arrow": "latest",
         "jasmine-core": "~3.6.0",
         "jasmine-spec-reporter": "~5.0.0",
         "karma": "~6.1.0",
@@ -75687,8 +75682,7 @@
         "@uppy/companion-client": "file:../companion-client",
         "@uppy/utils": "file:../utils",
         "@uppy/xhr-upload": "file:../xhr-upload",
-        "nanoid": "^3.1.23",
-        "qs-stringify": "^1.1.0"
+        "nanoid": "^3.1.23"
       },
       "devDependencies": {
         "whatwg-fetch": "3.6.2"
@@ -75797,8 +75791,7 @@
       "license": "MIT",
       "dependencies": {
         "@uppy/utils": "file:../utils",
-        "namespace-emitter": "^2.0.1",
-        "qs-stringify": "^1.1.0"
+        "namespace-emitter": "^2.0.1"
       }
     },
     "packages/@uppy/companion/node_modules/@types/node": {
@@ -76643,7 +76636,7 @@
         "hexo": "4.2.1",
         "hexo-browsersync": "^0.3.0",
         "hexo-cli": "3.1.0",
-        "hexo-filter-github-emojis": "git+ssh://git@github.com/arturi/hexo-filter-github-emojis.git#c0b188687b47669d0aa452d6f9adbb7487925baf",
+        "hexo-filter-github-emojis": "arturi/hexo-filter-github-emojis",
         "hexo-generator-alias": "^0.1.3",
         "hexo-generator-archive": "^1.0.0",
         "hexo-generator-category": "^1.0.0",
@@ -89304,7 +89297,7 @@
         "preact-render-to-string": "^4.1.0",
         "react": "^16.8.6",
         "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
-        "react-native-svg-uri": "git+ssh://git@github.com/gaboelnuevo/react-native-svg-uri.git#473e4f958e8846cbd5c69ce5cf59753cd5cea748"
+        "react-native-svg-uri": "gaboelnuevo/react-native-svg-uri#473e4f958e8846cbd5c69ce5cf59753cd5cea748"
       }
     },
     "@uppy-example/redux": {
@@ -89639,7 +89632,7 @@
         "eslint": "^7.22.0",
         "eslint-plugin-import": "^2.22.1",
         "eslint-plugin-jsdoc": "^35.4.1",
-        "eslint-plugin-prefer-arrow": "*",
+        "eslint-plugin-prefer-arrow": "latest",
         "jasmine-core": "~3.6.0",
         "jasmine-spec-reporter": "~5.0.0",
         "karma": "~6.1.0",
@@ -89693,7 +89686,6 @@
         "@uppy/utils": "file:../utils",
         "@uppy/xhr-upload": "file:../xhr-upload",
         "nanoid": "^3.1.23",
-        "qs-stringify": "^1.1.0",
         "whatwg-fetch": "3.6.2"
       }
     },
@@ -89964,8 +89956,7 @@
       "version": "file:packages/@uppy/companion-client",
       "requires": {
         "@uppy/utils": "file:../utils",
-        "namespace-emitter": "^2.0.1",
-        "qs-stringify": "^1.1.0"
+        "namespace-emitter": "^2.0.1"
       }
     },
     "@uppy/core": {
@@ -93692,7 +93683,7 @@
         "eslint": "^7.22.0",
         "eslint-plugin-import": "^2.22.1",
         "eslint-plugin-jsdoc": "^35.4.1",
-        "eslint-plugin-prefer-arrow": "*",
+        "eslint-plugin-prefer-arrow": "latest",
         "jasmine-core": "~3.6.0",
         "jasmine-spec-reporter": "~5.0.0",
         "karma": "~6.1.0",
@@ -126399,11 +126390,6 @@
       "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
       "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
     },
-    "qs-stringify": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/qs-stringify/-/qs-stringify-1.2.1.tgz",
-      "integrity": "sha512-2N5xGLGZUxpgAYq1fD1LmBSCbxQVsXYt5JU0nU3FuPWO8PlCnKNFQwXkZgyB6mrTdg7IbexX4wxIR403dJw9pw=="
-    },
     "query-selector-shadow-dom": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/query-selector-shadow-dom/-/query-selector-shadow-dom-1.0.0.tgz",
@@ -135359,7 +135345,7 @@
         "hexo": "4.2.1",
         "hexo-browsersync": "^0.3.0",
         "hexo-cli": "3.1.0",
-        "hexo-filter-github-emojis": "git+ssh://git@github.com/arturi/hexo-filter-github-emojis.git#c0b188687b47669d0aa452d6f9adbb7487925baf",
+        "hexo-filter-github-emojis": "arturi/hexo-filter-github-emojis",
         "hexo-generator-alias": "^0.1.3",
         "hexo-generator-archive": "^1.0.0",
         "hexo-generator-category": "^1.0.0",

+ 1 - 2
packages/@uppy/aws-s3/package.json

@@ -25,8 +25,7 @@
     "@uppy/companion-client": "file:../companion-client",
     "@uppy/utils": "file:../utils",
     "@uppy/xhr-upload": "file:../xhr-upload",
-    "nanoid": "^3.1.23",
-    "qs-stringify": "^1.1.0"
+    "nanoid": "^3.1.23"
   },
   "devDependencies": {
     "whatwg-fetch": "3.6.2"

+ 6 - 8
packages/@uppy/aws-s3/src/index.js

@@ -31,7 +31,6 @@ const { RateLimitedQueue, internalRateLimitedQueue } = require('@uppy/utils/lib/
 const settle = require('@uppy/utils/lib/settle')
 const hasProperty = require('@uppy/utils/lib/hasProperty')
 const { RequestClient } = require('@uppy/companion-client')
-const qsStringify = require('qs-stringify')
 const MiniXHRUpload = require('./MiniXHRUpload')
 const isXml = require('./isXml')
 
@@ -102,14 +101,13 @@ module.exports = class AwsS3 extends BasePlugin {
 
     const filename = file.meta.name
     const { type } = file.meta
-    const metadata = {}
-    this.opts.metaFields.forEach((key) => {
-      if (file.meta[key] != null) {
-        metadata[key] = file.meta[key].toString()
-      }
-    })
+    const metadata = Object.fromEntries(
+      this.opts.metaFields
+        .filter(key => file.meta[key] != null)
+        .map(key => [`metadata[${key}]`, file.meta[key].toString()])
+    )
 
-    const query = qsStringify({ filename, type, metadata })
+    const query = new URLSearchParams({ filename, type, ...metadata })
     return this.client.get(`s3/params?${query}`)
       .then(assertServerError)
   }

+ 1 - 2
packages/@uppy/companion-client/package.json

@@ -22,7 +22,6 @@
   },
   "dependencies": {
     "@uppy/utils": "file:../utils",
-    "namespace-emitter": "^2.0.1",
-    "qs-stringify": "^1.1.0"
+    "namespace-emitter": "^2.0.1"
   }
 }

+ 1 - 4
packages/@uppy/companion-client/src/Provider.js

@@ -1,6 +1,5 @@
 'use strict'
 
-const qsStringify = require('qs-stringify')
 const RequestClient = require('./RequestClient')
 const tokenStorage = require('./tokenStorage')
 
@@ -59,9 +58,7 @@ module.exports = class Provider extends RequestClient {
       queries.uppyPreAuthToken = this.preAuthToken
     }
 
-    let strigifiedQueries = qsStringify(queries)
-    strigifiedQueries = strigifiedQueries ? `?${strigifiedQueries}` : strigifiedQueries
-    return `${this.hostname}/${this.id}/connect${strigifiedQueries}`
+    return `${this.hostname}/${this.id}/connect?${new URLSearchParams(queries)}`
   }
 
   fileUrl (id) {