Add node modules and compiled JavaScript from main (#57)
Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
parent
d893f27da9
commit
7f7e5ba5ea
6750 changed files with 1745644 additions and 10860 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -327,7 +327,5 @@ ASALocalRun/
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
.mfractor/
|
.mfractor/
|
||||||
node_modules
|
|
||||||
|
|
||||||
# Transpiled JS
|
# Transpiled JS
|
||||||
lib/
|
|
||||||
|
|
4662
lib/index.js
Normal file
4662
lib/index.js
Normal file
File diff suppressed because it is too large
Load diff
BIN
lib/unzip
Executable file
BIN
lib/unzip
Executable file
Binary file not shown.
BIN
lib/unzip-darwin
Executable file
BIN
lib/unzip-darwin
Executable file
Binary file not shown.
6007
node_modules/.package-lock.json
generated
vendored
Normal file
6007
node_modules/.package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
9
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
9
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
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.
|
147
node_modules/@actions/core/README.md
generated
vendored
Normal file
147
node_modules/@actions/core/README.md
generated
vendored
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
# `@actions/core`
|
||||||
|
|
||||||
|
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Import the package
|
||||||
|
|
||||||
|
```js
|
||||||
|
// javascript
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
// typescript
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Inputs/Outputs
|
||||||
|
|
||||||
|
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const myInput = core.getInput('inputName', { required: true });
|
||||||
|
|
||||||
|
core.setOutput('outputKey', 'outputVal');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exporting variables
|
||||||
|
|
||||||
|
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.exportVariable('envVar', 'Val');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Setting a secret
|
||||||
|
|
||||||
|
Setting a secret registers the secret with the runner to ensure it is masked in logs.
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.setSecret('myPassword');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### PATH Manipulation
|
||||||
|
|
||||||
|
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
|
||||||
|
|
||||||
|
```js
|
||||||
|
core.addPath('/path/to/mytool');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exit codes
|
||||||
|
|
||||||
|
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Do stuff
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// setFailed logs the message and sets a failing exit code
|
||||||
|
core.setFailed(`Action failed with error ${err}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Logging
|
||||||
|
|
||||||
|
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
const myInput = core.getInput('input');
|
||||||
|
try {
|
||||||
|
core.debug('Inside try block');
|
||||||
|
|
||||||
|
if (!myInput) {
|
||||||
|
core.warning('myInput was not set');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (core.isDebug()) {
|
||||||
|
// curl -v https://github.com
|
||||||
|
} else {
|
||||||
|
// curl https://github.com
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do stuff
|
||||||
|
core.info('Output to the actions build log')
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.error(`Error ${err}, action may still succeed though`);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This library can also wrap chunks of output in foldable groups.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core')
|
||||||
|
|
||||||
|
// Manually wrap output
|
||||||
|
core.startGroup('Do some function')
|
||||||
|
doSomeFunction()
|
||||||
|
core.endGroup()
|
||||||
|
|
||||||
|
// Wrap an asynchronous function call
|
||||||
|
const result = await core.group('Do something async', async () => {
|
||||||
|
const response = await doSomeHTTPRequest()
|
||||||
|
return response
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Action state
|
||||||
|
|
||||||
|
You can use this library to save state and get state for sharing information between a given wrapper action:
|
||||||
|
|
||||||
|
**action.yml**
|
||||||
|
```yaml
|
||||||
|
name: 'Wrapper action sample'
|
||||||
|
inputs:
|
||||||
|
name:
|
||||||
|
default: 'GitHub'
|
||||||
|
runs:
|
||||||
|
using: 'node12'
|
||||||
|
main: 'main.js'
|
||||||
|
post: 'cleanup.js'
|
||||||
|
```
|
||||||
|
|
||||||
|
In action's `main.js`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
core.saveState("pidToKill", 12345);
|
||||||
|
```
|
||||||
|
|
||||||
|
In action's `cleanup.js`:
|
||||||
|
```js
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
var pid = core.getState("pidToKill");
|
||||||
|
|
||||||
|
process.kill(pid);
|
||||||
|
```
|
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
Normal file
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
interface CommandProperties {
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Commands
|
||||||
|
*
|
||||||
|
* Command Format:
|
||||||
|
* ::name key=value,key=value::message
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
* ::warning::This is the message
|
||||||
|
* ::set-env name=MY_VAR::some value
|
||||||
|
*/
|
||||||
|
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
||||||
|
export declare function issue(name: string, message?: string): void;
|
||||||
|
export {};
|
79
node_modules/@actions/core/lib/command.js
generated
vendored
Normal file
79
node_modules/@actions/core/lib/command.js
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
"use strict";
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const os = __importStar(require("os"));
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
/**
|
||||||
|
* Commands
|
||||||
|
*
|
||||||
|
* Command Format:
|
||||||
|
* ::name key=value,key=value::message
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
* ::warning::This is the message
|
||||||
|
* ::set-env name=MY_VAR::some value
|
||||||
|
*/
|
||||||
|
function issueCommand(command, properties, message) {
|
||||||
|
const cmd = new Command(command, properties, message);
|
||||||
|
process.stdout.write(cmd.toString() + os.EOL);
|
||||||
|
}
|
||||||
|
exports.issueCommand = issueCommand;
|
||||||
|
function issue(name, message = '') {
|
||||||
|
issueCommand(name, {}, message);
|
||||||
|
}
|
||||||
|
exports.issue = issue;
|
||||||
|
const CMD_STRING = '::';
|
||||||
|
class Command {
|
||||||
|
constructor(command, properties, message) {
|
||||||
|
if (!command) {
|
||||||
|
command = 'missing.command';
|
||||||
|
}
|
||||||
|
this.command = command;
|
||||||
|
this.properties = properties;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
toString() {
|
||||||
|
let cmdStr = CMD_STRING + this.command;
|
||||||
|
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||||
|
cmdStr += ' ';
|
||||||
|
let first = true;
|
||||||
|
for (const key in this.properties) {
|
||||||
|
if (this.properties.hasOwnProperty(key)) {
|
||||||
|
const val = this.properties[key];
|
||||||
|
if (val) {
|
||||||
|
if (first) {
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
cmdStr += ',';
|
||||||
|
}
|
||||||
|
cmdStr += `${key}=${escapeProperty(val)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
||||||
|
return cmdStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function escapeData(s) {
|
||||||
|
return utils_1.toCommandValue(s)
|
||||||
|
.replace(/%/g, '%25')
|
||||||
|
.replace(/\r/g, '%0D')
|
||||||
|
.replace(/\n/g, '%0A');
|
||||||
|
}
|
||||||
|
function escapeProperty(s) {
|
||||||
|
return utils_1.toCommandValue(s)
|
||||||
|
.replace(/%/g, '%25')
|
||||||
|
.replace(/\r/g, '%0D')
|
||||||
|
.replace(/\n/g, '%0A')
|
||||||
|
.replace(/:/g, '%3A')
|
||||||
|
.replace(/,/g, '%2C');
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=command.js.map
|
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AACxB,mCAAsC;AAWtC;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
122
node_modules/@actions/core/lib/core.d.ts
generated
vendored
Normal file
122
node_modules/@actions/core/lib/core.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
/**
|
||||||
|
* Interface for getInput options
|
||||||
|
*/
|
||||||
|
export interface InputOptions {
|
||||||
|
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||||
|
required?: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* The code to exit an action
|
||||||
|
*/
|
||||||
|
export declare enum ExitCode {
|
||||||
|
/**
|
||||||
|
* A code indicating that the action was successful
|
||||||
|
*/
|
||||||
|
Success = 0,
|
||||||
|
/**
|
||||||
|
* A code indicating that the action was a failure
|
||||||
|
*/
|
||||||
|
Failure = 1
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Sets env variable for this action and future actions in the job
|
||||||
|
* @param name the name of the variable to set
|
||||||
|
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||||
|
*/
|
||||||
|
export declare function exportVariable(name: string, val: any): void;
|
||||||
|
/**
|
||||||
|
* Registers a secret which will get masked from logs
|
||||||
|
* @param secret value of the secret
|
||||||
|
*/
|
||||||
|
export declare function setSecret(secret: string): void;
|
||||||
|
/**
|
||||||
|
* Prepends inputPath to the PATH (for this action and future actions)
|
||||||
|
* @param inputPath
|
||||||
|
*/
|
||||||
|
export declare function addPath(inputPath: string): void;
|
||||||
|
/**
|
||||||
|
* Gets the value of an input. The value is also trimmed.
|
||||||
|
*
|
||||||
|
* @param name name of the input to get
|
||||||
|
* @param options optional. See InputOptions.
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
export declare function getInput(name: string, options?: InputOptions): string;
|
||||||
|
/**
|
||||||
|
* Sets the value of an output.
|
||||||
|
*
|
||||||
|
* @param name name of the output to set
|
||||||
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||||
|
*/
|
||||||
|
export declare function setOutput(name: string, value: any): void;
|
||||||
|
/**
|
||||||
|
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||||
|
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
export declare function setCommandEcho(enabled: boolean): void;
|
||||||
|
/**
|
||||||
|
* Sets the action status to failed.
|
||||||
|
* When the action exits it will be with an exit code of 1
|
||||||
|
* @param message add error issue message
|
||||||
|
*/
|
||||||
|
export declare function setFailed(message: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Gets whether Actions Step Debug is on or not
|
||||||
|
*/
|
||||||
|
export declare function isDebug(): boolean;
|
||||||
|
/**
|
||||||
|
* Writes debug message to user log
|
||||||
|
* @param message debug message
|
||||||
|
*/
|
||||||
|
export declare function debug(message: string): void;
|
||||||
|
/**
|
||||||
|
* Adds an error issue
|
||||||
|
* @param message error issue message. Errors will be converted to string via toString()
|
||||||
|
*/
|
||||||
|
export declare function error(message: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Adds an warning issue
|
||||||
|
* @param message warning issue message. Errors will be converted to string via toString()
|
||||||
|
*/
|
||||||
|
export declare function warning(message: string | Error): void;
|
||||||
|
/**
|
||||||
|
* Writes info to log with console.log.
|
||||||
|
* @param message info message
|
||||||
|
*/
|
||||||
|
export declare function info(message: string): void;
|
||||||
|
/**
|
||||||
|
* Begin an output group.
|
||||||
|
*
|
||||||
|
* Output until the next `groupEnd` will be foldable in this group
|
||||||
|
*
|
||||||
|
* @param name The name of the output group
|
||||||
|
*/
|
||||||
|
export declare function startGroup(name: string): void;
|
||||||
|
/**
|
||||||
|
* End an output group.
|
||||||
|
*/
|
||||||
|
export declare function endGroup(): void;
|
||||||
|
/**
|
||||||
|
* Wrap an asynchronous function call in a group.
|
||||||
|
*
|
||||||
|
* Returns the same type as the function itself.
|
||||||
|
*
|
||||||
|
* @param name The name of the group
|
||||||
|
* @param fn The function to wrap in the group
|
||||||
|
*/
|
||||||
|
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
||||||
|
/**
|
||||||
|
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||||
|
*
|
||||||
|
* @param name name of the state to store
|
||||||
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||||
|
*/
|
||||||
|
export declare function saveState(name: string, value: any): void;
|
||||||
|
/**
|
||||||
|
* Gets the value of an state set by this action's main execution.
|
||||||
|
*
|
||||||
|
* @param name name of the state to get
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
export declare function getState(name: string): string;
|
238
node_modules/@actions/core/lib/core.js
generated
vendored
Normal file
238
node_modules/@actions/core/lib/core.js
generated
vendored
Normal file
|
@ -0,0 +1,238 @@
|
||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const command_1 = require("./command");
|
||||||
|
const file_command_1 = require("./file-command");
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
const os = __importStar(require("os"));
|
||||||
|
const path = __importStar(require("path"));
|
||||||
|
/**
|
||||||
|
* The code to exit an action
|
||||||
|
*/
|
||||||
|
var ExitCode;
|
||||||
|
(function (ExitCode) {
|
||||||
|
/**
|
||||||
|
* A code indicating that the action was successful
|
||||||
|
*/
|
||||||
|
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||||
|
/**
|
||||||
|
* A code indicating that the action was a failure
|
||||||
|
*/
|
||||||
|
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||||
|
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Variables
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Sets env variable for this action and future actions in the job
|
||||||
|
* @param name the name of the variable to set
|
||||||
|
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
function exportVariable(name, val) {
|
||||||
|
const convertedVal = utils_1.toCommandValue(val);
|
||||||
|
process.env[name] = convertedVal;
|
||||||
|
const filePath = process.env['GITHUB_ENV'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||||
|
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||||
|
file_command_1.issueCommand('ENV', commandValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.exportVariable = exportVariable;
|
||||||
|
/**
|
||||||
|
* Registers a secret which will get masked from logs
|
||||||
|
* @param secret value of the secret
|
||||||
|
*/
|
||||||
|
function setSecret(secret) {
|
||||||
|
command_1.issueCommand('add-mask', {}, secret);
|
||||||
|
}
|
||||||
|
exports.setSecret = setSecret;
|
||||||
|
/**
|
||||||
|
* Prepends inputPath to the PATH (for this action and future actions)
|
||||||
|
* @param inputPath
|
||||||
|
*/
|
||||||
|
function addPath(inputPath) {
|
||||||
|
const filePath = process.env['GITHUB_PATH'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
file_command_1.issueCommand('PATH', inputPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
|
}
|
||||||
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||||
|
}
|
||||||
|
exports.addPath = addPath;
|
||||||
|
/**
|
||||||
|
* Gets the value of an input. The value is also trimmed.
|
||||||
|
*
|
||||||
|
* @param name name of the input to get
|
||||||
|
* @param options optional. See InputOptions.
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
function getInput(name, options) {
|
||||||
|
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
||||||
|
if (options && options.required && !val) {
|
||||||
|
throw new Error(`Input required and not supplied: ${name}`);
|
||||||
|
}
|
||||||
|
return val.trim();
|
||||||
|
}
|
||||||
|
exports.getInput = getInput;
|
||||||
|
/**
|
||||||
|
* Sets the value of an output.
|
||||||
|
*
|
||||||
|
* @param name name of the output to set
|
||||||
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
function setOutput(name, value) {
|
||||||
|
command_1.issueCommand('set-output', { name }, value);
|
||||||
|
}
|
||||||
|
exports.setOutput = setOutput;
|
||||||
|
/**
|
||||||
|
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||||
|
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function setCommandEcho(enabled) {
|
||||||
|
command_1.issue('echo', enabled ? 'on' : 'off');
|
||||||
|
}
|
||||||
|
exports.setCommandEcho = setCommandEcho;
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Results
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Sets the action status to failed.
|
||||||
|
* When the action exits it will be with an exit code of 1
|
||||||
|
* @param message add error issue message
|
||||||
|
*/
|
||||||
|
function setFailed(message) {
|
||||||
|
process.exitCode = ExitCode.Failure;
|
||||||
|
error(message);
|
||||||
|
}
|
||||||
|
exports.setFailed = setFailed;
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Logging Commands
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Gets whether Actions Step Debug is on or not
|
||||||
|
*/
|
||||||
|
function isDebug() {
|
||||||
|
return process.env['RUNNER_DEBUG'] === '1';
|
||||||
|
}
|
||||||
|
exports.isDebug = isDebug;
|
||||||
|
/**
|
||||||
|
* Writes debug message to user log
|
||||||
|
* @param message debug message
|
||||||
|
*/
|
||||||
|
function debug(message) {
|
||||||
|
command_1.issueCommand('debug', {}, message);
|
||||||
|
}
|
||||||
|
exports.debug = debug;
|
||||||
|
/**
|
||||||
|
* Adds an error issue
|
||||||
|
* @param message error issue message. Errors will be converted to string via toString()
|
||||||
|
*/
|
||||||
|
function error(message) {
|
||||||
|
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
||||||
|
}
|
||||||
|
exports.error = error;
|
||||||
|
/**
|
||||||
|
* Adds an warning issue
|
||||||
|
* @param message warning issue message. Errors will be converted to string via toString()
|
||||||
|
*/
|
||||||
|
function warning(message) {
|
||||||
|
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
||||||
|
}
|
||||||
|
exports.warning = warning;
|
||||||
|
/**
|
||||||
|
* Writes info to log with console.log.
|
||||||
|
* @param message info message
|
||||||
|
*/
|
||||||
|
function info(message) {
|
||||||
|
process.stdout.write(message + os.EOL);
|
||||||
|
}
|
||||||
|
exports.info = info;
|
||||||
|
/**
|
||||||
|
* Begin an output group.
|
||||||
|
*
|
||||||
|
* Output until the next `groupEnd` will be foldable in this group
|
||||||
|
*
|
||||||
|
* @param name The name of the output group
|
||||||
|
*/
|
||||||
|
function startGroup(name) {
|
||||||
|
command_1.issue('group', name);
|
||||||
|
}
|
||||||
|
exports.startGroup = startGroup;
|
||||||
|
/**
|
||||||
|
* End an output group.
|
||||||
|
*/
|
||||||
|
function endGroup() {
|
||||||
|
command_1.issue('endgroup');
|
||||||
|
}
|
||||||
|
exports.endGroup = endGroup;
|
||||||
|
/**
|
||||||
|
* Wrap an asynchronous function call in a group.
|
||||||
|
*
|
||||||
|
* Returns the same type as the function itself.
|
||||||
|
*
|
||||||
|
* @param name The name of the group
|
||||||
|
* @param fn The function to wrap in the group
|
||||||
|
*/
|
||||||
|
function group(name, fn) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
startGroup(name);
|
||||||
|
let result;
|
||||||
|
try {
|
||||||
|
result = yield fn();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
endGroup();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.group = group;
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Wrapper action state
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||||
|
*
|
||||||
|
* @param name name of the state to store
|
||||||
|
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
function saveState(name, value) {
|
||||||
|
command_1.issueCommand('save-state', { name }, value);
|
||||||
|
}
|
||||||
|
exports.saveState = saveState;
|
||||||
|
/**
|
||||||
|
* Gets the value of an state set by this action's main execution.
|
||||||
|
*
|
||||||
|
* @param name name of the state to get
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
function getState(name) {
|
||||||
|
return process.env[`STATE_${name}`] || '';
|
||||||
|
}
|
||||||
|
exports.getState = getState;
|
||||||
|
//# sourceMappingURL=core.js.map
|
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAC7C,iDAA+D;AAC/D,mCAAsC;AAEtC,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,sBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAEhC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;IAChD,IAAI,QAAQ,EAAE;QACZ,MAAM,SAAS,GAAG,qCAAqC,CAAA;QACvD,MAAM,YAAY,GAAG,GAAG,IAAI,KAAK,SAAS,GAAG,EAAE,CAAC,GAAG,GAAG,YAAY,GAAG,EAAE,CAAC,GAAG,GAAG,SAAS,EAAE,CAAA;QACzF,2BAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;KACtC;SAAM;QACL,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;KAC9C;AACH,CAAC;AAZD,wCAYC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;IACjD,IAAI,QAAQ,EAAE;QACZ,2BAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;KACpC;SAAM;QACL,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;KACxC;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AARD,0BAQC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAC7C,eAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAFD,wCAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAuB;IAC/C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IAEnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAJD,8BAIC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAuB;IAC3C,eAAK,CAAC,OAAO,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AACzE,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAuB;IAC7C,eAAK,CAAC,SAAS,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC3E,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
|
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export declare function issueCommand(command: string, message: any): void;
|
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
"use strict";
|
||||||
|
// For internal use, subject to change.
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
const fs = __importStar(require("fs"));
|
||||||
|
const os = __importStar(require("os"));
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
function issueCommand(command, message) {
|
||||||
|
const filePath = process.env[`GITHUB_${command}`];
|
||||||
|
if (!filePath) {
|
||||||
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
throw new Error(`Missing file at path: ${filePath}`);
|
||||||
|
}
|
||||||
|
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.issueCommand = issueCommand;
|
||||||
|
//# sourceMappingURL=file-command.js.map
|
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/**
|
||||||
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
|
* @param input input to sanitize into a string
|
||||||
|
*/
|
||||||
|
export declare function toCommandValue(input: any): string;
|
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
"use strict";
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
/**
|
||||||
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
|
* @param input input to sanitize into a string
|
||||||
|
*/
|
||||||
|
function toCommandValue(input) {
|
||||||
|
if (input === null || input === undefined) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
else if (typeof input === 'string' || input instanceof String) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
return JSON.stringify(input);
|
||||||
|
}
|
||||||
|
exports.toCommandValue = toCommandValue;
|
||||||
|
//# sourceMappingURL=utils.js.map
|
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC"}
|
41
node_modules/@actions/core/package.json
generated
vendored
Normal file
41
node_modules/@actions/core/package.json
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
{
|
||||||
|
"name": "@actions/core",
|
||||||
|
"version": "1.2.6",
|
||||||
|
"description": "Actions core lib",
|
||||||
|
"keywords": [
|
||||||
|
"github",
|
||||||
|
"actions",
|
||||||
|
"core"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/core.js",
|
||||||
|
"types": "lib/core.d.ts",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib",
|
||||||
|
"test": "__tests__"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"!.DS_Store"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/toolkit.git",
|
||||||
|
"directory": "packages/core"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||||
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
|
"tsc": "tsc"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^12.0.2"
|
||||||
|
}
|
||||||
|
}
|
7
node_modules/@actions/exec/LICENSE.md
generated
vendored
Normal file
7
node_modules/@actions/exec/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
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.
|
60
node_modules/@actions/exec/README.md
generated
vendored
Normal file
60
node_modules/@actions/exec/README.md
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
# `@actions/exec`
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
#### Basic
|
||||||
|
|
||||||
|
You can use this package to execute your tools on the command line in a cross platform way:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
await exec.exec('node index.js');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Args
|
||||||
|
|
||||||
|
You can also pass in arg arrays:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
await exec.exec('node', ['index.js', 'foo=bar']);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Output/options
|
||||||
|
|
||||||
|
Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5):
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
|
||||||
|
let myOutput = '';
|
||||||
|
let myError = '';
|
||||||
|
|
||||||
|
const options = {};
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
myOutput += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data: Buffer) => {
|
||||||
|
myError += data.toString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
options.cwd = './lib';
|
||||||
|
|
||||||
|
await exec.exec('node', ['index.js', 'foo=bar'], options);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Exec tools not in the PATH
|
||||||
|
|
||||||
|
You can use it in conjunction with the `which` function from `@actions/io` to execute tools that are not in the PATH:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
const pythonPath: string = await io.which('python', true)
|
||||||
|
|
||||||
|
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||||
|
```
|
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
Normal file
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
import * as im from './interfaces';
|
||||||
|
/**
|
||||||
|
* Exec a command.
|
||||||
|
* Output will be streamed to the live console.
|
||||||
|
* Returns promise with return code
|
||||||
|
*
|
||||||
|
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||||
|
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||||
|
* @param options optional exec options. See ExecOptions
|
||||||
|
* @returns Promise<number> exit code
|
||||||
|
*/
|
||||||
|
export declare function exec(commandLine: string, args?: string[], options?: im.ExecOptions): Promise<number>;
|
37
node_modules/@actions/exec/lib/exec.js
generated
vendored
Normal file
37
node_modules/@actions/exec/lib/exec.js
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const tr = require("./toolrunner");
|
||||||
|
/**
|
||||||
|
* Exec a command.
|
||||||
|
* Output will be streamed to the live console.
|
||||||
|
* Returns promise with return code
|
||||||
|
*
|
||||||
|
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||||
|
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||||
|
* @param options optional exec options. See ExecOptions
|
||||||
|
* @returns Promise<number> exit code
|
||||||
|
*/
|
||||||
|
function exec(commandLine, args, options) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const commandArgs = tr.argStringToArray(commandLine);
|
||||||
|
if (commandArgs.length === 0) {
|
||||||
|
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
||||||
|
}
|
||||||
|
// Path to tool to execute should be first arg
|
||||||
|
const toolPath = commandArgs[0];
|
||||||
|
args = commandArgs.slice(1).concat(args || []);
|
||||||
|
const runner = new tr.ToolRunner(toolPath, args, options);
|
||||||
|
return runner.exec();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.exec = exec;
|
||||||
|
//# sourceMappingURL=exec.js.map
|
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
Normal file
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,mCAAkC;AAElC;;;;;;;;;GASG;AACH,SAAsB,IAAI,CACxB,WAAmB,EACnB,IAAe,EACf,OAAwB;;QAExB,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;SACpE;QACD,8CAA8C;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAkB,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;CAAA;AAdD,oBAcC"}
|
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
Normal file
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/// <reference types="node" />
|
||||||
|
import * as stream from 'stream';
|
||||||
|
/**
|
||||||
|
* Interface for exec options
|
||||||
|
*/
|
||||||
|
export interface ExecOptions {
|
||||||
|
/** optional working directory. defaults to current */
|
||||||
|
cwd?: string;
|
||||||
|
/** optional envvar dictionary. defaults to current process's env */
|
||||||
|
env?: {
|
||||||
|
[key: string]: string;
|
||||||
|
};
|
||||||
|
/** optional. defaults to false */
|
||||||
|
silent?: boolean;
|
||||||
|
/** optional out stream to use. Defaults to process.stdout */
|
||||||
|
outStream?: stream.Writable;
|
||||||
|
/** optional err stream to use. Defaults to process.stderr */
|
||||||
|
errStream?: stream.Writable;
|
||||||
|
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
||||||
|
windowsVerbatimArguments?: boolean;
|
||||||
|
/** optional. whether to fail if output to stderr. defaults to false */
|
||||||
|
failOnStdErr?: boolean;
|
||||||
|
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
||||||
|
ignoreReturnCode?: boolean;
|
||||||
|
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
||||||
|
delay?: number;
|
||||||
|
/** optional. Listeners for output. Callback functions that will be called on these events */
|
||||||
|
listeners?: {
|
||||||
|
stdout?: (data: Buffer) => void;
|
||||||
|
stderr?: (data: Buffer) => void;
|
||||||
|
stdline?: (data: string) => void;
|
||||||
|
errline?: (data: string) => void;
|
||||||
|
debug?: (data: string) => void;
|
||||||
|
};
|
||||||
|
}
|
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
Normal file
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
//# sourceMappingURL=interfaces.js.map
|
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
Normal file
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
Normal file
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/// <reference types="node" />
|
||||||
|
import * as events from 'events';
|
||||||
|
import * as im from './interfaces';
|
||||||
|
export declare class ToolRunner extends events.EventEmitter {
|
||||||
|
constructor(toolPath: string, args?: string[], options?: im.ExecOptions);
|
||||||
|
private toolPath;
|
||||||
|
private args;
|
||||||
|
private options;
|
||||||
|
private _debug;
|
||||||
|
private _getCommandString;
|
||||||
|
private _processLineBuffer;
|
||||||
|
private _getSpawnFileName;
|
||||||
|
private _getSpawnArgs;
|
||||||
|
private _endsWith;
|
||||||
|
private _isCmdFile;
|
||||||
|
private _windowsQuoteCmdArg;
|
||||||
|
private _uvQuoteCmdArg;
|
||||||
|
private _cloneExecOptions;
|
||||||
|
private _getSpawnOptions;
|
||||||
|
/**
|
||||||
|
* Exec a tool.
|
||||||
|
* Output will be streamed to the live console.
|
||||||
|
* Returns promise with return code
|
||||||
|
*
|
||||||
|
* @param tool path to tool to exec
|
||||||
|
* @param options optional exec options. See ExecOptions
|
||||||
|
* @returns number
|
||||||
|
*/
|
||||||
|
exec(): Promise<number>;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Convert an arg string to an array of args. Handles escaping
|
||||||
|
*
|
||||||
|
* @param argString string of arguments
|
||||||
|
* @returns string[] array of arguments
|
||||||
|
*/
|
||||||
|
export declare function argStringToArray(argString: string): string[];
|
574
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
Normal file
574
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
Normal file
|
@ -0,0 +1,574 @@
|
||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const os = require("os");
|
||||||
|
const events = require("events");
|
||||||
|
const child = require("child_process");
|
||||||
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
/*
|
||||||
|
* Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
|
||||||
|
*/
|
||||||
|
class ToolRunner extends events.EventEmitter {
|
||||||
|
constructor(toolPath, args, options) {
|
||||||
|
super();
|
||||||
|
if (!toolPath) {
|
||||||
|
throw new Error("Parameter 'toolPath' cannot be null or empty.");
|
||||||
|
}
|
||||||
|
this.toolPath = toolPath;
|
||||||
|
this.args = args || [];
|
||||||
|
this.options = options || {};
|
||||||
|
}
|
||||||
|
_debug(message) {
|
||||||
|
if (this.options.listeners && this.options.listeners.debug) {
|
||||||
|
this.options.listeners.debug(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_getCommandString(options, noPrefix) {
|
||||||
|
const toolPath = this._getSpawnFileName();
|
||||||
|
const args = this._getSpawnArgs(options);
|
||||||
|
let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
// Windows + cmd file
|
||||||
|
if (this._isCmdFile()) {
|
||||||
|
cmd += toolPath;
|
||||||
|
for (const a of args) {
|
||||||
|
cmd += ` ${a}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Windows + verbatim
|
||||||
|
else if (options.windowsVerbatimArguments) {
|
||||||
|
cmd += `"${toolPath}"`;
|
||||||
|
for (const a of args) {
|
||||||
|
cmd += ` ${a}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Windows (regular)
|
||||||
|
else {
|
||||||
|
cmd += this._windowsQuoteCmdArg(toolPath);
|
||||||
|
for (const a of args) {
|
||||||
|
cmd += ` ${this._windowsQuoteCmdArg(a)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// OSX/Linux - this can likely be improved with some form of quoting.
|
||||||
|
// creating processes on Unix is fundamentally different than Windows.
|
||||||
|
// on Unix, execvp() takes an arg array.
|
||||||
|
cmd += toolPath;
|
||||||
|
for (const a of args) {
|
||||||
|
cmd += ` ${a}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cmd;
|
||||||
|
}
|
||||||
|
_processLineBuffer(data, strBuffer, onLine) {
|
||||||
|
try {
|
||||||
|
let s = strBuffer + data.toString();
|
||||||
|
let n = s.indexOf(os.EOL);
|
||||||
|
while (n > -1) {
|
||||||
|
const line = s.substring(0, n);
|
||||||
|
onLine(line);
|
||||||
|
// the rest of the string ...
|
||||||
|
s = s.substring(n + os.EOL.length);
|
||||||
|
n = s.indexOf(os.EOL);
|
||||||
|
}
|
||||||
|
strBuffer = s;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// streaming lines to console is best effort. Don't fail a build.
|
||||||
|
this._debug(`error processing line. Failed with error ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_getSpawnFileName() {
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
if (this._isCmdFile()) {
|
||||||
|
return process.env['COMSPEC'] || 'cmd.exe';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.toolPath;
|
||||||
|
}
|
||||||
|
_getSpawnArgs(options) {
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
if (this._isCmdFile()) {
|
||||||
|
let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
|
||||||
|
for (const a of this.args) {
|
||||||
|
argline += ' ';
|
||||||
|
argline += options.windowsVerbatimArguments
|
||||||
|
? a
|
||||||
|
: this._windowsQuoteCmdArg(a);
|
||||||
|
}
|
||||||
|
argline += '"';
|
||||||
|
return [argline];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.args;
|
||||||
|
}
|
||||||
|
_endsWith(str, end) {
|
||||||
|
return str.endsWith(end);
|
||||||
|
}
|
||||||
|
_isCmdFile() {
|
||||||
|
const upperToolPath = this.toolPath.toUpperCase();
|
||||||
|
return (this._endsWith(upperToolPath, '.CMD') ||
|
||||||
|
this._endsWith(upperToolPath, '.BAT'));
|
||||||
|
}
|
||||||
|
_windowsQuoteCmdArg(arg) {
|
||||||
|
// for .exe, apply the normal quoting rules that libuv applies
|
||||||
|
if (!this._isCmdFile()) {
|
||||||
|
return this._uvQuoteCmdArg(arg);
|
||||||
|
}
|
||||||
|
// otherwise apply quoting rules specific to the cmd.exe command line parser.
|
||||||
|
// the libuv rules are generic and are not designed specifically for cmd.exe
|
||||||
|
// command line parser.
|
||||||
|
//
|
||||||
|
// for a detailed description of the cmd.exe command line parser, refer to
|
||||||
|
// http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
|
||||||
|
// need quotes for empty arg
|
||||||
|
if (!arg) {
|
||||||
|
return '""';
|
||||||
|
}
|
||||||
|
// determine whether the arg needs to be quoted
|
||||||
|
const cmdSpecialChars = [
|
||||||
|
' ',
|
||||||
|
'\t',
|
||||||
|
'&',
|
||||||
|
'(',
|
||||||
|
')',
|
||||||
|
'[',
|
||||||
|
']',
|
||||||
|
'{',
|
||||||
|
'}',
|
||||||
|
'^',
|
||||||
|
'=',
|
||||||
|
';',
|
||||||
|
'!',
|
||||||
|
"'",
|
||||||
|
'+',
|
||||||
|
',',
|
||||||
|
'`',
|
||||||
|
'~',
|
||||||
|
'|',
|
||||||
|
'<',
|
||||||
|
'>',
|
||||||
|
'"'
|
||||||
|
];
|
||||||
|
let needsQuotes = false;
|
||||||
|
for (const char of arg) {
|
||||||
|
if (cmdSpecialChars.some(x => x === char)) {
|
||||||
|
needsQuotes = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// short-circuit if quotes not needed
|
||||||
|
if (!needsQuotes) {
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
// the following quoting rules are very similar to the rules that by libuv applies.
|
||||||
|
//
|
||||||
|
// 1) wrap the string in quotes
|
||||||
|
//
|
||||||
|
// 2) double-up quotes - i.e. " => ""
|
||||||
|
//
|
||||||
|
// this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
|
||||||
|
// doesn't work well with a cmd.exe command line.
|
||||||
|
//
|
||||||
|
// note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
|
||||||
|
// for example, the command line:
|
||||||
|
// foo.exe "myarg:""my val"""
|
||||||
|
// is parsed by a .NET console app into an arg array:
|
||||||
|
// [ "myarg:\"my val\"" ]
|
||||||
|
// which is the same end result when applying libuv quoting rules. although the actual
|
||||||
|
// command line from libuv quoting rules would look like:
|
||||||
|
// foo.exe "myarg:\"my val\""
|
||||||
|
//
|
||||||
|
// 3) double-up slashes that precede a quote,
|
||||||
|
// e.g. hello \world => "hello \world"
|
||||||
|
// hello\"world => "hello\\""world"
|
||||||
|
// hello\\"world => "hello\\\\""world"
|
||||||
|
// hello world\ => "hello world\\"
|
||||||
|
//
|
||||||
|
// technically this is not required for a cmd.exe command line, or the batch argument parser.
|
||||||
|
// the reasons for including this as a .cmd quoting rule are:
|
||||||
|
//
|
||||||
|
// a) this is optimized for the scenario where the argument is passed from the .cmd file to an
|
||||||
|
// external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
|
||||||
|
//
|
||||||
|
// b) it's what we've been doing previously (by deferring to node default behavior) and we
|
||||||
|
// haven't heard any complaints about that aspect.
|
||||||
|
//
|
||||||
|
// note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
|
||||||
|
// escaped when used on the command line directly - even though within a .cmd file % can be escaped
|
||||||
|
// by using %%.
|
||||||
|
//
|
||||||
|
// the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
|
||||||
|
// the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
|
||||||
|
//
|
||||||
|
// one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
|
||||||
|
// often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
|
||||||
|
// variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
|
||||||
|
// to an external program.
|
||||||
|
//
|
||||||
|
// an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
|
||||||
|
// % can be escaped within a .cmd file.
|
||||||
|
let reverse = '"';
|
||||||
|
let quoteHit = true;
|
||||||
|
for (let i = arg.length; i > 0; i--) {
|
||||||
|
// walk the string in reverse
|
||||||
|
reverse += arg[i - 1];
|
||||||
|
if (quoteHit && arg[i - 1] === '\\') {
|
||||||
|
reverse += '\\'; // double the slash
|
||||||
|
}
|
||||||
|
else if (arg[i - 1] === '"') {
|
||||||
|
quoteHit = true;
|
||||||
|
reverse += '"'; // double the quote
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
quoteHit = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reverse += '"';
|
||||||
|
return reverse
|
||||||
|
.split('')
|
||||||
|
.reverse()
|
||||||
|
.join('');
|
||||||
|
}
|
||||||
|
_uvQuoteCmdArg(arg) {
|
||||||
|
// Tool runner wraps child_process.spawn() and needs to apply the same quoting as
|
||||||
|
// Node in certain cases where the undocumented spawn option windowsVerbatimArguments
|
||||||
|
// is used.
|
||||||
|
//
|
||||||
|
// Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
|
||||||
|
// see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
|
||||||
|
// pasting copyright notice from Node within this function:
|
||||||
|
//
|
||||||
|
// Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
if (!arg) {
|
||||||
|
// Need double quotation for empty argument
|
||||||
|
return '""';
|
||||||
|
}
|
||||||
|
if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
|
||||||
|
// No quotation needed
|
||||||
|
return arg;
|
||||||
|
}
|
||||||
|
if (!arg.includes('"') && !arg.includes('\\')) {
|
||||||
|
// No embedded double quotes or backslashes, so I can just wrap
|
||||||
|
// quote marks around the whole thing.
|
||||||
|
return `"${arg}"`;
|
||||||
|
}
|
||||||
|
// Expected input/output:
|
||||||
|
// input : hello"world
|
||||||
|
// output: "hello\"world"
|
||||||
|
// input : hello""world
|
||||||
|
// output: "hello\"\"world"
|
||||||
|
// input : hello\world
|
||||||
|
// output: hello\world
|
||||||
|
// input : hello\\world
|
||||||
|
// output: hello\\world
|
||||||
|
// input : hello\"world
|
||||||
|
// output: "hello\\\"world"
|
||||||
|
// input : hello\\"world
|
||||||
|
// output: "hello\\\\\"world"
|
||||||
|
// input : hello world\
|
||||||
|
// output: "hello world\\" - note the comment in libuv actually reads "hello world\"
|
||||||
|
// but it appears the comment is wrong, it should be "hello world\\"
|
||||||
|
let reverse = '"';
|
||||||
|
let quoteHit = true;
|
||||||
|
for (let i = arg.length; i > 0; i--) {
|
||||||
|
// walk the string in reverse
|
||||||
|
reverse += arg[i - 1];
|
||||||
|
if (quoteHit && arg[i - 1] === '\\') {
|
||||||
|
reverse += '\\';
|
||||||
|
}
|
||||||
|
else if (arg[i - 1] === '"') {
|
||||||
|
quoteHit = true;
|
||||||
|
reverse += '\\';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
quoteHit = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reverse += '"';
|
||||||
|
return reverse
|
||||||
|
.split('')
|
||||||
|
.reverse()
|
||||||
|
.join('');
|
||||||
|
}
|
||||||
|
_cloneExecOptions(options) {
|
||||||
|
options = options || {};
|
||||||
|
const result = {
|
||||||
|
cwd: options.cwd || process.cwd(),
|
||||||
|
env: options.env || process.env,
|
||||||
|
silent: options.silent || false,
|
||||||
|
windowsVerbatimArguments: options.windowsVerbatimArguments || false,
|
||||||
|
failOnStdErr: options.failOnStdErr || false,
|
||||||
|
ignoreReturnCode: options.ignoreReturnCode || false,
|
||||||
|
delay: options.delay || 10000
|
||||||
|
};
|
||||||
|
result.outStream = options.outStream || process.stdout;
|
||||||
|
result.errStream = options.errStream || process.stderr;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
_getSpawnOptions(options, toolPath) {
|
||||||
|
options = options || {};
|
||||||
|
const result = {};
|
||||||
|
result.cwd = options.cwd;
|
||||||
|
result.env = options.env;
|
||||||
|
result['windowsVerbatimArguments'] =
|
||||||
|
options.windowsVerbatimArguments || this._isCmdFile();
|
||||||
|
if (options.windowsVerbatimArguments) {
|
||||||
|
result.argv0 = `"${toolPath}"`;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Exec a tool.
|
||||||
|
* Output will be streamed to the live console.
|
||||||
|
* Returns promise with return code
|
||||||
|
*
|
||||||
|
* @param tool path to tool to exec
|
||||||
|
* @param options optional exec options. See ExecOptions
|
||||||
|
* @returns number
|
||||||
|
*/
|
||||||
|
exec() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
this._debug(`exec tool: ${this.toolPath}`);
|
||||||
|
this._debug('arguments:');
|
||||||
|
for (const arg of this.args) {
|
||||||
|
this._debug(` ${arg}`);
|
||||||
|
}
|
||||||
|
const optionsNonNull = this._cloneExecOptions(this.options);
|
||||||
|
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
||||||
|
optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
|
||||||
|
}
|
||||||
|
const state = new ExecState(optionsNonNull, this.toolPath);
|
||||||
|
state.on('debug', (message) => {
|
||||||
|
this._debug(message);
|
||||||
|
});
|
||||||
|
const fileName = this._getSpawnFileName();
|
||||||
|
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
|
||||||
|
const stdbuffer = '';
|
||||||
|
if (cp.stdout) {
|
||||||
|
cp.stdout.on('data', (data) => {
|
||||||
|
if (this.options.listeners && this.options.listeners.stdout) {
|
||||||
|
this.options.listeners.stdout(data);
|
||||||
|
}
|
||||||
|
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
||||||
|
optionsNonNull.outStream.write(data);
|
||||||
|
}
|
||||||
|
this._processLineBuffer(data, stdbuffer, (line) => {
|
||||||
|
if (this.options.listeners && this.options.listeners.stdline) {
|
||||||
|
this.options.listeners.stdline(line);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const errbuffer = '';
|
||||||
|
if (cp.stderr) {
|
||||||
|
cp.stderr.on('data', (data) => {
|
||||||
|
state.processStderr = true;
|
||||||
|
if (this.options.listeners && this.options.listeners.stderr) {
|
||||||
|
this.options.listeners.stderr(data);
|
||||||
|
}
|
||||||
|
if (!optionsNonNull.silent &&
|
||||||
|
optionsNonNull.errStream &&
|
||||||
|
optionsNonNull.outStream) {
|
||||||
|
const s = optionsNonNull.failOnStdErr
|
||||||
|
? optionsNonNull.errStream
|
||||||
|
: optionsNonNull.outStream;
|
||||||
|
s.write(data);
|
||||||
|
}
|
||||||
|
this._processLineBuffer(data, errbuffer, (line) => {
|
||||||
|
if (this.options.listeners && this.options.listeners.errline) {
|
||||||
|
this.options.listeners.errline(line);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
cp.on('error', (err) => {
|
||||||
|
state.processError = err.message;
|
||||||
|
state.processExited = true;
|
||||||
|
state.processClosed = true;
|
||||||
|
state.CheckComplete();
|
||||||
|
});
|
||||||
|
cp.on('exit', (code) => {
|
||||||
|
state.processExitCode = code;
|
||||||
|
state.processExited = true;
|
||||||
|
this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
|
||||||
|
state.CheckComplete();
|
||||||
|
});
|
||||||
|
cp.on('close', (code) => {
|
||||||
|
state.processExitCode = code;
|
||||||
|
state.processExited = true;
|
||||||
|
state.processClosed = true;
|
||||||
|
this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
|
||||||
|
state.CheckComplete();
|
||||||
|
});
|
||||||
|
state.on('done', (error, exitCode) => {
|
||||||
|
if (stdbuffer.length > 0) {
|
||||||
|
this.emit('stdline', stdbuffer);
|
||||||
|
}
|
||||||
|
if (errbuffer.length > 0) {
|
||||||
|
this.emit('errline', errbuffer);
|
||||||
|
}
|
||||||
|
cp.removeAllListeners();
|
||||||
|
if (error) {
|
||||||
|
reject(error);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
resolve(exitCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ToolRunner = ToolRunner;
|
||||||
|
/**
|
||||||
|
* Convert an arg string to an array of args. Handles escaping
|
||||||
|
*
|
||||||
|
* @param argString string of arguments
|
||||||
|
* @returns string[] array of arguments
|
||||||
|
*/
|
||||||
|
function argStringToArray(argString) {
|
||||||
|
const args = [];
|
||||||
|
let inQuotes = false;
|
||||||
|
let escaped = false;
|
||||||
|
let arg = '';
|
||||||
|
function append(c) {
|
||||||
|
// we only escape double quotes.
|
||||||
|
if (escaped && c !== '"') {
|
||||||
|
arg += '\\';
|
||||||
|
}
|
||||||
|
arg += c;
|
||||||
|
escaped = false;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < argString.length; i++) {
|
||||||
|
const c = argString.charAt(i);
|
||||||
|
if (c === '"') {
|
||||||
|
if (!escaped) {
|
||||||
|
inQuotes = !inQuotes;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
append(c);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c === '\\' && escaped) {
|
||||||
|
append(c);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c === '\\' && inQuotes) {
|
||||||
|
escaped = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c === ' ' && !inQuotes) {
|
||||||
|
if (arg.length > 0) {
|
||||||
|
args.push(arg);
|
||||||
|
arg = '';
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
append(c);
|
||||||
|
}
|
||||||
|
if (arg.length > 0) {
|
||||||
|
args.push(arg.trim());
|
||||||
|
}
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
exports.argStringToArray = argStringToArray;
|
||||||
|
class ExecState extends events.EventEmitter {
|
||||||
|
constructor(options, toolPath) {
|
||||||
|
super();
|
||||||
|
this.processClosed = false; // tracks whether the process has exited and stdio is closed
|
||||||
|
this.processError = '';
|
||||||
|
this.processExitCode = 0;
|
||||||
|
this.processExited = false; // tracks whether the process has exited
|
||||||
|
this.processStderr = false; // tracks whether stderr was written to
|
||||||
|
this.delay = 10000; // 10 seconds
|
||||||
|
this.done = false;
|
||||||
|
this.timeout = null;
|
||||||
|
if (!toolPath) {
|
||||||
|
throw new Error('toolPath must not be empty');
|
||||||
|
}
|
||||||
|
this.options = options;
|
||||||
|
this.toolPath = toolPath;
|
||||||
|
if (options.delay) {
|
||||||
|
this.delay = options.delay;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CheckComplete() {
|
||||||
|
if (this.done) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.processClosed) {
|
||||||
|
this._setResult();
|
||||||
|
}
|
||||||
|
else if (this.processExited) {
|
||||||
|
this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_debug(message) {
|
||||||
|
this.emit('debug', message);
|
||||||
|
}
|
||||||
|
_setResult() {
|
||||||
|
// determine whether there is an error
|
||||||
|
let error;
|
||||||
|
if (this.processExited) {
|
||||||
|
if (this.processError) {
|
||||||
|
error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
|
||||||
|
}
|
||||||
|
else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
|
||||||
|
error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
|
||||||
|
}
|
||||||
|
else if (this.processStderr && this.options.failOnStdErr) {
|
||||||
|
error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// clear the timeout
|
||||||
|
if (this.timeout) {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
|
this.timeout = null;
|
||||||
|
}
|
||||||
|
this.done = true;
|
||||||
|
this.emit('done', error, this.processExitCode);
|
||||||
|
}
|
||||||
|
static HandleTimeout(state) {
|
||||||
|
if (state.done) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!state.processClosed && state.processExited) {
|
||||||
|
const message = `The STDIO streams did not close within ${state.delay /
|
||||||
|
1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
|
||||||
|
state._debug(message);
|
||||||
|
}
|
||||||
|
state._setResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=toolrunner.js.map
|
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
Normal file
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
38
node_modules/@actions/exec/package.json
generated
vendored
Normal file
38
node_modules/@actions/exec/package.json
generated
vendored
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{
|
||||||
|
"name": "@actions/exec",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"description": "Actions exec lib",
|
||||||
|
"keywords": [
|
||||||
|
"github",
|
||||||
|
"actions",
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/exec.js",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib",
|
||||||
|
"test": "__tests__"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/toolkit.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
|
"tsc": "tsc"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@actions/io": "^1.0.1"
|
||||||
|
},
|
||||||
|
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||||
|
}
|
7
node_modules/@actions/io/LICENSE.md
generated
vendored
Normal file
7
node_modules/@actions/io/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
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.
|
53
node_modules/@actions/io/README.md
generated
vendored
Normal file
53
node_modules/@actions/io/README.md
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
# `@actions/io`
|
||||||
|
|
||||||
|
> Core functions for cli filesystem scenarios
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
#### mkdir -p
|
||||||
|
|
||||||
|
Recursively make a directory. Follows rules specified in [man mkdir](https://linux.die.net/man/1/mkdir) with the `-p` option specified:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
await io.mkdirP('path/to/make');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### cp/mv
|
||||||
|
|
||||||
|
Copy or move files or folders. Follows rules specified in [man cp](https://linux.die.net/man/1/cp) and [man mv](https://linux.die.net/man/1/mv):
|
||||||
|
|
||||||
|
```js
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
// Recursive must be true for directories
|
||||||
|
const options = { recursive: true, force: false }
|
||||||
|
|
||||||
|
await io.cp('path/to/directory', 'path/to/dest', options);
|
||||||
|
await io.mv('path/to/file', 'path/to/dest');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### rm -rf
|
||||||
|
|
||||||
|
Remove a file or folder recursively. Follows rules specified in [man rm](https://linux.die.net/man/1/rm) with the `-r` and `-f` rules specified.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
await io.rmRF('path/to/directory');
|
||||||
|
await io.rmRF('path/to/file');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### which
|
||||||
|
|
||||||
|
Get the path to a tool and resolves via paths. Follows the rules specified in [man which](https://linux.die.net/man/1/which).
|
||||||
|
|
||||||
|
```js
|
||||||
|
const exec = require('@actions/exec');
|
||||||
|
const io = require('@actions/io');
|
||||||
|
|
||||||
|
const pythonPath: string = await io.which('python', true)
|
||||||
|
|
||||||
|
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||||
|
```
|
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
Normal file
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/// <reference types="node" />
|
||||||
|
import * as fs from 'fs';
|
||||||
|
export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, readlink: typeof fs.promises.readlink, rename: typeof fs.promises.rename, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
|
||||||
|
export declare const IS_WINDOWS: boolean;
|
||||||
|
export declare function exists(fsPath: string): Promise<boolean>;
|
||||||
|
export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
|
||||||
|
/**
|
||||||
|
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||||
|
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||||
|
*/
|
||||||
|
export declare function isRooted(p: string): boolean;
|
||||||
|
/**
|
||||||
|
* Recursively create a directory at `fsPath`.
|
||||||
|
*
|
||||||
|
* This implementation is optimistic, meaning it attempts to create the full
|
||||||
|
* path first, and backs up the path stack from there.
|
||||||
|
*
|
||||||
|
* @param fsPath The path to create
|
||||||
|
* @param maxDepth The maximum recursion depth
|
||||||
|
* @param depth The current recursion depth
|
||||||
|
*/
|
||||||
|
export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Best effort attempt to determine whether a file exists and is executable.
|
||||||
|
* @param filePath file path to check
|
||||||
|
* @param extensions additional file extensions to try
|
||||||
|
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||||
|
*/
|
||||||
|
export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>;
|
195
node_modules/@actions/io/lib/io-util.js
generated
vendored
Normal file
195
node_modules/@actions/io/lib/io-util.js
generated
vendored
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var _a;
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const assert_1 = require("assert");
|
||||||
|
const fs = require("fs");
|
||||||
|
const path = require("path");
|
||||||
|
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||||
|
exports.IS_WINDOWS = process.platform === 'win32';
|
||||||
|
function exists(fsPath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
|
yield exports.stat(fsPath);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
if (err.code === 'ENOENT') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.exists = exists;
|
||||||
|
function isDirectory(fsPath, useStat = false) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
|
||||||
|
return stats.isDirectory();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.isDirectory = isDirectory;
|
||||||
|
/**
|
||||||
|
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||||
|
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||||
|
*/
|
||||||
|
function isRooted(p) {
|
||||||
|
p = normalizeSeparators(p);
|
||||||
|
if (!p) {
|
||||||
|
throw new Error('isRooted() parameter "p" cannot be empty');
|
||||||
|
}
|
||||||
|
if (exports.IS_WINDOWS) {
|
||||||
|
return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
|
||||||
|
); // e.g. C: or C:\hello
|
||||||
|
}
|
||||||
|
return p.startsWith('/');
|
||||||
|
}
|
||||||
|
exports.isRooted = isRooted;
|
||||||
|
/**
|
||||||
|
* Recursively create a directory at `fsPath`.
|
||||||
|
*
|
||||||
|
* This implementation is optimistic, meaning it attempts to create the full
|
||||||
|
* path first, and backs up the path stack from there.
|
||||||
|
*
|
||||||
|
* @param fsPath The path to create
|
||||||
|
* @param maxDepth The maximum recursion depth
|
||||||
|
* @param depth The current recursion depth
|
||||||
|
*/
|
||||||
|
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||||
|
fsPath = path.resolve(fsPath);
|
||||||
|
if (depth >= maxDepth)
|
||||||
|
return exports.mkdir(fsPath);
|
||||||
|
try {
|
||||||
|
yield exports.mkdir(fsPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
switch (err.code) {
|
||||||
|
case 'ENOENT': {
|
||||||
|
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
||||||
|
yield exports.mkdir(fsPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
let stats;
|
||||||
|
try {
|
||||||
|
stats = yield exports.stat(fsPath);
|
||||||
|
}
|
||||||
|
catch (err2) {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
if (!stats.isDirectory())
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.mkdirP = mkdirP;
|
||||||
|
/**
|
||||||
|
* Best effort attempt to determine whether a file exists and is executable.
|
||||||
|
* @param filePath file path to check
|
||||||
|
* @param extensions additional file extensions to try
|
||||||
|
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||||
|
*/
|
||||||
|
function tryGetExecutablePath(filePath, extensions) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let stats = undefined;
|
||||||
|
try {
|
||||||
|
// test file exists
|
||||||
|
stats = yield exports.stat(filePath);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
if (err.code !== 'ENOENT') {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stats && stats.isFile()) {
|
||||||
|
if (exports.IS_WINDOWS) {
|
||||||
|
// on Windows, test for valid extension
|
||||||
|
const upperExt = path.extname(filePath).toUpperCase();
|
||||||
|
if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (isUnixExecutable(stats)) {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// try each extension
|
||||||
|
const originalFilePath = filePath;
|
||||||
|
for (const extension of extensions) {
|
||||||
|
filePath = originalFilePath + extension;
|
||||||
|
stats = undefined;
|
||||||
|
try {
|
||||||
|
stats = yield exports.stat(filePath);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
if (err.code !== 'ENOENT') {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stats && stats.isFile()) {
|
||||||
|
if (exports.IS_WINDOWS) {
|
||||||
|
// preserve the case of the actual file (since an extension was appended)
|
||||||
|
try {
|
||||||
|
const directory = path.dirname(filePath);
|
||||||
|
const upperName = path.basename(filePath).toUpperCase();
|
||||||
|
for (const actualName of yield exports.readdir(directory)) {
|
||||||
|
if (upperName === actualName.toUpperCase()) {
|
||||||
|
filePath = path.join(directory, actualName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
|
||||||
|
}
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (isUnixExecutable(stats)) {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.tryGetExecutablePath = tryGetExecutablePath;
|
||||||
|
function normalizeSeparators(p) {
|
||||||
|
p = p || '';
|
||||||
|
if (exports.IS_WINDOWS) {
|
||||||
|
// convert slashes on Windows
|
||||||
|
p = p.replace(/\//g, '\\');
|
||||||
|
// remove redundant slashes
|
||||||
|
return p.replace(/\\\\+/g, '\\');
|
||||||
|
}
|
||||||
|
// remove redundant slashes
|
||||||
|
return p.replace(/\/\/+/g, '/');
|
||||||
|
}
|
||||||
|
// on Mac/Linux, test the execute bit
|
||||||
|
// R W X R W X R W X
|
||||||
|
// 256 128 64 32 16 8 4 2 1
|
||||||
|
function isUnixExecutable(stats) {
|
||||||
|
return ((stats.mode & 1) > 0 ||
|
||||||
|
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
||||||
|
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=io-util.js.map
|
1
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
Normal file
1
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAyB;AACzB,yBAAwB;AACxB,6BAA4B;AAEf,gBAYE,qTAAA;AAEF,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAEtD,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,OAAO,KAAK,CAAA;aACb;YAED,MAAM,GAAG,CAAA;SACV;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CAAA;AAZD,wBAYC;AAED,SAAsB,WAAW,CAC/B,MAAc,EACd,UAAmB,KAAK;;QAExB,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,YAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;QAChE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAA;IAC5B,CAAC;CAAA;AAND,kCAMC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,CAAS;IAChC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAC1B,IAAI,CAAC,CAAC,EAAE;QACN,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IAED,IAAI,kBAAU,EAAE;QACd,OAAO,CACL,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,8BAA8B;SACxE,CAAA,CAAC,sBAAsB;KACzB;IAED,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AAbD,4BAaC;AAED;;;;;;;;;GASG;AACH,SAAsB,MAAM,CAC1B,MAAc,EACd,WAAmB,IAAI,EACvB,QAAgB,CAAC;;QAEjB,WAAE,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAA;QAE9C,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE7B,IAAI,KAAK,IAAI,QAAQ;YAAE,OAAO,aAAK,CAAC,MAAM,CAAC,CAAA;QAE3C,IAAI;YACF,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;YACnB,OAAM;SACP;QAAC,OAAO,GAAG,EAAE;YACZ,QAAQ,GAAG,CAAC,IAAI,EAAE;gBAChB,KAAK,QAAQ,CAAC,CAAC;oBACb,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;oBACvD,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;oBACnB,OAAM;iBACP;gBACD,OAAO,CAAC,CAAC;oBACP,IAAI,KAAe,CAAA;oBAEnB,IAAI;wBACF,KAAK,GAAG,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;qBAC3B;oBAAC,OAAO,IAAI,EAAE;wBACb,MAAM,GAAG,CAAA;qBACV;oBAED,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;wBAAE,MAAM,GAAG,CAAA;iBACpC;aACF;SACF;IACH,CAAC;CAAA;AAlCD,wBAkCC;AAED;;;;;GAKG;AACH,SAAsB,oBAAoB,CACxC,QAAgB,EAChB,UAAoB;;QAEpB,IAAI,KAAK,GAAyB,SAAS,CAAA;QAC3C,IAAI;YACF,mBAAmB;YACnB,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;SAC7B;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;aACF;SACF;QACD,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;YAC3B,IAAI,kBAAU,EAAE;gBACd,uCAAuC;gBACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;gBACrD,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,EAAE;oBACpE,OAAO,QAAQ,CAAA;iBAChB;aACF;iBAAM;gBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;oBAC3B,OAAO,QAAQ,CAAA;iBAChB;aACF;SACF;QAED,qBAAqB;QACrB,MAAM,gBAAgB,GAAG,QAAQ,CAAA;QACjC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAAA;YAEvC,KAAK,GAAG,SAAS,CAAA;YACjB,IAAI;gBACF,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;aAC7B;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;oBACzB,sCAAsC;oBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;iBACF;aACF;YAED,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;gBAC3B,IAAI,kBAAU,EAAE;oBACd,yEAAyE;oBACzE,IAAI;wBACF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;wBACxC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;wBACvD,KAAK,MAAM,UAAU,IAAI,MAAM,eAAO,CAAC,SAAS,CAAC,EAAE;4BACjD,IAAI,SAAS,KAAK,UAAU,CAAC,WAAW,EAAE,EAAE;gCAC1C,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;gCAC3C,MAAK;6BACN;yBACF;qBACF;oBAAC,OAAO,GAAG,EAAE;wBACZ,sCAAsC;wBACtC,OAAO,CAAC,GAAG,CACT,yEAAyE,QAAQ,MAAM,GAAG,EAAE,CAC7F,CAAA;qBACF;oBAED,OAAO,QAAQ,CAAA;iBAChB;qBAAM;oBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;wBAC3B,OAAO,QAAQ,CAAA;qBAChB;iBACF;aACF;SACF;QAED,OAAO,EAAE,CAAA;IACX,CAAC;CAAA;AA5ED,oDA4EC;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IACX,IAAI,kBAAU,EAAE;QACd,6BAA6B;QAC7B,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAE1B,2BAA2B;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KACjC;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC;AAED,qCAAqC;AACrC,6BAA6B;AAC7B,6BAA6B;AAC7B,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACxD,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC"}
|
56
node_modules/@actions/io/lib/io.d.ts
generated
vendored
Normal file
56
node_modules/@actions/io/lib/io.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
/**
|
||||||
|
* Interface for cp/mv options
|
||||||
|
*/
|
||||||
|
export interface CopyOptions {
|
||||||
|
/** Optional. Whether to recursively copy all subdirectories. Defaults to false */
|
||||||
|
recursive?: boolean;
|
||||||
|
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||||
|
force?: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Interface for cp/mv options
|
||||||
|
*/
|
||||||
|
export interface MoveOptions {
|
||||||
|
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||||
|
force?: boolean;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Copies a file or folder.
|
||||||
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||||
|
*
|
||||||
|
* @param source source path
|
||||||
|
* @param dest destination path
|
||||||
|
* @param options optional. See CopyOptions.
|
||||||
|
*/
|
||||||
|
export declare function cp(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Moves a path.
|
||||||
|
*
|
||||||
|
* @param source source path
|
||||||
|
* @param dest destination path
|
||||||
|
* @param options optional. See MoveOptions.
|
||||||
|
*/
|
||||||
|
export declare function mv(source: string, dest: string, options?: MoveOptions): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Remove a path recursively with force
|
||||||
|
*
|
||||||
|
* @param inputPath path to remove
|
||||||
|
*/
|
||||||
|
export declare function rmRF(inputPath: string): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Make a directory. Creates the full path with folders in between
|
||||||
|
* Will throw if it fails
|
||||||
|
*
|
||||||
|
* @param fsPath path to create
|
||||||
|
* @returns Promise<void>
|
||||||
|
*/
|
||||||
|
export declare function mkdirP(fsPath: string): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||||
|
* If you check and the tool does not exist, it will throw.
|
||||||
|
*
|
||||||
|
* @param tool name of the tool
|
||||||
|
* @param check whether to check if tool exists
|
||||||
|
* @returns Promise<string> path to tool
|
||||||
|
*/
|
||||||
|
export declare function which(tool: string, check?: boolean): Promise<string>;
|
290
node_modules/@actions/io/lib/io.js
generated
vendored
Normal file
290
node_modules/@actions/io/lib/io.js
generated
vendored
Normal file
|
@ -0,0 +1,290 @@
|
||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const childProcess = require("child_process");
|
||||||
|
const path = require("path");
|
||||||
|
const util_1 = require("util");
|
||||||
|
const ioUtil = require("./io-util");
|
||||||
|
const exec = util_1.promisify(childProcess.exec);
|
||||||
|
/**
|
||||||
|
* Copies a file or folder.
|
||||||
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||||
|
*
|
||||||
|
* @param source source path
|
||||||
|
* @param dest destination path
|
||||||
|
* @param options optional. See CopyOptions.
|
||||||
|
*/
|
||||||
|
function cp(source, dest, options = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const { force, recursive } = readCopyOptions(options);
|
||||||
|
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
||||||
|
// Dest is an existing file, but not forcing
|
||||||
|
if (destStat && destStat.isFile() && !force) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// If dest is an existing directory, should copy inside.
|
||||||
|
const newDest = destStat && destStat.isDirectory()
|
||||||
|
? path.join(dest, path.basename(source))
|
||||||
|
: dest;
|
||||||
|
if (!(yield ioUtil.exists(source))) {
|
||||||
|
throw new Error(`no such file or directory: ${source}`);
|
||||||
|
}
|
||||||
|
const sourceStat = yield ioUtil.stat(source);
|
||||||
|
if (sourceStat.isDirectory()) {
|
||||||
|
if (!recursive) {
|
||||||
|
throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield cpDirRecursive(source, newDest, 0, force);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (path.relative(source, newDest) === '') {
|
||||||
|
// a file cannot be copied to itself
|
||||||
|
throw new Error(`'${newDest}' and '${source}' are the same file`);
|
||||||
|
}
|
||||||
|
yield copyFile(source, newDest, force);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.cp = cp;
|
||||||
|
/**
|
||||||
|
* Moves a path.
|
||||||
|
*
|
||||||
|
* @param source source path
|
||||||
|
* @param dest destination path
|
||||||
|
* @param options optional. See MoveOptions.
|
||||||
|
*/
|
||||||
|
function mv(source, dest, options = {}) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (yield ioUtil.exists(dest)) {
|
||||||
|
let destExists = true;
|
||||||
|
if (yield ioUtil.isDirectory(dest)) {
|
||||||
|
// If dest is directory copy src into dest
|
||||||
|
dest = path.join(dest, path.basename(source));
|
||||||
|
destExists = yield ioUtil.exists(dest);
|
||||||
|
}
|
||||||
|
if (destExists) {
|
||||||
|
if (options.force == null || options.force) {
|
||||||
|
yield rmRF(dest);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error('Destination already exists');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
yield mkdirP(path.dirname(dest));
|
||||||
|
yield ioUtil.rename(source, dest);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.mv = mv;
|
||||||
|
/**
|
||||||
|
* Remove a path recursively with force
|
||||||
|
*
|
||||||
|
* @param inputPath path to remove
|
||||||
|
*/
|
||||||
|
function rmRF(inputPath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (ioUtil.IS_WINDOWS) {
|
||||||
|
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||||
|
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||||
|
try {
|
||||||
|
if (yield ioUtil.isDirectory(inputPath, true)) {
|
||||||
|
yield exec(`rd /s /q "${inputPath}"`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield exec(`del /f /a "${inputPath}"`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT')
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
||||||
|
try {
|
||||||
|
yield ioUtil.unlink(inputPath);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT')
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
let isDir = false;
|
||||||
|
try {
|
||||||
|
isDir = yield ioUtil.isDirectory(inputPath);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
|
// other errors are valid
|
||||||
|
if (err.code !== 'ENOENT')
|
||||||
|
throw err;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isDir) {
|
||||||
|
yield exec(`rm -rf "${inputPath}"`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield ioUtil.unlink(inputPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.rmRF = rmRF;
|
||||||
|
/**
|
||||||
|
* Make a directory. Creates the full path with folders in between
|
||||||
|
* Will throw if it fails
|
||||||
|
*
|
||||||
|
* @param fsPath path to create
|
||||||
|
* @returns Promise<void>
|
||||||
|
*/
|
||||||
|
function mkdirP(fsPath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
yield ioUtil.mkdirP(fsPath);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.mkdirP = mkdirP;
|
||||||
|
/**
|
||||||
|
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||||
|
* If you check and the tool does not exist, it will throw.
|
||||||
|
*
|
||||||
|
* @param tool name of the tool
|
||||||
|
* @param check whether to check if tool exists
|
||||||
|
* @returns Promise<string> path to tool
|
||||||
|
*/
|
||||||
|
function which(tool, check) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!tool) {
|
||||||
|
throw new Error("parameter 'tool' is required");
|
||||||
|
}
|
||||||
|
// recursive when check=true
|
||||||
|
if (check) {
|
||||||
|
const result = yield which(tool, false);
|
||||||
|
if (!result) {
|
||||||
|
if (ioUtil.IS_WINDOWS) {
|
||||||
|
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
// build the list of extensions to try
|
||||||
|
const extensions = [];
|
||||||
|
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
||||||
|
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
||||||
|
if (extension) {
|
||||||
|
extensions.push(extension);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if it's rooted, return it if exists. otherwise return empty.
|
||||||
|
if (ioUtil.isRooted(tool)) {
|
||||||
|
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
||||||
|
if (filePath) {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
// if any path separators, return empty
|
||||||
|
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
// build the list of directories
|
||||||
|
//
|
||||||
|
// Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
|
||||||
|
// it feels like we should not do this. Checking the current directory seems like more of a use
|
||||||
|
// case of a shell, and the which() function exposed by the toolkit should strive for consistency
|
||||||
|
// across platforms.
|
||||||
|
const directories = [];
|
||||||
|
if (process.env.PATH) {
|
||||||
|
for (const p of process.env.PATH.split(path.delimiter)) {
|
||||||
|
if (p) {
|
||||||
|
directories.push(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// return the first match
|
||||||
|
for (const directory of directories) {
|
||||||
|
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
||||||
|
if (filePath) {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
throw new Error(`which failed with message ${err.message}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.which = which;
|
||||||
|
function readCopyOptions(options) {
|
||||||
|
const force = options.force == null ? true : options.force;
|
||||||
|
const recursive = Boolean(options.recursive);
|
||||||
|
return { force, recursive };
|
||||||
|
}
|
||||||
|
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Ensure there is not a run away recursive copy
|
||||||
|
if (currentDepth >= 255)
|
||||||
|
return;
|
||||||
|
currentDepth++;
|
||||||
|
yield mkdirP(destDir);
|
||||||
|
const files = yield ioUtil.readdir(sourceDir);
|
||||||
|
for (const fileName of files) {
|
||||||
|
const srcFile = `${sourceDir}/${fileName}`;
|
||||||
|
const destFile = `${destDir}/${fileName}`;
|
||||||
|
const srcFileStat = yield ioUtil.lstat(srcFile);
|
||||||
|
if (srcFileStat.isDirectory()) {
|
||||||
|
// Recurse
|
||||||
|
yield cpDirRecursive(srcFile, destFile, currentDepth, force);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield copyFile(srcFile, destFile, force);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Change the mode for the newly created directory
|
||||||
|
yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Buffered file copy
|
||||||
|
function copyFile(srcFile, destFile, force) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
|
||||||
|
// unlink/re-link it
|
||||||
|
try {
|
||||||
|
yield ioUtil.lstat(destFile);
|
||||||
|
yield ioUtil.unlink(destFile);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
// Try to override file permission
|
||||||
|
if (e.code === 'EPERM') {
|
||||||
|
yield ioUtil.chmod(destFile, '0666');
|
||||||
|
yield ioUtil.unlink(destFile);
|
||||||
|
}
|
||||||
|
// other errors = it doesn't exist, no work to do
|
||||||
|
}
|
||||||
|
// Copy over symlink
|
||||||
|
const symlinkFull = yield ioUtil.readlink(srcFile);
|
||||||
|
yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
|
||||||
|
}
|
||||||
|
else if (!(yield ioUtil.exists(destFile)) || force) {
|
||||||
|
yield ioUtil.copyFile(srcFile, destFile);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=io.js.map
|
1
node_modules/@actions/io/lib/io.js.map
generated
vendored
Normal file
1
node_modules/@actions/io/lib/io.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
35
node_modules/@actions/io/package.json
generated
vendored
Normal file
35
node_modules/@actions/io/package.json
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"name": "@actions/io",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"description": "Actions io lib",
|
||||||
|
"keywords": [
|
||||||
|
"github",
|
||||||
|
"actions",
|
||||||
|
"io"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/actions/toolkit/tree/master/packages/io",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/io.js",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib",
|
||||||
|
"test": "__tests__"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/toolkit.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
|
"tsc": "tsc"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
},
|
||||||
|
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||||
|
}
|
7
node_modules/@actions/tool-cache/LICENSE.md
generated
vendored
Normal file
7
node_modules/@actions/tool-cache/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
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.
|
82
node_modules/@actions/tool-cache/README.md
generated
vendored
Normal file
82
node_modules/@actions/tool-cache/README.md
generated
vendored
Normal file
|
@ -0,0 +1,82 @@
|
||||||
|
# `@actions/tool-cache`
|
||||||
|
|
||||||
|
> Functions necessary for downloading and caching tools.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
#### Download
|
||||||
|
|
||||||
|
You can use this to download tools (or other files) from a download URL:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
|
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Extract
|
||||||
|
|
||||||
|
These can then be extracted in platform specific ways:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
const node12Path = tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
|
||||||
|
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
|
||||||
|
|
||||||
|
// Or alternately
|
||||||
|
const node12Path = tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
|
||||||
|
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||||
|
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Cache
|
||||||
|
|
||||||
|
Finally, you can cache these directories in our tool-cache. This is useful if you want to switch back and forth between versions of a tool, or save a tool between runs for private runners (private runners are still in development but are on the roadmap).
|
||||||
|
|
||||||
|
You'll often want to add it to the path as part of this step:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const tc = require('@actions/tool-cache');
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||||
|
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||||
|
|
||||||
|
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');
|
||||||
|
core.addPath(cachedPath);
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also cache files for reuse.
|
||||||
|
|
||||||
|
```js
|
||||||
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
|
tc.cacheFile('path/to/exe', 'destFileName.exe', 'myExeName', '1.1.0');
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Find
|
||||||
|
|
||||||
|
Finally, you can find directories and files you've previously cached:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const tc = require('@actions/tool-cache');
|
||||||
|
const core = require('@actions/core');
|
||||||
|
|
||||||
|
const nodeDirectory = tc.find('node', '12.x', 'x64');
|
||||||
|
core.addPath(nodeDirectory);
|
||||||
|
```
|
||||||
|
|
||||||
|
You can even find all cached versions of a tool:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
|
const allNodeVersions = tc.findAllVersions('node');
|
||||||
|
console.log(`Versions of node available: ${allNodeVersions}`);
|
||||||
|
```
|
79
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
Normal file
79
node_modules/@actions/tool-cache/lib/tool-cache.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
export declare class HTTPError extends Error {
|
||||||
|
readonly httpStatusCode: number | undefined;
|
||||||
|
constructor(httpStatusCode: number | undefined);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Download a tool from an url and stream it into a file
|
||||||
|
*
|
||||||
|
* @param url url of tool to download
|
||||||
|
* @returns path to downloaded tool
|
||||||
|
*/
|
||||||
|
export declare function downloadTool(url: string): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Extract a .7z file
|
||||||
|
*
|
||||||
|
* @param file path to the .7z file
|
||||||
|
* @param dest destination directory. Optional.
|
||||||
|
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||||
|
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||||
|
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||||
|
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||||
|
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||||
|
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||||
|
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||||
|
* to 7zr.exe can be pass to this function.
|
||||||
|
* @returns path to the destination directory
|
||||||
|
*/
|
||||||
|
export declare function extract7z(file: string, dest?: string, _7zPath?: string): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Extract a tar
|
||||||
|
*
|
||||||
|
* @param file path to the tar
|
||||||
|
* @param dest destination directory. Optional.
|
||||||
|
* @param flags flags for the tar. Optional.
|
||||||
|
* @returns path to the destination directory
|
||||||
|
*/
|
||||||
|
export declare function extractTar(file: string, dest?: string, flags?: string): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Extract a zip
|
||||||
|
*
|
||||||
|
* @param file path to the zip
|
||||||
|
* @param dest destination directory. Optional.
|
||||||
|
* @returns path to the destination directory
|
||||||
|
*/
|
||||||
|
export declare function extractZip(file: string, dest?: string): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Caches a directory and installs it into the tool cacheDir
|
||||||
|
*
|
||||||
|
* @param sourceDir the directory to cache into tools
|
||||||
|
* @param tool tool name
|
||||||
|
* @param version version of the tool. semver format
|
||||||
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
|
*/
|
||||||
|
export declare function cacheDir(sourceDir: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Caches a downloaded file (GUID) and installs it
|
||||||
|
* into the tool cache with a given targetName
|
||||||
|
*
|
||||||
|
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||||
|
* @param targetFile the name of the file name in the tools directory
|
||||||
|
* @param tool tool name
|
||||||
|
* @param version version of the tool. semver format
|
||||||
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
|
*/
|
||||||
|
export declare function cacheFile(sourceFile: string, targetFile: string, tool: string, version: string, arch?: string): Promise<string>;
|
||||||
|
/**
|
||||||
|
* Finds the path to a tool version in the local installed tool cache
|
||||||
|
*
|
||||||
|
* @param toolName name of the tool
|
||||||
|
* @param versionSpec version of the tool
|
||||||
|
* @param arch optional arch. defaults to arch of computer
|
||||||
|
*/
|
||||||
|
export declare function find(toolName: string, versionSpec: string, arch?: string): string;
|
||||||
|
/**
|
||||||
|
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
||||||
|
*
|
||||||
|
* @param toolName name of the tool
|
||||||
|
* @param arch optional arch. defaults to arch of computer
|
||||||
|
*/
|
||||||
|
export declare function findAllVersions(toolName: string, arch?: string): string[];
|
449
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
Normal file
449
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
Normal file
|
@ -0,0 +1,449 @@
|
||||||
|
"use strict";
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const core = require("@actions/core");
|
||||||
|
const io = require("@actions/io");
|
||||||
|
const fs = require("fs");
|
||||||
|
const os = require("os");
|
||||||
|
const path = require("path");
|
||||||
|
const httpm = require("typed-rest-client/HttpClient");
|
||||||
|
const semver = require("semver");
|
||||||
|
const uuidV4 = require("uuid/v4");
|
||||||
|
const exec_1 = require("@actions/exec/lib/exec");
|
||||||
|
const assert_1 = require("assert");
|
||||||
|
class HTTPError extends Error {
|
||||||
|
constructor(httpStatusCode) {
|
||||||
|
super(`Unexpected HTTP response: ${httpStatusCode}`);
|
||||||
|
this.httpStatusCode = httpStatusCode;
|
||||||
|
Object.setPrototypeOf(this, new.target.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.HTTPError = HTTPError;
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
const userAgent = 'actions/tool-cache';
|
||||||
|
// On load grab temp directory and cache directory and remove them from env (currently don't want to expose this)
|
||||||
|
let tempDirectory = process.env['RUNNER_TEMP'] || '';
|
||||||
|
let cacheRoot = process.env['RUNNER_TOOL_CACHE'] || '';
|
||||||
|
// If directories not found, place them in common temp locations
|
||||||
|
if (!tempDirectory || !cacheRoot) {
|
||||||
|
let baseLocation;
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
// On windows use the USERPROFILE env variable
|
||||||
|
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
baseLocation = '/Users';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
baseLocation = '/home';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!tempDirectory) {
|
||||||
|
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
||||||
|
}
|
||||||
|
if (!cacheRoot) {
|
||||||
|
cacheRoot = path.join(baseLocation, 'actions', 'cache');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Download a tool from an url and stream it into a file
|
||||||
|
*
|
||||||
|
* @param url url of tool to download
|
||||||
|
* @returns path to downloaded tool
|
||||||
|
*/
|
||||||
|
function downloadTool(url) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// Wrap in a promise so that we can resolve from within stream callbacks
|
||||||
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
|
const http = new httpm.HttpClient(userAgent, [], {
|
||||||
|
allowRetries: true,
|
||||||
|
maxRetries: 3
|
||||||
|
});
|
||||||
|
const destPath = path.join(tempDirectory, uuidV4());
|
||||||
|
yield io.mkdirP(tempDirectory);
|
||||||
|
core.debug(`Downloading ${url}`);
|
||||||
|
core.debug(`Downloading ${destPath}`);
|
||||||
|
if (fs.existsSync(destPath)) {
|
||||||
|
throw new Error(`Destination file path ${destPath} already exists`);
|
||||||
|
}
|
||||||
|
const response = yield http.get(url);
|
||||||
|
if (response.message.statusCode !== 200) {
|
||||||
|
const err = new HTTPError(response.message.statusCode);
|
||||||
|
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
const file = fs.createWriteStream(destPath);
|
||||||
|
file.on('open', () => __awaiter(this, void 0, void 0, function* () {
|
||||||
|
try {
|
||||||
|
const stream = response.message.pipe(file);
|
||||||
|
stream.on('close', () => {
|
||||||
|
core.debug('download complete');
|
||||||
|
resolve(destPath);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
core.debug(`Failed to download from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`);
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
file.on('error', err => {
|
||||||
|
file.end();
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.downloadTool = downloadTool;
|
||||||
|
/**
|
||||||
|
* Extract a .7z file
|
||||||
|
*
|
||||||
|
* @param file path to the .7z file
|
||||||
|
* @param dest destination directory. Optional.
|
||||||
|
* @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this
|
||||||
|
* problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will
|
||||||
|
* gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is
|
||||||
|
* bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line
|
||||||
|
* interface, it is smaller than the full command line interface, and it does support long paths. At the
|
||||||
|
* time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website.
|
||||||
|
* Be sure to check the current license agreement. If 7zr.exe is bundled with your action, then the path
|
||||||
|
* to 7zr.exe can be pass to this function.
|
||||||
|
* @returns path to the destination directory
|
||||||
|
*/
|
||||||
|
function extract7z(file, dest, _7zPath) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
assert_1.ok(IS_WINDOWS, 'extract7z() not supported on current OS');
|
||||||
|
assert_1.ok(file, 'parameter "file" is required');
|
||||||
|
dest = dest || (yield _createExtractFolder(dest));
|
||||||
|
const originalCwd = process.cwd();
|
||||||
|
process.chdir(dest);
|
||||||
|
if (_7zPath) {
|
||||||
|
try {
|
||||||
|
const args = [
|
||||||
|
'x',
|
||||||
|
'-bb1',
|
||||||
|
'-bd',
|
||||||
|
'-sccUTF-8',
|
||||||
|
file
|
||||||
|
];
|
||||||
|
const options = {
|
||||||
|
silent: true
|
||||||
|
};
|
||||||
|
yield exec_1.exec(`"${_7zPath}"`, args, options);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
process.chdir(originalCwd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const escapedScript = path
|
||||||
|
.join(__dirname, '..', 'scripts', 'Invoke-7zdec.ps1')
|
||||||
|
.replace(/'/g, "''")
|
||||||
|
.replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||||
|
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
|
const escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
|
const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}'`;
|
||||||
|
const args = [
|
||||||
|
'-NoLogo',
|
||||||
|
'-Sta',
|
||||||
|
'-NoProfile',
|
||||||
|
'-NonInteractive',
|
||||||
|
'-ExecutionPolicy',
|
||||||
|
'Unrestricted',
|
||||||
|
'-Command',
|
||||||
|
command
|
||||||
|
];
|
||||||
|
const options = {
|
||||||
|
silent: true
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const powershellPath = yield io.which('powershell', true);
|
||||||
|
yield exec_1.exec(`"${powershellPath}"`, args, options);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
process.chdir(originalCwd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.extract7z = extract7z;
|
||||||
|
/**
|
||||||
|
* Extract a tar
|
||||||
|
*
|
||||||
|
* @param file path to the tar
|
||||||
|
* @param dest destination directory. Optional.
|
||||||
|
* @param flags flags for the tar. Optional.
|
||||||
|
* @returns path to the destination directory
|
||||||
|
*/
|
||||||
|
function extractTar(file, dest, flags = 'xz') {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!file) {
|
||||||
|
throw new Error("parameter 'file' is required");
|
||||||
|
}
|
||||||
|
dest = dest || (yield _createExtractFolder(dest));
|
||||||
|
const tarPath = yield io.which('tar', true);
|
||||||
|
yield exec_1.exec(`"${tarPath}"`, [flags, '-C', dest, '-f', file]);
|
||||||
|
return dest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.extractTar = extractTar;
|
||||||
|
/**
|
||||||
|
* Extract a zip
|
||||||
|
*
|
||||||
|
* @param file path to the zip
|
||||||
|
* @param dest destination directory. Optional.
|
||||||
|
* @returns path to the destination directory
|
||||||
|
*/
|
||||||
|
function extractZip(file, dest) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!file) {
|
||||||
|
throw new Error("parameter 'file' is required");
|
||||||
|
}
|
||||||
|
dest = dest || (yield _createExtractFolder(dest));
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
yield extractZipWin(file, dest);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
yield extractZipDarwin(file, dest);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield extractZipNix(file, dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.extractZip = extractZip;
|
||||||
|
function extractZipWin(file, dest) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
// build the powershell command
|
||||||
|
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
||||||
|
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
||||||
|
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
||||||
|
// run powershell
|
||||||
|
const powershellPath = yield io.which('powershell');
|
||||||
|
const args = [
|
||||||
|
'-NoLogo',
|
||||||
|
'-Sta',
|
||||||
|
'-NoProfile',
|
||||||
|
'-NonInteractive',
|
||||||
|
'-ExecutionPolicy',
|
||||||
|
'Unrestricted',
|
||||||
|
'-Command',
|
||||||
|
command
|
||||||
|
];
|
||||||
|
yield exec_1.exec(`"${powershellPath}"`, args);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function extractZipNix(file, dest) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip');
|
||||||
|
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function extractZipDarwin(file, dest) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip-darwin');
|
||||||
|
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Caches a directory and installs it into the tool cacheDir
|
||||||
|
*
|
||||||
|
* @param sourceDir the directory to cache into tools
|
||||||
|
* @param tool tool name
|
||||||
|
* @param version version of the tool. semver format
|
||||||
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
|
*/
|
||||||
|
function cacheDir(sourceDir, tool, version, arch) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
version = semver.clean(version) || version;
|
||||||
|
arch = arch || os.arch();
|
||||||
|
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||||
|
core.debug(`source dir: ${sourceDir}`);
|
||||||
|
if (!fs.statSync(sourceDir).isDirectory()) {
|
||||||
|
throw new Error('sourceDir is not a directory');
|
||||||
|
}
|
||||||
|
// Create the tool dir
|
||||||
|
const destPath = yield _createToolPath(tool, version, arch);
|
||||||
|
// copy each child item. do not move. move can fail on Windows
|
||||||
|
// due to anti-virus software having an open handle on a file.
|
||||||
|
for (const itemName of fs.readdirSync(sourceDir)) {
|
||||||
|
const s = path.join(sourceDir, itemName);
|
||||||
|
yield io.cp(s, destPath, { recursive: true });
|
||||||
|
}
|
||||||
|
// write .complete
|
||||||
|
_completeToolPath(tool, version, arch);
|
||||||
|
return destPath;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.cacheDir = cacheDir;
|
||||||
|
/**
|
||||||
|
* Caches a downloaded file (GUID) and installs it
|
||||||
|
* into the tool cache with a given targetName
|
||||||
|
*
|
||||||
|
* @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid.
|
||||||
|
* @param targetFile the name of the file name in the tools directory
|
||||||
|
* @param tool tool name
|
||||||
|
* @param version version of the tool. semver format
|
||||||
|
* @param arch architecture of the tool. Optional. Defaults to machine architecture
|
||||||
|
*/
|
||||||
|
function cacheFile(sourceFile, targetFile, tool, version, arch) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
version = semver.clean(version) || version;
|
||||||
|
arch = arch || os.arch();
|
||||||
|
core.debug(`Caching tool ${tool} ${version} ${arch}`);
|
||||||
|
core.debug(`source file: ${sourceFile}`);
|
||||||
|
if (!fs.statSync(sourceFile).isFile()) {
|
||||||
|
throw new Error('sourceFile is not a file');
|
||||||
|
}
|
||||||
|
// create the tool dir
|
||||||
|
const destFolder = yield _createToolPath(tool, version, arch);
|
||||||
|
// copy instead of move. move can fail on Windows due to
|
||||||
|
// anti-virus software having an open handle on a file.
|
||||||
|
const destPath = path.join(destFolder, targetFile);
|
||||||
|
core.debug(`destination file ${destPath}`);
|
||||||
|
yield io.cp(sourceFile, destPath);
|
||||||
|
// write .complete
|
||||||
|
_completeToolPath(tool, version, arch);
|
||||||
|
return destFolder;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.cacheFile = cacheFile;
|
||||||
|
/**
|
||||||
|
* Finds the path to a tool version in the local installed tool cache
|
||||||
|
*
|
||||||
|
* @param toolName name of the tool
|
||||||
|
* @param versionSpec version of the tool
|
||||||
|
* @param arch optional arch. defaults to arch of computer
|
||||||
|
*/
|
||||||
|
function find(toolName, versionSpec, arch) {
|
||||||
|
if (!toolName) {
|
||||||
|
throw new Error('toolName parameter is required');
|
||||||
|
}
|
||||||
|
if (!versionSpec) {
|
||||||
|
throw new Error('versionSpec parameter is required');
|
||||||
|
}
|
||||||
|
arch = arch || os.arch();
|
||||||
|
// attempt to resolve an explicit version
|
||||||
|
if (!_isExplicitVersion(versionSpec)) {
|
||||||
|
const localVersions = findAllVersions(toolName, arch);
|
||||||
|
const match = _evaluateVersions(localVersions, versionSpec);
|
||||||
|
versionSpec = match;
|
||||||
|
}
|
||||||
|
// check for the explicit version in the cache
|
||||||
|
let toolPath = '';
|
||||||
|
if (versionSpec) {
|
||||||
|
versionSpec = semver.clean(versionSpec) || '';
|
||||||
|
const cachePath = path.join(cacheRoot, toolName, versionSpec, arch);
|
||||||
|
core.debug(`checking cache: ${cachePath}`);
|
||||||
|
if (fs.existsSync(cachePath) && fs.existsSync(`${cachePath}.complete`)) {
|
||||||
|
core.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`);
|
||||||
|
toolPath = cachePath;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.debug('not found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return toolPath;
|
||||||
|
}
|
||||||
|
exports.find = find;
|
||||||
|
/**
|
||||||
|
* Finds the paths to all versions of a tool that are installed in the local tool cache
|
||||||
|
*
|
||||||
|
* @param toolName name of the tool
|
||||||
|
* @param arch optional arch. defaults to arch of computer
|
||||||
|
*/
|
||||||
|
function findAllVersions(toolName, arch) {
|
||||||
|
const versions = [];
|
||||||
|
arch = arch || os.arch();
|
||||||
|
const toolPath = path.join(cacheRoot, toolName);
|
||||||
|
if (fs.existsSync(toolPath)) {
|
||||||
|
const children = fs.readdirSync(toolPath);
|
||||||
|
for (const child of children) {
|
||||||
|
if (_isExplicitVersion(child)) {
|
||||||
|
const fullPath = path.join(toolPath, child, arch || '');
|
||||||
|
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
||||||
|
versions.push(child);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return versions;
|
||||||
|
}
|
||||||
|
exports.findAllVersions = findAllVersions;
|
||||||
|
function _createExtractFolder(dest) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!dest) {
|
||||||
|
// create a temp dir
|
||||||
|
dest = path.join(tempDirectory, uuidV4());
|
||||||
|
}
|
||||||
|
yield io.mkdirP(dest);
|
||||||
|
return dest;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function _createToolPath(tool, version, arch) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||||
|
core.debug(`destination ${folderPath}`);
|
||||||
|
const markerPath = `${folderPath}.complete`;
|
||||||
|
yield io.rmRF(folderPath);
|
||||||
|
yield io.rmRF(markerPath);
|
||||||
|
yield io.mkdirP(folderPath);
|
||||||
|
return folderPath;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function _completeToolPath(tool, version, arch) {
|
||||||
|
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
|
||||||
|
const markerPath = `${folderPath}.complete`;
|
||||||
|
fs.writeFileSync(markerPath, '');
|
||||||
|
core.debug('finished caching tool');
|
||||||
|
}
|
||||||
|
function _isExplicitVersion(versionSpec) {
|
||||||
|
const c = semver.clean(versionSpec) || '';
|
||||||
|
core.debug(`isExplicit: ${c}`);
|
||||||
|
const valid = semver.valid(c) != null;
|
||||||
|
core.debug(`explicit? ${valid}`);
|
||||||
|
return valid;
|
||||||
|
}
|
||||||
|
function _evaluateVersions(versions, versionSpec) {
|
||||||
|
let version = '';
|
||||||
|
core.debug(`evaluating ${versions.length} versions`);
|
||||||
|
versions = versions.sort((a, b) => {
|
||||||
|
if (semver.gt(a, b)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
});
|
||||||
|
for (let i = versions.length - 1; i >= 0; i--) {
|
||||||
|
const potential = versions[i];
|
||||||
|
const satisfied = semver.satisfies(potential, versionSpec);
|
||||||
|
if (satisfied) {
|
||||||
|
version = potential;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (version) {
|
||||||
|
core.debug(`matched: ${version}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.debug('match not found');
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
//# sourceMappingURL=tool-cache.js.map
|
1
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
Normal file
1
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
50
node_modules/@actions/tool-cache/package.json
generated
vendored
Normal file
50
node_modules/@actions/tool-cache/package.json
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{
|
||||||
|
"name": "@actions/tool-cache",
|
||||||
|
"version": "1.1.1",
|
||||||
|
"description": "Actions tool-cache lib",
|
||||||
|
"keywords": [
|
||||||
|
"github",
|
||||||
|
"actions",
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/tool-cache.js",
|
||||||
|
"directories": {
|
||||||
|
"lib": "lib",
|
||||||
|
"test": "__tests__"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"lib",
|
||||||
|
"scripts"
|
||||||
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/actions/toolkit.git"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
|
"tsc": "tsc"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/core": "^1.1.0",
|
||||||
|
"@actions/exec": "^1.0.1",
|
||||||
|
"@actions/io": "^1.0.1",
|
||||||
|
"semver": "^6.1.0",
|
||||||
|
"typed-rest-client": "^1.4.0",
|
||||||
|
"uuid": "^3.3.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/nock": "^10.0.3",
|
||||||
|
"@types/semver": "^6.0.0",
|
||||||
|
"@types/uuid": "^3.4.4",
|
||||||
|
"nock": "^10.0.6"
|
||||||
|
},
|
||||||
|
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||||
|
}
|
60
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
Normal file
60
node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
generated
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Source,
|
||||||
|
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Target)
|
||||||
|
|
||||||
|
# This script translates the output from 7zdec into UTF8. Node has limited
|
||||||
|
# built-in support for encodings.
|
||||||
|
#
|
||||||
|
# 7zdec uses the system default code page. The system default code page varies
|
||||||
|
# depending on the locale configuration. On an en-US box, the system default code
|
||||||
|
# page is Windows-1252.
|
||||||
|
#
|
||||||
|
# Note, on a typical en-US box, testing with the 'ç' character is a good way to
|
||||||
|
# determine whether data is passed correctly between processes. This is because
|
||||||
|
# the 'ç' character has a different code point across each of the common encodings
|
||||||
|
# on a typical en-US box, i.e.
|
||||||
|
# 1) the default console-output code page (IBM437)
|
||||||
|
# 2) the system default code page (i.e. CP_ACP) (Windows-1252)
|
||||||
|
# 3) UTF8
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
# Redefine the wrapper over STDOUT to use UTF8. Node expects UTF8 by default.
|
||||||
|
$stdout = [System.Console]::OpenStandardOutput()
|
||||||
|
$utf8 = New-Object System.Text.UTF8Encoding($false) # do not emit BOM
|
||||||
|
$writer = New-Object System.IO.StreamWriter($stdout, $utf8)
|
||||||
|
[System.Console]::SetOut($writer)
|
||||||
|
|
||||||
|
# All subsequent output must be written using [System.Console]::WriteLine(). In
|
||||||
|
# PowerShell 4, Write-Host and Out-Default do not consider the updated stream writer.
|
||||||
|
|
||||||
|
Set-Location -LiteralPath $Target
|
||||||
|
|
||||||
|
# Print the ##command.
|
||||||
|
$_7zdec = Join-Path -Path "$PSScriptRoot" -ChildPath "externals/7zdec.exe"
|
||||||
|
[System.Console]::WriteLine("##[command]$_7zdec x `"$Source`"")
|
||||||
|
|
||||||
|
# The $OutputEncoding variable instructs PowerShell how to interpret the output
|
||||||
|
# from the external command.
|
||||||
|
$OutputEncoding = [System.Text.Encoding]::Default
|
||||||
|
|
||||||
|
# Note, the output from 7zdec.exe needs to be iterated over. Otherwise PowerShell.exe
|
||||||
|
# will launch the external command in such a way that it inherits the streams.
|
||||||
|
& $_7zdec x $Source 2>&1 |
|
||||||
|
ForEach-Object {
|
||||||
|
if ($_ -is [System.Management.Automation.ErrorRecord]) {
|
||||||
|
[System.Console]::WriteLine($_.Exception.Message)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[System.Console]::WriteLine($_)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[System.Console]::WriteLine("##[debug]7zdec.exe exit code '$LASTEXITCODE'")
|
||||||
|
[System.Console]::Out.Flush()
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
exit $LASTEXITCODE
|
||||||
|
}
|
BIN
node_modules/@actions/tool-cache/scripts/externals/7zdec.exe
generated
vendored
Normal file
BIN
node_modules/@actions/tool-cache/scripts/externals/7zdec.exe
generated
vendored
Normal file
Binary file not shown.
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip
generated
vendored
Executable file
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip
generated
vendored
Executable file
Binary file not shown.
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip-darwin
generated
vendored
Executable file
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip-darwin
generated
vendored
Executable file
Binary file not shown.
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/code-frame/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
|
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.
|
19
node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
19
node_modules/@babel/code-frame/README.md
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# @babel/code-frame
|
||||||
|
|
||||||
|
> Generate errors that contain a code frame that point to source locations.
|
||||||
|
|
||||||
|
See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/code-frame
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/code-frame --dev
|
||||||
|
```
|
167
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
167
node_modules/@babel/code-frame/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.codeFrameColumns = codeFrameColumns;
|
||||||
|
exports.default = _default;
|
||||||
|
|
||||||
|
var _highlight = _interopRequireWildcard(require("@babel/highlight"));
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
let deprecationWarningShown = false;
|
||||||
|
|
||||||
|
function getDefs(chalk) {
|
||||||
|
return {
|
||||||
|
gutter: chalk.grey,
|
||||||
|
marker: chalk.red.bold,
|
||||||
|
message: chalk.red.bold
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||||
|
|
||||||
|
function getMarkerLines(loc, source, opts) {
|
||||||
|
const startLoc = Object.assign({
|
||||||
|
column: 0,
|
||||||
|
line: -1
|
||||||
|
}, loc.start);
|
||||||
|
const endLoc = Object.assign({}, startLoc, loc.end);
|
||||||
|
const {
|
||||||
|
linesAbove = 2,
|
||||||
|
linesBelow = 3
|
||||||
|
} = opts || {};
|
||||||
|
const startLine = startLoc.line;
|
||||||
|
const startColumn = startLoc.column;
|
||||||
|
const endLine = endLoc.line;
|
||||||
|
const endColumn = endLoc.column;
|
||||||
|
let start = Math.max(startLine - (linesAbove + 1), 0);
|
||||||
|
let end = Math.min(source.length, endLine + linesBelow);
|
||||||
|
|
||||||
|
if (startLine === -1) {
|
||||||
|
start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endLine === -1) {
|
||||||
|
end = source.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
const lineDiff = endLine - startLine;
|
||||||
|
const markerLines = {};
|
||||||
|
|
||||||
|
if (lineDiff) {
|
||||||
|
for (let i = 0; i <= lineDiff; i++) {
|
||||||
|
const lineNumber = i + startLine;
|
||||||
|
|
||||||
|
if (!startColumn) {
|
||||||
|
markerLines[lineNumber] = true;
|
||||||
|
} else if (i === 0) {
|
||||||
|
const sourceLength = source[lineNumber - 1].length;
|
||||||
|
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||||
|
} else if (i === lineDiff) {
|
||||||
|
markerLines[lineNumber] = [0, endColumn];
|
||||||
|
} else {
|
||||||
|
const sourceLength = source[lineNumber - i].length;
|
||||||
|
markerLines[lineNumber] = [0, sourceLength];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (startColumn === endColumn) {
|
||||||
|
if (startColumn) {
|
||||||
|
markerLines[startLine] = [startColumn, 0];
|
||||||
|
} else {
|
||||||
|
markerLines[startLine] = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
markerLines
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function codeFrameColumns(rawLines, loc, opts = {}) {
|
||||||
|
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
||||||
|
const chalk = (0, _highlight.getChalk)(opts);
|
||||||
|
const defs = getDefs(chalk);
|
||||||
|
|
||||||
|
const maybeHighlight = (chalkFn, string) => {
|
||||||
|
return highlighted ? chalkFn(string) : string;
|
||||||
|
};
|
||||||
|
|
||||||
|
const lines = rawLines.split(NEWLINE);
|
||||||
|
const {
|
||||||
|
start,
|
||||||
|
end,
|
||||||
|
markerLines
|
||||||
|
} = getMarkerLines(loc, lines, opts);
|
||||||
|
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||||
|
const numberMaxWidth = String(end).length;
|
||||||
|
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
||||||
|
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
|
||||||
|
const number = start + 1 + index;
|
||||||
|
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
||||||
|
const gutter = ` ${paddedNumber} | `;
|
||||||
|
const hasMarker = markerLines[number];
|
||||||
|
const lastMarkerLine = !markerLines[number + 1];
|
||||||
|
|
||||||
|
if (hasMarker) {
|
||||||
|
let markerLine = "";
|
||||||
|
|
||||||
|
if (Array.isArray(hasMarker)) {
|
||||||
|
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
||||||
|
const numberOfMarkers = hasMarker[1] || 1;
|
||||||
|
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
||||||
|
|
||||||
|
if (lastMarkerLine && opts.message) {
|
||||||
|
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
|
||||||
|
} else {
|
||||||
|
return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
|
||||||
|
}
|
||||||
|
}).join("\n");
|
||||||
|
|
||||||
|
if (opts.message && !hasColumns) {
|
||||||
|
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (highlighted) {
|
||||||
|
return chalk.reset(frame);
|
||||||
|
} else {
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
||||||
|
if (!deprecationWarningShown) {
|
||||||
|
deprecationWarningShown = true;
|
||||||
|
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
||||||
|
|
||||||
|
if (process.emitWarning) {
|
||||||
|
process.emitWarning(message, "DeprecationWarning");
|
||||||
|
} else {
|
||||||
|
const deprecationError = new Error(message);
|
||||||
|
deprecationError.name = "DeprecationWarning";
|
||||||
|
console.warn(new Error(message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
colNumber = Math.max(colNumber, 0);
|
||||||
|
const location = {
|
||||||
|
start: {
|
||||||
|
column: colNumber,
|
||||||
|
line: lineNumber
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return codeFrameColumns(rawLines, location, opts);
|
||||||
|
}
|
25
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
25
node_modules/@babel/code-frame/package.json
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "@babel/code-frame",
|
||||||
|
"version": "7.10.4",
|
||||||
|
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||||
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||||
|
"homepage": "https://babeljs.io/",
|
||||||
|
"license": "MIT",
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/babel/babel.git",
|
||||||
|
"directory": "packages/babel-code-frame"
|
||||||
|
},
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/highlight": "^7.10.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"chalk": "^2.0.0",
|
||||||
|
"strip-ansi": "^4.0.0"
|
||||||
|
},
|
||||||
|
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df"
|
||||||
|
}
|
22
node_modules/@babel/core/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/core/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
|
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.
|
19
node_modules/@babel/core/README.md
generated
vendored
Normal file
19
node_modules/@babel/core/README.md
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# @babel/core
|
||||||
|
|
||||||
|
> Babel compiler core.
|
||||||
|
|
||||||
|
See our website [@babel/core](https://babeljs.io/docs/en/next/babel-core.html) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Using npm:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev @babel/core
|
||||||
|
```
|
||||||
|
|
||||||
|
or using yarn:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn add @babel/core --dev
|
||||||
|
```
|
324
node_modules/@babel/core/lib/config/caching.js
generated
vendored
Normal file
324
node_modules/@babel/core/lib/config/caching.js
generated
vendored
Normal file
|
@ -0,0 +1,324 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.makeWeakCache = makeWeakCache;
|
||||||
|
exports.makeWeakCacheSync = makeWeakCacheSync;
|
||||||
|
exports.makeStrongCache = makeStrongCache;
|
||||||
|
exports.makeStrongCacheSync = makeStrongCacheSync;
|
||||||
|
exports.assertSimpleType = assertSimpleType;
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _async = require("../gensync-utils/async");
|
||||||
|
|
||||||
|
var _util = require("./util");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const synchronize = gen => {
|
||||||
|
return (0, _gensync().default)(gen).sync;
|
||||||
|
};
|
||||||
|
|
||||||
|
function* genTrue(data) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeWeakCache(handler) {
|
||||||
|
return makeCachedFunction(WeakMap, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeWeakCacheSync(handler) {
|
||||||
|
return synchronize(makeWeakCache(handler));
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeStrongCache(handler) {
|
||||||
|
return makeCachedFunction(Map, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeStrongCacheSync(handler) {
|
||||||
|
return synchronize(makeStrongCache(handler));
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeCachedFunction(CallCache, handler) {
|
||||||
|
const callCacheSync = new CallCache();
|
||||||
|
const callCacheAsync = new CallCache();
|
||||||
|
const futureCache = new CallCache();
|
||||||
|
return function* cachedFunction(arg, data) {
|
||||||
|
const asyncContext = yield* (0, _async.isAsync)();
|
||||||
|
const callCache = asyncContext ? callCacheAsync : callCacheSync;
|
||||||
|
const cached = yield* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data);
|
||||||
|
if (cached.valid) return cached.value;
|
||||||
|
const cache = new CacheConfigurator(data);
|
||||||
|
const handlerResult = handler(arg, cache);
|
||||||
|
let finishLock;
|
||||||
|
let value;
|
||||||
|
|
||||||
|
if ((0, _util.isIterableIterator)(handlerResult)) {
|
||||||
|
const gen = handlerResult;
|
||||||
|
value = yield* (0, _async.onFirstPause)(gen, () => {
|
||||||
|
finishLock = setupAsyncLocks(cache, futureCache, arg);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
value = handlerResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFunctionCache(callCache, cache, arg, value);
|
||||||
|
|
||||||
|
if (finishLock) {
|
||||||
|
futureCache.delete(arg);
|
||||||
|
finishLock.release(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function* getCachedValue(cache, arg, data) {
|
||||||
|
const cachedValue = cache.get(arg);
|
||||||
|
|
||||||
|
if (cachedValue) {
|
||||||
|
for (const {
|
||||||
|
value,
|
||||||
|
valid
|
||||||
|
} of cachedValue) {
|
||||||
|
if (yield* valid(data)) return {
|
||||||
|
valid: true,
|
||||||
|
value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
valid: false,
|
||||||
|
value: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data) {
|
||||||
|
const cached = yield* getCachedValue(callCache, arg, data);
|
||||||
|
|
||||||
|
if (cached.valid) {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (asyncContext) {
|
||||||
|
const cached = yield* getCachedValue(futureCache, arg, data);
|
||||||
|
|
||||||
|
if (cached.valid) {
|
||||||
|
const value = yield* (0, _async.waitFor)(cached.value.promise);
|
||||||
|
return {
|
||||||
|
valid: true,
|
||||||
|
value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
valid: false,
|
||||||
|
value: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupAsyncLocks(config, futureCache, arg) {
|
||||||
|
const finishLock = new Lock();
|
||||||
|
updateFunctionCache(futureCache, config, arg, finishLock);
|
||||||
|
return finishLock;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateFunctionCache(cache, config, arg, value) {
|
||||||
|
if (!config.configured()) config.forever();
|
||||||
|
let cachedValue = cache.get(arg);
|
||||||
|
config.deactivate();
|
||||||
|
|
||||||
|
switch (config.mode()) {
|
||||||
|
case "forever":
|
||||||
|
cachedValue = [{
|
||||||
|
value,
|
||||||
|
valid: genTrue
|
||||||
|
}];
|
||||||
|
cache.set(arg, cachedValue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "invalidate":
|
||||||
|
cachedValue = [{
|
||||||
|
value,
|
||||||
|
valid: config.validator()
|
||||||
|
}];
|
||||||
|
cache.set(arg, cachedValue);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "valid":
|
||||||
|
if (cachedValue) {
|
||||||
|
cachedValue.push({
|
||||||
|
value,
|
||||||
|
valid: config.validator()
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
cachedValue = [{
|
||||||
|
value,
|
||||||
|
valid: config.validator()
|
||||||
|
}];
|
||||||
|
cache.set(arg, cachedValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class CacheConfigurator {
|
||||||
|
constructor(data) {
|
||||||
|
this._active = true;
|
||||||
|
this._never = false;
|
||||||
|
this._forever = false;
|
||||||
|
this._invalidate = false;
|
||||||
|
this._configured = false;
|
||||||
|
this._pairs = [];
|
||||||
|
this._data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
simple() {
|
||||||
|
return makeSimpleConfigurator(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
mode() {
|
||||||
|
if (this._never) return "never";
|
||||||
|
if (this._forever) return "forever";
|
||||||
|
if (this._invalidate) return "invalidate";
|
||||||
|
return "valid";
|
||||||
|
}
|
||||||
|
|
||||||
|
forever() {
|
||||||
|
if (!this._active) {
|
||||||
|
throw new Error("Cannot change caching after evaluation has completed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._never) {
|
||||||
|
throw new Error("Caching has already been configured with .never()");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._forever = true;
|
||||||
|
this._configured = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
never() {
|
||||||
|
if (!this._active) {
|
||||||
|
throw new Error("Cannot change caching after evaluation has completed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._forever) {
|
||||||
|
throw new Error("Caching has already been configured with .forever()");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._never = true;
|
||||||
|
this._configured = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
using(handler) {
|
||||||
|
if (!this._active) {
|
||||||
|
throw new Error("Cannot change caching after evaluation has completed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._never || this._forever) {
|
||||||
|
throw new Error("Caching has already been configured with .never or .forever()");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._configured = true;
|
||||||
|
const key = handler(this._data);
|
||||||
|
const fn = (0, _async.maybeAsync)(handler, `You appear to be using an async cache handler, but Babel has been called synchronously`);
|
||||||
|
|
||||||
|
if ((0, _async.isThenable)(key)) {
|
||||||
|
return key.then(key => {
|
||||||
|
this._pairs.push([key, fn]);
|
||||||
|
|
||||||
|
return key;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this._pairs.push([key, fn]);
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
invalidate(handler) {
|
||||||
|
this._invalidate = true;
|
||||||
|
return this.using(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
validator() {
|
||||||
|
const pairs = this._pairs;
|
||||||
|
return function* (data) {
|
||||||
|
for (const [key, fn] of pairs) {
|
||||||
|
if (key !== (yield* fn(data))) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
deactivate() {
|
||||||
|
this._active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
configured() {
|
||||||
|
return this._configured;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeSimpleConfigurator(cache) {
|
||||||
|
function cacheFn(val) {
|
||||||
|
if (typeof val === "boolean") {
|
||||||
|
if (val) cache.forever();else cache.never();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache.using(() => assertSimpleType(val()));
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheFn.forever = () => cache.forever();
|
||||||
|
|
||||||
|
cacheFn.never = () => cache.never();
|
||||||
|
|
||||||
|
cacheFn.using = cb => cache.using(() => assertSimpleType(cb()));
|
||||||
|
|
||||||
|
cacheFn.invalidate = cb => cache.invalidate(() => assertSimpleType(cb()));
|
||||||
|
|
||||||
|
return cacheFn;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertSimpleType(value) {
|
||||||
|
if ((0, _async.isThenable)(value)) {
|
||||||
|
throw new Error(`You appear to be using an async cache handler, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously handle your caching logic.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value != null && typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number") {
|
||||||
|
throw new Error("Cache keys must be either string, boolean, number, null, or undefined.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
class Lock {
|
||||||
|
constructor() {
|
||||||
|
this.released = false;
|
||||||
|
this.promise = new Promise(resolve => {
|
||||||
|
this._resolve = resolve;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
release(value) {
|
||||||
|
this.released = true;
|
||||||
|
|
||||||
|
this._resolve(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
519
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
Normal file
519
node_modules/@babel/core/lib/config/config-chain.js
generated
vendored
Normal file
|
@ -0,0 +1,519 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.buildPresetChain = buildPresetChain;
|
||||||
|
exports.buildRootChain = buildRootChain;
|
||||||
|
exports.buildPresetChainWalker = void 0;
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _debug() {
|
||||||
|
const data = _interopRequireDefault(require("debug"));
|
||||||
|
|
||||||
|
_debug = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _options = require("./validation/options");
|
||||||
|
|
||||||
|
var _patternToRegex = _interopRequireDefault(require("./pattern-to-regex"));
|
||||||
|
|
||||||
|
var _printer = require("./printer");
|
||||||
|
|
||||||
|
var _files = require("./files");
|
||||||
|
|
||||||
|
var _caching = require("./caching");
|
||||||
|
|
||||||
|
var _configDescriptors = require("./config-descriptors");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const debug = (0, _debug().default)("babel:config:config-chain");
|
||||||
|
|
||||||
|
function* buildPresetChain(arg, context) {
|
||||||
|
const chain = yield* buildPresetChainWalker(arg, context);
|
||||||
|
if (!chain) return null;
|
||||||
|
return {
|
||||||
|
plugins: dedupDescriptors(chain.plugins),
|
||||||
|
presets: dedupDescriptors(chain.presets),
|
||||||
|
options: chain.options.map(o => normalizeOptions(o))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const buildPresetChainWalker = makeChainWalker({
|
||||||
|
root: preset => loadPresetDescriptors(preset),
|
||||||
|
env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),
|
||||||
|
overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),
|
||||||
|
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName),
|
||||||
|
createLogger: () => () => {}
|
||||||
|
});
|
||||||
|
exports.buildPresetChainWalker = buildPresetChainWalker;
|
||||||
|
const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
|
||||||
|
const loadPresetEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName)));
|
||||||
|
const loadPresetOverridesDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index)));
|
||||||
|
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||||
|
|
||||||
|
function* buildRootChain(opts, context) {
|
||||||
|
let configReport, babelRcReport;
|
||||||
|
const programmaticLogger = new _printer.ConfigPrinter();
|
||||||
|
const programmaticChain = yield* loadProgrammaticChain({
|
||||||
|
options: opts,
|
||||||
|
dirname: context.cwd
|
||||||
|
}, context, undefined, programmaticLogger);
|
||||||
|
if (!programmaticChain) return null;
|
||||||
|
const programmaticReport = programmaticLogger.output();
|
||||||
|
let configFile;
|
||||||
|
|
||||||
|
if (typeof opts.configFile === "string") {
|
||||||
|
configFile = yield* (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller);
|
||||||
|
} else if (opts.configFile !== false) {
|
||||||
|
configFile = yield* (0, _files.findRootConfig)(context.root, context.envName, context.caller);
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
babelrc,
|
||||||
|
babelrcRoots
|
||||||
|
} = opts;
|
||||||
|
let babelrcRootsDirectory = context.cwd;
|
||||||
|
const configFileChain = emptyChain();
|
||||||
|
const configFileLogger = new _printer.ConfigPrinter();
|
||||||
|
|
||||||
|
if (configFile) {
|
||||||
|
const validatedFile = validateConfigFile(configFile);
|
||||||
|
const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger);
|
||||||
|
if (!result) return null;
|
||||||
|
configReport = configFileLogger.output();
|
||||||
|
|
||||||
|
if (babelrc === undefined) {
|
||||||
|
babelrc = validatedFile.options.babelrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (babelrcRoots === undefined) {
|
||||||
|
babelrcRootsDirectory = validatedFile.dirname;
|
||||||
|
babelrcRoots = validatedFile.options.babelrcRoots;
|
||||||
|
}
|
||||||
|
|
||||||
|
mergeChain(configFileChain, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
const pkgData = typeof context.filename === "string" ? yield* (0, _files.findPackageData)(context.filename) : null;
|
||||||
|
let ignoreFile, babelrcFile;
|
||||||
|
const fileChain = emptyChain();
|
||||||
|
|
||||||
|
if ((babelrc === true || babelrc === undefined) && pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) {
|
||||||
|
({
|
||||||
|
ignore: ignoreFile,
|
||||||
|
config: babelrcFile
|
||||||
|
} = yield* (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller));
|
||||||
|
|
||||||
|
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (babelrcFile) {
|
||||||
|
const validatedFile = validateBabelrcFile(babelrcFile);
|
||||||
|
const babelrcLogger = new _printer.ConfigPrinter();
|
||||||
|
const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger);
|
||||||
|
if (!result) return null;
|
||||||
|
babelRcReport = babelrcLogger.output();
|
||||||
|
mergeChain(fileChain, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.showConfig) {
|
||||||
|
console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n"));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain);
|
||||||
|
return {
|
||||||
|
plugins: dedupDescriptors(chain.plugins),
|
||||||
|
presets: dedupDescriptors(chain.presets),
|
||||||
|
options: chain.options.map(o => normalizeOptions(o)),
|
||||||
|
ignore: ignoreFile || undefined,
|
||||||
|
babelrc: babelrcFile || undefined,
|
||||||
|
config: configFile || undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) {
|
||||||
|
if (typeof babelrcRoots === "boolean") return babelrcRoots;
|
||||||
|
const absoluteRoot = context.root;
|
||||||
|
|
||||||
|
if (babelrcRoots === undefined) {
|
||||||
|
return pkgData.directories.indexOf(absoluteRoot) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
let babelrcPatterns = babelrcRoots;
|
||||||
|
if (!Array.isArray(babelrcPatterns)) babelrcPatterns = [babelrcPatterns];
|
||||||
|
babelrcPatterns = babelrcPatterns.map(pat => {
|
||||||
|
return typeof pat === "string" ? _path().default.resolve(babelrcRootsDirectory, pat) : pat;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {
|
||||||
|
return pkgData.directories.indexOf(absoluteRoot) !== -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return babelrcPatterns.some(pat => {
|
||||||
|
if (typeof pat === "string") {
|
||||||
|
pat = (0, _patternToRegex.default)(pat, babelrcRootsDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkgData.directories.some(directory => {
|
||||||
|
return matchPattern(pat, babelrcRootsDirectory, directory, context);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const validateConfigFile = (0, _caching.makeWeakCacheSync)(file => ({
|
||||||
|
filepath: file.filepath,
|
||||||
|
dirname: file.dirname,
|
||||||
|
options: (0, _options.validate)("configfile", file.options)
|
||||||
|
}));
|
||||||
|
const validateBabelrcFile = (0, _caching.makeWeakCacheSync)(file => ({
|
||||||
|
filepath: file.filepath,
|
||||||
|
dirname: file.dirname,
|
||||||
|
options: (0, _options.validate)("babelrcfile", file.options)
|
||||||
|
}));
|
||||||
|
const validateExtendFile = (0, _caching.makeWeakCacheSync)(file => ({
|
||||||
|
filepath: file.filepath,
|
||||||
|
dirname: file.dirname,
|
||||||
|
options: (0, _options.validate)("extendsfile", file.options)
|
||||||
|
}));
|
||||||
|
const loadProgrammaticChain = makeChainWalker({
|
||||||
|
root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors),
|
||||||
|
env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName),
|
||||||
|
overrides: (input, index) => buildOverrideDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index),
|
||||||
|
overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName),
|
||||||
|
createLogger: (input, context, baseLogger) => buildProgrammaticLogger(input, context, baseLogger)
|
||||||
|
});
|
||||||
|
const loadFileChain = makeChainWalker({
|
||||||
|
root: file => loadFileDescriptors(file),
|
||||||
|
env: (file, envName) => loadFileEnvDescriptors(file)(envName),
|
||||||
|
overrides: (file, index) => loadFileOverridesDescriptors(file)(index),
|
||||||
|
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName),
|
||||||
|
createLogger: (file, context, baseLogger) => buildFileLogger(file.filepath, context, baseLogger)
|
||||||
|
});
|
||||||
|
const loadFileDescriptors = (0, _caching.makeWeakCacheSync)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
|
||||||
|
const loadFileEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
|
||||||
|
const loadFileOverridesDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
|
||||||
|
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
|
||||||
|
|
||||||
|
function buildFileLogger(filepath, context, baseLogger) {
|
||||||
|
if (!baseLogger) {
|
||||||
|
return () => {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Config, {
|
||||||
|
filepath
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildRootDescriptors({
|
||||||
|
dirname,
|
||||||
|
options
|
||||||
|
}, alias, descriptors) {
|
||||||
|
return descriptors(dirname, options, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildProgrammaticLogger(_, context, baseLogger) {
|
||||||
|
var _context$caller;
|
||||||
|
|
||||||
|
if (!baseLogger) {
|
||||||
|
return () => {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Programmatic, {
|
||||||
|
callerName: (_context$caller = context.caller) == null ? void 0 : _context$caller.name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildEnvDescriptors({
|
||||||
|
dirname,
|
||||||
|
options
|
||||||
|
}, alias, descriptors, envName) {
|
||||||
|
const opts = options.env && options.env[envName];
|
||||||
|
return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildOverrideDescriptors({
|
||||||
|
dirname,
|
||||||
|
options
|
||||||
|
}, alias, descriptors, index) {
|
||||||
|
const opts = options.overrides && options.overrides[index];
|
||||||
|
if (!opts) throw new Error("Assertion failure - missing override");
|
||||||
|
return descriptors(dirname, opts, `${alias}.overrides[${index}]`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildOverrideEnvDescriptors({
|
||||||
|
dirname,
|
||||||
|
options
|
||||||
|
}, alias, descriptors, index, envName) {
|
||||||
|
const override = options.overrides && options.overrides[index];
|
||||||
|
if (!override) throw new Error("Assertion failure - missing override");
|
||||||
|
const opts = override.env && override.env[envName];
|
||||||
|
return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeChainWalker({
|
||||||
|
root,
|
||||||
|
env,
|
||||||
|
overrides,
|
||||||
|
overridesEnv,
|
||||||
|
createLogger
|
||||||
|
}) {
|
||||||
|
return function* (input, context, files = new Set(), baseLogger) {
|
||||||
|
const {
|
||||||
|
dirname
|
||||||
|
} = input;
|
||||||
|
const flattenedConfigs = [];
|
||||||
|
const rootOpts = root(input);
|
||||||
|
|
||||||
|
if (configIsApplicable(rootOpts, dirname, context)) {
|
||||||
|
flattenedConfigs.push({
|
||||||
|
config: rootOpts,
|
||||||
|
envName: undefined,
|
||||||
|
index: undefined
|
||||||
|
});
|
||||||
|
const envOpts = env(input, context.envName);
|
||||||
|
|
||||||
|
if (envOpts && configIsApplicable(envOpts, dirname, context)) {
|
||||||
|
flattenedConfigs.push({
|
||||||
|
config: envOpts,
|
||||||
|
envName: context.envName,
|
||||||
|
index: undefined
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
(rootOpts.options.overrides || []).forEach((_, index) => {
|
||||||
|
const overrideOps = overrides(input, index);
|
||||||
|
|
||||||
|
if (configIsApplicable(overrideOps, dirname, context)) {
|
||||||
|
flattenedConfigs.push({
|
||||||
|
config: overrideOps,
|
||||||
|
index,
|
||||||
|
envName: undefined
|
||||||
|
});
|
||||||
|
const overrideEnvOpts = overridesEnv(input, index, context.envName);
|
||||||
|
|
||||||
|
if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context)) {
|
||||||
|
flattenedConfigs.push({
|
||||||
|
config: overrideEnvOpts,
|
||||||
|
index,
|
||||||
|
envName: context.envName
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flattenedConfigs.some(({
|
||||||
|
config: {
|
||||||
|
options: {
|
||||||
|
ignore,
|
||||||
|
only
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}) => shouldIgnore(context, ignore, only, dirname))) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const chain = emptyChain();
|
||||||
|
const logger = createLogger(input, context, baseLogger);
|
||||||
|
|
||||||
|
for (const {
|
||||||
|
config,
|
||||||
|
index,
|
||||||
|
envName
|
||||||
|
} of flattenedConfigs) {
|
||||||
|
if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger(config, index, envName);
|
||||||
|
mergeChainOpts(chain, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
return chain;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function* mergeExtendsChain(chain, opts, dirname, context, files, baseLogger) {
|
||||||
|
if (opts.extends === undefined) return true;
|
||||||
|
const file = yield* (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller);
|
||||||
|
|
||||||
|
if (files.has(file)) {
|
||||||
|
throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
files.add(file);
|
||||||
|
const fileChain = yield* loadFileChain(validateExtendFile(file), context, files, baseLogger);
|
||||||
|
files.delete(file);
|
||||||
|
if (!fileChain) return false;
|
||||||
|
mergeChain(chain, fileChain);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeChain(target, source) {
|
||||||
|
target.options.push(...source.options);
|
||||||
|
target.plugins.push(...source.plugins);
|
||||||
|
target.presets.push(...source.presets);
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeChainOpts(target, {
|
||||||
|
options,
|
||||||
|
plugins,
|
||||||
|
presets
|
||||||
|
}) {
|
||||||
|
target.options.push(options);
|
||||||
|
target.plugins.push(...plugins());
|
||||||
|
target.presets.push(...presets());
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
function emptyChain() {
|
||||||
|
return {
|
||||||
|
options: [],
|
||||||
|
presets: [],
|
||||||
|
plugins: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeOptions(opts) {
|
||||||
|
const options = Object.assign({}, opts);
|
||||||
|
delete options.extends;
|
||||||
|
delete options.env;
|
||||||
|
delete options.overrides;
|
||||||
|
delete options.plugins;
|
||||||
|
delete options.presets;
|
||||||
|
delete options.passPerPreset;
|
||||||
|
delete options.ignore;
|
||||||
|
delete options.only;
|
||||||
|
delete options.test;
|
||||||
|
delete options.include;
|
||||||
|
delete options.exclude;
|
||||||
|
|
||||||
|
if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) {
|
||||||
|
options.sourceMaps = options.sourceMap;
|
||||||
|
delete options.sourceMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
function dedupDescriptors(items) {
|
||||||
|
const map = new Map();
|
||||||
|
const descriptors = [];
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
if (typeof item.value === "function") {
|
||||||
|
const fnKey = item.value;
|
||||||
|
let nameMap = map.get(fnKey);
|
||||||
|
|
||||||
|
if (!nameMap) {
|
||||||
|
nameMap = new Map();
|
||||||
|
map.set(fnKey, nameMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
let desc = nameMap.get(item.name);
|
||||||
|
|
||||||
|
if (!desc) {
|
||||||
|
desc = {
|
||||||
|
value: item
|
||||||
|
};
|
||||||
|
descriptors.push(desc);
|
||||||
|
if (!item.ownPass) nameMap.set(item.name, desc);
|
||||||
|
} else {
|
||||||
|
desc.value = item;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
descriptors.push({
|
||||||
|
value: item
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return descriptors.reduce((acc, desc) => {
|
||||||
|
acc.push(desc.value);
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
function configIsApplicable({
|
||||||
|
options
|
||||||
|
}, dirname, context) {
|
||||||
|
return (options.test === undefined || configFieldIsApplicable(context, options.test, dirname)) && (options.include === undefined || configFieldIsApplicable(context, options.include, dirname)) && (options.exclude === undefined || !configFieldIsApplicable(context, options.exclude, dirname));
|
||||||
|
}
|
||||||
|
|
||||||
|
function configFieldIsApplicable(context, test, dirname) {
|
||||||
|
const patterns = Array.isArray(test) ? test : [test];
|
||||||
|
return matchesPatterns(context, patterns, dirname);
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldIgnore(context, ignore, only, dirname) {
|
||||||
|
if (ignore && matchesPatterns(context, ignore, dirname)) {
|
||||||
|
var _context$filename;
|
||||||
|
|
||||||
|
const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore)}\` from "${dirname}"`;
|
||||||
|
debug(message);
|
||||||
|
|
||||||
|
if (context.showConfig) {
|
||||||
|
console.log(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (only && !matchesPatterns(context, only, dirname)) {
|
||||||
|
var _context$filename2;
|
||||||
|
|
||||||
|
const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only)}\` from "${dirname}"`;
|
||||||
|
debug(message);
|
||||||
|
|
||||||
|
if (context.showConfig) {
|
||||||
|
console.log(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchesPatterns(context, patterns, dirname) {
|
||||||
|
return patterns.some(pattern => matchPattern(pattern, dirname, context.filename, context));
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchPattern(pattern, dirname, pathToTest, context) {
|
||||||
|
if (typeof pattern === "function") {
|
||||||
|
return !!pattern(pathToTest, {
|
||||||
|
dirname,
|
||||||
|
envName: context.envName,
|
||||||
|
caller: context.caller
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof pathToTest !== "string") {
|
||||||
|
throw new Error(`Configuration contains string/RegExp pattern, but no filename was passed to Babel`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof pattern === "string") {
|
||||||
|
pattern = (0, _patternToRegex.default)(pattern, dirname);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pattern.test(pathToTest);
|
||||||
|
}
|
211
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
Normal file
211
node_modules/@babel/core/lib/config/config-descriptors.js
generated
vendored
Normal file
|
@ -0,0 +1,211 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.createCachedDescriptors = createCachedDescriptors;
|
||||||
|
exports.createUncachedDescriptors = createUncachedDescriptors;
|
||||||
|
exports.createDescriptor = createDescriptor;
|
||||||
|
|
||||||
|
var _files = require("./files");
|
||||||
|
|
||||||
|
var _item = require("./item");
|
||||||
|
|
||||||
|
var _caching = require("./caching");
|
||||||
|
|
||||||
|
function isEqualDescriptor(a, b) {
|
||||||
|
return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && (a.file && a.file.request) === (b.file && b.file.request) && (a.file && a.file.resolved) === (b.file && b.file.resolved);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCachedDescriptors(dirname, options, alias) {
|
||||||
|
const {
|
||||||
|
plugins,
|
||||||
|
presets,
|
||||||
|
passPerPreset
|
||||||
|
} = options;
|
||||||
|
return {
|
||||||
|
options,
|
||||||
|
plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => [],
|
||||||
|
presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function createUncachedDescriptors(dirname, options, alias) {
|
||||||
|
let plugins;
|
||||||
|
let presets;
|
||||||
|
return {
|
||||||
|
options,
|
||||||
|
plugins: () => {
|
||||||
|
if (!plugins) {
|
||||||
|
plugins = createPluginDescriptors(options.plugins || [], dirname, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
return plugins;
|
||||||
|
},
|
||||||
|
presets: () => {
|
||||||
|
if (!presets) {
|
||||||
|
presets = createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset);
|
||||||
|
}
|
||||||
|
|
||||||
|
return presets;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const PRESET_DESCRIPTOR_CACHE = new WeakMap();
|
||||||
|
const createCachedPresetDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
||||||
|
const dirname = cache.using(dir => dir);
|
||||||
|
return (0, _caching.makeStrongCacheSync)(alias => (0, _caching.makeStrongCacheSync)(passPerPreset => createPresetDescriptors(items, dirname, alias, passPerPreset).map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc))));
|
||||||
|
});
|
||||||
|
const PLUGIN_DESCRIPTOR_CACHE = new WeakMap();
|
||||||
|
const createCachedPluginDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
|
||||||
|
const dirname = cache.using(dir => dir);
|
||||||
|
return (0, _caching.makeStrongCacheSync)(alias => createPluginDescriptors(items, dirname, alias).map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)));
|
||||||
|
});
|
||||||
|
const DEFAULT_OPTIONS = {};
|
||||||
|
|
||||||
|
function loadCachedDescriptor(cache, desc) {
|
||||||
|
const {
|
||||||
|
value,
|
||||||
|
options = DEFAULT_OPTIONS
|
||||||
|
} = desc;
|
||||||
|
if (options === false) return desc;
|
||||||
|
let cacheByOptions = cache.get(value);
|
||||||
|
|
||||||
|
if (!cacheByOptions) {
|
||||||
|
cacheByOptions = new WeakMap();
|
||||||
|
cache.set(value, cacheByOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
let possibilities = cacheByOptions.get(options);
|
||||||
|
|
||||||
|
if (!possibilities) {
|
||||||
|
possibilities = [];
|
||||||
|
cacheByOptions.set(options, possibilities);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (possibilities.indexOf(desc) === -1) {
|
||||||
|
const matches = possibilities.filter(possibility => isEqualDescriptor(possibility, desc));
|
||||||
|
|
||||||
|
if (matches.length > 0) {
|
||||||
|
return matches[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
possibilities.push(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPresetDescriptors(items, dirname, alias, passPerPreset) {
|
||||||
|
return createDescriptors("preset", items, dirname, alias, passPerPreset);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPluginDescriptors(items, dirname, alias) {
|
||||||
|
return createDescriptors("plugin", items, dirname, alias);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDescriptors(type, items, dirname, alias, ownPass) {
|
||||||
|
const descriptors = items.map((item, index) => createDescriptor(item, dirname, {
|
||||||
|
type,
|
||||||
|
alias: `${alias}$${index}`,
|
||||||
|
ownPass: !!ownPass
|
||||||
|
}));
|
||||||
|
assertNoDuplicates(descriptors);
|
||||||
|
return descriptors;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createDescriptor(pair, dirname, {
|
||||||
|
type,
|
||||||
|
alias,
|
||||||
|
ownPass
|
||||||
|
}) {
|
||||||
|
const desc = (0, _item.getItemDescriptor)(pair);
|
||||||
|
|
||||||
|
if (desc) {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
let name;
|
||||||
|
let options;
|
||||||
|
let value = pair;
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
if (value.length === 3) {
|
||||||
|
[value, options, name] = value;
|
||||||
|
} else {
|
||||||
|
[value, options] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let file = undefined;
|
||||||
|
let filepath = null;
|
||||||
|
|
||||||
|
if (typeof value === "string") {
|
||||||
|
if (typeof type !== "string") {
|
||||||
|
throw new Error("To resolve a string-based item, the type of item must be given");
|
||||||
|
}
|
||||||
|
|
||||||
|
const resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset;
|
||||||
|
const request = value;
|
||||||
|
({
|
||||||
|
filepath,
|
||||||
|
value
|
||||||
|
} = resolver(value, dirname));
|
||||||
|
file = {
|
||||||
|
request,
|
||||||
|
resolved: filepath
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
throw new Error(`Unexpected falsy value: ${String(value)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value === "object" && value.__esModule) {
|
||||||
|
if (value.default) {
|
||||||
|
value = value.default;
|
||||||
|
} else {
|
||||||
|
throw new Error("Must export a default export when using ES6 modules.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof value !== "object" && typeof value !== "function") {
|
||||||
|
throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filepath !== null && typeof value === "object" && value) {
|
||||||
|
throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
name,
|
||||||
|
alias: filepath || alias,
|
||||||
|
value,
|
||||||
|
options,
|
||||||
|
dirname,
|
||||||
|
ownPass,
|
||||||
|
file
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertNoDuplicates(items) {
|
||||||
|
const map = new Map();
|
||||||
|
|
||||||
|
for (const item of items) {
|
||||||
|
if (typeof item.value !== "function") continue;
|
||||||
|
let nameMap = map.get(item.value);
|
||||||
|
|
||||||
|
if (!nameMap) {
|
||||||
|
nameMap = new Set();
|
||||||
|
map.set(item.value, nameMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nameMap.has(item.name)) {
|
||||||
|
const conflicts = items.filter(i => i.value === item.value);
|
||||||
|
throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`, ``, `Duplicates detected are:`, `${JSON.stringify(conflicts, null, 2)}`].join("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
nameMap.add(item.name);
|
||||||
|
}
|
||||||
|
}
|
335
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
Normal file
335
node_modules/@babel/core/lib/config/files/configuration.js
generated
vendored
Normal file
|
@ -0,0 +1,335 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.findConfigUpwards = findConfigUpwards;
|
||||||
|
exports.findRelativeConfig = findRelativeConfig;
|
||||||
|
exports.findRootConfig = findRootConfig;
|
||||||
|
exports.loadConfig = loadConfig;
|
||||||
|
exports.resolveShowConfigPath = resolveShowConfigPath;
|
||||||
|
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||||
|
|
||||||
|
function _debug() {
|
||||||
|
const data = _interopRequireDefault(require("debug"));
|
||||||
|
|
||||||
|
_debug = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _json() {
|
||||||
|
const data = _interopRequireDefault(require("json5"));
|
||||||
|
|
||||||
|
_json = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _caching = require("../caching");
|
||||||
|
|
||||||
|
var _configApi = _interopRequireDefault(require("../helpers/config-api"));
|
||||||
|
|
||||||
|
var _utils = require("./utils");
|
||||||
|
|
||||||
|
var _moduleTypes = _interopRequireDefault(require("./module-types"));
|
||||||
|
|
||||||
|
var _patternToRegex = _interopRequireDefault(require("../pattern-to-regex"));
|
||||||
|
|
||||||
|
var fs = _interopRequireWildcard(require("../../gensync-utils/fs"));
|
||||||
|
|
||||||
|
var _resolve = _interopRequireDefault(require("../../gensync-utils/resolve"));
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const debug = (0, _debug().default)("babel:config:loading:files:configuration");
|
||||||
|
const ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json"];
|
||||||
|
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
|
||||||
|
const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json"];
|
||||||
|
const BABELIGNORE_FILENAME = ".babelignore";
|
||||||
|
|
||||||
|
function* findConfigUpwards(rootDir) {
|
||||||
|
let dirname = rootDir;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
for (const filename of ROOT_CONFIG_FILENAMES) {
|
||||||
|
if (yield* fs.exists(_path().default.join(dirname, filename))) {
|
||||||
|
return dirname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextDir = _path().default.dirname(dirname);
|
||||||
|
|
||||||
|
if (dirname === nextDir) break;
|
||||||
|
dirname = nextDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function* findRelativeConfig(packageData, envName, caller) {
|
||||||
|
let config = null;
|
||||||
|
let ignore = null;
|
||||||
|
|
||||||
|
const dirname = _path().default.dirname(packageData.filepath);
|
||||||
|
|
||||||
|
for (const loc of packageData.directories) {
|
||||||
|
if (!config) {
|
||||||
|
var _packageData$pkg;
|
||||||
|
|
||||||
|
config = yield* loadOneConfig(RELATIVE_CONFIG_FILENAMES, loc, envName, caller, ((_packageData$pkg = packageData.pkg) == null ? void 0 : _packageData$pkg.dirname) === loc ? packageToBabelConfig(packageData.pkg) : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ignore) {
|
||||||
|
const ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME);
|
||||||
|
|
||||||
|
ignore = yield* readIgnoreConfig(ignoreLoc);
|
||||||
|
|
||||||
|
if (ignore) {
|
||||||
|
debug("Found ignore %o from %o.", ignore.filepath, dirname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
config,
|
||||||
|
ignore
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function findRootConfig(dirname, envName, caller) {
|
||||||
|
return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);
|
||||||
|
}
|
||||||
|
|
||||||
|
function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) {
|
||||||
|
const configs = yield* _gensync().default.all(names.map(filename => readConfig(_path().default.join(dirname, filename), envName, caller)));
|
||||||
|
const config = configs.reduce((previousConfig, config) => {
|
||||||
|
if (config && previousConfig) {
|
||||||
|
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return config || previousConfig;
|
||||||
|
}, previousConfig);
|
||||||
|
|
||||||
|
if (config) {
|
||||||
|
debug("Found configuration %o from %o.", config.filepath, dirname);
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
function* loadConfig(name, dirname, envName, caller) {
|
||||||
|
const filepath = yield* (0, _resolve.default)(name, {
|
||||||
|
basedir: dirname
|
||||||
|
});
|
||||||
|
const conf = yield* readConfig(filepath, envName, caller);
|
||||||
|
|
||||||
|
if (!conf) {
|
||||||
|
throw new Error(`Config file ${filepath} contains no configuration data`);
|
||||||
|
}
|
||||||
|
|
||||||
|
debug("Loaded config %o from %o.", name, dirname);
|
||||||
|
return conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
function readConfig(filepath, envName, caller) {
|
||||||
|
const ext = _path().default.extname(filepath);
|
||||||
|
|
||||||
|
return ext === ".js" || ext === ".cjs" || ext === ".mjs" ? readConfigJS(filepath, {
|
||||||
|
envName,
|
||||||
|
caller
|
||||||
|
}) : readConfigJSON5(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
const LOADING_CONFIGS = new Set();
|
||||||
|
const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepath, cache) {
|
||||||
|
if (!fs.exists.sync(filepath)) {
|
||||||
|
cache.forever();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LOADING_CONFIGS.has(filepath)) {
|
||||||
|
cache.never();
|
||||||
|
debug("Auto-ignoring usage of config %o.", filepath);
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
dirname: _path().default.dirname(filepath),
|
||||||
|
options: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let options;
|
||||||
|
|
||||||
|
try {
|
||||||
|
LOADING_CONFIGS.add(filepath);
|
||||||
|
options = yield* (0, _moduleTypes.default)(filepath, "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously.");
|
||||||
|
} catch (err) {
|
||||||
|
err.message = `${filepath}: Error while loading config - ${err.message}`;
|
||||||
|
throw err;
|
||||||
|
} finally {
|
||||||
|
LOADING_CONFIGS.delete(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
let assertCache = false;
|
||||||
|
|
||||||
|
if (typeof options === "function") {
|
||||||
|
yield* [];
|
||||||
|
options = options((0, _configApi.default)(cache));
|
||||||
|
assertCache = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
||||||
|
throw new Error(`${filepath}: Configuration should be an exported JavaScript object.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof options.then === "function") {
|
||||||
|
throw new Error(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assertCache && !cache.configured()) throwConfigError();
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
dirname: _path().default.dirname(filepath),
|
||||||
|
options
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => {
|
||||||
|
const babel = file.options["babel"];
|
||||||
|
if (typeof babel === "undefined") return null;
|
||||||
|
|
||||||
|
if (typeof babel !== "object" || Array.isArray(babel) || babel === null) {
|
||||||
|
throw new Error(`${file.filepath}: .babel property must be an object`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filepath: file.filepath,
|
||||||
|
dirname: file.dirname,
|
||||||
|
options: babel
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||||
|
let options;
|
||||||
|
|
||||||
|
try {
|
||||||
|
options = _json().default.parse(content);
|
||||||
|
} catch (err) {
|
||||||
|
err.message = `${filepath}: Error while parsing config - ${err.message}`;
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options) throw new Error(`${filepath}: No config detected`);
|
||||||
|
|
||||||
|
if (typeof options !== "object") {
|
||||||
|
throw new Error(`${filepath}: Config returned typeof ${typeof options}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(options)) {
|
||||||
|
throw new Error(`${filepath}: Expected config object but found array`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
dirname: _path().default.dirname(filepath),
|
||||||
|
options
|
||||||
|
};
|
||||||
|
});
|
||||||
|
const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||||
|
const ignoreDir = _path().default.dirname(filepath);
|
||||||
|
|
||||||
|
const ignorePatterns = content.split("\n").map(line => line.replace(/#(.*?)$/, "").trim()).filter(line => !!line);
|
||||||
|
|
||||||
|
for (const pattern of ignorePatterns) {
|
||||||
|
if (pattern[0] === "!") {
|
||||||
|
throw new Error(`Negation of file paths is not supported.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
dirname: _path().default.dirname(filepath),
|
||||||
|
ignore: ignorePatterns.map(pattern => (0, _patternToRegex.default)(pattern, ignoreDir))
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
function* resolveShowConfigPath(dirname) {
|
||||||
|
const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;
|
||||||
|
|
||||||
|
if (targetPath != null) {
|
||||||
|
const absolutePath = _path().default.resolve(dirname, targetPath);
|
||||||
|
|
||||||
|
const stats = yield* fs.stat(absolutePath);
|
||||||
|
|
||||||
|
if (!stats.isFile()) {
|
||||||
|
throw new Error(`${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return absolutePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function throwConfigError() {
|
||||||
|
throw new Error(`\
|
||||||
|
Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
|
||||||
|
for various types of caching, using the first param of their handler functions:
|
||||||
|
|
||||||
|
module.exports = function(api) {
|
||||||
|
// The API exposes the following:
|
||||||
|
|
||||||
|
// Cache the returned value forever and don't call this function again.
|
||||||
|
api.cache(true);
|
||||||
|
|
||||||
|
// Don't cache at all. Not recommended because it will be very slow.
|
||||||
|
api.cache(false);
|
||||||
|
|
||||||
|
// Cached based on the value of some function. If this function returns a value different from
|
||||||
|
// a previously-encountered value, the plugins will re-evaluate.
|
||||||
|
var env = api.cache(() => process.env.NODE_ENV);
|
||||||
|
|
||||||
|
// If testing for a specific env, we recommend specifics to avoid instantiating a plugin for
|
||||||
|
// any possible NODE_ENV value that might come up during plugin execution.
|
||||||
|
var isProd = api.cache(() => process.env.NODE_ENV === "production");
|
||||||
|
|
||||||
|
// .cache(fn) will perform a linear search though instances to find the matching plugin based
|
||||||
|
// based on previous instantiated plugins. If you want to recreate the plugin and discard the
|
||||||
|
// previous instance whenever something changes, you may use:
|
||||||
|
var isProd = api.cache.invalidate(() => process.env.NODE_ENV === "production");
|
||||||
|
|
||||||
|
// Note, we also expose the following more-verbose versions of the above examples:
|
||||||
|
api.cache.forever(); // api.cache(true)
|
||||||
|
api.cache.never(); // api.cache(false)
|
||||||
|
api.cache.using(fn); // api.cache(fn)
|
||||||
|
|
||||||
|
// Return the value that will be cached.
|
||||||
|
return { };
|
||||||
|
};`);
|
||||||
|
}
|
10
node_modules/@babel/core/lib/config/files/import.js
generated
vendored
Normal file
10
node_modules/@babel/core/lib/config/files/import.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = import_;
|
||||||
|
|
||||||
|
function import_(filepath) {
|
||||||
|
return import(filepath);
|
||||||
|
}
|
68
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
Normal file
68
node_modules/@babel/core/lib/config/files/index-browser.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.findConfigUpwards = findConfigUpwards;
|
||||||
|
exports.findPackageData = findPackageData;
|
||||||
|
exports.findRelativeConfig = findRelativeConfig;
|
||||||
|
exports.findRootConfig = findRootConfig;
|
||||||
|
exports.loadConfig = loadConfig;
|
||||||
|
exports.resolveShowConfigPath = resolveShowConfigPath;
|
||||||
|
exports.resolvePlugin = resolvePlugin;
|
||||||
|
exports.resolvePreset = resolvePreset;
|
||||||
|
exports.loadPlugin = loadPlugin;
|
||||||
|
exports.loadPreset = loadPreset;
|
||||||
|
exports.ROOT_CONFIG_FILENAMES = void 0;
|
||||||
|
|
||||||
|
function* findConfigUpwards(rootDir) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function* findPackageData(filepath) {
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
directories: [],
|
||||||
|
pkg: null,
|
||||||
|
isPackage: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function* findRelativeConfig(pkgData, envName, caller) {
|
||||||
|
return {
|
||||||
|
pkg: null,
|
||||||
|
config: null,
|
||||||
|
ignore: null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function* findRootConfig(dirname, envName, caller) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function* loadConfig(name, dirname, envName, caller) {
|
||||||
|
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function* resolveShowConfigPath(dirname) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ROOT_CONFIG_FILENAMES = [];
|
||||||
|
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
|
||||||
|
|
||||||
|
function resolvePlugin(name, dirname) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolvePreset(name, dirname) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadPlugin(name, dirname) {
|
||||||
|
throw new Error(`Cannot load plugin ${name} relative to ${dirname} in a browser`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadPreset(name, dirname) {
|
||||||
|
throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`);
|
||||||
|
}
|
79
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
Normal file
79
node_modules/@babel/core/lib/config/files/index.js
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "findPackageData", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _package.findPackageData;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "findConfigUpwards", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.findConfigUpwards;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "findRelativeConfig", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.findRelativeConfig;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "findRootConfig", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.findRootConfig;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadConfig", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.loadConfig;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "resolveShowConfigPath", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.resolveShowConfigPath;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _configuration.ROOT_CONFIG_FILENAMES;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "resolvePlugin", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _plugins.resolvePlugin;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "resolvePreset", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _plugins.resolvePreset;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadPlugin", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _plugins.loadPlugin;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadPreset", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _plugins.loadPreset;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var _package = require("./package");
|
||||||
|
|
||||||
|
var _configuration = require("./configuration");
|
||||||
|
|
||||||
|
var _plugins = require("./plugins");
|
||||||
|
|
||||||
|
({});
|
96
node_modules/@babel/core/lib/config/files/module-types.js
generated
vendored
Normal file
96
node_modules/@babel/core/lib/config/files/module-types.js
generated
vendored
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = loadCjsOrMjsDefault;
|
||||||
|
|
||||||
|
var _async = require("../../gensync-utils/async");
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _url() {
|
||||||
|
const data = require("url");
|
||||||
|
|
||||||
|
_url = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||||
|
|
||||||
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||||
|
|
||||||
|
let import_;
|
||||||
|
|
||||||
|
try {
|
||||||
|
import_ = require("./import").default;
|
||||||
|
} catch (_unused) {}
|
||||||
|
|
||||||
|
function* loadCjsOrMjsDefault(filepath, asyncError) {
|
||||||
|
switch (guessJSModuleType(filepath)) {
|
||||||
|
case "cjs":
|
||||||
|
return loadCjsDefault(filepath);
|
||||||
|
|
||||||
|
case "unknown":
|
||||||
|
try {
|
||||||
|
return loadCjsDefault(filepath);
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code !== "ERR_REQUIRE_ESM") throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "mjs":
|
||||||
|
if (yield* (0, _async.isAsync)()) {
|
||||||
|
return yield* (0, _async.waitFor)(loadMjsDefault(filepath));
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(asyncError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function guessJSModuleType(filename) {
|
||||||
|
switch (_path().default.extname(filename)) {
|
||||||
|
case ".cjs":
|
||||||
|
return "cjs";
|
||||||
|
|
||||||
|
case ".mjs":
|
||||||
|
return "mjs";
|
||||||
|
|
||||||
|
default:
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadCjsDefault(filepath) {
|
||||||
|
const module = require(filepath);
|
||||||
|
|
||||||
|
return (module == null ? void 0 : module.__esModule) ? module.default || undefined : module;
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadMjsDefault(_x) {
|
||||||
|
return _loadMjsDefault.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
|
function _loadMjsDefault() {
|
||||||
|
_loadMjsDefault = _asyncToGenerator(function* (filepath) {
|
||||||
|
if (!import_) {
|
||||||
|
throw new Error("Internal error: Native ECMAScript modules aren't supported" + " by this platform.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
const module = yield import_((0, _url().pathToFileURL)(filepath));
|
||||||
|
return module.default;
|
||||||
|
});
|
||||||
|
return _loadMjsDefault.apply(this, arguments);
|
||||||
|
}
|
78
node_modules/@babel/core/lib/config/files/package.js
generated
vendored
Normal file
78
node_modules/@babel/core/lib/config/files/package.js
generated
vendored
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.findPackageData = findPackageData;
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _utils = require("./utils");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const PACKAGE_FILENAME = "package.json";
|
||||||
|
|
||||||
|
function* findPackageData(filepath) {
|
||||||
|
let pkg = null;
|
||||||
|
const directories = [];
|
||||||
|
let isPackage = true;
|
||||||
|
|
||||||
|
let dirname = _path().default.dirname(filepath);
|
||||||
|
|
||||||
|
while (!pkg && _path().default.basename(dirname) !== "node_modules") {
|
||||||
|
directories.push(dirname);
|
||||||
|
pkg = yield* readConfigPackage(_path().default.join(dirname, PACKAGE_FILENAME));
|
||||||
|
|
||||||
|
const nextLoc = _path().default.dirname(dirname);
|
||||||
|
|
||||||
|
if (dirname === nextLoc) {
|
||||||
|
isPackage = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
dirname = nextLoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
directories,
|
||||||
|
pkg,
|
||||||
|
isPackage
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) => {
|
||||||
|
let options;
|
||||||
|
|
||||||
|
try {
|
||||||
|
options = JSON.parse(content);
|
||||||
|
} catch (err) {
|
||||||
|
err.message = `${filepath}: Error while parsing JSON - ${err.message}`;
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options) throw new Error(`${filepath}: No config detected`);
|
||||||
|
|
||||||
|
if (typeof options !== "object") {
|
||||||
|
throw new Error(`${filepath}: Config returned typeof ${typeof options}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(options)) {
|
||||||
|
throw new Error(`${filepath}: Expected config object but found array`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
dirname: _path().default.dirname(filepath),
|
||||||
|
options
|
||||||
|
};
|
||||||
|
});
|
169
node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
Normal file
169
node_modules/@babel/core/lib/config/files/plugins.js
generated
vendored
Normal file
|
@ -0,0 +1,169 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.resolvePlugin = resolvePlugin;
|
||||||
|
exports.resolvePreset = resolvePreset;
|
||||||
|
exports.loadPlugin = loadPlugin;
|
||||||
|
exports.loadPreset = loadPreset;
|
||||||
|
|
||||||
|
function _debug() {
|
||||||
|
const data = _interopRequireDefault(require("debug"));
|
||||||
|
|
||||||
|
_debug = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _resolve() {
|
||||||
|
const data = _interopRequireDefault(require("resolve"));
|
||||||
|
|
||||||
|
_resolve = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const debug = (0, _debug().default)("babel:config:loading:files:plugins");
|
||||||
|
const EXACT_RE = /^module:/;
|
||||||
|
const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
|
||||||
|
const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
|
||||||
|
const BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/;
|
||||||
|
const BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/;
|
||||||
|
const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-plugin(?:-|\/|$)|[^/]+\/)/;
|
||||||
|
const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-preset(?:-|\/|$)|[^/]+\/)/;
|
||||||
|
const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;
|
||||||
|
|
||||||
|
function resolvePlugin(name, dirname) {
|
||||||
|
return resolveStandardizedName("plugin", name, dirname);
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolvePreset(name, dirname) {
|
||||||
|
return resolveStandardizedName("preset", name, dirname);
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadPlugin(name, dirname) {
|
||||||
|
const filepath = resolvePlugin(name, dirname);
|
||||||
|
|
||||||
|
if (!filepath) {
|
||||||
|
throw new Error(`Plugin ${name} not found relative to ${dirname}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = requireModule("plugin", filepath);
|
||||||
|
debug("Loaded plugin %o from %o.", name, dirname);
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadPreset(name, dirname) {
|
||||||
|
const filepath = resolvePreset(name, dirname);
|
||||||
|
|
||||||
|
if (!filepath) {
|
||||||
|
throw new Error(`Preset ${name} not found relative to ${dirname}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const value = requireModule("preset", filepath);
|
||||||
|
debug("Loaded preset %o from %o.", name, dirname);
|
||||||
|
return {
|
||||||
|
filepath,
|
||||||
|
value
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function standardizeName(type, name) {
|
||||||
|
if (_path().default.isAbsolute(name)) return name;
|
||||||
|
const isPreset = type === "preset";
|
||||||
|
return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, `babel-${type}-`).replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, `$1${type}-`).replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, `$1babel-${type}-`).replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`).replace(EXACT_RE, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveStandardizedName(type, name, dirname = process.cwd()) {
|
||||||
|
const standardizedName = standardizeName(type, name);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return _resolve().default.sync(standardizedName, {
|
||||||
|
basedir: dirname
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code !== "MODULE_NOT_FOUND") throw e;
|
||||||
|
|
||||||
|
if (standardizedName !== name) {
|
||||||
|
let resolvedOriginal = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
_resolve().default.sync(name, {
|
||||||
|
basedir: dirname
|
||||||
|
});
|
||||||
|
|
||||||
|
resolvedOriginal = true;
|
||||||
|
} catch (_unused) {}
|
||||||
|
|
||||||
|
if (resolvedOriginal) {
|
||||||
|
e.message += `\n- If you want to resolve "${name}", use "module:${name}"`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let resolvedBabel = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
_resolve().default.sync(standardizeName(type, "@babel/" + name), {
|
||||||
|
basedir: dirname
|
||||||
|
});
|
||||||
|
|
||||||
|
resolvedBabel = true;
|
||||||
|
} catch (_unused2) {}
|
||||||
|
|
||||||
|
if (resolvedBabel) {
|
||||||
|
e.message += `\n- Did you mean "@babel/${name}"?`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let resolvedOppositeType = false;
|
||||||
|
const oppositeType = type === "preset" ? "plugin" : "preset";
|
||||||
|
|
||||||
|
try {
|
||||||
|
_resolve().default.sync(standardizeName(oppositeType, name), {
|
||||||
|
basedir: dirname
|
||||||
|
});
|
||||||
|
|
||||||
|
resolvedOppositeType = true;
|
||||||
|
} catch (_unused3) {}
|
||||||
|
|
||||||
|
if (resolvedOppositeType) {
|
||||||
|
e.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const LOADING_MODULES = new Set();
|
||||||
|
|
||||||
|
function requireModule(type, name) {
|
||||||
|
if (LOADING_MODULES.has(name)) {
|
||||||
|
throw new Error(`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
LOADING_MODULES.add(name);
|
||||||
|
return require(name);
|
||||||
|
} finally {
|
||||||
|
LOADING_MODULES.delete(name);
|
||||||
|
}
|
||||||
|
}
|
0
node_modules/@babel/core/lib/config/files/types.js
generated
vendored
Normal file
0
node_modules/@babel/core/lib/config/files/types.js
generated
vendored
Normal file
48
node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
Normal file
48
node_modules/@babel/core/lib/config/files/utils.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.makeStaticFileCache = makeStaticFileCache;
|
||||||
|
|
||||||
|
var _caching = require("../caching");
|
||||||
|
|
||||||
|
var fs = _interopRequireWildcard(require("../../gensync-utils/fs"));
|
||||||
|
|
||||||
|
function _fs2() {
|
||||||
|
const data = _interopRequireDefault(require("fs"));
|
||||||
|
|
||||||
|
_fs2 = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
function makeStaticFileCache(fn) {
|
||||||
|
return (0, _caching.makeStrongCache)(function* (filepath, cache) {
|
||||||
|
const cached = cache.invalidate(() => fileMtime(filepath));
|
||||||
|
|
||||||
|
if (cached === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fn(filepath, yield* fs.readFile(filepath, "utf8"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function fileMtime(filepath) {
|
||||||
|
try {
|
||||||
|
return +_fs2().default.statSync(filepath).mtime;
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
317
node_modules/@babel/core/lib/config/full.js
generated
vendored
Normal file
317
node_modules/@babel/core/lib/config/full.js
generated
vendored
Normal file
|
@ -0,0 +1,317 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _async = require("../gensync-utils/async");
|
||||||
|
|
||||||
|
var _util = require("./util");
|
||||||
|
|
||||||
|
var context = _interopRequireWildcard(require("../index"));
|
||||||
|
|
||||||
|
var _plugin = _interopRequireDefault(require("./plugin"));
|
||||||
|
|
||||||
|
var _item = require("./item");
|
||||||
|
|
||||||
|
var _configChain = require("./config-chain");
|
||||||
|
|
||||||
|
function _traverse() {
|
||||||
|
const data = _interopRequireDefault(require("@babel/traverse"));
|
||||||
|
|
||||||
|
_traverse = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _caching = require("./caching");
|
||||||
|
|
||||||
|
var _options = require("./validation/options");
|
||||||
|
|
||||||
|
var _plugins = require("./validation/plugins");
|
||||||
|
|
||||||
|
var _configApi = _interopRequireDefault(require("./helpers/config-api"));
|
||||||
|
|
||||||
|
var _partial = _interopRequireDefault(require("./partial"));
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
var _default = (0, _gensync().default)(function* loadFullConfig(inputOpts) {
|
||||||
|
const result = yield* (0, _partial.default)(inputOpts);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
options,
|
||||||
|
context
|
||||||
|
} = result;
|
||||||
|
const optionDefaults = {};
|
||||||
|
const passes = [[]];
|
||||||
|
|
||||||
|
try {
|
||||||
|
const {
|
||||||
|
plugins,
|
||||||
|
presets
|
||||||
|
} = options;
|
||||||
|
|
||||||
|
if (!plugins || !presets) {
|
||||||
|
throw new Error("Assertion failure - plugins and presets exist");
|
||||||
|
}
|
||||||
|
|
||||||
|
const ignored = yield* function* recurseDescriptors(config, pass) {
|
||||||
|
const plugins = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < config.plugins.length; i++) {
|
||||||
|
const descriptor = config.plugins[i];
|
||||||
|
|
||||||
|
if (descriptor.options !== false) {
|
||||||
|
try {
|
||||||
|
plugins.push(yield* loadPluginDescriptor(descriptor, context));
|
||||||
|
} catch (e) {
|
||||||
|
if (i > 0 && e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") {
|
||||||
|
(0, _options.checkNoUnwrappedItemOptionPairs)(config.plugins[i - 1], descriptor, "plugin", i, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const presets = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < config.presets.length; i++) {
|
||||||
|
const descriptor = config.presets[i];
|
||||||
|
|
||||||
|
if (descriptor.options !== false) {
|
||||||
|
try {
|
||||||
|
presets.push({
|
||||||
|
preset: yield* loadPresetDescriptor(descriptor, context),
|
||||||
|
pass: descriptor.ownPass ? [] : pass
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (i > 0 && e.code === "BABEL_UNKNOWN_OPTION") {
|
||||||
|
(0, _options.checkNoUnwrappedItemOptionPairs)(config.presets[i - 1], descriptor, "preset", i, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (presets.length > 0) {
|
||||||
|
passes.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pass));
|
||||||
|
|
||||||
|
for (const {
|
||||||
|
preset,
|
||||||
|
pass
|
||||||
|
} of presets) {
|
||||||
|
if (!preset) return true;
|
||||||
|
const ignored = yield* recurseDescriptors({
|
||||||
|
plugins: preset.plugins,
|
||||||
|
presets: preset.presets
|
||||||
|
}, pass);
|
||||||
|
if (ignored) return true;
|
||||||
|
preset.options.forEach(opts => {
|
||||||
|
(0, _util.mergeOptions)(optionDefaults, opts);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugins.length > 0) {
|
||||||
|
pass.unshift(...plugins);
|
||||||
|
}
|
||||||
|
}({
|
||||||
|
plugins: plugins.map(item => {
|
||||||
|
const desc = (0, _item.getItemDescriptor)(item);
|
||||||
|
|
||||||
|
if (!desc) {
|
||||||
|
throw new Error("Assertion failure - must be config item");
|
||||||
|
}
|
||||||
|
|
||||||
|
return desc;
|
||||||
|
}),
|
||||||
|
presets: presets.map(item => {
|
||||||
|
const desc = (0, _item.getItemDescriptor)(item);
|
||||||
|
|
||||||
|
if (!desc) {
|
||||||
|
throw new Error("Assertion failure - must be config item");
|
||||||
|
}
|
||||||
|
|
||||||
|
return desc;
|
||||||
|
})
|
||||||
|
}, passes[0]);
|
||||||
|
if (ignored) return null;
|
||||||
|
} catch (e) {
|
||||||
|
if (!/^\[BABEL\]/.test(e.message)) {
|
||||||
|
e.message = `[BABEL] ${context.filename || "unknown"}: ${e.message}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
const opts = optionDefaults;
|
||||||
|
(0, _util.mergeOptions)(opts, options);
|
||||||
|
opts.plugins = passes[0];
|
||||||
|
opts.presets = passes.slice(1).filter(plugins => plugins.length > 0).map(plugins => ({
|
||||||
|
plugins
|
||||||
|
}));
|
||||||
|
opts.passPerPreset = opts.presets.length > 0;
|
||||||
|
return {
|
||||||
|
options: opts,
|
||||||
|
passes: passes
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
exports.default = _default;
|
||||||
|
const loadDescriptor = (0, _caching.makeWeakCache)(function* ({
|
||||||
|
value,
|
||||||
|
options,
|
||||||
|
dirname,
|
||||||
|
alias
|
||||||
|
}, cache) {
|
||||||
|
if (options === false) throw new Error("Assertion failure");
|
||||||
|
options = options || {};
|
||||||
|
let item = value;
|
||||||
|
|
||||||
|
if (typeof value === "function") {
|
||||||
|
const api = Object.assign({}, context, (0, _configApi.default)(cache));
|
||||||
|
|
||||||
|
try {
|
||||||
|
item = value(api, options, dirname);
|
||||||
|
} catch (e) {
|
||||||
|
if (alias) {
|
||||||
|
e.message += ` (While processing: ${JSON.stringify(alias)})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!item || typeof item !== "object") {
|
||||||
|
throw new Error("Plugin/Preset did not return an object.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof item.then === "function") {
|
||||||
|
yield* [];
|
||||||
|
throw new Error(`You appear to be using an async plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
value: item,
|
||||||
|
options,
|
||||||
|
dirname,
|
||||||
|
alias
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
function* loadPluginDescriptor(descriptor, context) {
|
||||||
|
if (descriptor.value instanceof _plugin.default) {
|
||||||
|
if (descriptor.options) {
|
||||||
|
throw new Error("Passed options to an existing Plugin instance will not work.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return descriptor.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return yield* instantiatePlugin(yield* loadDescriptor(descriptor, context), context);
|
||||||
|
}
|
||||||
|
|
||||||
|
const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({
|
||||||
|
value,
|
||||||
|
options,
|
||||||
|
dirname,
|
||||||
|
alias
|
||||||
|
}, cache) {
|
||||||
|
const pluginObj = (0, _plugins.validatePluginObject)(value);
|
||||||
|
const plugin = Object.assign({}, pluginObj);
|
||||||
|
|
||||||
|
if (plugin.visitor) {
|
||||||
|
plugin.visitor = _traverse().default.explode(Object.assign({}, plugin.visitor));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.inherits) {
|
||||||
|
const inheritsDescriptor = {
|
||||||
|
name: undefined,
|
||||||
|
alias: `${alias}$inherits`,
|
||||||
|
value: plugin.inherits,
|
||||||
|
options,
|
||||||
|
dirname
|
||||||
|
};
|
||||||
|
const inherits = yield* (0, _async.forwardAsync)(loadPluginDescriptor, run => {
|
||||||
|
return cache.invalidate(data => run(inheritsDescriptor, data));
|
||||||
|
});
|
||||||
|
plugin.pre = chain(inherits.pre, plugin.pre);
|
||||||
|
plugin.post = chain(inherits.post, plugin.post);
|
||||||
|
plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions);
|
||||||
|
plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new _plugin.default(plugin, options, alias);
|
||||||
|
});
|
||||||
|
|
||||||
|
const validateIfOptionNeedsFilename = (options, descriptor) => {
|
||||||
|
if (options.test || options.include || options.exclude) {
|
||||||
|
const formattedPresetName = descriptor.name ? `"${descriptor.name}"` : "/* your preset */";
|
||||||
|
throw new Error([`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, `\`\`\``, `babel.transform(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, `\`\`\``, `See https://babeljs.io/docs/en/options#filename for more information.`].join("\n"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const validatePreset = (preset, context, descriptor) => {
|
||||||
|
if (!context.filename) {
|
||||||
|
const {
|
||||||
|
options
|
||||||
|
} = preset;
|
||||||
|
validateIfOptionNeedsFilename(options, descriptor);
|
||||||
|
|
||||||
|
if (options.overrides) {
|
||||||
|
options.overrides.forEach(overrideOptions => validateIfOptionNeedsFilename(overrideOptions, descriptor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function* loadPresetDescriptor(descriptor, context) {
|
||||||
|
const preset = instantiatePreset(yield* loadDescriptor(descriptor, context));
|
||||||
|
validatePreset(preset, context, descriptor);
|
||||||
|
return yield* (0, _configChain.buildPresetChain)(preset, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
const instantiatePreset = (0, _caching.makeWeakCacheSync)(({
|
||||||
|
value,
|
||||||
|
dirname,
|
||||||
|
alias
|
||||||
|
}) => {
|
||||||
|
return {
|
||||||
|
options: (0, _options.validate)("preset", value),
|
||||||
|
alias,
|
||||||
|
dirname
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
function chain(a, b) {
|
||||||
|
const fns = [a, b].filter(Boolean);
|
||||||
|
if (fns.length <= 1) return fns[0];
|
||||||
|
return function (...args) {
|
||||||
|
for (const fn of fns) {
|
||||||
|
fn.apply(this, args);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
85
node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
Normal file
85
node_modules/@babel/core/lib/config/helpers/config-api.js
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = makeAPI;
|
||||||
|
|
||||||
|
function _semver() {
|
||||||
|
const data = _interopRequireDefault(require("semver"));
|
||||||
|
|
||||||
|
_semver = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ = require("../../");
|
||||||
|
|
||||||
|
var _caching = require("../caching");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function makeAPI(cache) {
|
||||||
|
const env = value => cache.using(data => {
|
||||||
|
if (typeof value === "undefined") return data.envName;
|
||||||
|
|
||||||
|
if (typeof value === "function") {
|
||||||
|
return (0, _caching.assertSimpleType)(value(data.envName));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Array.isArray(value)) value = [value];
|
||||||
|
return value.some(entry => {
|
||||||
|
if (typeof entry !== "string") {
|
||||||
|
throw new Error("Unexpected non-string value");
|
||||||
|
}
|
||||||
|
|
||||||
|
return entry === data.envName;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const caller = cb => cache.using(data => (0, _caching.assertSimpleType)(cb(data.caller)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
version: _.version,
|
||||||
|
cache: cache.simple(),
|
||||||
|
env,
|
||||||
|
async: () => false,
|
||||||
|
caller,
|
||||||
|
assertVersion
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertVersion(range) {
|
||||||
|
if (typeof range === "number") {
|
||||||
|
if (!Number.isInteger(range)) {
|
||||||
|
throw new Error("Expected string or integer value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
range = `^${range}.0.0-0`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof range !== "string") {
|
||||||
|
throw new Error("Expected string or integer value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_semver().default.satisfies(_.version, range)) return;
|
||||||
|
const limit = Error.stackTraceLimit;
|
||||||
|
|
||||||
|
if (typeof limit === "number" && limit < 25) {
|
||||||
|
Error.stackTraceLimit = 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
const err = new Error(`Requires Babel "${range}", but was loaded with "${_.version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`);
|
||||||
|
|
||||||
|
if (typeof limit === "number") {
|
||||||
|
Error.stackTraceLimit = limit;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw Object.assign(err, {
|
||||||
|
code: "BABEL_VERSION_UNSUPPORTED",
|
||||||
|
version: _.version,
|
||||||
|
range
|
||||||
|
});
|
||||||
|
}
|
10
node_modules/@babel/core/lib/config/helpers/environment.js
generated
vendored
Normal file
10
node_modules/@babel/core/lib/config/helpers/environment.js
generated
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.getEnv = getEnv;
|
||||||
|
|
||||||
|
function getEnv(defaultValue = "development") {
|
||||||
|
return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;
|
||||||
|
}
|
57
node_modules/@babel/core/lib/config/index.js
generated
vendored
Normal file
57
node_modules/@babel/core/lib/config/index.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "default", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _full.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
exports.loadOptionsAsync = exports.loadOptionsSync = exports.loadOptions = exports.loadPartialConfigAsync = exports.loadPartialConfigSync = exports.loadPartialConfig = void 0;
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _full = _interopRequireDefault(require("./full"));
|
||||||
|
|
||||||
|
var _partial = require("./partial");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const loadOptionsRunner = (0, _gensync().default)(function* (opts) {
|
||||||
|
var _config$options;
|
||||||
|
|
||||||
|
const config = yield* (0, _full.default)(opts);
|
||||||
|
return (_config$options = config == null ? void 0 : config.options) != null ? _config$options : null;
|
||||||
|
});
|
||||||
|
|
||||||
|
const maybeErrback = runner => (opts, callback) => {
|
||||||
|
if (callback === undefined && typeof opts === "function") {
|
||||||
|
callback = opts;
|
||||||
|
opts = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return callback ? runner.errback(opts, callback) : runner.sync(opts);
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadPartialConfig = maybeErrback(_partial.loadPartialConfig);
|
||||||
|
exports.loadPartialConfig = loadPartialConfig;
|
||||||
|
const loadPartialConfigSync = _partial.loadPartialConfig.sync;
|
||||||
|
exports.loadPartialConfigSync = loadPartialConfigSync;
|
||||||
|
const loadPartialConfigAsync = _partial.loadPartialConfig.async;
|
||||||
|
exports.loadPartialConfigAsync = loadPartialConfigAsync;
|
||||||
|
const loadOptions = maybeErrback(loadOptionsRunner);
|
||||||
|
exports.loadOptions = loadOptions;
|
||||||
|
const loadOptionsSync = loadOptionsRunner.sync;
|
||||||
|
exports.loadOptionsSync = loadOptionsSync;
|
||||||
|
const loadOptionsAsync = loadOptionsRunner.async;
|
||||||
|
exports.loadOptionsAsync = loadOptionsAsync;
|
66
node_modules/@babel/core/lib/config/item.js
generated
vendored
Normal file
66
node_modules/@babel/core/lib/config/item.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.createItemFromDescriptor = createItemFromDescriptor;
|
||||||
|
exports.createConfigItem = createConfigItem;
|
||||||
|
exports.getItemDescriptor = getItemDescriptor;
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _configDescriptors = require("./config-descriptors");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function createItemFromDescriptor(desc) {
|
||||||
|
return new ConfigItem(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createConfigItem(value, {
|
||||||
|
dirname = ".",
|
||||||
|
type
|
||||||
|
} = {}) {
|
||||||
|
const descriptor = (0, _configDescriptors.createDescriptor)(value, _path().default.resolve(dirname), {
|
||||||
|
type,
|
||||||
|
alias: "programmatic item"
|
||||||
|
});
|
||||||
|
return createItemFromDescriptor(descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getItemDescriptor(item) {
|
||||||
|
if (item instanceof ConfigItem) {
|
||||||
|
return item._descriptor;
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConfigItem {
|
||||||
|
constructor(descriptor) {
|
||||||
|
this._descriptor = descriptor;
|
||||||
|
Object.defineProperty(this, "_descriptor", {
|
||||||
|
enumerable: false
|
||||||
|
});
|
||||||
|
this.value = this._descriptor.value;
|
||||||
|
this.options = this._descriptor.options;
|
||||||
|
this.dirname = this._descriptor.dirname;
|
||||||
|
this.name = this._descriptor.name;
|
||||||
|
this.file = this._descriptor.file ? {
|
||||||
|
request: this._descriptor.file.request,
|
||||||
|
resolved: this._descriptor.file.resolved
|
||||||
|
} : undefined;
|
||||||
|
Object.freeze(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.freeze(ConfigItem.prototype);
|
157
node_modules/@babel/core/lib/config/partial.js
generated
vendored
Normal file
157
node_modules/@babel/core/lib/config/partial.js
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = loadPrivatePartialConfig;
|
||||||
|
exports.loadPartialConfig = void 0;
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _plugin = _interopRequireDefault(require("./plugin"));
|
||||||
|
|
||||||
|
var _util = require("./util");
|
||||||
|
|
||||||
|
var _item = require("./item");
|
||||||
|
|
||||||
|
var _configChain = require("./config-chain");
|
||||||
|
|
||||||
|
var _environment = require("./helpers/environment");
|
||||||
|
|
||||||
|
var _options = require("./validation/options");
|
||||||
|
|
||||||
|
var _files = require("./files");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function* resolveRootMode(rootDir, rootMode) {
|
||||||
|
switch (rootMode) {
|
||||||
|
case "root":
|
||||||
|
return rootDir;
|
||||||
|
|
||||||
|
case "upward-optional":
|
||||||
|
{
|
||||||
|
const upwardRootDir = yield* (0, _files.findConfigUpwards)(rootDir);
|
||||||
|
return upwardRootDir === null ? rootDir : upwardRootDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
case "upward":
|
||||||
|
{
|
||||||
|
const upwardRootDir = yield* (0, _files.findConfigUpwards)(rootDir);
|
||||||
|
if (upwardRootDir !== null) return upwardRootDir;
|
||||||
|
throw Object.assign(new Error(`Babel was run with rootMode:"upward" but a root could not ` + `be found when searching upward from "${rootDir}".\n` + `One of the following config files must be in the directory tree: ` + `"${_files.ROOT_CONFIG_FILENAMES.join(", ")}".`), {
|
||||||
|
code: "BABEL_ROOT_NOT_FOUND",
|
||||||
|
dirname: rootDir
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error(`Assertion failure - unknown rootMode value.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function* loadPrivatePartialConfig(inputOpts) {
|
||||||
|
if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) {
|
||||||
|
throw new Error("Babel options must be an object, null, or undefined");
|
||||||
|
}
|
||||||
|
|
||||||
|
const args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {};
|
||||||
|
const {
|
||||||
|
envName = (0, _environment.getEnv)(),
|
||||||
|
cwd = ".",
|
||||||
|
root: rootDir = ".",
|
||||||
|
rootMode = "root",
|
||||||
|
caller,
|
||||||
|
cloneInputAst = true
|
||||||
|
} = args;
|
||||||
|
|
||||||
|
const absoluteCwd = _path().default.resolve(cwd);
|
||||||
|
|
||||||
|
const absoluteRootDir = yield* resolveRootMode(_path().default.resolve(absoluteCwd, rootDir), rootMode);
|
||||||
|
const filename = typeof args.filename === "string" ? _path().default.resolve(cwd, args.filename) : undefined;
|
||||||
|
const showConfigPath = yield* (0, _files.resolveShowConfigPath)(absoluteCwd);
|
||||||
|
const context = {
|
||||||
|
filename,
|
||||||
|
cwd: absoluteCwd,
|
||||||
|
root: absoluteRootDir,
|
||||||
|
envName,
|
||||||
|
caller,
|
||||||
|
showConfig: showConfigPath === filename
|
||||||
|
};
|
||||||
|
const configChain = yield* (0, _configChain.buildRootChain)(args, context);
|
||||||
|
if (!configChain) return null;
|
||||||
|
const options = {};
|
||||||
|
configChain.options.forEach(opts => {
|
||||||
|
(0, _util.mergeOptions)(options, opts);
|
||||||
|
});
|
||||||
|
options.cloneInputAst = cloneInputAst;
|
||||||
|
options.babelrc = false;
|
||||||
|
options.configFile = false;
|
||||||
|
options.passPerPreset = false;
|
||||||
|
options.envName = context.envName;
|
||||||
|
options.cwd = context.cwd;
|
||||||
|
options.root = context.root;
|
||||||
|
options.filename = typeof context.filename === "string" ? context.filename : undefined;
|
||||||
|
options.plugins = configChain.plugins.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor));
|
||||||
|
options.presets = configChain.presets.map(descriptor => (0, _item.createItemFromDescriptor)(descriptor));
|
||||||
|
return {
|
||||||
|
options,
|
||||||
|
context,
|
||||||
|
ignore: configChain.ignore,
|
||||||
|
babelrc: configChain.babelrc,
|
||||||
|
config: configChain.config
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadPartialConfig = (0, _gensync().default)(function* (inputOpts) {
|
||||||
|
const result = yield* loadPrivatePartialConfig(inputOpts);
|
||||||
|
if (!result) return null;
|
||||||
|
const {
|
||||||
|
options,
|
||||||
|
babelrc,
|
||||||
|
ignore,
|
||||||
|
config
|
||||||
|
} = result;
|
||||||
|
(options.plugins || []).forEach(item => {
|
||||||
|
if (item.value instanceof _plugin.default) {
|
||||||
|
throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined);
|
||||||
|
});
|
||||||
|
exports.loadPartialConfig = loadPartialConfig;
|
||||||
|
|
||||||
|
class PartialConfig {
|
||||||
|
constructor(options, babelrc, ignore, config) {
|
||||||
|
this.options = options;
|
||||||
|
this.babelignore = ignore;
|
||||||
|
this.babelrc = babelrc;
|
||||||
|
this.config = config;
|
||||||
|
Object.freeze(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
hasFilesystemConfig() {
|
||||||
|
return this.babelrc !== undefined || this.config !== undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.freeze(PartialConfig.prototype);
|
52
node_modules/@babel/core/lib/config/pattern-to-regex.js
generated
vendored
Normal file
52
node_modules/@babel/core/lib/config/pattern-to-regex.js
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = pathToPattern;
|
||||||
|
|
||||||
|
function _path() {
|
||||||
|
const data = _interopRequireDefault(require("path"));
|
||||||
|
|
||||||
|
_path = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _escapeRegExp() {
|
||||||
|
const data = _interopRequireDefault(require("lodash/escapeRegExp"));
|
||||||
|
|
||||||
|
_escapeRegExp = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const sep = `\\${_path().default.sep}`;
|
||||||
|
const endSep = `(?:${sep}|$)`;
|
||||||
|
const substitution = `[^${sep}]+`;
|
||||||
|
const starPat = `(?:${substitution}${sep})`;
|
||||||
|
const starPatLast = `(?:${substitution}${endSep})`;
|
||||||
|
const starStarPat = `${starPat}*?`;
|
||||||
|
const starStarPatLast = `${starPat}*?${starPatLast}?`;
|
||||||
|
|
||||||
|
function pathToPattern(pattern, dirname) {
|
||||||
|
const parts = _path().default.resolve(dirname, pattern).split(_path().default.sep);
|
||||||
|
|
||||||
|
return new RegExp(["^", ...parts.map((part, i) => {
|
||||||
|
const last = i === parts.length - 1;
|
||||||
|
if (part === "**") return last ? starStarPatLast : starStarPat;
|
||||||
|
if (part === "*") return last ? starPatLast : starPat;
|
||||||
|
|
||||||
|
if (part.indexOf("*.") === 0) {
|
||||||
|
return substitution + (0, _escapeRegExp().default)(part.slice(1)) + (last ? endSep : sep);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (0, _escapeRegExp().default)(part) + (last ? endSep : sep);
|
||||||
|
})].join(""));
|
||||||
|
}
|
22
node_modules/@babel/core/lib/config/plugin.js
generated
vendored
Normal file
22
node_modules/@babel/core/lib/config/plugin.js
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
|
||||||
|
class Plugin {
|
||||||
|
constructor(plugin, options, key) {
|
||||||
|
this.key = plugin.name || key;
|
||||||
|
this.manipulateOptions = plugin.manipulateOptions;
|
||||||
|
this.post = plugin.post;
|
||||||
|
this.pre = plugin.pre;
|
||||||
|
this.visitor = plugin.visitor || {};
|
||||||
|
this.parserOverride = plugin.parserOverride;
|
||||||
|
this.generatorOverride = plugin.generatorOverride;
|
||||||
|
this.options = options;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = Plugin;
|
127
node_modules/@babel/core/lib/config/printer.js
generated
vendored
Normal file
127
node_modules/@babel/core/lib/config/printer.js
generated
vendored
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.ConfigPrinter = exports.ChainFormatter = void 0;
|
||||||
|
const ChainFormatter = {
|
||||||
|
Programmatic: 0,
|
||||||
|
Config: 1
|
||||||
|
};
|
||||||
|
exports.ChainFormatter = ChainFormatter;
|
||||||
|
const Formatter = {
|
||||||
|
title(type, callerName, filepath) {
|
||||||
|
let title = "";
|
||||||
|
|
||||||
|
if (type === ChainFormatter.Programmatic) {
|
||||||
|
title = "programmatic options";
|
||||||
|
|
||||||
|
if (callerName) {
|
||||||
|
title += " from " + callerName;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
title = "config " + filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return title;
|
||||||
|
},
|
||||||
|
|
||||||
|
loc(index, envName) {
|
||||||
|
let loc = "";
|
||||||
|
|
||||||
|
if (index != null) {
|
||||||
|
loc += `.overrides[${index}]`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (envName != null) {
|
||||||
|
loc += `.env["${envName}"]`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return loc;
|
||||||
|
},
|
||||||
|
|
||||||
|
optionsAndDescriptors(opt) {
|
||||||
|
const content = Object.assign({}, opt.options);
|
||||||
|
delete content.overrides;
|
||||||
|
delete content.env;
|
||||||
|
const pluginDescriptors = [...opt.plugins()];
|
||||||
|
|
||||||
|
if (pluginDescriptors.length) {
|
||||||
|
content.plugins = pluginDescriptors.map(d => descriptorToConfig(d));
|
||||||
|
}
|
||||||
|
|
||||||
|
const presetDescriptors = [...opt.presets()];
|
||||||
|
|
||||||
|
if (presetDescriptors.length) {
|
||||||
|
content.presets = [...presetDescriptors].map(d => descriptorToConfig(d));
|
||||||
|
}
|
||||||
|
|
||||||
|
return JSON.stringify(content, undefined, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function descriptorToConfig(d) {
|
||||||
|
var _d$file;
|
||||||
|
|
||||||
|
let name = (_d$file = d.file) == null ? void 0 : _d$file.request;
|
||||||
|
|
||||||
|
if (name == null) {
|
||||||
|
if (typeof d.value === "object") {
|
||||||
|
name = d.value;
|
||||||
|
} else if (typeof d.value === "function") {
|
||||||
|
name = `[Function: ${d.value.toString().substr(0, 50)} ... ]`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == null) {
|
||||||
|
name = "[Unknown]";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d.options === undefined) {
|
||||||
|
return name;
|
||||||
|
} else if (d.name == null) {
|
||||||
|
return [name, d.options];
|
||||||
|
} else {
|
||||||
|
return [name, d.options, d.name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ConfigPrinter {
|
||||||
|
constructor() {
|
||||||
|
this._stack = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
configure(enabled, type, {
|
||||||
|
callerName,
|
||||||
|
filepath
|
||||||
|
}) {
|
||||||
|
if (!enabled) return () => {};
|
||||||
|
return (content, index, envName) => {
|
||||||
|
this._stack.push({
|
||||||
|
type,
|
||||||
|
callerName,
|
||||||
|
filepath,
|
||||||
|
content,
|
||||||
|
index,
|
||||||
|
envName
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static format(config) {
|
||||||
|
let title = Formatter.title(config.type, config.callerName, config.filepath);
|
||||||
|
const loc = Formatter.loc(config.index, config.envName);
|
||||||
|
if (loc) title += ` ${loc}`;
|
||||||
|
const content = Formatter.optionsAndDescriptors(config.content);
|
||||||
|
return `${title}\n${content}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
output() {
|
||||||
|
if (this._stack.length === 0) return "";
|
||||||
|
return this._stack.map(s => ConfigPrinter.format(s)).join("\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.ConfigPrinter = ConfigPrinter;
|
35
node_modules/@babel/core/lib/config/util.js
generated
vendored
Normal file
35
node_modules/@babel/core/lib/config/util.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.mergeOptions = mergeOptions;
|
||||||
|
exports.isIterableIterator = isIterableIterator;
|
||||||
|
|
||||||
|
function mergeOptions(target, source) {
|
||||||
|
for (const k of Object.keys(source)) {
|
||||||
|
if (k === "parserOpts" && source.parserOpts) {
|
||||||
|
const parserOpts = source.parserOpts;
|
||||||
|
const targetObj = target.parserOpts = target.parserOpts || {};
|
||||||
|
mergeDefaultFields(targetObj, parserOpts);
|
||||||
|
} else if (k === "generatorOpts" && source.generatorOpts) {
|
||||||
|
const generatorOpts = source.generatorOpts;
|
||||||
|
const targetObj = target.generatorOpts = target.generatorOpts || {};
|
||||||
|
mergeDefaultFields(targetObj, generatorOpts);
|
||||||
|
} else {
|
||||||
|
const val = source[k];
|
||||||
|
if (val !== undefined) target[k] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function mergeDefaultFields(target, source) {
|
||||||
|
for (const k of Object.keys(source)) {
|
||||||
|
const val = source[k];
|
||||||
|
if (val !== undefined) target[k] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isIterableIterator(value) {
|
||||||
|
return !!value && typeof value.next === "function" && typeof value[Symbol.iterator] === "function";
|
||||||
|
}
|
268
node_modules/@babel/core/lib/config/validation/option-assertions.js
generated
vendored
Normal file
268
node_modules/@babel/core/lib/config/validation/option-assertions.js
generated
vendored
Normal file
|
@ -0,0 +1,268 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.msg = msg;
|
||||||
|
exports.access = access;
|
||||||
|
exports.assertRootMode = assertRootMode;
|
||||||
|
exports.assertSourceMaps = assertSourceMaps;
|
||||||
|
exports.assertCompact = assertCompact;
|
||||||
|
exports.assertSourceType = assertSourceType;
|
||||||
|
exports.assertCallerMetadata = assertCallerMetadata;
|
||||||
|
exports.assertInputSourceMap = assertInputSourceMap;
|
||||||
|
exports.assertString = assertString;
|
||||||
|
exports.assertFunction = assertFunction;
|
||||||
|
exports.assertBoolean = assertBoolean;
|
||||||
|
exports.assertObject = assertObject;
|
||||||
|
exports.assertArray = assertArray;
|
||||||
|
exports.assertIgnoreList = assertIgnoreList;
|
||||||
|
exports.assertConfigApplicableTest = assertConfigApplicableTest;
|
||||||
|
exports.assertConfigFileSearch = assertConfigFileSearch;
|
||||||
|
exports.assertBabelrcSearch = assertBabelrcSearch;
|
||||||
|
exports.assertPluginList = assertPluginList;
|
||||||
|
|
||||||
|
function msg(loc) {
|
||||||
|
switch (loc.type) {
|
||||||
|
case "root":
|
||||||
|
return ``;
|
||||||
|
|
||||||
|
case "env":
|
||||||
|
return `${msg(loc.parent)}.env["${loc.name}"]`;
|
||||||
|
|
||||||
|
case "overrides":
|
||||||
|
return `${msg(loc.parent)}.overrides[${loc.index}]`;
|
||||||
|
|
||||||
|
case "option":
|
||||||
|
return `${msg(loc.parent)}.${loc.name}`;
|
||||||
|
|
||||||
|
case "access":
|
||||||
|
return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new Error(`Assertion failure: Unknown type ${loc.type}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function access(loc, name) {
|
||||||
|
return {
|
||||||
|
type: "access",
|
||||||
|
name,
|
||||||
|
parent: loc
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertRootMode(loc, value) {
|
||||||
|
if (value !== undefined && value !== "root" && value !== "upward" && value !== "upward-optional") {
|
||||||
|
throw new Error(`${msg(loc)} must be a "root", "upward", "upward-optional" or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertSourceMaps(loc, value) {
|
||||||
|
if (value !== undefined && typeof value !== "boolean" && value !== "inline" && value !== "both") {
|
||||||
|
throw new Error(`${msg(loc)} must be a boolean, "inline", "both", or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertCompact(loc, value) {
|
||||||
|
if (value !== undefined && typeof value !== "boolean" && value !== "auto") {
|
||||||
|
throw new Error(`${msg(loc)} must be a boolean, "auto", or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertSourceType(loc, value) {
|
||||||
|
if (value !== undefined && value !== "module" && value !== "script" && value !== "unambiguous") {
|
||||||
|
throw new Error(`${msg(loc)} must be "module", "script", "unambiguous", or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertCallerMetadata(loc, value) {
|
||||||
|
const obj = assertObject(loc, value);
|
||||||
|
|
||||||
|
if (obj) {
|
||||||
|
if (typeof obj["name"] !== "string") {
|
||||||
|
throw new Error(`${msg(loc)} set but does not contain "name" property string`);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const prop of Object.keys(obj)) {
|
||||||
|
const propLoc = access(loc, prop);
|
||||||
|
const value = obj[prop];
|
||||||
|
|
||||||
|
if (value != null && typeof value !== "boolean" && typeof value !== "string" && typeof value !== "number") {
|
||||||
|
throw new Error(`${msg(propLoc)} must be null, undefined, a boolean, a string, or a number.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertInputSourceMap(loc, value) {
|
||||||
|
if (value !== undefined && typeof value !== "boolean" && (typeof value !== "object" || !value)) {
|
||||||
|
throw new Error(`${msg(loc)} must be a boolean, object, or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertString(loc, value) {
|
||||||
|
if (value !== undefined && typeof value !== "string") {
|
||||||
|
throw new Error(`${msg(loc)} must be a string, or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertFunction(loc, value) {
|
||||||
|
if (value !== undefined && typeof value !== "function") {
|
||||||
|
throw new Error(`${msg(loc)} must be a function, or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertBoolean(loc, value) {
|
||||||
|
if (value !== undefined && typeof value !== "boolean") {
|
||||||
|
throw new Error(`${msg(loc)} must be a boolean, or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertObject(loc, value) {
|
||||||
|
if (value !== undefined && (typeof value !== "object" || Array.isArray(value) || !value)) {
|
||||||
|
throw new Error(`${msg(loc)} must be an object, or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertArray(loc, value) {
|
||||||
|
if (value != null && !Array.isArray(value)) {
|
||||||
|
throw new Error(`${msg(loc)} must be an array, or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertIgnoreList(loc, value) {
|
||||||
|
const arr = assertArray(loc, value);
|
||||||
|
|
||||||
|
if (arr) {
|
||||||
|
arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item));
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertIgnoreItem(loc, value) {
|
||||||
|
if (typeof value !== "string" && typeof value !== "function" && !(value instanceof RegExp)) {
|
||||||
|
throw new Error(`${msg(loc)} must be an array of string/Function/RegExp values, or undefined`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertConfigApplicableTest(loc, value) {
|
||||||
|
if (value === undefined) return value;
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach((item, i) => {
|
||||||
|
if (!checkValidTest(item)) {
|
||||||
|
throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (!checkValidTest(value)) {
|
||||||
|
throw new Error(`${msg(loc)} must be a string/Function/RegExp, or an array of those`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkValidTest(value) {
|
||||||
|
return typeof value === "string" || typeof value === "function" || value instanceof RegExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertConfigFileSearch(loc, value) {
|
||||||
|
if (value !== undefined && typeof value !== "boolean" && typeof value !== "string") {
|
||||||
|
throw new Error(`${msg(loc)} must be a undefined, a boolean, a string, ` + `got ${JSON.stringify(value)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertBabelrcSearch(loc, value) {
|
||||||
|
if (value === undefined || typeof value === "boolean") return value;
|
||||||
|
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
value.forEach((item, i) => {
|
||||||
|
if (!checkValidTest(item)) {
|
||||||
|
throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (!checkValidTest(value)) {
|
||||||
|
throw new Error(`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` + `or an array of those, got ${JSON.stringify(value)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertPluginList(loc, value) {
|
||||||
|
const arr = assertArray(loc, value);
|
||||||
|
|
||||||
|
if (arr) {
|
||||||
|
arr.forEach((item, i) => assertPluginItem(access(loc, i), item));
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertPluginItem(loc, value) {
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
if (value.length === 0) {
|
||||||
|
throw new Error(`${msg(loc)} must include an object`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.length > 3) {
|
||||||
|
throw new Error(`${msg(loc)} may only be a two-tuple or three-tuple`);
|
||||||
|
}
|
||||||
|
|
||||||
|
assertPluginTarget(access(loc, 0), value[0]);
|
||||||
|
|
||||||
|
if (value.length > 1) {
|
||||||
|
const opts = value[1];
|
||||||
|
|
||||||
|
if (opts !== undefined && opts !== false && (typeof opts !== "object" || Array.isArray(opts) || opts === null)) {
|
||||||
|
throw new Error(`${msg(access(loc, 1))} must be an object, false, or undefined`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value.length === 3) {
|
||||||
|
const name = value[2];
|
||||||
|
|
||||||
|
if (name !== undefined && typeof name !== "string") {
|
||||||
|
throw new Error(`${msg(access(loc, 2))} must be a string, or undefined`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
assertPluginTarget(loc, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertPluginTarget(loc, value) {
|
||||||
|
if ((typeof value !== "object" || !value) && typeof value !== "string" && typeof value !== "function") {
|
||||||
|
throw new Error(`${msg(loc)} must be a string, object, function`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
197
node_modules/@babel/core/lib/config/validation/options.js
generated
vendored
Normal file
197
node_modules/@babel/core/lib/config/validation/options.js
generated
vendored
Normal file
|
@ -0,0 +1,197 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.validate = validate;
|
||||||
|
exports.checkNoUnwrappedItemOptionPairs = checkNoUnwrappedItemOptionPairs;
|
||||||
|
|
||||||
|
var _plugin = _interopRequireDefault(require("../plugin"));
|
||||||
|
|
||||||
|
var _removed = _interopRequireDefault(require("./removed"));
|
||||||
|
|
||||||
|
var _optionAssertions = require("./option-assertions");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const ROOT_VALIDATORS = {
|
||||||
|
cwd: _optionAssertions.assertString,
|
||||||
|
root: _optionAssertions.assertString,
|
||||||
|
rootMode: _optionAssertions.assertRootMode,
|
||||||
|
configFile: _optionAssertions.assertConfigFileSearch,
|
||||||
|
caller: _optionAssertions.assertCallerMetadata,
|
||||||
|
filename: _optionAssertions.assertString,
|
||||||
|
filenameRelative: _optionAssertions.assertString,
|
||||||
|
code: _optionAssertions.assertBoolean,
|
||||||
|
ast: _optionAssertions.assertBoolean,
|
||||||
|
cloneInputAst: _optionAssertions.assertBoolean,
|
||||||
|
envName: _optionAssertions.assertString
|
||||||
|
};
|
||||||
|
const BABELRC_VALIDATORS = {
|
||||||
|
babelrc: _optionAssertions.assertBoolean,
|
||||||
|
babelrcRoots: _optionAssertions.assertBabelrcSearch
|
||||||
|
};
|
||||||
|
const NONPRESET_VALIDATORS = {
|
||||||
|
extends: _optionAssertions.assertString,
|
||||||
|
ignore: _optionAssertions.assertIgnoreList,
|
||||||
|
only: _optionAssertions.assertIgnoreList
|
||||||
|
};
|
||||||
|
const COMMON_VALIDATORS = {
|
||||||
|
inputSourceMap: _optionAssertions.assertInputSourceMap,
|
||||||
|
presets: _optionAssertions.assertPluginList,
|
||||||
|
plugins: _optionAssertions.assertPluginList,
|
||||||
|
passPerPreset: _optionAssertions.assertBoolean,
|
||||||
|
env: assertEnvSet,
|
||||||
|
overrides: assertOverridesList,
|
||||||
|
test: _optionAssertions.assertConfigApplicableTest,
|
||||||
|
include: _optionAssertions.assertConfigApplicableTest,
|
||||||
|
exclude: _optionAssertions.assertConfigApplicableTest,
|
||||||
|
retainLines: _optionAssertions.assertBoolean,
|
||||||
|
comments: _optionAssertions.assertBoolean,
|
||||||
|
shouldPrintComment: _optionAssertions.assertFunction,
|
||||||
|
compact: _optionAssertions.assertCompact,
|
||||||
|
minified: _optionAssertions.assertBoolean,
|
||||||
|
auxiliaryCommentBefore: _optionAssertions.assertString,
|
||||||
|
auxiliaryCommentAfter: _optionAssertions.assertString,
|
||||||
|
sourceType: _optionAssertions.assertSourceType,
|
||||||
|
wrapPluginVisitorMethod: _optionAssertions.assertFunction,
|
||||||
|
highlightCode: _optionAssertions.assertBoolean,
|
||||||
|
sourceMaps: _optionAssertions.assertSourceMaps,
|
||||||
|
sourceMap: _optionAssertions.assertSourceMaps,
|
||||||
|
sourceFileName: _optionAssertions.assertString,
|
||||||
|
sourceRoot: _optionAssertions.assertString,
|
||||||
|
getModuleId: _optionAssertions.assertFunction,
|
||||||
|
moduleRoot: _optionAssertions.assertString,
|
||||||
|
moduleIds: _optionAssertions.assertBoolean,
|
||||||
|
moduleId: _optionAssertions.assertString,
|
||||||
|
parserOpts: _optionAssertions.assertObject,
|
||||||
|
generatorOpts: _optionAssertions.assertObject
|
||||||
|
};
|
||||||
|
|
||||||
|
function getSource(loc) {
|
||||||
|
return loc.type === "root" ? loc.source : getSource(loc.parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate(type, opts) {
|
||||||
|
return validateNested({
|
||||||
|
type: "root",
|
||||||
|
source: type
|
||||||
|
}, opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateNested(loc, opts) {
|
||||||
|
const type = getSource(loc);
|
||||||
|
assertNoDuplicateSourcemap(opts);
|
||||||
|
Object.keys(opts).forEach(key => {
|
||||||
|
const optLoc = {
|
||||||
|
type: "option",
|
||||||
|
name: key,
|
||||||
|
parent: loc
|
||||||
|
};
|
||||||
|
|
||||||
|
if (type === "preset" && NONPRESET_VALIDATORS[key]) {
|
||||||
|
throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in preset options`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type !== "arguments" && ROOT_VALIDATORS[key]) {
|
||||||
|
throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type !== "arguments" && type !== "configfile" && BABELRC_VALIDATORS[key]) {
|
||||||
|
if (type === "babelrcfile" || type === "extendsfile") {
|
||||||
|
throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in .babelrc or "extends"ed files, only in root programmatic options, ` + `or babel.config.js/config file options`);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options, or babel.config.js/config file options`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || BABELRC_VALIDATORS[key] || ROOT_VALIDATORS[key] || throwUnknownError;
|
||||||
|
validator(optLoc, opts[key]);
|
||||||
|
});
|
||||||
|
return opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
function throwUnknownError(loc) {
|
||||||
|
const key = loc.name;
|
||||||
|
|
||||||
|
if (_removed.default[key]) {
|
||||||
|
const {
|
||||||
|
message,
|
||||||
|
version = 5
|
||||||
|
} = _removed.default[key];
|
||||||
|
throw new Error(`Using removed Babel ${version} option: ${(0, _optionAssertions.msg)(loc)} - ${message}`);
|
||||||
|
} else {
|
||||||
|
const unknownOptErr = new Error(`Unknown option: ${(0, _optionAssertions.msg)(loc)}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`);
|
||||||
|
unknownOptErr.code = "BABEL_UNKNOWN_OPTION";
|
||||||
|
throw unknownOptErr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function has(obj, key) {
|
||||||
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertNoDuplicateSourcemap(opts) {
|
||||||
|
if (has(opts, "sourceMap") && has(opts, "sourceMaps")) {
|
||||||
|
throw new Error(".sourceMap is an alias for .sourceMaps, cannot use both");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertEnvSet(loc, value) {
|
||||||
|
if (loc.parent.type === "env") {
|
||||||
|
throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside of another .env block`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const parent = loc.parent;
|
||||||
|
const obj = (0, _optionAssertions.assertObject)(loc, value);
|
||||||
|
|
||||||
|
if (obj) {
|
||||||
|
for (const envName of Object.keys(obj)) {
|
||||||
|
const env = (0, _optionAssertions.assertObject)((0, _optionAssertions.access)(loc, envName), obj[envName]);
|
||||||
|
if (!env) continue;
|
||||||
|
const envLoc = {
|
||||||
|
type: "env",
|
||||||
|
name: envName,
|
||||||
|
parent
|
||||||
|
};
|
||||||
|
validateNested(envLoc, env);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertOverridesList(loc, value) {
|
||||||
|
if (loc.parent.type === "env") {
|
||||||
|
throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .env block`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loc.parent.type === "overrides") {
|
||||||
|
throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .overrides block`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const parent = loc.parent;
|
||||||
|
const arr = (0, _optionAssertions.assertArray)(loc, value);
|
||||||
|
|
||||||
|
if (arr) {
|
||||||
|
for (const [index, item] of arr.entries()) {
|
||||||
|
const objLoc = (0, _optionAssertions.access)(loc, index);
|
||||||
|
const env = (0, _optionAssertions.assertObject)(objLoc, item);
|
||||||
|
if (!env) throw new Error(`${(0, _optionAssertions.msg)(objLoc)} must be an object`);
|
||||||
|
const overridesLoc = {
|
||||||
|
type: "overrides",
|
||||||
|
index,
|
||||||
|
parent
|
||||||
|
};
|
||||||
|
validateNested(overridesLoc, env);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkNoUnwrappedItemOptionPairs(lastItem, thisItem, type, index, e) {
|
||||||
|
if (lastItem.file && lastItem.options === undefined && typeof thisItem.value === "object") {
|
||||||
|
e.message += `\n- Maybe you meant to use\n` + `"${type}": [\n ["${lastItem.file.request}", ${JSON.stringify(thisItem.value, undefined, 2)}]\n]\n` + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;
|
||||||
|
}
|
||||||
|
}
|
71
node_modules/@babel/core/lib/config/validation/plugins.js
generated
vendored
Normal file
71
node_modules/@babel/core/lib/config/validation/plugins.js
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.validatePluginObject = validatePluginObject;
|
||||||
|
|
||||||
|
var _optionAssertions = require("./option-assertions");
|
||||||
|
|
||||||
|
const VALIDATORS = {
|
||||||
|
name: _optionAssertions.assertString,
|
||||||
|
manipulateOptions: _optionAssertions.assertFunction,
|
||||||
|
pre: _optionAssertions.assertFunction,
|
||||||
|
post: _optionAssertions.assertFunction,
|
||||||
|
inherits: _optionAssertions.assertFunction,
|
||||||
|
visitor: assertVisitorMap,
|
||||||
|
parserOverride: _optionAssertions.assertFunction,
|
||||||
|
generatorOverride: _optionAssertions.assertFunction
|
||||||
|
};
|
||||||
|
|
||||||
|
function assertVisitorMap(loc, value) {
|
||||||
|
const obj = (0, _optionAssertions.assertObject)(loc, value);
|
||||||
|
|
||||||
|
if (obj) {
|
||||||
|
Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop]));
|
||||||
|
|
||||||
|
if (obj.enter || obj.exit) {
|
||||||
|
throw new Error(`${(0, _optionAssertions.msg)(loc)} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
function assertVisitorHandler(key, value) {
|
||||||
|
if (value && typeof value === "object") {
|
||||||
|
Object.keys(value).forEach(handler => {
|
||||||
|
if (handler !== "enter" && handler !== "exit") {
|
||||||
|
throw new Error(`.visitor["${key}"] may only have .enter and/or .exit handlers.`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (typeof value !== "function") {
|
||||||
|
throw new Error(`.visitor["${key}"] must be a function`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function validatePluginObject(obj) {
|
||||||
|
const rootPath = {
|
||||||
|
type: "root",
|
||||||
|
source: "plugin"
|
||||||
|
};
|
||||||
|
Object.keys(obj).forEach(key => {
|
||||||
|
const validator = VALIDATORS[key];
|
||||||
|
|
||||||
|
if (validator) {
|
||||||
|
const optLoc = {
|
||||||
|
type: "option",
|
||||||
|
name: key,
|
||||||
|
parent: rootPath
|
||||||
|
};
|
||||||
|
validator(optLoc, obj[key]);
|
||||||
|
} else {
|
||||||
|
const invalidPluginPropertyError = new Error(`.${key} is not a valid Plugin property`);
|
||||||
|
invalidPluginPropertyError.code = "BABEL_UNKNOWN_PLUGIN_PROPERTY";
|
||||||
|
throw invalidPluginPropertyError;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return obj;
|
||||||
|
}
|
66
node_modules/@babel/core/lib/config/validation/removed.js
generated
vendored
Normal file
66
node_modules/@babel/core/lib/config/validation/removed.js
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
var _default = {
|
||||||
|
auxiliaryComment: {
|
||||||
|
message: "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
|
||||||
|
},
|
||||||
|
blacklist: {
|
||||||
|
message: "Put the specific transforms you want in the `plugins` option"
|
||||||
|
},
|
||||||
|
breakConfig: {
|
||||||
|
message: "This is not a necessary option in Babel 6"
|
||||||
|
},
|
||||||
|
experimental: {
|
||||||
|
message: "Put the specific transforms you want in the `plugins` option"
|
||||||
|
},
|
||||||
|
externalHelpers: {
|
||||||
|
message: "Use the `external-helpers` plugin instead. " + "Check out http://babeljs.io/docs/plugins/external-helpers/"
|
||||||
|
},
|
||||||
|
extra: {
|
||||||
|
message: ""
|
||||||
|
},
|
||||||
|
jsxPragma: {
|
||||||
|
message: "use the `pragma` option in the `react-jsx` plugin. " + "Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
|
||||||
|
},
|
||||||
|
loose: {
|
||||||
|
message: "Specify the `loose` option for the relevant plugin you are using " + "or use a preset that sets the option."
|
||||||
|
},
|
||||||
|
metadataUsedHelpers: {
|
||||||
|
message: "Not required anymore as this is enabled by default"
|
||||||
|
},
|
||||||
|
modules: {
|
||||||
|
message: "Use the corresponding module transform plugin in the `plugins` option. " + "Check out http://babeljs.io/docs/plugins/#modules"
|
||||||
|
},
|
||||||
|
nonStandard: {
|
||||||
|
message: "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. " + "Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
|
||||||
|
},
|
||||||
|
optional: {
|
||||||
|
message: "Put the specific transforms you want in the `plugins` option"
|
||||||
|
},
|
||||||
|
sourceMapName: {
|
||||||
|
message: "The `sourceMapName` option has been removed because it makes more sense for the " + "tooling that calls Babel to assign `map.file` themselves."
|
||||||
|
},
|
||||||
|
stage: {
|
||||||
|
message: "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
|
||||||
|
},
|
||||||
|
whitelist: {
|
||||||
|
message: "Put the specific transforms you want in the `plugins` option"
|
||||||
|
},
|
||||||
|
resolveModuleSource: {
|
||||||
|
version: 6,
|
||||||
|
message: "Use `babel-plugin-module-resolver@3`'s 'resolvePath' options"
|
||||||
|
},
|
||||||
|
metadata: {
|
||||||
|
version: 6,
|
||||||
|
message: "Generated plugin metadata is always included in the output result"
|
||||||
|
},
|
||||||
|
sourceMapTarget: {
|
||||||
|
version: 6,
|
||||||
|
message: "The `sourceMapTarget` option has been removed because it makes more sense for the tooling " + "that calls Babel to assign `map.file` themselves."
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports.default = _default;
|
89
node_modules/@babel/core/lib/gensync-utils/async.js
generated
vendored
Normal file
89
node_modules/@babel/core/lib/gensync-utils/async.js
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.maybeAsync = maybeAsync;
|
||||||
|
exports.forwardAsync = forwardAsync;
|
||||||
|
exports.isThenable = isThenable;
|
||||||
|
exports.waitFor = exports.onFirstPause = exports.isAsync = void 0;
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const id = x => x;
|
||||||
|
|
||||||
|
const runGenerator = (0, _gensync().default)(function* (item) {
|
||||||
|
return yield* item;
|
||||||
|
});
|
||||||
|
const isAsync = (0, _gensync().default)({
|
||||||
|
sync: () => false,
|
||||||
|
errback: cb => cb(null, true)
|
||||||
|
});
|
||||||
|
exports.isAsync = isAsync;
|
||||||
|
|
||||||
|
function maybeAsync(fn, message) {
|
||||||
|
return (0, _gensync().default)({
|
||||||
|
sync(...args) {
|
||||||
|
const result = fn.apply(this, args);
|
||||||
|
if (isThenable(result)) throw new Error(message);
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
async(...args) {
|
||||||
|
return Promise.resolve(fn.apply(this, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const withKind = (0, _gensync().default)({
|
||||||
|
sync: cb => cb("sync"),
|
||||||
|
async: cb => cb("async")
|
||||||
|
});
|
||||||
|
|
||||||
|
function forwardAsync(action, cb) {
|
||||||
|
const g = (0, _gensync().default)(action);
|
||||||
|
return withKind(kind => {
|
||||||
|
const adapted = g[kind];
|
||||||
|
return cb(adapted);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const onFirstPause = (0, _gensync().default)({
|
||||||
|
name: "onFirstPause",
|
||||||
|
arity: 2,
|
||||||
|
sync: function (item) {
|
||||||
|
return runGenerator.sync(item);
|
||||||
|
},
|
||||||
|
errback: function (item, firstPause, cb) {
|
||||||
|
let completed = false;
|
||||||
|
runGenerator.errback(item, (err, value) => {
|
||||||
|
completed = true;
|
||||||
|
cb(err, value);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!completed) {
|
||||||
|
firstPause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
exports.onFirstPause = onFirstPause;
|
||||||
|
const waitFor = (0, _gensync().default)({
|
||||||
|
sync: id,
|
||||||
|
async: id
|
||||||
|
});
|
||||||
|
exports.waitFor = waitFor;
|
||||||
|
|
||||||
|
function isThenable(val) {
|
||||||
|
return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function";
|
||||||
|
}
|
53
node_modules/@babel/core/lib/gensync-utils/fs.js
generated
vendored
Normal file
53
node_modules/@babel/core/lib/gensync-utils/fs.js
generated
vendored
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.stat = exports.exists = exports.readFile = void 0;
|
||||||
|
|
||||||
|
function _fs() {
|
||||||
|
const data = _interopRequireDefault(require("fs"));
|
||||||
|
|
||||||
|
_fs = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const readFile = (0, _gensync().default)({
|
||||||
|
sync: _fs().default.readFileSync,
|
||||||
|
errback: _fs().default.readFile
|
||||||
|
});
|
||||||
|
exports.readFile = readFile;
|
||||||
|
const exists = (0, _gensync().default)({
|
||||||
|
sync(path) {
|
||||||
|
try {
|
||||||
|
_fs().default.accessSync(path);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (_unused) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
errback: (path, cb) => _fs().default.access(path, undefined, err => cb(null, !err))
|
||||||
|
});
|
||||||
|
exports.exists = exists;
|
||||||
|
const stat = (0, _gensync().default)({
|
||||||
|
sync: _fs().default.statSync,
|
||||||
|
errback: _fs().default.stat
|
||||||
|
});
|
||||||
|
exports.stat = stat;
|
35
node_modules/@babel/core/lib/gensync-utils/resolve.js
generated
vendored
Normal file
35
node_modules/@babel/core/lib/gensync-utils/resolve.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
|
||||||
|
function _resolve() {
|
||||||
|
const data = _interopRequireDefault(require("resolve"));
|
||||||
|
|
||||||
|
_resolve = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
var _default = (0, _gensync().default)({
|
||||||
|
sync: _resolve().default.sync,
|
||||||
|
errback: _resolve().default
|
||||||
|
});
|
||||||
|
|
||||||
|
exports.default = _default;
|
266
node_modules/@babel/core/lib/index.js
generated
vendored
Normal file
266
node_modules/@babel/core/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,266 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.Plugin = Plugin;
|
||||||
|
Object.defineProperty(exports, "File", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _file.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "buildExternalHelpers", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _buildExternalHelpers.default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "resolvePlugin", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _files.resolvePlugin;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "resolvePreset", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _files.resolvePreset;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "version", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _package.version;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "getEnv", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _environment.getEnv;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "tokTypes", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _parser().tokTypes;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "traverse", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _traverse().default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "template", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _template().default;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "createConfigItem", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _item.createConfigItem;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadPartialConfig", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _config.loadPartialConfig;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadPartialConfigSync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _config.loadPartialConfigSync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadPartialConfigAsync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _config.loadPartialConfigAsync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadOptions", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _config.loadOptions;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadOptionsSync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _config.loadOptionsSync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "loadOptionsAsync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _config.loadOptionsAsync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "transform", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _transform.transform;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "transformSync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _transform.transformSync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "transformAsync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _transform.transformAsync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "transformFile", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _transformFile.transformFile;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "transformFileSync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _transformFile.transformFileSync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "transformFileAsync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _transformFile.transformFileAsync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "transformFromAst", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _transformAst.transformFromAst;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "transformFromAstSync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _transformAst.transformFromAstSync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "transformFromAstAsync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _transformAst.transformFromAstAsync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "parse", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _parse.parse;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "parseSync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _parse.parseSync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Object.defineProperty(exports, "parseAsync", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _parse.parseAsync;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
exports.types = exports.OptionManager = exports.DEFAULT_EXTENSIONS = void 0;
|
||||||
|
|
||||||
|
var _file = _interopRequireDefault(require("./transformation/file/file"));
|
||||||
|
|
||||||
|
var _buildExternalHelpers = _interopRequireDefault(require("./tools/build-external-helpers"));
|
||||||
|
|
||||||
|
var _files = require("./config/files");
|
||||||
|
|
||||||
|
var _package = require("../package.json");
|
||||||
|
|
||||||
|
var _environment = require("./config/helpers/environment");
|
||||||
|
|
||||||
|
function _types() {
|
||||||
|
const data = _interopRequireWildcard(require("@babel/types"));
|
||||||
|
|
||||||
|
_types = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "types", {
|
||||||
|
enumerable: true,
|
||||||
|
get: function () {
|
||||||
|
return _types();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function _parser() {
|
||||||
|
const data = require("@babel/parser");
|
||||||
|
|
||||||
|
_parser = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _traverse() {
|
||||||
|
const data = _interopRequireDefault(require("@babel/traverse"));
|
||||||
|
|
||||||
|
_traverse = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _template() {
|
||||||
|
const data = _interopRequireDefault(require("@babel/template"));
|
||||||
|
|
||||||
|
_template = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _item = require("./config/item");
|
||||||
|
|
||||||
|
var _config = require("./config");
|
||||||
|
|
||||||
|
var _transform = require("./transform");
|
||||||
|
|
||||||
|
var _transformFile = require("./transform-file");
|
||||||
|
|
||||||
|
var _transformAst = require("./transform-ast");
|
||||||
|
|
||||||
|
var _parse = require("./parse");
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs"]);
|
||||||
|
exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS;
|
||||||
|
|
||||||
|
class OptionManager {
|
||||||
|
init(opts) {
|
||||||
|
return (0, _config.loadOptions)(opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.OptionManager = OptionManager;
|
||||||
|
|
||||||
|
function Plugin(alias) {
|
||||||
|
throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`);
|
||||||
|
}
|
50
node_modules/@babel/core/lib/parse.js
generated
vendored
Normal file
50
node_modules/@babel/core/lib/parse.js
generated
vendored
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.parseAsync = exports.parseSync = exports.parse = void 0;
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _config = _interopRequireDefault(require("./config"));
|
||||||
|
|
||||||
|
var _parser = _interopRequireDefault(require("./parser"));
|
||||||
|
|
||||||
|
var _normalizeOpts = _interopRequireDefault(require("./transformation/normalize-opts"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const parseRunner = (0, _gensync().default)(function* parse(code, opts) {
|
||||||
|
const config = yield* (0, _config.default)(opts);
|
||||||
|
|
||||||
|
if (config === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return yield* (0, _parser.default)(config.passes, (0, _normalizeOpts.default)(config), code);
|
||||||
|
});
|
||||||
|
|
||||||
|
const parse = function parse(code, opts, callback) {
|
||||||
|
if (typeof opts === "function") {
|
||||||
|
callback = opts;
|
||||||
|
opts = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback === undefined) return parseRunner.sync(code, opts);
|
||||||
|
parseRunner.errback(code, opts, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.parse = parse;
|
||||||
|
const parseSync = parseRunner.sync;
|
||||||
|
exports.parseSync = parseSync;
|
||||||
|
const parseAsync = parseRunner.async;
|
||||||
|
exports.parseAsync = parseAsync;
|
97
node_modules/@babel/core/lib/parser/index.js
generated
vendored
Normal file
97
node_modules/@babel/core/lib/parser/index.js
generated
vendored
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = parser;
|
||||||
|
|
||||||
|
function _parser() {
|
||||||
|
const data = require("@babel/parser");
|
||||||
|
|
||||||
|
_parser = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _codeFrame() {
|
||||||
|
const data = require("@babel/code-frame");
|
||||||
|
|
||||||
|
_codeFrame = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _missingPluginHelper = _interopRequireDefault(require("./util/missing-plugin-helper"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function* parser(pluginPasses, {
|
||||||
|
parserOpts,
|
||||||
|
highlightCode = true,
|
||||||
|
filename = "unknown"
|
||||||
|
}, code) {
|
||||||
|
try {
|
||||||
|
const results = [];
|
||||||
|
|
||||||
|
for (const plugins of pluginPasses) {
|
||||||
|
for (const plugin of plugins) {
|
||||||
|
const {
|
||||||
|
parserOverride
|
||||||
|
} = plugin;
|
||||||
|
|
||||||
|
if (parserOverride) {
|
||||||
|
const ast = parserOverride(code, parserOpts, _parser().parse);
|
||||||
|
if (ast !== undefined) results.push(ast);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results.length === 0) {
|
||||||
|
return (0, _parser().parse)(code, parserOpts);
|
||||||
|
} else if (results.length === 1) {
|
||||||
|
yield* [];
|
||||||
|
|
||||||
|
if (typeof results[0].then === "function") {
|
||||||
|
throw new Error(`You appear to be using an async parser plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return results[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error("More than one plugin attempted to override parsing.");
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") {
|
||||||
|
err.message += "\nConsider renaming the file to '.mjs', or setting sourceType:module " + "or sourceType:unambiguous in your Babel config for this file.";
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
loc,
|
||||||
|
missingPlugin
|
||||||
|
} = err;
|
||||||
|
|
||||||
|
if (loc) {
|
||||||
|
const codeFrame = (0, _codeFrame().codeFrameColumns)(code, {
|
||||||
|
start: {
|
||||||
|
line: loc.line,
|
||||||
|
column: loc.column + 1
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
highlightCode
|
||||||
|
});
|
||||||
|
|
||||||
|
if (missingPlugin) {
|
||||||
|
err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame);
|
||||||
|
} else {
|
||||||
|
err.message = `${filename}: ${err.message}\n\n` + codeFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
err.code = "BABEL_PARSE_ERROR";
|
||||||
|
}
|
||||||
|
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
291
node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js
generated
vendored
Normal file
291
node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js
generated
vendored
Normal file
|
@ -0,0 +1,291 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = generateMissingPluginMessage;
|
||||||
|
const pluginNameMap = {
|
||||||
|
classProperties: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-class-properties",
|
||||||
|
url: "https://git.io/vb4yQ"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-class-properties",
|
||||||
|
url: "https://git.io/vb4SL"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
classPrivateProperties: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-class-properties",
|
||||||
|
url: "https://git.io/vb4yQ"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-class-properties",
|
||||||
|
url: "https://git.io/vb4SL"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
classPrivateMethods: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-class-properties",
|
||||||
|
url: "https://git.io/vb4yQ"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-private-methods",
|
||||||
|
url: "https://git.io/JvpRG"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
decimal: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-decimal",
|
||||||
|
url: "https://git.io/JfKOH"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
decorators: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-decorators",
|
||||||
|
url: "https://git.io/vb4y9"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-decorators",
|
||||||
|
url: "https://git.io/vb4ST"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
doExpressions: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-do-expressions",
|
||||||
|
url: "https://git.io/vb4yh"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-do-expressions",
|
||||||
|
url: "https://git.io/vb4S3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dynamicImport: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-dynamic-import",
|
||||||
|
url: "https://git.io/vb4Sv"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
exportDefaultFrom: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-export-default-from",
|
||||||
|
url: "https://git.io/vb4SO"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-export-default-from",
|
||||||
|
url: "https://git.io/vb4yH"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
exportNamespaceFrom: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-export-namespace-from",
|
||||||
|
url: "https://git.io/vb4Sf"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-export-namespace-from",
|
||||||
|
url: "https://git.io/vb4SG"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
flow: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-flow",
|
||||||
|
url: "https://git.io/vb4yb"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/preset-flow",
|
||||||
|
url: "https://git.io/JfeDn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
functionBind: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-function-bind",
|
||||||
|
url: "https://git.io/vb4y7"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-function-bind",
|
||||||
|
url: "https://git.io/vb4St"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
functionSent: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-function-sent",
|
||||||
|
url: "https://git.io/vb4yN"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-function-sent",
|
||||||
|
url: "https://git.io/vb4SZ"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
importMeta: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-import-meta",
|
||||||
|
url: "https://git.io/vbKK6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
jsx: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-jsx",
|
||||||
|
url: "https://git.io/vb4yA"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/preset-react",
|
||||||
|
url: "https://git.io/JfeDR"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
moduleAttributes: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-module-attributes",
|
||||||
|
url: "https://git.io/JfK3k"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
numericSeparator: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-numeric-separator",
|
||||||
|
url: "https://git.io/vb4Sq"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-numeric-separator",
|
||||||
|
url: "https://git.io/vb4yS"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
optionalChaining: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-optional-chaining",
|
||||||
|
url: "https://git.io/vb4Sc"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-optional-chaining",
|
||||||
|
url: "https://git.io/vb4Sk"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pipelineOperator: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-pipeline-operator",
|
||||||
|
url: "https://git.io/vb4yj"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-pipeline-operator",
|
||||||
|
url: "https://git.io/vb4SU"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
privateIn: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-private-property-in-object",
|
||||||
|
url: "https://git.io/JfK3q"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-private-property-in-object",
|
||||||
|
url: "https://git.io/JfK3O"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
recordAndTuple: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-record-and-tuple",
|
||||||
|
url: "https://git.io/JvKp3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
throwExpressions: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-throw-expressions",
|
||||||
|
url: "https://git.io/vb4SJ"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-throw-expressions",
|
||||||
|
url: "https://git.io/vb4yF"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
typescript: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-typescript",
|
||||||
|
url: "https://git.io/vb4SC"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/preset-typescript",
|
||||||
|
url: "https://git.io/JfeDz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
asyncGenerators: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-async-generators",
|
||||||
|
url: "https://git.io/vb4SY"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-async-generator-functions",
|
||||||
|
url: "https://git.io/vb4yp"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
logicalAssignment: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-logical-assignment-operators",
|
||||||
|
url: "https://git.io/vAlBp"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-logical-assignment-operators",
|
||||||
|
url: "https://git.io/vAlRe"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nullishCoalescingOperator: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-nullish-coalescing-operator",
|
||||||
|
url: "https://git.io/vb4yx"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-nullish-coalescing-operator",
|
||||||
|
url: "https://git.io/vb4Se"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
objectRestSpread: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-object-rest-spread",
|
||||||
|
url: "https://git.io/vb4y5"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-object-rest-spread",
|
||||||
|
url: "https://git.io/vb4Ss"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
optionalCatchBinding: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-optional-catch-binding",
|
||||||
|
url: "https://git.io/vb4Sn"
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-optional-catch-binding",
|
||||||
|
url: "https://git.io/vb4SI"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
pluginNameMap.privateIn.syntax = pluginNameMap.privateIn.transform;
|
||||||
|
|
||||||
|
const getNameURLCombination = ({
|
||||||
|
name,
|
||||||
|
url
|
||||||
|
}) => `${name} (${url})`;
|
||||||
|
|
||||||
|
function generateMissingPluginMessage(missingPluginName, loc, codeFrame) {
|
||||||
|
let helpMessage = `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` + `(${loc.line}:${loc.column + 1}):\n\n` + codeFrame;
|
||||||
|
const pluginInfo = pluginNameMap[missingPluginName];
|
||||||
|
|
||||||
|
if (pluginInfo) {
|
||||||
|
const {
|
||||||
|
syntax: syntaxPlugin,
|
||||||
|
transform: transformPlugin
|
||||||
|
} = pluginInfo;
|
||||||
|
|
||||||
|
if (syntaxPlugin) {
|
||||||
|
const syntaxPluginInfo = getNameURLCombination(syntaxPlugin);
|
||||||
|
|
||||||
|
if (transformPlugin) {
|
||||||
|
const transformPluginInfo = getNameURLCombination(transformPlugin);
|
||||||
|
const sectionType = transformPlugin.name.startsWith("@babel/plugin") ? "plugins" : "presets";
|
||||||
|
helpMessage += `\n\nAdd ${transformPluginInfo} to the '${sectionType}' section of your Babel config to enable transformation.
|
||||||
|
If you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section to enable parsing.`;
|
||||||
|
} else {
|
||||||
|
helpMessage += `\n\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` + `to enable parsing.`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return helpMessage;
|
||||||
|
}
|
148
node_modules/@babel/core/lib/tools/build-external-helpers.js
generated
vendored
Normal file
148
node_modules/@babel/core/lib/tools/build-external-helpers.js
generated
vendored
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = _default;
|
||||||
|
|
||||||
|
function helpers() {
|
||||||
|
const data = _interopRequireWildcard(require("@babel/helpers"));
|
||||||
|
|
||||||
|
helpers = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _generator() {
|
||||||
|
const data = _interopRequireDefault(require("@babel/generator"));
|
||||||
|
|
||||||
|
_generator = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _template() {
|
||||||
|
const data = _interopRequireDefault(require("@babel/template"));
|
||||||
|
|
||||||
|
_template = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function t() {
|
||||||
|
const data = _interopRequireWildcard(require("@babel/types"));
|
||||||
|
|
||||||
|
t = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _file = _interopRequireDefault(require("../transformation/file/file"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
const buildUmdWrapper = replacements => (0, _template().default)`
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof define === "function" && define.amd) {
|
||||||
|
define(AMD_ARGUMENTS, factory);
|
||||||
|
} else if (typeof exports === "object") {
|
||||||
|
factory(COMMON_ARGUMENTS);
|
||||||
|
} else {
|
||||||
|
factory(BROWSER_ARGUMENTS);
|
||||||
|
}
|
||||||
|
})(UMD_ROOT, function (FACTORY_PARAMETERS) {
|
||||||
|
FACTORY_BODY
|
||||||
|
});
|
||||||
|
`(replacements);
|
||||||
|
|
||||||
|
function buildGlobal(allowlist) {
|
||||||
|
const namespace = t().identifier("babelHelpers");
|
||||||
|
const body = [];
|
||||||
|
const container = t().functionExpression(null, [t().identifier("global")], t().blockStatement(body));
|
||||||
|
const tree = t().program([t().expressionStatement(t().callExpression(container, [t().conditionalExpression(t().binaryExpression("===", t().unaryExpression("typeof", t().identifier("global")), t().stringLiteral("undefined")), t().identifier("self"), t().identifier("global"))]))]);
|
||||||
|
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().assignmentExpression("=", t().memberExpression(t().identifier("global"), namespace), t().objectExpression([])))]));
|
||||||
|
buildHelpers(body, namespace, allowlist);
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildModule(allowlist) {
|
||||||
|
const body = [];
|
||||||
|
const refs = buildHelpers(body, null, allowlist);
|
||||||
|
body.unshift(t().exportNamedDeclaration(null, Object.keys(refs).map(name => {
|
||||||
|
return t().exportSpecifier(t().cloneNode(refs[name]), t().identifier(name));
|
||||||
|
})));
|
||||||
|
return t().program(body, [], "module");
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildUmd(allowlist) {
|
||||||
|
const namespace = t().identifier("babelHelpers");
|
||||||
|
const body = [];
|
||||||
|
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().identifier("global"))]));
|
||||||
|
buildHelpers(body, namespace, allowlist);
|
||||||
|
return t().program([buildUmdWrapper({
|
||||||
|
FACTORY_PARAMETERS: t().identifier("global"),
|
||||||
|
BROWSER_ARGUMENTS: t().assignmentExpression("=", t().memberExpression(t().identifier("root"), namespace), t().objectExpression([])),
|
||||||
|
COMMON_ARGUMENTS: t().identifier("exports"),
|
||||||
|
AMD_ARGUMENTS: t().arrayExpression([t().stringLiteral("exports")]),
|
||||||
|
FACTORY_BODY: body,
|
||||||
|
UMD_ROOT: t().identifier("this")
|
||||||
|
})]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildVar(allowlist) {
|
||||||
|
const namespace = t().identifier("babelHelpers");
|
||||||
|
const body = [];
|
||||||
|
body.push(t().variableDeclaration("var", [t().variableDeclarator(namespace, t().objectExpression([]))]));
|
||||||
|
const tree = t().program(body);
|
||||||
|
buildHelpers(body, namespace, allowlist);
|
||||||
|
body.push(t().expressionStatement(namespace));
|
||||||
|
return tree;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildHelpers(body, namespace, allowlist) {
|
||||||
|
const getHelperReference = name => {
|
||||||
|
return namespace ? t().memberExpression(namespace, t().identifier(name)) : t().identifier(`_${name}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const refs = {};
|
||||||
|
helpers().list.forEach(function (name) {
|
||||||
|
if (allowlist && allowlist.indexOf(name) < 0) return;
|
||||||
|
const ref = refs[name] = getHelperReference(name);
|
||||||
|
helpers().ensure(name, _file.default);
|
||||||
|
const {
|
||||||
|
nodes
|
||||||
|
} = helpers().get(name, getHelperReference, ref);
|
||||||
|
body.push(...nodes);
|
||||||
|
});
|
||||||
|
return refs;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _default(allowlist, outputType = "global") {
|
||||||
|
let tree;
|
||||||
|
const build = {
|
||||||
|
global: buildGlobal,
|
||||||
|
module: buildModule,
|
||||||
|
umd: buildUmd,
|
||||||
|
var: buildVar
|
||||||
|
}[outputType];
|
||||||
|
|
||||||
|
if (build) {
|
||||||
|
tree = build(allowlist);
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unsupported output type ${outputType}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (0, _generator().default)(tree).code;
|
||||||
|
}
|
48
node_modules/@babel/core/lib/transform-ast.js
generated
vendored
Normal file
48
node_modules/@babel/core/lib/transform-ast.js
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.transformFromAstAsync = exports.transformFromAstSync = exports.transformFromAst = void 0;
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _config = _interopRequireDefault(require("./config"));
|
||||||
|
|
||||||
|
var _transformation = require("./transformation");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const transformFromAstRunner = (0, _gensync().default)(function* (ast, code, opts) {
|
||||||
|
const config = yield* (0, _config.default)(opts);
|
||||||
|
if (config === null) return null;
|
||||||
|
if (!ast) throw new Error("No AST given");
|
||||||
|
return yield* (0, _transformation.run)(config, code, ast);
|
||||||
|
});
|
||||||
|
|
||||||
|
const transformFromAst = function transformFromAst(ast, code, opts, callback) {
|
||||||
|
if (typeof opts === "function") {
|
||||||
|
callback = opts;
|
||||||
|
opts = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback === undefined) {
|
||||||
|
return transformFromAstRunner.sync(ast, code, opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
transformFromAstRunner.errback(ast, code, opts, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.transformFromAst = transformFromAst;
|
||||||
|
const transformFromAstSync = transformFromAstRunner.sync;
|
||||||
|
exports.transformFromAstSync = transformFromAstSync;
|
||||||
|
const transformFromAstAsync = transformFromAstRunner.async;
|
||||||
|
exports.transformFromAstAsync = transformFromAstAsync;
|
26
node_modules/@babel/core/lib/transform-file-browser.js
generated
vendored
Normal file
26
node_modules/@babel/core/lib/transform-file-browser.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.transformFileSync = transformFileSync;
|
||||||
|
exports.transformFileAsync = transformFileAsync;
|
||||||
|
exports.transformFile = void 0;
|
||||||
|
|
||||||
|
const transformFile = function transformFile(filename, opts, callback) {
|
||||||
|
if (typeof opts === "function") {
|
||||||
|
callback = opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
callback(new Error("Transforming files is not supported in browsers"), null);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.transformFile = transformFile;
|
||||||
|
|
||||||
|
function transformFileSync() {
|
||||||
|
throw new Error("Transforming files is not supported in browsers");
|
||||||
|
}
|
||||||
|
|
||||||
|
function transformFileAsync() {
|
||||||
|
return Promise.reject(new Error("Transforming files is not supported in browsers"));
|
||||||
|
}
|
45
node_modules/@babel/core/lib/transform-file.js
generated
vendored
Normal file
45
node_modules/@babel/core/lib/transform-file.js
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.transformFileAsync = exports.transformFileSync = exports.transformFile = void 0;
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _config = _interopRequireDefault(require("./config"));
|
||||||
|
|
||||||
|
var _transformation = require("./transformation");
|
||||||
|
|
||||||
|
var fs = _interopRequireWildcard(require("./gensync-utils/fs"));
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
({});
|
||||||
|
const transformFileRunner = (0, _gensync().default)(function* (filename, opts) {
|
||||||
|
const options = Object.assign({}, opts, {
|
||||||
|
filename
|
||||||
|
});
|
||||||
|
const config = yield* (0, _config.default)(options);
|
||||||
|
if (config === null) return null;
|
||||||
|
const code = yield* fs.readFile(filename, "utf8");
|
||||||
|
return yield* (0, _transformation.run)(config, code);
|
||||||
|
});
|
||||||
|
const transformFile = transformFileRunner.errback;
|
||||||
|
exports.transformFile = transformFile;
|
||||||
|
const transformFileSync = transformFileRunner.sync;
|
||||||
|
exports.transformFileSync = transformFileSync;
|
||||||
|
const transformFileAsync = transformFileRunner.async;
|
||||||
|
exports.transformFileAsync = transformFileAsync;
|
44
node_modules/@babel/core/lib/transform.js
generated
vendored
Normal file
44
node_modules/@babel/core/lib/transform.js
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.transformAsync = exports.transformSync = exports.transform = void 0;
|
||||||
|
|
||||||
|
function _gensync() {
|
||||||
|
const data = _interopRequireDefault(require("gensync"));
|
||||||
|
|
||||||
|
_gensync = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _config = _interopRequireDefault(require("./config"));
|
||||||
|
|
||||||
|
var _transformation = require("./transformation");
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
const transformRunner = (0, _gensync().default)(function* transform(code, opts) {
|
||||||
|
const config = yield* (0, _config.default)(opts);
|
||||||
|
if (config === null) return null;
|
||||||
|
return yield* (0, _transformation.run)(config, code);
|
||||||
|
});
|
||||||
|
|
||||||
|
const transform = function transform(code, opts, callback) {
|
||||||
|
if (typeof opts === "function") {
|
||||||
|
callback = opts;
|
||||||
|
opts = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback === undefined) return transformRunner.sync(code, opts);
|
||||||
|
transformRunner.errback(code, opts, callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.transform = transform;
|
||||||
|
const transformSync = transformRunner.sync;
|
||||||
|
exports.transformSync = transformSync;
|
||||||
|
const transformAsync = transformRunner.async;
|
||||||
|
exports.transformAsync = transformAsync;
|
68
node_modules/@babel/core/lib/transformation/block-hoist-plugin.js
generated
vendored
Normal file
68
node_modules/@babel/core/lib/transformation/block-hoist-plugin.js
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = loadBlockHoistPlugin;
|
||||||
|
|
||||||
|
function _sortBy() {
|
||||||
|
const data = _interopRequireDefault(require("lodash/sortBy"));
|
||||||
|
|
||||||
|
_sortBy = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _config = _interopRequireDefault(require("../config"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
let LOADED_PLUGIN;
|
||||||
|
|
||||||
|
function loadBlockHoistPlugin() {
|
||||||
|
if (!LOADED_PLUGIN) {
|
||||||
|
const config = _config.default.sync({
|
||||||
|
babelrc: false,
|
||||||
|
configFile: false,
|
||||||
|
plugins: [blockHoistPlugin]
|
||||||
|
});
|
||||||
|
|
||||||
|
LOADED_PLUGIN = config ? config.passes[0][0] : undefined;
|
||||||
|
if (!LOADED_PLUGIN) throw new Error("Assertion failure");
|
||||||
|
}
|
||||||
|
|
||||||
|
return LOADED_PLUGIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
const blockHoistPlugin = {
|
||||||
|
name: "internal.blockHoist",
|
||||||
|
visitor: {
|
||||||
|
Block: {
|
||||||
|
exit({
|
||||||
|
node
|
||||||
|
}) {
|
||||||
|
let hasChange = false;
|
||||||
|
|
||||||
|
for (let i = 0; i < node.body.length; i++) {
|
||||||
|
const bodyNode = node.body[i];
|
||||||
|
|
||||||
|
if ((bodyNode == null ? void 0 : bodyNode._blockHoist) != null) {
|
||||||
|
hasChange = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasChange) return;
|
||||||
|
node.body = (0, _sortBy().default)(node.body, function (bodyNode) {
|
||||||
|
let priority = bodyNode == null ? void 0 : bodyNode._blockHoist;
|
||||||
|
if (priority == null) priority = 1;
|
||||||
|
if (priority === true) priority = 2;
|
||||||
|
return -1 * priority;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
253
node_modules/@babel/core/lib/transformation/file/file.js
generated
vendored
Normal file
253
node_modules/@babel/core/lib/transformation/file/file.js
generated
vendored
Normal file
|
@ -0,0 +1,253 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = void 0;
|
||||||
|
|
||||||
|
function helpers() {
|
||||||
|
const data = _interopRequireWildcard(require("@babel/helpers"));
|
||||||
|
|
||||||
|
helpers = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _traverse() {
|
||||||
|
const data = _interopRequireWildcard(require("@babel/traverse"));
|
||||||
|
|
||||||
|
_traverse = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _codeFrame() {
|
||||||
|
const data = require("@babel/code-frame");
|
||||||
|
|
||||||
|
_codeFrame = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function t() {
|
||||||
|
const data = _interopRequireWildcard(require("@babel/types"));
|
||||||
|
|
||||||
|
t = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _helperModuleTransforms() {
|
||||||
|
const data = require("@babel/helper-module-transforms");
|
||||||
|
|
||||||
|
_helperModuleTransforms = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _semver() {
|
||||||
|
const data = _interopRequireDefault(require("semver"));
|
||||||
|
|
||||||
|
_semver = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
||||||
|
|
||||||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||||
|
|
||||||
|
const errorVisitor = {
|
||||||
|
enter(path, state) {
|
||||||
|
const loc = path.node.loc;
|
||||||
|
|
||||||
|
if (loc) {
|
||||||
|
state.loc = loc;
|
||||||
|
path.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class File {
|
||||||
|
constructor(options, {
|
||||||
|
code,
|
||||||
|
ast,
|
||||||
|
inputMap
|
||||||
|
}) {
|
||||||
|
this._map = new Map();
|
||||||
|
this.declarations = {};
|
||||||
|
this.path = null;
|
||||||
|
this.ast = {};
|
||||||
|
this.metadata = {};
|
||||||
|
this.code = "";
|
||||||
|
this.inputMap = null;
|
||||||
|
this.hub = {
|
||||||
|
file: this,
|
||||||
|
getCode: () => this.code,
|
||||||
|
getScope: () => this.scope,
|
||||||
|
addHelper: this.addHelper.bind(this),
|
||||||
|
buildError: this.buildCodeFrameError.bind(this)
|
||||||
|
};
|
||||||
|
this.opts = options;
|
||||||
|
this.code = code;
|
||||||
|
this.ast = ast;
|
||||||
|
this.inputMap = inputMap;
|
||||||
|
this.path = _traverse().NodePath.get({
|
||||||
|
hub: this.hub,
|
||||||
|
parentPath: null,
|
||||||
|
parent: this.ast,
|
||||||
|
container: this.ast,
|
||||||
|
key: "program"
|
||||||
|
}).setContext();
|
||||||
|
this.scope = this.path.scope;
|
||||||
|
}
|
||||||
|
|
||||||
|
get shebang() {
|
||||||
|
const {
|
||||||
|
interpreter
|
||||||
|
} = this.path.node;
|
||||||
|
return interpreter ? interpreter.value : "";
|
||||||
|
}
|
||||||
|
|
||||||
|
set shebang(value) {
|
||||||
|
if (value) {
|
||||||
|
this.path.get("interpreter").replaceWith(t().interpreterDirective(value));
|
||||||
|
} else {
|
||||||
|
this.path.get("interpreter").remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
set(key, val) {
|
||||||
|
if (key === "helpersNamespace") {
|
||||||
|
throw new Error("Babel 7.0.0-beta.56 has dropped support for the 'helpersNamespace' utility." + "If you are using @babel/plugin-external-helpers you will need to use a newer " + "version than the one you currently have installed. " + "If you have your own implementation, you'll want to explore using 'helperGenerator' " + "alongside 'file.availableHelper()'.");
|
||||||
|
}
|
||||||
|
|
||||||
|
this._map.set(key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
get(key) {
|
||||||
|
return this._map.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
has(key) {
|
||||||
|
return this._map.has(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
getModuleName() {
|
||||||
|
return (0, _helperModuleTransforms().getModuleName)(this.opts, this.opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
addImport() {
|
||||||
|
throw new Error("This API has been removed. If you're looking for this " + "functionality in Babel 7, you should import the " + "'@babel/helper-module-imports' module and use the functions exposed " + " from that module, such as 'addNamed' or 'addDefault'.");
|
||||||
|
}
|
||||||
|
|
||||||
|
availableHelper(name, versionRange) {
|
||||||
|
let minVersion;
|
||||||
|
|
||||||
|
try {
|
||||||
|
minVersion = helpers().minVersion(name);
|
||||||
|
} catch (err) {
|
||||||
|
if (err.code !== "BABEL_HELPER_UNKNOWN") throw err;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof versionRange !== "string") return true;
|
||||||
|
if (_semver().default.valid(versionRange)) versionRange = `^${versionRange}`;
|
||||||
|
return !_semver().default.intersects(`<${minVersion}`, versionRange) && !_semver().default.intersects(`>=8.0.0`, versionRange);
|
||||||
|
}
|
||||||
|
|
||||||
|
addHelper(name) {
|
||||||
|
const declar = this.declarations[name];
|
||||||
|
if (declar) return t().cloneNode(declar);
|
||||||
|
const generator = this.get("helperGenerator");
|
||||||
|
|
||||||
|
if (generator) {
|
||||||
|
const res = generator(name);
|
||||||
|
if (res) return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
helpers().ensure(name, File);
|
||||||
|
const uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
|
||||||
|
const dependencies = {};
|
||||||
|
|
||||||
|
for (const dep of helpers().getDependencies(name)) {
|
||||||
|
dependencies[dep] = this.addHelper(dep);
|
||||||
|
}
|
||||||
|
|
||||||
|
const {
|
||||||
|
nodes,
|
||||||
|
globals
|
||||||
|
} = helpers().get(name, dep => dependencies[dep], uid, Object.keys(this.scope.getAllBindings()));
|
||||||
|
globals.forEach(name => {
|
||||||
|
if (this.path.scope.hasBinding(name, true)) {
|
||||||
|
this.path.scope.rename(name);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
nodes.forEach(node => {
|
||||||
|
node._compact = true;
|
||||||
|
});
|
||||||
|
this.path.unshiftContainer("body", nodes);
|
||||||
|
this.path.get("body").forEach(path => {
|
||||||
|
if (nodes.indexOf(path.node) === -1) return;
|
||||||
|
if (path.isVariableDeclaration()) this.scope.registerDeclaration(path);
|
||||||
|
});
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
addTemplateObject() {
|
||||||
|
throw new Error("This function has been moved into the template literal transform itself.");
|
||||||
|
}
|
||||||
|
|
||||||
|
buildCodeFrameError(node, msg, Error = SyntaxError) {
|
||||||
|
let loc = node && (node.loc || node._loc);
|
||||||
|
|
||||||
|
if (!loc && node) {
|
||||||
|
const state = {
|
||||||
|
loc: null
|
||||||
|
};
|
||||||
|
(0, _traverse().default)(node, errorVisitor, this.scope, state);
|
||||||
|
loc = state.loc;
|
||||||
|
let txt = "This is an error on an internal node. Probably an internal error.";
|
||||||
|
if (loc) txt += " Location has been estimated.";
|
||||||
|
msg += ` (${txt})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (loc) {
|
||||||
|
const {
|
||||||
|
highlightCode = true
|
||||||
|
} = this.opts;
|
||||||
|
msg += "\n" + (0, _codeFrame().codeFrameColumns)(this.code, {
|
||||||
|
start: {
|
||||||
|
line: loc.start.line,
|
||||||
|
column: loc.start.column + 1
|
||||||
|
},
|
||||||
|
end: loc.end && loc.start.line === loc.end.line ? {
|
||||||
|
line: loc.end.line,
|
||||||
|
column: loc.end.column + 1
|
||||||
|
} : undefined
|
||||||
|
}, {
|
||||||
|
highlightCode
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Error(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = File;
|
89
node_modules/@babel/core/lib/transformation/file/generate.js
generated
vendored
Normal file
89
node_modules/@babel/core/lib/transformation/file/generate.js
generated
vendored
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = generateCode;
|
||||||
|
|
||||||
|
function _convertSourceMap() {
|
||||||
|
const data = _interopRequireDefault(require("convert-source-map"));
|
||||||
|
|
||||||
|
_convertSourceMap = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _generator() {
|
||||||
|
const data = _interopRequireDefault(require("@babel/generator"));
|
||||||
|
|
||||||
|
_generator = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _mergeMap = _interopRequireDefault(require("./merge-map"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function generateCode(pluginPasses, file) {
|
||||||
|
const {
|
||||||
|
opts,
|
||||||
|
ast,
|
||||||
|
code,
|
||||||
|
inputMap
|
||||||
|
} = file;
|
||||||
|
const results = [];
|
||||||
|
|
||||||
|
for (const plugins of pluginPasses) {
|
||||||
|
for (const plugin of plugins) {
|
||||||
|
const {
|
||||||
|
generatorOverride
|
||||||
|
} = plugin;
|
||||||
|
|
||||||
|
if (generatorOverride) {
|
||||||
|
const result = generatorOverride(ast, opts.generatorOpts, code, _generator().default);
|
||||||
|
if (result !== undefined) results.push(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let result;
|
||||||
|
|
||||||
|
if (results.length === 0) {
|
||||||
|
result = (0, _generator().default)(ast, opts.generatorOpts, code);
|
||||||
|
} else if (results.length === 1) {
|
||||||
|
result = results[0];
|
||||||
|
|
||||||
|
if (typeof result.then === "function") {
|
||||||
|
throw new Error(`You appear to be using an async codegen plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new Error("More than one plugin attempted to override codegen.");
|
||||||
|
}
|
||||||
|
|
||||||
|
let {
|
||||||
|
code: outputCode,
|
||||||
|
map: outputMap
|
||||||
|
} = result;
|
||||||
|
|
||||||
|
if (outputMap && inputMap) {
|
||||||
|
outputMap = (0, _mergeMap.default)(inputMap.toObject(), outputMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
|
||||||
|
outputCode += "\n" + _convertSourceMap().default.fromObject(outputMap).toComment();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (opts.sourceMaps === "inline") {
|
||||||
|
outputMap = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
outputCode,
|
||||||
|
outputMap
|
||||||
|
};
|
||||||
|
}
|
247
node_modules/@babel/core/lib/transformation/file/merge-map.js
generated
vendored
Normal file
247
node_modules/@babel/core/lib/transformation/file/merge-map.js
generated
vendored
Normal file
|
@ -0,0 +1,247 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.default = mergeSourceMap;
|
||||||
|
|
||||||
|
function _sourceMap() {
|
||||||
|
const data = _interopRequireDefault(require("source-map"));
|
||||||
|
|
||||||
|
_sourceMap = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function mergeSourceMap(inputMap, map) {
|
||||||
|
const input = buildMappingData(inputMap);
|
||||||
|
const output = buildMappingData(map);
|
||||||
|
const mergedGenerator = new (_sourceMap().default.SourceMapGenerator)();
|
||||||
|
|
||||||
|
for (const {
|
||||||
|
source
|
||||||
|
} of input.sources) {
|
||||||
|
if (typeof source.content === "string") {
|
||||||
|
mergedGenerator.setSourceContent(source.path, source.content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output.sources.length === 1) {
|
||||||
|
const defaultSource = output.sources[0];
|
||||||
|
const insertedMappings = new Map();
|
||||||
|
eachInputGeneratedRange(input, (generated, original, source) => {
|
||||||
|
eachOverlappingGeneratedOutputRange(defaultSource, generated, item => {
|
||||||
|
const key = makeMappingKey(item);
|
||||||
|
if (insertedMappings.has(key)) return;
|
||||||
|
insertedMappings.set(key, item);
|
||||||
|
mergedGenerator.addMapping({
|
||||||
|
source: source.path,
|
||||||
|
original: {
|
||||||
|
line: original.line,
|
||||||
|
column: original.columnStart
|
||||||
|
},
|
||||||
|
generated: {
|
||||||
|
line: item.line,
|
||||||
|
column: item.columnStart
|
||||||
|
},
|
||||||
|
name: original.name
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
for (const item of insertedMappings.values()) {
|
||||||
|
if (item.columnEnd === Infinity) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const clearItem = {
|
||||||
|
line: item.line,
|
||||||
|
columnStart: item.columnEnd
|
||||||
|
};
|
||||||
|
const key = makeMappingKey(clearItem);
|
||||||
|
|
||||||
|
if (insertedMappings.has(key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
mergedGenerator.addMapping({
|
||||||
|
generated: {
|
||||||
|
line: clearItem.line,
|
||||||
|
column: clearItem.columnStart
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = mergedGenerator.toJSON();
|
||||||
|
|
||||||
|
if (typeof input.sourceRoot === "string") {
|
||||||
|
result.sourceRoot = input.sourceRoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeMappingKey(item) {
|
||||||
|
return `${item.line}/${item.columnStart}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function eachOverlappingGeneratedOutputRange(outputFile, inputGeneratedRange, callback) {
|
||||||
|
const overlappingOriginal = filterApplicableOriginalRanges(outputFile, inputGeneratedRange);
|
||||||
|
|
||||||
|
for (const {
|
||||||
|
generated
|
||||||
|
} of overlappingOriginal) {
|
||||||
|
for (const item of generated) {
|
||||||
|
callback(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterApplicableOriginalRanges({
|
||||||
|
mappings
|
||||||
|
}, {
|
||||||
|
line,
|
||||||
|
columnStart,
|
||||||
|
columnEnd
|
||||||
|
}) {
|
||||||
|
return filterSortedArray(mappings, ({
|
||||||
|
original: outOriginal
|
||||||
|
}) => {
|
||||||
|
if (line > outOriginal.line) return -1;
|
||||||
|
if (line < outOriginal.line) return 1;
|
||||||
|
if (columnStart >= outOriginal.columnEnd) return -1;
|
||||||
|
if (columnEnd <= outOriginal.columnStart) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function eachInputGeneratedRange(map, callback) {
|
||||||
|
for (const {
|
||||||
|
source,
|
||||||
|
mappings
|
||||||
|
} of map.sources) {
|
||||||
|
for (const {
|
||||||
|
original,
|
||||||
|
generated
|
||||||
|
} of mappings) {
|
||||||
|
for (const item of generated) {
|
||||||
|
callback(item, original, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildMappingData(map) {
|
||||||
|
const consumer = new (_sourceMap().default.SourceMapConsumer)(Object.assign({}, map, {
|
||||||
|
sourceRoot: null
|
||||||
|
}));
|
||||||
|
const sources = new Map();
|
||||||
|
const mappings = new Map();
|
||||||
|
let last = null;
|
||||||
|
consumer.computeColumnSpans();
|
||||||
|
consumer.eachMapping(m => {
|
||||||
|
if (m.originalLine === null) return;
|
||||||
|
let source = sources.get(m.source);
|
||||||
|
|
||||||
|
if (!source) {
|
||||||
|
source = {
|
||||||
|
path: m.source,
|
||||||
|
content: consumer.sourceContentFor(m.source, true)
|
||||||
|
};
|
||||||
|
sources.set(m.source, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
let sourceData = mappings.get(source);
|
||||||
|
|
||||||
|
if (!sourceData) {
|
||||||
|
sourceData = {
|
||||||
|
source,
|
||||||
|
mappings: []
|
||||||
|
};
|
||||||
|
mappings.set(source, sourceData);
|
||||||
|
}
|
||||||
|
|
||||||
|
const obj = {
|
||||||
|
line: m.originalLine,
|
||||||
|
columnStart: m.originalColumn,
|
||||||
|
columnEnd: Infinity,
|
||||||
|
name: m.name
|
||||||
|
};
|
||||||
|
|
||||||
|
if (last && last.source === source && last.mapping.line === m.originalLine) {
|
||||||
|
last.mapping.columnEnd = m.originalColumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
last = {
|
||||||
|
source,
|
||||||
|
mapping: obj
|
||||||
|
};
|
||||||
|
sourceData.mappings.push({
|
||||||
|
original: obj,
|
||||||
|
generated: consumer.allGeneratedPositionsFor({
|
||||||
|
source: m.source,
|
||||||
|
line: m.originalLine,
|
||||||
|
column: m.originalColumn
|
||||||
|
}).map(item => ({
|
||||||
|
line: item.line,
|
||||||
|
columnStart: item.column,
|
||||||
|
columnEnd: item.lastColumn + 1
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
}, null, _sourceMap().default.SourceMapConsumer.ORIGINAL_ORDER);
|
||||||
|
return {
|
||||||
|
file: map.file,
|
||||||
|
sourceRoot: map.sourceRoot,
|
||||||
|
sources: Array.from(mappings.values())
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function findInsertionLocation(array, callback) {
|
||||||
|
let left = 0;
|
||||||
|
let right = array.length;
|
||||||
|
|
||||||
|
while (left < right) {
|
||||||
|
const mid = Math.floor((left + right) / 2);
|
||||||
|
const item = array[mid];
|
||||||
|
const result = callback(item);
|
||||||
|
|
||||||
|
if (result === 0) {
|
||||||
|
left = mid;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result >= 0) {
|
||||||
|
right = mid;
|
||||||
|
} else {
|
||||||
|
left = mid + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let i = left;
|
||||||
|
|
||||||
|
if (i < array.length) {
|
||||||
|
while (i >= 0 && callback(array[i]) >= 0) {
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterSortedArray(array, callback) {
|
||||||
|
const start = findInsertionLocation(array, callback);
|
||||||
|
const results = [];
|
||||||
|
|
||||||
|
for (let i = start; i < array.length && callback(array[i]) === 0; i++) {
|
||||||
|
results.push(array[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
}
|
126
node_modules/@babel/core/lib/transformation/index.js
generated
vendored
Normal file
126
node_modules/@babel/core/lib/transformation/index.js
generated
vendored
Normal file
|
@ -0,0 +1,126 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
value: true
|
||||||
|
});
|
||||||
|
exports.run = run;
|
||||||
|
|
||||||
|
function _traverse() {
|
||||||
|
const data = _interopRequireDefault(require("@babel/traverse"));
|
||||||
|
|
||||||
|
_traverse = function () {
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
var _pluginPass = _interopRequireDefault(require("./plugin-pass"));
|
||||||
|
|
||||||
|
var _blockHoistPlugin = _interopRequireDefault(require("./block-hoist-plugin"));
|
||||||
|
|
||||||
|
var _normalizeOpts = _interopRequireDefault(require("./normalize-opts"));
|
||||||
|
|
||||||
|
var _normalizeFile = _interopRequireDefault(require("./normalize-file"));
|
||||||
|
|
||||||
|
var _generate = _interopRequireDefault(require("./file/generate"));
|
||||||
|
|
||||||
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||||
|
|
||||||
|
function* run(config, code, ast) {
|
||||||
|
const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
|
||||||
|
const opts = file.opts;
|
||||||
|
|
||||||
|
try {
|
||||||
|
yield* transformFile(file, config.passes);
|
||||||
|
} catch (e) {
|
||||||
|
var _opts$filename;
|
||||||
|
|
||||||
|
e.message = `${(_opts$filename = opts.filename) != null ? _opts$filename : "unknown"}: ${e.message}`;
|
||||||
|
|
||||||
|
if (!e.code) {
|
||||||
|
e.code = "BABEL_TRANSFORM_ERROR";
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
let outputCode, outputMap;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (opts.code !== false) {
|
||||||
|
({
|
||||||
|
outputCode,
|
||||||
|
outputMap
|
||||||
|
} = (0, _generate.default)(config.passes, file));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
var _opts$filename2;
|
||||||
|
|
||||||
|
e.message = `${(_opts$filename2 = opts.filename) != null ? _opts$filename2 : "unknown"}: ${e.message}`;
|
||||||
|
|
||||||
|
if (!e.code) {
|
||||||
|
e.code = "BABEL_GENERATE_ERROR";
|
||||||
|
}
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
metadata: file.metadata,
|
||||||
|
options: opts,
|
||||||
|
ast: opts.ast === true ? file.ast : null,
|
||||||
|
code: outputCode === undefined ? null : outputCode,
|
||||||
|
map: outputMap === undefined ? null : outputMap,
|
||||||
|
sourceType: file.ast.program.sourceType
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function* transformFile(file, pluginPasses) {
|
||||||
|
for (const pluginPairs of pluginPasses) {
|
||||||
|
const passPairs = [];
|
||||||
|
const passes = [];
|
||||||
|
const visitors = [];
|
||||||
|
|
||||||
|
for (const plugin of pluginPairs.concat([(0, _blockHoistPlugin.default)()])) {
|
||||||
|
const pass = new _pluginPass.default(file, plugin.key, plugin.options);
|
||||||
|
passPairs.push([plugin, pass]);
|
||||||
|
passes.push(pass);
|
||||||
|
visitors.push(plugin.visitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const [plugin, pass] of passPairs) {
|
||||||
|
const fn = plugin.pre;
|
||||||
|
|
||||||
|
if (fn) {
|
||||||
|
const result = fn.call(pass, file);
|
||||||
|
yield* [];
|
||||||
|
|
||||||
|
if (isThenable(result)) {
|
||||||
|
throw new Error(`You appear to be using an plugin with an async .pre, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod);
|
||||||
|
|
||||||
|
(0, _traverse().default)(file.ast, visitor, file.scope);
|
||||||
|
|
||||||
|
for (const [plugin, pass] of passPairs) {
|
||||||
|
const fn = plugin.post;
|
||||||
|
|
||||||
|
if (fn) {
|
||||||
|
const result = fn.call(pass, file);
|
||||||
|
yield* [];
|
||||||
|
|
||||||
|
if (isThenable(result)) {
|
||||||
|
throw new Error(`You appear to be using an plugin with an async .post, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function isThenable(val) {
|
||||||
|
return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function";
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue