From 552ed888fce931f47062afe83d90b7cd71492d57 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 Dec 2024 19:01:41 +0000 Subject: [PATCH 1/4] fix(deps): update dependency scratch-storage to v4 --- package-lock.json | 67 ++++++++++++++++++++++++++++++++++++++++------- package.json | 2 +- 2 files changed, 58 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index d2d623236e1..627f0b754f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "react-twitter-embed": "3.0.3", "react-use": "17.6.0", "scratch-parser": "6.0.0", - "scratch-storage": "2.3.284" + "scratch-storage": "4.0.23" }, "devDependencies": { "@babel/cli": "7.26.4", @@ -4745,6 +4745,7 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, "license": "MIT", "peerDependencies": { "ajv": "^6.9.1" @@ -6203,7 +6204,6 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, "funding": [ { "type": "github", @@ -7593,6 +7593,7 @@ "version": "3.1.8", "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", + "dev": true, "license": "MIT", "dependencies": { "node-fetch": "^2.6.12" @@ -13223,7 +13224,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, "funding": [ { "type": "github", @@ -22510,6 +22510,23 @@ "react": "^16.0.0" } }, + "node_modules/scratch-gui/node_modules/scratch-storage": { + "version": "2.3.284", + "resolved": "https://registry.npmjs.org/scratch-storage/-/scratch-storage-2.3.284.tgz", + "integrity": "sha512-GlMSCQtP3O+Sd8504Q7P19OKB92i5v5k5oHBgaBoYCksxSLK3477Zw6c5wKRPa6314sqrmo/EAGxW3QZeoc9Yw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/runtime": "^7.21.0", + "arraybuffer-loader": "^1.0.3", + "base64-js": "^1.3.0", + "cross-fetch": "^3.1.5", + "fastestsmallesttextencoderdecoder": "^1.0.7", + "js-md5": "^0.7.3", + "minilog": "^3.1.0", + "worker-loader": "^2.0.0" + } + }, "node_modules/scratch-l10n": { "version": "5.0.51", "resolved": "https://registry.npmjs.org/scratch-l10n/-/scratch-l10n-5.0.51.tgz", @@ -22676,19 +22693,28 @@ } }, "node_modules/scratch-storage": { - "version": "2.3.284", - "resolved": "https://registry.npmjs.org/scratch-storage/-/scratch-storage-2.3.284.tgz", - "integrity": "sha512-GlMSCQtP3O+Sd8504Q7P19OKB92i5v5k5oHBgaBoYCksxSLK3477Zw6c5wKRPa6314sqrmo/EAGxW3QZeoc9Yw==", - "license": "BSD-3-Clause", + "version": "4.0.23", + "resolved": "https://registry.npmjs.org/scratch-storage/-/scratch-storage-4.0.23.tgz", + "integrity": "sha512-OQj7VoEOceUwt+8scm8kg0GK45jS0HXh/uzk3dHrtqVfCdDDqdylJrRcUpGavSmm2Y/YIPSKp8Qkxuwl8mXe8g==", + "license": "AGPL-3.0-only", "dependencies": { "@babel/runtime": "^7.21.0", "arraybuffer-loader": "^1.0.3", "base64-js": "^1.3.0", - "cross-fetch": "^3.1.5", + "buffer": "6.0.3", + "cross-fetch": "^4.0.0", "fastestsmallesttextencoderdecoder": "^1.0.7", "js-md5": "^0.7.3", - "minilog": "^3.1.0", - "worker-loader": "^2.0.0" + "minilog": "^3.1.0" + } + }, + "node_modules/scratch-storage/node_modules/cross-fetch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", + "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", + "license": "MIT", + "dependencies": { + "node-fetch": "^2.6.12" } }, "node_modules/scratch-storage/node_modules/microee": { @@ -22807,6 +22833,23 @@ "microee": "0.0.6" } }, + "node_modules/scratch-vm/node_modules/scratch-storage": { + "version": "2.3.284", + "resolved": "https://registry.npmjs.org/scratch-storage/-/scratch-storage-2.3.284.tgz", + "integrity": "sha512-GlMSCQtP3O+Sd8504Q7P19OKB92i5v5k5oHBgaBoYCksxSLK3477Zw6c5wKRPa6314sqrmo/EAGxW3QZeoc9Yw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/runtime": "^7.21.0", + "arraybuffer-loader": "^1.0.3", + "base64-js": "^1.3.0", + "cross-fetch": "^3.1.5", + "fastestsmallesttextencoderdecoder": "^1.0.7", + "js-md5": "^0.7.3", + "minilog": "^3.1.0", + "worker-loader": "^2.0.0" + } + }, "node_modules/screenfull": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/screenfull/-/screenfull-5.2.0.tgz", @@ -28634,6 +28677,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-2.0.0.tgz", "integrity": "sha512-tnvNp4K3KQOpfRnD20m8xltE3eWh89Ye+5oj7wXEEHKac1P4oZ6p9oTj8/8ExqoSBnk9nu5Pr4nKfQ1hn2APJw==", + "dev": true, "license": "MIT", "dependencies": { "loader-utils": "^1.0.0", @@ -28650,6 +28694,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, "license": "MIT", "dependencies": { "minimist": "^1.2.0" @@ -28662,6 +28707,7 @@ "version": "1.4.2", "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.4.2.tgz", "integrity": "sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxaxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==", + "dev": true, "license": "MIT", "dependencies": { "big.js": "^5.2.2", @@ -28676,6 +28722,7 @@ "version": "0.4.7", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==", + "dev": true, "license": "MIT", "dependencies": { "ajv": "^6.1.0", diff --git a/package.json b/package.json index 25f2fb43980..e2adb4a9122 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "react-twitter-embed": "3.0.3", "react-use": "17.6.0", "scratch-parser": "6.0.0", - "scratch-storage": "2.3.284" + "scratch-storage": "4.0.23" }, "devDependencies": { "@babel/cli": "7.26.4", From 691ee6c0ab4e9406375295cff7937896e07812e7 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:00:16 -0800 Subject: [PATCH 2/4] test: add failing test to flag scratch-storage API change --- test/unit/lib/storage.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/unit/lib/storage.test.js diff --git a/test/unit/lib/storage.test.js b/test/unit/lib/storage.test.js new file mode 100644 index 00000000000..0975de85bef --- /dev/null +++ b/test/unit/lib/storage.test.js @@ -0,0 +1,9 @@ +import storage from '../../../src/lib/storage'; + +describe('unit test lib/storage.js', () => { + test('storage construction', () => { + expect(storage).toBeDefined(); // also implies the import succeeded + expect(storage.addWebSource).toBeDefined(); // method on ScratchStorage + expect(storage.setProjectToken).toBeDefined(); // method added by GUI + }); +}); From 17dd85dfffadf373ae61e2b65f2816ada6b7ee76 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:01:19 -0800 Subject: [PATCH 3/4] fix: adjust to new scratch-storage API --- src/lib/storage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/storage.js b/src/lib/storage.js index ef5d6881064..c9fd5661757 100644 --- a/src/lib/storage.js +++ b/src/lib/storage.js @@ -1,4 +1,4 @@ -import ScratchStorage from 'scratch-storage'; +import {ScratchStorage} from 'scratch-storage'; const PROJECT_HOST = process.env.PROJECT_HOST || 'https://projects.scratch.mit.edu'; From 5273e7493ef6aa0215f002bd4332a46400c81266 Mon Sep 17 00:00:00 2001 From: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com> Date: Fri, 20 Dec 2024 10:03:27 -0800 Subject: [PATCH 4/4] refactor: fix scratch-storage deprecation warning --- src/lib/storage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/storage.js b/src/lib/storage.js index c9fd5661757..b24cd326b76 100644 --- a/src/lib/storage.js +++ b/src/lib/storage.js @@ -9,7 +9,7 @@ const PROJECT_HOST = process.env.PROJECT_HOST || 'https://projects.scratch.mit.e class Storage extends ScratchStorage { constructor () { super(); - this.addWebSource( + this.addWebStore( [this.AssetType.Project], this.getProjectGetConfig.bind(this) );