Fix TypeError for invalid package.json dependencies
What does this MR do and why?
Contributes to #436953 (closed)
Problem
Linker expects the dependency files to be valid. However, they are created by users and not guaranteed to have a valid format.
Solution
Explicitly convert dependency values to String object before verification.
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
- Create a
package.json
file in the project with the following content
{
"name": "module-name",
"version": "10.3.1",
"repository": {
"type": "git",
"url": "https://github.com/vuejs/vue.git"
},
"homepage": "https://github.com/vuejs/vue#readme",
"scripts": {
"karma": "karma start config/karma.config.js --single-run"
},
"dependencies": {
"primus": "*",
"async": "~0.8.0",
"wrong": {
"key": "value"
},
"express": "4.2.x",
"bigpipe": "bigpipe/pagelet",
"plates": "https://github.com/flatiron/plates/tarball/master",
"karma": "^1.4.1",
"random": "git+https://EdOverflow@github.com/example/example.git"
},
"devDependencies": {
"vows": "^0.7.0",
"assume": "<1.0.0 || >=2.3.1 <2.4.5 || >=2.5.2 <3.0.0",
"pre-commit": "*"
},
"license": "MIT"
}
- Visit the latest commit page
- You should see diffs without any errors