Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install missing sha.js dependency #2283

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- `apollo-env`
- <First `apollo-env` related entry goes here>
- `apollo-graphql`
- <First `apollo-graphql` related entry goes here>
- Add missing `sha.js` dependency [PR #2283](https://github.com/apollographql/apollo-tooling/pull/2283)
- `apollo-language-server`
- <First `apollo-language-server` related entry goes here>
- `apollo-tools`
Expand Down
12 changes: 11 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"@types/nock": "10.0.3",
"@types/node": "8.10.66",
"@types/node-fetch": "2.5.10",
"@types/sha.js": "2.4.0",
"@types/table": "6.0.0",
"cross-env": "7.0.3",
"graphql": "15.2.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/apollo-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"dependencies": {
"core-js-pure": "^3.10.2",
"lodash.sortby": "^4.7.0"
"lodash.sortby": "^4.7.0",
"sha.js": "^2.4.11"
},
"peerDependencies": {
"graphql": "^14.2.1 || ^15.0.0"
Expand Down
7 changes: 5 additions & 2 deletions packages/apollo-graphql/src/utilities/createHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ export function createHash(kind: string): import("crypto").Hash {
if (isNodeLike) {
// Use module.require instead of just require to avoid bundling whatever
// crypto polyfills a non-Node bundler might fall back to.
return module.require("crypto").createHash(kind);
return (module.require("crypto") as typeof import("crypto")).createHash(
kind
);
}
return require("sha.js")(kind);

return (require("sha.js") as typeof import("sha.js"))(kind);
}