4 Commits

Author SHA1 Message Date
Drew Heavner
290e6a13bf Fixed #5 - Added input for providing the text of the service account json to authorize the action 2020-02-12 10:55:53 -05:00
Drew Heavner
ec56d49b16 Update README.md 2020-01-30 11:53:11 -05:00
Drew Heavner
0e110a8eed Updated release version to 1.0.3 2020-01-30 11:17:52 -05:00
Drew Heavner
bdde081050 Fixed #1 - Fixed the whatsnew-** script for loading release notes into builds
Added test to ensure that release notes are parsed properly
Updated to latest dependencies to fix security vulnerability
Updated GH Actions Workflow to run test before updating tag
Updated README.md to reflect proper whatsnew documentation.
2020-01-30 11:14:51 -05:00
2662 changed files with 251555 additions and 213194 deletions

View File

@@ -11,6 +11,9 @@ jobs:
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- name: Run Tests
run: npm run test
- name: Update v1 Tag - name: Update v1 Tag
uses: hole19/git-tag-action@master uses: hole19/git-tag-action@master
env: env:

View File

@@ -4,9 +4,15 @@ This action will help you upload an Android `.apk` or `.aab` (Android App Bundle
## Inputs ## Inputs
_You must provide one of either `serviceAccountJson` or `serviceAccountJsonPlainText`_
### `serviceAccountJson` ### `serviceAccountJson`
**Required:** The service account json private key file to authorize the upload request The service account json private key file to authorize the upload request
### `serviceAccountJsonPlainText`
The service account json in plain text, provided via a secret, etc.
### `packageName` ### `packageName`
@@ -28,8 +34,21 @@ Portion of users who should get the staged version of the app. Accepts values be
### `whatsNewDirectory` ### `whatsNewDirectory`
The directory of localized whats new files to upload as the release notes. Using the pattern `whatsnew-<LOCALE>` The directory of localized whats new files to upload as the release notes. The files contained in the `whatsNewDirectory` MUST use the pattern `whatsnew-<LOCALE>` where `LOCALE` is using the [`BCP 47`](https://tools.ietf.org/html/bcp47) format, e.g.
i.e. `whatsnew-en-US` * `en-US` - English/America
* `de-DE` - German/Germany
* `ja-JP` - Japanese/Japan
and contain plain `utf8` encoded text with no extension on the file. The resulting directory in your project should look something like this:
```
projectDir/
└── whatsNewDirectory/
├── whatsnew-en-US
├── whatsnew-de-DE
└── whatsnew-ja-JP
```
where `whatsNewDirectory` is the path you pass to the action.
### `mappingFile` ### `mappingFile`
@@ -47,4 +66,4 @@ with:
userFraction: 0.33 userFraction: 0.33
whatsNewDirectory: /distribution/whatsnew whatsNewDirectory: /distribution/whatsnew
mappingFile: /app/build/outputs/mapping/release/mapping.txt mappingFile: /app/build/outputs/mapping/release/mapping.txt
``` ```

View File

@@ -1,4 +0,0 @@
import * as process from 'process'
import * as cp from 'child_process'
import * as path from 'path'

1
__tests__/whatsnew-de-DE Normal file
View File

@@ -0,0 +1 @@
test_changelog_file_german

1
__tests__/whatsnew-en-US Normal file
View File

@@ -0,0 +1 @@
test_changelog_file

1
__tests__/whatsnew-ja-JP Normal file
View File

@@ -0,0 +1 @@
test_changelog_file_japanese

View File

@@ -0,0 +1,23 @@
import * as process from 'process'
import * as cp from 'child_process'
import * as path from 'path'
import {readLocalizedReleaseNotes} from "../src/whatsnew";
import {androidpublisher_v3} from "googleapis";
import LocalizedText = androidpublisher_v3.Schema$LocalizedText;
test("read localized whatsnew files", async () => {
let texts = await readLocalizedReleaseNotes("./__tests__");
expect(texts).toHaveLength(3);
expect(texts).toContainEqual({
language: "en-US",
text: "test_changelog_file"
});
expect(texts).toContainEqual({
language: "de-DE",
text: "test_changelog_file_german"
});
expect(texts).toContainEqual({
language: "ja-JP",
text: "test_changelog_file_japanese"
});
});

View File

@@ -7,7 +7,10 @@ branding:
inputs: inputs:
serviceAccountJson: serviceAccountJson:
description: 'The service account json private key file to authorize the upload request' description: 'The service account json private key file to authorize the upload request'
required: true required: false
serviceAccountJsonPlainText:
description: 'The raw json text of the service account private key to authorize the upload request'
required: false
packageName: packageName:
description: 'The package name, or Application Id, of the app you are uploading' description: 'The package name, or Application Id, of the app you are uploading'
required: true required: true

View File

@@ -1,9 +1,10 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 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) { return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 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 rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
@@ -19,6 +20,7 @@ const core = __importStar(require("@actions/core"));
const fs = __importStar(require("fs")); const fs = __importStar(require("fs"));
const fs_1 = require("fs"); const fs_1 = require("fs");
const googleapis_1 = require("googleapis"); const googleapis_1 = require("googleapis");
const whatsnew_1 = require("./whatsnew");
const androidPublisher = googleapis_1.google.androidpublisher('v3'); const androidPublisher = googleapis_1.google.androidpublisher('v3');
function uploadRelease(options, releaseFile) { function uploadRelease(options, releaseFile) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@@ -87,7 +89,7 @@ function trackVersionCode(appEdit, options, versionCode) {
{ {
userFraction: options.userFraction, userFraction: options.userFraction,
status: status, status: status,
releaseNotes: yield readLocalizedReleaseNotes(options.whatsNewDir), releaseNotes: yield whatsnew_1.readLocalizedReleaseNotes(options.whatsNewDir),
versionCodes: [ versionCodes: [
versionCode.toString() versionCode.toString()
] ]
@@ -98,31 +100,6 @@ function trackVersionCode(appEdit, options, versionCode) {
return res.data; return res.data;
}); });
} }
function readLocalizedReleaseNotes(whatsNewDir) {
return __awaiter(this, void 0, void 0, function* () {
if (whatsNewDir != undefined && whatsNewDir.length > 0) {
const releaseNotes = fs.readdirSync(whatsNewDir).filter(value => /whatsnew-*-*/.test(value));
const pattern = /whatsnew-(?<local>.*-.*)/.compile();
let localizedReleaseNotes = [];
releaseNotes.forEach(value => {
const matches = value.match(pattern);
if (matches != undefined && matches.length == 2) {
const lang = matches[1];
const content = fs_1.readFileSync(value, 'utf-8');
if (content != undefined) {
core.debug(`Found localized 'whatsnew-*-*' for Lang(${lang})`);
localizedReleaseNotes.push({
language: lang,
text: content
});
}
}
});
return localizedReleaseNotes;
}
return undefined;
});
}
function uploadMappingFile(appEdit, versionCode, options) { function uploadMappingFile(appEdit, versionCode, options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (options.mappingFile != undefined && options.mappingFile.length > 0) { if (options.mappingFile != undefined && options.mappingFile.length > 0) {

View File

@@ -1,9 +1,10 @@
"use strict"; "use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 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) { return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 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 rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
@@ -25,13 +26,32 @@ const auth = new google.auth.GoogleAuth({
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
const serviceAccountJson = core.getInput('serviceAccountJson', { required: true }); const serviceAccountJson = core.getInput('serviceAccountJson', { required: false });
const serviceAccountJsonRaw = core.getInput('serviceAccountJsonPlainText', { required: false });
const packageName = core.getInput('packageName', { required: true }); const packageName = core.getInput('packageName', { required: true });
const releaseFile = core.getInput('releaseFile', { required: true }); const releaseFile = core.getInput('releaseFile', { required: true });
const track = core.getInput('track', { required: true }); const track = core.getInput('track', { required: true });
const userFraction = core.getInput('userFraction', { required: false }); const userFraction = core.getInput('userFraction', { required: false });
const whatsNewDir = core.getInput('whatsNewDirectory', { required: false }); const whatsNewDir = core.getInput('whatsNewDirectory', { required: false });
const mappingFile = core.getInput('mappingFile', { required: false }); const mappingFile = core.getInput('mappingFile', { required: false });
if (!serviceAccountJson && !serviceAccountJsonRaw) {
console.log("No service account json key provided!");
core.setFailed("You must provide one of 'serviceAccountJson' or 'serviceAccountJsonPlainText' to use this action");
}
// If the user has provided the raw plain text via secrets, or w/e, then write to file and
// set appropriate env variable for the auth
if (serviceAccountJsonRaw) {
const serviceAccountFile = "./serviceAccountJson.json";
fs.writeFileSync(serviceAccountFile, serviceAccountJsonRaw, {
encoding: 'utf8'
});
// Insure that the api can find our service account credentials
core.exportVariable("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountFile);
}
if (serviceAccountJson) {
// Insure that the api can find our service account credentials
core.exportVariable("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountJson);
}
// verify inputs // verify inputs
let userFractionFloat = parseFloat(userFraction); let userFractionFloat = parseFloat(userFraction);
if (!isNaN(userFractionFloat)) { if (!isNaN(userFractionFloat)) {
@@ -56,8 +76,6 @@ function run() {
core.setFailed(`Unable to find 'mappingFile' @ ${mappingFile}`); core.setFailed(`Unable to find 'mappingFile' @ ${mappingFile}`);
return; return;
} }
// Insure that the api can find our service account credentials
core.exportVariable("GOOGLE_APPLICATION_CREDENTIALS", serviceAccountJson);
const authClient = yield auth.getClient(); const authClient = yield auth.getClient();
yield edits_1.uploadRelease({ yield edits_1.uploadRelease({
auth: authClient, auth: authClient,

52
lib/whatsnew.js Normal file
View File

@@ -0,0 +1,52 @@
"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 core = __importStar(require("@actions/core"));
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const fs_1 = require("fs");
function readLocalizedReleaseNotes(whatsNewDir) {
return __awaiter(this, void 0, void 0, function* () {
if (whatsNewDir != undefined && whatsNewDir.length > 0) {
const releaseNotes = fs.readdirSync(whatsNewDir)
.filter(value => /whatsnew-.*-.{2}\b/.test(value));
const pattern = /whatsnew-(?<local>.*-.*)/;
let localizedReleaseNotes = [];
core.debug(`Found files: ${releaseNotes}`);
releaseNotes.forEach(value => {
const matches = value.match(pattern);
core.debug(`Matches for ${value} = ${matches}`);
if (matches != undefined && matches.length == 2) {
const lang = matches[1];
const filePath = path.join(whatsNewDir, value);
const content = fs_1.readFileSync(filePath, 'utf-8');
if (content != undefined) {
core.debug(`Found localized 'whatsnew-*-*' for Lang(${lang})`);
localizedReleaseNotes.push({
language: lang,
text: content
});
}
}
});
return localizedReleaseNotes;
}
return undefined;
});
}
exports.readLocalizedReleaseNotes = readLocalizedReleaseNotes;

1
node_modules/.bin/handlebars generated vendored
View File

@@ -1 +0,0 @@
../handlebars/bin/handlebars

2
node_modules/.bin/semver generated vendored
View File

@@ -1 +1 @@
../semver/bin/semver.js ../semver/bin/semver

1
node_modules/.bin/uglifyjs generated vendored
View File

@@ -1 +0,0 @@
../uglify-js/bin/uglifyjs

View File

@@ -1,7 +0,0 @@
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.

109
node_modules/@actions/core/README.md generated vendored
View File

@@ -4,48 +4,55 @@
## Usage ## Usage
#### Inputs/Outputs ### Import the package
You can use this library to get inputs or set outputs: ```js
// javascript
```
const core = require('@actions/core'); const core = require('@actions/core');
const myInput = core.getInput('inputName', { required: true }); // typescript
import * as core from '@actions/core';
```
// Do stuff #### 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'); core.setOutput('outputKey', 'outputVal');
``` ```
#### Exporting variables/secrets #### Exporting variables
You can also export variables and secrets for future steps. Variables get set in the environment automatically, while secrets must be scoped into the environment from a workflow using `{{ secret.FOO }}`. Secrets will also be masked from the logs: Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
```
const core = require('@actions/core');
// Do stuff
```js
core.exportVariable('envVar', 'Val'); core.exportVariable('envVar', 'Val');
core.exportSecret('secretVar', variableWithSecretValue); ```
#### 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 #### PATH Manipulation
You can explicitly add items to the path for all remaining steps in a workflow: 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
const core = require('@actions/core'); core.addPath('/path/to/mytool');
core.addPath('pathToTool');
``` ```
#### Exit codes #### Exit codes
You should use this library to set the failing exit code for your action: 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'); const core = require('@actions/core');
try { try {
@@ -56,13 +63,15 @@ catch (err) {
core.setFailed(`Action failed with error ${err}`); core.setFailed(`Action failed with error ${err}`);
} }
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
``` ```
#### Logging #### Logging
Finally, this library provides some utilities for 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 core = require('@actions/core');
const myInput = core.getInput('input'); const myInput = core.getInput('input');
@@ -70,12 +79,62 @@ try {
core.debug('Inside try block'); core.debug('Inside try block');
if (!myInput) { if (!myInput) {
core.warning('myInput wasnt set'); core.warning('myInput was not set');
} }
// Do stuff // Do stuff
} }
catch (err) { catch (err) {
core.error('Error ${err}, action may still succeed though'); 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);
```

View File

@@ -5,12 +5,12 @@ interface CommandProperties {
* Commands * Commands
* *
* Command Format: * Command Format:
* ##[name key=value;key=value]message * ::name key=value,key=value::message
* *
* Examples: * Examples:
* ##[warning]This is the user warning message * ::warning::This is the message
* ##[set-secret name=mypassword]definatelyNotAPassword! * ::set-env name=MY_VAR::some value
*/ */
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void; export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
export declare function issue(name: string, message: string): void; export declare function issue(name: string, message?: string): void;
export {}; export {};

View File

@@ -1,26 +1,33 @@
"use strict"; "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 }); Object.defineProperty(exports, "__esModule", { value: true });
const os = require("os"); const os = __importStar(require("os"));
/** /**
* Commands * Commands
* *
* Command Format: * Command Format:
* ##[name key=value;key=value]message * ::name key=value,key=value::message
* *
* Examples: * Examples:
* ##[warning]This is the user warning message * ::warning::This is the message
* ##[set-secret name=mypassword]definatelyNotAPassword! * ::set-env name=MY_VAR::some value
*/ */
function issueCommand(command, properties, message) { function issueCommand(command, properties, message) {
const cmd = new Command(command, properties, message); const cmd = new Command(command, properties, message);
process.stdout.write(cmd.toString() + os.EOL); process.stdout.write(cmd.toString() + os.EOL);
} }
exports.issueCommand = issueCommand; exports.issueCommand = issueCommand;
function issue(name, message) { function issue(name, message = '') {
issueCommand(name, {}, message); issueCommand(name, {}, message);
} }
exports.issue = issue; exports.issue = issue;
const CMD_PREFIX = '##['; const CMD_STRING = '::';
class Command { class Command {
constructor(command, properties, message) { constructor(command, properties, message) {
if (!command) { if (!command) {
@@ -31,36 +38,41 @@ class Command {
this.message = message; this.message = message;
} }
toString() { toString() {
let cmdStr = CMD_PREFIX + this.command; let cmdStr = CMD_STRING + this.command;
if (this.properties && Object.keys(this.properties).length > 0) { if (this.properties && Object.keys(this.properties).length > 0) {
cmdStr += ' '; cmdStr += ' ';
let first = true;
for (const key in this.properties) { for (const key in this.properties) {
if (this.properties.hasOwnProperty(key)) { if (this.properties.hasOwnProperty(key)) {
const val = this.properties[key]; const val = this.properties[key];
if (val) { if (val) {
// safely append the val - avoid blowing up when attempting to if (first) {
// call .replace() if message is not a string for some reason first = false;
cmdStr += `${key}=${escape(`${val || ''}`)};`; }
else {
cmdStr += ',';
}
cmdStr += `${key}=${escapeProperty(val)}`;
} }
} }
} }
} }
cmdStr += ']'; cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
// safely append the message - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason
const message = `${this.message || ''}`;
cmdStr += escapeData(message);
return cmdStr; return cmdStr;
} }
} }
function escapeData(s) { function escapeData(s) {
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A'); return (s || '')
.replace(/%/g, '%25')
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A');
} }
function escape(s) { function escapeProperty(s) {
return s return (s || '')
.replace(/%/g, '%25')
.replace(/\r/g, '%0D') .replace(/\r/g, '%0D')
.replace(/\n/g, '%0A') .replace(/\n/g, '%0A')
.replace(/]/g, '%5D') .replace(/:/g, '%3A')
.replace(/;/g, '%3B'); .replace(/,/g, '%2C');
} }
//# sourceMappingURL=command.js.map //# sourceMappingURL=command.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,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,OAAe;IACjD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,KAAK,CAAA;AAExB,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,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,8DAA8D;wBAC9D,6DAA6D;wBAC7D,MAAM,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAA;qBAC9C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,CAAA;QAEb,kEAAkE;QAClE,6DAA6D;QAC7D,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,CAAA;QACvC,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,CAAA;QAE7B,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACtD,CAAC;AAED,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,CAAC;SACL,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"} {"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,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,CAAS;IAC3B,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;SACb,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,CAAS;IAC/B,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;SACb,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"}

View File

@@ -19,17 +19,16 @@ export declare enum ExitCode {
Failure = 1 Failure = 1
} }
/** /**
* sets env variable for this action and future actions in the job * Sets env variable for this action and future actions in the job
* @param name the name of the variable to set * @param name the name of the variable to set
* @param val the value of the variable * @param val the value of the variable
*/ */
export declare function exportVariable(name: string, val: string): void; export declare function exportVariable(name: string, val: string): void;
/** /**
* exports the variable and registers a secret which will get masked from logs * Registers a secret which will get masked from logs
* @param name the name of the variable to set * @param secret value of the secret
* @param val value of the secret
*/ */
export declare function exportSecret(name: string, val: string): void; export declare function setSecret(secret: string): void;
/** /**
* Prepends inputPath to the PATH (for this action and future actions) * Prepends inputPath to the PATH (for this action and future actions)
* @param inputPath * @param inputPath
@@ -71,3 +70,43 @@ export declare function error(message: string): void;
* @param message warning issue message * @param message warning issue message
*/ */
export declare function warning(message: string): void; export declare function warning(message: string): 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
*/
export declare function saveState(name: string, value: string): 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;

View File

@@ -1,7 +1,24 @@
"use strict"; "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 }); Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("./command"); const command_1 = require("./command");
const path = require("path"); const os = __importStar(require("os"));
const path = __importStar(require("path"));
/** /**
* The code to exit an action * The code to exit an action
*/ */
@@ -20,7 +37,7 @@ var ExitCode;
// Variables // Variables
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
/** /**
* sets env variable for this action and future actions in the job * Sets env variable for this action and future actions in the job
* @param name the name of the variable to set * @param name the name of the variable to set
* @param val the value of the variable * @param val the value of the variable
*/ */
@@ -30,15 +47,13 @@ function exportVariable(name, val) {
} }
exports.exportVariable = exportVariable; exports.exportVariable = exportVariable;
/** /**
* exports the variable and registers a secret which will get masked from logs * Registers a secret which will get masked from logs
* @param name the name of the variable to set * @param secret value of the secret
* @param val value of the secret
*/ */
function exportSecret(name, val) { function setSecret(secret) {
exportVariable(name, val); command_1.issueCommand('add-mask', {}, secret);
command_1.issueCommand('set-secret', {}, val);
} }
exports.exportSecret = exportSecret; exports.setSecret = setSecret;
/** /**
* Prepends inputPath to the PATH (for this action and future actions) * Prepends inputPath to the PATH (for this action and future actions)
* @param inputPath * @param inputPath
@@ -56,7 +71,7 @@ exports.addPath = addPath;
* @returns string * @returns string
*/ */
function getInput(name, options) { function getInput(name, options) {
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || ''; const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
if (options && options.required && !val) { if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`); throw new Error(`Input required and not supplied: ${name}`);
} }
@@ -113,4 +128,75 @@ function warning(message) {
command_1.issue('warning', message); command_1.issue('warning', message);
} }
exports.warning = warning; 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
*/
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 //# sourceMappingURL=core.js.map

View File

@@ -1 +1 @@
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;AAAA,uCAA6C;AAE7C,6BAA4B;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,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACzB,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC;AAHD,oCAGC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACpE,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,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;;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,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC"} {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAE7C,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,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;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,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;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,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;;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,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,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,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,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"}

View File

@@ -1,36 +1,34 @@
{ {
"_args": [ "_from": "@actions/core@1.2.2",
[ "_id": "@actions/core@1.2.2",
"@actions/core@1.0.0",
"/Users/drew.heavner/Documents/Github/upload-google-play"
]
],
"_from": "@actions/core@1.0.0",
"_id": "@actions/core@1.0.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-aMIlkx96XH4E/2YZtEOeyrYQfhlas9jIRkfGPqMwXD095Rdkzo4lB6ZmbxPQSzD+e1M+Xsm98ZhuSMYGv/AlqA==", "_integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg==",
"_location": "/@actions/core", "_location": "/@actions/core",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "version",
"registry": true, "registry": true,
"raw": "@actions/core@1.0.0", "raw": "@actions/core@1.2.2",
"name": "@actions/core", "name": "@actions/core",
"escapedName": "@actions%2fcore", "escapedName": "@actions%2fcore",
"scope": "@actions", "scope": "@actions",
"rawSpec": "1.0.0", "rawSpec": "1.2.2",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "1.0.0" "fetchSpec": "1.2.2"
}, },
"_requiredBy": [ "_requiredBy": [
"#USER",
"/" "/"
], ],
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.0.0.tgz", "_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
"_spec": "1.0.0", "_shasum": "3c4848d50378f9e3bcb67bcf97813382ec7369ee",
"_spec": "@actions/core@1.2.2",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play", "_where": "/Users/drew.heavner/Documents/Github/upload-google-play",
"bugs": { "bugs": {
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"
}, },
"bundleDependencies": false,
"deprecated": false,
"description": "Actions core lib", "description": "Actions core lib",
"devDependencies": { "devDependencies": {
"@types/node": "^12.0.2" "@types/node": "^12.0.2"
@@ -42,11 +40,11 @@
"files": [ "files": [
"lib" "lib"
], ],
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core", "homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
"keywords": [ "keywords": [
"core", "github",
"actions" "actions",
"core"
], ],
"license": "MIT", "license": "MIT",
"main": "lib/core.js", "main": "lib/core.js",
@@ -56,11 +54,14 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/actions/toolkit.git" "url": "git+https://github.com/actions/toolkit.git",
"directory": "packages/core"
}, },
"scripts": { "scripts": {
"audit-moderate": "npm install && npm audit --audit-level=moderate",
"test": "echo \"Error: run tests from root\" && exit 1", "test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc" "tsc": "tsc"
}, },
"version": "1.0.0" "types": "lib/core.d.ts",
"version": "1.2.2"
} }

View File

@@ -4,7 +4,7 @@
#### Basic #### Basic
You can use this package to execute your tools on the command line in a cross platform way: You can use this package to execute tools in a cross platform way:
```js ```js
const exec = require('@actions/exec'); const exec = require('@actions/exec');
@@ -48,13 +48,10 @@ await exec.exec('node', ['index.js', 'foo=bar'], options);
#### Exec tools not in the PATH #### 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: You can specify the full path for tools not in the PATH:
```js ```js
const exec = require('@actions/exec'); const exec = require('@actions/exec');
const io = require('@actions/io');
const pythonPath: string = await io.which('python', true) await exec.exec('"/path/to/my-tool"', ['arg1']);
await exec.exec(`"${pythonPath}"`, ['main.py']);
``` ```

View File

@@ -12,6 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
const os = require("os"); const os = require("os");
const events = require("events"); const events = require("events");
const child = require("child_process"); const child = require("child_process");
const path = require("path");
const io = require("@actions/io");
const ioUtil = require("@actions/io/lib/io-util");
/* eslint-disable @typescript-eslint/unbound-method */ /* eslint-disable @typescript-eslint/unbound-method */
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
/* /*
@@ -357,6 +360,16 @@ class ToolRunner extends events.EventEmitter {
*/ */
exec() { exec() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// root the tool path if it is unrooted and contains relative pathing
if (!ioUtil.isRooted(this.toolPath) &&
(this.toolPath.includes('/') ||
(IS_WINDOWS && this.toolPath.includes('\\')))) {
// prefer options.cwd if it is specified, however options.cwd may also need to be rooted
this.toolPath = path.resolve(process.cwd(), this.options.cwd || process.cwd(), this.toolPath);
}
// if the tool is only a file name, then resolve it from the PATH
// otherwise verify it exists (add extension on Windows if necessary)
this.toolPath = yield io.which(this.toolPath, true);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this._debug(`exec tool: ${this.toolPath}`); this._debug(`exec tool: ${this.toolPath}`);
this._debug('arguments:'); this._debug('arguments:');

File diff suppressed because one or more lines are too long

View File

@@ -1,38 +1,38 @@
{ {
"_from": "@actions/exec", "_from": "@actions/exec@1.0.3",
"_id": "@actions/exec@1.0.1", "_id": "@actions/exec@1.0.3",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ==", "_integrity": "sha512-TogJGnueOmM7ntCi0ASTUj4LapRRtDfj57Ja4IhPmg2fls28uVOPbAn8N+JifaOumN2UG3oEO/Ixek2A4NcYSA==",
"_location": "/@actions/exec", "_location": "/@actions/exec",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "tag", "type": "version",
"registry": true, "registry": true,
"raw": "@actions/exec", "raw": "@actions/exec@1.0.3",
"name": "@actions/exec", "name": "@actions/exec",
"escapedName": "@actions%2fexec", "escapedName": "@actions%2fexec",
"scope": "@actions", "scope": "@actions",
"rawSpec": "", "rawSpec": "1.0.3",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "latest" "fetchSpec": "1.0.3"
}, },
"_requiredBy": [ "_requiredBy": [
"#USER", "#USER",
"/" "/"
], ],
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.1.tgz", "_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.3.tgz",
"_shasum": "1624b541165697e7008d7c87bc1f69f191263c6c", "_shasum": "b967f8700d6ff011dcc91243b58bafc1bb9ab95f",
"_spec": "@actions/exec", "_spec": "@actions/exec@1.0.3",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play", "_where": "/Users/drew.heavner/Documents/Github/upload-google-play",
"bugs": { "bugs": {
"url": "https://github.com/actions/toolkit/issues" "url": "https://github.com/actions/toolkit/issues"
}, },
"bundleDependencies": false, "bundleDependencies": false,
"deprecated": false, "dependencies": {
"description": "Actions exec lib",
"devDependencies": {
"@actions/io": "^1.0.1" "@actions/io": "^1.0.1"
}, },
"deprecated": false,
"description": "Actions exec lib",
"directories": { "directories": {
"lib": "lib", "lib": "lib",
"test": "__tests__" "test": "__tests__"
@@ -40,7 +40,6 @@
"files": [ "files": [
"lib" "lib"
], ],
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec", "homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
"keywords": [ "keywords": [
"github", "github",
@@ -55,11 +54,14 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/actions/toolkit.git" "url": "git+https://github.com/actions/toolkit.git",
"directory": "packages/exec"
}, },
"scripts": { "scripts": {
"audit-moderate": "npm install && npm audit --audit-level=moderate",
"test": "echo \"Error: run tests from root\" && exit 1", "test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc" "tsc": "tsc"
}, },
"version": "1.0.1" "types": "lib/exec.d.ts",
"version": "1.0.3"
} }

53
node_modules/@actions/io/README.md generated vendored Normal file
View 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
View 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
View 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
View 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
View 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
View 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

File diff suppressed because one or more lines are too long

63
node_modules/@actions/io/package.json generated vendored Normal file
View File

@@ -0,0 +1,63 @@
{
"_from": "@actions/io@^1.0.1",
"_id": "@actions/io@1.0.2",
"_inBundle": false,
"_integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg==",
"_location": "/@actions/io",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@actions/io@^1.0.1",
"name": "@actions/io",
"escapedName": "@actions%2fio",
"scope": "@actions",
"rawSpec": "^1.0.1",
"saveSpec": null,
"fetchSpec": "^1.0.1"
},
"_requiredBy": [
"/@actions/exec"
],
"_resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz",
"_shasum": "2f614b6e69ce14d191180451eb38e6576a6e6b27",
"_spec": "@actions/io@^1.0.1",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/@actions/exec",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Actions io lib",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
],
"homepage": "https://github.com/actions/toolkit/tree/master/packages/io",
"keywords": [
"github",
"actions",
"io"
],
"license": "MIT",
"main": "lib/io.js",
"name": "@actions/io",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/actions/toolkit.git",
"directory": "packages/io"
},
"scripts": {
"audit-moderate": "npm install && npm audit --audit-level=moderate",
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"types": "lib/io.d.ts",
"version": "1.0.2"
}

View File

@@ -6,17 +6,11 @@ Object.defineProperty(exports, "__esModule", {
exports.codeFrameColumns = codeFrameColumns; exports.codeFrameColumns = codeFrameColumns;
exports.default = _default; exports.default = _default;
function _highlight() { var _highlight = _interopRequireWildcard(require("@babel/highlight"));
const data = _interopRequireWildcard(require("@babel/highlight"));
_highlight = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
let deprecationWarningShown = false; let deprecationWarningShown = false;
@@ -35,7 +29,7 @@ function getMarkerLines(loc, source, opts) {
column: 0, column: 0,
line: -1 line: -1
}, loc.start); }, loc.start);
const endLoc = Object.assign({}, startLoc, loc.end); const endLoc = Object.assign({}, startLoc, {}, loc.end);
const { const {
linesAbove = 2, linesAbove = 2,
linesBelow = 3 linesBelow = 3
@@ -94,8 +88,8 @@ function getMarkerLines(loc, source, opts) {
} }
function codeFrameColumns(rawLines, loc, opts = {}) { function codeFrameColumns(rawLines, loc, opts = {}) {
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts); const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
const chalk = (0, _highlight().getChalk)(opts); const chalk = (0, _highlight.getChalk)(opts);
const defs = getDefs(chalk); const defs = getDefs(chalk);
const maybeHighlight = (chalkFn, string) => { const maybeHighlight = (chalkFn, string) => {
@@ -110,7 +104,7 @@ function codeFrameColumns(rawLines, loc, opts = {}) {
} = getMarkerLines(loc, lines, opts); } = getMarkerLines(loc, lines, opts);
const hasColumns = loc.start && typeof loc.start.column === "number"; const hasColumns = loc.start && typeof loc.start.column === "number";
const numberMaxWidth = String(end).length; const numberMaxWidth = String(end).length;
const highlightedLines = highlighted ? (0, _highlight().default)(rawLines, opts) : rawLines; const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => { let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
const number = start + 1 + index; const number = start + 1 + index;
const paddedNumber = ` ${number}`.slice(-numberMaxWidth); const paddedNumber = ` ${number}`.slice(-numberMaxWidth);

View File

@@ -1,27 +1,20 @@
{ {
"_args": [ "_from": "@babel/code-frame@^7.0.0",
[ "_id": "@babel/code-frame@7.8.3",
"@babel/code-frame@7.5.5",
"/Users/drew.heavner/Documents/Github/upload-google-play"
]
],
"_development": true,
"_from": "@babel/code-frame@7.5.5",
"_id": "@babel/code-frame@7.5.5",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", "_integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
"_location": "/@babel/code-frame", "_location": "/@babel/code-frame",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "range",
"registry": true, "registry": true,
"raw": "@babel/code-frame@7.5.5", "raw": "@babel/code-frame@^7.0.0",
"name": "@babel/code-frame", "name": "@babel/code-frame",
"escapedName": "@babel%2fcode-frame", "escapedName": "@babel%2fcode-frame",
"scope": "@babel", "scope": "@babel",
"rawSpec": "7.5.5", "rawSpec": "^7.0.0",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "7.5.5" "fetchSpec": "^7.0.0"
}, },
"_requiredBy": [ "_requiredBy": [
"/@babel/core", "/@babel/core",
@@ -29,22 +22,25 @@
"/@babel/traverse", "/@babel/traverse",
"/jest-message-util" "/jest-message-util"
], ],
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", "_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz",
"_spec": "7.5.5", "_shasum": "33e25903d7481181534e12ec0a25f16b6fcf419e",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play", "_spec": "@babel/code-frame@^7.0.0",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/jest-message-util",
"author": { "author": {
"name": "Sebastian McKenzie", "name": "Sebastian McKenzie",
"email": "sebmck@gmail.com" "email": "sebmck@gmail.com"
}, },
"bundleDependencies": false,
"dependencies": { "dependencies": {
"@babel/highlight": "^7.0.0" "@babel/highlight": "^7.8.3"
}, },
"deprecated": false,
"description": "Generate errors that contain a code frame that point to source locations.", "description": "Generate errors that contain a code frame that point to source locations.",
"devDependencies": { "devDependencies": {
"chalk": "^2.0.0", "chalk": "^2.0.0",
"strip-ansi": "^4.0.0" "strip-ansi": "^4.0.0"
}, },
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43", "gitHead": "a7620bd266ae1345975767bbc7abf09034437017",
"homepage": "https://babeljs.io/", "homepage": "https://babeljs.io/",
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
@@ -56,5 +52,5 @@
"type": "git", "type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame" "url": "https://github.com/babel/babel/tree/master/packages/babel-code-frame"
}, },
"version": "7.5.5" "version": "7.8.3"
} }

View File

@@ -3,74 +3,177 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.makeStrongCache = makeStrongCache;
exports.makeWeakCache = makeWeakCache; exports.makeWeakCache = makeWeakCache;
exports.makeWeakCacheSync = makeWeakCacheSync;
exports.makeStrongCache = makeStrongCache;
exports.makeStrongCacheSync = makeStrongCacheSync;
exports.assertSimpleType = assertSimpleType; exports.assertSimpleType = assertSimpleType;
function makeStrongCache(handler) { function _gensync() {
return makeCachedFunction(new Map(), handler); 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) { function makeWeakCache(handler) {
return makeCachedFunction(new WeakMap(), handler); return makeCachedFunction(WeakMap, handler);
} }
function makeCachedFunction(callCache, handler) { function makeWeakCacheSync(handler) {
return function cachedFunction(arg, data) { return synchronize(makeWeakCache(handler));
let cachedValue = callCache.get(arg); }
if (cachedValue) { function makeStrongCache(handler) {
for (const _ref of cachedValue) { return makeCachedFunction(Map, handler);
const { }
value,
valid function makeStrongCacheSync(handler) {
} = _ref; return synchronize(makeStrongCache(handler));
if (valid(data)) return value; }
}
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;
} }
const cache = new CacheConfigurator(data); updateFunctionCache(callCache, cache, arg, value);
const value = handler(arg, cache);
if (!cache.configured()) cache.forever();
cache.deactivate();
switch (cache.mode()) {
case "forever":
cachedValue = [{
value,
valid: () => true
}];
callCache.set(arg, cachedValue);
break;
case "invalidate":
cachedValue = [{
value,
valid: cache.validator()
}];
callCache.set(arg, cachedValue);
break;
case "valid":
if (cachedValue) {
cachedValue.push({
value,
valid: cache.validator()
});
} else {
cachedValue = [{
value,
valid: cache.validator()
}];
callCache.set(arg, cachedValue);
}
if (finishLock) {
futureCache.delete(arg);
finishLock.release(value);
} }
return 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 { class CacheConfigurator {
constructor(data) { constructor(data) {
this._active = true; this._active = true;
@@ -130,33 +233,35 @@ class CacheConfigurator {
this._configured = true; this._configured = true;
const key = handler(this._data); 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`);
this._pairs.push([key, handler]); if ((0, _async.isThenable)(key)) {
return key.then(key => {
this._pairs.push([key, fn]);
return key;
});
}
this._pairs.push([key, fn]);
return key; return key;
} }
invalidate(handler) { invalidate(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._invalidate = true; this._invalidate = true;
this._configured = true; return this.using(handler);
const key = handler(this._data);
this._pairs.push([key, handler]);
return key;
} }
validator() { validator() {
const pairs = this._pairs; const pairs = this._pairs;
return data => pairs.every(([key, fn]) => key === fn(data)); return function* (data) {
for (const [key, fn] of pairs) {
if (key !== (yield* fn(data))) return false;
}
return true;
};
} }
deactivate() { deactivate() {
@@ -191,9 +296,29 @@ function makeSimpleConfigurator(cache) {
} }
function assertSimpleType(value) { 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") { 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."); throw new Error("Cache keys must be either string, boolean, number, null, or undefined.");
} }
return value; return value;
}
class Lock {
constructor() {
this.released = false;
this.promise = new Promise(resolve => {
this._resolve = resolve;
});
}
release(value) {
this.released = true;
this._resolve(value);
}
} }

View File

@@ -41,8 +41,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
const debug = (0, _debug().default)("babel:config:config-chain"); const debug = (0, _debug().default)("babel:config:config-chain");
function buildPresetChain(arg, context) { function* buildPresetChain(arg, context) {
const chain = buildPresetChainWalker(arg, context); const chain = yield* buildPresetChainWalker(arg, context);
if (!chain) return null; if (!chain) return null;
return { return {
plugins: dedupDescriptors(chain.plugins), plugins: dedupDescriptors(chain.plugins),
@@ -59,13 +59,13 @@ const buildPresetChainWalker = makeChainWalker({
overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName) overridesEnv: (preset, index, envName) => loadPresetOverridesEnvDescriptors(preset)(index)(envName)
}); });
exports.buildPresetChainWalker = buildPresetChainWalker; exports.buildPresetChainWalker = buildPresetChainWalker;
const loadPresetDescriptors = (0, _caching.makeWeakCache)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors)); const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRootDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors));
const loadPresetEnvDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName))); const loadPresetEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName)));
const loadPresetOverridesDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index))); const loadPresetOverridesDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index)));
const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCache)(preset => (0, _caching.makeStrongCache)(index => (0, _caching.makeStrongCache)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName)))); 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) { function* buildRootChain(opts, context) {
const programmaticChain = loadProgrammaticChain({ const programmaticChain = yield* loadProgrammaticChain({
options: opts, options: opts,
dirname: context.cwd dirname: context.cwd
}, context); }, context);
@@ -73,9 +73,9 @@ function buildRootChain(opts, context) {
let configFile; let configFile;
if (typeof opts.configFile === "string") { if (typeof opts.configFile === "string") {
configFile = (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller); configFile = yield* (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller);
} else if (opts.configFile !== false) { } else if (opts.configFile !== false) {
configFile = (0, _files.findRootConfig)(context.root, context.envName, context.caller); configFile = yield* (0, _files.findRootConfig)(context.root, context.envName, context.caller);
} }
let { let {
@@ -87,7 +87,7 @@ function buildRootChain(opts, context) {
if (configFile) { if (configFile) {
const validatedFile = validateConfigFile(configFile); const validatedFile = validateConfigFile(configFile);
const result = loadFileChain(validatedFile, context); const result = yield* loadFileChain(validatedFile, context);
if (!result) return null; if (!result) return null;
if (babelrc === undefined) { if (babelrc === undefined) {
@@ -102,7 +102,7 @@ function buildRootChain(opts, context) {
mergeChain(configFileChain, result); mergeChain(configFileChain, result);
} }
const pkgData = typeof context.filename === "string" ? (0, _files.findPackageData)(context.filename) : null; const pkgData = typeof context.filename === "string" ? yield* (0, _files.findPackageData)(context.filename) : null;
let ignoreFile, babelrcFile; let ignoreFile, babelrcFile;
const fileChain = emptyChain(); const fileChain = emptyChain();
@@ -110,14 +110,14 @@ function buildRootChain(opts, context) {
({ ({
ignore: ignoreFile, ignore: ignoreFile,
config: babelrcFile config: babelrcFile
} = (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller)); } = yield* (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller));
if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) { if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) {
return null; return null;
} }
if (babelrcFile) { if (babelrcFile) {
const result = loadFileChain(validateBabelrcFile(babelrcFile), context); const result = yield* loadFileChain(validateBabelrcFile(babelrcFile), context);
if (!result) return null; if (!result) return null;
mergeChain(fileChain, result); mergeChain(fileChain, result);
} }
@@ -163,17 +163,17 @@ function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirector
}); });
} }
const validateConfigFile = (0, _caching.makeWeakCache)(file => ({ const validateConfigFile = (0, _caching.makeWeakCacheSync)(file => ({
filepath: file.filepath, filepath: file.filepath,
dirname: file.dirname, dirname: file.dirname,
options: (0, _options.validate)("configfile", file.options) options: (0, _options.validate)("configfile", file.options)
})); }));
const validateBabelrcFile = (0, _caching.makeWeakCache)(file => ({ const validateBabelrcFile = (0, _caching.makeWeakCacheSync)(file => ({
filepath: file.filepath, filepath: file.filepath,
dirname: file.dirname, dirname: file.dirname,
options: (0, _options.validate)("babelrcfile", file.options) options: (0, _options.validate)("babelrcfile", file.options)
})); }));
const validateExtendFile = (0, _caching.makeWeakCache)(file => ({ const validateExtendFile = (0, _caching.makeWeakCacheSync)(file => ({
filepath: file.filepath, filepath: file.filepath,
dirname: file.dirname, dirname: file.dirname,
options: (0, _options.validate)("extendsfile", file.options) options: (0, _options.validate)("extendsfile", file.options)
@@ -190,10 +190,10 @@ const loadFileChain = makeChainWalker({
overrides: (file, index) => loadFileOverridesDescriptors(file)(index), overrides: (file, index) => loadFileOverridesDescriptors(file)(index),
overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName) overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName)
}); });
const loadFileDescriptors = (0, _caching.makeWeakCache)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors)); const loadFileDescriptors = (0, _caching.makeWeakCacheSync)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors));
const loadFileEnvDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName))); const loadFileEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName)));
const loadFileOverridesDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index))); const loadFileOverridesDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index)));
const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCache)(file => (0, _caching.makeStrongCache)(index => (0, _caching.makeStrongCache)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName)))); const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName))));
function buildRootDescriptors({ function buildRootDescriptors({
dirname, dirname,
@@ -235,7 +235,7 @@ function makeChainWalker({
overrides, overrides,
overridesEnv overridesEnv
}) { }) {
return (input, context, files = new Set()) => { return function* (input, context, files = new Set()) {
const { const {
dirname dirname
} = input; } = input;
@@ -276,7 +276,7 @@ function makeChainWalker({
const chain = emptyChain(); const chain = emptyChain();
for (const op of flattenedConfigs) { for (const op of flattenedConfigs) {
if (!mergeExtendsChain(chain, op.options, dirname, context, files)) { if (!(yield* mergeExtendsChain(chain, op.options, dirname, context, files))) {
return null; return null;
} }
@@ -287,16 +287,16 @@ function makeChainWalker({
}; };
} }
function mergeExtendsChain(chain, opts, dirname, context, files) { function* mergeExtendsChain(chain, opts, dirname, context, files) {
if (opts.extends === undefined) return true; if (opts.extends === undefined) return true;
const file = (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller); const file = yield* (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller);
if (files.has(file)) { 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")); 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); files.add(file);
const fileChain = loadFileChain(validateExtendFile(file), context, files); const fileChain = yield* loadFileChain(validateExtendFile(file), context, files);
files.delete(file); files.delete(file);
if (!fileChain) return false; if (!fileChain) return false;
mergeChain(chain, fileChain); mergeChain(chain, fileChain);
@@ -343,7 +343,7 @@ function normalizeOptions(opts) {
delete options.include; delete options.include;
delete options.exclude; delete options.exclude;
if (options.hasOwnProperty("sourceMap")) { if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) {
options.sourceMaps = options.sourceMap; options.sourceMaps = options.sourceMap;
delete options.sourceMap; delete options.sourceMap;
} }

View File

@@ -53,14 +53,14 @@ function createUncachedDescriptors(dirname, options, alias) {
} }
const PRESET_DESCRIPTOR_CACHE = new WeakMap(); const PRESET_DESCRIPTOR_CACHE = new WeakMap();
const createCachedPresetDescriptors = (0, _caching.makeWeakCache)((items, cache) => { const createCachedPresetDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
const dirname = cache.using(dir => dir); const dirname = cache.using(dir => dir);
return (0, _caching.makeStrongCache)(alias => (0, _caching.makeStrongCache)(passPerPreset => createPresetDescriptors(items, dirname, alias, passPerPreset).map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc)))); 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 PLUGIN_DESCRIPTOR_CACHE = new WeakMap();
const createCachedPluginDescriptors = (0, _caching.makeWeakCache)((items, cache) => { const createCachedPluginDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => {
const dirname = cache.using(dir => dir); const dirname = cache.using(dir => dir);
return (0, _caching.makeStrongCache)(alias => createPluginDescriptors(items, dirname, alias).map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc))); return (0, _caching.makeStrongCacheSync)(alias => createPluginDescriptors(items, dirname, alias).map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)));
}); });
const DEFAULT_OPTIONS = {}; const DEFAULT_OPTIONS = {};
@@ -202,7 +202,8 @@ function assertNoDuplicates(items) {
} }
if (nameMap.has(item.name)) { if (nameMap.has(item.name)) {
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'],`, ` ]`].join("\n")); 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); nameMap.add(item.name);

View File

@@ -7,6 +7,7 @@ exports.findConfigUpwards = findConfigUpwards;
exports.findRelativeConfig = findRelativeConfig; exports.findRelativeConfig = findRelativeConfig;
exports.findRootConfig = findRootConfig; exports.findRootConfig = findRootConfig;
exports.loadConfig = loadConfig; exports.loadConfig = loadConfig;
exports.ROOT_CONFIG_FILENAMES = void 0;
function _debug() { function _debug() {
const data = _interopRequireDefault(require("debug")); const data = _interopRequireDefault(require("debug"));
@@ -28,16 +29,6 @@ function _path() {
return data; return data;
} }
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _json() { function _json() {
const data = _interopRequireDefault(require("json5")); const data = _interopRequireDefault(require("json5"));
@@ -48,10 +39,10 @@ function _json() {
return data; return data;
} }
function _resolve() { function _gensync() {
const data = _interopRequireDefault(require("resolve")); const data = _interopRequireDefault(require("gensync"));
_resolve = function () { _gensync = function () {
return data; return data;
}; };
@@ -64,22 +55,34 @@ var _configApi = _interopRequireDefault(require("../helpers/config-api"));
var _utils = require("./utils"); var _utils = require("./utils");
var _moduleTypes = _interopRequireDefault(require("./module-types"));
var _patternToRegex = _interopRequireDefault(require("../pattern-to-regex")); 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 }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = (0, _debug().default)("babel:config:loading:files:configuration"); const debug = (0, _debug().default)("babel:config:loading:files:configuration");
const BABEL_CONFIG_JS_FILENAME = "babel.config.js"; const ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json"];
const BABELRC_FILENAME = ".babelrc"; exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
const BABELRC_JS_FILENAME = ".babelrc.js"; const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json"];
const BABELIGNORE_FILENAME = ".babelignore"; const BABELIGNORE_FILENAME = ".babelignore";
function findConfigUpwards(rootDir) { function* findConfigUpwards(rootDir) {
let dirname = rootDir; let dirname = rootDir;
while (true) { while (true) {
if (_fs().default.existsSync(_path().default.join(dirname, BABEL_CONFIG_JS_FILENAME))) { for (const filename of ROOT_CONFIG_FILENAMES) {
return dirname; if (yield* fs.exists(_path().default.join(dirname, filename))) {
return dirname;
}
} }
const nextDir = _path().default.dirname(dirname); const nextDir = _path().default.dirname(dirname);
@@ -91,7 +94,7 @@ function findConfigUpwards(rootDir) {
return null; return null;
} }
function findRelativeConfig(packageData, envName, caller) { function* findRelativeConfig(packageData, envName, caller) {
let config = null; let config = null;
let ignore = null; let ignore = null;
@@ -99,36 +102,13 @@ function findRelativeConfig(packageData, envName, caller) {
for (const loc of packageData.directories) { for (const loc of packageData.directories) {
if (!config) { if (!config) {
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce((previousConfig, name) => { config = yield* loadOneConfig(RELATIVE_CONFIG_FILENAMES, loc, envName, caller, packageData.pkg && packageData.pkg.dirname === loc ? packageToBabelConfig(packageData.pkg) : null);
const filepath = _path().default.join(loc, name);
const config = readConfig(filepath, envName, caller);
if (config && previousConfig) {
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(previousConfig.filepath)}\n` + ` - ${name}\n` + `from ${loc}`);
}
return config || previousConfig;
}, null);
const pkgConfig = packageData.pkg && packageData.pkg.dirname === loc ? packageToBabelConfig(packageData.pkg) : null;
if (pkgConfig) {
if (config) {
throw new Error(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().default.basename(pkgConfig.filepath)}#babel\n` + ` - ${_path().default.basename(config.filepath)}\n` + `from ${loc}`);
}
config = pkgConfig;
}
if (config) {
debug("Found configuration %o from %o.", config.filepath, dirname);
}
} }
if (!ignore) { if (!ignore) {
const ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME); const ignoreLoc = _path().default.join(loc, BABELIGNORE_FILENAME);
ignore = readIgnoreConfig(ignoreLoc); ignore = yield* readIgnoreConfig(ignoreLoc);
if (ignore) { if (ignore) {
debug("Found ignore %o from %o.", ignore.filepath, dirname); debug("Found ignore %o from %o.", ignore.filepath, dirname);
@@ -143,23 +123,31 @@ function findRelativeConfig(packageData, envName, caller) {
} }
function findRootConfig(dirname, envName, caller) { function findRootConfig(dirname, envName, caller) {
const filepath = _path().default.resolve(dirname, BABEL_CONFIG_JS_FILENAME); return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);
const conf = readConfig(filepath, envName, caller);
if (conf) {
debug("Found root config %o in %o.", BABEL_CONFIG_JS_FILENAME, dirname);
}
return conf;
} }
function loadConfig(name, dirname, envName, caller) { function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) {
const filepath = _resolve().default.sync(name, { 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 basedir: dirname
}); });
const conf = yield* readConfig(filepath, envName, caller);
const conf = readConfig(filepath, envName, caller);
if (!conf) { if (!conf) {
throw new Error(`Config file ${filepath} contains no configuration data`); throw new Error(`Config file ${filepath} contains no configuration data`);
@@ -170,15 +158,17 @@ function loadConfig(name, dirname, envName, caller) {
} }
function readConfig(filepath, envName, caller) { function readConfig(filepath, envName, caller) {
return _path().default.extname(filepath) === ".js" ? readConfigJS(filepath, { const ext = _path().default.extname(filepath);
return ext === ".js" || ext === ".cjs" || ext === ".mjs" ? readConfigJS(filepath, {
envName, envName,
caller caller
}) : readConfigJSON5(filepath); }) : readConfigJSON5(filepath);
} }
const LOADING_CONFIGS = new Set(); const LOADING_CONFIGS = new Set();
const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => { const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepath, cache) {
if (!_fs().default.existsSync(filepath)) { if (!fs.exists.sync(filepath)) {
cache.forever(); cache.forever();
return null; return null;
} }
@@ -197,10 +187,7 @@ const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => {
try { try {
LOADING_CONFIGS.add(filepath); 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.");
const configModule = require(filepath);
options = configModule && configModule.__esModule ? configModule.default || undefined : configModule;
} catch (err) { } catch (err) {
err.message = `${filepath}: Error while loading config - ${err.message}`; err.message = `${filepath}: Error while loading config - ${err.message}`;
throw err; throw err;
@@ -208,9 +195,12 @@ const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => {
LOADING_CONFIGS.delete(filepath); LOADING_CONFIGS.delete(filepath);
} }
let assertCache = false;
if (typeof options === "function") { if (typeof options === "function") {
yield* [];
options = options((0, _configApi.default)(cache)); options = options((0, _configApi.default)(cache));
if (!cache.configured()) throwConfigError(); assertCache = true;
} }
if (!options || typeof options !== "object" || Array.isArray(options)) { if (!options || typeof options !== "object" || Array.isArray(options)) {
@@ -221,13 +211,14 @@ const readConfigJS = (0, _caching.makeStrongCache)((filepath, cache) => {
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.`); 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 { return {
filepath, filepath,
dirname: _path().default.dirname(filepath), dirname: _path().default.dirname(filepath),
options options
}; };
}); });
const packageToBabelConfig = (0, _caching.makeWeakCache)(file => { const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => {
const babel = file.options["babel"]; const babel = file.options["babel"];
if (typeof babel === "undefined") return null; if (typeof babel === "undefined") return null;

10
node_modules/@babel/core/lib/config/files/import.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = import_;
function import_(filepath) {
return import(filepath);
}

View File

@@ -12,12 +12,13 @@ exports.resolvePlugin = resolvePlugin;
exports.resolvePreset = resolvePreset; exports.resolvePreset = resolvePreset;
exports.loadPlugin = loadPlugin; exports.loadPlugin = loadPlugin;
exports.loadPreset = loadPreset; exports.loadPreset = loadPreset;
exports.ROOT_CONFIG_FILENAMES = void 0;
function findConfigUpwards(rootDir) { function* findConfigUpwards(rootDir) {
return null; return null;
} }
function findPackageData(filepath) { function* findPackageData(filepath) {
return { return {
filepath, filepath,
directories: [], directories: [],
@@ -26,7 +27,7 @@ function findPackageData(filepath) {
}; };
} }
function findRelativeConfig(pkgData, envName, caller) { function* findRelativeConfig(pkgData, envName, caller) {
return { return {
pkg: null, pkg: null,
config: null, config: null,
@@ -34,14 +35,17 @@ function findRelativeConfig(pkgData, envName, caller) {
}; };
} }
function findRootConfig(dirname, envName, caller) { function* findRootConfig(dirname, envName, caller) {
return null; return null;
} }
function loadConfig(name, dirname, envName, caller) { function* loadConfig(name, dirname, envName, caller) {
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`); throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
} }
const ROOT_CONFIG_FILENAMES = [];
exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES;
function resolvePlugin(name, dirname) { function resolvePlugin(name, dirname) {
return null; return null;
} }

View File

@@ -33,6 +33,12 @@ Object.defineProperty(exports, "loadConfig", {
return _configuration.loadConfig; return _configuration.loadConfig;
} }
}); });
Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", {
enumerable: true,
get: function () {
return _configuration.ROOT_CONFIG_FILENAMES;
}
});
Object.defineProperty(exports, "resolvePlugin", { Object.defineProperty(exports, "resolvePlugin", {
enumerable: true, enumerable: true,
get: function () { get: function () {

View File

@@ -0,0 +1,86 @@
"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 _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_(filepath);
return module.default;
});
return _loadMjsDefault.apply(this, arguments);
}

View File

@@ -21,7 +21,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
const PACKAGE_FILENAME = "package.json"; const PACKAGE_FILENAME = "package.json";
function findPackageData(filepath) { function* findPackageData(filepath) {
let pkg = null; let pkg = null;
const directories = []; const directories = [];
let isPackage = true; let isPackage = true;
@@ -30,7 +30,7 @@ function findPackageData(filepath) {
while (!pkg && _path().default.basename(dirname) !== "node_modules") { while (!pkg && _path().default.basename(dirname) !== "node_modules") {
directories.push(dirname); directories.push(dirname);
pkg = readConfigPackage(_path().default.join(dirname, PACKAGE_FILENAME)); pkg = yield* readConfigPackage(_path().default.join(dirname, PACKAGE_FILENAME));
const nextLoc = _path().default.dirname(dirname); const nextLoc = _path().default.dirname(dirname);

View File

@@ -5,34 +5,42 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.makeStaticFileCache = makeStaticFileCache; exports.makeStaticFileCache = makeStaticFileCache;
function _fs() { var _caching = require("../caching");
var fs = _interopRequireWildcard(require("../../gensync-utils/fs"));
function _fs2() {
const data = _interopRequireDefault(require("fs")); const data = _interopRequireDefault(require("fs"));
_fs = function () { _fs2 = function () {
return data; return data;
}; };
return data; return data;
} }
var _caching = require("../caching");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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) { function makeStaticFileCache(fn) {
return (0, _caching.makeStrongCache)((filepath, cache) => { return (0, _caching.makeStrongCache)(function* (filepath, cache) {
if (cache.invalidate(() => fileMtime(filepath)) === null) { const cached = cache.invalidate(() => fileMtime(filepath));
if (cached === null) {
cache.forever(); cache.forever();
return null; return null;
} }
return fn(filepath, _fs().default.readFileSync(filepath, "utf8")); return fn(filepath, (yield* fs.readFile(filepath, "utf8")));
}); });
} }
function fileMtime(filepath) { function fileMtime(filepath) {
try { try {
return +_fs().default.statSync(filepath).mtime; return +_fs2().default.statSync(filepath).mtime;
} catch (e) { } catch (e) {
if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e; if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e;
} }

View File

@@ -3,7 +3,19 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = loadFullConfig; 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 _util = require("./util");
@@ -35,12 +47,14 @@ var _configApi = _interopRequireDefault(require("./helpers/config-api"));
var _partial = _interopRequireDefault(require("./partial")); 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 }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } var _default = (0, _gensync().default)(function* loadFullConfig(inputOpts) {
const result = yield* (0, _partial.default)(inputOpts);
function loadFullConfig(inputOpts) {
const result = (0, _partial.default)(inputOpts);
if (!result) { if (!result) {
return null; return null;
@@ -63,35 +77,55 @@ function loadFullConfig(inputOpts) {
throw new Error("Assertion failure - plugins and presets exist"); throw new Error("Assertion failure - plugins and presets exist");
} }
const ignored = function recurseDescriptors(config, pass) { const ignored = yield* function* recurseDescriptors(config, pass) {
const plugins = config.plugins.reduce((acc, descriptor) => { const plugins = [];
if (descriptor.options !== false) {
acc.push(loadPluginDescriptor(descriptor, context));
}
return acc; for (let i = 0; i < config.plugins.length; i++) {
}, []); const descriptor = config.plugins[i];
const presets = config.presets.reduce((acc, descriptor) => {
if (descriptor.options !== false) {
acc.push({
preset: loadPresetDescriptor(descriptor, context),
pass: descriptor.ownPass ? [] : pass
});
}
return acc; 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) { if (presets.length > 0) {
passes.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pass)); passes.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pass));
for (const _ref of presets) { for (const {
const { preset,
preset, pass
pass } of presets) {
} = _ref;
if (!preset) return true; if (!preset) return true;
const ignored = recurseDescriptors({ const ignored = yield* recurseDescriptors({
plugins: preset.plugins, plugins: preset.plugins,
presets: preset.presets presets: preset.presets
}, pass); }, pass);
@@ -125,7 +159,6 @@ function loadFullConfig(inputOpts) {
return desc; return desc;
}) })
}, passes[0]); }, passes[0]);
if (ignored) return null; if (ignored) return null;
} catch (e) { } catch (e) {
if (!/^\[BABEL\]/.test(e.message)) { if (!/^\[BABEL\]/.test(e.message)) {
@@ -146,20 +179,21 @@ function loadFullConfig(inputOpts) {
options: opts, options: opts,
passes: passes passes: passes
}; };
} });
const loadDescriptor = (0, _caching.makeWeakCache)(({ exports.default = _default;
const loadDescriptor = (0, _caching.makeWeakCache)(function* ({
value, value,
options, options,
dirname, dirname,
alias alias
}, cache) => { }, cache) {
if (options === false) throw new Error("Assertion failure"); if (options === false) throw new Error("Assertion failure");
options = options || {}; options = options || {};
let item = value; let item = value;
if (typeof value === "function") { if (typeof value === "function") {
const api = Object.assign({}, context, (0, _configApi.default)(cache)); const api = Object.assign({}, context, {}, (0, _configApi.default)(cache));
try { try {
item = value(api, options, dirname); item = value(api, options, dirname);
@@ -177,6 +211,7 @@ const loadDescriptor = (0, _caching.makeWeakCache)(({
} }
if (typeof item.then === "function") { 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.`); 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.`);
} }
@@ -188,7 +223,7 @@ const loadDescriptor = (0, _caching.makeWeakCache)(({
}; };
}); });
function loadPluginDescriptor(descriptor, context) { function* loadPluginDescriptor(descriptor, context) {
if (descriptor.value instanceof _plugin.default) { if (descriptor.value instanceof _plugin.default) {
if (descriptor.options) { if (descriptor.options) {
throw new Error("Passed options to an existing Plugin instance will not work."); throw new Error("Passed options to an existing Plugin instance will not work.");
@@ -197,15 +232,15 @@ function loadPluginDescriptor(descriptor, context) {
return descriptor.value; return descriptor.value;
} }
return instantiatePlugin(loadDescriptor(descriptor, context), context); return yield* instantiatePlugin((yield* loadDescriptor(descriptor, context)), context);
} }
const instantiatePlugin = (0, _caching.makeWeakCache)(({ const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({
value, value,
options, options,
dirname, dirname,
alias alias
}, cache) => { }, cache) {
const pluginObj = (0, _plugins.validatePluginObject)(value); const pluginObj = (0, _plugins.validatePluginObject)(value);
const plugin = Object.assign({}, pluginObj); const plugin = Object.assign({}, pluginObj);
@@ -221,7 +256,9 @@ const instantiatePlugin = (0, _caching.makeWeakCache)(({
options, options,
dirname dirname
}; };
const inherits = cache.invalidate(data => loadPluginDescriptor(inheritsDescriptor, data)); const inherits = yield* (0, _async.forwardAsync)(loadPluginDescriptor, run => {
return cache.invalidate(data => run(inheritsDescriptor, data));
});
plugin.pre = chain(inherits.pre, plugin.pre); plugin.pre = chain(inherits.pre, plugin.pre);
plugin.post = chain(inherits.post, plugin.post); plugin.post = chain(inherits.post, plugin.post);
plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions); plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions);
@@ -231,11 +268,33 @@ const instantiatePlugin = (0, _caching.makeWeakCache)(({
return new _plugin.default(plugin, options, alias); return new _plugin.default(plugin, options, alias);
}); });
const loadPresetDescriptor = (descriptor, context) => { const validateIfOptionNeedsFilename = (options, descriptor) => {
return (0, _configChain.buildPresetChain)(instantiatePreset(loadDescriptor(descriptor, context)), context); 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 instantiatePreset = (0, _caching.makeWeakCache)(({ 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, value,
dirname, dirname,
alias alias

View File

@@ -3,19 +3,23 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.loadOptions = loadOptions;
Object.defineProperty(exports, "default", { Object.defineProperty(exports, "default", {
enumerable: true, enumerable: true,
get: function () { get: function () {
return _full.default; return _full.default;
} }
}); });
Object.defineProperty(exports, "loadPartialConfig", { exports.loadOptionsAsync = exports.loadOptionsSync = exports.loadOptions = exports.loadPartialConfigAsync = exports.loadPartialConfigSync = exports.loadPartialConfig = void 0;
enumerable: true,
get: function () { function _gensync() {
return _partial.loadPartialConfig; const data = _interopRequireDefault(require("gensync"));
}
}); _gensync = function () {
return data;
};
return data;
}
var _full = _interopRequireDefault(require("./full")); var _full = _interopRequireDefault(require("./full"));
@@ -23,7 +27,29 @@ var _partial = require("./partial");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function loadOptions(opts) { const loadOptionsRunner = (0, _gensync().default)(function* (opts) {
const config = (0, _full.default)(opts); const config = yield* (0, _full.default)(opts);
return config ? config.options : null; return config ? 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;

View File

@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = loadPrivatePartialConfig; exports.default = loadPrivatePartialConfig;
exports.loadPartialConfig = loadPartialConfig; exports.loadPartialConfig = void 0;
function _path() { function _path() {
const data = _interopRequireDefault(require("path")); const data = _interopRequireDefault(require("path"));
@@ -16,6 +16,16 @@ function _path() {
return data; return data;
} }
function _gensync() {
const data = _interopRequireDefault(require("gensync"));
_gensync = function () {
return data;
};
return data;
}
var _plugin = _interopRequireDefault(require("./plugin")); var _plugin = _interopRequireDefault(require("./plugin"));
var _util = require("./util"); var _util = require("./util");
@@ -32,33 +42,33 @@ var _files = require("./files");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function resolveRootMode(rootDir, rootMode) { function* resolveRootMode(rootDir, rootMode) {
switch (rootMode) { switch (rootMode) {
case "root": case "root":
return rootDir; return rootDir;
case "upward-optional": case "upward-optional":
{ {
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir); const upwardRootDir = yield* (0, _files.findConfigUpwards)(rootDir);
return upwardRootDir === null ? rootDir : upwardRootDir; return upwardRootDir === null ? rootDir : upwardRootDir;
} }
case "upward": case "upward":
{ {
const upwardRootDir = (0, _files.findConfigUpwards)(rootDir); const upwardRootDir = yield* (0, _files.findConfigUpwards)(rootDir);
if (upwardRootDir !== null) return upwardRootDir; 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}"`), { 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", code: "BABEL_ROOT_NOT_FOUND",
dirname: rootDir dirname: rootDir
}); });
} }
default: default:
throw new Error(`Assertion failure - unknown rootMode value`); throw new Error(`Assertion failure - unknown rootMode value.`);
} }
} }
function loadPrivatePartialConfig(inputOpts) { function* loadPrivatePartialConfig(inputOpts) {
if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) { if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) {
throw new Error("Babel options must be an object, null, or undefined"); throw new Error("Babel options must be an object, null, or undefined");
} }
@@ -74,7 +84,7 @@ function loadPrivatePartialConfig(inputOpts) {
const absoluteCwd = _path().default.resolve(cwd); const absoluteCwd = _path().default.resolve(cwd);
const absoluteRootDir = resolveRootMode(_path().default.resolve(absoluteCwd, rootDir), rootMode); const absoluteRootDir = yield* resolveRootMode(_path().default.resolve(absoluteCwd, rootDir), rootMode);
const context = { const context = {
filename: typeof args.filename === "string" ? _path().default.resolve(cwd, args.filename) : undefined, filename: typeof args.filename === "string" ? _path().default.resolve(cwd, args.filename) : undefined,
cwd: absoluteCwd, cwd: absoluteCwd,
@@ -82,7 +92,7 @@ function loadPrivatePartialConfig(inputOpts) {
envName, envName,
caller caller
}; };
const configChain = (0, _configChain.buildRootChain)(args, context); const configChain = yield* (0, _configChain.buildRootChain)(args, context);
if (!configChain) return null; if (!configChain) return null;
const options = {}; const options = {};
configChain.options.forEach(opts => { configChain.options.forEach(opts => {
@@ -106,8 +116,8 @@ function loadPrivatePartialConfig(inputOpts) {
}; };
} }
function loadPartialConfig(inputOpts) { const loadPartialConfig = (0, _gensync().default)(function* (inputOpts) {
const result = loadPrivatePartialConfig(inputOpts); const result = yield* loadPrivatePartialConfig(inputOpts);
if (!result) return null; if (!result) return null;
const { const {
options, options,
@@ -121,7 +131,8 @@ function loadPartialConfig(inputOpts) {
} }
}); });
return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined); return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined);
} });
exports.loadPartialConfig = loadPartialConfig;
class PartialConfig { class PartialConfig {
constructor(options, babelrc, ignore, config) { constructor(options, babelrc, ignore, config) {

View File

@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.mergeOptions = mergeOptions; exports.mergeOptions = mergeOptions;
exports.isIterableIterator = isIterableIterator;
function mergeOptions(target, source) { function mergeOptions(target, source) {
for (const k of Object.keys(source)) { for (const k of Object.keys(source)) {
@@ -27,4 +28,8 @@ function mergeDefaultFields(target, source) {
const val = source[k]; const val = source[k];
if (val !== undefined) target[k] = val; if (val !== undefined) target[k] = val;
} }
}
function isIterableIterator(value) {
return !!value && typeof value.next === "function" && typeof value[Symbol.iterator] === "function";
} }

View File

@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.validate = validate; exports.validate = validate;
exports.checkNoUnwrappedItemOptionPairs = checkNoUnwrappedItemOptionPairs;
var _plugin = _interopRequireDefault(require("../plugin")); var _plugin = _interopRequireDefault(require("../plugin"));
@@ -117,10 +118,11 @@ function throwUnknownError(loc) {
message, message,
version = 5 version = 5
} = _removed.default[key]; } = _removed.default[key];
throw new ReferenceError(`Using removed Babel ${version} option: ${(0, _optionAssertions.msg)(loc)} - ${message}`); throw new Error(`Using removed Babel ${version} option: ${(0, _optionAssertions.msg)(loc)} - ${message}`);
} else { } else {
const unknownOptErr = `Unknown option: ${(0, _optionAssertions.msg)(loc)}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`; 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.`);
throw new ReferenceError(unknownOptErr); unknownOptErr.code = "BABEL_UNKNOWN_OPTION";
throw unknownOptErr;
} }
} }
@@ -185,4 +187,10 @@ function assertOverridesList(loc, value) {
} }
return arr; 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`;
}
} }

View File

@@ -47,9 +47,22 @@ function assertVisitorHandler(key, value) {
} }
function validatePluginObject(obj) { function validatePluginObject(obj) {
const rootPath = {
type: "root",
source: "plugin"
};
Object.keys(obj).forEach(key => { Object.keys(obj).forEach(key => {
const validator = VALIDATORS[key]; const validator = VALIDATORS[key];
if (validator) validator(key, obj[key]);else throw new Error(`.${key} is not a valid Plugin property`); const optLoc = {
type: "option",
name: key,
parent: rootPath
};
if (validator) 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; return obj;
} }

89
node_modules/@babel/core/lib/gensync-utils/async.js generated vendored Normal file
View 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";
}

48
node_modules/@babel/core/lib/gensync-utils/fs.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
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;

35
node_modules/@babel/core/lib/gensync-utils/resolve.js generated vendored Normal file
View 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;

View File

@@ -70,12 +70,36 @@ Object.defineProperty(exports, "loadPartialConfig", {
return _config.loadPartialConfig; 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", { Object.defineProperty(exports, "loadOptions", {
enumerable: true, enumerable: true,
get: function () { get: function () {
return _config.loadOptions; 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", { Object.defineProperty(exports, "transform", {
enumerable: true, enumerable: true,
get: function () { get: function () {
@@ -219,7 +243,9 @@ var _transformAst = require("./transform-ast");
var _parse = require("./parse"); var _parse = require("./parse");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 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 }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

View File

@@ -3,63 +3,48 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.parseSync = parseSync; exports.parseAsync = exports.parseSync = exports.parse = void 0;
exports.parseAsync = parseAsync;
exports.parse = void 0; function _gensync() {
const data = _interopRequireDefault(require("gensync"));
_gensync = function () {
return data;
};
return data;
}
var _config = _interopRequireDefault(require("./config")); var _config = _interopRequireDefault(require("./config"));
var _normalizeFile = _interopRequireDefault(require("./transformation/normalize-file")); var _parser = _interopRequireDefault(require("./parser"));
var _normalizeOpts = _interopRequireDefault(require("./transformation/normalize-opts")); var _normalizeOpts = _interopRequireDefault(require("./transformation/normalize-opts"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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) { const parse = function parse(code, opts, callback) {
if (typeof opts === "function") { if (typeof opts === "function") {
callback = opts; callback = opts;
opts = undefined; opts = undefined;
} }
if (callback === undefined) return parseSync(code, opts); if (callback === undefined) return parseRunner.sync(code, opts);
const config = (0, _config.default)(opts); parseRunner.errback(code, opts, callback);
if (config === null) {
return null;
}
const cb = callback;
process.nextTick(() => {
let ast = null;
try {
const cfg = (0, _config.default)(opts);
if (cfg === null) return cb(null, null);
ast = (0, _normalizeFile.default)(cfg.passes, (0, _normalizeOpts.default)(cfg), code).ast;
} catch (err) {
return cb(err);
}
cb(null, ast);
});
}; };
exports.parse = parse; exports.parse = parse;
const parseSync = parseRunner.sync;
function parseSync(code, opts) { exports.parseSync = parseSync;
const config = (0, _config.default)(opts); const parseAsync = parseRunner.async;
exports.parseAsync = parseAsync;
if (config === null) {
return null;
}
return (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code).ast;
}
function parseAsync(code, opts) {
return new Promise((res, rej) => {
parse(code, opts, (err, result) => {
if (err == null) res(result);else rej(err);
});
});
}

97
node_modules/@babel/core/lib/parser/index.js generated vendored Normal file
View 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;
}
}

View File

@@ -117,16 +117,6 @@ const pluginNameMap = {
url: "https://git.io/vAlRe" 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"
}
},
numericSeparator: { numericSeparator: {
syntax: { syntax: {
name: "@babel/plugin-syntax-numeric-separator", name: "@babel/plugin-syntax-numeric-separator",
@@ -187,6 +177,16 @@ const pluginNameMap = {
url: "https://git.io/vb4yp" url: "https://git.io/vb4yp"
} }
}, },
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: { objectRestSpread: {
syntax: { syntax: {
name: "@babel/plugin-syntax-object-rest-spread", name: "@babel/plugin-syntax-object-rest-spread",

View File

@@ -47,7 +47,9 @@ function t() {
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 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 => _template().default` const buildUmdWrapper = replacements => _template().default`
(function (root, factory) { (function (root, factory) {

View File

@@ -3,9 +3,17 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.transformFromAstSync = transformFromAstSync; exports.transformFromAstAsync = exports.transformFromAstSync = exports.transformFromAst = void 0;
exports.transformFromAstAsync = transformFromAstAsync;
exports.transformFromAst = void 0; function _gensync() {
const data = _interopRequireDefault(require("gensync"));
_gensync = function () {
return data;
};
return data;
}
var _config = _interopRequireDefault(require("./config")); var _config = _interopRequireDefault(require("./config"));
@@ -13,42 +21,28 @@ var _transformation = require("./transformation");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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) { const transformFromAst = function transformFromAst(ast, code, opts, callback) {
if (typeof opts === "function") { if (typeof opts === "function") {
callback = opts; callback = opts;
opts = undefined; opts = undefined;
} }
if (callback === undefined) return transformFromAstSync(ast, code, opts); if (callback === undefined) {
const cb = callback; return transformFromAstRunner.sync(ast, code, opts);
process.nextTick(() => { }
let cfg;
try { transformFromAstRunner.errback(ast, code, opts, callback);
cfg = (0, _config.default)(opts);
if (cfg === null) return cb(null, null);
} catch (err) {
return cb(err);
}
if (!ast) return cb(new Error("No AST given"));
(0, _transformation.runAsync)(cfg, code, ast, cb);
});
}; };
exports.transformFromAst = transformFromAst; exports.transformFromAst = transformFromAst;
const transformFromAstSync = transformFromAstRunner.sync;
function transformFromAstSync(ast, code, opts) { exports.transformFromAstSync = transformFromAstSync;
const config = (0, _config.default)(opts); const transformFromAstAsync = transformFromAstRunner.async;
if (config === null) return null; exports.transformFromAstAsync = transformFromAstAsync;
if (!ast) throw new Error("No AST given");
return (0, _transformation.runSync)(config, code, ast);
}
function transformFromAstAsync(ast, code, opts) {
return new Promise((res, rej) => {
transformFromAst(ast, code, opts, (err, result) => {
if (err == null) res(result);else rej(err);
});
});
}

View File

@@ -3,14 +3,12 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.transformFileSync = transformFileSync; exports.transformFileAsync = exports.transformFileSync = exports.transformFile = void 0;
exports.transformFileAsync = transformFileAsync;
exports.transformFile = void 0;
function _fs() { function _gensync() {
const data = _interopRequireDefault(require("fs")); const data = _interopRequireDefault(require("gensync"));
_fs = function () { _gensync = function () {
return data; return data;
}; };
@@ -21,50 +19,16 @@ var _config = _interopRequireDefault(require("./config"));
var _transformation = require("./transformation"); 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 }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
({}); ({});
const transformFileRunner = (0, _gensync().default)(function* (filename, opts) {
const transformFile = function transformFile(filename, opts, callback) {
let options;
if (typeof opts === "function") {
callback = opts;
opts = undefined;
}
if (opts == null) {
options = {
filename
};
} else if (opts && typeof opts === "object") {
options = Object.assign({}, opts, {
filename
});
}
process.nextTick(() => {
let cfg;
try {
cfg = (0, _config.default)(options);
if (cfg === null) return callback(null, null);
} catch (err) {
return callback(err);
}
const config = cfg;
_fs().default.readFile(filename, "utf8", function (err, code) {
if (err) return callback(err, null);
(0, _transformation.runAsync)(config, code, null, callback);
});
});
};
exports.transformFile = transformFile;
function transformFileSync(filename, opts) {
let options; let options;
if (opts == null) { if (opts == null) {
@@ -77,15 +41,14 @@ function transformFileSync(filename, opts) {
}); });
} }
const config = (0, _config.default)(options); const config = yield* (0, _config.default)(options);
if (config === null) return null; if (config === null) return null;
return (0, _transformation.runSync)(config, _fs().default.readFileSync(filename, "utf8")); const code = yield* fs.readFile(filename, "utf8");
} return yield* (0, _transformation.run)(config, code);
});
function transformFileAsync(filename, opts) { const transformFile = transformFileRunner.errback;
return new Promise((res, rej) => { exports.transformFile = transformFile;
transformFile(filename, opts, (err, result) => { const transformFileSync = transformFileRunner.sync;
if (err == null) res(result);else rej(err); exports.transformFileSync = transformFileSync;
}); const transformFileAsync = transformFileRunner.async;
}); exports.transformFileAsync = transformFileAsync;
}

View File

@@ -3,9 +3,17 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.transformSync = transformSync; exports.transformAsync = exports.transformSync = exports.transform = void 0;
exports.transformAsync = transformAsync;
exports.transform = void 0; function _gensync() {
const data = _interopRequireDefault(require("gensync"));
_gensync = function () {
return data;
};
return data;
}
var _config = _interopRequireDefault(require("./config")); var _config = _interopRequireDefault(require("./config"));
@@ -13,40 +21,24 @@ var _transformation = require("./transformation");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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) { const transform = function transform(code, opts, callback) {
if (typeof opts === "function") { if (typeof opts === "function") {
callback = opts; callback = opts;
opts = undefined; opts = undefined;
} }
if (callback === undefined) return transformSync(code, opts); if (callback === undefined) return transformRunner.sync(code, opts);
const cb = callback; transformRunner.errback(code, opts, callback);
process.nextTick(() => {
let cfg;
try {
cfg = (0, _config.default)(opts);
if (cfg === null) return cb(null, null);
} catch (err) {
return cb(err);
}
(0, _transformation.runAsync)(cfg, code, null, cb);
});
}; };
exports.transform = transform; exports.transform = transform;
const transformSync = transformRunner.sync;
function transformSync(code, opts) { exports.transformSync = transformSync;
const config = (0, _config.default)(opts); const transformAsync = transformRunner.async;
if (config === null) return null; exports.transformAsync = transformAsync;
return (0, _transformation.runSync)(config, code);
}
function transformAsync(code, opts) {
return new Promise((res, rej) => {
transform(code, opts, (err, result) => {
if (err == null) res(result);else rej(err);
});
});
}

View File

@@ -23,11 +23,12 @@ let LOADED_PLUGIN;
function loadBlockHoistPlugin() { function loadBlockHoistPlugin() {
if (!LOADED_PLUGIN) { if (!LOADED_PLUGIN) {
const config = (0, _config.default)({ const config = _config.default.sync({
babelrc: false, babelrc: false,
configFile: false, configFile: false,
plugins: [blockHoistPlugin] plugins: [blockHoistPlugin]
}); });
LOADED_PLUGIN = config ? config.passes[0][0] : undefined; LOADED_PLUGIN = config ? config.passes[0][0] : undefined;
if (!LOADED_PLUGIN) throw new Error("Assertion failure"); if (!LOADED_PLUGIN) throw new Error("Assertion failure");
} }

View File

@@ -57,7 +57,9 @@ function _semver() {
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 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 = { const errorVisitor = {
enter(path, state) { enter(path, state) {
@@ -232,7 +234,6 @@ class File {
buildCodeFrameError(node, msg, Error = SyntaxError) { buildCodeFrameError(node, msg, Error = SyntaxError) {
let loc = node && (node.loc || node._loc); let loc = node && (node.loc || node._loc);
msg = `${this.opts.filename}: ${msg}`;
if (!loc && node) { if (!loc && node) {
const state = { const state = {
@@ -253,7 +254,11 @@ class File {
start: { start: {
line: loc.start.line, line: loc.start.line,
column: loc.start.column + 1 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 highlightCode
}); });

View File

@@ -59,7 +59,7 @@ function generateCode(pluginPasses, file) {
result = results[0]; result = results[0];
if (typeof result.then === "function") { if (typeof result.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.`); 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 { } else {
throw new Error("More than one plugin attempted to override codegen."); throw new Error("More than one plugin attempted to override codegen.");

View File

@@ -22,11 +22,9 @@ function mergeSourceMap(inputMap, map) {
const output = buildMappingData(map); const output = buildMappingData(map);
const mergedGenerator = new (_sourceMap().default.SourceMapGenerator)(); const mergedGenerator = new (_sourceMap().default.SourceMapGenerator)();
for (const _ref of input.sources) { for (const {
const { source
source } of input.sources) {
} = _ref;
if (typeof source.content === "string") { if (typeof source.content === "string") {
mergedGenerator.setSourceContent(source.path, source.content); mergedGenerator.setSourceContent(source.path, source.content);
} }
@@ -95,11 +93,9 @@ function makeMappingKey(item) {
function eachOverlappingGeneratedOutputRange(outputFile, inputGeneratedRange, callback) { function eachOverlappingGeneratedOutputRange(outputFile, inputGeneratedRange, callback) {
const overlappingOriginal = filterApplicableOriginalRanges(outputFile, inputGeneratedRange); const overlappingOriginal = filterApplicableOriginalRanges(outputFile, inputGeneratedRange);
for (const _ref2 of overlappingOriginal) { for (const {
const { generated
generated } of overlappingOriginal) {
} = _ref2;
for (const item of generated) { for (const item of generated) {
callback(item); callback(item);
} }
@@ -125,18 +121,14 @@ function filterApplicableOriginalRanges({
} }
function eachInputGeneratedRange(map, callback) { function eachInputGeneratedRange(map, callback) {
for (const _ref3 of map.sources) { for (const {
const { source,
source, mappings
mappings } of map.sources) {
} = _ref3; for (const {
original,
for (const _ref4 of mappings) { generated
const { } of mappings) {
original,
generated
} = _ref4;
for (const item of generated) { for (const item of generated) {
callback(item, original, source); callback(item, original, source);
} }

View File

@@ -3,8 +3,7 @@
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.runAsync = runAsync; exports.run = run;
exports.runSync = runSync;
function _traverse() { function _traverse() {
const data = _interopRequireDefault(require("@babel/traverse")); const data = _interopRequireDefault(require("@babel/traverse"));
@@ -28,26 +27,45 @@ var _generate = _interopRequireDefault(require("./file/generate"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function runAsync(config, code, ast, callback) { function* run(config, code, ast) {
let result; const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
const opts = file.opts;
try { try {
result = runSync(config, code, ast); yield* transformFile(file, config.passes);
} catch (err) { } catch (e) {
return callback(err); 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;
} }
return callback(null, result); 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;
}
function runSync(config, code, ast) {
const file = (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
transformFile(file, config.passes);
const opts = file.opts;
const {
outputCode,
outputMap
} = opts.code !== false ? (0, _generate.default)(config.passes, file) : {};
return { return {
metadata: file.metadata, metadata: file.metadata,
options: opts, options: opts,
@@ -58,7 +76,7 @@ function runSync(config, code, ast) {
}; };
} }
function transformFile(file, pluginPasses) { function* transformFile(file, pluginPasses) {
for (const pluginPairs of pluginPasses) { for (const pluginPairs of pluginPasses) {
const passPairs = []; const passPairs = [];
const passes = []; const passes = [];
@@ -76,6 +94,7 @@ function transformFile(file, pluginPasses) {
if (fn) { if (fn) {
const result = fn.call(pass, file); const result = fn.call(pass, file);
yield* [];
if (isThenable(result)) { 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.`); 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.`);
@@ -92,6 +111,7 @@ function transformFile(file, pluginPasses) {
if (fn) { if (fn) {
const result = fn.call(pass, file); const result = fn.call(pass, file);
yield* [];
if (isThenable(result)) { 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.`); 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.`);

View File

@@ -5,6 +5,16 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.default = normalizeFile; exports.default = normalizeFile;
function _fs() {
const data = _interopRequireDefault(require("fs"));
_fs = function () {
return data;
};
return data;
}
function _path() { function _path() {
const data = _interopRequireDefault(require("path")); const data = _interopRequireDefault(require("path"));
@@ -55,76 +65,21 @@ function _convertSourceMap() {
return data; return data;
} }
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 _file = _interopRequireDefault(require("./file/file")); var _file = _interopRequireDefault(require("./file/file"));
var _missingPluginHelper = _interopRequireDefault(require("./util/missing-plugin-helper")); var _parser = _interopRequireDefault(require("../parser"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 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 }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const debug = (0, _debug().default)("babel:transform:file"); const debug = (0, _debug().default)("babel:transform:file");
const LARGE_INPUT_SOURCEMAP_THRESHOLD = 1000000;
function normalizeFile(pluginPasses, options, code, ast) { function* normalizeFile(pluginPasses, options, code, ast) {
code = `${code || ""}`; code = `${code || ""}`;
let inputMap = null;
if (options.inputSourceMap !== false) {
if (typeof options.inputSourceMap === "object") {
inputMap = _convertSourceMap().default.fromObject(options.inputSourceMap);
}
if (!inputMap) {
try {
inputMap = _convertSourceMap().default.fromSource(code);
if (inputMap) {
code = _convertSourceMap().default.removeComments(code);
}
} catch (err) {
debug("discarding unknown inline input sourcemap", err);
code = _convertSourceMap().default.removeComments(code);
}
}
if (!inputMap) {
if (typeof options.filename === "string") {
try {
inputMap = _convertSourceMap().default.fromMapFileSource(code, _path().default.dirname(options.filename));
if (inputMap) {
code = _convertSourceMap().default.removeMapFileComments(code);
}
} catch (err) {
debug("discarding unknown file input sourcemap", err);
code = _convertSourceMap().default.removeMapFileComments(code);
}
} else {
debug("discarding un-loadable file input sourcemap");
code = _convertSourceMap().default.removeMapFileComments(code);
}
}
}
if (ast) { if (ast) {
if (ast.type === "Program") { if (ast.type === "Program") {
@@ -135,7 +90,49 @@ function normalizeFile(pluginPasses, options, code, ast) {
ast = (0, _cloneDeep().default)(ast); ast = (0, _cloneDeep().default)(ast);
} else { } else {
ast = parser(pluginPasses, options, code); ast = yield* (0, _parser.default)(pluginPasses, options, code);
}
let inputMap = null;
if (options.inputSourceMap !== false) {
if (typeof options.inputSourceMap === "object") {
inputMap = _convertSourceMap().default.fromObject(options.inputSourceMap);
}
if (!inputMap) {
const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast);
if (lastComment) {
try {
inputMap = _convertSourceMap().default.fromComment(lastComment);
} catch (err) {
debug("discarding unknown inline input sourcemap", err);
}
}
}
if (!inputMap) {
const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast);
if (typeof options.filename === "string" && lastComment) {
try {
const match = EXTERNAL_SOURCEMAP_REGEX.exec(lastComment);
const inputMapContent = _fs().default.readFileSync(_path().default.resolve(_path().default.dirname(options.filename), match[1]));
if (inputMapContent.length > LARGE_INPUT_SOURCEMAP_THRESHOLD) {
debug("skip merging input map > 1 MB");
} else {
inputMap = _convertSourceMap().default.fromJSON(inputMapContent);
}
} catch (err) {
debug("discarding unknown file input sourcemap", err);
}
} else if (lastComment) {
debug("discarding un-loadable file input sourcemap");
}
}
} }
return new _file.default(options, { return new _file.default(options, {
@@ -145,67 +142,32 @@ function normalizeFile(pluginPasses, options, code, ast) {
}); });
} }
function parser(pluginPasses, { const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/;
parserOpts, const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/;
highlightCode = true,
filename = "unknown"
}, code) {
try {
const results = [];
for (const plugins of pluginPasses) { function extractCommentsFromList(regex, comments, lastComment) {
for (const plugin of plugins) { if (comments) {
const { comments = comments.filter(({
parserOverride value
} = plugin; }) => {
if (regex.test(value)) {
if (parserOverride) { lastComment = value;
const ast = parserOverride(code, parserOpts, _parser().parse); return false;
if (ast !== undefined) results.push(ast);
}
}
}
if (results.length === 0) {
return (0, _parser().parse)(code, parserOpts);
} else if (results.length === 1) {
if (typeof results[0].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.`);
} }
return results[0]; return true;
} });
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;
} }
return [comments, lastComment];
}
function extractComments(regex, ast) {
let lastComment = null;
t().traverseFast(ast, node => {
[node.leadingComments, lastComment] = extractCommentsFromList(regex, node.leadingComments, lastComment);
[node.innerComments, lastComment] = extractCommentsFromList(regex, node.innerComments, lastComment);
[node.trailingComments, lastComment] = extractCommentsFromList(regex, node.trailingComments, lastComment);
});
return lastComment;
} }

View File

@@ -1 +0,0 @@
../semver/bin/semver

View File

@@ -1,39 +0,0 @@
# changes log
## 5.7
* Add `minVersion` method
## 5.6
* Move boolean `loose` param to an options object, with
backwards-compatibility protection.
* Add ability to opt out of special prerelease version handling with
the `includePrerelease` option flag.
## 5.5
* Add version coercion capabilities
## 5.4
* Add intersection checking
## 5.3
* Add `minSatisfying` method
## 5.2
* Add `prerelease(v)` that returns prerelease components
## 5.1
* Add Backus-Naur for ranges
* Remove excessively cute inspection methods
## 5.0
* Remove AMD/Browserified build artifacts
* Fix ltr and gtr when using the `*` range
* Fix for range `*` with a prerelease identifier

View File

@@ -1,68 +1,70 @@
{ {
"_args": [ "_from": "@babel/core@^7.1.0",
[ "_id": "@babel/core@7.8.4",
"@babel/core@7.5.5",
"/Users/drew.heavner/Documents/Github/upload-google-play"
]
],
"_development": true,
"_from": "@babel/core@7.5.5",
"_id": "@babel/core@7.5.5",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg==", "_integrity": "sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA==",
"_location": "/@babel/core", "_location": "/@babel/core",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "range",
"registry": true, "registry": true,
"raw": "@babel/core@7.5.5", "raw": "@babel/core@^7.1.0",
"name": "@babel/core", "name": "@babel/core",
"escapedName": "@babel%2fcore", "escapedName": "@babel%2fcore",
"scope": "@babel", "scope": "@babel",
"rawSpec": "7.5.5", "rawSpec": "^7.1.0",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "7.5.5" "fetchSpec": "^7.1.0"
}, },
"_requiredBy": [ "_requiredBy": [
"/@jest/transform", "/@jest/transform",
"/jest-config" "/jest-config"
], ],
"_resolved": "https://registry.npmjs.org/@babel/core/-/core-7.5.5.tgz", "_resolved": "https://registry.npmjs.org/@babel/core/-/core-7.8.4.tgz",
"_spec": "7.5.5", "_shasum": "d496799e5c12195b3602d0fddd77294e3e38e80e",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play", "_spec": "@babel/core@^7.1.0",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/@jest/transform",
"author": { "author": {
"name": "Sebastian McKenzie", "name": "Sebastian McKenzie",
"email": "sebmck@gmail.com" "email": "sebmck@gmail.com"
}, },
"browser": { "browser": {
"./lib/config/files/index.js": "./lib/config/files/index-browser.js", "./lib/config/files/index.js": "./lib/config/files/index-browser.js",
"./lib/transform-file.js": "./lib/transform-file-browser.js" "./lib/transform-file.js": "./lib/transform-file-browser.js",
"./src/config/files/index.js": "./src/config/files/index-browser.js",
"./src/transform-file.js": "./src/transform-file-browser.js"
}, },
"bundleDependencies": false,
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.5.5", "@babel/code-frame": "^7.8.3",
"@babel/generator": "^7.5.5", "@babel/generator": "^7.8.4",
"@babel/helpers": "^7.5.5", "@babel/helpers": "^7.8.4",
"@babel/parser": "^7.5.5", "@babel/parser": "^7.8.4",
"@babel/template": "^7.4.4", "@babel/template": "^7.8.3",
"@babel/traverse": "^7.5.5", "@babel/traverse": "^7.8.4",
"@babel/types": "^7.5.5", "@babel/types": "^7.8.3",
"convert-source-map": "^1.1.0", "convert-source-map": "^1.7.0",
"debug": "^4.1.0", "debug": "^4.1.0",
"gensync": "^1.0.0-beta.1",
"json5": "^2.1.0", "json5": "^2.1.0",
"lodash": "^4.17.13", "lodash": "^4.17.13",
"resolve": "^1.3.2", "resolve": "^1.3.2",
"semver": "^5.4.1", "semver": "^5.4.1",
"source-map": "^0.5.0" "source-map": "^0.5.0"
}, },
"deprecated": false,
"description": "Babel compiler core.", "description": "Babel compiler core.",
"devDependencies": { "devDependencies": {
"@babel/helper-transform-fixture-test-runner": "^7.5.5", "@babel/helper-transform-fixture-test-runner": "^7.8.3"
"@babel/register": "^7.5.5"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
}, },
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43", "funding": {
"type": "opencollective",
"url": "https://opencollective.com/babel"
},
"gitHead": "5c2e6bc07fed3d28801d93168622c99ae622653a",
"homepage": "https://babeljs.io/", "homepage": "https://babeljs.io/",
"keywords": [ "keywords": [
"6to5", "6to5",
@@ -89,5 +91,5 @@
"type": "git", "type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-core" "url": "https://github.com/babel/babel/tree/master/packages/babel-core"
}, },
"version": "7.5.5" "version": "7.8.4"
} }

View File

@@ -4,19 +4,6 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = void 0; exports.default = void 0;
function _trimRight() {
const data = _interopRequireDefault(require("trim-right"));
_trimRight = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const SPACES_RE = /^[ \t]+$/; const SPACES_RE = /^[ \t]+$/;
class Buffer { class Buffer {
@@ -44,7 +31,7 @@ class Buffer {
const map = this._map; const map = this._map;
const result = { const result = {
code: (0, _trimRight().default)(this._buf.join("")), code: this._buf.join("").trimRight(),
map: null, map: null,
rawMappings: map && map.getRawMappings() rawMappings: map && map.getRawMappings()
}; };

View File

@@ -11,20 +11,14 @@ exports.ClassMethod = ClassMethod;
exports.ClassPrivateMethod = ClassPrivateMethod; exports.ClassPrivateMethod = ClassPrivateMethod;
exports._classMethodHead = _classMethodHead; exports._classMethodHead = _classMethodHead;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function ClassDeclaration(node, parent) { function ClassDeclaration(node, parent) {
if (!this.format.decoratorsBeforeExport || !t().isExportDefaultDeclaration(parent) && !t().isExportNamedDeclaration(parent)) { if (!this.format.decoratorsBeforeExport || !t.isExportDefaultDeclaration(parent) && !t.isExportNamedDeclaration(parent)) {
this.printJoin(node.decorators, node); this.printJoin(node.decorators, node);
} }
@@ -84,26 +78,7 @@ function ClassBody(node) {
function ClassProperty(node) { function ClassProperty(node) {
this.printJoin(node.decorators, node); this.printJoin(node.decorators, node);
this.tsPrintClassMemberModifiers(node, true);
if (node.accessibility) {
this.word(node.accessibility);
this.space();
}
if (node.static) {
this.word("static");
this.space();
}
if (node.abstract) {
this.word("abstract");
this.space();
}
if (node.readonly) {
this.word("readonly");
this.space();
}
if (node.computed) { if (node.computed) {
this.token("["); this.token("[");
@@ -170,21 +145,7 @@ function ClassPrivateMethod(node) {
function _classMethodHead(node) { function _classMethodHead(node) {
this.printJoin(node.decorators, node); this.printJoin(node.decorators, node);
this.tsPrintClassMemberModifiers(node, false);
if (node.accessibility) {
this.word(node.accessibility);
this.space();
}
if (node.abstract) {
this.word("abstract");
this.space();
}
if (node.static) {
this.word("static");
this.space();
}
this._methodHead(node); this._methodHead(node);
} }

View File

@@ -25,21 +25,16 @@ exports.BindExpression = BindExpression;
exports.MemberExpression = MemberExpression; exports.MemberExpression = MemberExpression;
exports.MetaProperty = MetaProperty; exports.MetaProperty = MetaProperty;
exports.PrivateName = PrivateName; exports.PrivateName = PrivateName;
exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier;
exports.AwaitExpression = exports.YieldExpression = void 0; exports.AwaitExpression = exports.YieldExpression = void 0;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
var n = _interopRequireWildcard(require("../node")); var n = _interopRequireWildcard(require("../node"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 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 UnaryExpression(node) { function UnaryExpression(node) {
if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof" || node.operator === "throw") { if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof" || node.operator === "throw") {
@@ -93,9 +88,9 @@ function NewExpression(node, parent) {
this.space(); this.space();
this.print(node.callee, node); this.print(node.callee, node);
if (this.format.minified && node.arguments.length === 0 && !node.optional && !t().isCallExpression(parent, { if (this.format.minified && node.arguments.length === 0 && !node.optional && !t.isCallExpression(parent, {
callee: node callee: node
}) && !t().isMemberExpression(parent) && !t().isNewExpression(parent)) { }) && !t.isMemberExpression(parent) && !t.isNewExpression(parent)) {
return; return;
} }
@@ -132,13 +127,13 @@ function Decorator(node) {
function OptionalMemberExpression(node) { function OptionalMemberExpression(node) {
this.print(node.object, node); this.print(node.object, node);
if (!node.computed && t().isMemberExpression(node.property)) { if (!node.computed && t.isMemberExpression(node.property)) {
throw new TypeError("Got a MemberExpression for MemberExpression property"); throw new TypeError("Got a MemberExpression for MemberExpression property");
} }
let computed = node.computed; let computed = node.computed;
if (t().isLiteral(node.property) && typeof node.property.value === "number") { if (t.isLiteral(node.property) && typeof node.property.value === "number") {
computed = true; computed = true;
} }
@@ -260,13 +255,13 @@ function BindExpression(node) {
function MemberExpression(node) { function MemberExpression(node) {
this.print(node.object, node); this.print(node.object, node);
if (!node.computed && t().isMemberExpression(node.property)) { if (!node.computed && t.isMemberExpression(node.property)) {
throw new TypeError("Got a MemberExpression for MemberExpression property"); throw new TypeError("Got a MemberExpression for MemberExpression property");
} }
let computed = node.computed; let computed = node.computed;
if (t().isLiteral(node.property) && typeof node.property.value === "number") { if (t.isLiteral(node.property) && typeof node.property.value === "number") {
computed = true; computed = true;
} }
@@ -289,4 +284,9 @@ function MetaProperty(node) {
function PrivateName(node) { function PrivateName(node) {
this.token("#"); this.token("#");
this.print(node.id, node); this.print(node.id, node);
}
function V8IntrinsicIdentifier(node) {
this.token("%");
this.word(node.name);
} }

View File

@@ -20,6 +20,15 @@ exports.DeclareOpaqueType = DeclareOpaqueType;
exports.DeclareVariable = DeclareVariable; exports.DeclareVariable = DeclareVariable;
exports.DeclareExportDeclaration = DeclareExportDeclaration; exports.DeclareExportDeclaration = DeclareExportDeclaration;
exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration; exports.DeclareExportAllDeclaration = DeclareExportAllDeclaration;
exports.EnumDeclaration = EnumDeclaration;
exports.EnumBooleanBody = EnumBooleanBody;
exports.EnumNumberBody = EnumNumberBody;
exports.EnumStringBody = EnumStringBody;
exports.EnumSymbolBody = EnumSymbolBody;
exports.EnumDefaultedMember = EnumDefaultedMember;
exports.EnumBooleanMember = EnumBooleanMember;
exports.EnumNumberMember = EnumNumberMember;
exports.EnumStringMember = EnumStringMember;
exports.ExistsTypeAnnotation = ExistsTypeAnnotation; exports.ExistsTypeAnnotation = ExistsTypeAnnotation;
exports.FunctionTypeAnnotation = FunctionTypeAnnotation; exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
exports.FunctionTypeParam = FunctionTypeParam; exports.FunctionTypeParam = FunctionTypeParam;
@@ -66,21 +75,15 @@ Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
} }
}); });
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
var _modules = require("./modules"); var _modules = require("./modules");
var _types2 = require("./types"); var _types2 = require("./types");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 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 AnyTypeAnnotation() { function AnyTypeAnnotation() {
this.word("any"); this.word("any");
@@ -105,7 +108,7 @@ function NullLiteralTypeAnnotation() {
} }
function DeclareClass(node, parent) { function DeclareClass(node, parent) {
if (!t().isDeclareExportDeclaration(parent)) { if (!t.isDeclareExportDeclaration(parent)) {
this.word("declare"); this.word("declare");
this.space(); this.space();
} }
@@ -117,7 +120,7 @@ function DeclareClass(node, parent) {
} }
function DeclareFunction(node, parent) { function DeclareFunction(node, parent) {
if (!t().isDeclareExportDeclaration(parent)) { if (!t.isDeclareExportDeclaration(parent)) {
this.word("declare"); this.word("declare");
this.space(); this.space();
} }
@@ -180,7 +183,7 @@ function DeclareTypeAlias(node) {
} }
function DeclareOpaqueType(node, parent) { function DeclareOpaqueType(node, parent) {
if (!t().isDeclareExportDeclaration(parent)) { if (!t.isDeclareExportDeclaration(parent)) {
this.word("declare"); this.word("declare");
this.space(); this.space();
} }
@@ -189,7 +192,7 @@ function DeclareOpaqueType(node, parent) {
} }
function DeclareVariable(node, parent) { function DeclareVariable(node, parent) {
if (!t().isDeclareExportDeclaration(parent)) { if (!t.isDeclareExportDeclaration(parent)) {
this.word("declare"); this.word("declare");
this.space(); this.space();
} }
@@ -222,11 +225,112 @@ function DeclareExportAllDeclaration() {
_modules.ExportAllDeclaration.apply(this, arguments); _modules.ExportAllDeclaration.apply(this, arguments);
} }
function EnumDeclaration(node) {
const {
id,
body
} = node;
this.word("enum");
this.space();
this.print(id, node);
this.print(body, node);
}
function enumExplicitType(context, name, hasExplicitType) {
if (hasExplicitType) {
context.space();
context.word("of");
context.space();
context.word(name);
}
context.space();
}
function enumBody(context, node) {
const {
members
} = node;
context.token("{");
context.indent();
context.newline();
for (const member of members) {
context.print(member, node);
context.newline();
}
context.dedent();
context.token("}");
}
function EnumBooleanBody(node) {
const {
explicitType
} = node;
enumExplicitType(this, "boolean", explicitType);
enumBody(this, node);
}
function EnumNumberBody(node) {
const {
explicitType
} = node;
enumExplicitType(this, "number", explicitType);
enumBody(this, node);
}
function EnumStringBody(node) {
const {
explicitType
} = node;
enumExplicitType(this, "string", explicitType);
enumBody(this, node);
}
function EnumSymbolBody(node) {
enumExplicitType(this, "symbol", true);
enumBody(this, node);
}
function EnumDefaultedMember(node) {
const {
id
} = node;
this.print(id, node);
this.token(",");
}
function enumInitializedMember(context, node) {
const {
id,
init
} = node;
context.print(id, node);
context.space();
context.token("=");
context.space();
context.print(init, node);
context.token(",");
}
function EnumBooleanMember(node) {
enumInitializedMember(this, node);
}
function EnumNumberMember(node) {
enumInitializedMember(this, node);
}
function EnumStringMember(node) {
enumInitializedMember(this, node);
}
function FlowExportDeclaration(node) { function FlowExportDeclaration(node) {
if (node.declaration) { if (node.declaration) {
const declar = node.declaration; const declar = node.declaration;
this.print(declar, node); this.print(declar, node);
if (!t().isStatement(declar)) this.semicolon(); if (!t.isStatement(declar)) this.semicolon();
} else { } else {
this.token("{"); this.token("{");

View File

@@ -12,17 +12,11 @@ exports._functionHead = _functionHead;
exports.FunctionDeclaration = exports.FunctionExpression = FunctionExpression; exports.FunctionDeclaration = exports.FunctionExpression = FunctionExpression;
exports.ArrowFunctionExpression = ArrowFunctionExpression; exports.ArrowFunctionExpression = ArrowFunctionExpression;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _params(node) { function _params(node) {
this.print(node.typeParameters, node); this.print(node.typeParameters, node);
@@ -132,7 +126,7 @@ function ArrowFunctionExpression(node) {
const firstParam = node.params[0]; const firstParam = node.params[0];
if (node.params.length === 1 && t().isIdentifier(firstParam) && !hasTypes(node, firstParam)) { if (node.params.length === 1 && t.isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
if (this.format.retainLines && node.loc && node.body.loc && node.loc.start.line < node.body.loc.start.line) { if (this.format.retainLines && node.loc && node.body.loc && node.loc.start.line < node.body.loc.start.line) {
this.token("("); this.token("(");

View File

@@ -14,17 +14,11 @@ exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
exports.ImportDeclaration = ImportDeclaration; exports.ImportDeclaration = ImportDeclaration;
exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function ImportSpecifier(node) { function ImportSpecifier(node) {
if (node.importKind === "type" || node.importKind === "typeof") { if (node.importKind === "type" || node.importKind === "typeof") {
@@ -87,7 +81,7 @@ function ExportAllDeclaration(node) {
} }
function ExportNamedDeclaration(node) { function ExportNamedDeclaration(node) {
if (this.format.decoratorsBeforeExport && t().isClassDeclaration(node.declaration)) { if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node); this.printJoin(node.declaration.decorators, node);
} }
@@ -97,7 +91,7 @@ function ExportNamedDeclaration(node) {
} }
function ExportDefaultDeclaration(node) { function ExportDefaultDeclaration(node) {
if (this.format.decoratorsBeforeExport && t().isClassDeclaration(node.declaration)) { if (this.format.decoratorsBeforeExport && t.isClassDeclaration(node.declaration)) {
this.printJoin(node.declaration.decorators, node); this.printJoin(node.declaration.decorators, node);
} }
@@ -112,7 +106,7 @@ function ExportDeclaration(node) {
if (node.declaration) { if (node.declaration) {
const declar = node.declaration; const declar = node.declaration;
this.print(declar, node); this.print(declar, node);
if (!t().isStatement(declar)) this.semicolon(); if (!t.isStatement(declar)) this.semicolon();
} else { } else {
if (node.exportKind === "type") { if (node.exportKind === "type") {
this.word("type"); this.word("type");
@@ -125,7 +119,7 @@ function ExportDeclaration(node) {
while (true) { while (true) {
const first = specifiers[0]; const first = specifiers[0];
if (t().isExportDefaultSpecifier(first) || t().isExportNamespaceSpecifier(first)) { if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) {
hasSpecial = true; hasSpecial = true;
this.print(specifiers.shift(), node); this.print(specifiers.shift(), node);
@@ -176,7 +170,7 @@ function ImportDeclaration(node) {
while (true) { while (true) {
const first = specifiers[0]; const first = specifiers[0];
if (t().isImportDefaultSpecifier(first) || t().isImportNamespaceSpecifier(first)) { if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) {
this.print(specifiers.shift(), node); this.print(specifiers.shift(), node);
if (specifiers.length) { if (specifiers.length) {

View File

@@ -18,17 +18,11 @@ exports.VariableDeclaration = VariableDeclaration;
exports.VariableDeclarator = VariableDeclarator; exports.VariableDeclarator = VariableDeclarator;
exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForOfStatement = exports.ForInStatement = void 0; exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForOfStatement = exports.ForInStatement = void 0;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function WithStatement(node) { function WithStatement(node) {
this.word("with"); this.word("with");
@@ -46,7 +40,7 @@ function IfStatement(node) {
this.print(node.test, node); this.print(node.test, node);
this.token(")"); this.token(")");
this.space(); this.space();
const needsBlock = node.alternate && t().isIfStatement(getLastStatement(node.consequent)); const needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent));
if (needsBlock) { if (needsBlock) {
this.token("{"); this.token("{");
@@ -71,7 +65,7 @@ function IfStatement(node) {
} }
function getLastStatement(statement) { function getLastStatement(statement) {
if (!t().isStatement(statement.body)) return statement; if (!t.isStatement(statement.body)) return statement;
return getLastStatement(statement.body); return getLastStatement(statement.body);
} }
@@ -280,7 +274,7 @@ function VariableDeclaration(node, parent) {
this.space(); this.space();
let hasInits = false; let hasInits = false;
if (!t().isFor(parent)) { if (!t.isFor(parent)) {
for (const declar of node.declarations) { for (const declar of node.declarations) {
if (declar.init) { if (declar.init) {
hasInits = true; hasInits = true;
@@ -298,7 +292,7 @@ function VariableDeclaration(node, parent) {
separator separator
}); });
if (t().isFor(parent)) { if (t.isFor(parent)) {
if (parent.left === node || parent.init === node) return; if (parent.left === node || parent.init === node) return;
} }

View File

@@ -20,29 +20,15 @@ exports.PipelineTopicExpression = PipelineTopicExpression;
exports.PipelineBareFunction = PipelineBareFunction; exports.PipelineBareFunction = PipelineBareFunction;
exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference; exports.PipelinePrimaryTopicReference = PipelinePrimaryTopicReference;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { var _jsesc = _interopRequireDefault(require("jsesc"));
return data;
};
return data;
}
function _jsesc() {
const data = _interopRequireDefault(require("jsesc"));
_jsesc = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 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 Identifier(node) { function Identifier(node) {
this.exactSource(node.loc, () => { this.exactSource(node.loc, () => {
@@ -93,14 +79,14 @@ function ObjectProperty(node) {
this.print(node.key, node); this.print(node.key, node);
this.token("]"); this.token("]");
} else { } else {
if (t().isAssignmentPattern(node.value) && t().isIdentifier(node.key) && node.key.name === node.value.left.name) { if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) {
this.print(node.value, node); this.print(node.value, node);
return; return;
} }
this.print(node.key, node); this.print(node.key, node);
if (node.shorthand && t().isIdentifier(node.key) && t().isIdentifier(node.value) && node.key.name === node.value.name) { if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) {
return; return;
} }
} }
@@ -170,7 +156,7 @@ function StringLiteral(node) {
opts.json = true; opts.json = true;
} }
const val = (0, _jsesc().default)(node.value, opts); const val = (0, _jsesc.default)(node.value, opts);
return this.token(val); return this.token(val);
} }

View File

@@ -17,6 +17,7 @@ exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName;
exports.TSMethodSignature = TSMethodSignature; exports.TSMethodSignature = TSMethodSignature;
exports.TSIndexSignature = TSIndexSignature; exports.TSIndexSignature = TSIndexSignature;
exports.TSAnyKeyword = TSAnyKeyword; exports.TSAnyKeyword = TSAnyKeyword;
exports.TSBigIntKeyword = TSBigIntKeyword;
exports.TSUnknownKeyword = TSUnknownKeyword; exports.TSUnknownKeyword = TSUnknownKeyword;
exports.TSNumberKeyword = TSNumberKeyword; exports.TSNumberKeyword = TSNumberKeyword;
exports.TSObjectKeyword = TSObjectKeyword; exports.TSObjectKeyword = TSObjectKeyword;
@@ -68,6 +69,7 @@ exports.TSNonNullExpression = TSNonNullExpression;
exports.TSExportAssignment = TSExportAssignment; exports.TSExportAssignment = TSExportAssignment;
exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration; exports.TSNamespaceExportDeclaration = TSNamespaceExportDeclaration;
exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase; exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase;
exports.tsPrintClassMemberModifiers = tsPrintClassMemberModifiers;
function TSTypeAnnotation(node) { function TSTypeAnnotation(node) {
this.token(":"); this.token(":");
@@ -139,12 +141,14 @@ function TSQualifiedName(node) {
function TSCallSignatureDeclaration(node) { function TSCallSignatureDeclaration(node) {
this.tsPrintSignatureDeclarationBase(node); this.tsPrintSignatureDeclarationBase(node);
this.token(";");
} }
function TSConstructSignatureDeclaration(node) { function TSConstructSignatureDeclaration(node) {
this.word("new"); this.word("new");
this.space(); this.space();
this.tsPrintSignatureDeclarationBase(node); this.tsPrintSignatureDeclarationBase(node);
this.token(";");
} }
function TSPropertySignature(node) { function TSPropertySignature(node) {
@@ -216,6 +220,10 @@ function TSAnyKeyword() {
this.word("any"); this.word("any");
} }
function TSBigIntKeyword() {
this.word("bigint");
}
function TSUnknownKeyword() { function TSUnknownKeyword() {
this.word("unknown"); this.word("unknown");
} }
@@ -293,11 +301,19 @@ function TSTypeReference(node) {
} }
function TSTypePredicate(node) { function TSTypePredicate(node) {
if (node.asserts) {
this.word("asserts");
this.space();
}
this.print(node.parameterName); this.print(node.parameterName);
this.space();
this.word("is"); if (node.typeAnnotation) {
this.space(); this.space();
this.print(node.typeAnnotation.typeAnnotation); this.word("is");
this.space();
this.print(node.typeAnnotation.typeAnnotation);
}
} }
function TSTypeQuery(node) { function TSTypeQuery(node) {
@@ -712,4 +728,31 @@ function tsPrintSignatureDeclarationBase(node) {
this.token(")"); this.token(")");
this.print(node.typeAnnotation, node); this.print(node.typeAnnotation, node);
}
function tsPrintClassMemberModifiers(node, isField) {
if (isField && node.declare) {
this.word("declare");
this.space();
}
if (node.accessibility) {
this.word(node.accessibility);
this.space();
}
if (node.static) {
this.word("static");
this.space();
}
if (node.abstract) {
this.word("abstract");
this.space();
}
if (isField && node.readonly) {
this.word("readonly");
this.space();
}
} }

View File

@@ -12,17 +12,11 @@ var whitespace = _interopRequireWildcard(require("./whitespace"));
var parens = _interopRequireWildcard(require("./parentheses")); var parens = _interopRequireWildcard(require("./parentheses"));
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function expandAliases(obj) { function expandAliases(obj) {
const newObj = {}; const newObj = {};
@@ -36,7 +30,7 @@ function expandAliases(obj) {
} }
for (const type of Object.keys(obj)) { for (const type of Object.keys(obj)) {
const aliases = t().FLIPPED_ALIAS_KEYS[type]; const aliases = t.FLIPPED_ALIAS_KEYS[type];
if (aliases) { if (aliases) {
for (const alias of aliases) { for (const alias of aliases) {
@@ -60,11 +54,11 @@ function find(obj, node, parent, printStack) {
} }
function isOrHasCallExpression(node) { function isOrHasCallExpression(node) {
if (t().isCallExpression(node)) { if (t.isCallExpression(node)) {
return true; return true;
} }
if (t().isMemberExpression(node)) { if (t.isMemberExpression(node)) {
return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property); return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);
} else { } else {
return false; return false;
@@ -74,7 +68,7 @@ function isOrHasCallExpression(node) {
function needsWhitespace(node, parent, type) { function needsWhitespace(node, parent, type) {
if (!node) return 0; if (!node) return 0;
if (t().isExpressionStatement(node)) { if (t.isExpressionStatement(node)) {
node = node.expression; node = node.expression;
} }
@@ -109,9 +103,10 @@ function needsWhitespaceAfter(node, parent) {
function needsParens(node, parent, printStack) { function needsParens(node, parent, printStack) {
if (!parent) return false; if (!parent) return false;
if (t().isNewExpression(parent) && parent.callee === node) { if (t.isNewExpression(parent) && parent.callee === node) {
if (isOrHasCallExpression(node)) return true; if (isOrHasCallExpression(node)) return true;
} }
if (t.isLogicalExpression(node) && parent.operator === "??") return true;
return find(expandedParens, node, parent, printStack); return find(expandedParens, node, parent, printStack);
} }

View File

@@ -25,20 +25,15 @@ exports.OptionalMemberExpression = OptionalMemberExpression;
exports.AssignmentExpression = AssignmentExpression; exports.AssignmentExpression = AssignmentExpression;
exports.NewExpression = NewExpression; exports.NewExpression = NewExpression;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
const PRECEDENCE = { const PRECEDENCE = {
"||": 0, "||": 0,
"??": 0,
"&&": 1, "&&": 1,
"|": 2, "|": 2,
"^": 3, "^": 3,
@@ -64,22 +59,22 @@ const PRECEDENCE = {
"**": 10 "**": 10
}; };
const isClassExtendsClause = (node, parent) => (t().isClassDeclaration(parent) || t().isClassExpression(parent)) && parent.superClass === node; const isClassExtendsClause = (node, parent) => (t.isClassDeclaration(parent) || t.isClassExpression(parent)) && parent.superClass === node;
function NullableTypeAnnotation(node, parent) { function NullableTypeAnnotation(node, parent) {
return t().isArrayTypeAnnotation(parent); return t.isArrayTypeAnnotation(parent);
} }
function FunctionTypeAnnotation(node, parent) { function FunctionTypeAnnotation(node, parent, printStack) {
return t().isUnionTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isArrayTypeAnnotation(parent); return t.isUnionTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isArrayTypeAnnotation(parent) || t.isTypeAnnotation(parent) && t.isArrowFunctionExpression(printStack[printStack.length - 3]);
} }
function UpdateExpression(node, parent) { function UpdateExpression(node, parent) {
return t().isMemberExpression(parent, { return t.isMemberExpression(parent, {
object: node object: node
}) || t().isCallExpression(parent, { }) || t.isCallExpression(parent, {
callee: node callee: node
}) || t().isNewExpression(parent, { }) || t.isNewExpression(parent, {
callee: node callee: node
}) || isClassExtendsClause(node, parent); }) || isClassExtendsClause(node, parent);
} }
@@ -95,7 +90,7 @@ function DoExpression(node, parent, printStack) {
} }
function Binary(node, parent) { function Binary(node, parent) {
if (node.operator === "**" && t().isBinaryExpression(parent, { if (node.operator === "**" && t.isBinaryExpression(parent, {
operator: "**" operator: "**"
})) { })) {
return parent.left === node; return parent.left === node;
@@ -105,17 +100,17 @@ function Binary(node, parent) {
return true; return true;
} }
if ((t().isCallExpression(parent) || t().isNewExpression(parent)) && parent.callee === node || t().isUnaryLike(parent) || t().isMemberExpression(parent) && parent.object === node || t().isAwaitExpression(parent)) { if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isUnaryLike(parent) || t.isMemberExpression(parent) && parent.object === node || t.isAwaitExpression(parent)) {
return true; return true;
} }
if (t().isBinary(parent)) { if (t.isBinary(parent)) {
const parentOp = parent.operator; const parentOp = parent.operator;
const parentPos = PRECEDENCE[parentOp]; const parentPos = PRECEDENCE[parentOp];
const nodeOp = node.operator; const nodeOp = node.operator;
const nodePos = PRECEDENCE[nodeOp]; const nodePos = PRECEDENCE[nodeOp];
if (parentPos === nodePos && parent.right === node && !t().isLogicalExpression(parent) || parentPos > nodePos) { if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent) || parentPos > nodePos) {
return true; return true;
} }
} }
@@ -124,7 +119,7 @@ function Binary(node, parent) {
} }
function UnionTypeAnnotation(node, parent) { function UnionTypeAnnotation(node, parent) {
return t().isArrayTypeAnnotation(parent) || t().isNullableTypeAnnotation(parent) || t().isIntersectionTypeAnnotation(parent) || t().isUnionTypeAnnotation(parent); return t.isArrayTypeAnnotation(parent) || t.isNullableTypeAnnotation(parent) || t.isIntersectionTypeAnnotation(parent) || t.isUnionTypeAnnotation(parent);
} }
function TSAsExpression() { function TSAsExpression() {
@@ -136,15 +131,15 @@ function TSTypeAssertion() {
} }
function TSUnionType(node, parent) { function TSUnionType(node, parent) {
return t().isTSArrayType(parent) || t().isTSOptionalType(parent) || t().isTSIntersectionType(parent) || t().isTSUnionType(parent) || t().isTSRestType(parent); return t.isTSArrayType(parent) || t.isTSOptionalType(parent) || t.isTSIntersectionType(parent) || t.isTSUnionType(parent) || t.isTSRestType(parent);
} }
function BinaryExpression(node, parent) { function BinaryExpression(node, parent) {
return node.operator === "in" && (t().isVariableDeclarator(parent) || t().isFor(parent)); return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent));
} }
function SequenceExpression(node, parent) { function SequenceExpression(node, parent) {
if (t().isForStatement(parent) || t().isThrowStatement(parent) || t().isReturnStatement(parent) || t().isIfStatement(parent) && parent.test === node || t().isWhileStatement(parent) && parent.test === node || t().isForInStatement(parent) && parent.right === node || t().isSwitchStatement(parent) && parent.discriminant === node || t().isExpressionStatement(parent) && parent.expression === node) { if (t.isForStatement(parent) || t.isThrowStatement(parent) || t.isReturnStatement(parent) || t.isIfStatement(parent) && parent.test === node || t.isWhileStatement(parent) && parent.test === node || t.isForInStatement(parent) && parent.right === node || t.isSwitchStatement(parent) && parent.discriminant === node || t.isExpressionStatement(parent) && parent.expression === node) {
return false; return false;
} }
@@ -152,7 +147,7 @@ function SequenceExpression(node, parent) {
} }
function YieldExpression(node, parent) { function YieldExpression(node, parent) {
return t().isBinary(parent) || t().isUnaryLike(parent) || t().isCallExpression(parent) || t().isMemberExpression(parent) || t().isNewExpression(parent) || t().isAwaitExpression(parent) && t().isYieldExpression(node) || t().isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent); return t.isBinary(parent) || t.isUnaryLike(parent) || t.isCallExpression(parent) || t.isMemberExpression(parent) || t.isNewExpression(parent) || t.isAwaitExpression(parent) && t.isYieldExpression(node) || t.isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent);
} }
function ClassExpression(node, parent, printStack) { function ClassExpression(node, parent, printStack) {
@@ -162,13 +157,13 @@ function ClassExpression(node, parent, printStack) {
} }
function UnaryLike(node, parent) { function UnaryLike(node, parent) {
return t().isMemberExpression(parent, { return t.isMemberExpression(parent, {
object: node object: node
}) || t().isCallExpression(parent, { }) || t.isCallExpression(parent, {
callee: node callee: node
}) || t().isNewExpression(parent, { }) || t.isNewExpression(parent, {
callee: node callee: node
}) || t().isBinaryExpression(parent, { }) || t.isBinaryExpression(parent, {
operator: "**", operator: "**",
left: node left: node
}) || isClassExtendsClause(node, parent); }) || isClassExtendsClause(node, parent);
@@ -181,13 +176,13 @@ function FunctionExpression(node, parent, printStack) {
} }
function ArrowFunctionExpression(node, parent) { function ArrowFunctionExpression(node, parent) {
return t().isExportDeclaration(parent) || ConditionalExpression(node, parent); return t.isExportDeclaration(parent) || ConditionalExpression(node, parent);
} }
function ConditionalExpression(node, parent) { function ConditionalExpression(node, parent) {
if (t().isUnaryLike(parent) || t().isBinary(parent) || t().isConditionalExpression(parent, { if (t.isUnaryLike(parent) || t.isBinary(parent) || t.isConditionalExpression(parent, {
test: node test: node
}) || t().isAwaitExpression(parent) || t().isOptionalMemberExpression(parent) || t().isTaggedTemplateExpression(parent) || t().isTSTypeAssertion(parent) || t().isTSAsExpression(parent)) { }) || t.isAwaitExpression(parent) || t.isOptionalMemberExpression(parent) || t.isTaggedTemplateExpression(parent) || t.isTSTypeAssertion(parent) || t.isTSAsExpression(parent)) {
return true; return true;
} }
@@ -195,11 +190,11 @@ function ConditionalExpression(node, parent) {
} }
function OptionalMemberExpression(node, parent) { function OptionalMemberExpression(node, parent) {
return t().isCallExpression(parent) || t().isMemberExpression(parent); return t.isCallExpression(parent) || t.isMemberExpression(parent);
} }
function AssignmentExpression(node) { function AssignmentExpression(node) {
if (t().isObjectPattern(node.left)) { if (t.isObjectPattern(node.left)) {
return true; return true;
} else { } else {
return ConditionalExpression(...arguments); return ConditionalExpression(...arguments);
@@ -220,25 +215,25 @@ function isFirstInStatement(printStack, {
let parent = printStack[i]; let parent = printStack[i];
while (i > 0) { while (i > 0) {
if (t().isExpressionStatement(parent, { if (t.isExpressionStatement(parent, {
expression: node expression: node
}) || t().isTaggedTemplateExpression(parent) || considerDefaultExports && t().isExportDefaultDeclaration(parent, { }) || t.isTaggedTemplateExpression(parent) || considerDefaultExports && t.isExportDefaultDeclaration(parent, {
declaration: node declaration: node
}) || considerArrow && t().isArrowFunctionExpression(parent, { }) || considerArrow && t.isArrowFunctionExpression(parent, {
body: node body: node
})) { })) {
return true; return true;
} }
if (t().isCallExpression(parent, { if (t.isCallExpression(parent, {
callee: node callee: node
}) || t().isSequenceExpression(parent) && parent.expressions[0] === node || t().isMemberExpression(parent, { }) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isMemberExpression(parent, {
object: node object: node
}) || t().isConditional(parent, { }) || t.isConditional(parent, {
test: node test: node
}) || t().isBinary(parent, { }) || t.isBinary(parent, {
left: node left: node
}) || t().isAssignmentExpression(parent, { }) || t.isAssignmentExpression(parent, {
left: node left: node
})) { })) {
node = parent; node = parent;

View File

@@ -5,31 +5,25 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.list = exports.nodes = void 0; exports.list = exports.nodes = void 0;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function crawl(node, state = {}) { function crawl(node, state = {}) {
if (t().isMemberExpression(node)) { if (t.isMemberExpression(node)) {
crawl(node.object, state); crawl(node.object, state);
if (node.computed) crawl(node.property, state); if (node.computed) crawl(node.property, state);
} else if (t().isBinary(node) || t().isAssignmentExpression(node)) { } else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
crawl(node.left, state); crawl(node.left, state);
crawl(node.right, state); crawl(node.right, state);
} else if (t().isCallExpression(node)) { } else if (t.isCallExpression(node)) {
state.hasCall = true; state.hasCall = true;
crawl(node.callee, state); crawl(node.callee, state);
} else if (t().isFunction(node)) { } else if (t.isFunction(node)) {
state.hasFunction = true; state.hasFunction = true;
} else if (t().isIdentifier(node)) { } else if (t.isIdentifier(node)) {
state.hasHelper = state.hasHelper || isHelper(node.callee); state.hasHelper = state.hasHelper || isHelper(node.callee);
} }
@@ -37,21 +31,21 @@ function crawl(node, state = {}) {
} }
function isHelper(node) { function isHelper(node) {
if (t().isMemberExpression(node)) { if (t.isMemberExpression(node)) {
return isHelper(node.object) || isHelper(node.property); return isHelper(node.object) || isHelper(node.property);
} else if (t().isIdentifier(node)) { } else if (t.isIdentifier(node)) {
return node.name === "require" || node.name[0] === "_"; return node.name === "require" || node.name[0] === "_";
} else if (t().isCallExpression(node)) { } else if (t.isCallExpression(node)) {
return isHelper(node.callee); return isHelper(node.callee);
} else if (t().isBinary(node) || t().isAssignmentExpression(node)) { } else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
return t().isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right); return t.isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
} else { } else {
return false; return false;
} }
} }
function isType(node) { function isType(node) {
return t().isLiteral(node) || t().isObjectExpression(node) || t().isArrayExpression(node) || t().isIdentifier(node) || t().isMemberExpression(node); return t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) || t.isIdentifier(node) || t.isMemberExpression(node);
} }
const nodes = { const nodes = {
@@ -74,7 +68,7 @@ const nodes = {
}, },
LogicalExpression(node) { LogicalExpression(node) {
if (t().isFunction(node.left) || t().isFunction(node.right)) { if (t.isFunction(node.left) || t.isFunction(node.right)) {
return { return {
after: true after: true
}; };
@@ -90,7 +84,7 @@ const nodes = {
}, },
CallExpression(node) { CallExpression(node) {
if (t().isFunction(node.callee) || isHelper(node)) { if (t.isFunction(node.callee) || isHelper(node)) {
return { return {
before: true, before: true,
after: true after: true
@@ -118,7 +112,7 @@ const nodes = {
}, },
IfStatement(node) { IfStatement(node) {
if (t().isBlockStatement(node.consequent)) { if (t.isBlockStatement(node.consequent)) {
return { return {
before: true, before: true,
after: true after: true
@@ -184,7 +178,7 @@ exports.list = list;
}; };
} }
[type].concat(t().FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { [type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
nodes[type] = function () { nodes[type] = function () {
return amounts; return amounts;
}; };

View File

@@ -5,43 +5,21 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.default = void 0; exports.default = void 0;
function _isInteger() { var _isInteger = _interopRequireDefault(require("lodash/isInteger"));
const data = _interopRequireDefault(require("lodash/isInteger"));
_isInteger = function () { var _repeat = _interopRequireDefault(require("lodash/repeat"));
return data;
};
return data;
}
function _repeat() {
const data = _interopRequireDefault(require("lodash/repeat"));
_repeat = function () {
return data;
};
return data;
}
var _buffer = _interopRequireDefault(require("./buffer")); var _buffer = _interopRequireDefault(require("./buffer"));
var n = _interopRequireWildcard(require("./node")); var n = _interopRequireWildcard(require("./node"));
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
var generatorFunctions = _interopRequireWildcard(require("./generators")); var generatorFunctions = _interopRequireWildcard(require("./generators"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } 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 }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -120,7 +98,7 @@ class Printer {
number(str) { number(str) {
this.word(str); this.word(str);
this._endsWithInteger = (0, _isInteger().default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== "."; this._endsWithInteger = (0, _isInteger.default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
} }
token(str) { token(str) {
@@ -239,7 +217,7 @@ class Printer {
} }
_getIndent() { _getIndent() {
return (0, _repeat().default)(this.format.indent.style, this._indent); return (0, _repeat.default)(this.format.indent.style, this._indent);
} }
startTerminatorless(isLabel = false) { startTerminatorless(isLabel = false) {
@@ -294,7 +272,7 @@ class Printer {
this._printLeadingComments(node); this._printLeadingComments(node);
const loc = t().isProgram(node) || t().isFile(node) ? null : node.loc; const loc = t.isProgram(node) || t.isFile(node) ? null : node.loc;
this.withSource("start", loc, () => { this.withSource("start", loc, () => {
printMethod.call(this, node, parent); printMethod.call(this, node, parent);
}); });
@@ -385,7 +363,7 @@ class Printer {
printBlock(parent) { printBlock(parent) {
const node = parent.body; const node = parent.body;
if (!t().isEmptyStatement(node)) { if (!t.isEmptyStatement(node)) {
this.space(); this.space();
} }
@@ -472,7 +450,7 @@ class Printer {
} }
const indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn()); const indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn());
val = val.replace(/\n(?!$)/g, `\n${(0, _repeat().default)(" ", indentSize)}`); val = val.replace(/\n(?!$)/g, `\n${(0, _repeat.default)(" ", indentSize)}`);
} }
if (this.endsWith("/")) this._space(); if (this.endsWith("/")) this._space();

View File

@@ -5,15 +5,7 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.default = void 0; exports.default = void 0;
function _sourceMap() { var _sourceMap = _interopRequireDefault(require("source-map"));
const data = _interopRequireDefault(require("source-map"));
_sourceMap = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -27,20 +19,20 @@ class SourceMap {
get() { get() {
if (!this._cachedMap) { if (!this._cachedMap) {
const map = this._cachedMap = new (_sourceMap().default.SourceMapGenerator)({ const map = this._cachedMap = new _sourceMap.default.SourceMapGenerator({
sourceRoot: this._opts.sourceRoot sourceRoot: this._opts.sourceRoot
}); });
const code = this._code; const code = this._code;
if (typeof code === "string") { if (typeof code === "string") {
map.setSourceContent(this._opts.sourceFileName, code); map.setSourceContent(this._opts.sourceFileName.replace(/\\/g, "/"), code);
} else if (typeof code === "object") { } else if (typeof code === "object") {
Object.keys(code).forEach(sourceFileName => { Object.keys(code).forEach(sourceFileName => {
map.setSourceContent(sourceFileName, code[sourceFileName]); map.setSourceContent(sourceFileName.replace(/\\/g, "/"), code[sourceFileName]);
}); });
} }
this._rawMappings.forEach(map.addMapping, map); this._rawMappings.forEach(mapping => map.addMapping(mapping), map);
} }
return this._cachedMap.toJSON(); return this._cachedMap.toJSON();
@@ -68,7 +60,7 @@ class SourceMap {
line: generatedLine, line: generatedLine,
column: generatedColumn column: generatedColumn
}, },
source: line == null ? undefined : filename || this._opts.sourceFileName, source: line == null ? undefined : (filename || this._opts.sourceFileName).replace(/\\/g, "/"),
original: line == null ? undefined : { original: line == null ? undefined : {
line: line, line: line,
column: column column: column

View File

@@ -1,56 +1,51 @@
{ {
"_args": [ "_from": "@babel/generator@^7.8.4",
[ "_id": "@babel/generator@7.8.4",
"@babel/generator@7.5.5",
"/Users/drew.heavner/Documents/Github/upload-google-play"
]
],
"_development": true,
"_from": "@babel/generator@7.5.5",
"_id": "@babel/generator@7.5.5",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ==", "_integrity": "sha512-PwhclGdRpNAf3IxZb0YVuITPZmmrXz9zf6fH8lT4XbrmfQKr6ryBzhv593P5C6poJRciFCL/eHGW2NuGrgEyxA==",
"_location": "/@babel/generator", "_location": "/@babel/generator",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "range",
"registry": true, "registry": true,
"raw": "@babel/generator@7.5.5", "raw": "@babel/generator@^7.8.4",
"name": "@babel/generator", "name": "@babel/generator",
"escapedName": "@babel%2fgenerator", "escapedName": "@babel%2fgenerator",
"scope": "@babel", "scope": "@babel",
"rawSpec": "7.5.5", "rawSpec": "^7.8.4",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "7.5.5" "fetchSpec": "^7.8.4"
}, },
"_requiredBy": [ "_requiredBy": [
"/@babel/core", "/@babel/core",
"/@babel/traverse", "/@babel/traverse",
"/istanbul-lib-instrument" "/istanbul-lib-instrument"
], ],
"_resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.5.5.tgz", "_resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.8.4.tgz",
"_spec": "7.5.5", "_shasum": "35bbc74486956fe4251829f9f6c48330e8d0985e",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play", "_spec": "@babel/generator@^7.8.4",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/@babel/core",
"author": { "author": {
"name": "Sebastian McKenzie", "name": "Sebastian McKenzie",
"email": "sebmck@gmail.com" "email": "sebmck@gmail.com"
}, },
"bundleDependencies": false,
"dependencies": { "dependencies": {
"@babel/types": "^7.5.5", "@babel/types": "^7.8.3",
"jsesc": "^2.5.1", "jsesc": "^2.5.1",
"lodash": "^4.17.13", "lodash": "^4.17.13",
"source-map": "^0.5.0", "source-map": "^0.5.0"
"trim-right": "^1.0.1"
}, },
"deprecated": false,
"description": "Turns an AST into code.", "description": "Turns an AST into code.",
"devDependencies": { "devDependencies": {
"@babel/helper-fixtures": "^7.5.5", "@babel/helper-fixtures": "^7.8.3",
"@babel/parser": "^7.5.5" "@babel/parser": "^7.8.4"
}, },
"files": [ "files": [
"lib" "lib"
], ],
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43", "gitHead": "5c2e6bc07fed3d28801d93168622c99ae622653a",
"homepage": "https://babeljs.io/", "homepage": "https://babeljs.io/",
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
@@ -62,5 +57,5 @@
"type": "git", "type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-generator" "url": "https://github.com/babel/babel/tree/master/packages/babel-generator"
}, },
"version": "7.5.5" "version": "7.8.4"
} }

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2014-2018 Sebastian McKenzie and other contributors Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@@ -5,41 +5,19 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.default = _default; exports.default = _default;
function _helperGetFunctionArity() { var _helperGetFunctionArity = _interopRequireDefault(require("@babel/helper-get-function-arity"));
const data = _interopRequireDefault(require("@babel/helper-get-function-arity"));
_helperGetFunctionArity = function () { var _template = _interopRequireDefault(require("@babel/template"));
return data;
};
return data; var t = _interopRequireWildcard(require("@babel/types"));
}
function _template() { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
const data = _interopRequireDefault(require("@babel/template"));
_template = function () { 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; }
return data;
};
return data;
}
function t() {
const data = _interopRequireWildcard(require("@babel/types"));
t = function () {
return data;
};
return data;
}
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const buildPropertyMethodAssignmentWrapper = (0, _template().default)(` const buildPropertyMethodAssignmentWrapper = (0, _template.default)(`
(function (FUNCTION_KEY) { (function (FUNCTION_KEY) {
function FUNCTION_ID() { function FUNCTION_ID() {
return FUNCTION_KEY.apply(this, arguments); return FUNCTION_KEY.apply(this, arguments);
@@ -52,7 +30,7 @@ const buildPropertyMethodAssignmentWrapper = (0, _template().default)(`
return FUNCTION_ID; return FUNCTION_ID;
})(FUNCTION) })(FUNCTION)
`); `);
const buildGeneratorPropertyMethodAssignmentWrapper = (0, _template().default)(` const buildGeneratorPropertyMethodAssignmentWrapper = (0, _template.default)(`
(function (FUNCTION_KEY) { (function (FUNCTION_KEY) {
function* FUNCTION_ID() { function* FUNCTION_ID() {
return yield* FUNCTION_KEY.apply(this, arguments); return yield* FUNCTION_KEY.apply(this, arguments);
@@ -77,15 +55,15 @@ const visitor = {
}; };
function getNameFromLiteralId(id) { function getNameFromLiteralId(id) {
if (t().isNullLiteral(id)) { if (t.isNullLiteral(id)) {
return "null"; return "null";
} }
if (t().isRegExpLiteral(id)) { if (t.isRegExpLiteral(id)) {
return `_${id.pattern}_${id.flags}`; return `_${id.pattern}_${id.flags}`;
} }
if (t().isTemplateLiteral(id)) { if (t.isTemplateLiteral(id)) {
return id.quasis.map(quasi => quasi.value.raw).join(""); return id.quasis.map(quasi => quasi.value.raw).join("");
} }
@@ -101,7 +79,7 @@ function wrap(state, method, id, scope) {
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) { if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
scope.rename(id.name); scope.rename(id.name);
} else { } else {
if (!t().isFunction(method)) return; if (!t.isFunction(method)) return;
let build = buildPropertyMethodAssignmentWrapper; let build = buildPropertyMethodAssignmentWrapper;
if (method.generator) { if (method.generator) {
@@ -115,7 +93,7 @@ function wrap(state, method, id, scope) {
}).expression; }).expression;
const params = template.callee.body.body[0].params; const params = template.callee.body.body[0].params;
for (let i = 0, len = (0, _helperGetFunctionArity().default)(method); i < len; i++) { for (let i = 0, len = (0, _helperGetFunctionArity.default)(method); i < len; i++) {
params.push(scope.generateUidIdentifier("x")); params.push(scope.generateUidIdentifier("x"));
} }
@@ -156,23 +134,23 @@ function _default({
}, localBinding = false) { }, localBinding = false) {
if (node.id) return; if (node.id) return;
if ((t().isObjectProperty(parent) || t().isObjectMethod(parent, { if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, {
kind: "method" kind: "method"
})) && (!parent.computed || t().isLiteral(parent.key))) { })) && (!parent.computed || t.isLiteral(parent.key))) {
id = parent.key; id = parent.key;
} else if (t().isVariableDeclarator(parent)) { } else if (t.isVariableDeclarator(parent)) {
id = parent.id; id = parent.id;
if (t().isIdentifier(id) && !localBinding) { if (t.isIdentifier(id) && !localBinding) {
const binding = scope.parent.getBinding(id.name); const binding = scope.parent.getBinding(id.name);
if (binding && binding.constant && scope.getBinding(id.name) === binding) { if (binding && binding.constant && scope.getBinding(id.name) === binding) {
node.id = t().cloneNode(id); node.id = t.cloneNode(id);
node.id[t().NOT_LOCAL_BINDING] = true; node.id[t.NOT_LOCAL_BINDING] = true;
return; return;
} }
} }
} else if (t().isAssignmentExpression(parent)) { } else if (t.isAssignmentExpression(parent)) {
id = parent.left; id = parent.left;
} else if (!id) { } else if (!id) {
return; return;
@@ -180,9 +158,9 @@ function _default({
let name; let name;
if (id && t().isLiteral(id)) { if (id && t.isLiteral(id)) {
name = getNameFromLiteralId(id); name = getNameFromLiteralId(id);
} else if (id && t().isIdentifier(id)) { } else if (id && t.isIdentifier(id)) {
name = id.name; name = id.name;
} }
@@ -190,9 +168,9 @@ function _default({
return; return;
} }
name = t().toBindingIdentifierName(name); name = t.toBindingIdentifierName(name);
id = t().identifier(name); id = t.identifier(name);
id[t().NOT_LOCAL_BINDING] = true; id[t.NOT_LOCAL_BINDING] = true;
const state = visit(node, name, scope); const state = visit(node, name, scope);
return wrap(state, node, id, scope) || node; return wrap(state, node, id, scope) || node;
} }

View File

@@ -1,40 +1,37 @@
{ {
"_args": [ "_from": "@babel/helper-function-name@^7.8.3",
[ "_id": "@babel/helper-function-name@7.8.3",
"@babel/helper-function-name@7.1.0",
"/Users/drew.heavner/Documents/Github/upload-google-play"
]
],
"_development": true,
"_from": "@babel/helper-function-name@7.1.0",
"_id": "@babel/helper-function-name@7.1.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==", "_integrity": "sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA==",
"_location": "/@babel/helper-function-name", "_location": "/@babel/helper-function-name",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "range",
"registry": true, "registry": true,
"raw": "@babel/helper-function-name@7.1.0", "raw": "@babel/helper-function-name@^7.8.3",
"name": "@babel/helper-function-name", "name": "@babel/helper-function-name",
"escapedName": "@babel%2fhelper-function-name", "escapedName": "@babel%2fhelper-function-name",
"scope": "@babel", "scope": "@babel",
"rawSpec": "7.1.0", "rawSpec": "^7.8.3",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "7.1.0" "fetchSpec": "^7.8.3"
}, },
"_requiredBy": [ "_requiredBy": [
"/@babel/traverse" "/@babel/traverse"
], ],
"_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz", "_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz",
"_spec": "7.1.0", "_shasum": "eeeb665a01b1f11068e9fb86ad56a1cb1a824cca",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play", "_spec": "@babel/helper-function-name@^7.8.3",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/@babel/traverse",
"bundleDependencies": false,
"dependencies": { "dependencies": {
"@babel/helper-get-function-arity": "^7.0.0", "@babel/helper-get-function-arity": "^7.8.3",
"@babel/template": "^7.1.0", "@babel/template": "^7.8.3",
"@babel/types": "^7.0.0" "@babel/types": "^7.8.3"
}, },
"deprecated": false,
"description": "Helper function to change the property 'name' of every function", "description": "Helper function to change the property 'name' of every function",
"gitHead": "a7620bd266ae1345975767bbc7abf09034437017",
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
"name": "@babel/helper-function-name", "name": "@babel/helper-function-name",
@@ -45,5 +42,5 @@
"type": "git", "type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name" "url": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name"
}, },
"version": "7.1.0" "version": "7.8.3"
} }

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com> Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@@ -5,17 +5,11 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.default = _default; exports.default = _default;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _default(node) { function _default(node) {
const params = node.params; const params = node.params;
@@ -23,7 +17,7 @@ function _default(node) {
for (let i = 0; i < params.length; i++) { for (let i = 0; i < params.length; i++) {
const param = params[i]; const param = params[i];
if (t().isAssignmentPattern(param) || t().isRestElement(param)) { if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
return i; return i;
} }
} }

View File

@@ -1,44 +1,44 @@
{ {
"_args": [ "_from": "@babel/helper-get-function-arity@^7.8.3",
[ "_id": "@babel/helper-get-function-arity@7.8.3",
"@babel/helper-get-function-arity@7.0.0",
"/Users/drew.heavner/Documents/Github/upload-google-play"
]
],
"_development": true,
"_from": "@babel/helper-get-function-arity@7.0.0",
"_id": "@babel/helper-get-function-arity@7.0.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-r2DbJeg4svYvt3HOS74U4eWKsUAMRH01Z1ds1zx8KNTPtpTL5JAsdFv8BNyOpVqdFhHkkRDIg5B4AsxmkjAlmQ==", "_integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==",
"_location": "/@babel/helper-get-function-arity", "_location": "/@babel/helper-get-function-arity",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "range",
"registry": true, "registry": true,
"raw": "@babel/helper-get-function-arity@7.0.0", "raw": "@babel/helper-get-function-arity@^7.8.3",
"name": "@babel/helper-get-function-arity", "name": "@babel/helper-get-function-arity",
"escapedName": "@babel%2fhelper-get-function-arity", "escapedName": "@babel%2fhelper-get-function-arity",
"scope": "@babel", "scope": "@babel",
"rawSpec": "7.0.0", "rawSpec": "^7.8.3",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "7.0.0" "fetchSpec": "^7.8.3"
}, },
"_requiredBy": [ "_requiredBy": [
"/@babel/helper-function-name" "/@babel/helper-function-name"
], ],
"_resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz", "_resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz",
"_spec": "7.0.0", "_shasum": "b894b947bd004381ce63ea1db9f08547e920abd5",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play", "_spec": "@babel/helper-get-function-arity@^7.8.3",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/@babel/helper-function-name",
"bundleDependencies": false,
"dependencies": { "dependencies": {
"@babel/types": "^7.0.0" "@babel/types": "^7.8.3"
}, },
"deprecated": false,
"description": "Helper function to get function arity", "description": "Helper function to get function arity",
"gitHead": "a7620bd266ae1345975767bbc7abf09034437017",
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
"name": "@babel/helper-get-function-arity", "name": "@babel/helper-get-function-arity",
"publishConfig": {
"access": "public"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity" "url": "https://github.com/babel/babel/tree/master/packages/babel-helper-get-function-arity"
}, },
"version": "7.0.0" "version": "7.8.3"
} }

View File

@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com> Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@@ -31,7 +31,7 @@ function copyApiObject(api) {
} }
} }
return Object.assign({}, proto, api); return Object.assign({}, proto, {}, api);
} }
function has(obj, key) { function has(obj, key) {

View File

@@ -1,47 +1,47 @@
{ {
"_args": [ "_from": "@babel/helper-plugin-utils@^7.0.0",
[ "_id": "@babel/helper-plugin-utils@7.8.3",
"@babel/helper-plugin-utils@7.0.0",
"/Users/drew.heavner/Documents/Github/upload-google-play"
]
],
"_development": true,
"_from": "@babel/helper-plugin-utils@7.0.0",
"_id": "@babel/helper-plugin-utils@7.0.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA==", "_integrity": "sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ==",
"_location": "/@babel/helper-plugin-utils", "_location": "/@babel/helper-plugin-utils",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
"type": "version", "type": "range",
"registry": true, "registry": true,
"raw": "@babel/helper-plugin-utils@7.0.0", "raw": "@babel/helper-plugin-utils@^7.0.0",
"name": "@babel/helper-plugin-utils", "name": "@babel/helper-plugin-utils",
"escapedName": "@babel%2fhelper-plugin-utils", "escapedName": "@babel%2fhelper-plugin-utils",
"scope": "@babel", "scope": "@babel",
"rawSpec": "7.0.0", "rawSpec": "^7.0.0",
"saveSpec": null, "saveSpec": null,
"fetchSpec": "7.0.0" "fetchSpec": "^7.0.0"
}, },
"_requiredBy": [ "_requiredBy": [
"/@babel/plugin-syntax-object-rest-spread", "/@babel/plugin-syntax-object-rest-spread",
"/babel-plugin-istanbul" "/babel-plugin-istanbul"
], ],
"_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz", "_resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz",
"_spec": "7.0.0", "_shasum": "9ea293be19babc0f52ff8ca88b34c3611b208670",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play", "_spec": "@babel/helper-plugin-utils@^7.0.0",
"_where": "/Users/drew.heavner/Documents/Github/upload-google-play/node_modules/babel-plugin-istanbul",
"author": { "author": {
"name": "Logan Smyth", "name": "Logan Smyth",
"email": "loganfsmyth@gmail.com" "email": "loganfsmyth@gmail.com"
}, },
"bundleDependencies": false,
"deprecated": false,
"description": "General utilities for plugins to use", "description": "General utilities for plugins to use",
"gitHead": "a7620bd266ae1345975767bbc7abf09034437017",
"homepage": "https://babeljs.io/", "homepage": "https://babeljs.io/",
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",
"name": "@babel/helper-plugin-utils", "name": "@babel/helper-plugin-utils",
"publishConfig": {
"access": "public"
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-utils" "url": "https://github.com/babel/babel/tree/master/packages/babel-helper-plugin-utils"
}, },
"version": "7.0.0" "version": "7.8.3"
} }

View File

@@ -5,17 +5,11 @@ Object.defineProperty(exports, "__esModule", {
}); });
exports.default = splitExportDeclaration; exports.default = splitExportDeclaration;
function t() { var t = _interopRequireWildcard(require("@babel/types"));
const data = _interopRequireWildcard(require("@babel/types"));
t = function () { function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
return data;
};
return data; 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function splitExportDeclaration(exportDeclaration) { function splitExportDeclaration(exportDeclaration) {
if (!exportDeclaration.isExportDeclaration()) { if (!exportDeclaration.isExportDeclaration()) {
@@ -37,12 +31,12 @@ function splitExportDeclaration(exportDeclaration) {
id = scope.generateUidIdentifier("default"); id = scope.generateUidIdentifier("default");
if (standaloneDeclaration || declaration.isFunctionExpression() || declaration.isClassExpression()) { if (standaloneDeclaration || declaration.isFunctionExpression() || declaration.isClassExpression()) {
declaration.node.id = t().cloneNode(id); declaration.node.id = t.cloneNode(id);
} }
} }
const updatedDeclaration = standaloneDeclaration ? declaration : t().variableDeclaration("var", [t().variableDeclarator(t().cloneNode(id), declaration.node)]); const updatedDeclaration = standaloneDeclaration ? declaration : t.variableDeclaration("var", [t.variableDeclarator(t.cloneNode(id), declaration.node)]);
const updatedExportDeclaration = t().exportNamedDeclaration(null, [t().exportSpecifier(t().cloneNode(id), t().identifier("default"))]); const updatedExportDeclaration = t.exportNamedDeclaration(null, [t.exportSpecifier(t.cloneNode(id), t.identifier("default"))]);
exportDeclaration.insertAfter(updatedExportDeclaration); exportDeclaration.insertAfter(updatedExportDeclaration);
exportDeclaration.replaceWith(updatedDeclaration); exportDeclaration.replaceWith(updatedDeclaration);
@@ -59,9 +53,9 @@ function splitExportDeclaration(exportDeclaration) {
const bindingIdentifiers = declaration.getOuterBindingIdentifiers(); const bindingIdentifiers = declaration.getOuterBindingIdentifiers();
const specifiers = Object.keys(bindingIdentifiers).map(name => { const specifiers = Object.keys(bindingIdentifiers).map(name => {
return t().exportSpecifier(t().identifier(name), t().identifier(name)); return t.exportSpecifier(t.identifier(name), t.identifier(name));
}); });
const aliasDeclar = t().exportNamedDeclaration(null, specifiers); const aliasDeclar = t.exportNamedDeclaration(null, specifiers);
exportDeclaration.insertAfter(aliasDeclar); exportDeclaration.insertAfter(aliasDeclar);
exportDeclaration.replaceWith(declaration.node); exportDeclaration.replaceWith(declaration.node);
return exportDeclaration; return exportDeclaration;

Some files were not shown because too many files have changed in this diff Show More