Skip to content

Commit

Permalink
chore: upgrade (most) dev deps (#797)
Browse files Browse the repository at this point in the history
* chore: upgrade (most) dev deps
* chore: upgrade to latest flow 256
- fix code issues related to flow
  • Loading branch information
yoavniran authored Dec 8, 2024
1 parent b4d6d7a commit 2770f8d
Show file tree
Hide file tree
Showing 47 changed files with 1,280 additions and 856 deletions.
118 changes: 59 additions & 59 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,101 +55,101 @@
"url": "https://opencollective.com/react-uploady"
},
"devDependencies": {
"@actions/core": "^1.10.1",
"@actions/core": "^1.11.1",
"@actions/github": "^6.0.0",
"@babel/cli": "^7.25.6",
"@babel/core": "^7.25.2",
"@babel/plugin-proposal-export-default-from": "^7.24.7",
"@babel/plugin-proposal-function-bind": "^7.24.7",
"@babel/plugin-transform-runtime": "^7.25.4",
"@babel/preset-env": "^7.25.4",
"@babel/preset-flow": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@babel/runtime-corejs3": "^7.25.6",
"@babel/cli": "^7.26.4",
"@babel/core": "^7.26.0",
"@babel/plugin-proposal-export-default-from": "^7.25.9",
"@babel/plugin-proposal-function-bind": "^7.25.9",
"@babel/plugin-transform-runtime": "^7.25.9",
"@babel/preset-env": "^7.26.0",
"@babel/preset-flow": "^7.25.9",
"@babel/preset-react": "^7.26.3",
"@babel/runtime-corejs3": "^7.26.0",
"@bunchtogether/vite-plugin-flow": "^1.0.2",
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"@commitlint/config-lerna-scopes": "^19.5.0",
"@eslint/js": "^9.14.0",
"@eslint/js": "^9.16.0",
"@monorepo-utils/package-utils": "^2.10.4",
"@storybook/addon-docs": "^8.4.2",
"@storybook/addon-essentials": "^8.4.2",
"@storybook/addon-interactions": "^8.4.2",
"@storybook/addon-links": "^8.4.2",
"@storybook/addon-docs": "^8.4.7",
"@storybook/addon-essentials": "^8.4.7",
"@storybook/addon-interactions": "^8.4.7",
"@storybook/addon-links": "^8.4.7",
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
"@storybook/blocks": "^8.4.2",
"@storybook/preview-api": "^8.4.2",
"@storybook/react": "^8.4.2",
"@storybook/react-webpack5": "^8.4.2",
"@storybook/test": "^8.4.2",
"@storybook/theming": "^8.4.2",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@storybook/blocks": "^8.4.7",
"@storybook/preview-api": "^8.4.7",
"@storybook/react": "^8.4.7",
"@storybook/react-webpack5": "^8.4.7",
"@storybook/test": "^8.4.7",
"@storybook/theming": "^8.4.7",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.3",
"@vitest/coverage-istanbul": "^2.0.5",
"@vitest/coverage-v8": "^2.1.4",
"@vitest/ui": "^2.1.4",
"async": "^3.2.5",
"babel-loader": "^9.1.3",
"@types/react": "^18.3.14",
"@vitest/coverage-istanbul": "^2.1.8",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"async": "^3.2.6",
"babel-loader": "^9.2.1",
"babel-plugin-istanbul": "^7.0.0",
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
"babel-plugin-module-resolver": "^5.0.2",
"babel-plugin-syntax-hermes-parser": "^0.23.1",
"babel-plugin-syntax-hermes-parser": "^0.25.1",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"bundlesize": "^0.18.2",
"bytes": "^3.1.2",
"chai": "^5.1.1",
"chai": "^5.1.2",
"chai-dom": "^1.12.0",
"chalk": "^5.3.0",
"concurrently": "^8.2.2",
"core-js": "^3.37.1",
"cypress": "^13.14.1",
"concurrently": "^9.1.0",
"core-js": "^3.39.0",
"cypress": "^13.16.1",
"cypress-intercept-formdata": "^0.6.0",
"cypress-mochawesome-reporter": "^3.8.2",
"cypress-multi-reporters": "^1.6.4",
"eslint": "^9.14.0",
"cypress-multi-reporters": "^2.0.4",
"eslint": "^9.16.0",
"eslint-plugin-ft-flow": "^3.0.11",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-no-async": "^1.2.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-storybook": "^0.11.0",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-storybook": "^0.11.1",
"eslint-plugin-vitest": "^0.5.4",
"execa": "^9.3.0",
"filesize": "^10.1.4",
"flow-bin": "^0.245.1",
"execa": "^9.5.2",
"filesize": "^10.1.6",
"flow-bin": "^0.256",
"fs-extra": "^11.2.0",
"glob": "^11.0.0",
"globals": "^15.12.0",
"hermes-eslint": "^0.25.0",
"html-webpack-plugin": "^5.6.0",
"globals": "^15.13.0",
"hermes-eslint": "^0.25.1",
"html-webpack-plugin": "^5.6.3",
"http-server": "^14.1.1",
"husky": "^9.1.1",
"jsdom": "^24.1.1",
"lerna": "^8.1.8",
"husky": "^9.1.7",
"jsdom": "^25.0.1",
"lerna": "^8.1.9",
"license-webpack-plugin": "^4.0.2",
"lodash": "^4.17.21",
"markdown-it": "^14.1.0",
"mocha-junit-reporter": "^2.2.1",
"pacote": "^18.0.6",
"pacote": "^21.0.0",
"rc-progress": "^4.0.0",
"react": "^18.3.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.3.1",
"react-icons": "^5.0.1",
"rimraf": "^5.0.5",
"react-icons": "^5.4.0",
"rimraf": "^6.0.1",
"semver-utils": "^1.1.4",
"shelljs": "^0.8.5",
"storybook": "^8.4.2",
"styled-components": "^6.1.12",
"typescript": "^5.3.3",
"typescript-eslint": "^8.13.0",
"storybook": "^8.4.7",
"styled-components": "^6.1.13",
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0",
"vite": "^5.4.10",
"vite-plugin-babel": "^1.2.0",
"vitest": "^2.1.4",
"wait-on": "^7.2.0",
"vite-plugin-babel": "^1.3.0",
"vitest": "^2.1.8",
"wait-on": "^8.0.1",
"weak-napi": "^2.0.2",
"webpack": "5",
"webpack-cli": "5",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/abort/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@rpldy/simple-state": "^1.9.0-rc.1"
},
"devDependencies": {
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/chunked-sender/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
"devDependencies": {
"@rpldy/life-events": "^1.9.0-rc.1",
"@rpldy/uploader": "^1.9.0-rc.1",
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
}
}
19 changes: 10 additions & 9 deletions packages/core/chunked-sender/src/chunkedSender/sendChunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,21 @@ const uploadChunkWithUpdatedData = (
onProgress,
})
// $FlowFixMe - https://github.com/facebook/flow/issues/8215
.then((updatedData: ChunkStartEventData & boolean) => {
const skipChunk = (updatedData === false);
.then((response: ChunkStartEventData | boolean) => {
let result;
const updatedData = typeof response === "boolean" ? (response === false ? { stop: true } : {}) : (response || {});

if (skipChunk) {
if (updatedData.stop) {
logger.debugLog(`chunkedSender.sendChunk: received false from CHUNK_START handler - skipping chunk ${chunkIndex}, item ${item.id}`);
}

return skipChunk ?
getSkippedResult() :
//upload the chunk to the server
xhrSend([chunkItem],
result = getSkippedResult();
} else {
result = xhrSend([chunkItem],
updatedData?.url || state.url,
mergeWithUndefined({}, sendOptions, updatedData?.sendOptions),
onChunkProgress);
}

return result;
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,16 @@ describe("sendChunk tests", () => {
expect(sendResult.abort()).toBe(true);
});

it("should throw if failed to slice chunk", () => {
it("shouldn't skip chunk when even updated returns true", async () => {
const { result } = await testSendChunk({ size: 9 }, true);

expect(result).toEqual({ xhrSend: true });

expect(xhrSend.mock.calls[0][1]).toBe("test.com");
expect(xhrSend.mock.calls[0][2].headers["Content-Range"]).toBeDefined();
});

it("should throw if failed to slice chunk", () => {
getChunkDataFromFile.mockReturnValueOnce(null);
const chunk = { id: "c1", start: 1, end: 10, data: null };

Expand Down
2 changes: 1 addition & 1 deletion packages/core/life-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@rpldy/shared": "^1.9.0-rc.1"
},
"devDependencies": {
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/mock-sender/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"@rpldy/sender": "^1.9.0-rc.1",
"@rpldy/uploader": "^1.9.0-rc.1",
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/raw-uploader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@rpldy/shared": "^1.9.0-rc.1"
},
"devDependencies": {
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/retry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@rpldy/uploader": "^1.9.0-rc.1"
},
"devDependencies": {
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/safe-storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@rpldy/shared": "^1.9.0-rc.1"
},
"devDependencies": {
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/sender/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@rpldy/shared": "^1.9.0-rc.1"
},
"devDependencies": {
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"build": "node ../../../scripts/build.mjs"
},
"devDependencies": {
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
},
"dependencies": {
"invariant": "^2.2.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/shared/src/tests/triggerCancellable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ describe("triggerCancellable tests", () => {
it("should throw when rejected", async () => {
trigger.mockImplementationOnce(() => [Promise.reject("baaa")]);

expect(triggerCancellable(trigger, "test")).rejects.toBe("baaa");
await expect(triggerCancellable(trigger, "test")).rejects.toBe("baaa");
});
});
2 changes: 1 addition & 1 deletion packages/core/shared/src/tests/triggerUpdater.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ describe("triggerUpdater tests", () => {
it("should throw when rejected", async () => {
trigger.mockImplementationOnce(() => [Promise.reject("baaa")]);

expect(triggerUpdater(trigger, "test")).rejects.toBe("baaa");
await expect(triggerUpdater(trigger, "test")).rejects.toBe("baaa");
});
});
2 changes: 1 addition & 1 deletion packages/core/simple-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@rpldy/shared": "^1.9.0-rc.1"
},
"devDependencies": {
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/tus-sender/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
"devDependencies": {
"@rpldy/life-events": "^1.9.0-rc.1",
"@rpldy/uploader": "^1.9.0-rc.1",
"flow-bin": "^0.245.1"
"flow-bin": "^0.256.0"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,15 @@ const getUpdatedRequest = (
resumeHeaders: unwrap(options.resumeHeaders),
})
// $FlowIssue - https://github.com/facebook/flow/issues/8215
.then((updatedData: ResumeStartEventResponse & boolean) => {
const cancelResume = updatedData === false;
.then((response: ResumeStartEventResponse | boolean) => {
let result;

if (cancelResume) {
logger.debugLog(`tusSender.resume: received false from TUS RESUME_START event - cancelling resume attempt for item: ${item.id}`);
}
const updatedData = typeof response === "boolean" ? (response === false ? { stop: true } : {}) : (response || {});

const updatedRequest = cancelResume ?
false :
request(
if (updatedData.stop) {
logger.debugLog(`tusSender.resume: received false from TUS RESUME_START event - cancelling resume attempt for item: ${item.id}`);
} else {
result = request(
updatedData?.url || url,
null,
{
Expand All @@ -130,8 +129,9 @@ const getUpdatedRequest = (
options.resumeHeaders,
updatedData?.resumeHeaders)
});
}

return () => updatedRequest;
return () => result;
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,18 @@ describe("resumeUpload tests", () => {
});
});

it("should resume when handler response is boolean true", async () => {
const { request } = await testResume({}, null, true);

expect(request).toHaveBeenCalledWith("upload.url", null ,{
method: "HEAD",
headers: {
"tus-resumable": "1",
"x-test": "123",
}
});
});

it("should cancel resume from start event handler", async () => {
const { request, response } = await testResume({}, null, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("finalizeParallelUpload tests", () => {
expect(request).not.toHaveBeenCalled();
});

it("should throw if parallel chunks dont match state items", () => {
it("should throw if parallel chunks dont match state items", async () => {
const item = { id: "i1" };

const tusState = createMockState({
Expand All @@ -58,7 +58,7 @@ describe("finalizeParallelUpload tests", () => {
}
});

expect(handleParallelTusUpload(item, null, tusState, null, Promise.resolve({
await expect(handleParallelTusUpload(item, null, tusState, null, Promise.resolve({
state: FILE_STATES.FINISHED
}))).rejects.toThrow(`tusSender: something went wrong. found 3 upload urls for 2 parts`);
});
Expand Down
Loading

0 comments on commit 2770f8d

Please sign in to comment.