mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 05:14:44 +00:00
.
This commit is contained in:
parent
fc725ba36b
commit
422b9fdb15
7395 changed files with 1786235 additions and 3476 deletions
33
node_modules/parse-json/index.js
generated
vendored
Normal file
33
node_modules/parse-json/index.js
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
const errorEx = require('error-ex');
|
||||
const fallback = require('json-parse-better-errors');
|
||||
|
||||
const JSONError = errorEx('JSONError', {
|
||||
fileName: errorEx.append('in %s')
|
||||
});
|
||||
|
||||
module.exports = (input, reviver, filename) => {
|
||||
if (typeof reviver === 'string') {
|
||||
filename = reviver;
|
||||
reviver = null;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
return JSON.parse(input, reviver);
|
||||
} catch (err) {
|
||||
fallback(input, reviver);
|
||||
|
||||
throw err;
|
||||
}
|
||||
} catch (err) {
|
||||
err.message = err.message.replace(/\n/g, '');
|
||||
|
||||
const jsonErr = new JSONError(err);
|
||||
if (filename) {
|
||||
jsonErr.fileName = filename;
|
||||
}
|
||||
|
||||
throw jsonErr;
|
||||
}
|
||||
};
|
9
node_modules/parse-json/license
generated
vendored
Normal file
9
node_modules/parse-json/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
47
node_modules/parse-json/package.json
generated
vendored
Normal file
47
node_modules/parse-json/package.json
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "parse-json",
|
||||
"version": "4.0.0",
|
||||
"description": "Parse JSON with more helpful errors",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/parse-json",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"vendor"
|
||||
],
|
||||
"keywords": [
|
||||
"parse",
|
||||
"json",
|
||||
"graceful",
|
||||
"error",
|
||||
"message",
|
||||
"humanize",
|
||||
"friendly",
|
||||
"helpful",
|
||||
"string",
|
||||
"str"
|
||||
],
|
||||
"dependencies": {
|
||||
"error-ex": "^1.3.1",
|
||||
"json-parse-better-errors": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"nyc": "^11.2.1",
|
||||
"xo": "*"
|
||||
}
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz"
|
||||
,"_integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA="
|
||||
,"_from": "parse-json@4.0.0"
|
||||
}
|
83
node_modules/parse-json/readme.md
generated
vendored
Normal file
83
node_modules/parse-json/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
# parse-json [](https://travis-ci.org/sindresorhus/parse-json)
|
||||
|
||||
> Parse JSON with more helpful errors
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install parse-json
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const parseJson = require('parse-json');
|
||||
const json = '{\n\t"foo": true,\n}';
|
||||
|
||||
|
||||
JSON.parse(json);
|
||||
/*
|
||||
undefined:3
|
||||
}
|
||||
^
|
||||
SyntaxError: Unexpected token }
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json);
|
||||
/*
|
||||
JSONError: Trailing comma in object at 3:1
|
||||
}
|
||||
^
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json, 'foo.json');
|
||||
/*
|
||||
JSONError: Trailing comma in object in foo.json:3:1
|
||||
}
|
||||
^
|
||||
*/
|
||||
|
||||
|
||||
// You can also add the filename at a later point
|
||||
try {
|
||||
parseJson(json);
|
||||
} catch (err) {
|
||||
err.fileName = 'foo.json';
|
||||
throw err;
|
||||
}
|
||||
/*
|
||||
JSONError: Trailing comma in object in foo.json:3:1
|
||||
}
|
||||
^
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### parseJson(input, [reviver], [filename])
|
||||
|
||||
#### input
|
||||
|
||||
Type: `string`
|
||||
|
||||
#### reviver
|
||||
|
||||
Type: `Function`
|
||||
|
||||
Prescribes how the value originally produced by parsing is transformed, before being returned. See [`JSON.parse` docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#Using_the_reviver_parameter
|
||||
) for more.
|
||||
|
||||
#### filename
|
||||
|
||||
Type: `string`
|
||||
|
||||
Filename displayed in the error message.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
Loading…
Add table
Add a link
Reference in a new issue