feature: tests

This commit is contained in:
Joel Male 2022-11-10 23:06:47 +10:00
parent ee20d8c79e
commit 80541e6fb8
52 changed files with 6109 additions and 832 deletions

View File

@ -6,4 +6,4 @@ updates:
directory: "/" directory: "/"
# Check the npm registry for updates every day (weekdays) # Check the npm registry for updates every day (weekdays)
schedule: schedule:
interval: "daily" interval: "weekly"

9
.github/mergify.yml vendored
View File

@ -1,9 +0,0 @@
pull_request_rules:
- name: automatic merge for develop raised by dependabot with label dependencies
conditions:
- base=develop
- label=dependencies
- -conflict
actions:
merge:
method: merge

40
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Tests
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
release:
types:
- created
jobs:
tests:
name: Tests
runs-on: ubuntu-20.04
strategy:
fail-fast: true
matrix:
node-version: [14.x, 16.x]
stability: [prefer-stable]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile --${{ matrix.stability }}
- name: Execute tests
run: yarn test

10
__tests__/main.test.ts Normal file
View File

@ -0,0 +1,10 @@
import { http } from '../src/http'
import {expect, test} from '@jest/globals'
test('it makes a post request', async () => {
const url = 'https://httpbin.org/post'
const body = '{"hello": "world"}'
const insecure = false
const res = await http.make(url, body)
expect(res.status).toBe(200)
})

1
babel.config.js Normal file
View File

@ -0,0 +1 @@
module.exports = {presets: ['@babel/preset-env']}

4
dist/index.js vendored
View File

@ -6940,7 +6940,7 @@ exports.http = void 0;
const node_fetch_1 = __nccwpck_require__(4429); const node_fetch_1 = __nccwpck_require__(4429);
var https = __nccwpck_require__(5687); var https = __nccwpck_require__(5687);
class Http { class Http {
make(url, headers, body, ignoreCertificate) { make(url, body, headers = null, ignoreCertificate = false) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
(0, node_fetch_1.default)(url, this.getOptions('post', headers, body, ignoreCertificate)).then((res) => resolve(res)); (0, node_fetch_1.default)(url, this.getOptions('post', headers, body, ignoreCertificate)).then((res) => resolve(res));
}); });
@ -7010,7 +7010,7 @@ function run() {
} }
core.info(`Sending webhook request to ${url}`); core.info(`Sending webhook request to ${url}`);
http_1.http http_1.http
.make(url, headers, body, insecure) .make(url, body, headers, insecure)
.then(res => { .then(res => {
if (res.status >= 400) { if (res.status >= 400) {
error(res.status); error(res.status);

7
jest.config.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = {
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(js)$': 'babel-jest'
},
transformIgnorePatterns: []
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,13 +1,11 @@
'use strict'; 'use strict';
module.exports = string => { var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
if (typeof string !== 'string') {
module.exports = function (str) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string'); throw new TypeError('Expected a string');
} }
// Escape characters with special meaning either inside or outside character sets. return str.replace(matchOperatorsRe, '\\$&');
// Use a simple backslash escape when its always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns stricter grammar.
return string
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
.replace(/-/g, '\\x2d');
}; };

View File

@ -1,9 +1,21 @@
MIT License The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com) 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: 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 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. 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.

View File

@ -1,38 +1,41 @@
{ {
"name": "escape-string-regexp", "name": "escape-string-regexp",
"version": "4.0.0", "version": "1.0.5",
"description": "Escape RegExp special characters", "description": "Escape RegExp special characters",
"license": "MIT", "license": "MIT",
"repository": "sindresorhus/escape-string-regexp", "repository": "sindresorhus/escape-string-regexp",
"funding": "https://github.com/sponsors/sindresorhus", "author": {
"author": { "name": "Sindre Sorhus",
"name": "Sindre Sorhus", "email": "sindresorhus@gmail.com",
"email": "sindresorhus@gmail.com", "url": "sindresorhus.com"
"url": "https://sindresorhus.com" },
}, "maintainers": [
"engines": { "Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)",
"node": ">=10" "Joshua Boy Nicolai Appelman <joshua@jbna.nl> (jbna.nl)"
}, ],
"scripts": { "engines": {
"test": "xo && ava && tsd" "node": ">=0.8.0"
}, },
"files": [ "scripts": {
"index.js", "test": "xo && ava"
"index.d.ts" },
], "files": [
"keywords": [ "index.js"
"escape", ],
"regex", "keywords": [
"regexp", "escape",
"regular", "regex",
"expression", "regexp",
"string", "re",
"special", "regular",
"characters" "expression",
], "string",
"devDependencies": { "str",
"ava": "^1.4.1", "special",
"tsd": "^0.11.0", "characters"
"xo": "^0.28.3" ],
} "devDependencies": {
"ava": "*",
"xo": "*"
}
} }

View File

@ -2,33 +2,26 @@
> Escape RegExp special characters > Escape RegExp special characters
## Install ## Install
``` ```
$ npm install escape-string-regexp $ npm install --save escape-string-regexp
``` ```
## Usage ## Usage
```js ```js
const escapeStringRegexp = require('escape-string-regexp'); const escapeStringRegexp = require('escape-string-regexp');
const escapedString = escapeStringRegexp('How much $ for a 🦄?'); const escapedString = escapeStringRegexp('how much $ for a unicorn?');
//=> 'How much \\$ for a 🦄\\?' //=> 'how much \$ for a unicorn\?'
new RegExp(escapedString); new RegExp(escapedString);
``` ```
You can also use this to escape a string that is inserted into the middle of a regex, for example, into a character class.
--- ## License
<div align="center"> MIT © [Sindre Sorhus](http://sindresorhus.com)
<b>
<a href="https://tidelift.com/subscription/pkg/npm-escape-string-regexp?utm_source=npm-escape-string-regexp&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>

2
node_modules/find-up/license generated vendored
View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com) 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: 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:

15
node_modules/find-up/package.json generated vendored
View File

@ -1,17 +1,16 @@
{ {
"name": "find-up", "name": "find-up",
"version": "5.0.0", "version": "4.1.0",
"description": "Find a file or directory by walking up parent directories", "description": "Find a file or directory by walking up parent directories",
"license": "MIT", "license": "MIT",
"repository": "sindresorhus/find-up", "repository": "sindresorhus/find-up",
"funding": "https://github.com/sponsors/sindresorhus",
"author": { "author": {
"name": "Sindre Sorhus", "name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com", "email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com" "url": "sindresorhus.com"
}, },
"engines": { "engines": {
"node": ">=10" "node": ">=8"
}, },
"scripts": { "scripts": {
"test": "xo && ava && tsd" "test": "xo && ava && tsd"
@ -41,14 +40,14 @@
"path" "path"
], ],
"dependencies": { "dependencies": {
"locate-path": "^6.0.0", "locate-path": "^5.0.0",
"path-exists": "^4.0.0" "path-exists": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"ava": "^2.1.0", "ava": "^2.1.0",
"is-path-inside": "^2.1.0", "is-path-inside": "^2.1.0",
"tempy": "^0.6.0", "tempy": "^0.3.0",
"tsd": "^0.13.1", "tsd": "^0.7.3",
"xo": "^0.33.0" "xo": "^0.24.0"
} }
} }

15
node_modules/find-up/readme.md generated vendored
View File

@ -1,13 +1,15 @@
# find-up [![Build Status](https://travis-ci.com/sindresorhus/find-up.svg?branch=master)](https://travis-ci.com/github/sindresorhus/find-up) # find-up [![Build Status](https://travis-ci.org/sindresorhus/find-up.svg?branch=master)](https://travis-ci.org/sindresorhus/find-up)
> Find a file or directory by walking up parent directories > Find a file or directory by walking up parent directories
## Install ## Install
``` ```
$ npm install find-up $ npm install find-up
``` ```
## Usage ## Usage
``` ```
@ -42,6 +44,7 @@ const findUp = require('find-up');
})(); })();
``` ```
## API ## API
### findUp(name, options?) ### findUp(name, options?)
@ -82,22 +85,22 @@ Type: `object`
##### cwd ##### cwd
Type: `string`\ Type: `string`<br>
Default: `process.cwd()` Default: `process.cwd()`
Directory to start from. Directory to start from.
##### type ##### type
Type: `string`\ Type: `string`<br>
Default: `'file'`\ Default: `'file'`<br>
Values: `'file'` `'directory'` Values: `'file'` `'directory'`
The type of paths that can match. The type of paths that can match.
##### allowSymlinks ##### allowSymlinks
Type: `boolean`\ Type: `boolean`<br>
Default: `true` Default: `true`
Allow symbolic links to match if they point to the chosen path type. Allow symbolic links to match if they point to the chosen path type.
@ -131,6 +134,7 @@ const findUp = require('find-up');
})(); })();
``` ```
## Related ## Related
- [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module - [find-up-cli](https://github.com/sindresorhus/find-up-cli) - CLI for this module
@ -138,6 +142,7 @@ const findUp = require('find-up');
- [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package - [pkg-dir](https://github.com/sindresorhus/pkg-dir) - Find the root directory of an npm package
- [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path - [resolve-from](https://github.com/sindresorhus/resolve-from) - Resolve the path of a module like `require.resolve()` but from a given path
--- ---
<div align="center"> <div align="center">

263
node_modules/globals/globals.json generated vendored
View File

@ -1,6 +1,5 @@
{ {
"builtin": { "builtin": {
"AggregateError": false,
"Array": false, "Array": false,
"ArrayBuffer": false, "ArrayBuffer": false,
"Atomics": false, "Atomics": false,
@ -19,7 +18,6 @@
"escape": false, "escape": false,
"eval": false, "eval": false,
"EvalError": false, "EvalError": false,
"FinalizationRegistry": false,
"Float32Array": false, "Float32Array": false,
"Float64Array": false, "Float64Array": false,
"Function": false, "Function": false,
@ -64,7 +62,6 @@
"URIError": false, "URIError": false,
"valueOf": false, "valueOf": false,
"WeakMap": false, "WeakMap": false,
"WeakRef": false,
"WeakSet": false "WeakSet": false
}, },
"es5": { "es5": {
@ -227,139 +224,6 @@
"WeakMap": false, "WeakMap": false,
"WeakSet": false "WeakSet": false
}, },
"es2020": {
"Array": false,
"ArrayBuffer": false,
"Atomics": false,
"BigInt": false,
"BigInt64Array": false,
"BigUint64Array": false,
"Boolean": false,
"constructor": false,
"DataView": false,
"Date": false,
"decodeURI": false,
"decodeURIComponent": false,
"encodeURI": false,
"encodeURIComponent": false,
"Error": false,
"escape": false,
"eval": false,
"EvalError": false,
"Float32Array": false,
"Float64Array": false,
"Function": false,
"globalThis": false,
"hasOwnProperty": false,
"Infinity": false,
"Int16Array": false,
"Int32Array": false,
"Int8Array": false,
"isFinite": false,
"isNaN": false,
"isPrototypeOf": false,
"JSON": false,
"Map": false,
"Math": false,
"NaN": false,
"Number": false,
"Object": false,
"parseFloat": false,
"parseInt": false,
"Promise": false,
"propertyIsEnumerable": false,
"Proxy": false,
"RangeError": false,
"ReferenceError": false,
"Reflect": false,
"RegExp": false,
"Set": false,
"SharedArrayBuffer": false,
"String": false,
"Symbol": false,
"SyntaxError": false,
"toLocaleString": false,
"toString": false,
"TypeError": false,
"Uint16Array": false,
"Uint32Array": false,
"Uint8Array": false,
"Uint8ClampedArray": false,
"undefined": false,
"unescape": false,
"URIError": false,
"valueOf": false,
"WeakMap": false,
"WeakSet": false
},
"es2021": {
"AggregateError": false,
"Array": false,
"ArrayBuffer": false,
"Atomics": false,
"BigInt": false,
"BigInt64Array": false,
"BigUint64Array": false,
"Boolean": false,
"constructor": false,
"DataView": false,
"Date": false,
"decodeURI": false,
"decodeURIComponent": false,
"encodeURI": false,
"encodeURIComponent": false,
"Error": false,
"escape": false,
"eval": false,
"EvalError": false,
"FinalizationRegistry": false,
"Float32Array": false,
"Float64Array": false,
"Function": false,
"globalThis": false,
"hasOwnProperty": false,
"Infinity": false,
"Int16Array": false,
"Int32Array": false,
"Int8Array": false,
"isFinite": false,
"isNaN": false,
"isPrototypeOf": false,
"JSON": false,
"Map": false,
"Math": false,
"NaN": false,
"Number": false,
"Object": false,
"parseFloat": false,
"parseInt": false,
"Promise": false,
"propertyIsEnumerable": false,
"Proxy": false,
"RangeError": false,
"ReferenceError": false,
"Reflect": false,
"RegExp": false,
"Set": false,
"SharedArrayBuffer": false,
"String": false,
"Symbol": false,
"SyntaxError": false,
"toLocaleString": false,
"toString": false,
"TypeError": false,
"Uint16Array": false,
"Uint32Array": false,
"Uint8Array": false,
"Uint8ClampedArray": false,
"undefined": false,
"unescape": false,
"URIError": false,
"valueOf": false,
"WeakMap": false,
"WeakRef": false,
"WeakSet": false
},
"browser": { "browser": {
"AbortController": false, "AbortController": false,
"AbortSignal": false, "AbortSignal": false,
@ -388,7 +252,7 @@
"AudioParam": false, "AudioParam": false,
"AudioProcessingEvent": false, "AudioProcessingEvent": false,
"AudioScheduledSourceNode": false, "AudioScheduledSourceNode": false,
"AudioWorkletGlobalScope": false, "AudioWorkletGlobalScope ": false,
"AudioWorkletNode": false, "AudioWorkletNode": false,
"AudioWorkletProcessor": false, "AudioWorkletProcessor": false,
"BarProp": false, "BarProp": false,
@ -442,24 +306,15 @@
"CSSImportRule": false, "CSSImportRule": false,
"CSSKeyframeRule": false, "CSSKeyframeRule": false,
"CSSKeyframesRule": false, "CSSKeyframesRule": false,
"CSSMatrixComponent": false,
"CSSMediaRule": false, "CSSMediaRule": false,
"CSSNamespaceRule": false, "CSSNamespaceRule": false,
"CSSPageRule": false, "CSSPageRule": false,
"CSSPerspective": false,
"CSSRotate": false,
"CSSRule": false, "CSSRule": false,
"CSSRuleList": false, "CSSRuleList": false,
"CSSScale": false,
"CSSSkew": false,
"CSSSkewX": false,
"CSSSkewY": false,
"CSSStyleDeclaration": false, "CSSStyleDeclaration": false,
"CSSStyleRule": false, "CSSStyleRule": false,
"CSSStyleSheet": false, "CSSStyleSheet": false,
"CSSSupportsRule": false, "CSSSupportsRule": false,
"CSSTransformValue": false,
"CSSTranslate": false,
"CustomElementRegistry": false, "CustomElementRegistry": false,
"customElements": false, "customElements": false,
"CustomEvent": false, "CustomEvent": false,
@ -487,7 +342,6 @@
"DOMPointReadOnly": false, "DOMPointReadOnly": false,
"DOMQuad": false, "DOMQuad": false,
"DOMRect": false, "DOMRect": false,
"DOMRectList": false,
"DOMRectReadOnly": false, "DOMRectReadOnly": false,
"DOMStringList": false, "DOMStringList": false,
"DOMStringMap": false, "DOMStringMap": false,
@ -511,7 +365,6 @@
"FontFace": false, "FontFace": false,
"FontFaceSetLoadEvent": false, "FontFaceSetLoadEvent": false,
"FormData": false, "FormData": false,
"FormDataEvent": false,
"frameElement": false, "frameElement": false,
"frames": false, "frames": false,
"GainNode": false, "GainNode": false,
@ -647,7 +500,6 @@
"MediaKeyStatusMap": false, "MediaKeyStatusMap": false,
"MediaKeySystemAccess": false, "MediaKeySystemAccess": false,
"MediaList": false, "MediaList": false,
"MediaMetadata": false,
"MediaQueryList": false, "MediaQueryList": false,
"MediaQueryListEvent": false, "MediaQueryListEvent": false,
"MediaRecorder": false, "MediaRecorder": false,
@ -694,7 +546,6 @@
"OfflineAudioContext": false, "OfflineAudioContext": false,
"offscreenBuffering": false, "offscreenBuffering": false,
"OffscreenCanvas": true, "OffscreenCanvas": true,
"OffscreenCanvasRenderingContext2D": false,
"onabort": true, "onabort": true,
"onafterprint": true, "onafterprint": true,
"onanimationend": true, "onanimationend": true,
@ -799,7 +650,6 @@
"OscillatorNode": false, "OscillatorNode": false,
"outerHeight": false, "outerHeight": false,
"outerWidth": false, "outerWidth": false,
"OverconstrainedError": false,
"PageTransitionEvent": false, "PageTransitionEvent": false,
"pageXOffset": false, "pageXOffset": false,
"pageYOffset": false, "pageYOffset": false,
@ -856,7 +706,6 @@
"registerProcessor": false, "registerProcessor": false,
"RemotePlayback": false, "RemotePlayback": false,
"removeEventListener": false, "removeEventListener": false,
"reportError": false,
"Request": false, "Request": false,
"requestAnimationFrame": false, "requestAnimationFrame": false,
"requestIdleCallback": false, "requestIdleCallback": false,
@ -919,11 +768,9 @@
"Storage": false, "Storage": false,
"StorageEvent": false, "StorageEvent": false,
"StorageManager": false, "StorageManager": false,
"structuredClone": false,
"styleMedia": false, "styleMedia": false,
"StyleSheet": false, "StyleSheet": false,
"StyleSheetList": false, "StyleSheetList": false,
"SubmitEvent": false,
"SubtleCrypto": false, "SubtleCrypto": false,
"SVGAElement": false, "SVGAElement": false,
"SVGAngle": false, "SVGAngle": false,
@ -1040,7 +887,6 @@
"TouchEvent": false, "TouchEvent": false,
"TouchList": false, "TouchList": false,
"TrackEvent": false, "TrackEvent": false,
"TransformStream": false,
"TransitionEvent": false, "TransitionEvent": false,
"TreeWalker": false, "TreeWalker": false,
"UIEvent": false, "UIEvent": false,
@ -1098,9 +944,6 @@
"clearTimeout": false, "clearTimeout": false,
"close": true, "close": true,
"console": false, "console": false,
"CustomEvent": false,
"ErrorEvent": false,
"Event": false,
"fetch": false, "fetch": false,
"FileReaderSync": false, "FileReaderSync": false,
"FormData": false, "FormData": false,
@ -1121,7 +964,6 @@
"indexedDB": false, "indexedDB": false,
"location": false, "location": false,
"MessageChannel": false, "MessageChannel": false,
"MessageEvent": false,
"MessagePort": false, "MessagePort": false,
"name": false, "name": false,
"navigator": false, "navigator": false,
@ -1147,7 +989,6 @@
"Promise": false, "Promise": false,
"queueMicrotask": false, "queueMicrotask": false,
"removeEventListener": false, "removeEventListener": false,
"reportError": false,
"Request": false, "Request": false,
"Response": false, "Response": false,
"self": true, "self": true,
@ -1166,65 +1007,21 @@
"node": { "node": {
"__dirname": false, "__dirname": false,
"__filename": false, "__filename": false,
"AbortController": false,
"AbortSignal": false,
"atob": false,
"btoa": false,
"Buffer": false, "Buffer": false,
"clearImmediate": false, "clearImmediate": false,
"clearInterval": false, "clearInterval": false,
"clearTimeout": false, "clearTimeout": false,
"console": false, "console": false,
"DOMException": false,
"Event": false,
"EventTarget": false,
"exports": true, "exports": true,
"fetch": false,
"global": false, "global": false,
"Intl": false, "Intl": false,
"MessageChannel": false,
"MessageEvent": false,
"MessagePort": false,
"module": false, "module": false,
"performance": false,
"process": false, "process": false,
"queueMicrotask": false, "queueMicrotask": false,
"require": false, "require": false,
"setImmediate": false, "setImmediate": false,
"setInterval": false, "setInterval": false,
"setTimeout": false, "setTimeout": false,
"structuredClone": false,
"TextDecoder": false,
"TextEncoder": false,
"URL": false,
"URLSearchParams": false
},
"nodeBuiltin": {
"AbortController": false,
"AbortSignal": false,
"atob": false,
"btoa": false,
"Buffer": false,
"clearImmediate": false,
"clearInterval": false,
"clearTimeout": false,
"console": false,
"DOMException": false,
"Event": false,
"EventTarget": false,
"fetch": false,
"global": false,
"Intl": false,
"MessageChannel": false,
"MessageEvent": false,
"MessagePort": false,
"performance": false,
"process": false,
"queueMicrotask": false,
"setImmediate": false,
"setInterval": false,
"setTimeout": false,
"structuredClone": false,
"TextDecoder": false, "TextDecoder": false,
"TextEncoder": false, "TextEncoder": false,
"URL": false, "URL": false,
@ -1269,7 +1066,6 @@
"beforeEach": false, "beforeEach": false,
"describe": false, "describe": false,
"expect": false, "expect": false,
"expectAsync": false,
"fail": false, "fail": false,
"fdescribe": false, "fdescribe": false,
"fit": false, "fit": false,
@ -1278,7 +1074,6 @@
"pending": false, "pending": false,
"runs": false, "runs": false,
"spyOn": false, "spyOn": false,
"spyOnAllFunctions": false,
"spyOnProperty": false, "spyOnProperty": false,
"waits": false, "waits": false,
"waitsFor": false, "waitsFor": false,
@ -1388,19 +1183,17 @@
"quit": false "quit": false
}, },
"wsh": { "wsh": {
"ActiveXObject": false, "ActiveXObject": true,
"CollectGarbage": false, "Enumerator": true,
"Debug": false, "GetObject": true,
"Enumerator": false, "ScriptEngine": true,
"GetObject": false, "ScriptEngineBuildVersion": true,
"RuntimeObject": false, "ScriptEngineMajorVersion": true,
"ScriptEngine": false, "ScriptEngineMinorVersion": true,
"ScriptEngineBuildVersion": false, "VBArray": true,
"ScriptEngineMajorVersion": false, "WScript": true,
"ScriptEngineMinorVersion": false, "WSH": true,
"VBArray": false, "XDomainRequest": true
"WScript": false,
"WSH": false
}, },
"jquery": { "jquery": {
"$": false, "$": false,
@ -1483,6 +1276,7 @@
"Try": false "Try": false
}, },
"meteor": { "meteor": {
"_": false,
"$": false, "$": false,
"Accounts": false, "Accounts": false,
"AccountsClient": false, "AccountsClient": false,
@ -1588,9 +1382,6 @@
"Clients": false, "Clients": false,
"close": true, "close": true,
"console": false, "console": false,
"CustomEvent": false,
"ErrorEvent": false,
"Event": false,
"ExtendableEvent": false, "ExtendableEvent": false,
"ExtendableMessageEvent": false, "ExtendableMessageEvent": false,
"fetch": false, "fetch": false,
@ -1614,7 +1405,6 @@
"indexedDB": false, "indexedDB": false,
"location": false, "location": false,
"MessageChannel": false, "MessageChannel": false,
"MessageEvent": false,
"MessagePort": false, "MessagePort": false,
"name": false, "name": false,
"navigator": false, "navigator": false,
@ -1672,7 +1462,6 @@
}, },
"atomtest": { "atomtest": {
"advanceClock": false, "advanceClock": false,
"atom": false,
"fakeClearInterval": false, "fakeClearInterval": false,
"fakeClearTimeout": false, "fakeClearTimeout": false,
"fakeSetInterval": false, "fakeSetInterval": false,
@ -1708,28 +1497,11 @@
"protractor": false "protractor": false
}, },
"shared-node-browser": { "shared-node-browser": {
"AbortController": false,
"AbortSignal": false,
"atob": false,
"btoa": false,
"clearInterval": false, "clearInterval": false,
"clearTimeout": false, "clearTimeout": false,
"console": false, "console": false,
"DOMException": false,
"Event": false,
"EventTarget": false,
"fetch": false,
"Intl": false,
"MessageChannel": false,
"MessageEvent": false,
"MessagePort": false,
"performance": false,
"queueMicrotask": false,
"setInterval": false, "setInterval": false,
"setTimeout": false, "setTimeout": false,
"structuredClone": false,
"TextDecoder": false,
"TextEncoder": false,
"URL": false, "URL": false,
"URLSearchParams": false "URLSearchParams": false
}, },
@ -1743,27 +1515,18 @@
"createObjectIn": false, "createObjectIn": false,
"exportFunction": false, "exportFunction": false,
"GM": false, "GM": false,
"GM_addElement": false,
"GM_addStyle": false, "GM_addStyle": false,
"GM_addValueChangeListener": false,
"GM_deleteValue": false, "GM_deleteValue": false,
"GM_download": false,
"GM_getResourceText": false, "GM_getResourceText": false,
"GM_getResourceURL": false, "GM_getResourceURL": false,
"GM_getTab": false,
"GM_getTabs": false,
"GM_getValue": false, "GM_getValue": false,
"GM_info": false, "GM_info": false,
"GM_listValues": false, "GM_listValues": false,
"GM_log": false, "GM_log": false,
"GM_notification": false,
"GM_openInTab": false, "GM_openInTab": false,
"GM_registerMenuCommand": false, "GM_registerMenuCommand": false,
"GM_removeValueChangeListener": false,
"GM_saveTab": false,
"GM_setClipboard": false, "GM_setClipboard": false,
"GM_setValue": false, "GM_setValue": false,
"GM_unregisterMenuCommand": false,
"GM_xmlhttpRequest": false, "GM_xmlhttpRequest": false,
"unsafeWindow": false "unsafeWindow": false
}, },

6
node_modules/globals/index.d.ts generated vendored
View File

@ -1,6 +0,0 @@
import {ReadonlyDeep} from 'type-fest';
import globalsJson = require('./globals.json');
declare const globals: ReadonlyDeep<typeof globalsJson>;
export = globals;

2
node_modules/globals/license generated vendored
View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com) 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: 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:

26
node_modules/globals/package.json generated vendored
View File

@ -1,24 +1,22 @@
{ {
"name": "globals", "name": "globals",
"version": "13.17.0", "version": "11.12.0",
"description": "Global identifiers from different JavaScript environments", "description": "Global identifiers from different JavaScript environments",
"license": "MIT", "license": "MIT",
"repository": "sindresorhus/globals", "repository": "sindresorhus/globals",
"funding": "https://github.com/sponsors/sindresorhus",
"author": { "author": {
"name": "Sindre Sorhus", "name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com", "email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com" "url": "sindresorhus.com"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">=4"
}, },
"scripts": { "scripts": {
"test": "xo && ava" "test": "xo && ava"
}, },
"files": [ "files": [
"index.js", "index.js",
"index.d.ts",
"globals.json" "globals.json"
], ],
"keywords": [ "keywords": [
@ -31,25 +29,13 @@
"eslint", "eslint",
"environments" "environments"
], ],
"dependencies": {
"type-fest": "^0.20.2"
},
"devDependencies": { "devDependencies": {
"ava": "^2.4.0", "ava": "0.21.0",
"tsd": "^0.14.0", "xo": "0.18.0"
"xo": "^0.36.1"
}, },
"xo": { "xo": {
"ignores": [ "ignores": [
"get-browser-globals.js" "get-browser-globals.js"
], ]
"rules": {
"node/no-unsupported-features/es-syntax": "off"
}
},
"tsd": {
"compilerOptions": {
"resolveJsonModule": true
}
} }
} }

33
node_modules/globals/readme.md generated vendored
View File

@ -1,12 +1,13 @@
# globals # globals [![Build Status](https://travis-ci.org/sindresorhus/globals.svg?branch=master)](https://travis-ci.org/sindresorhus/globals)
> Global identifiers from different JavaScript environments > Global identifiers from different JavaScript environments
It's just a [JSON file](globals.json), so use it in any environment. Extracted from [JSHint](https://github.com/jshint/jshint/blob/3a8efa979dbb157bfb5c10b5826603a55a33b9ad/src/vars.js) and [ESLint](https://github.com/eslint/eslint/blob/b648406218f8a2d7302b98f5565e23199f44eb31/conf/environments.json) and merged.
This package is used by ESLint. It's just a [JSON file](globals.json), so use it in whatever environment you like.
**This module [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).**
**This package [no longer accepts](https://github.com/sindresorhus/globals/issues/82) new environments. If you need it for ESLint, just [create a plugin](http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins).**
## Install ## Install
@ -14,6 +15,7 @@ This package is used by ESLint.
$ npm install globals $ npm install globals
``` ```
## Usage ## Usage
```js ```js
@ -26,31 +28,14 @@ console.log(globals.browser);
applicationCache: false, applicationCache: false,
ArrayBuffer: false, ArrayBuffer: false,
atob: false, atob: false,
...
} }
*/ */
``` ```
Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise. Each global is given a value of `true` or `false`. A value of `true` indicates that the variable may be overwritten. A value of `false` indicates that the variable should be considered read-only. This information is used by static analysis tools to flag incorrect behavior. We assume all variables should be `false` unless we hear otherwise.
For Node.js this package provides two sets of globals:
- `globals.nodeBuiltin`: Globals available to all code running in Node.js. ## License
These will usually be available as properties on the `global` object and include `process`, `Buffer`, but not CommonJS arguments like `require`.
See: https://nodejs.org/api/globals.html
- `globals.node`: A combination of the globals from `nodeBuiltin` plus all CommonJS arguments ("CommonJS module scope").
See: https://nodejs.org/api/modules.html#modules_the_module_scope
When analyzing code that is known to run outside of a CommonJS wrapper, for example, JavaScript modules, `nodeBuiltin` can find accidental CommonJS references. MIT © [Sindre Sorhus](https://sindresorhus.com)
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-globals?utm_source=npm-globals&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>

274
node_modules/json5/CHANGELOG.md generated vendored
View File

@ -1,274 +0,0 @@
### v1.0.1 [[code][c1.0.1], [diff][d1.0.1]]
[c1.0.1]: https://github.com/json5/json5/tree/v1.0.1
[d1.0.1]: https://github.com/json5/json5/compare/v1.0.0...v1.0.1
This release includes a bug fix and minor change.
- Fix: `parse` throws on unclosed objects and arrays.
- New: `package.json5` has been removed until an easier way to keep it in sync
with `package.json` is found.
### v1.0.0 [[code][c1.0.0], [diff][d1.0.0]]
[c1.0.0]: https://github.com/json5/json5/tree/v1.0.0
[d1.0.0]: https://github.com/json5/json5/compare/v0.5.1...v1.0.0
This release includes major internal changes and public API enhancements.
- **Major** JSON5 officially supports Node.js v4 and later. Support for Node.js
v0.10 and v0.12 have been dropped.
- New: Unicode property names and Unicode escapes in property names are
supported. ([#1])
- New: `stringify` outputs trailing commas in objects and arrays when a `space`
option is provided. ([#66])
- New: JSON5 allows line and paragraph separator characters (U+2028 and U+2029)
in strings in order to be compatible with JSON. However, ES5 does not allow
these characters in strings, so JSON5 gives a warning when they are parsed and
escapes them when they are stringified. ([#70])
- New: `stringify` accepts an options object as its second argument. The
supported options are `replacer`, `space`, and a new `quote` option that
specifies the quote character used in strings. ([#71])
- New: The CLI supports STDIN and STDOUT and adds `--out-file`, `--space`, and
`--validate` options. See `json5 --help` for more information. ([#72], [#84],
and [#108])
- New: In addition to the white space characters space `\t`, `\v`, `\f`, `\n`,
`\r`, and `\xA0`, the additional white space characters `\u2028`, `\u2029`,
and all other characters in the Space Separator Unicode category are allowed.
- New: In addition to the character escapes `\'`, `\"`, `\\`, `\b`, `\f`, `\n`,
`\r`, and `\t`, the additional character escapes `\v` and `\0`, hexadecimal
escapes like `\x0F`, and unnecessary escapes like `\a` are allowed in string
values and string property names.
- New: `stringify` outputs strings with single quotes by default but
intelligently uses double quotes if there are more single quotes than double
quotes inside the string. (i.e. `stringify('Stay here.')` outputs
`'Stay here.'` while `stringify('Let\'s go.')` outputs `"Let's go."`)
- New: When a character is not allowed in a string, `stringify` outputs a
character escape like `\t` when available, a hexadecimal escape like `\x0F`
when the Unicode code point is less than 256, or a Unicode character escape
like `\u01FF`, in that order.
- New: `stringify` checks for a `toJSON5` method on objects and, if it exists,
stringifies its return value instead of the object. `toJSON5` overrides
`toJSON` if they both exist.
- New: To `require` or `import` JSON5 files, use `require('json5/lib/register')`
or `import 'json5/lib/register'`. Previous versions used `json5/lib/require`,
which still exists for backward compatibility but is deprecated and will give
a warning.
- New: To use JSON5 in browsers, use the file at `dist/index.js` or
`https://unpkg.com/json5@^1.0.0`.
- Fix: `stringify` properly outputs `Infinity` and `NaN`. ([#67])
- Fix: `isWord` no longer becomes a property of `JSON5` after calling
`stringify`. ([#68] and [#89])
- Fix: `stringify` no longer throws when an object does not have a `prototype`.
([#154])
- Fix: `stringify` properly handles the `key` argument of `toJSON(key)` methods.
`toJSON5(key)` follows this pattern.
- Fix: `stringify` accepts `Number` and `String` objects as its `space`
argument.
- Fix: In addition to a function, `stringify` also accepts an array of keys to
include in the output as its `replacer` argument. Numbers, `Number` objects,
and `String` objects will be converted to a string if they are given as array
values.
### v0.5.1 [[code][c0.5.1], [diff][d0.5.1]]
[c0.5.1]: https://github.com/json5/json5/tree/v0.5.1
[d0.5.1]: https://github.com/json5/json5/compare/v0.5.0...v0.5.1
This release includes a minor fix for indentations when stringifying empty
arrays.
- Fix: Indents no longer appear in empty arrays when stringified. ([#134])
### v0.5.0 [[code][c0.5.0], [diff][d0.5.0]]
[c0.5.0]: https://github.com/json5/json5/tree/v0.5.0
[d0.5.0]: https://github.com/json5/json5/compare/v0.4.0...v0.5.0
This release includes major internal changes and public API enhancements.
- **Major:** JSON5 officially supports Node.js v4 LTS and v5. Support for
Node.js v0.6 and v0.8 have been dropped, while support for v0.10 and v0.12
remain.
- Fix: YUI Compressor no longer fails when compressing json5.js. ([#97])
- New: `parse` and the CLI provide line and column numbers when displaying error
messages. ([#101]; awesome work by [@amb26].)
### v0.4.0 [[code][c0.4.0], [diff][d0.4.0]]
[c0.4.0]: https://github.com/json5/json5/tree/v0.4.0
[d0.4.0]: https://github.com/json5/json5/compare/v0.2.0...v0.4.0
Note that v0.3.0 was tagged, but never published to npm, so this v0.4.0
changelog entry includes v0.3.0 features.
This is a massive release that adds `stringify` support, among other things.
- **Major:** `JSON5.stringify()` now exists!
This method is analogous to the native `JSON.stringify()`;
it just avoids quoting keys where possible.
See the [usage documentation](./README.md#usage) for more.
([#32]; huge thanks and props [@aeisenberg]!)
- New: `NaN` and `-NaN` are now allowed number literals.
([#30]; thanks [@rowanhill].)
- New: Duplicate object keys are now allowed; the last value is used.
This is the same behavior as JSON. ([#57]; thanks [@jordanbtucker].)
- Fix: Properly handle various whitespace and newline cases now.
E.g. JSON5 now properly supports escaped CR and CRLF newlines in strings,
and JSON5 now accepts the same whitespace as JSON (stricter than ES5).
([#58], [#60], and [#63]; thanks [@jordanbtucker].)
- New: Negative hexadecimal numbers (e.g. `-0xC8`) are allowed again.
(They were disallowed in v0.2.0; see below.)
It turns out they *are* valid in ES5, so JSON5 supports them now too.
([#36]; thanks [@jordanbtucker]!)
### v0.2.0 [[code][c0.2.0], [diff][d0.2.0]]
[c0.2.0]: https://github.com/json5/json5/tree/v0.2.0
[d0.2.0]: https://github.com/json5/json5/compare/v0.1.0...v0.2.0
This release fixes some bugs and adds some more utility features to help you
express data more easily:
- **Breaking:** Negative hexadecimal numbers (e.g. `-0xC8`) are rejected now.
While V8 (e.g. Chrome and Node) supported them, it turns out they're invalid
in ES5. This has been [fixed in V8][v8-hex-fix] (and by extension, Chrome
and Node), so JSON5 officially rejects them now, too. ([#36])
- New: Trailing decimal points in decimal numbers are allowed again.
(They were disallowed in v0.1.0; see below.)
They're allowed by ES5, and differentiating between integers and floats may
make sense on some platforms. ([#16]; thanks [@Midar].)
- New: `Infinity` and `-Infinity` are now allowed number literals.
([#30]; thanks [@pepkin88].)
- New: Plus signs (`+`) in front of numbers are now allowed, since it can
be helpful in some contexts to explicitly mark numbers as positive.
(E.g. when a property represents changes or deltas.)
- Fix: unescaped newlines in strings are rejected now.
([#24]; thanks [@Midar].)
### v0.1.0 [[code][c0.1.0], [diff][d0.1.0]]
[c0.1.0]: https://github.com/json5/json5/tree/v0.1.0
[d0.1.0]: https://github.com/json5/json5/compare/v0.0.1...v0.1.0
This release tightens JSON5 support and adds helpful utility features:
- New: Support hexadecimal numbers. (Thanks [@MaxNanasy].)
- Fix: Reject octal numbers properly now. Previously, they were accepted but
improperly parsed as base-10 numbers. (Thanks [@MaxNanasy].)
- **Breaking:** Reject "noctal" numbers now (base-10 numbers that begin with a
leading zero). These are disallowed by both JSON5 and JSON, as well as by
ES5's strict mode. (Thanks [@MaxNanasy].)
- New: Support leading decimal points in decimal numbers.
(Thanks [@MaxNanasy].)
- **Breaking:** Reject trailing decimal points in decimal numbers now. These
are disallowed by both JSON5 and JSON. (Thanks [@MaxNanasy].)
- **Breaking:** Reject omitted elements in arrays now. These are disallowed by
both JSON5 and JSON.
- Fix: Throw proper `SyntaxError` instances on errors now.
- New: Add Node.js `require()` hook. Register via `json5/lib/require`.
- New: Add Node.js `json5` executable to compile JSON5 files to JSON.
### v0.0.1 [[code][c0.0.1], [diff][d0.0.1]]
[c0.0.1]: https://github.com/json5/json5/tree/v0.0.1
[d0.0.1]: https://github.com/json5/json5/compare/v0.0.0...v0.0.1
This was the first implementation of this JSON5 parser.
- Support unquoted object keys, including reserved words. Unicode characters
and escape sequences sequences aren't yet supported.
- Support single-quoted strings.
- Support multi-line strings.
- Support trailing commas in arrays and objects.
- Support comments, both inline and block.
### v0.0.0 [[code](https://github.com/json5/json5/tree/v0.0.0)]
Let's consider this to be Douglas Crockford's original [json_parse.js] — a
parser for the regular JSON format.
[json_parse.js]: https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
[v8-hex-fix]: http://code.google.com/p/v8/issues/detail?id=2240
[@MaxNanasy]: https://github.com/MaxNanasy
[@Midar]: https://github.com/Midar
[@pepkin88]: https://github.com/pepkin88
[@rowanhill]: https://github.com/rowanhill
[@aeisenberg]: https://github.com/aeisenberg
[@jordanbtucker]: https://github.com/jordanbtucker
[@amb26]: https://github.com/amb26
[#1]: https://github.com/json5/json5/issues/1
[#16]: https://github.com/json5/json5/issues/16
[#24]: https://github.com/json5/json5/issues/24
[#30]: https://github.com/json5/json5/issues/30
[#32]: https://github.com/json5/json5/issues/32
[#36]: https://github.com/json5/json5/issues/36
[#57]: https://github.com/json5/json5/issues/57
[#58]: https://github.com/json5/json5/pull/58
[#60]: https://github.com/json5/json5/pull/60
[#63]: https://github.com/json5/json5/pull/63
[#66]: https://github.com/json5/json5/issues/66
[#67]: https://github.com/json5/json5/issues/67
[#68]: https://github.com/json5/json5/issues/68
[#70]: https://github.com/json5/json5/issues/70
[#71]: https://github.com/json5/json5/issues/71
[#72]: https://github.com/json5/json5/issues/72
[#84]: https://github.com/json5/json5/pull/84
[#89]: https://github.com/json5/json5/pull/89
[#97]: https://github.com/json5/json5/pull/97
[#101]: https://github.com/json5/json5/pull/101
[#108]: https://github.com/json5/json5/pull/108
[#134]: https://github.com/json5/json5/pull/134
[#154]: https://github.com/json5/json5/issues/154

12
node_modules/json5/README.md generated vendored
View File

@ -1,6 +1,6 @@
# JSON5 JSON for Humans # JSON5 JSON for Humans
[![Build Status](https://travis-ci.org/json5/json5.svg)][Build Status] [![Build Status](https://travis-ci.com/json5/json5.svg)][Build Status]
[![Coverage [![Coverage
Status](https://coveralls.io/repos/github/json5/json5/badge.svg)][Coverage Status](https://coveralls.io/repos/github/json5/json5/badge.svg)][Coverage
Status] Status]
@ -12,7 +12,7 @@ some productions from [ECMAScript 5.1].
This JavaScript library is the official reference implementation for JSON5 This JavaScript library is the official reference implementation for JSON5
parsing and serialization libraries. parsing and serialization libraries.
[Build Status]: https://travis-ci.org/json5/json5 [Build Status]: https://travis-ci.com/json5/json5
[Coverage Status]: https://coveralls.io/github/json5/json5 [Coverage Status]: https://coveralls.io/github/json5/json5
@ -84,7 +84,7 @@ const JSON5 = require('json5')
### Browsers ### Browsers
```html ```html
<script src="https://unpkg.com/json5@^1.0.0"></script> <script src="https://unpkg.com/json5@^2.0.0/dist/index.min.js"></script>
``` ```
This will create a global `JSON5` variable. This will create a global `JSON5` variable.
@ -182,7 +182,7 @@ If `<file>` is not provided, then STDIN is used.
- `-V`, `--version`: Output the version number - `-V`, `--version`: Output the version number
- `-h`, `--help`: Output usage information - `-h`, `--help`: Output usage information
## Contibuting ## Contributing
### Development ### Development
```sh ```sh
git clone https://github.com/json5/json5 git clone https://github.com/json5/json5
@ -199,7 +199,7 @@ To report bugs or request features regarding the JSON5 data format, please
submit an issue to the [official specification submit an issue to the [official specification
repository](https://github.com/json5/json5-spec). repository](https://github.com/json5/json5-spec).
To report bugs or request features regarding the JavaScript implentation of To report bugs or request features regarding the JavaScript implementation of
JSON5, please submit an issue to this repository. JSON5, please submit an issue to this repository.
## License ## License
@ -221,7 +221,7 @@ implementation of JSON5 was also modeled directly off of Dougs open-source
code. code.
[json_parse.js]: [json_parse.js]:
https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js https://github.com/douglascrockford/JSON-js/blob/03157639c7a7cddd2e9f032537f346f1a87c0f6d/json_parse.js
[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific [Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific
supporter, contributing multiple patches and ideas. supporter, contributing multiple patches and ideas.

1711
node_modules/json5/dist/index.js generated vendored

File diff suppressed because one or more lines are too long

152
node_modules/json5/lib/cli.js generated vendored
View File

@ -1,2 +1,152 @@
#!/usr/bin/env node #!/usr/bin/env node
'use strict';var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _path=require('path');var _path2=_interopRequireDefault(_path);var _minimist=require('minimist');var _minimist2=_interopRequireDefault(_minimist);var _package=require('../package.json');var _package2=_interopRequireDefault(_package);var _=require('./');var _2=_interopRequireDefault(_);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var argv=(0,_minimist2.default)(process.argv.slice(2),{alias:{'convert':'c','space':'s','validate':'v','out-file':'o','version':'V','help':'h'},boolean:['convert','validate','version','help'],string:['space','out-file']});if(argv.version){version()}else if(argv.help){usage()}else{var inFilename=argv._[0];var readStream=void 0;if(inFilename){readStream=_fs2.default.createReadStream(inFilename)}else{readStream=process.stdin}var json5='';readStream.on('data',function(data){json5+=data});readStream.on('end',function(){var space=void 0;if(argv.space==='t'||argv.space==='tab'){space='\t'}else{space=Number(argv.space)}var value=void 0;try{value=_2.default.parse(json5);if(!argv.validate){var json=JSON.stringify(value,null,space);var writeStream=void 0;if(argv.convert&&inFilename&&!argv.o){var parsedFilename=_path2.default.parse(inFilename);var outFilename=_path2.default.format(Object.assign(parsedFilename,{base:_path2.default.basename(parsedFilename.base,parsedFilename.ext)+'.json'}));writeStream=_fs2.default.createWriteStream(outFilename)}else if(argv.o){writeStream=_fs2.default.createWriteStream(argv.o)}else{writeStream=process.stdout}writeStream.write(json)}}catch(err){console.error(err.message);process.exit(1)}})}function version(){console.log(_package2.default.version)}function usage(){console.log('\n Usage: json5 [options] <file>\n\n If <file> is not provided, then STDIN is used.\n\n Options:\n\n -s, --space The number of spaces to indent or \'t\' for tabs\n -o, --out-file [file] Output to the specified file, otherwise STDOUT\n -v, --validate Validate JSON5 but do not output JSON\n -V, --version Output the version number\n -h, --help Output usage information')}
const fs = require('fs')
const path = require('path')
const pkg = require('../package.json')
const JSON5 = require('./')
const argv = parseArgs()
if (argv.version) {
version()
} else if (argv.help) {
usage()
} else {
const inFilename = argv.defaults[0]
let readStream
if (inFilename) {
readStream = fs.createReadStream(inFilename)
} else {
readStream = process.stdin
}
let json5 = ''
readStream.on('data', data => {
json5 += data
})
readStream.on('end', () => {
let space
if (argv.space === 't' || argv.space === 'tab') {
space = '\t'
} else {
space = Number(argv.space)
}
let value
try {
value = JSON5.parse(json5)
if (!argv.validate) {
const json = JSON.stringify(value, null, space)
let writeStream
// --convert is for backward compatibility with v0.5.1. If
// specified with <file> and not --out-file, then a file with
// the same name but with a .json extension will be written.
if (argv.convert && inFilename && !argv.outFile) {
const parsedFilename = path.parse(inFilename)
const outFilename = path.format(
Object.assign(
parsedFilename,
{base: path.basename(parsedFilename.base, parsedFilename.ext) + '.json'}
)
)
writeStream = fs.createWriteStream(outFilename)
} else if (argv.outFile) {
writeStream = fs.createWriteStream(argv.outFile)
} else {
writeStream = process.stdout
}
writeStream.write(json)
}
} catch (err) {
console.error(err.message)
process.exit(1)
}
})
}
function parseArgs () {
let convert
let space
let validate
let outFile
let version
let help
const defaults = []
const args = process.argv.slice(2)
for (let i = 0; i < args.length; i++) {
const arg = args[i]
switch (arg) {
case '--convert':
case '-c':
convert = true
break
case '--space':
case '-s':
space = args[++i]
break
case '--validate':
case '-v':
validate = true
break
case '--out-file':
case '-o':
outFile = args[++i]
break
case '--version':
case '-V':
version = true
break
case '--help':
case '-h':
help = true
break
default:
defaults.push(arg)
break
}
}
return {
convert,
space,
validate,
outFile,
version,
help,
defaults,
}
}
function version () {
console.log(pkg.version)
}
function usage () {
console.log(
`
Usage: json5 [options] <file>
If <file> is not provided, then STDIN is used.
Options:
-s, --space The number of spaces to indent or 't' for tabs
-o, --out-file [file] Output to the specified file, otherwise STDOUT
-v, --validate Validate JSON5 but do not output JSON
-V, --version Output the version number
-h, --help Output usage information`
)
}

10
node_modules/json5/lib/index.js generated vendored
View File

@ -1 +1,9 @@
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _parse=require('./parse');var _parse2=_interopRequireDefault(_parse);var _stringify=require('./stringify');var _stringify2=_interopRequireDefault(_stringify);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}exports.default={parse:_parse2.default,stringify:_stringify2.default};module.exports=exports['default']; const parse = require('./parse')
const stringify = require('./stringify')
const JSON5 = {
parse,
stringify,
}
module.exports = JSON5

1088
node_modules/json5/lib/parse.js generated vendored

File diff suppressed because one or more lines are too long

14
node_modules/json5/lib/register.js generated vendored
View File

@ -1 +1,13 @@
'use strict';var _fs=require('fs');var _fs2=_interopRequireDefault(_fs);var _=require('./');var _2=_interopRequireDefault(_);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}require.extensions['.json5']=function(module,filename){var content=_fs2.default.readFileSync(filename,'utf8');try{module.exports=_2.default.parse(content)}catch(err){err.message=filename+': '+err.message;throw err}}; const fs = require('fs')
const JSON5 = require('./')
// eslint-disable-next-line node/no-deprecated-api
require.extensions['.json5'] = function (module, filename) {
const content = fs.readFileSync(filename, 'utf8')
try {
module.exports = JSON5.parse(content)
} catch (err) {
err.message = filename + ': ' + err.message
throw err
}
}

5
node_modules/json5/lib/require.js generated vendored
View File

@ -1 +1,4 @@
"use strict";require("./register");console.warn("'json5/require' is deprecated. Please use 'json5/register' instead."); // This file is for backward compatibility with v0.5.1.
require('./register')
console.warn("'json5/require' is deprecated. Please use 'json5/register' instead.")

262
node_modules/json5/lib/stringify.js generated vendored

File diff suppressed because one or more lines are too long

5
node_modules/json5/lib/unicode.js generated vendored

File diff suppressed because one or more lines are too long

36
node_modules/json5/lib/util.js generated vendored
View File

@ -1 +1,35 @@
'use strict';Object.defineProperty(exports,'__esModule',{value:true});exports.isSpaceSeparator=isSpaceSeparator;exports.isIdStartChar=isIdStartChar;exports.isIdContinueChar=isIdContinueChar;exports.isDigit=isDigit;exports.isHexDigit=isHexDigit;var _unicode=require('../lib/unicode');var unicode=_interopRequireWildcard(_unicode);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key]}}newObj.default=obj;return newObj}}function isSpaceSeparator(c){return unicode.Space_Separator.test(c)}function isIdStartChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c==='$'||c==='_'||unicode.ID_Start.test(c)}function isIdContinueChar(c){return c>='a'&&c<='z'||c>='A'&&c<='Z'||c>='0'&&c<='9'||c==='$'||c==='_'||c==='\u200C'||c==='\u200D'||unicode.ID_Continue.test(c)}function isDigit(c){return /[0-9]/.test(c)}function isHexDigit(c){return /[0-9A-Fa-f]/.test(c)} const unicode = require('../lib/unicode')
module.exports = {
isSpaceSeparator (c) {
return typeof c === 'string' && unicode.Space_Separator.test(c)
},
isIdStartChar (c) {
return typeof c === 'string' && (
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c === '$') || (c === '_') ||
unicode.ID_Start.test(c)
)
},
isIdContinueChar (c) {
return typeof c === 'string' && (
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') ||
(c === '$') || (c === '_') ||
(c === '\u200C') || (c === '\u200D') ||
unicode.ID_Continue.test(c)
)
},
isDigit (c) {
return typeof c === 'string' && /[0-9]/.test(c)
},
isHexDigit (c) {
return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
},
}

71
node_modules/json5/package.json generated vendored
View File

@ -1,23 +1,30 @@
{ {
"name": "json5", "name": "json5",
"version": "1.0.1", "version": "2.2.1",
"description": "JSON for humans.", "description": "JSON for humans.",
"main": "lib/index.js", "main": "lib/index.js",
"module": "dist/index.mjs",
"bin": "lib/cli.js", "bin": "lib/cli.js",
"browser": "dist/index.js", "browser": "dist/index.js",
"types": "lib/index.d.ts",
"files": [ "files": [
"lib/", "lib/",
"dist/" "dist/"
], ],
"engines": {
"node": ">=6"
},
"scripts": { "scripts": {
"build": "babel-node build/build.js && babel src -d lib && rollup -c", "build": "rollup -c",
"coverage": "nyc report --reporter=text-lcov | coveralls", "build-package": "node build/package.js",
"lint": "eslint --fix build src", "build-unicode": "node build/unicode.js",
"prepublishOnly": "npm run lint && npm test && npm run production", "coverage": "tap --coverage-report html test",
"pretest": "cross-env NODE_ENV=test npm run build", "lint": "eslint --fix .",
"preversion": "npm run lint && npm test && npm run production", "prepublishOnly": "npm run production",
"production": "cross-env NODE_ENV=production npm run build", "preversion": "npm run production",
"test": "nyc --reporter=html --reporter=text mocha" "production": "npm run lint && npm test && npm run build",
"test": "tap -Rspec --100 test",
"version": "npm run build-package && git add package.json5"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -41,36 +48,22 @@
"url": "https://github.com/json5/json5/issues" "url": "https://github.com/json5/json5/issues"
}, },
"homepage": "http://json5.org/", "homepage": "http://json5.org/",
"dependencies": {
"minimist": "^1.2.0"
},
"devDependencies": { "devDependencies": {
"babel-cli": "^6.26.0", "core-js": "^2.6.5",
"babel-core": "^6.26.0", "eslint": "^5.15.3",
"babel-plugin-add-module-exports": "^0.2.1", "eslint-config-standard": "^12.0.0",
"babel-plugin-external-helpers": "^6.22.0", "eslint-plugin-import": "^2.16.0",
"babel-plugin-istanbul": "^4.1.5", "eslint-plugin-node": "^8.0.1",
"babel-preset-env": "^1.6.1", "eslint-plugin-promise": "^4.0.1",
"babel-register": "^6.26.0", "eslint-plugin-standard": "^4.0.0",
"babelrc-rollup": "^3.0.0", "regenerate": "^1.4.0",
"coveralls": "^3.0.0", "rollup": "^0.64.1",
"cross-env": "^5.1.4", "rollup-plugin-buble": "^0.19.6",
"del": "^3.0.0", "rollup-plugin-commonjs": "^9.2.1",
"eslint": "^4.18.2", "rollup-plugin-node-resolve": "^3.4.0",
"eslint-config-standard": "^11.0.0", "rollup-plugin-terser": "^1.0.1",
"eslint-plugin-import": "^2.9.0", "sinon": "^6.3.5",
"eslint-plugin-node": "^6.0.1", "tap": "^12.6.0",
"eslint-plugin-promise": "^3.7.0", "unicode-10.0.0": "^0.7.5"
"eslint-plugin-standard": "^3.0.1",
"mocha": "^5.0.4",
"nyc": "^11.4.1",
"regenerate": "^1.3.3",
"rollup": "^0.56.5",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-commonjs": "^9.0.0",
"rollup-plugin-node-resolve": "^3.2.0",
"rollup-plugin-uglify": "^3.0.0",
"sinon": "^4.4.2",
"unicode-9.0.0": "^0.7.5"
} }
} }

9
node_modules/locate-path/index.js generated vendored
View File

@ -29,16 +29,14 @@ module.exports = async (paths, options) => {
allowSymlinks: true, allowSymlinks: true,
...options ...options
}; };
checkType(options); checkType(options);
const statFn = options.allowSymlinks ? fsStat : fsLStat; const statFn = options.allowSymlinks ? fsStat : fsLStat;
return pLocate(paths, async path_ => { return pLocate(paths, async path_ => {
try { try {
const stat = await statFn(path.resolve(options.cwd, path_)); const stat = await statFn(path.resolve(options.cwd, path_));
return matchType(options.type, stat); return matchType(options.type, stat);
} catch { } catch (_) {
return false; return false;
} }
}, options); }, options);
@ -51,9 +49,7 @@ module.exports.sync = (paths, options) => {
type: 'file', type: 'file',
...options ...options
}; };
checkType(options); checkType(options);
const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync; const statFn = options.allowSymlinks ? fs.statSync : fs.lstatSync;
for (const path_ of paths) { for (const path_ of paths) {
@ -63,6 +59,7 @@ module.exports.sync = (paths, options) => {
if (matchType(options.type, stat)) { if (matchType(options.type, stat)) {
return path_; return path_;
} }
} catch {} } catch (_) {
}
} }
}; };

2
node_modules/locate-path/license generated vendored
View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com) 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: 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:

View File

@ -1,17 +1,16 @@
{ {
"name": "locate-path", "name": "locate-path",
"version": "6.0.0", "version": "5.0.0",
"description": "Get the first path that exists on disk of multiple paths", "description": "Get the first path that exists on disk of multiple paths",
"license": "MIT", "license": "MIT",
"repository": "sindresorhus/locate-path", "repository": "sindresorhus/locate-path",
"funding": "https://github.com/sponsors/sindresorhus",
"author": { "author": {
"name": "Sindre Sorhus", "name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com", "email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com" "url": "sindresorhus.com"
}, },
"engines": { "engines": {
"node": ">=10" "node": ">=8"
}, },
"scripts": { "scripts": {
"test": "xo && ava && tsd" "test": "xo && ava && tsd"
@ -36,11 +35,11 @@
"iterator" "iterator"
], ],
"dependencies": { "dependencies": {
"p-locate": "^5.0.0" "p-locate": "^4.1.0"
}, },
"devDependencies": { "devDependencies": {
"ava": "^2.4.0", "ava": "^1.4.1",
"tsd": "^0.13.1", "tsd": "^0.7.2",
"xo": "^0.32.1" "xo": "^0.24.0"
} }
} }

43
node_modules/locate-path/readme.md generated vendored
View File

@ -1,13 +1,15 @@
# locate-path [![Build Status](https://travis-ci.com/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.com/github/sindresorhus/locate-path) # locate-path [![Build Status](https://travis-ci.org/sindresorhus/locate-path.svg?branch=master)](https://travis-ci.org/sindresorhus/locate-path)
> Get the first path that exists on disk of multiple paths > Get the first path that exists on disk of multiple paths
## Install ## Install
``` ```
$ npm install locate-path $ npm install locate-path
``` ```
## Usage ## Usage
Here we find the first file that exists on disk, in array order. Here we find the first file that exists on disk, in array order.
@ -27,9 +29,10 @@ const files = [
})(); })();
``` ```
## API ## API
### locatePath(paths, options?) ### locatePath(paths, [options])
Returns a `Promise<string>` for the first path that exists or `undefined` if none exists. Returns a `Promise<string>` for the first path that exists or `undefined` if none exists.
@ -41,19 +44,19 @@ Paths to check.
#### options #### options
Type: `object` Type: `Object`
##### concurrency ##### concurrency
Type: `number`\ Type: `number`<br>
Default: `Infinity`\ Default: `Infinity`<br>
Minimum: `1` Minimum: `1`
Number of concurrently pending promises. Number of concurrently pending promises.
##### preserveOrder ##### preserveOrder
Type: `boolean`\ Type: `boolean`<br>
Default: `true` Default: `true`
Preserve `paths` order when searching. Preserve `paths` order when searching.
@ -62,27 +65,27 @@ Disable this to improve performance if you don't care about the order.
##### cwd ##### cwd
Type: `string`\ Type: `string`<br>
Default: `process.cwd()` Default: `process.cwd()`
Current working directory. Current working directory.
##### type ##### type
Type: `string`\ Type: `string`<br>
Default: `'file'`\ Default: `file`<br>
Values: `'file' | 'directory'` Values: `file` `directory`
The type of paths that can match. The type of paths that can match.
##### allowSymlinks ##### allowSymlinks
Type: `boolean`\ Type: `boolean`<br>
Default: `true` Default: `true`
Allow symbolic links to match if they point to the chosen path type. Allow symbolic links to match if they point to the chosen path type.
### locatePath.sync(paths, options?) ### locatePath.sync(paths, [options])
Returns the first path that exists or `undefined` if none exists. Returns the first path that exists or `undefined` if none exists.
@ -94,7 +97,7 @@ Paths to check.
#### options #### options
Type: `object` Type: `Object`
##### cwd ##### cwd
@ -108,18 +111,12 @@ Same as above.
Same as above. Same as above.
## Related ## Related
- [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists - [path-exists](https://github.com/sindresorhus/path-exists) - Check if a path exists
---
<div align="center"> ## License
<b>
<a href="https://tidelift.com/subscription/pkg/npm-locate-path?utm_source=npm-locate-path&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> MIT © [Sindre Sorhus](https://sindresorhus.com)
</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>

2
node_modules/p-locate/index.js generated vendored
View File

@ -48,3 +48,5 @@ const pLocate = async (iterable, tester, options) => {
}; };
module.exports = pLocate; module.exports = pLocate;
// TODO: Remove this for the next major release
module.exports.default = pLocate;

2
node_modules/p-locate/license generated vendored
View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com) 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: 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:

19
node_modules/p-locate/package.json generated vendored
View File

@ -1,17 +1,16 @@
{ {
"name": "p-locate", "name": "p-locate",
"version": "5.0.0", "version": "4.1.0",
"description": "Get the first fulfilled promise that satisfies the provided testing function", "description": "Get the first fulfilled promise that satisfies the provided testing function",
"license": "MIT", "license": "MIT",
"repository": "sindresorhus/p-locate", "repository": "sindresorhus/p-locate",
"funding": "https://github.com/sponsors/sindresorhus",
"author": { "author": {
"name": "Sindre Sorhus", "name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com", "email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com" "url": "sindresorhus.com"
}, },
"engines": { "engines": {
"node": ">=10" "node": ">=8"
}, },
"scripts": { "scripts": {
"test": "xo && ava && tsd" "test": "xo && ava && tsd"
@ -41,14 +40,14 @@
"bluebird" "bluebird"
], ],
"dependencies": { "dependencies": {
"p-limit": "^3.0.2" "p-limit": "^2.2.0"
}, },
"devDependencies": { "devDependencies": {
"ava": "^2.4.0", "ava": "^1.4.1",
"delay": "^4.1.0", "delay": "^4.1.0",
"in-range": "^2.0.0", "in-range": "^1.0.0",
"time-span": "^4.0.0", "time-span": "^3.0.0",
"tsd": "^0.13.1", "tsd": "^0.7.2",
"xo": "^0.32.1" "xo": "^0.24.0"
} }
} }

29
node_modules/p-locate/readme.md generated vendored
View File

@ -1,15 +1,17 @@
# p-locate [![Build Status](https://travis-ci.com/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.com/github/sindresorhus/p-locate) # p-locate [![Build Status](https://travis-ci.org/sindresorhus/p-locate.svg?branch=master)](https://travis-ci.org/sindresorhus/p-locate)
> Get the first fulfilled promise that satisfies the provided testing function > Get the first fulfilled promise that satisfies the provided testing function
Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find). Think of it like an async version of [`Array#find`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find).
## Install ## Install
``` ```
$ npm install p-locate $ npm install p-locate
``` ```
## Usage ## Usage
Here we find the first file that exists on disk, in array order. Here we find the first file that exists on disk, in array order.
@ -34,9 +36,10 @@ const files = [
*The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.* *The above is just an example. Use [`locate-path`](https://github.com/sindresorhus/locate-path) if you need this.*
## API ## API
### pLocate(input, tester, options?) ### pLocate(input, tester, [options])
Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`. Returns a `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
@ -54,25 +57,26 @@ This function will receive resolved values from `input` and is expected to retur
#### options #### options
Type: `object` Type: `Object`
##### concurrency ##### concurrency
Type: `number`\ Type: `number`<br>
Default: `Infinity`\ Default: `Infinity`<br>
Minimum: `1` Minimum: `1`
Number of concurrently pending promises returned by `tester`. Number of concurrently pending promises returned by `tester`.
##### preserveOrder ##### preserveOrder
Type: `boolean`\ Type: `boolean`<br>
Default: `true` Default: `true`
Preserve `input` order when searching. Preserve `input` order when searching.
Disable this to improve performance if you don't care about the order. Disable this to improve performance if you don't care about the order.
## Related ## Related
- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently - [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
@ -80,14 +84,7 @@ Disable this to improve performance if you don't care about the order.
- [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled - [p-any](https://github.com/sindresorhus/p-any) - Wait for any promise to be fulfilled
- [More…](https://github.com/sindresorhus/promise-fun) - [More…](https://github.com/sindresorhus/promise-fun)
---
<div align="center"> ## License
<b>
<a href="https://tidelift.com/subscription/pkg/npm-p-locate?utm_source=npm-p-locate&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> MIT © [Sindre Sorhus](https://sindresorhus.com)
</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>

30
node_modules/resolve-from/index.js generated vendored
View File

@ -3,9 +3,9 @@ const path = require('path');
const Module = require('module'); const Module = require('module');
const fs = require('fs'); const fs = require('fs');
const resolveFrom = (fromDir, moduleId, silent) => { const resolveFrom = (fromDirectory, moduleId, silent) => {
if (typeof fromDir !== 'string') { if (typeof fromDirectory !== 'string') {
throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``); throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDirectory}\``);
} }
if (typeof moduleId !== 'string') { if (typeof moduleId !== 'string') {
@ -13,35 +13,35 @@ const resolveFrom = (fromDir, moduleId, silent) => {
} }
try { try {
fromDir = fs.realpathSync(fromDir); fromDirectory = fs.realpathSync(fromDirectory);
} catch (err) { } catch (error) {
if (err.code === 'ENOENT') { if (error.code === 'ENOENT') {
fromDir = path.resolve(fromDir); fromDirectory = path.resolve(fromDirectory);
} else if (silent) { } else if (silent) {
return null; return;
} else { } else {
throw err; throw error;
} }
} }
const fromFile = path.join(fromDir, 'noop.js'); const fromFile = path.join(fromDirectory, 'noop.js');
const resolveFileName = () => Module._resolveFilename(moduleId, { const resolveFileName = () => Module._resolveFilename(moduleId, {
id: fromFile, id: fromFile,
filename: fromFile, filename: fromFile,
paths: Module._nodeModulePaths(fromDir) paths: Module._nodeModulePaths(fromDirectory)
}); });
if (silent) { if (silent) {
try { try {
return resolveFileName(); return resolveFileName();
} catch (err) { } catch (error) {
return null; return;
} }
} }
return resolveFileName(); return resolveFileName();
}; };
module.exports = (fromDir, moduleId) => resolveFrom(fromDir, moduleId); module.exports = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId);
module.exports.silent = (fromDir, moduleId) => resolveFrom(fromDir, moduleId, true); module.exports.silent = (fromDirectory, moduleId) => resolveFrom(fromDirectory, moduleId, true);

View File

@ -1,6 +1,6 @@
{ {
"name": "resolve-from", "name": "resolve-from",
"version": "4.0.0", "version": "5.0.0",
"description": "Resolve the path of a module like `require.resolve()` but from a given path", "description": "Resolve the path of a module like `require.resolve()` but from a given path",
"license": "MIT", "license": "MIT",
"repository": "sindresorhus/resolve-from", "repository": "sindresorhus/resolve-from",
@ -10,13 +10,14 @@
"url": "sindresorhus.com" "url": "sindresorhus.com"
}, },
"engines": { "engines": {
"node": ">=4" "node": ">=8"
}, },
"scripts": { "scripts": {
"test": "xo && ava" "test": "xo && ava && tsd"
}, },
"files": [ "files": [
"index.js" "index.js",
"index.d.ts"
], ],
"keywords": [ "keywords": [
"require", "require",
@ -28,7 +29,8 @@
"import" "import"
], ],
"devDependencies": { "devDependencies": {
"ava": "*", "ava": "^1.4.1",
"xo": "*" "tsd": "^0.7.2",
"xo": "^0.24.0"
} }
} }

10
node_modules/resolve-from/readme.md generated vendored
View File

@ -24,15 +24,15 @@ resolveFrom('foo', './bar');
## API ## API
### resolveFrom(fromDir, moduleId) ### resolveFrom(fromDirectory, moduleId)
Like `require()`, throws when the module can't be found. Like `require()`, throws when the module can't be found.
### resolveFrom.silent(fromDir, moduleId) ### resolveFrom.silent(fromDirectory, moduleId)
Returns `null` instead of throwing when the module can't be found. Returns `undefined` instead of throwing when the module can't be found.
#### fromDir #### fromDirectory
Type: `string` Type: `string`
@ -47,7 +47,7 @@ What you would use in `require()`.
## Tip ## Tip
Create a partial using a bound function if you want to resolve from the same `fromDir` multiple times: Create a partial using a bound function if you want to resolve from the same `fromDirectory` multiple times:
```js ```js
const resolveFromFoo = resolveFrom.bind(null, 'foo'); const resolveFromFoo = resolveFrom.bind(null, 'foo');

View File

@ -1 +1 @@
../../../json5/lib/cli.js ../json5/lib/cli.js

View File

@ -30,15 +30,19 @@
"node-fetch": "^3.2.10" "node-fetch": "^3.2.10"
}, },
"devDependencies": { "devDependencies": {
"@babel/preset-env": "^7.20.2",
"@types/node": "^18.11.9", "@types/node": "^18.11.9",
"@typescript-eslint/parser": "^5.42.1", "@typescript-eslint/parser": "^5.42.1",
"@vercel/ncc": "^0.34.0", "@vercel/ncc": "^0.34.0",
"babel-jest": "^29.3.1",
"eslint": "^8.27.0", "eslint": "^8.27.0",
"eslint-plugin-github": "^4.4.1", "eslint-plugin-github": "^4.4.1",
"https": "^1.0.0", "https": "^1.0.0",
"jest": "^29.3.1",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"prettier": "2.7.1", "prettier": "2.7.1",
"semver": "^7.3.8", "semver": "^7.3.8",
"ts-jest": "^29.0.3",
"typescript": "^4.8.4", "typescript": "^4.8.4",
"uuid": "^9.0.0" "uuid": "^9.0.0"
} }

View File

@ -4,9 +4,9 @@ var https = require('https')
class Http { class Http {
make( make(
url: string, url: string,
headers: string | null,
body: string | null, body: string | null,
ignoreCertificate: boolean | null headers: string | null = null,
ignoreCertificate: boolean | null = false
): Promise<any> { ): Promise<any> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
fetch( fetch(

View File

@ -37,7 +37,7 @@ async function run() {
// make the request // make the request
http http
.make(url, headers, body, insecure) .make(url, body, headers, insecure)
.then(res => { .then(res => {
// if the status code is not 2xx // if the status code is not 2xx
if (res.status >= 400) { if (res.status >= 400) {

2549
yarn.lock

File diff suppressed because it is too large Load Diff