scratch-storage 1.3.5 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "scratch-storage",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "Load and store project and asset files for Scratch 3.0",
5
5
  "license": "BSD-3-Clause",
6
6
  "homepage": "https://github.com/LLK/scratch-storage#readme",
7
7
  "repository": {
8
8
  "type": "git",
9
9
  "url": "https://github.com/LLK/scratch-storage.git",
10
- "sha": "fbce0ee3707807015cd463136b28f7d91b65dd2e"
10
+ "sha": "90204e8c430a14deb1dfc3cb3f279eb02e5d8c91"
11
11
  },
12
12
  "main": "./dist/node/scratch-storage.js",
13
13
  "browser": "./src/index.js",
@@ -33,27 +33,27 @@
33
33
  "worker-loader": "^2.0.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@babel/core": "^7.14.3",
37
- "@babel/polyfill": "7.4.3",
38
- "@babel/preset-env": "^7.4.3",
36
+ "@babel/core": "7.14.8",
37
+ "@babel/polyfill": "7.12.1",
38
+ "@babel/preset-env": "7.14.8",
39
39
  "@commitlint/cli": "8.2.0",
40
40
  "@commitlint/config-conventional": "8.2.0",
41
41
  "@commitlint/travis-cli": "8.2.0",
42
42
  "babel-eslint": "10.1.0",
43
- "babel-loader": "^8.2.2",
44
- "cz-conventional-changelog": "^3.0.2",
45
- "eslint": "^7.13.0",
46
- "eslint-config-scratch": "^6.0.0",
47
- "eslint-plugin-react": "^7.20.0",
43
+ "babel-loader": "8.0.6",
44
+ "cz-conventional-changelog": "3.3.0",
45
+ "eslint": "7.27.0",
46
+ "eslint-config-scratch": "6.0.0",
47
+ "eslint-plugin-react": "7.24.0",
48
48
  "file-loader": "4.1.0",
49
49
  "husky": "1.3.1",
50
50
  "json": "^9.0.4",
51
- "node-fetch": "^2.6.1",
51
+ "node-fetch": "2.6.1",
52
52
  "semantic-release": "^15.10.5",
53
53
  "tap": "12.1.1",
54
- "uglifyjs-webpack-plugin": "^2.0.1",
55
- "webpack": "^4.8.0",
56
- "webpack-cli": "^3.3.12"
54
+ "uglifyjs-webpack-plugin": "2.2.0",
55
+ "webpack": "4.46.0",
56
+ "webpack-cli": "3.1.2"
57
57
  },
58
58
  "config": {
59
59
  "commitizen": {
package/renovate.json5 ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+
4
+ "extends": [
5
+ "github>LLK/scratch-renovate-config:conservative"
6
+ ]
7
+ }
@@ -1,7 +1,5 @@
1
1
  const md5 = require('js-md5');
2
2
  const test = require('tap').test;
3
- // Polyfill the fetch API
4
- global.fetch = require('node-fetch');
5
3
 
6
4
  const ScratchStorage = require('../../dist/node/scratch-storage');
7
5
 
@@ -18,6 +16,7 @@ test('constructor', t => {
18
16
  * @typedef {object} AssetTestInfo
19
17
  * @property {AssetType} type - The type of the asset.
20
18
  * @property {string} id - The asset's unique ID.
19
+ * @property {string} md5 - The asset's MD5 hash.
21
20
  * @property {DataFormat} [ext] - Optional: the asset's data format / file extension.
22
21
  */
23
22
  const testAssets = [
package/webpack.config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const path = require('path');
2
+ const {ProvidePlugin} = require('webpack');
2
3
  const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
3
4
 
4
5
  const base = {
@@ -64,6 +65,11 @@ module.exports = [
64
65
  'js-md5': true,
65
66
  'localforage': true,
66
67
  'text-encoding': true
67
- }
68
+ },
69
+ plugins: [
70
+ new ProvidePlugin({
71
+ fetch: ['node-fetch', 'default']
72
+ })
73
+ ]
68
74
  })
69
75
  ];
@@ -1,188 +0,0 @@
1
- /******/ (function(modules) { // webpackBootstrap
2
- /******/ // The module cache
3
- /******/ var installedModules = {};
4
- /******/
5
- /******/ // The require function
6
- /******/ function __webpack_require__(moduleId) {
7
- /******/
8
- /******/ // Check if module is in cache
9
- /******/ if(installedModules[moduleId]) {
10
- /******/ return installedModules[moduleId].exports;
11
- /******/ }
12
- /******/ // Create a new module (and put it into the cache)
13
- /******/ var module = installedModules[moduleId] = {
14
- /******/ i: moduleId,
15
- /******/ l: false,
16
- /******/ exports: {}
17
- /******/ };
18
- /******/
19
- /******/ // Execute the module function
20
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
- /******/
22
- /******/ // Flag the module as loaded
23
- /******/ module.l = true;
24
- /******/
25
- /******/ // Return the exports of the module
26
- /******/ return module.exports;
27
- /******/ }
28
- /******/
29
- /******/
30
- /******/ // expose the modules object (__webpack_modules__)
31
- /******/ __webpack_require__.m = modules;
32
- /******/
33
- /******/ // expose the module cache
34
- /******/ __webpack_require__.c = installedModules;
35
- /******/
36
- /******/ // define getter function for harmony exports
37
- /******/ __webpack_require__.d = function(exports, name, getter) {
38
- /******/ if(!__webpack_require__.o(exports, name)) {
39
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
40
- /******/ }
41
- /******/ };
42
- /******/
43
- /******/ // define __esModule on exports
44
- /******/ __webpack_require__.r = function(exports) {
45
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47
- /******/ }
48
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
49
- /******/ };
50
- /******/
51
- /******/ // create a fake namespace object
52
- /******/ // mode & 1: value is a module id, require it
53
- /******/ // mode & 2: merge all properties of value into the ns
54
- /******/ // mode & 4: return value when already ns object
55
- /******/ // mode & 8|1: behave like require
56
- /******/ __webpack_require__.t = function(value, mode) {
57
- /******/ if(mode & 1) value = __webpack_require__(value);
58
- /******/ if(mode & 8) return value;
59
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60
- /******/ var ns = Object.create(null);
61
- /******/ __webpack_require__.r(ns);
62
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64
- /******/ return ns;
65
- /******/ };
66
- /******/
67
- /******/ // getDefaultExport function for compatibility with non-harmony modules
68
- /******/ __webpack_require__.n = function(module) {
69
- /******/ var getter = module && module.__esModule ?
70
- /******/ function getDefault() { return module['default']; } :
71
- /******/ function getModuleExports() { return module; };
72
- /******/ __webpack_require__.d(getter, 'a', getter);
73
- /******/ return getter;
74
- /******/ };
75
- /******/
76
- /******/ // Object.prototype.hasOwnProperty.call
77
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78
- /******/
79
- /******/ // __webpack_public_path__
80
- /******/ __webpack_require__.p = "";
81
- /******/
82
- /******/
83
- /******/ // Load entry module and return exports
84
- /******/ return __webpack_require__(__webpack_require__.s = "./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js");
85
- /******/ })
86
- /************************************************************************/
87
- /******/ ({
88
-
89
- /***/ "./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js":
90
- /*!*******************************************************************************!*\
91
- !*** ./node_modules/babel-loader/lib??ref--4!./src/FetchWorkerTool.worker.js ***!
92
- \*******************************************************************************/
93
- /*! no static exports found */
94
- /***/ (function(module, exports) {
95
-
96
- /* eslint-env worker */
97
- var jobsActive = 0;
98
- var complete = [];
99
- var intervalId = null;
100
- /**
101
- * Register a step function.
102
- *
103
- * Step checks if there are completed jobs and if there are sends them to the
104
- * parent. Then it checks the jobs count. If there are no further jobs, clear
105
- * the step.
106
- */
107
-
108
- var registerStep = function registerStep() {
109
- intervalId = setInterval(function () {
110
- if (complete.length) {
111
- // Send our chunk of completed requests and instruct postMessage to
112
- // transfer the buffers instead of copying them.
113
- postMessage(complete.slice(), // Instruct postMessage that these buffers in the sent message
114
- // should use their Transferable trait. After the postMessage
115
- // call the "buffers" will still be in complete if you looked,
116
- // but they will all be length 0 as the data they reference has
117
- // been sent to the window. This lets us send a lot of data
118
- // without the normal postMessage behaviour of making a copy of
119
- // all of the data for the window.
120
- complete.map(function (response) {
121
- return response.buffer;
122
- }).filter(Boolean));
123
- complete.length = 0;
124
- }
125
-
126
- if (jobsActive === 0) {
127
- clearInterval(intervalId);
128
- intervalId = null;
129
- }
130
- }, 1);
131
- };
132
- /**
133
- * Receive a job from the parent and fetch the requested data.
134
- * @param {object} options.job A job id, url, and options descriptor to perform.
135
- */
136
-
137
-
138
- var onMessage = function onMessage(_ref) {
139
- var job = _ref.data;
140
-
141
- if (jobsActive === 0 && !intervalId) {
142
- registerStep();
143
- }
144
-
145
- jobsActive++;
146
- fetch(job.url, job.options).then(function (response) {
147
- return response.arrayBuffer();
148
- }).then(function (buffer) {
149
- return complete.push({
150
- id: job.id,
151
- buffer: buffer
152
- });
153
- }).catch(function (error) {
154
- return complete.push({
155
- id: job.id,
156
- error: error
157
- });
158
- }).then(function () {
159
- return jobsActive--;
160
- });
161
- };
162
-
163
- if (self.fetch) {
164
- postMessage({
165
- support: {
166
- fetch: true
167
- }
168
- });
169
- self.addEventListener('message', onMessage);
170
- } else {
171
- postMessage({
172
- support: {
173
- fetch: false
174
- }
175
- });
176
- self.addEventListener('message', function (_ref2) {
177
- var job = _ref2.data;
178
- postMessage([{
179
- id: job.id,
180
- error: new Error('fetch is unavailable')
181
- }]);
182
- });
183
- }
184
-
185
- /***/ })
186
-
187
- /******/ });
188
- //# sourceMappingURL=4816ce2aa9bf12df8b86.worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"4816ce2aa9bf12df8b86.worker.js","sources":["webpack://ScratchStorage/webpack/bootstrap","webpack://ScratchStorage/./src/FetchWorkerTool.worker.js"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js\");\n","/* eslint-env worker */\n\nlet jobsActive = 0;\nconst complete = [];\n\nlet intervalId = null;\n\n/**\n * Register a step function.\n *\n * Step checks if there are completed jobs and if there are sends them to the\n * parent. Then it checks the jobs count. If there are no further jobs, clear\n * the step.\n */\nconst registerStep = function () {\n intervalId = setInterval(() => {\n if (complete.length) {\n // Send our chunk of completed requests and instruct postMessage to\n // transfer the buffers instead of copying them.\n postMessage(\n complete.slice(),\n // Instruct postMessage that these buffers in the sent message\n // should use their Transferable trait. After the postMessage\n // call the \"buffers\" will still be in complete if you looked,\n // but they will all be length 0 as the data they reference has\n // been sent to the window. This lets us send a lot of data\n // without the normal postMessage behaviour of making a copy of\n // all of the data for the window.\n complete.map(response => response.buffer).filter(Boolean)\n );\n complete.length = 0;\n }\n if (jobsActive === 0) {\n clearInterval(intervalId);\n intervalId = null;\n }\n }, 1);\n};\n\n/**\n * Receive a job from the parent and fetch the requested data.\n * @param {object} options.job A job id, url, and options descriptor to perform.\n */\nconst onMessage = ({data: job}) => {\n if (jobsActive === 0 && !intervalId) {\n registerStep();\n }\n\n jobsActive++;\n\n fetch(job.url, job.options)\n .then(response => response.arrayBuffer())\n .then(buffer => complete.push({id: job.id, buffer}))\n .catch(error => complete.push({id: job.id, error}))\n .then(() => jobsActive--);\n};\n\nif (self.fetch) {\n postMessage({support: {fetch: true}});\n self.addEventListener('message', onMessage);\n} else {\n postMessage({support: {fetch: false}});\n self.addEventListener('message', ({data: job}) => {\n postMessage([{id: job.id, error: new Error('fetch is unavailable')}]);\n });\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AClFA;AAEA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAEA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AADA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;;;;A","sourceRoot":""}