mirror of
https://github.com/actions/setup-python.git
synced 2025-06-28 21:53:47 +00:00
Fix.
This commit is contained in:
parent
7fe1ba03a3
commit
ec0a863019
7020 changed files with 1880198 additions and 489 deletions
67
node_modules/read-pkg/index.d.ts
generated
vendored
Normal file
67
node_modules/read-pkg/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
import * as typeFest from 'type-fest';
|
||||
import normalize = require('normalize-package-data');
|
||||
|
||||
declare namespace readPkg {
|
||||
interface Options {
|
||||
/**
|
||||
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
|
||||
|
||||
@default true
|
||||
*/
|
||||
readonly normalize?: boolean;
|
||||
|
||||
/**
|
||||
Current working directory.
|
||||
|
||||
@default process.cwd()
|
||||
*/
|
||||
readonly cwd?: string;
|
||||
}
|
||||
|
||||
interface NormalizeOptions extends Options {
|
||||
readonly normalize?: true;
|
||||
}
|
||||
|
||||
type NormalizedPackageJson = PackageJson & normalize.Package;
|
||||
type PackageJson = typeFest.PackageJson;
|
||||
}
|
||||
|
||||
declare const readPkg: {
|
||||
/**
|
||||
@returns The parsed JSON.
|
||||
|
||||
@example
|
||||
```
|
||||
import readPkg = require('read-pkg');
|
||||
|
||||
(async () => {
|
||||
console.log(await readPkg());
|
||||
//=> {name: 'read-pkg', …}
|
||||
|
||||
console.log(await readPkg({cwd: 'some-other-directory'});
|
||||
//=> {name: 'unicorn', …}
|
||||
})();
|
||||
```
|
||||
*/
|
||||
(options?: readPkg.NormalizeOptions): Promise<readPkg.NormalizedPackageJson>;
|
||||
(options: readPkg.Options): Promise<readPkg.PackageJson>;
|
||||
|
||||
/**
|
||||
@returns The parsed JSON.
|
||||
|
||||
@example
|
||||
```
|
||||
import readPkg = require('read-pkg');
|
||||
|
||||
console.log(readPkg.sync());
|
||||
//=> {name: 'read-pkg', …}
|
||||
|
||||
console.log(readPkg.sync({cwd: 'some-other-directory'});
|
||||
//=> {name: 'unicorn', …}
|
||||
```
|
||||
*/
|
||||
sync(options?: readPkg.NormalizeOptions): readPkg.NormalizedPackageJson;
|
||||
sync(options: readPkg.Options): readPkg.PackageJson;
|
||||
};
|
||||
|
||||
export = readPkg;
|
41
node_modules/read-pkg/index.js
generated
vendored
Normal file
41
node_modules/read-pkg/index.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
'use strict';
|
||||
const {promisify} = require('util');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const parseJson = require('parse-json');
|
||||
|
||||
const readFileAsync = promisify(fs.readFile);
|
||||
|
||||
module.exports = async options => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
normalize: true,
|
||||
...options
|
||||
};
|
||||
|
||||
const filePath = path.resolve(options.cwd, 'package.json');
|
||||
const json = parseJson(await readFileAsync(filePath, 'utf8'));
|
||||
|
||||
if (options.normalize) {
|
||||
require('normalize-package-data')(json);
|
||||
}
|
||||
|
||||
return json;
|
||||
};
|
||||
|
||||
module.exports.sync = options => {
|
||||
options = {
|
||||
cwd: process.cwd(),
|
||||
normalize: true,
|
||||
...options
|
||||
};
|
||||
|
||||
const filePath = path.resolve(options.cwd, 'package.json');
|
||||
const json = parseJson(fs.readFileSync(filePath, 'utf8'));
|
||||
|
||||
if (options.normalize) {
|
||||
require('normalize-package-data')(json);
|
||||
}
|
||||
|
||||
return json;
|
||||
};
|
9
node_modules/read-pkg/license
generated
vendored
Normal file
9
node_modules/read-pkg/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.
|
50
node_modules/read-pkg/node_modules/parse-json/index.js
generated
vendored
Normal file
50
node_modules/read-pkg/node_modules/parse-json/index.js
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
|||
'use strict';
|
||||
const errorEx = require('error-ex');
|
||||
const fallback = require('json-parse-better-errors');
|
||||
const {default: LinesAndColumns} = require('lines-and-columns');
|
||||
const {codeFrameColumns} = require('@babel/code-frame');
|
||||
|
||||
const JSONError = errorEx('JSONError', {
|
||||
fileName: errorEx.append('in %s'),
|
||||
codeFrame: errorEx.append('\n\n%s\n')
|
||||
});
|
||||
|
||||
module.exports = (string, reviver, filename) => {
|
||||
if (typeof reviver === 'string') {
|
||||
filename = reviver;
|
||||
reviver = null;
|
||||
}
|
||||
|
||||
try {
|
||||
try {
|
||||
return JSON.parse(string, reviver);
|
||||
} catch (error) {
|
||||
fallback(string, reviver);
|
||||
throw error;
|
||||
}
|
||||
} catch (error) {
|
||||
error.message = error.message.replace(/\n/g, '');
|
||||
const indexMatch = error.message.match(/in JSON at position (\d+) while parsing near/);
|
||||
|
||||
const jsonError = new JSONError(error);
|
||||
if (filename) {
|
||||
jsonError.fileName = filename;
|
||||
}
|
||||
|
||||
if (indexMatch && indexMatch.length > 0) {
|
||||
const lines = new LinesAndColumns(string);
|
||||
const index = Number(indexMatch[1]);
|
||||
const location = lines.locationForIndex(index);
|
||||
|
||||
const codeFrame = codeFrameColumns(
|
||||
string,
|
||||
{start: {line: location.line + 1, column: location.column + 1}},
|
||||
{highlightCode: true}
|
||||
);
|
||||
|
||||
jsonError.codeFrame = codeFrame;
|
||||
}
|
||||
|
||||
throw jsonError;
|
||||
}
|
||||
};
|
9
node_modules/read-pkg/node_modules/parse-json/license
generated
vendored
Normal file
9
node_modules/read-pkg/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.
|
76
node_modules/read-pkg/node_modules/parse-json/package.json
generated
vendored
Normal file
76
node_modules/read-pkg/node_modules/parse-json/package.json
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
{
|
||||
"_from": "parse-json@^5.0.0",
|
||||
"_id": "parse-json@5.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==",
|
||||
"_location": "/read-pkg/parse-json",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "parse-json@^5.0.0",
|
||||
"name": "parse-json",
|
||||
"escapedName": "parse-json",
|
||||
"rawSpec": "^5.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/read-pkg"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz",
|
||||
"_shasum": "73e5114c986d143efa3712d4ea24db9a4266f60f",
|
||||
"_spec": "parse-json@^5.0.0",
|
||||
"_where": "E:\\github\\setup-python\\node_modules\\read-pkg",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/parse-json/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"error-ex": "^1.3.1",
|
||||
"json-parse-better-errors": "^1.0.1",
|
||||
"lines-and-columns": "^1.1.6"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Parse JSON with more helpful errors",
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"nyc": "^14.1.1",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"vendor"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/parse-json#readme",
|
||||
"keywords": [
|
||||
"parse",
|
||||
"json",
|
||||
"graceful",
|
||||
"error",
|
||||
"message",
|
||||
"humanize",
|
||||
"friendly",
|
||||
"helpful",
|
||||
"string"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "parse-json",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/parse-json.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc ava"
|
||||
},
|
||||
"version": "5.0.0"
|
||||
}
|
101
node_modules/read-pkg/node_modules/parse-json/readme.md
generated
vendored
Normal file
101
node_modules/read-pkg/node_modules/parse-json/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
# 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: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}'
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
|
||||
|
||||
parseJson(json, 'foo.json');
|
||||
/*
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}' in foo.json
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
|
||||
|
||||
// You can also add the filename at a later point
|
||||
try {
|
||||
parseJson(json);
|
||||
} catch (error) {
|
||||
error.fileName = 'foo.json';
|
||||
throw error;
|
||||
}
|
||||
/*
|
||||
JSONError: Unexpected token } in JSON at position 16 while parsing near '{ "foo": true,}' in foo.json
|
||||
|
||||
1 | {
|
||||
2 | "foo": true,
|
||||
> 3 | }
|
||||
| ^
|
||||
*/
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### parseJson(string, reviver?, filename?)
|
||||
|
||||
#### string
|
||||
|
||||
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.
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-parse-json?utm_source=npm-parse-json&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
86
node_modules/read-pkg/package.json
generated
vendored
Normal file
86
node_modules/read-pkg/package.json
generated
vendored
Normal file
|
@ -0,0 +1,86 @@
|
|||
{
|
||||
"_from": "read-pkg@^5.1.1",
|
||||
"_id": "read-pkg@5.2.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==",
|
||||
"_location": "/read-pkg",
|
||||
"_phantomChildren": {
|
||||
"@babel/code-frame": "7.5.5",
|
||||
"error-ex": "1.3.2",
|
||||
"json-parse-better-errors": "1.0.2",
|
||||
"lines-and-columns": "1.1.6"
|
||||
},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "read-pkg@^5.1.1",
|
||||
"name": "read-pkg",
|
||||
"escapedName": "read-pkg",
|
||||
"rawSpec": "^5.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/husky"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz",
|
||||
"_shasum": "7bf295438ca5a33e56cd30e053b34ee7250c93cc",
|
||||
"_spec": "read-pkg@^5.1.1",
|
||||
"_where": "E:\\github\\setup-python\\node_modules\\husky",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/read-pkg/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@types/normalize-package-data": "^2.4.0",
|
||||
"normalize-package-data": "^2.5.0",
|
||||
"parse-json": "^5.0.0",
|
||||
"type-fest": "^0.6.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Read a package.json file",
|
||||
"devDependencies": {
|
||||
"ava": "^2.2.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/read-pkg#readme",
|
||||
"keywords": [
|
||||
"json",
|
||||
"read",
|
||||
"parse",
|
||||
"file",
|
||||
"fs",
|
||||
"graceful",
|
||||
"load",
|
||||
"package",
|
||||
"normalize"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "read-pkg",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/read-pkg.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "5.2.0",
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test/test.js"
|
||||
]
|
||||
}
|
||||
}
|
81
node_modules/read-pkg/readme.md
generated
vendored
Normal file
81
node_modules/read-pkg/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,81 @@
|
|||
# read-pkg [](https://travis-ci.org/sindresorhus/read-pkg)
|
||||
|
||||
> Read a package.json file
|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- [Gracefully handles filesystem issues](https://github.com/isaacs/node-graceful-fs)
|
||||
- [Throws more helpful JSON errors](https://github.com/sindresorhus/parse-json)
|
||||
- [Normalizes the data](https://github.com/npm/normalize-package-data#what-normalization-currently-entails)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install read-pkg
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const readPkg = require('read-pkg');
|
||||
|
||||
(async () => {
|
||||
console.log(await readPkg());
|
||||
//=> {name: 'read-pkg', …}
|
||||
|
||||
console.log(await readPkg({cwd: 'some-other-directory'}));
|
||||
//=> {name: 'unicorn', …}
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### readPkg(options?)
|
||||
|
||||
Returns a `Promise<object>` with the parsed JSON.
|
||||
|
||||
### readPkg.sync(options?)
|
||||
|
||||
Returns the parsed JSON.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### cwd
|
||||
|
||||
Type: `string`<br>
|
||||
Default: `process.cwd()`
|
||||
|
||||
Current working directory.
|
||||
|
||||
##### normalize
|
||||
|
||||
Type: `boolean`<br>
|
||||
Default: `true`
|
||||
|
||||
[Normalize](https://github.com/npm/normalize-package-data#what-normalization-currently-entails) the package data.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up) - Read the closest package.json file
|
||||
- [write-pkg](https://github.com/sindresorhus/write-pkg) - Write a `package.json` file
|
||||
- [load-json-file](https://github.com/sindresorhus/load-json-file) - Read and parse a JSON file
|
||||
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-read-pkg?utm_source=npm-read-pkg&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue