mirror of
https://github.com/dawidd6/action-ansible-playbook.git
synced 2026-01-11 14:01:41 -07:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c534b3ba0 | ||
|
|
9a7cbd2b6b | ||
|
|
19d1b2c628 | ||
|
|
c27fb2d7b1 | ||
|
|
7b2f0761a9 | ||
|
|
d270136941 | ||
|
|
e4d3ccbe7b | ||
|
|
a328034622 | ||
|
|
1b9385ee45 | ||
|
|
563b73df2f | ||
|
|
d28d9989a8 | ||
|
|
81f2a15778 | ||
|
|
145a900758 | ||
|
|
a90a5a21fa | ||
|
|
a216fccde8 | ||
|
|
76f8e15bac | ||
|
|
9805b8fa8b | ||
|
|
921a00333b | ||
|
|
1e8a3ef594 | ||
|
|
e3e388ffee | ||
|
|
12b09931f9 | ||
|
|
6f709ceecd | ||
|
|
89ee60634c | ||
|
|
83c93acd55 | ||
|
|
c65cf629fb | ||
|
|
6249522d7c | ||
|
|
9fa54a34c7 | ||
|
|
4f3ca9bf23 | ||
|
|
c667c001c3 | ||
|
|
013642b2f2 | ||
|
|
905e9bd607 | ||
|
|
72edf25c15 | ||
|
|
fd56a2ad58 | ||
|
|
47f48fd0e8 | ||
|
|
55d6336eea |
82
.github/workflows/test.yml
vendored
82
.github/workflows/test.yml
vendored
@@ -1,6 +1,10 @@
|
||||
name: Test Action
|
||||
|
||||
on: push
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test-remote:
|
||||
@@ -8,24 +12,33 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Test remote
|
||||
- name: Setup remote
|
||||
run: |
|
||||
docker build -t host -f Dockerfile.test .
|
||||
docker build -t action -f Dockerfile .
|
||||
docker run -d \
|
||||
--name host \
|
||||
-e SSH_PUBLIC_KEY="${{secrets.SSH_PUBLIC_KEY}}" \
|
||||
host
|
||||
docker run -t \
|
||||
--name action \
|
||||
--link host \
|
||||
-v $PWD:/wd \
|
||||
-w /wd \
|
||||
-e INPUT_PLAYBOOK="playbook.yml" \
|
||||
-e INPUT_DIRECTORY="./" \
|
||||
-e INPUT_KEY="${{secrets.SSH_PRIVATE_KEY}}" \
|
||||
-e INPUT_OPTIONS="--inventory hosts --limit remote" \
|
||||
action
|
||||
echo "${{secrets.SSH_PUBLIC_KEY}}" | sudo tee /etc/ssh/authorized_keys
|
||||
sudo tee /etc/ssh/sshd_config <<EOF
|
||||
PasswordAuthentication no
|
||||
PubkeyAuthentication yes
|
||||
AuthorizedKeysFile /etc/ssh/authorized_keys
|
||||
PermitRootLogin no
|
||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||
EOF
|
||||
sudo systemctl restart sshd
|
||||
- name: Test remote
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
directory: test
|
||||
key: ${{secrets.SSH_PRIVATE_KEY}}
|
||||
inventory: |
|
||||
[all]
|
||||
localhost
|
||||
options: |
|
||||
-e docker_image=docker_url
|
||||
-e docker_username=user
|
||||
-e docker_password=pass
|
||||
-e db_name=db_name
|
||||
-e db_user=db_user
|
||||
-e db_pass=db_pass
|
||||
test-local:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -35,10 +48,18 @@ jobs:
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
key: ${{secrets.SSH_PRIVATE_KEY}}
|
||||
requirements: requirements.yml
|
||||
options: |
|
||||
--inventory hosts
|
||||
--limit local
|
||||
--inventory hosts
|
||||
--limit local
|
||||
- name: Test local
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
requirements: requirements-bundle.yml
|
||||
options: |
|
||||
--inventory hosts
|
||||
--limit local
|
||||
test-local-more:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -48,13 +69,18 @@ jobs:
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
key: ${{secrets.SSH_PRIVATE_KEY}}
|
||||
vault_password: test
|
||||
inventory: |
|
||||
[remote]
|
||||
host ansible_user=user
|
||||
|
||||
[local]
|
||||
localhost ansible_user=root ansible_connection=local
|
||||
[all]
|
||||
localhost ansible_connection=local
|
||||
options: |
|
||||
--limit local
|
||||
-e key1=val1
|
||||
-e key2=val2
|
||||
- name: Test local
|
||||
uses: ./
|
||||
with:
|
||||
playbook: playbook.yml
|
||||
vault_password: test
|
||||
inventory: |
|
||||
[all]
|
||||
localhost ansible_connection=local
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
FROM alpine
|
||||
|
||||
RUN apk -U add ansible
|
||||
|
||||
COPY main.sh /
|
||||
|
||||
ENTRYPOINT ["/main.sh"]
|
||||
@@ -1,17 +0,0 @@
|
||||
FROM alpine
|
||||
|
||||
RUN apk -U add openssh-server openssh-sftp-server sudo python3
|
||||
RUN adduser -D user
|
||||
RUN passwd -u user
|
||||
RUN echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
|
||||
RUN echo "PasswordAuthentication no" > /etc/ssh/sshd_config
|
||||
RUN echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
|
||||
RUN echo "AuthorizedKeysFile /etc/ssh/authorized_keys" >> /etc/ssh/sshd_config
|
||||
RUN echo "PermitRootLogin no" >> /etc/ssh/sshd_config
|
||||
RUN echo "Subsystem sftp /usr/lib/ssh/sftp-server" >> /etc/ssh/sshd_config
|
||||
|
||||
RUN ssh-keygen -A
|
||||
|
||||
COPY test.sh /
|
||||
|
||||
ENTRYPOINT ["/test.sh"]
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
An action that executes given Ansible playbook on selected hosts.
|
||||
|
||||
Should work on any OS, if `ansible-playbook` command is available in `PATH`.
|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
- name: Run playbook
|
||||
uses: dawidd6/action-ansible-playbook@v1
|
||||
uses: dawidd6/action-ansible-playbook@v2
|
||||
with:
|
||||
playbook: deploy.yml
|
||||
directory: ./
|
||||
|
||||
10
action.yml
10
action.yml
@@ -7,12 +7,15 @@ inputs:
|
||||
playbook:
|
||||
description: Ansible playbook filepath
|
||||
required: true
|
||||
requirements:
|
||||
description: Ansible Galaxy requirements filepath
|
||||
required: false
|
||||
directory:
|
||||
description: Root directory of Ansible project (defaults to current)
|
||||
required: false
|
||||
key:
|
||||
description: SSH private key used to connect to the host
|
||||
required: true
|
||||
required: false
|
||||
inventory:
|
||||
description: Custom content to write into hosts
|
||||
required: false
|
||||
@@ -23,5 +26,6 @@ inputs:
|
||||
description: Extra options that should be passed to ansible-playbook command
|
||||
required: false
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
using: node12
|
||||
main: main.js
|
||||
post: post.js
|
||||
|
||||
5
hosts
5
hosts
@@ -1,5 +1,2 @@
|
||||
[remote]
|
||||
host ansible_user=user
|
||||
|
||||
[local]
|
||||
localhost ansible_user=root ansible_connection=local
|
||||
localhost ansible_connection=local
|
||||
75
main.js
Normal file
75
main.js
Normal file
@@ -0,0 +1,75 @@
|
||||
const core = require('@actions/core')
|
||||
const exec = require('@actions/exec')
|
||||
const yaml = require('yaml')
|
||||
const fs = require('fs')
|
||||
const os = require('os')
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
const playbook = core.getInput("playbook", { required: true })
|
||||
const requirements = core.getInput("requirements")
|
||||
const directory = core.getInput("directory")
|
||||
const key = core.getInput("key")
|
||||
const inventory = core.getInput("inventory")
|
||||
const vaultPassword = core.getInput("vault_password")
|
||||
const options = core.getInput("options")
|
||||
|
||||
let cmd = ["ansible-playbook", playbook]
|
||||
|
||||
if (options) {
|
||||
cmd.push(options.replace(/\n/g, " "))
|
||||
}
|
||||
|
||||
if (directory) {
|
||||
process.chdir(directory)
|
||||
core.saveState("directory", directory)
|
||||
}
|
||||
|
||||
if (requirements) {
|
||||
const requirementsContent = fs.readFileSync(requirements, 'utf8')
|
||||
const requirementsObject = yaml.parse(requirementsContent)
|
||||
|
||||
if (Array.isArray(requirementsObject)) {
|
||||
await exec.exec("ansible-galaxy", ["install", "-r", requirements])
|
||||
} else {
|
||||
if (requirementsObject.roles)
|
||||
await exec.exec("ansible-galaxy", ["role", "install", "-r", requirements])
|
||||
if (requirementsObject.collections)
|
||||
await exec.exec("ansible-galaxy", ["collection", "install", "-r", requirements])
|
||||
}
|
||||
}
|
||||
|
||||
if (key) {
|
||||
const keyFile = ".ansible_key"
|
||||
fs.writeFileSync(keyFile, key + os.EOL, { mode: 0600 })
|
||||
core.saveState("keyFile", keyFile)
|
||||
cmd.push("--key-file")
|
||||
cmd.push(keyFile)
|
||||
}
|
||||
|
||||
if (inventory) {
|
||||
const inventoryFile = ".ansible_inventory"
|
||||
fs.writeFileSync(inventoryFile, inventory, { mode: 0600 })
|
||||
core.saveState("inventoryFile", inventoryFile)
|
||||
cmd.push("--inventory-file")
|
||||
cmd.push(inventoryFile)
|
||||
}
|
||||
|
||||
if (vaultPassword) {
|
||||
const vaultPasswordFile = ".ansible_vault_password"
|
||||
fs.writeFileSync(vaultPasswordFile, vaultPassword, { mode: 0600 })
|
||||
core.saveState("vaultPasswordFile", vaultPasswordFile)
|
||||
cmd.push("--vault-password-file")
|
||||
cmd.push(vaultPasswordFile)
|
||||
}
|
||||
|
||||
process.env.ANSIBLE_HOST_KEY_CHECKING = "False"
|
||||
process.env.ANSIBLE_FORCE_COLOR = "True"
|
||||
|
||||
await exec.exec(cmd.join(" "))
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
55
main.sh
55
main.sh
@@ -1,55 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
inventory_file="hosts"
|
||||
vault_password_file=".vault_password"
|
||||
|
||||
playbook="$INPUT_PLAYBOOK"
|
||||
directory="$INPUT_DIRECTORY"
|
||||
key="$INPUT_KEY"
|
||||
inventory="$INPUT_INVENTORY"
|
||||
vault_password="$INPUT_VAULT_PASSWORD"
|
||||
options="$INPUT_OPTIONS"
|
||||
|
||||
if test -z "$playbook"; then
|
||||
echo "::error::You need to specify 'playbook' input (Ansible playbook filepath)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$key"; then
|
||||
echo "::error::You need to specify 'key' input (SSH private key)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$HOME/.ssh"
|
||||
echo "$key" > "$HOME/.ssh/id_rsa"
|
||||
chmod 600 "$HOME/.ssh/id_rsa"
|
||||
|
||||
if test -n "$directory"; then
|
||||
echo "==> Changing directory to: $directory"
|
||||
cd "$directory"
|
||||
fi
|
||||
|
||||
if test -n "$options"; then
|
||||
options="$(echo "$options" | tr '\n' ' ' | xargs)"
|
||||
fi
|
||||
|
||||
if test -n "$inventory"; then
|
||||
echo "==> Setting inventory"
|
||||
echo "$inventory" > "$inventory_file"
|
||||
options="$options --inventory $inventory_file"
|
||||
fi
|
||||
|
||||
if test -n "$vault_password"; then
|
||||
echo "==> Setting vault password"
|
||||
echo "$vault_password" > "$vault_password_file"
|
||||
options="$options --vault-password-file $vault_password_file"
|
||||
fi
|
||||
|
||||
export ANSIBLE_HOST_KEY_CHECKING=False
|
||||
export ANSIBLE_FORCE_COLOR=True
|
||||
|
||||
echo "[command]ansible-playbook $options $playbook"
|
||||
|
||||
ansible-playbook $options $playbook
|
||||
33
node_modules/.package-lock.json
generated
vendored
Normal file
33
node_modules/.package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "action-ansible-playbook",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
|
||||
},
|
||||
"node_modules/@actions/exec": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz",
|
||||
"integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==",
|
||||
"dependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@actions/io": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.0.2.tgz",
|
||||
"integrity": "sha512-J8KuFqVPr3p6U8W93DOXlXW6zFvrQAJANdS+vw0YhusLIq+bszW8zmK2Fh1C2kDPX8FMvwIl1OUcFgvJoXLbAg=="
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.0.tgz",
|
||||
"integrity": "sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
9
node_modules/@actions/core/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
147
node_modules/@actions/core/README.md
generated
vendored
Normal file
147
node_modules/@actions/core/README.md
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
# `@actions/core`
|
||||
|
||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||
|
||||
## Usage
|
||||
|
||||
### Import the package
|
||||
|
||||
```js
|
||||
// javascript
|
||||
const core = require('@actions/core');
|
||||
|
||||
// typescript
|
||||
import * as core from '@actions/core';
|
||||
```
|
||||
|
||||
#### Inputs/Outputs
|
||||
|
||||
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
||||
|
||||
```js
|
||||
const myInput = core.getInput('inputName', { required: true });
|
||||
|
||||
core.setOutput('outputKey', 'outputVal');
|
||||
```
|
||||
|
||||
#### Exporting variables
|
||||
|
||||
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
|
||||
|
||||
```js
|
||||
core.exportVariable('envVar', 'Val');
|
||||
```
|
||||
|
||||
#### Setting a secret
|
||||
|
||||
Setting a secret registers the secret with the runner to ensure it is masked in logs.
|
||||
|
||||
```js
|
||||
core.setSecret('myPassword');
|
||||
```
|
||||
|
||||
#### PATH Manipulation
|
||||
|
||||
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
|
||||
|
||||
```js
|
||||
core.addPath('/path/to/mytool');
|
||||
```
|
||||
|
||||
#### Exit codes
|
||||
|
||||
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
try {
|
||||
// Do stuff
|
||||
}
|
||||
catch (err) {
|
||||
// setFailed logs the message and sets a failing exit code
|
||||
core.setFailed(`Action failed with error ${err}`);
|
||||
}
|
||||
|
||||
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
||||
|
||||
```
|
||||
|
||||
#### Logging
|
||||
|
||||
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
const myInput = core.getInput('input');
|
||||
try {
|
||||
core.debug('Inside try block');
|
||||
|
||||
if (!myInput) {
|
||||
core.warning('myInput was not set');
|
||||
}
|
||||
|
||||
if (core.isDebug()) {
|
||||
// curl -v https://github.com
|
||||
} else {
|
||||
// curl https://github.com
|
||||
}
|
||||
|
||||
// Do stuff
|
||||
core.info('Output to the actions build log')
|
||||
}
|
||||
catch (err) {
|
||||
core.error(`Error ${err}, action may still succeed though`);
|
||||
}
|
||||
```
|
||||
|
||||
This library can also wrap chunks of output in foldable groups.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core')
|
||||
|
||||
// Manually wrap output
|
||||
core.startGroup('Do some function')
|
||||
doSomeFunction()
|
||||
core.endGroup()
|
||||
|
||||
// Wrap an asynchronous function call
|
||||
const result = await core.group('Do something async', async () => {
|
||||
const response = await doSomeHTTPRequest()
|
||||
return response
|
||||
})
|
||||
```
|
||||
|
||||
#### Action state
|
||||
|
||||
You can use this library to save state and get state for sharing information between a given wrapper action:
|
||||
|
||||
**action.yml**
|
||||
```yaml
|
||||
name: 'Wrapper action sample'
|
||||
inputs:
|
||||
name:
|
||||
default: 'GitHub'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'main.js'
|
||||
post: 'cleanup.js'
|
||||
```
|
||||
|
||||
In action's `main.js`:
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
core.saveState("pidToKill", 12345);
|
||||
```
|
||||
|
||||
In action's `cleanup.js`:
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
var pid = core.getState("pidToKill");
|
||||
|
||||
process.kill(pid);
|
||||
```
|
||||
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
Normal file
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
interface CommandProperties {
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ::name key=value,key=value::message
|
||||
*
|
||||
* Examples:
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/
|
||||
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
|
||||
export declare function issue(name: string, message?: string): void;
|
||||
export {};
|
||||
79
node_modules/@actions/core/lib/command.js
generated
vendored
Normal file
79
node_modules/@actions/core/lib/command.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = __importStar(require("os"));
|
||||
const utils_1 = require("./utils");
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ::name key=value,key=value::message
|
||||
*
|
||||
* Examples:
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/
|
||||
function issueCommand(command, properties, message) {
|
||||
const cmd = new Command(command, properties, message);
|
||||
process.stdout.write(cmd.toString() + os.EOL);
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
function issue(name, message = '') {
|
||||
issueCommand(name, {}, message);
|
||||
}
|
||||
exports.issue = issue;
|
||||
const CMD_STRING = '::';
|
||||
class Command {
|
||||
constructor(command, properties, message) {
|
||||
if (!command) {
|
||||
command = 'missing.command';
|
||||
}
|
||||
this.command = command;
|
||||
this.properties = properties;
|
||||
this.message = message;
|
||||
}
|
||||
toString() {
|
||||
let cmdStr = CMD_STRING + this.command;
|
||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||
cmdStr += ' ';
|
||||
let first = true;
|
||||
for (const key in this.properties) {
|
||||
if (this.properties.hasOwnProperty(key)) {
|
||||
const val = this.properties[key];
|
||||
if (val) {
|
||||
if (first) {
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
cmdStr += ',';
|
||||
}
|
||||
cmdStr += `${key}=${escapeProperty(val)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
||||
return cmdStr;
|
||||
}
|
||||
}
|
||||
function escapeData(s) {
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A');
|
||||
}
|
||||
function escapeProperty(s) {
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
.replace(/:/g, '%3A')
|
||||
.replace(/,/g, '%2C');
|
||||
}
|
||||
//# sourceMappingURL=command.js.map
|
||||
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AACxB,mCAAsC;AAWtC;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAY;IAEZ,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAM;IACxB,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAM;IAC5B,OAAO,sBAAc,CAAC,CAAC,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
||||
122
node_modules/@actions/core/lib/core.d.ts
generated
vendored
Normal file
122
node_modules/@actions/core/lib/core.d.ts
generated
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* Interface for getInput options
|
||||
*/
|
||||
export interface InputOptions {
|
||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||
required?: boolean;
|
||||
}
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
export declare enum ExitCode {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
Success = 0,
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
Failure = 1
|
||||
}
|
||||
/**
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function exportVariable(name: string, val: any): void;
|
||||
/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/
|
||||
export declare function setSecret(secret: string): void;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
export declare function addPath(inputPath: string): void;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
export declare function getInput(name: string, options?: InputOptions): string;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function setOutput(name: string, value: any): void;
|
||||
/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/
|
||||
export declare function setCommandEcho(enabled: boolean): void;
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
export declare function setFailed(message: string | Error): void;
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/
|
||||
export declare function isDebug(): boolean;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
export declare function debug(message: string): void;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
export declare function error(message: string | Error): void;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
export declare function warning(message: string | Error): void;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/
|
||||
export declare function info(message: string): void;
|
||||
/**
|
||||
* Begin an output group.
|
||||
*
|
||||
* Output until the next `groupEnd` will be foldable in this group
|
||||
*
|
||||
* @param name The name of the output group
|
||||
*/
|
||||
export declare function startGroup(name: string): void;
|
||||
/**
|
||||
* End an output group.
|
||||
*/
|
||||
export declare function endGroup(): void;
|
||||
/**
|
||||
* Wrap an asynchronous function call in a group.
|
||||
*
|
||||
* Returns the same type as the function itself.
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param fn The function to wrap in the group
|
||||
*/
|
||||
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
||||
/**
|
||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||
*
|
||||
* @param name name of the state to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
export declare function saveState(name: string, value: any): void;
|
||||
/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
* @param name name of the state to get
|
||||
* @returns string
|
||||
*/
|
||||
export declare function getState(name: string): string;
|
||||
238
node_modules/@actions/core/lib/core.js
generated
vendored
Normal file
238
node_modules/@actions/core/lib/core.js
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const command_1 = require("./command");
|
||||
const file_command_1 = require("./file-command");
|
||||
const utils_1 = require("./utils");
|
||||
const os = __importStar(require("os"));
|
||||
const path = __importStar(require("path"));
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
var ExitCode;
|
||||
(function (ExitCode) {
|
||||
/**
|
||||
* A code indicating that the action was successful
|
||||
*/
|
||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||
/**
|
||||
* A code indicating that the action was a failure
|
||||
*/
|
||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||
//-----------------------------------------------------------------------
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function exportVariable(name, val) {
|
||||
const convertedVal = utils_1.toCommandValue(val);
|
||||
process.env[name] = convertedVal;
|
||||
const filePath = process.env['GITHUB_ENV'] || '';
|
||||
if (filePath) {
|
||||
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||
file_command_1.issueCommand('ENV', commandValue);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
}
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/
|
||||
function setSecret(secret) {
|
||||
command_1.issueCommand('add-mask', {}, secret);
|
||||
}
|
||||
exports.setSecret = setSecret;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
const filePath = process.env['GITHUB_PATH'] || '';
|
||||
if (filePath) {
|
||||
file_command_1.issueCommand('PATH', inputPath);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
}
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string
|
||||
*/
|
||||
function getInput(name, options) {
|
||||
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
||||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
* @param name name of the output to set
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function setOutput(name, value) {
|
||||
command_1.issueCommand('set-output', { name }, value);
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
/**
|
||||
* Enables or disables the echoing of commands into stdout for the rest of the step.
|
||||
* Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
|
||||
*
|
||||
*/
|
||||
function setCommandEcho(enabled) {
|
||||
command_1.issue('echo', enabled ? 'on' : 'off');
|
||||
}
|
||||
exports.setCommandEcho = setCommandEcho;
|
||||
//-----------------------------------------------------------------------
|
||||
// Results
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Sets the action status to failed.
|
||||
* When the action exits it will be with an exit code of 1
|
||||
* @param message add error issue message
|
||||
*/
|
||||
function setFailed(message) {
|
||||
process.exitCode = ExitCode.Failure;
|
||||
error(message);
|
||||
}
|
||||
exports.setFailed = setFailed;
|
||||
//-----------------------------------------------------------------------
|
||||
// Logging Commands
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Gets whether Actions Step Debug is on or not
|
||||
*/
|
||||
function isDebug() {
|
||||
return process.env['RUNNER_DEBUG'] === '1';
|
||||
}
|
||||
exports.isDebug = isDebug;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
*/
|
||||
function debug(message) {
|
||||
command_1.issueCommand('debug', {}, message);
|
||||
}
|
||||
exports.debug = debug;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
function error(message) {
|
||||
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
exports.error = error;
|
||||
/**
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
*/
|
||||
function warning(message) {
|
||||
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
exports.warning = warning;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/
|
||||
function info(message) {
|
||||
process.stdout.write(message + os.EOL);
|
||||
}
|
||||
exports.info = info;
|
||||
/**
|
||||
* Begin an output group.
|
||||
*
|
||||
* Output until the next `groupEnd` will be foldable in this group
|
||||
*
|
||||
* @param name The name of the output group
|
||||
*/
|
||||
function startGroup(name) {
|
||||
command_1.issue('group', name);
|
||||
}
|
||||
exports.startGroup = startGroup;
|
||||
/**
|
||||
* End an output group.
|
||||
*/
|
||||
function endGroup() {
|
||||
command_1.issue('endgroup');
|
||||
}
|
||||
exports.endGroup = endGroup;
|
||||
/**
|
||||
* Wrap an asynchronous function call in a group.
|
||||
*
|
||||
* Returns the same type as the function itself.
|
||||
*
|
||||
* @param name The name of the group
|
||||
* @param fn The function to wrap in the group
|
||||
*/
|
||||
function group(name, fn) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
startGroup(name);
|
||||
let result;
|
||||
try {
|
||||
result = yield fn();
|
||||
}
|
||||
finally {
|
||||
endGroup();
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
exports.group = group;
|
||||
//-----------------------------------------------------------------------
|
||||
// Wrapper action state
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
||||
*
|
||||
* @param name name of the state to store
|
||||
* @param value value to store. Non-string values will be converted to a string via JSON.stringify
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function saveState(name, value) {
|
||||
command_1.issueCommand('save-state', { name }, value);
|
||||
}
|
||||
exports.saveState = saveState;
|
||||
/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
* @param name name of the state to get
|
||||
* @returns string
|
||||
*/
|
||||
function getState(name) {
|
||||
return process.env[`STATE_${name}`] || '';
|
||||
}
|
||||
exports.getState = getState;
|
||||
//# sourceMappingURL=core.js.map
|
||||
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAC7C,iDAA+D;AAC/D,mCAAsC;AAEtC,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAQ;IACnD,MAAM,YAAY,GAAG,sBAAc,CAAC,GAAG,CAAC,CAAA;IACxC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,YAAY,CAAA;IAEhC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;IAChD,IAAI,QAAQ,EAAE;QACZ,MAAM,SAAS,GAAG,qCAAqC,CAAA;QACvD,MAAM,YAAY,GAAG,GAAG,IAAI,KAAK,SAAS,GAAG,EAAE,CAAC,GAAG,GAAG,YAAY,GAAG,EAAE,CAAC,GAAG,GAAG,SAAS,EAAE,CAAA;QACzF,2BAAgB,CAAC,KAAK,EAAE,YAAY,CAAC,CAAA;KACtC;SAAM;QACL,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,YAAY,CAAC,CAAA;KAC9C;AACH,CAAC;AAZD,wCAYC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;IACjD,IAAI,QAAQ,EAAE;QACZ,2BAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;KACpC;SAAM;QACL,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;KACxC;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AARD,0BAQC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAC7C,eAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;AACvC,CAAC;AAFD,wCAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAuB;IAC/C,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IAEnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAJD,8BAIC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,OAAO;IACrB,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,GAAG,CAAA;AAC5C,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAuB;IAC3C,eAAK,CAAC,OAAO,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AACzE,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAuB;IAC7C,eAAK,CAAC,SAAS,EAAE,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC3E,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
|
||||
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare function issueCommand(command: string, message: any): void;
|
||||
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
29
node_modules/@actions/core/lib/file-command.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
// For internal use, subject to change.
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fs = __importStar(require("fs"));
|
||||
const os = __importStar(require("os"));
|
||||
const utils_1 = require("./utils");
|
||||
function issueCommand(command, message) {
|
||||
const filePath = process.env[`GITHUB_${command}`];
|
||||
if (!filePath) {
|
||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||
}
|
||||
if (!fs.existsSync(filePath)) {
|
||||
throw new Error(`Missing file at path: ${filePath}`);
|
||||
}
|
||||
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
//# sourceMappingURL=file-command.js.map
|
||||
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
|
||||
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
5
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
export declare function toCommandValue(input: any): string;
|
||||
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
19
node_modules/@actions/core/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
function toCommandValue(input) {
|
||||
if (input === null || input === undefined) {
|
||||
return '';
|
||||
}
|
||||
else if (typeof input === 'string' || input instanceof String) {
|
||||
return input;
|
||||
}
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC"}
|
||||
70
node_modules/@actions/core/package.json
generated
vendored
Normal file
70
node_modules/@actions/core/package.json
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@actions/core@1.2.6",
|
||||
"/home/dawidd6/github/dawidd6/action-ansible-playbook"
|
||||
]
|
||||
],
|
||||
"_from": "@actions/core@1.2.6",
|
||||
"_id": "@actions/core@1.2.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@actions/core@1.2.6",
|
||||
"name": "@actions/core",
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.2.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.2.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||
"_spec": "1.2.6",
|
||||
"_where": "/home/dawidd6/github/dawidd6/action-ansible-playbook",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"description": "Actions core lib",
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"!.DS_Store"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"name": "@actions/core",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git",
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"types": "lib/core.d.ts",
|
||||
"version": "1.2.6"
|
||||
}
|
||||
57
node_modules/@actions/exec/README.md
generated
vendored
Normal file
57
node_modules/@actions/exec/README.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# `@actions/exec`
|
||||
|
||||
## Usage
|
||||
|
||||
#### Basic
|
||||
|
||||
You can use this package to execute tools in a cross platform way:
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
await exec.exec('node index.js');
|
||||
```
|
||||
|
||||
#### Args
|
||||
|
||||
You can also pass in arg arrays:
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
await exec.exec('node', ['index.js', 'foo=bar']);
|
||||
```
|
||||
|
||||
#### Output/options
|
||||
|
||||
Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5):
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
let myOutput = '';
|
||||
let myError = '';
|
||||
|
||||
const options = {};
|
||||
options.listeners = {
|
||||
stdout: (data: Buffer) => {
|
||||
myOutput += data.toString();
|
||||
},
|
||||
stderr: (data: Buffer) => {
|
||||
myError += data.toString();
|
||||
}
|
||||
};
|
||||
options.cwd = './lib';
|
||||
|
||||
await exec.exec('node', ['index.js', 'foo=bar'], options);
|
||||
```
|
||||
|
||||
#### Exec tools not in the PATH
|
||||
|
||||
You can specify the full path for tools not in the PATH:
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
|
||||
await exec.exec('"/path/to/my-tool"', ['arg1']);
|
||||
```
|
||||
13
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
Normal file
13
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { ExecOptions } from './interfaces';
|
||||
export { ExecOptions };
|
||||
/**
|
||||
* Exec a command.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns Promise<number> exit code
|
||||
*/
|
||||
export declare function exec(commandLine: string, args?: string[], options?: ExecOptions): Promise<number>;
|
||||
44
node_modules/@actions/exec/lib/exec.js
generated
vendored
Normal file
44
node_modules/@actions/exec/lib/exec.js
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
"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 tr = __importStar(require("./toolrunner"));
|
||||
/**
|
||||
* Exec a command.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns Promise<number> exit code
|
||||
*/
|
||||
function exec(commandLine, args, options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const commandArgs = tr.argStringToArray(commandLine);
|
||||
if (commandArgs.length === 0) {
|
||||
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
||||
}
|
||||
// Path to tool to execute should be first arg
|
||||
const toolPath = commandArgs[0];
|
||||
args = commandArgs.slice(1).concat(args || []);
|
||||
const runner = new tr.ToolRunner(toolPath, args, options);
|
||||
return runner.exec();
|
||||
});
|
||||
}
|
||||
exports.exec = exec;
|
||||
//# sourceMappingURL=exec.js.map
|
||||
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
Normal file
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AACA,iDAAkC;AAIlC;;;;;;;;;GASG;AACH,SAAsB,IAAI,CACxB,WAAmB,EACnB,IAAe,EACf,OAAqB;;QAErB,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;SACpE;QACD,8CAA8C;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAkB,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;CAAA;AAdD,oBAcC"}
|
||||
37
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
Normal file
37
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/// <reference types="node" />
|
||||
import * as stream from 'stream';
|
||||
/**
|
||||
* Interface for exec options
|
||||
*/
|
||||
export interface ExecOptions {
|
||||
/** optional working directory. defaults to current */
|
||||
cwd?: string;
|
||||
/** optional envvar dictionary. defaults to current process's env */
|
||||
env?: {
|
||||
[key: string]: string;
|
||||
};
|
||||
/** optional. defaults to false */
|
||||
silent?: boolean;
|
||||
/** optional out stream to use. Defaults to process.stdout */
|
||||
outStream?: stream.Writable;
|
||||
/** optional err stream to use. Defaults to process.stderr */
|
||||
errStream?: stream.Writable;
|
||||
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
||||
windowsVerbatimArguments?: boolean;
|
||||
/** optional. whether to fail if output to stderr. defaults to false */
|
||||
failOnStdErr?: boolean;
|
||||
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
||||
ignoreReturnCode?: boolean;
|
||||
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
||||
delay?: number;
|
||||
/** optional. input to write to the process on STDIN. */
|
||||
input?: Buffer;
|
||||
/** optional. Listeners for output. Callback functions that will be called on these events */
|
||||
listeners?: {
|
||||
stdout?: (data: Buffer) => void;
|
||||
stderr?: (data: Buffer) => void;
|
||||
stdline?: (data: string) => void;
|
||||
errline?: (data: string) => void;
|
||||
debug?: (data: string) => void;
|
||||
};
|
||||
}
|
||||
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
Normal file
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=interfaces.js.map
|
||||
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
Normal file
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
||||
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
Normal file
37
node_modules/@actions/exec/lib/toolrunner.d.ts
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
/// <reference types="node" />
|
||||
import * as events from 'events';
|
||||
import * as im from './interfaces';
|
||||
export declare class ToolRunner extends events.EventEmitter {
|
||||
constructor(toolPath: string, args?: string[], options?: im.ExecOptions);
|
||||
private toolPath;
|
||||
private args;
|
||||
private options;
|
||||
private _debug;
|
||||
private _getCommandString;
|
||||
private _processLineBuffer;
|
||||
private _getSpawnFileName;
|
||||
private _getSpawnArgs;
|
||||
private _endsWith;
|
||||
private _isCmdFile;
|
||||
private _windowsQuoteCmdArg;
|
||||
private _uvQuoteCmdArg;
|
||||
private _cloneExecOptions;
|
||||
private _getSpawnOptions;
|
||||
/**
|
||||
* Exec a tool.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns number
|
||||
*/
|
||||
exec(): Promise<number>;
|
||||
}
|
||||
/**
|
||||
* Convert an arg string to an array of args. Handles escaping
|
||||
*
|
||||
* @param argString string of arguments
|
||||
* @returns string[] array of arguments
|
||||
*/
|
||||
export declare function argStringToArray(argString: string): string[];
|
||||
600
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
Normal file
600
node_modules/@actions/exec/lib/toolrunner.js
generated
vendored
Normal file
@@ -0,0 +1,600 @@
|
||||
"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 os = __importStar(require("os"));
|
||||
const events = __importStar(require("events"));
|
||||
const child = __importStar(require("child_process"));
|
||||
const path = __importStar(require("path"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const ioUtil = __importStar(require("@actions/io/lib/io-util"));
|
||||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
/*
|
||||
* Class for running command line tools. Handles quoting and arg parsing in a platform agnostic way.
|
||||
*/
|
||||
class ToolRunner extends events.EventEmitter {
|
||||
constructor(toolPath, args, options) {
|
||||
super();
|
||||
if (!toolPath) {
|
||||
throw new Error("Parameter 'toolPath' cannot be null or empty.");
|
||||
}
|
||||
this.toolPath = toolPath;
|
||||
this.args = args || [];
|
||||
this.options = options || {};
|
||||
}
|
||||
_debug(message) {
|
||||
if (this.options.listeners && this.options.listeners.debug) {
|
||||
this.options.listeners.debug(message);
|
||||
}
|
||||
}
|
||||
_getCommandString(options, noPrefix) {
|
||||
const toolPath = this._getSpawnFileName();
|
||||
const args = this._getSpawnArgs(options);
|
||||
let cmd = noPrefix ? '' : '[command]'; // omit prefix when piped to a second tool
|
||||
if (IS_WINDOWS) {
|
||||
// Windows + cmd file
|
||||
if (this._isCmdFile()) {
|
||||
cmd += toolPath;
|
||||
for (const a of args) {
|
||||
cmd += ` ${a}`;
|
||||
}
|
||||
}
|
||||
// Windows + verbatim
|
||||
else if (options.windowsVerbatimArguments) {
|
||||
cmd += `"${toolPath}"`;
|
||||
for (const a of args) {
|
||||
cmd += ` ${a}`;
|
||||
}
|
||||
}
|
||||
// Windows (regular)
|
||||
else {
|
||||
cmd += this._windowsQuoteCmdArg(toolPath);
|
||||
for (const a of args) {
|
||||
cmd += ` ${this._windowsQuoteCmdArg(a)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// OSX/Linux - this can likely be improved with some form of quoting.
|
||||
// creating processes on Unix is fundamentally different than Windows.
|
||||
// on Unix, execvp() takes an arg array.
|
||||
cmd += toolPath;
|
||||
for (const a of args) {
|
||||
cmd += ` ${a}`;
|
||||
}
|
||||
}
|
||||
return cmd;
|
||||
}
|
||||
_processLineBuffer(data, strBuffer, onLine) {
|
||||
try {
|
||||
let s = strBuffer + data.toString();
|
||||
let n = s.indexOf(os.EOL);
|
||||
while (n > -1) {
|
||||
const line = s.substring(0, n);
|
||||
onLine(line);
|
||||
// the rest of the string ...
|
||||
s = s.substring(n + os.EOL.length);
|
||||
n = s.indexOf(os.EOL);
|
||||
}
|
||||
strBuffer = s;
|
||||
}
|
||||
catch (err) {
|
||||
// streaming lines to console is best effort. Don't fail a build.
|
||||
this._debug(`error processing line. Failed with error ${err}`);
|
||||
}
|
||||
}
|
||||
_getSpawnFileName() {
|
||||
if (IS_WINDOWS) {
|
||||
if (this._isCmdFile()) {
|
||||
return process.env['COMSPEC'] || 'cmd.exe';
|
||||
}
|
||||
}
|
||||
return this.toolPath;
|
||||
}
|
||||
_getSpawnArgs(options) {
|
||||
if (IS_WINDOWS) {
|
||||
if (this._isCmdFile()) {
|
||||
let argline = `/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;
|
||||
for (const a of this.args) {
|
||||
argline += ' ';
|
||||
argline += options.windowsVerbatimArguments
|
||||
? a
|
||||
: this._windowsQuoteCmdArg(a);
|
||||
}
|
||||
argline += '"';
|
||||
return [argline];
|
||||
}
|
||||
}
|
||||
return this.args;
|
||||
}
|
||||
_endsWith(str, end) {
|
||||
return str.endsWith(end);
|
||||
}
|
||||
_isCmdFile() {
|
||||
const upperToolPath = this.toolPath.toUpperCase();
|
||||
return (this._endsWith(upperToolPath, '.CMD') ||
|
||||
this._endsWith(upperToolPath, '.BAT'));
|
||||
}
|
||||
_windowsQuoteCmdArg(arg) {
|
||||
// for .exe, apply the normal quoting rules that libuv applies
|
||||
if (!this._isCmdFile()) {
|
||||
return this._uvQuoteCmdArg(arg);
|
||||
}
|
||||
// otherwise apply quoting rules specific to the cmd.exe command line parser.
|
||||
// the libuv rules are generic and are not designed specifically for cmd.exe
|
||||
// command line parser.
|
||||
//
|
||||
// for a detailed description of the cmd.exe command line parser, refer to
|
||||
// http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts/7970912#7970912
|
||||
// need quotes for empty arg
|
||||
if (!arg) {
|
||||
return '""';
|
||||
}
|
||||
// determine whether the arg needs to be quoted
|
||||
const cmdSpecialChars = [
|
||||
' ',
|
||||
'\t',
|
||||
'&',
|
||||
'(',
|
||||
')',
|
||||
'[',
|
||||
']',
|
||||
'{',
|
||||
'}',
|
||||
'^',
|
||||
'=',
|
||||
';',
|
||||
'!',
|
||||
"'",
|
||||
'+',
|
||||
',',
|
||||
'`',
|
||||
'~',
|
||||
'|',
|
||||
'<',
|
||||
'>',
|
||||
'"'
|
||||
];
|
||||
let needsQuotes = false;
|
||||
for (const char of arg) {
|
||||
if (cmdSpecialChars.some(x => x === char)) {
|
||||
needsQuotes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// short-circuit if quotes not needed
|
||||
if (!needsQuotes) {
|
||||
return arg;
|
||||
}
|
||||
// the following quoting rules are very similar to the rules that by libuv applies.
|
||||
//
|
||||
// 1) wrap the string in quotes
|
||||
//
|
||||
// 2) double-up quotes - i.e. " => ""
|
||||
//
|
||||
// this is different from the libuv quoting rules. libuv replaces " with \", which unfortunately
|
||||
// doesn't work well with a cmd.exe command line.
|
||||
//
|
||||
// note, replacing " with "" also works well if the arg is passed to a downstream .NET console app.
|
||||
// for example, the command line:
|
||||
// foo.exe "myarg:""my val"""
|
||||
// is parsed by a .NET console app into an arg array:
|
||||
// [ "myarg:\"my val\"" ]
|
||||
// which is the same end result when applying libuv quoting rules. although the actual
|
||||
// command line from libuv quoting rules would look like:
|
||||
// foo.exe "myarg:\"my val\""
|
||||
//
|
||||
// 3) double-up slashes that precede a quote,
|
||||
// e.g. hello \world => "hello \world"
|
||||
// hello\"world => "hello\\""world"
|
||||
// hello\\"world => "hello\\\\""world"
|
||||
// hello world\ => "hello world\\"
|
||||
//
|
||||
// technically this is not required for a cmd.exe command line, or the batch argument parser.
|
||||
// the reasons for including this as a .cmd quoting rule are:
|
||||
//
|
||||
// a) this is optimized for the scenario where the argument is passed from the .cmd file to an
|
||||
// external program. many programs (e.g. .NET console apps) rely on the slash-doubling rule.
|
||||
//
|
||||
// b) it's what we've been doing previously (by deferring to node default behavior) and we
|
||||
// haven't heard any complaints about that aspect.
|
||||
//
|
||||
// note, a weakness of the quoting rules chosen here, is that % is not escaped. in fact, % cannot be
|
||||
// escaped when used on the command line directly - even though within a .cmd file % can be escaped
|
||||
// by using %%.
|
||||
//
|
||||
// the saving grace is, on the command line, %var% is left as-is if var is not defined. this contrasts
|
||||
// the line parsing rules within a .cmd file, where if var is not defined it is replaced with nothing.
|
||||
//
|
||||
// one option that was explored was replacing % with ^% - i.e. %var% => ^%var^%. this hack would
|
||||
// often work, since it is unlikely that var^ would exist, and the ^ character is removed when the
|
||||
// variable is used. the problem, however, is that ^ is not removed when %* is used to pass the args
|
||||
// to an external program.
|
||||
//
|
||||
// an unexplored potential solution for the % escaping problem, is to create a wrapper .cmd file.
|
||||
// % can be escaped within a .cmd file.
|
||||
let reverse = '"';
|
||||
let quoteHit = true;
|
||||
for (let i = arg.length; i > 0; i--) {
|
||||
// walk the string in reverse
|
||||
reverse += arg[i - 1];
|
||||
if (quoteHit && arg[i - 1] === '\\') {
|
||||
reverse += '\\'; // double the slash
|
||||
}
|
||||
else if (arg[i - 1] === '"') {
|
||||
quoteHit = true;
|
||||
reverse += '"'; // double the quote
|
||||
}
|
||||
else {
|
||||
quoteHit = false;
|
||||
}
|
||||
}
|
||||
reverse += '"';
|
||||
return reverse
|
||||
.split('')
|
||||
.reverse()
|
||||
.join('');
|
||||
}
|
||||
_uvQuoteCmdArg(arg) {
|
||||
// Tool runner wraps child_process.spawn() and needs to apply the same quoting as
|
||||
// Node in certain cases where the undocumented spawn option windowsVerbatimArguments
|
||||
// is used.
|
||||
//
|
||||
// Since this function is a port of quote_cmd_arg from Node 4.x (technically, lib UV,
|
||||
// see https://github.com/nodejs/node/blob/v4.x/deps/uv/src/win/process.c for details),
|
||||
// pasting copyright notice from Node within this function:
|
||||
//
|
||||
// Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
if (!arg) {
|
||||
// Need double quotation for empty argument
|
||||
return '""';
|
||||
}
|
||||
if (!arg.includes(' ') && !arg.includes('\t') && !arg.includes('"')) {
|
||||
// No quotation needed
|
||||
return arg;
|
||||
}
|
||||
if (!arg.includes('"') && !arg.includes('\\')) {
|
||||
// No embedded double quotes or backslashes, so I can just wrap
|
||||
// quote marks around the whole thing.
|
||||
return `"${arg}"`;
|
||||
}
|
||||
// Expected input/output:
|
||||
// input : hello"world
|
||||
// output: "hello\"world"
|
||||
// input : hello""world
|
||||
// output: "hello\"\"world"
|
||||
// input : hello\world
|
||||
// output: hello\world
|
||||
// input : hello\\world
|
||||
// output: hello\\world
|
||||
// input : hello\"world
|
||||
// output: "hello\\\"world"
|
||||
// input : hello\\"world
|
||||
// output: "hello\\\\\"world"
|
||||
// input : hello world\
|
||||
// output: "hello world\\" - note the comment in libuv actually reads "hello world\"
|
||||
// but it appears the comment is wrong, it should be "hello world\\"
|
||||
let reverse = '"';
|
||||
let quoteHit = true;
|
||||
for (let i = arg.length; i > 0; i--) {
|
||||
// walk the string in reverse
|
||||
reverse += arg[i - 1];
|
||||
if (quoteHit && arg[i - 1] === '\\') {
|
||||
reverse += '\\';
|
||||
}
|
||||
else if (arg[i - 1] === '"') {
|
||||
quoteHit = true;
|
||||
reverse += '\\';
|
||||
}
|
||||
else {
|
||||
quoteHit = false;
|
||||
}
|
||||
}
|
||||
reverse += '"';
|
||||
return reverse
|
||||
.split('')
|
||||
.reverse()
|
||||
.join('');
|
||||
}
|
||||
_cloneExecOptions(options) {
|
||||
options = options || {};
|
||||
const result = {
|
||||
cwd: options.cwd || process.cwd(),
|
||||
env: options.env || process.env,
|
||||
silent: options.silent || false,
|
||||
windowsVerbatimArguments: options.windowsVerbatimArguments || false,
|
||||
failOnStdErr: options.failOnStdErr || false,
|
||||
ignoreReturnCode: options.ignoreReturnCode || false,
|
||||
delay: options.delay || 10000
|
||||
};
|
||||
result.outStream = options.outStream || process.stdout;
|
||||
result.errStream = options.errStream || process.stderr;
|
||||
return result;
|
||||
}
|
||||
_getSpawnOptions(options, toolPath) {
|
||||
options = options || {};
|
||||
const result = {};
|
||||
result.cwd = options.cwd;
|
||||
result.env = options.env;
|
||||
result['windowsVerbatimArguments'] =
|
||||
options.windowsVerbatimArguments || this._isCmdFile();
|
||||
if (options.windowsVerbatimArguments) {
|
||||
result.argv0 = `"${toolPath}"`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Exec a tool.
|
||||
* Output will be streamed to the live console.
|
||||
* Returns promise with return code
|
||||
*
|
||||
* @param tool path to tool to exec
|
||||
* @param options optional exec options. See ExecOptions
|
||||
* @returns number
|
||||
*/
|
||||
exec() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// 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) => {
|
||||
this._debug(`exec tool: ${this.toolPath}`);
|
||||
this._debug('arguments:');
|
||||
for (const arg of this.args) {
|
||||
this._debug(` ${arg}`);
|
||||
}
|
||||
const optionsNonNull = this._cloneExecOptions(this.options);
|
||||
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
||||
optionsNonNull.outStream.write(this._getCommandString(optionsNonNull) + os.EOL);
|
||||
}
|
||||
const state = new ExecState(optionsNonNull, this.toolPath);
|
||||
state.on('debug', (message) => {
|
||||
this._debug(message);
|
||||
});
|
||||
const fileName = this._getSpawnFileName();
|
||||
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
|
||||
const stdbuffer = '';
|
||||
if (cp.stdout) {
|
||||
cp.stdout.on('data', (data) => {
|
||||
if (this.options.listeners && this.options.listeners.stdout) {
|
||||
this.options.listeners.stdout(data);
|
||||
}
|
||||
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
||||
optionsNonNull.outStream.write(data);
|
||||
}
|
||||
this._processLineBuffer(data, stdbuffer, (line) => {
|
||||
if (this.options.listeners && this.options.listeners.stdline) {
|
||||
this.options.listeners.stdline(line);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
const errbuffer = '';
|
||||
if (cp.stderr) {
|
||||
cp.stderr.on('data', (data) => {
|
||||
state.processStderr = true;
|
||||
if (this.options.listeners && this.options.listeners.stderr) {
|
||||
this.options.listeners.stderr(data);
|
||||
}
|
||||
if (!optionsNonNull.silent &&
|
||||
optionsNonNull.errStream &&
|
||||
optionsNonNull.outStream) {
|
||||
const s = optionsNonNull.failOnStdErr
|
||||
? optionsNonNull.errStream
|
||||
: optionsNonNull.outStream;
|
||||
s.write(data);
|
||||
}
|
||||
this._processLineBuffer(data, errbuffer, (line) => {
|
||||
if (this.options.listeners && this.options.listeners.errline) {
|
||||
this.options.listeners.errline(line);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
cp.on('error', (err) => {
|
||||
state.processError = err.message;
|
||||
state.processExited = true;
|
||||
state.processClosed = true;
|
||||
state.CheckComplete();
|
||||
});
|
||||
cp.on('exit', (code) => {
|
||||
state.processExitCode = code;
|
||||
state.processExited = true;
|
||||
this._debug(`Exit code ${code} received from tool '${this.toolPath}'`);
|
||||
state.CheckComplete();
|
||||
});
|
||||
cp.on('close', (code) => {
|
||||
state.processExitCode = code;
|
||||
state.processExited = true;
|
||||
state.processClosed = true;
|
||||
this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);
|
||||
state.CheckComplete();
|
||||
});
|
||||
state.on('done', (error, exitCode) => {
|
||||
if (stdbuffer.length > 0) {
|
||||
this.emit('stdline', stdbuffer);
|
||||
}
|
||||
if (errbuffer.length > 0) {
|
||||
this.emit('errline', errbuffer);
|
||||
}
|
||||
cp.removeAllListeners();
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
resolve(exitCode);
|
||||
}
|
||||
});
|
||||
if (this.options.input) {
|
||||
if (!cp.stdin) {
|
||||
throw new Error('child process missing stdin');
|
||||
}
|
||||
cp.stdin.end(this.options.input);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.ToolRunner = ToolRunner;
|
||||
/**
|
||||
* Convert an arg string to an array of args. Handles escaping
|
||||
*
|
||||
* @param argString string of arguments
|
||||
* @returns string[] array of arguments
|
||||
*/
|
||||
function argStringToArray(argString) {
|
||||
const args = [];
|
||||
let inQuotes = false;
|
||||
let escaped = false;
|
||||
let arg = '';
|
||||
function append(c) {
|
||||
// we only escape double quotes.
|
||||
if (escaped && c !== '"') {
|
||||
arg += '\\';
|
||||
}
|
||||
arg += c;
|
||||
escaped = false;
|
||||
}
|
||||
for (let i = 0; i < argString.length; i++) {
|
||||
const c = argString.charAt(i);
|
||||
if (c === '"') {
|
||||
if (!escaped) {
|
||||
inQuotes = !inQuotes;
|
||||
}
|
||||
else {
|
||||
append(c);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (c === '\\' && escaped) {
|
||||
append(c);
|
||||
continue;
|
||||
}
|
||||
if (c === '\\' && inQuotes) {
|
||||
escaped = true;
|
||||
continue;
|
||||
}
|
||||
if (c === ' ' && !inQuotes) {
|
||||
if (arg.length > 0) {
|
||||
args.push(arg);
|
||||
arg = '';
|
||||
}
|
||||
continue;
|
||||
}
|
||||
append(c);
|
||||
}
|
||||
if (arg.length > 0) {
|
||||
args.push(arg.trim());
|
||||
}
|
||||
return args;
|
||||
}
|
||||
exports.argStringToArray = argStringToArray;
|
||||
class ExecState extends events.EventEmitter {
|
||||
constructor(options, toolPath) {
|
||||
super();
|
||||
this.processClosed = false; // tracks whether the process has exited and stdio is closed
|
||||
this.processError = '';
|
||||
this.processExitCode = 0;
|
||||
this.processExited = false; // tracks whether the process has exited
|
||||
this.processStderr = false; // tracks whether stderr was written to
|
||||
this.delay = 10000; // 10 seconds
|
||||
this.done = false;
|
||||
this.timeout = null;
|
||||
if (!toolPath) {
|
||||
throw new Error('toolPath must not be empty');
|
||||
}
|
||||
this.options = options;
|
||||
this.toolPath = toolPath;
|
||||
if (options.delay) {
|
||||
this.delay = options.delay;
|
||||
}
|
||||
}
|
||||
CheckComplete() {
|
||||
if (this.done) {
|
||||
return;
|
||||
}
|
||||
if (this.processClosed) {
|
||||
this._setResult();
|
||||
}
|
||||
else if (this.processExited) {
|
||||
this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this);
|
||||
}
|
||||
}
|
||||
_debug(message) {
|
||||
this.emit('debug', message);
|
||||
}
|
||||
_setResult() {
|
||||
// determine whether there is an error
|
||||
let error;
|
||||
if (this.processExited) {
|
||||
if (this.processError) {
|
||||
error = new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`);
|
||||
}
|
||||
else if (this.processExitCode !== 0 && !this.options.ignoreReturnCode) {
|
||||
error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
|
||||
}
|
||||
else if (this.processStderr && this.options.failOnStdErr) {
|
||||
error = new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`);
|
||||
}
|
||||
}
|
||||
// clear the timeout
|
||||
if (this.timeout) {
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = null;
|
||||
}
|
||||
this.done = true;
|
||||
this.emit('done', error, this.processExitCode);
|
||||
}
|
||||
static HandleTimeout(state) {
|
||||
if (state.done) {
|
||||
return;
|
||||
}
|
||||
if (!state.processClosed && state.processExited) {
|
||||
const message = `The STDIO streams did not close within ${state.delay /
|
||||
1000} seconds of the exit event from process '${state.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;
|
||||
state._debug(message);
|
||||
}
|
||||
state._setResult();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=toolrunner.js.map
|
||||
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
Normal file
1
node_modules/@actions/exec/lib/toolrunner.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
67
node_modules/@actions/exec/package.json
generated
vendored
Normal file
67
node_modules/@actions/exec/package.json
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"_from": "@actions/exec",
|
||||
"_id": "@actions/exec@1.0.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-4DPChWow9yc9W3WqEbUj8Nr86xkpyE29ZzWjXucHItclLbEW6jr80Zx4nqv18QL6KK65+cifiQZXvnqgTV6oHw==",
|
||||
"_location": "/@actions/exec",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "@actions/exec",
|
||||
"name": "@actions/exec",
|
||||
"escapedName": "@actions%2fexec",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.4.tgz",
|
||||
"_shasum": "99d75310e62e59fc37d2ee6dcff6d4bffadd3a5d",
|
||||
"_spec": "@actions/exec",
|
||||
"_where": "/home/dawidd6/github/dawidd6/action-ansible-playbook",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/io": "^1.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Actions exec lib",
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/exec.js",
|
||||
"name": "@actions/exec",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git",
|
||||
"directory": "packages/exec"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --audit-level=moderate",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"types": "lib/exec.d.ts",
|
||||
"version": "1.0.4"
|
||||
}
|
||||
53
node_modules/@actions/io/README.md
generated
vendored
Normal file
53
node_modules/@actions/io/README.md
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
# `@actions/io`
|
||||
|
||||
> Core functions for cli filesystem scenarios
|
||||
|
||||
## Usage
|
||||
|
||||
#### mkdir -p
|
||||
|
||||
Recursively make a directory. Follows rules specified in [man mkdir](https://linux.die.net/man/1/mkdir) with the `-p` option specified:
|
||||
|
||||
```js
|
||||
const io = require('@actions/io');
|
||||
|
||||
await io.mkdirP('path/to/make');
|
||||
```
|
||||
|
||||
#### cp/mv
|
||||
|
||||
Copy or move files or folders. Follows rules specified in [man cp](https://linux.die.net/man/1/cp) and [man mv](https://linux.die.net/man/1/mv):
|
||||
|
||||
```js
|
||||
const io = require('@actions/io');
|
||||
|
||||
// Recursive must be true for directories
|
||||
const options = { recursive: true, force: false }
|
||||
|
||||
await io.cp('path/to/directory', 'path/to/dest', options);
|
||||
await io.mv('path/to/file', 'path/to/dest');
|
||||
```
|
||||
|
||||
#### rm -rf
|
||||
|
||||
Remove a file or folder recursively. Follows rules specified in [man rm](https://linux.die.net/man/1/rm) with the `-r` and `-f` rules specified.
|
||||
|
||||
```js
|
||||
const io = require('@actions/io');
|
||||
|
||||
await io.rmRF('path/to/directory');
|
||||
await io.rmRF('path/to/file');
|
||||
```
|
||||
|
||||
#### which
|
||||
|
||||
Get the path to a tool and resolves via paths. Follows the rules specified in [man which](https://linux.die.net/man/1/which).
|
||||
|
||||
```js
|
||||
const exec = require('@actions/exec');
|
||||
const io = require('@actions/io');
|
||||
|
||||
const pythonPath: string = await io.which('python', true)
|
||||
|
||||
await exec.exec(`"${pythonPath}"`, ['main.py']);
|
||||
```
|
||||
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
Normal file
29
node_modules/@actions/io/lib/io-util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/// <reference types="node" />
|
||||
import * as fs from 'fs';
|
||||
export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, readdir: typeof fs.promises.readdir, readlink: typeof fs.promises.readlink, rename: typeof fs.promises.rename, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
|
||||
export declare const IS_WINDOWS: boolean;
|
||||
export declare function exists(fsPath: string): Promise<boolean>;
|
||||
export declare function isDirectory(fsPath: string, useStat?: boolean): Promise<boolean>;
|
||||
/**
|
||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||
*/
|
||||
export declare function isRooted(p: string): boolean;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
export declare function mkdirP(fsPath: string, maxDepth?: number, depth?: number): Promise<void>;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
* @param extensions additional file extensions to try
|
||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||
*/
|
||||
export declare function tryGetExecutablePath(filePath: string, extensions: string[]): Promise<string>;
|
||||
195
node_modules/@actions/io/lib/io-util.js
generated
vendored
Normal file
195
node_modules/@actions/io/lib/io-util.js
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const assert_1 = require("assert");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||
exports.IS_WINDOWS = process.platform === 'win32';
|
||||
function exists(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
yield exports.stat(fsPath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
return false;
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
exports.exists = exists;
|
||||
function isDirectory(fsPath, useStat = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
|
||||
return stats.isDirectory();
|
||||
});
|
||||
}
|
||||
exports.isDirectory = isDirectory;
|
||||
/**
|
||||
* On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:
|
||||
* \, \hello, \\hello\share, C:, and C:\hello (and corresponding alternate separator cases).
|
||||
*/
|
||||
function isRooted(p) {
|
||||
p = normalizeSeparators(p);
|
||||
if (!p) {
|
||||
throw new Error('isRooted() parameter "p" cannot be empty');
|
||||
}
|
||||
if (exports.IS_WINDOWS) {
|
||||
return (p.startsWith('\\') || /^[A-Z]:/i.test(p) // e.g. \ or \hello or \\hello
|
||||
); // e.g. C: or C:\hello
|
||||
}
|
||||
return p.startsWith('/');
|
||||
}
|
||||
exports.isRooted = isRooted;
|
||||
/**
|
||||
* Recursively create a directory at `fsPath`.
|
||||
*
|
||||
* This implementation is optimistic, meaning it attempts to create the full
|
||||
* path first, and backs up the path stack from there.
|
||||
*
|
||||
* @param fsPath The path to create
|
||||
* @param maxDepth The maximum recursion depth
|
||||
* @param depth The current recursion depth
|
||||
*/
|
||||
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
assert_1.ok(fsPath, 'a path argument must be provided');
|
||||
fsPath = path.resolve(fsPath);
|
||||
if (depth >= maxDepth)
|
||||
return exports.mkdir(fsPath);
|
||||
try {
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
catch (err) {
|
||||
switch (err.code) {
|
||||
case 'ENOENT': {
|
||||
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
||||
yield exports.mkdir(fsPath);
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
let stats;
|
||||
try {
|
||||
stats = yield exports.stat(fsPath);
|
||||
}
|
||||
catch (err2) {
|
||||
throw err;
|
||||
}
|
||||
if (!stats.isDirectory())
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
/**
|
||||
* Best effort attempt to determine whether a file exists and is executable.
|
||||
* @param filePath file path to check
|
||||
* @param extensions additional file extensions to try
|
||||
* @return if file exists and is executable, returns the file path. otherwise empty string.
|
||||
*/
|
||||
function tryGetExecutablePath(filePath, extensions) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let stats = undefined;
|
||||
try {
|
||||
// test file exists
|
||||
stats = yield exports.stat(filePath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||
}
|
||||
}
|
||||
if (stats && stats.isFile()) {
|
||||
if (exports.IS_WINDOWS) {
|
||||
// on Windows, test for valid extension
|
||||
const upperExt = path.extname(filePath).toUpperCase();
|
||||
if (extensions.some(validExt => validExt.toUpperCase() === upperExt)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isUnixExecutable(stats)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
// try each extension
|
||||
const originalFilePath = filePath;
|
||||
for (const extension of extensions) {
|
||||
filePath = originalFilePath + extension;
|
||||
stats = undefined;
|
||||
try {
|
||||
stats = yield exports.stat(filePath);
|
||||
}
|
||||
catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine if executable file exists '${filePath}': ${err}`);
|
||||
}
|
||||
}
|
||||
if (stats && stats.isFile()) {
|
||||
if (exports.IS_WINDOWS) {
|
||||
// preserve the case of the actual file (since an extension was appended)
|
||||
try {
|
||||
const directory = path.dirname(filePath);
|
||||
const upperName = path.basename(filePath).toUpperCase();
|
||||
for (const actualName of yield exports.readdir(directory)) {
|
||||
if (upperName === actualName.toUpperCase()) {
|
||||
filePath = path.join(directory, actualName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Unexpected error attempting to determine the actual case of the file '${filePath}': ${err}`);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
else {
|
||||
if (isUnixExecutable(stats)) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
});
|
||||
}
|
||||
exports.tryGetExecutablePath = tryGetExecutablePath;
|
||||
function normalizeSeparators(p) {
|
||||
p = p || '';
|
||||
if (exports.IS_WINDOWS) {
|
||||
// convert slashes on Windows
|
||||
p = p.replace(/\//g, '\\');
|
||||
// remove redundant slashes
|
||||
return p.replace(/\\\\+/g, '\\');
|
||||
}
|
||||
// remove redundant slashes
|
||||
return p.replace(/\/\/+/g, '/');
|
||||
}
|
||||
// on Mac/Linux, test the execute bit
|
||||
// R W X R W X R W X
|
||||
// 256 128 64 32 16 8 4 2 1
|
||||
function isUnixExecutable(stats) {
|
||||
return ((stats.mode & 1) > 0 ||
|
||||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
||||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
||||
}
|
||||
//# sourceMappingURL=io-util.js.map
|
||||
1
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
Normal file
1
node_modules/@actions/io/lib/io-util.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAyB;AACzB,yBAAwB;AACxB,6BAA4B;AAEf,gBAYE,qTAAA;AAEF,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AAEtD,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,OAAO,KAAK,CAAA;aACb;YAED,MAAM,GAAG,CAAA;SACV;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CAAA;AAZD,wBAYC;AAED,SAAsB,WAAW,CAC/B,MAAc,EACd,UAAmB,KAAK;;QAExB,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,YAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;QAChE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAA;IAC5B,CAAC;CAAA;AAND,kCAMC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,CAAS;IAChC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAC1B,IAAI,CAAC,CAAC,EAAE;QACN,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IAED,IAAI,kBAAU,EAAE;QACd,OAAO,CACL,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,8BAA8B;SACxE,CAAA,CAAC,sBAAsB;KACzB;IAED,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AAbD,4BAaC;AAED;;;;;;;;;GASG;AACH,SAAsB,MAAM,CAC1B,MAAc,EACd,WAAmB,IAAI,EACvB,QAAgB,CAAC;;QAEjB,WAAE,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAA;QAE9C,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;QAE7B,IAAI,KAAK,IAAI,QAAQ;YAAE,OAAO,aAAK,CAAC,MAAM,CAAC,CAAA;QAE3C,IAAI;YACF,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;YACnB,OAAM;SACP;QAAC,OAAO,GAAG,EAAE;YACZ,QAAQ,GAAG,CAAC,IAAI,EAAE;gBAChB,KAAK,QAAQ,CAAC,CAAC;oBACb,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;oBACvD,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;oBACnB,OAAM;iBACP;gBACD,OAAO,CAAC,CAAC;oBACP,IAAI,KAAe,CAAA;oBAEnB,IAAI;wBACF,KAAK,GAAG,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;qBAC3B;oBAAC,OAAO,IAAI,EAAE;wBACb,MAAM,GAAG,CAAA;qBACV;oBAED,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;wBAAE,MAAM,GAAG,CAAA;iBACpC;aACF;SACF;IACH,CAAC;CAAA;AAlCD,wBAkCC;AAED;;;;;GAKG;AACH,SAAsB,oBAAoB,CACxC,QAAgB,EAChB,UAAoB;;QAEpB,IAAI,KAAK,GAAyB,SAAS,CAAA;QAC3C,IAAI;YACF,mBAAmB;YACnB,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;SAC7B;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;aACF;SACF;QACD,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;YAC3B,IAAI,kBAAU,EAAE;gBACd,uCAAuC;gBACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;gBACrD,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,EAAE;oBACpE,OAAO,QAAQ,CAAA;iBAChB;aACF;iBAAM;gBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;oBAC3B,OAAO,QAAQ,CAAA;iBAChB;aACF;SACF;QAED,qBAAqB;QACrB,MAAM,gBAAgB,GAAG,QAAQ,CAAA;QACjC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAAA;YAEvC,KAAK,GAAG,SAAS,CAAA;YACjB,IAAI;gBACF,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;aAC7B;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;oBACzB,sCAAsC;oBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;iBACF;aACF;YAED,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;gBAC3B,IAAI,kBAAU,EAAE;oBACd,yEAAyE;oBACzE,IAAI;wBACF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;wBACxC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;wBACvD,KAAK,MAAM,UAAU,IAAI,MAAM,eAAO,CAAC,SAAS,CAAC,EAAE;4BACjD,IAAI,SAAS,KAAK,UAAU,CAAC,WAAW,EAAE,EAAE;gCAC1C,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;gCAC3C,MAAK;6BACN;yBACF;qBACF;oBAAC,OAAO,GAAG,EAAE;wBACZ,sCAAsC;wBACtC,OAAO,CAAC,GAAG,CACT,yEAAyE,QAAQ,MAAM,GAAG,EAAE,CAC7F,CAAA;qBACF;oBAED,OAAO,QAAQ,CAAA;iBAChB;qBAAM;oBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;wBAC3B,OAAO,QAAQ,CAAA;qBAChB;iBACF;aACF;SACF;QAED,OAAO,EAAE,CAAA;IACX,CAAC;CAAA;AA5ED,oDA4EC;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IACX,IAAI,kBAAU,EAAE;QACd,6BAA6B;QAC7B,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAE1B,2BAA2B;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KACjC;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC;AAED,qCAAqC;AACrC,6BAA6B;AAC7B,6BAA6B;AAC7B,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACxD,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC"}
|
||||
56
node_modules/@actions/io/lib/io.d.ts
generated
vendored
Normal file
56
node_modules/@actions/io/lib/io.d.ts
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
*/
|
||||
export interface CopyOptions {
|
||||
/** Optional. Whether to recursively copy all subdirectories. Defaults to false */
|
||||
recursive?: boolean;
|
||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Interface for cp/mv options
|
||||
*/
|
||||
export interface MoveOptions {
|
||||
/** Optional. Whether to overwrite existing files in the destination. Defaults to true */
|
||||
force?: boolean;
|
||||
}
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
export declare function cp(source: string, dest: string, options?: CopyOptions): Promise<void>;
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See MoveOptions.
|
||||
*/
|
||||
export declare function mv(source: string, dest: string, options?: MoveOptions): Promise<void>;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param inputPath path to remove
|
||||
*/
|
||||
export declare function rmRF(inputPath: string): Promise<void>;
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
* Will throw if it fails
|
||||
*
|
||||
* @param fsPath path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
export declare function mkdirP(fsPath: string): Promise<void>;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, it will throw.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param check whether to check if tool exists
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
export declare function which(tool: string, check?: boolean): Promise<string>;
|
||||
290
node_modules/@actions/io/lib/io.js
generated
vendored
Normal file
290
node_modules/@actions/io/lib/io.js
generated
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const childProcess = require("child_process");
|
||||
const path = require("path");
|
||||
const util_1 = require("util");
|
||||
const ioUtil = require("./io-util");
|
||||
const exec = util_1.promisify(childProcess.exec);
|
||||
/**
|
||||
* Copies a file or folder.
|
||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See CopyOptions.
|
||||
*/
|
||||
function cp(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const { force, recursive } = readCopyOptions(options);
|
||||
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
||||
// Dest is an existing file, but not forcing
|
||||
if (destStat && destStat.isFile() && !force) {
|
||||
return;
|
||||
}
|
||||
// If dest is an existing directory, should copy inside.
|
||||
const newDest = destStat && destStat.isDirectory()
|
||||
? path.join(dest, path.basename(source))
|
||||
: dest;
|
||||
if (!(yield ioUtil.exists(source))) {
|
||||
throw new Error(`no such file or directory: ${source}`);
|
||||
}
|
||||
const sourceStat = yield ioUtil.stat(source);
|
||||
if (sourceStat.isDirectory()) {
|
||||
if (!recursive) {
|
||||
throw new Error(`Failed to copy. ${source} is a directory, but tried to copy without recursive flag.`);
|
||||
}
|
||||
else {
|
||||
yield cpDirRecursive(source, newDest, 0, force);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (path.relative(source, newDest) === '') {
|
||||
// a file cannot be copied to itself
|
||||
throw new Error(`'${newDest}' and '${source}' are the same file`);
|
||||
}
|
||||
yield copyFile(source, newDest, force);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.cp = cp;
|
||||
/**
|
||||
* Moves a path.
|
||||
*
|
||||
* @param source source path
|
||||
* @param dest destination path
|
||||
* @param options optional. See MoveOptions.
|
||||
*/
|
||||
function mv(source, dest, options = {}) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (yield ioUtil.exists(dest)) {
|
||||
let destExists = true;
|
||||
if (yield ioUtil.isDirectory(dest)) {
|
||||
// If dest is directory copy src into dest
|
||||
dest = path.join(dest, path.basename(source));
|
||||
destExists = yield ioUtil.exists(dest);
|
||||
}
|
||||
if (destExists) {
|
||||
if (options.force == null || options.force) {
|
||||
yield rmRF(dest);
|
||||
}
|
||||
else {
|
||||
throw new Error('Destination already exists');
|
||||
}
|
||||
}
|
||||
}
|
||||
yield mkdirP(path.dirname(dest));
|
||||
yield ioUtil.rename(source, dest);
|
||||
});
|
||||
}
|
||||
exports.mv = mv;
|
||||
/**
|
||||
* Remove a path recursively with force
|
||||
*
|
||||
* @param inputPath path to remove
|
||||
*/
|
||||
function rmRF(inputPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
||||
try {
|
||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
||||
yield exec(`rd /s /q "${inputPath}"`);
|
||||
}
|
||||
else {
|
||||
yield exec(`del /f /a "${inputPath}"`);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
}
|
||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
||||
try {
|
||||
yield ioUtil.unlink(inputPath);
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
else {
|
||||
let isDir = false;
|
||||
try {
|
||||
isDir = yield ioUtil.isDirectory(inputPath);
|
||||
}
|
||||
catch (err) {
|
||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||
// other errors are valid
|
||||
if (err.code !== 'ENOENT')
|
||||
throw err;
|
||||
return;
|
||||
}
|
||||
if (isDir) {
|
||||
yield exec(`rm -rf "${inputPath}"`);
|
||||
}
|
||||
else {
|
||||
yield ioUtil.unlink(inputPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.rmRF = rmRF;
|
||||
/**
|
||||
* Make a directory. Creates the full path with folders in between
|
||||
* Will throw if it fails
|
||||
*
|
||||
* @param fsPath path to create
|
||||
* @returns Promise<void>
|
||||
*/
|
||||
function mkdirP(fsPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield ioUtil.mkdirP(fsPath);
|
||||
});
|
||||
}
|
||||
exports.mkdirP = mkdirP;
|
||||
/**
|
||||
* Returns path of a tool had the tool actually been invoked. Resolves via paths.
|
||||
* If you check and the tool does not exist, it will throw.
|
||||
*
|
||||
* @param tool name of the tool
|
||||
* @param check whether to check if tool exists
|
||||
* @returns Promise<string> path to tool
|
||||
*/
|
||||
function which(tool, check) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!tool) {
|
||||
throw new Error("parameter 'tool' is required");
|
||||
}
|
||||
// recursive when check=true
|
||||
if (check) {
|
||||
const result = yield which(tool, false);
|
||||
if (!result) {
|
||||
if (ioUtil.IS_WINDOWS) {
|
||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unable to locate executable file: ${tool}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
// build the list of extensions to try
|
||||
const extensions = [];
|
||||
if (ioUtil.IS_WINDOWS && process.env.PATHEXT) {
|
||||
for (const extension of process.env.PATHEXT.split(path.delimiter)) {
|
||||
if (extension) {
|
||||
extensions.push(extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
// if it's rooted, return it if exists. otherwise return empty.
|
||||
if (ioUtil.isRooted(tool)) {
|
||||
const filePath = yield ioUtil.tryGetExecutablePath(tool, extensions);
|
||||
if (filePath) {
|
||||
return filePath;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
// if any path separators, return empty
|
||||
if (tool.includes('/') || (ioUtil.IS_WINDOWS && tool.includes('\\'))) {
|
||||
return '';
|
||||
}
|
||||
// build the list of directories
|
||||
//
|
||||
// Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
|
||||
// it feels like we should not do this. Checking the current directory seems like more of a use
|
||||
// case of a shell, and the which() function exposed by the toolkit should strive for consistency
|
||||
// across platforms.
|
||||
const directories = [];
|
||||
if (process.env.PATH) {
|
||||
for (const p of process.env.PATH.split(path.delimiter)) {
|
||||
if (p) {
|
||||
directories.push(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
// return the first match
|
||||
for (const directory of directories) {
|
||||
const filePath = yield ioUtil.tryGetExecutablePath(directory + path.sep + tool, extensions);
|
||||
if (filePath) {
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`which failed with message ${err.message}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.which = which;
|
||||
function readCopyOptions(options) {
|
||||
const force = options.force == null ? true : options.force;
|
||||
const recursive = Boolean(options.recursive);
|
||||
return { force, recursive };
|
||||
}
|
||||
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Ensure there is not a run away recursive copy
|
||||
if (currentDepth >= 255)
|
||||
return;
|
||||
currentDepth++;
|
||||
yield mkdirP(destDir);
|
||||
const files = yield ioUtil.readdir(sourceDir);
|
||||
for (const fileName of files) {
|
||||
const srcFile = `${sourceDir}/${fileName}`;
|
||||
const destFile = `${destDir}/${fileName}`;
|
||||
const srcFileStat = yield ioUtil.lstat(srcFile);
|
||||
if (srcFileStat.isDirectory()) {
|
||||
// Recurse
|
||||
yield cpDirRecursive(srcFile, destFile, currentDepth, force);
|
||||
}
|
||||
else {
|
||||
yield copyFile(srcFile, destFile, force);
|
||||
}
|
||||
}
|
||||
// Change the mode for the newly created directory
|
||||
yield ioUtil.chmod(destDir, (yield ioUtil.stat(sourceDir)).mode);
|
||||
});
|
||||
}
|
||||
// Buffered file copy
|
||||
function copyFile(srcFile, destFile, force) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if ((yield ioUtil.lstat(srcFile)).isSymbolicLink()) {
|
||||
// unlink/re-link it
|
||||
try {
|
||||
yield ioUtil.lstat(destFile);
|
||||
yield ioUtil.unlink(destFile);
|
||||
}
|
||||
catch (e) {
|
||||
// Try to override file permission
|
||||
if (e.code === 'EPERM') {
|
||||
yield ioUtil.chmod(destFile, '0666');
|
||||
yield ioUtil.unlink(destFile);
|
||||
}
|
||||
// other errors = it doesn't exist, no work to do
|
||||
}
|
||||
// Copy over symlink
|
||||
const symlinkFull = yield ioUtil.readlink(srcFile);
|
||||
yield ioUtil.symlink(symlinkFull, destFile, ioUtil.IS_WINDOWS ? 'junction' : null);
|
||||
}
|
||||
else if (!(yield ioUtil.exists(destFile)) || force) {
|
||||
yield ioUtil.copyFile(srcFile, destFile);
|
||||
}
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=io.js.map
|
||||
1
node_modules/@actions/io/lib/io.js.map
generated
vendored
Normal file
1
node_modules/@actions/io/lib/io.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
63
node_modules/@actions/io/package.json
generated
vendored
Normal file
63
node_modules/@actions/io/package.json
generated
vendored
Normal 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": "/home/dawidd6/github/dawidd6/action-ansible-playbook/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"
|
||||
}
|
||||
13
node_modules/yaml/LICENSE
generated
vendored
Normal file
13
node_modules/yaml/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright 2018 Eemeli Aro <eemeli@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright notice
|
||||
and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
127
node_modules/yaml/README.md
generated
vendored
Normal file
127
node_modules/yaml/README.md
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
# YAML <a href="https://www.npmjs.com/package/yaml"><img align="right" src="https://badge.fury.io/js/yaml.svg" title="npm package" /></a><a href="https://travis-ci.org/eemeli/yaml"><img align="right" src="https://travis-ci.org/eemeli/yaml.svg?branch=master" title="Build status" /></a>
|
||||
|
||||
`yaml` is a JavaScript parser and stringifier for [YAML](http://yaml.org/), a human friendly data serialization standard. It supports both parsing and stringifying data using all versions of YAML, along with all common data schemas. As a particularly distinguishing feature, `yaml` fully supports reading and writing comments and blank lines in YAML documents.
|
||||
|
||||
The library is released under the ISC open source license, and the code is [available on GitHub](https://github.com/eemeli/yaml/). It has no external dependencies and runs on Node.js 6 and later, and in browsers from IE 11 upwards.
|
||||
|
||||
For the purposes of versioning, any changes that break any of the endpoints or APIs documented here will be considered semver-major breaking changes. Undocumented library internals may change between minor versions, and previous APIs may be deprecated (but not removed).
|
||||
|
||||
For more information, see the project's documentation site: [**eemeli.org/yaml**](https://eemeli.org/yaml/)
|
||||
|
||||
To install:
|
||||
|
||||
```sh
|
||||
npm install yaml
|
||||
```
|
||||
|
||||
Note: `yaml` 0.x and 1.x are rather different implementations. For the earlier `yaml`, see [tj/js-yaml](https://github.com/tj/js-yaml).
|
||||
|
||||
## API Overview
|
||||
|
||||
The API provided by `yaml` has three layers, depending on how deep you need to go: [Parse & Stringify](https://eemeli.org/yaml/#parse-amp-stringify), [Documents](https://eemeli.org/yaml/#documents), and the [CST Parser](https://eemeli.org/yaml/#cst-parser). The first has the simplest API and "just works", the second gets you all the bells and whistles supported by the library along with a decent [AST](https://eemeli.org/yaml/#content-nodes), and the third is the closest to YAML source, making it fast, raw, and crude.
|
||||
|
||||
```js
|
||||
import YAML from 'yaml'
|
||||
// or
|
||||
const YAML = require('yaml')
|
||||
```
|
||||
|
||||
### Parse & Stringify
|
||||
|
||||
- [`YAML.parse(str, options): value`](https://eemeli.org/yaml/#yaml-parse)
|
||||
- [`YAML.stringify(value, options): string`](https://eemeli.org/yaml/#yaml-stringify)
|
||||
|
||||
### YAML Documents
|
||||
|
||||
- [`YAML.createNode(value, wrapScalars, tag): Node`](https://eemeli.org/yaml/#creating-nodes)
|
||||
- [`YAML.defaultOptions`](https://eemeli.org/yaml/#options)
|
||||
- [`YAML.Document`](https://eemeli.org/yaml/#yaml-documents)
|
||||
- [`constructor(options)`](https://eemeli.org/yaml/#creating-documents)
|
||||
- [`defaults`](https://eemeli.org/yaml/#options)
|
||||
- [`#anchors`](https://eemeli.org/yaml/#working-with-anchors)
|
||||
- [`#contents`](https://eemeli.org/yaml/#content-nodes)
|
||||
- [`#errors`](https://eemeli.org/yaml/#errors)
|
||||
- [`YAML.parseAllDocuments(str, options): YAML.Document[]`](https://eemeli.org/yaml/#parsing-documents)
|
||||
- [`YAML.parseDocument(str, options): YAML.Document`](https://eemeli.org/yaml/#parsing-documents)
|
||||
|
||||
```js
|
||||
import { Pair, YAMLMap, YAMLSeq } from 'yaml/types'
|
||||
```
|
||||
|
||||
- [`new Pair(key, value)`](https://eemeli.org/yaml/#creating-nodes)
|
||||
- [`new YAMLMap()`](https://eemeli.org/yaml/#creating-nodes)
|
||||
- [`new YAMLSeq()`](https://eemeli.org/yaml/#creating-nodes)
|
||||
|
||||
### CST Parser
|
||||
|
||||
```js
|
||||
import parseCST from 'yaml/parse-cst'
|
||||
```
|
||||
|
||||
- [`parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/#parsecst)
|
||||
- [`YAML.parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/#parsecst)
|
||||
|
||||
## YAML.parse
|
||||
|
||||
```yaml
|
||||
# file.yml
|
||||
YAML:
|
||||
- A human-readable data serialization language
|
||||
- https://en.wikipedia.org/wiki/YAML
|
||||
yaml:
|
||||
- A complete JavaScript implementation
|
||||
- https://www.npmjs.com/package/yaml
|
||||
```
|
||||
|
||||
```js
|
||||
import fs from 'fs'
|
||||
import YAML from 'yaml'
|
||||
|
||||
YAML.parse('3.14159')
|
||||
// 3.14159
|
||||
|
||||
YAML.parse('[ true, false, maybe, null ]\n')
|
||||
// [ true, false, 'maybe', null ]
|
||||
|
||||
const file = fs.readFileSync('./file.yml', 'utf8')
|
||||
YAML.parse(file)
|
||||
// { YAML:
|
||||
// [ 'A human-readable data serialization language',
|
||||
// 'https://en.wikipedia.org/wiki/YAML' ],
|
||||
// yaml:
|
||||
// [ 'A complete JavaScript implementation',
|
||||
// 'https://www.npmjs.com/package/yaml' ] }
|
||||
```
|
||||
|
||||
## YAML.stringify
|
||||
|
||||
```js
|
||||
import YAML from 'yaml'
|
||||
|
||||
YAML.stringify(3.14159)
|
||||
// '3.14159\n'
|
||||
|
||||
YAML.stringify([true, false, 'maybe', null])
|
||||
// `- true
|
||||
// - false
|
||||
// - maybe
|
||||
// - null
|
||||
// `
|
||||
|
||||
YAML.stringify({ number: 3, plain: 'string', block: 'two\nlines\n' })
|
||||
// `number: 3
|
||||
// plain: string
|
||||
// block: >
|
||||
// two
|
||||
//
|
||||
// lines
|
||||
// `
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Browser testing provided by:
|
||||
|
||||
<a href="https://www.browserstack.com/open-source">
|
||||
<img width=200 src="https://eemeli.org/yaml/images/browserstack.svg" />
|
||||
</a>
|
||||
1277
node_modules/yaml/browser/dist/PlainValue-ff5147c6.js
generated
vendored
Normal file
1277
node_modules/yaml/browser/dist/PlainValue-ff5147c6.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
679
node_modules/yaml/browser/dist/Schema-2bf2c74e.js
generated
vendored
Normal file
679
node_modules/yaml/browser/dist/Schema-2bf2c74e.js
generated
vendored
Normal file
@@ -0,0 +1,679 @@
|
||||
import { _ as _createForOfIteratorHelper, h as _slicedToArray, a as _typeof, b as _createClass, e as _defineProperty, c as _classCallCheck, d as defaultTagPrefix, n as defaultTags } from './PlainValue-ff5147c6.js';
|
||||
import { d as YAMLMap, g as resolveMap, Y as YAMLSeq, h as resolveSeq, j as resolveString, c as stringifyString, s as strOptions, S as Scalar, n as nullOptions, a as boolOptions, i as intOptions, k as stringifyNumber, N as Node, A as Alias, P as Pair } from './resolveSeq-04825f30.js';
|
||||
import { b as binary, o as omap, p as pairs, s as set, i as intTime, f as floatTime, t as timestamp, a as warnOptionDeprecation } from './warnings-0e4b70d3.js';
|
||||
|
||||
function createMap(schema, obj, ctx) {
|
||||
var map = new YAMLMap(schema);
|
||||
|
||||
if (obj instanceof Map) {
|
||||
var _iterator = _createForOfIteratorHelper(obj),
|
||||
_step;
|
||||
|
||||
try {
|
||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||
var _step$value = _slicedToArray(_step.value, 2),
|
||||
key = _step$value[0],
|
||||
value = _step$value[1];
|
||||
|
||||
map.items.push(schema.createPair(key, value, ctx));
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator.e(err);
|
||||
} finally {
|
||||
_iterator.f();
|
||||
}
|
||||
} else if (obj && _typeof(obj) === 'object') {
|
||||
for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) {
|
||||
var _key = _Object$keys[_i];
|
||||
map.items.push(schema.createPair(_key, obj[_key], ctx));
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof schema.sortMapEntries === 'function') {
|
||||
map.items.sort(schema.sortMapEntries);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
var map = {
|
||||
createNode: createMap,
|
||||
default: true,
|
||||
nodeClass: YAMLMap,
|
||||
tag: 'tag:yaml.org,2002:map',
|
||||
resolve: resolveMap
|
||||
};
|
||||
|
||||
function createSeq(schema, obj, ctx) {
|
||||
var seq = new YAMLSeq(schema);
|
||||
|
||||
if (obj && obj[Symbol.iterator]) {
|
||||
var _iterator = _createForOfIteratorHelper(obj),
|
||||
_step;
|
||||
|
||||
try {
|
||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||
var it = _step.value;
|
||||
var v = schema.createNode(it, ctx.wrapScalars, null, ctx);
|
||||
seq.items.push(v);
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator.e(err);
|
||||
} finally {
|
||||
_iterator.f();
|
||||
}
|
||||
}
|
||||
|
||||
return seq;
|
||||
}
|
||||
|
||||
var seq = {
|
||||
createNode: createSeq,
|
||||
default: true,
|
||||
nodeClass: YAMLSeq,
|
||||
tag: 'tag:yaml.org,2002:seq',
|
||||
resolve: resolveSeq
|
||||
};
|
||||
|
||||
var string = {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'string';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:str',
|
||||
resolve: resolveString,
|
||||
stringify: function stringify(item, ctx, onComment, onChompKeep) {
|
||||
ctx = Object.assign({
|
||||
actualString: true
|
||||
}, ctx);
|
||||
return stringifyString(item, ctx, onComment, onChompKeep);
|
||||
},
|
||||
options: strOptions
|
||||
};
|
||||
|
||||
var failsafe = [map, seq, string];
|
||||
|
||||
/* global BigInt */
|
||||
|
||||
var intIdentify = function intIdentify(value) {
|
||||
return typeof value === 'bigint' || Number.isInteger(value);
|
||||
};
|
||||
|
||||
var intResolve = function intResolve(src, part, radix) {
|
||||
return intOptions.asBigInt ? BigInt(src) : parseInt(part, radix);
|
||||
};
|
||||
|
||||
function intStringify(node, radix, prefix) {
|
||||
var value = node.value;
|
||||
if (intIdentify(value) && value >= 0) return prefix + value.toString(radix);
|
||||
return stringifyNumber(node);
|
||||
}
|
||||
|
||||
var nullObj = {
|
||||
identify: function identify(value) {
|
||||
return value == null;
|
||||
},
|
||||
createNode: function createNode(schema, value, ctx) {
|
||||
return ctx.wrapScalars ? new Scalar(null) : null;
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:null',
|
||||
test: /^(?:~|[Nn]ull|NULL)?$/,
|
||||
resolve: function resolve() {
|
||||
return null;
|
||||
},
|
||||
options: nullOptions,
|
||||
stringify: function stringify() {
|
||||
return nullOptions.nullStr;
|
||||
}
|
||||
};
|
||||
var boolObj = {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'boolean';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
||||
resolve: function resolve(str) {
|
||||
return str[0] === 't' || str[0] === 'T';
|
||||
},
|
||||
options: boolOptions,
|
||||
stringify: function stringify(_ref) {
|
||||
var value = _ref.value;
|
||||
return value ? boolOptions.trueStr : boolOptions.falseStr;
|
||||
}
|
||||
};
|
||||
var octObj = {
|
||||
identify: function identify(value) {
|
||||
return intIdentify(value) && value >= 0;
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'OCT',
|
||||
test: /^0o([0-7]+)$/,
|
||||
resolve: function resolve(str, oct) {
|
||||
return intResolve(str, oct, 8);
|
||||
},
|
||||
options: intOptions,
|
||||
stringify: function stringify(node) {
|
||||
return intStringify(node, 8, '0o');
|
||||
}
|
||||
};
|
||||
var intObj = {
|
||||
identify: intIdentify,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
test: /^[-+]?[0-9]+$/,
|
||||
resolve: function resolve(str) {
|
||||
return intResolve(str, str, 10);
|
||||
},
|
||||
options: intOptions,
|
||||
stringify: stringifyNumber
|
||||
};
|
||||
var hexObj = {
|
||||
identify: function identify(value) {
|
||||
return intIdentify(value) && value >= 0;
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'HEX',
|
||||
test: /^0x([0-9a-fA-F]+)$/,
|
||||
resolve: function resolve(str, hex) {
|
||||
return intResolve(str, hex, 16);
|
||||
},
|
||||
options: intOptions,
|
||||
stringify: function stringify(node) {
|
||||
return intStringify(node, 16, '0x');
|
||||
}
|
||||
};
|
||||
var nanObj = {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'number';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
||||
resolve: function resolve(str, nan) {
|
||||
return nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
|
||||
},
|
||||
stringify: stringifyNumber
|
||||
};
|
||||
var expObj = {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'number';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
format: 'EXP',
|
||||
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
||||
resolve: function resolve(str) {
|
||||
return parseFloat(str);
|
||||
},
|
||||
stringify: function stringify(_ref2) {
|
||||
var value = _ref2.value;
|
||||
return Number(value).toExponential();
|
||||
}
|
||||
};
|
||||
var floatObj = {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'number';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
|
||||
resolve: function resolve(str, frac1, frac2) {
|
||||
var frac = frac1 || frac2;
|
||||
var node = new Scalar(parseFloat(str));
|
||||
if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
|
||||
return node;
|
||||
},
|
||||
stringify: stringifyNumber
|
||||
};
|
||||
var core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
|
||||
|
||||
/* global BigInt */
|
||||
|
||||
var intIdentify$1 = function intIdentify(value) {
|
||||
return typeof value === 'bigint' || Number.isInteger(value);
|
||||
};
|
||||
|
||||
var stringifyJSON = function stringifyJSON(_ref) {
|
||||
var value = _ref.value;
|
||||
return JSON.stringify(value);
|
||||
};
|
||||
|
||||
var json = [map, seq, {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'string';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:str',
|
||||
resolve: resolveString,
|
||||
stringify: stringifyJSON
|
||||
}, {
|
||||
identify: function identify(value) {
|
||||
return value == null;
|
||||
},
|
||||
createNode: function createNode(schema, value, ctx) {
|
||||
return ctx.wrapScalars ? new Scalar(null) : null;
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:null',
|
||||
test: /^null$/,
|
||||
resolve: function resolve() {
|
||||
return null;
|
||||
},
|
||||
stringify: stringifyJSON
|
||||
}, {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'boolean';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^true|false$/,
|
||||
resolve: function resolve(str) {
|
||||
return str === 'true';
|
||||
},
|
||||
stringify: stringifyJSON
|
||||
}, {
|
||||
identify: intIdentify$1,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
test: /^-?(?:0|[1-9][0-9]*)$/,
|
||||
resolve: function resolve(str) {
|
||||
return intOptions.asBigInt ? BigInt(str) : parseInt(str, 10);
|
||||
},
|
||||
stringify: function stringify(_ref2) {
|
||||
var value = _ref2.value;
|
||||
return intIdentify$1(value) ? value.toString() : JSON.stringify(value);
|
||||
}
|
||||
}, {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'number';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
||||
resolve: function resolve(str) {
|
||||
return parseFloat(str);
|
||||
},
|
||||
stringify: stringifyJSON
|
||||
}];
|
||||
|
||||
json.scalarFallback = function (str) {
|
||||
throw new SyntaxError("Unresolved plain scalar ".concat(JSON.stringify(str)));
|
||||
};
|
||||
|
||||
/* global BigInt */
|
||||
|
||||
var boolStringify = function boolStringify(_ref) {
|
||||
var value = _ref.value;
|
||||
return value ? boolOptions.trueStr : boolOptions.falseStr;
|
||||
};
|
||||
|
||||
var intIdentify$2 = function intIdentify(value) {
|
||||
return typeof value === 'bigint' || Number.isInteger(value);
|
||||
};
|
||||
|
||||
function intResolve$1(sign, src, radix) {
|
||||
var str = src.replace(/_/g, '');
|
||||
|
||||
if (intOptions.asBigInt) {
|
||||
switch (radix) {
|
||||
case 2:
|
||||
str = "0b".concat(str);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
str = "0o".concat(str);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
str = "0x".concat(str);
|
||||
break;
|
||||
}
|
||||
|
||||
var _n = BigInt(str);
|
||||
|
||||
return sign === '-' ? BigInt(-1) * _n : _n;
|
||||
}
|
||||
|
||||
var n = parseInt(str, radix);
|
||||
return sign === '-' ? -1 * n : n;
|
||||
}
|
||||
|
||||
function intStringify$1(node, radix, prefix) {
|
||||
var value = node.value;
|
||||
|
||||
if (intIdentify$2(value)) {
|
||||
var str = value.toString(radix);
|
||||
return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;
|
||||
}
|
||||
|
||||
return stringifyNumber(node);
|
||||
}
|
||||
|
||||
var yaml11 = failsafe.concat([{
|
||||
identify: function identify(value) {
|
||||
return value == null;
|
||||
},
|
||||
createNode: function createNode(schema, value, ctx) {
|
||||
return ctx.wrapScalars ? new Scalar(null) : null;
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:null',
|
||||
test: /^(?:~|[Nn]ull|NULL)?$/,
|
||||
resolve: function resolve() {
|
||||
return null;
|
||||
},
|
||||
options: nullOptions,
|
||||
stringify: function stringify() {
|
||||
return nullOptions.nullStr;
|
||||
}
|
||||
}, {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'boolean';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
||||
resolve: function resolve() {
|
||||
return true;
|
||||
},
|
||||
options: boolOptions,
|
||||
stringify: boolStringify
|
||||
}, {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'boolean';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
|
||||
resolve: function resolve() {
|
||||
return false;
|
||||
},
|
||||
options: boolOptions,
|
||||
stringify: boolStringify
|
||||
}, {
|
||||
identify: intIdentify$2,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'BIN',
|
||||
test: /^([-+]?)0b([0-1_]+)$/,
|
||||
resolve: function resolve(str, sign, bin) {
|
||||
return intResolve$1(sign, bin, 2);
|
||||
},
|
||||
stringify: function stringify(node) {
|
||||
return intStringify$1(node, 2, '0b');
|
||||
}
|
||||
}, {
|
||||
identify: intIdentify$2,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'OCT',
|
||||
test: /^([-+]?)0([0-7_]+)$/,
|
||||
resolve: function resolve(str, sign, oct) {
|
||||
return intResolve$1(sign, oct, 8);
|
||||
},
|
||||
stringify: function stringify(node) {
|
||||
return intStringify$1(node, 8, '0');
|
||||
}
|
||||
}, {
|
||||
identify: intIdentify$2,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
test: /^([-+]?)([0-9][0-9_]*)$/,
|
||||
resolve: function resolve(str, sign, abs) {
|
||||
return intResolve$1(sign, abs, 10);
|
||||
},
|
||||
stringify: stringifyNumber
|
||||
}, {
|
||||
identify: intIdentify$2,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'HEX',
|
||||
test: /^([-+]?)0x([0-9a-fA-F_]+)$/,
|
||||
resolve: function resolve(str, sign, hex) {
|
||||
return intResolve$1(sign, hex, 16);
|
||||
},
|
||||
stringify: function stringify(node) {
|
||||
return intStringify$1(node, 16, '0x');
|
||||
}
|
||||
}, {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'number';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
||||
resolve: function resolve(str, nan) {
|
||||
return nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY;
|
||||
},
|
||||
stringify: stringifyNumber
|
||||
}, {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'number';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
format: 'EXP',
|
||||
test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
||||
resolve: function resolve(str) {
|
||||
return parseFloat(str.replace(/_/g, ''));
|
||||
},
|
||||
stringify: function stringify(_ref2) {
|
||||
var value = _ref2.value;
|
||||
return Number(value).toExponential();
|
||||
}
|
||||
}, {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'number';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
|
||||
resolve: function resolve(str, frac) {
|
||||
var node = new Scalar(parseFloat(str.replace(/_/g, '')));
|
||||
|
||||
if (frac) {
|
||||
var f = frac.replace(/_/g, '');
|
||||
if (f[f.length - 1] === '0') node.minFractionDigits = f.length;
|
||||
}
|
||||
|
||||
return node;
|
||||
},
|
||||
stringify: stringifyNumber
|
||||
}], binary, omap, pairs, set, intTime, floatTime, timestamp);
|
||||
|
||||
var schemas = {
|
||||
core: core,
|
||||
failsafe: failsafe,
|
||||
json: json,
|
||||
yaml11: yaml11
|
||||
};
|
||||
var tags = {
|
||||
binary: binary,
|
||||
bool: boolObj,
|
||||
float: floatObj,
|
||||
floatExp: expObj,
|
||||
floatNaN: nanObj,
|
||||
floatTime: floatTime,
|
||||
int: intObj,
|
||||
intHex: hexObj,
|
||||
intOct: octObj,
|
||||
intTime: intTime,
|
||||
map: map,
|
||||
null: nullObj,
|
||||
omap: omap,
|
||||
pairs: pairs,
|
||||
seq: seq,
|
||||
set: set,
|
||||
timestamp: timestamp
|
||||
};
|
||||
|
||||
function findTagObject(value, tagName, tags) {
|
||||
if (tagName) {
|
||||
var match = tags.filter(function (t) {
|
||||
return t.tag === tagName;
|
||||
});
|
||||
var tagObj = match.find(function (t) {
|
||||
return !t.format;
|
||||
}) || match[0];
|
||||
if (!tagObj) throw new Error("Tag ".concat(tagName, " not found"));
|
||||
return tagObj;
|
||||
} // TODO: deprecate/remove class check
|
||||
|
||||
|
||||
return tags.find(function (t) {
|
||||
return (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format;
|
||||
});
|
||||
}
|
||||
|
||||
function createNode(value, tagName, ctx) {
|
||||
if (value instanceof Node) return value;
|
||||
var defaultPrefix = ctx.defaultPrefix,
|
||||
onTagObj = ctx.onTagObj,
|
||||
prevObjects = ctx.prevObjects,
|
||||
schema = ctx.schema,
|
||||
wrapScalars = ctx.wrapScalars;
|
||||
if (tagName && tagName.startsWith('!!')) tagName = defaultPrefix + tagName.slice(2);
|
||||
var tagObj = findTagObject(value, tagName, schema.tags);
|
||||
|
||||
if (!tagObj) {
|
||||
if (typeof value.toJSON === 'function') value = value.toJSON();
|
||||
if (_typeof(value) !== 'object') return wrapScalars ? new Scalar(value) : value;
|
||||
tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map;
|
||||
}
|
||||
|
||||
if (onTagObj) {
|
||||
onTagObj(tagObj);
|
||||
delete ctx.onTagObj;
|
||||
} // Detect duplicate references to the same object & use Alias nodes for all
|
||||
// after first. The `obj` wrapper allows for circular references to resolve.
|
||||
|
||||
|
||||
var obj = {};
|
||||
|
||||
if (value && _typeof(value) === 'object' && prevObjects) {
|
||||
var prev = prevObjects.get(value);
|
||||
|
||||
if (prev) {
|
||||
var alias = new Alias(prev); // leaves source dirty; must be cleaned by caller
|
||||
|
||||
ctx.aliasNodes.push(alias); // defined along with prevObjects
|
||||
|
||||
return alias;
|
||||
}
|
||||
|
||||
obj.value = value;
|
||||
prevObjects.set(value, obj);
|
||||
}
|
||||
|
||||
obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new Scalar(value) : value;
|
||||
if (tagName && obj.node instanceof Node) obj.node.tag = tagName;
|
||||
return obj.node;
|
||||
}
|
||||
|
||||
function getSchemaTags(schemas, knownTags, customTags, schemaId) {
|
||||
var tags = schemas[schemaId.replace(/\W/g, '')]; // 'yaml-1.1' -> 'yaml11'
|
||||
|
||||
if (!tags) {
|
||||
var keys = Object.keys(schemas).map(function (key) {
|
||||
return JSON.stringify(key);
|
||||
}).join(', ');
|
||||
throw new Error("Unknown schema \"".concat(schemaId, "\"; use one of ").concat(keys));
|
||||
}
|
||||
|
||||
if (Array.isArray(customTags)) {
|
||||
var _iterator = _createForOfIteratorHelper(customTags),
|
||||
_step;
|
||||
|
||||
try {
|
||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||
var tag = _step.value;
|
||||
tags = tags.concat(tag);
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator.e(err);
|
||||
} finally {
|
||||
_iterator.f();
|
||||
}
|
||||
} else if (typeof customTags === 'function') {
|
||||
tags = customTags(tags.slice());
|
||||
}
|
||||
|
||||
for (var i = 0; i < tags.length; ++i) {
|
||||
var _tag = tags[i];
|
||||
|
||||
if (typeof _tag === 'string') {
|
||||
var tagObj = knownTags[_tag];
|
||||
|
||||
if (!tagObj) {
|
||||
var _keys = Object.keys(knownTags).map(function (key) {
|
||||
return JSON.stringify(key);
|
||||
}).join(', ');
|
||||
|
||||
throw new Error("Unknown custom tag \"".concat(_tag, "\"; use one of ").concat(_keys));
|
||||
}
|
||||
|
||||
tags[i] = tagObj;
|
||||
}
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
|
||||
var sortMapEntriesByKey = function sortMapEntriesByKey(a, b) {
|
||||
return a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
||||
};
|
||||
|
||||
var Schema = /*#__PURE__*/function () {
|
||||
// TODO: remove in v2
|
||||
// TODO: remove in v2
|
||||
function Schema(_ref) {
|
||||
var customTags = _ref.customTags,
|
||||
merge = _ref.merge,
|
||||
schema = _ref.schema,
|
||||
sortMapEntries = _ref.sortMapEntries,
|
||||
deprecatedCustomTags = _ref.tags;
|
||||
|
||||
_classCallCheck(this, Schema);
|
||||
|
||||
this.merge = !!merge;
|
||||
this.name = schema;
|
||||
this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null;
|
||||
if (!customTags && deprecatedCustomTags) warnOptionDeprecation('tags', 'customTags');
|
||||
this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema);
|
||||
}
|
||||
|
||||
_createClass(Schema, [{
|
||||
key: "createNode",
|
||||
value: function createNode$1(value, wrapScalars, tagName, ctx) {
|
||||
var baseCtx = {
|
||||
defaultPrefix: Schema.defaultPrefix,
|
||||
schema: this,
|
||||
wrapScalars: wrapScalars
|
||||
};
|
||||
var createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx;
|
||||
return createNode(value, tagName, createCtx);
|
||||
}
|
||||
}, {
|
||||
key: "createPair",
|
||||
value: function createPair(key, value, ctx) {
|
||||
if (!ctx) ctx = {
|
||||
wrapScalars: true
|
||||
};
|
||||
var k = this.createNode(key, ctx.wrapScalars, null, ctx);
|
||||
var v = this.createNode(value, ctx.wrapScalars, null, ctx);
|
||||
return new Pair(k, v);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Schema;
|
||||
}();
|
||||
|
||||
_defineProperty(Schema, "defaultPrefix", defaultTagPrefix);
|
||||
|
||||
_defineProperty(Schema, "defaultTags", defaultTags);
|
||||
|
||||
export { Schema as S };
|
||||
1004
node_modules/yaml/browser/dist/index.js
generated
vendored
Normal file
1004
node_modules/yaml/browser/dist/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
node_modules/yaml/browser/dist/legacy-exports.js
generated
vendored
Normal file
3
node_modules/yaml/browser/dist/legacy-exports.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import './PlainValue-ff5147c6.js';
|
||||
import './resolveSeq-04825f30.js';
|
||||
export { b as binary, f as floatTime, i as intTime, o as omap, p as pairs, s as set, t as timestamp, c as warnFileDeprecation } from './warnings-0e4b70d3.js';
|
||||
1904
node_modules/yaml/browser/dist/parse-cst.js
generated
vendored
Normal file
1904
node_modules/yaml/browser/dist/parse-cst.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2373
node_modules/yaml/browser/dist/resolveSeq-04825f30.js
generated
vendored
Normal file
2373
node_modules/yaml/browser/dist/resolveSeq-04825f30.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
4
node_modules/yaml/browser/dist/types.js
generated
vendored
Normal file
4
node_modules/yaml/browser/dist/types.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
import './PlainValue-ff5147c6.js';
|
||||
export { A as Alias, C as Collection, M as Merge, N as Node, P as Pair, S as Scalar, d as YAMLMap, Y as YAMLSeq, b as binaryOptions, a as boolOptions, i as intOptions, n as nullOptions, s as strOptions } from './resolveSeq-04825f30.js';
|
||||
export { S as Schema } from './Schema-2bf2c74e.js';
|
||||
import './warnings-0e4b70d3.js';
|
||||
2
node_modules/yaml/browser/dist/util.js
generated
vendored
Normal file
2
node_modules/yaml/browser/dist/util.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { T as Type, i as YAMLError, o as YAMLReferenceError, g as YAMLSemanticError, Y as YAMLSyntaxError, f as YAMLWarning } from './PlainValue-ff5147c6.js';
|
||||
export { l as findPair, g as parseMap, h as parseSeq, k as stringifyNumber, c as stringifyString, t as toJSON } from './resolveSeq-04825f30.js';
|
||||
499
node_modules/yaml/browser/dist/warnings-0e4b70d3.js
generated
vendored
Normal file
499
node_modules/yaml/browser/dist/warnings-0e4b70d3.js
generated
vendored
Normal file
@@ -0,0 +1,499 @@
|
||||
import { o as YAMLReferenceError, T as Type, g as YAMLSemanticError, _ as _createForOfIteratorHelper, e as _defineProperty, j as _inherits, k as _createSuper, c as _classCallCheck, p as _assertThisInitialized, b as _createClass, a as _typeof, l as _get, m as _getPrototypeOf } from './PlainValue-ff5147c6.js';
|
||||
import { j as resolveString, b as binaryOptions, c as stringifyString, h as resolveSeq, P as Pair, d as YAMLMap, Y as YAMLSeq, t as toJSON, S as Scalar, l as findPair, g as resolveMap, k as stringifyNumber } from './resolveSeq-04825f30.js';
|
||||
|
||||
/* global atob, btoa, Buffer */
|
||||
var binary = {
|
||||
identify: function identify(value) {
|
||||
return value instanceof Uint8Array;
|
||||
},
|
||||
// Buffer inherits from Uint8Array
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:binary',
|
||||
|
||||
/**
|
||||
* Returns a Buffer in node and an Uint8Array in browsers
|
||||
*
|
||||
* To use the resulting buffer as an image, you'll want to do something like:
|
||||
*
|
||||
* const blob = new Blob([buffer], { type: 'image/jpeg' })
|
||||
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
||||
*/
|
||||
resolve: function resolve(doc, node) {
|
||||
var src = resolveString(doc, node);
|
||||
|
||||
if (typeof Buffer === 'function') {
|
||||
return Buffer.from(src, 'base64');
|
||||
} else if (typeof atob === 'function') {
|
||||
// On IE 11, atob() can't handle newlines
|
||||
var str = atob(src.replace(/[\n\r]/g, ''));
|
||||
var buffer = new Uint8Array(str.length);
|
||||
|
||||
for (var i = 0; i < str.length; ++i) {
|
||||
buffer[i] = str.charCodeAt(i);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
} else {
|
||||
var msg = 'This environment does not support reading binary tags; either Buffer or atob is required';
|
||||
doc.errors.push(new YAMLReferenceError(node, msg));
|
||||
return null;
|
||||
}
|
||||
},
|
||||
options: binaryOptions,
|
||||
stringify: function stringify(_ref, ctx, onComment, onChompKeep) {
|
||||
var comment = _ref.comment,
|
||||
type = _ref.type,
|
||||
value = _ref.value;
|
||||
var src;
|
||||
|
||||
if (typeof Buffer === 'function') {
|
||||
src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
|
||||
} else if (typeof btoa === 'function') {
|
||||
var s = '';
|
||||
|
||||
for (var i = 0; i < value.length; ++i) {
|
||||
s += String.fromCharCode(value[i]);
|
||||
}
|
||||
|
||||
src = btoa(s);
|
||||
} else {
|
||||
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
||||
}
|
||||
|
||||
if (!type) type = binaryOptions.defaultType;
|
||||
|
||||
if (type === Type.QUOTE_DOUBLE) {
|
||||
value = src;
|
||||
} else {
|
||||
var lineWidth = binaryOptions.lineWidth;
|
||||
var n = Math.ceil(src.length / lineWidth);
|
||||
var lines = new Array(n);
|
||||
|
||||
for (var _i = 0, o = 0; _i < n; ++_i, o += lineWidth) {
|
||||
lines[_i] = src.substr(o, lineWidth);
|
||||
}
|
||||
|
||||
value = lines.join(type === Type.BLOCK_LITERAL ? '\n' : ' ');
|
||||
}
|
||||
|
||||
return stringifyString({
|
||||
comment: comment,
|
||||
type: type,
|
||||
value: value
|
||||
}, ctx, onComment, onChompKeep);
|
||||
}
|
||||
};
|
||||
|
||||
function parsePairs(doc, cst) {
|
||||
var seq = resolveSeq(doc, cst);
|
||||
|
||||
for (var i = 0; i < seq.items.length; ++i) {
|
||||
var item = seq.items[i];
|
||||
if (item instanceof Pair) continue;else if (item instanceof YAMLMap) {
|
||||
if (item.items.length > 1) {
|
||||
var msg = 'Each pair must have its own sequence indicator';
|
||||
throw new YAMLSemanticError(cst, msg);
|
||||
}
|
||||
|
||||
var pair = item.items[0] || new Pair();
|
||||
if (item.commentBefore) pair.commentBefore = pair.commentBefore ? "".concat(item.commentBefore, "\n").concat(pair.commentBefore) : item.commentBefore;
|
||||
if (item.comment) pair.comment = pair.comment ? "".concat(item.comment, "\n").concat(pair.comment) : item.comment;
|
||||
item = pair;
|
||||
}
|
||||
seq.items[i] = item instanceof Pair ? item : new Pair(item);
|
||||
}
|
||||
|
||||
return seq;
|
||||
}
|
||||
function createPairs(schema, iterable, ctx) {
|
||||
var pairs = new YAMLSeq(schema);
|
||||
pairs.tag = 'tag:yaml.org,2002:pairs';
|
||||
|
||||
var _iterator = _createForOfIteratorHelper(iterable),
|
||||
_step;
|
||||
|
||||
try {
|
||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||
var it = _step.value;
|
||||
var key = void 0,
|
||||
value = void 0;
|
||||
|
||||
if (Array.isArray(it)) {
|
||||
if (it.length === 2) {
|
||||
key = it[0];
|
||||
value = it[1];
|
||||
} else throw new TypeError("Expected [key, value] tuple: ".concat(it));
|
||||
} else if (it && it instanceof Object) {
|
||||
var keys = Object.keys(it);
|
||||
|
||||
if (keys.length === 1) {
|
||||
key = keys[0];
|
||||
value = it[key];
|
||||
} else throw new TypeError("Expected { key: value } tuple: ".concat(it));
|
||||
} else {
|
||||
key = it;
|
||||
}
|
||||
|
||||
var pair = schema.createPair(key, value, ctx);
|
||||
pairs.items.push(pair);
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator.e(err);
|
||||
} finally {
|
||||
_iterator.f();
|
||||
}
|
||||
|
||||
return pairs;
|
||||
}
|
||||
var pairs = {
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:pairs',
|
||||
resolve: parsePairs,
|
||||
createNode: createPairs
|
||||
};
|
||||
|
||||
var YAMLOMap = /*#__PURE__*/function (_YAMLSeq) {
|
||||
_inherits(YAMLOMap, _YAMLSeq);
|
||||
|
||||
var _super = _createSuper(YAMLOMap);
|
||||
|
||||
function YAMLOMap() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, YAMLOMap);
|
||||
|
||||
_this = _super.call(this);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "add", YAMLMap.prototype.add.bind(_assertThisInitialized(_this)));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "delete", YAMLMap.prototype.delete.bind(_assertThisInitialized(_this)));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "get", YAMLMap.prototype.get.bind(_assertThisInitialized(_this)));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "has", YAMLMap.prototype.has.bind(_assertThisInitialized(_this)));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "set", YAMLMap.prototype.set.bind(_assertThisInitialized(_this)));
|
||||
|
||||
_this.tag = YAMLOMap.tag;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(YAMLOMap, [{
|
||||
key: "toJSON",
|
||||
value: function toJSON$1(_, ctx) {
|
||||
var map = new Map();
|
||||
if (ctx && ctx.onCreate) ctx.onCreate(map);
|
||||
|
||||
var _iterator = _createForOfIteratorHelper(this.items),
|
||||
_step;
|
||||
|
||||
try {
|
||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||
var pair = _step.value;
|
||||
var key = void 0,
|
||||
value = void 0;
|
||||
|
||||
if (pair instanceof Pair) {
|
||||
key = toJSON(pair.key, '', ctx);
|
||||
value = toJSON(pair.value, key, ctx);
|
||||
} else {
|
||||
key = toJSON(pair, '', ctx);
|
||||
}
|
||||
|
||||
if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys');
|
||||
map.set(key, value);
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator.e(err);
|
||||
} finally {
|
||||
_iterator.f();
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
}]);
|
||||
|
||||
return YAMLOMap;
|
||||
}(YAMLSeq);
|
||||
|
||||
_defineProperty(YAMLOMap, "tag", 'tag:yaml.org,2002:omap');
|
||||
|
||||
function parseOMap(doc, cst) {
|
||||
var pairs = parsePairs(doc, cst);
|
||||
var seenKeys = [];
|
||||
|
||||
var _iterator2 = _createForOfIteratorHelper(pairs.items),
|
||||
_step2;
|
||||
|
||||
try {
|
||||
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
||||
var key = _step2.value.key;
|
||||
|
||||
if (key instanceof Scalar) {
|
||||
if (seenKeys.includes(key.value)) {
|
||||
var msg = 'Ordered maps must not include duplicate keys';
|
||||
throw new YAMLSemanticError(cst, msg);
|
||||
} else {
|
||||
seenKeys.push(key.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator2.e(err);
|
||||
} finally {
|
||||
_iterator2.f();
|
||||
}
|
||||
|
||||
return Object.assign(new YAMLOMap(), pairs);
|
||||
}
|
||||
|
||||
function createOMap(schema, iterable, ctx) {
|
||||
var pairs = createPairs(schema, iterable, ctx);
|
||||
var omap = new YAMLOMap();
|
||||
omap.items = pairs.items;
|
||||
return omap;
|
||||
}
|
||||
|
||||
var omap = {
|
||||
identify: function identify(value) {
|
||||
return value instanceof Map;
|
||||
},
|
||||
nodeClass: YAMLOMap,
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:omap',
|
||||
resolve: parseOMap,
|
||||
createNode: createOMap
|
||||
};
|
||||
|
||||
var YAMLSet = /*#__PURE__*/function (_YAMLMap) {
|
||||
_inherits(YAMLSet, _YAMLMap);
|
||||
|
||||
var _super = _createSuper(YAMLSet);
|
||||
|
||||
function YAMLSet() {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, YAMLSet);
|
||||
|
||||
_this = _super.call(this);
|
||||
_this.tag = YAMLSet.tag;
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(YAMLSet, [{
|
||||
key: "add",
|
||||
value: function add(key) {
|
||||
var pair = key instanceof Pair ? key : new Pair(key);
|
||||
var prev = findPair(this.items, pair.key);
|
||||
if (!prev) this.items.push(pair);
|
||||
}
|
||||
}, {
|
||||
key: "get",
|
||||
value: function get(key, keepPair) {
|
||||
var pair = findPair(this.items, key);
|
||||
return !keepPair && pair instanceof Pair ? pair.key instanceof Scalar ? pair.key.value : pair.key : pair;
|
||||
}
|
||||
}, {
|
||||
key: "set",
|
||||
value: function set(key, value) {
|
||||
if (typeof value !== 'boolean') throw new Error("Expected boolean value for set(key, value) in a YAML set, not ".concat(_typeof(value)));
|
||||
var prev = findPair(this.items, key);
|
||||
|
||||
if (prev && !value) {
|
||||
this.items.splice(this.items.indexOf(prev), 1);
|
||||
} else if (!prev && value) {
|
||||
this.items.push(new Pair(key));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "toJSON",
|
||||
value: function toJSON(_, ctx) {
|
||||
return _get(_getPrototypeOf(YAMLSet.prototype), "toJSON", this).call(this, _, ctx, Set);
|
||||
}
|
||||
}, {
|
||||
key: "toString",
|
||||
value: function toString(ctx, onComment, onChompKeep) {
|
||||
if (!ctx) return JSON.stringify(this);
|
||||
if (this.hasAllNullValues()) return _get(_getPrototypeOf(YAMLSet.prototype), "toString", this).call(this, ctx, onComment, onChompKeep);else throw new Error('Set items must all have null values');
|
||||
}
|
||||
}]);
|
||||
|
||||
return YAMLSet;
|
||||
}(YAMLMap);
|
||||
|
||||
_defineProperty(YAMLSet, "tag", 'tag:yaml.org,2002:set');
|
||||
|
||||
function parseSet(doc, cst) {
|
||||
var map = resolveMap(doc, cst);
|
||||
if (!map.hasAllNullValues()) throw new YAMLSemanticError(cst, 'Set items must all have null values');
|
||||
return Object.assign(new YAMLSet(), map);
|
||||
}
|
||||
|
||||
function createSet(schema, iterable, ctx) {
|
||||
var set = new YAMLSet();
|
||||
|
||||
var _iterator = _createForOfIteratorHelper(iterable),
|
||||
_step;
|
||||
|
||||
try {
|
||||
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
||||
var value = _step.value;
|
||||
set.items.push(schema.createPair(value, null, ctx));
|
||||
}
|
||||
} catch (err) {
|
||||
_iterator.e(err);
|
||||
} finally {
|
||||
_iterator.f();
|
||||
}
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
var set = {
|
||||
identify: function identify(value) {
|
||||
return value instanceof Set;
|
||||
},
|
||||
nodeClass: YAMLSet,
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:set',
|
||||
resolve: parseSet,
|
||||
createNode: createSet
|
||||
};
|
||||
|
||||
var parseSexagesimal = function parseSexagesimal(sign, parts) {
|
||||
var n = parts.split(':').reduce(function (n, p) {
|
||||
return n * 60 + Number(p);
|
||||
}, 0);
|
||||
return sign === '-' ? -n : n;
|
||||
}; // hhhh:mm:ss.sss
|
||||
|
||||
|
||||
var stringifySexagesimal = function stringifySexagesimal(_ref) {
|
||||
var value = _ref.value;
|
||||
if (isNaN(value) || !isFinite(value)) return stringifyNumber(value);
|
||||
var sign = '';
|
||||
|
||||
if (value < 0) {
|
||||
sign = '-';
|
||||
value = Math.abs(value);
|
||||
}
|
||||
|
||||
var parts = [value % 60]; // seconds, including ms
|
||||
|
||||
if (value < 60) {
|
||||
parts.unshift(0); // at least one : is required
|
||||
} else {
|
||||
value = Math.round((value - parts[0]) / 60);
|
||||
parts.unshift(value % 60); // minutes
|
||||
|
||||
if (value >= 60) {
|
||||
value = Math.round((value - parts[0]) / 60);
|
||||
parts.unshift(value); // hours
|
||||
}
|
||||
}
|
||||
|
||||
return sign + parts.map(function (n) {
|
||||
return n < 10 ? '0' + String(n) : String(n);
|
||||
}).join(':').replace(/000000\d*$/, '') // % 60 may introduce error
|
||||
;
|
||||
};
|
||||
|
||||
var intTime = {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'number';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'TIME',
|
||||
test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
|
||||
resolve: function resolve(str, sign, parts) {
|
||||
return parseSexagesimal(sign, parts.replace(/_/g, ''));
|
||||
},
|
||||
stringify: stringifySexagesimal
|
||||
};
|
||||
var floatTime = {
|
||||
identify: function identify(value) {
|
||||
return typeof value === 'number';
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
format: 'TIME',
|
||||
test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
|
||||
resolve: function resolve(str, sign, parts) {
|
||||
return parseSexagesimal(sign, parts.replace(/_/g, ''));
|
||||
},
|
||||
stringify: stringifySexagesimal
|
||||
};
|
||||
var timestamp = {
|
||||
identify: function identify(value) {
|
||||
return value instanceof Date;
|
||||
},
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:timestamp',
|
||||
// If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
|
||||
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
||||
// assumed to be 00:00:00Z (start of day, UTC).
|
||||
test: RegExp('^(?:' + '([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd
|
||||
'(?:(?:t|T|[ \\t]+)' + // t | T | whitespace
|
||||
'([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?
|
||||
'(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30
|
||||
')?' + ')$'),
|
||||
resolve: function resolve(str, year, month, day, hour, minute, second, millisec, tz) {
|
||||
if (millisec) millisec = (millisec + '00').substr(1, 3);
|
||||
var date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
|
||||
|
||||
if (tz && tz !== 'Z') {
|
||||
var d = parseSexagesimal(tz[0], tz.slice(1));
|
||||
if (Math.abs(d) < 30) d *= 60;
|
||||
date -= 60000 * d;
|
||||
}
|
||||
|
||||
return new Date(date);
|
||||
},
|
||||
stringify: function stringify(_ref2) {
|
||||
var value = _ref2.value;
|
||||
return value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '');
|
||||
}
|
||||
};
|
||||
|
||||
/* global console, process, YAML_SILENCE_DEPRECATION_WARNINGS, YAML_SILENCE_WARNINGS */
|
||||
function shouldWarn(deprecation) {
|
||||
var env = typeof process !== 'undefined' && process.env || {};
|
||||
|
||||
if (deprecation) {
|
||||
if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== 'undefined') return !YAML_SILENCE_DEPRECATION_WARNINGS;
|
||||
return !env.YAML_SILENCE_DEPRECATION_WARNINGS;
|
||||
}
|
||||
|
||||
if (typeof YAML_SILENCE_WARNINGS !== 'undefined') return !YAML_SILENCE_WARNINGS;
|
||||
return !env.YAML_SILENCE_WARNINGS;
|
||||
}
|
||||
|
||||
function warn(warning, type) {
|
||||
if (shouldWarn(false)) {
|
||||
var emit = typeof process !== 'undefined' && process.emitWarning; // This will throw in Jest if `warning` is an Error instance due to
|
||||
// https://github.com/facebook/jest/issues/2549
|
||||
|
||||
if (emit) emit(warning, type);else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(type ? "".concat(type, ": ").concat(warning) : warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
function warnFileDeprecation(filename) {
|
||||
if (shouldWarn(true)) {
|
||||
var path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
|
||||
warn("The endpoint 'yaml/".concat(path, "' will be removed in a future release."), 'DeprecationWarning');
|
||||
}
|
||||
}
|
||||
var warned = {};
|
||||
function warnOptionDeprecation(name, alternative) {
|
||||
if (!warned[name] && shouldWarn(true)) {
|
||||
warned[name] = true;
|
||||
var msg = "The option '".concat(name, "' will be removed in a future release");
|
||||
msg += alternative ? ", use '".concat(alternative, "' instead.") : '.';
|
||||
warn(msg, 'DeprecationWarning');
|
||||
}
|
||||
}
|
||||
|
||||
export { warnOptionDeprecation as a, binary as b, warnFileDeprecation as c, floatTime as f, intTime as i, omap as o, pairs as p, set as s, timestamp as t, warn as w };
|
||||
1
node_modules/yaml/browser/index.js
generated
vendored
Normal file
1
node_modules/yaml/browser/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./dist').YAML
|
||||
2
node_modules/yaml/browser/map.js
generated
vendored
Normal file
2
node_modules/yaml/browser/map.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = require('./dist/types').YAMLMap
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
2
node_modules/yaml/browser/pair.js
generated
vendored
Normal file
2
node_modules/yaml/browser/pair.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = require('./dist/types').Pair
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
1
node_modules/yaml/browser/parse-cst.js
generated
vendored
Normal file
1
node_modules/yaml/browser/parse-cst.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./dist/parse-cst').parse
|
||||
2
node_modules/yaml/browser/scalar.js
generated
vendored
Normal file
2
node_modules/yaml/browser/scalar.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = require('./dist/types').Scalar
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
9
node_modules/yaml/browser/schema.js
generated
vendored
Normal file
9
node_modules/yaml/browser/schema.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
const types = require('./dist/types')
|
||||
const util = require('./dist/util')
|
||||
|
||||
module.exports = types.Schema
|
||||
module.exports.nullOptions = types.nullOptions
|
||||
module.exports.strOptions = types.strOptions
|
||||
module.exports.stringify = util.stringifyString
|
||||
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
2
node_modules/yaml/browser/seq.js
generated
vendored
Normal file
2
node_modules/yaml/browser/seq.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = require('./dist/types').YAMLSeq
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
1
node_modules/yaml/browser/types.js
generated
vendored
Normal file
1
node_modules/yaml/browser/types.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/types.js'
|
||||
8
node_modules/yaml/browser/types/binary.js
generated
vendored
Normal file
8
node_modules/yaml/browser/types/binary.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict'
|
||||
Object.defineProperty(exports, '__esModule', { value: true })
|
||||
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
exports.binary = legacy.binary
|
||||
exports.default = [exports.binary]
|
||||
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
3
node_modules/yaml/browser/types/omap.js
generated
vendored
Normal file
3
node_modules/yaml/browser/types/omap.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
module.exports = legacy.omap
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
3
node_modules/yaml/browser/types/pairs.js
generated
vendored
Normal file
3
node_modules/yaml/browser/types/pairs.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
module.exports = legacy.pairs
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
3
node_modules/yaml/browser/types/set.js
generated
vendored
Normal file
3
node_modules/yaml/browser/types/set.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
module.exports = legacy.set
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
10
node_modules/yaml/browser/types/timestamp.js
generated
vendored
Normal file
10
node_modules/yaml/browser/types/timestamp.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict'
|
||||
Object.defineProperty(exports, '__esModule', { value: true })
|
||||
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
exports.default = [legacy.intTime, legacy.floatTime, legacy.timestamp]
|
||||
exports.floatTime = legacy.floatTime
|
||||
exports.intTime = legacy.intTime
|
||||
exports.timestamp = legacy.timestamp
|
||||
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
1
node_modules/yaml/browser/util.js
generated
vendored
Normal file
1
node_modules/yaml/browser/util.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './dist/util.js'
|
||||
757
node_modules/yaml/dist/Document-2cf6b08c.js
generated
vendored
Normal file
757
node_modules/yaml/dist/Document-2cf6b08c.js
generated
vendored
Normal file
@@ -0,0 +1,757 @@
|
||||
'use strict';
|
||||
|
||||
var PlainValue = require('./PlainValue-ec8e588e.js');
|
||||
var resolveSeq = require('./resolveSeq-4a68b39b.js');
|
||||
var Schema = require('./Schema-42e9705c.js');
|
||||
|
||||
const defaultOptions = {
|
||||
anchorPrefix: 'a',
|
||||
customTags: null,
|
||||
indent: 2,
|
||||
indentSeq: true,
|
||||
keepCstNodes: false,
|
||||
keepNodeTypes: true,
|
||||
keepBlobsInJSON: true,
|
||||
mapAsMap: false,
|
||||
maxAliasCount: 100,
|
||||
prettyErrors: false,
|
||||
// TODO Set true in v2
|
||||
simpleKeys: false,
|
||||
version: '1.2'
|
||||
};
|
||||
const scalarOptions = {
|
||||
get binary() {
|
||||
return resolveSeq.binaryOptions;
|
||||
},
|
||||
|
||||
set binary(opt) {
|
||||
Object.assign(resolveSeq.binaryOptions, opt);
|
||||
},
|
||||
|
||||
get bool() {
|
||||
return resolveSeq.boolOptions;
|
||||
},
|
||||
|
||||
set bool(opt) {
|
||||
Object.assign(resolveSeq.boolOptions, opt);
|
||||
},
|
||||
|
||||
get int() {
|
||||
return resolveSeq.intOptions;
|
||||
},
|
||||
|
||||
set int(opt) {
|
||||
Object.assign(resolveSeq.intOptions, opt);
|
||||
},
|
||||
|
||||
get null() {
|
||||
return resolveSeq.nullOptions;
|
||||
},
|
||||
|
||||
set null(opt) {
|
||||
Object.assign(resolveSeq.nullOptions, opt);
|
||||
},
|
||||
|
||||
get str() {
|
||||
return resolveSeq.strOptions;
|
||||
},
|
||||
|
||||
set str(opt) {
|
||||
Object.assign(resolveSeq.strOptions, opt);
|
||||
}
|
||||
|
||||
};
|
||||
const documentOptions = {
|
||||
'1.0': {
|
||||
schema: 'yaml-1.1',
|
||||
merge: true,
|
||||
tagPrefixes: [{
|
||||
handle: '!',
|
||||
prefix: PlainValue.defaultTagPrefix
|
||||
}, {
|
||||
handle: '!!',
|
||||
prefix: 'tag:private.yaml.org,2002:'
|
||||
}]
|
||||
},
|
||||
'1.1': {
|
||||
schema: 'yaml-1.1',
|
||||
merge: true,
|
||||
tagPrefixes: [{
|
||||
handle: '!',
|
||||
prefix: '!'
|
||||
}, {
|
||||
handle: '!!',
|
||||
prefix: PlainValue.defaultTagPrefix
|
||||
}]
|
||||
},
|
||||
'1.2': {
|
||||
schema: 'core',
|
||||
merge: false,
|
||||
tagPrefixes: [{
|
||||
handle: '!',
|
||||
prefix: '!'
|
||||
}, {
|
||||
handle: '!!',
|
||||
prefix: PlainValue.defaultTagPrefix
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
function stringifyTag(doc, tag) {
|
||||
if ((doc.version || doc.options.version) === '1.0') {
|
||||
const priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/);
|
||||
if (priv) return '!' + priv[1];
|
||||
const vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/);
|
||||
return vocab ? `!${vocab[1]}/${vocab[2]}` : `!${tag.replace(/^tag:/, '')}`;
|
||||
}
|
||||
|
||||
let p = doc.tagPrefixes.find(p => tag.indexOf(p.prefix) === 0);
|
||||
|
||||
if (!p) {
|
||||
const dtp = doc.getDefaults().tagPrefixes;
|
||||
p = dtp && dtp.find(p => tag.indexOf(p.prefix) === 0);
|
||||
}
|
||||
|
||||
if (!p) return tag[0] === '!' ? tag : `!<${tag}>`;
|
||||
const suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, ch => ({
|
||||
'!': '%21',
|
||||
',': '%2C',
|
||||
'[': '%5B',
|
||||
']': '%5D',
|
||||
'{': '%7B',
|
||||
'}': '%7D'
|
||||
})[ch]);
|
||||
return p.handle + suffix;
|
||||
}
|
||||
|
||||
function getTagObject(tags, item) {
|
||||
if (item instanceof resolveSeq.Alias) return resolveSeq.Alias;
|
||||
|
||||
if (item.tag) {
|
||||
const match = tags.filter(t => t.tag === item.tag);
|
||||
if (match.length > 0) return match.find(t => t.format === item.format) || match[0];
|
||||
}
|
||||
|
||||
let tagObj, obj;
|
||||
|
||||
if (item instanceof resolveSeq.Scalar) {
|
||||
obj = item.value; // TODO: deprecate/remove class check
|
||||
|
||||
const match = tags.filter(t => t.identify && t.identify(obj) || t.class && obj instanceof t.class);
|
||||
tagObj = match.find(t => t.format === item.format) || match.find(t => !t.format);
|
||||
} else {
|
||||
obj = item;
|
||||
tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
|
||||
}
|
||||
|
||||
if (!tagObj) {
|
||||
const name = obj && obj.constructor ? obj.constructor.name : typeof obj;
|
||||
throw new Error(`Tag not resolved for ${name} value`);
|
||||
}
|
||||
|
||||
return tagObj;
|
||||
} // needs to be called before value stringifier to allow for circular anchor refs
|
||||
|
||||
|
||||
function stringifyProps(node, tagObj, {
|
||||
anchors,
|
||||
doc
|
||||
}) {
|
||||
const props = [];
|
||||
const anchor = doc.anchors.getName(node);
|
||||
|
||||
if (anchor) {
|
||||
anchors[anchor] = node;
|
||||
props.push(`&${anchor}`);
|
||||
}
|
||||
|
||||
if (node.tag) {
|
||||
props.push(stringifyTag(doc, node.tag));
|
||||
} else if (!tagObj.default) {
|
||||
props.push(stringifyTag(doc, tagObj.tag));
|
||||
}
|
||||
|
||||
return props.join(' ');
|
||||
}
|
||||
|
||||
function stringify(item, ctx, onComment, onChompKeep) {
|
||||
const {
|
||||
anchors,
|
||||
schema
|
||||
} = ctx.doc;
|
||||
let tagObj;
|
||||
|
||||
if (!(item instanceof resolveSeq.Node)) {
|
||||
const createCtx = {
|
||||
aliasNodes: [],
|
||||
onTagObj: o => tagObj = o,
|
||||
prevObjects: new Map()
|
||||
};
|
||||
item = schema.createNode(item, true, null, createCtx);
|
||||
|
||||
for (const alias of createCtx.aliasNodes) {
|
||||
alias.source = alias.source.node;
|
||||
let name = anchors.getName(alias.source);
|
||||
|
||||
if (!name) {
|
||||
name = anchors.newName();
|
||||
anchors.map[name] = alias.source;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (item instanceof resolveSeq.Pair) return item.toString(ctx, onComment, onChompKeep);
|
||||
if (!tagObj) tagObj = getTagObject(schema.tags, item);
|
||||
const props = stringifyProps(item, tagObj, ctx);
|
||||
if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
|
||||
const str = typeof tagObj.stringify === 'function' ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof resolveSeq.Scalar ? resolveSeq.stringifyString(item, ctx, onComment, onChompKeep) : item.toString(ctx, onComment, onChompKeep);
|
||||
if (!props) return str;
|
||||
return item instanceof resolveSeq.Scalar || str[0] === '{' || str[0] === '[' ? `${props} ${str}` : `${props}\n${ctx.indent}${str}`;
|
||||
}
|
||||
|
||||
class Anchors {
|
||||
static validAnchorNode(node) {
|
||||
return node instanceof resolveSeq.Scalar || node instanceof resolveSeq.YAMLSeq || node instanceof resolveSeq.YAMLMap;
|
||||
}
|
||||
|
||||
constructor(prefix) {
|
||||
PlainValue._defineProperty(this, "map", {});
|
||||
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
createAlias(node, name) {
|
||||
this.setAnchor(node, name);
|
||||
return new resolveSeq.Alias(node);
|
||||
}
|
||||
|
||||
createMergePair(...sources) {
|
||||
const merge = new resolveSeq.Merge();
|
||||
merge.value.items = sources.map(s => {
|
||||
if (s instanceof resolveSeq.Alias) {
|
||||
if (s.source instanceof resolveSeq.YAMLMap) return s;
|
||||
} else if (s instanceof resolveSeq.YAMLMap) {
|
||||
return this.createAlias(s);
|
||||
}
|
||||
|
||||
throw new Error('Merge sources must be Map nodes or their Aliases');
|
||||
});
|
||||
return merge;
|
||||
}
|
||||
|
||||
getName(node) {
|
||||
const {
|
||||
map
|
||||
} = this;
|
||||
return Object.keys(map).find(a => map[a] === node);
|
||||
}
|
||||
|
||||
getNames() {
|
||||
return Object.keys(this.map);
|
||||
}
|
||||
|
||||
getNode(name) {
|
||||
return this.map[name];
|
||||
}
|
||||
|
||||
newName(prefix) {
|
||||
if (!prefix) prefix = this.prefix;
|
||||
const names = Object.keys(this.map);
|
||||
|
||||
for (let i = 1; true; ++i) {
|
||||
const name = `${prefix}${i}`;
|
||||
if (!names.includes(name)) return name;
|
||||
}
|
||||
} // During parsing, map & aliases contain CST nodes
|
||||
|
||||
|
||||
resolveNodes() {
|
||||
const {
|
||||
map,
|
||||
_cstAliases
|
||||
} = this;
|
||||
Object.keys(map).forEach(a => {
|
||||
map[a] = map[a].resolved;
|
||||
});
|
||||
|
||||
_cstAliases.forEach(a => {
|
||||
a.source = a.source.resolved;
|
||||
});
|
||||
|
||||
delete this._cstAliases;
|
||||
}
|
||||
|
||||
setAnchor(node, name) {
|
||||
if (node != null && !Anchors.validAnchorNode(node)) {
|
||||
throw new Error('Anchors may only be set for Scalar, Seq and Map nodes');
|
||||
}
|
||||
|
||||
if (name && /[\x00-\x19\s,[\]{}]/.test(name)) {
|
||||
throw new Error('Anchor names must not contain whitespace or control characters');
|
||||
}
|
||||
|
||||
const {
|
||||
map
|
||||
} = this;
|
||||
const prev = node && Object.keys(map).find(a => map[a] === node);
|
||||
|
||||
if (prev) {
|
||||
if (!name) {
|
||||
return prev;
|
||||
} else if (prev !== name) {
|
||||
delete map[prev];
|
||||
map[name] = node;
|
||||
}
|
||||
} else {
|
||||
if (!name) {
|
||||
if (!node) return null;
|
||||
name = this.newName();
|
||||
}
|
||||
|
||||
map[name] = node;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const visit = (node, tags) => {
|
||||
if (node && typeof node === 'object') {
|
||||
const {
|
||||
tag
|
||||
} = node;
|
||||
|
||||
if (node instanceof resolveSeq.Collection) {
|
||||
if (tag) tags[tag] = true;
|
||||
node.items.forEach(n => visit(n, tags));
|
||||
} else if (node instanceof resolveSeq.Pair) {
|
||||
visit(node.key, tags);
|
||||
visit(node.value, tags);
|
||||
} else if (node instanceof resolveSeq.Scalar) {
|
||||
if (tag) tags[tag] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return tags;
|
||||
};
|
||||
|
||||
const listTagNames = node => Object.keys(visit(node, {}));
|
||||
|
||||
function parseContents(doc, contents) {
|
||||
const comments = {
|
||||
before: [],
|
||||
after: []
|
||||
};
|
||||
let body = undefined;
|
||||
let spaceBefore = false;
|
||||
|
||||
for (const node of contents) {
|
||||
if (node.valueRange) {
|
||||
if (body !== undefined) {
|
||||
const msg = 'Document contains trailing content not separated by a ... or --- line';
|
||||
doc.errors.push(new PlainValue.YAMLSyntaxError(node, msg));
|
||||
break;
|
||||
}
|
||||
|
||||
const res = resolveSeq.resolveNode(doc, node);
|
||||
|
||||
if (spaceBefore) {
|
||||
res.spaceBefore = true;
|
||||
spaceBefore = false;
|
||||
}
|
||||
|
||||
body = res;
|
||||
} else if (node.comment !== null) {
|
||||
const cc = body === undefined ? comments.before : comments.after;
|
||||
cc.push(node.comment);
|
||||
} else if (node.type === PlainValue.Type.BLANK_LINE) {
|
||||
spaceBefore = true;
|
||||
|
||||
if (body === undefined && comments.before.length > 0 && !doc.commentBefore) {
|
||||
// space-separated comments at start are parsed as document comments
|
||||
doc.commentBefore = comments.before.join('\n');
|
||||
comments.before = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doc.contents = body || null;
|
||||
|
||||
if (!body) {
|
||||
doc.comment = comments.before.concat(comments.after).join('\n') || null;
|
||||
} else {
|
||||
const cb = comments.before.join('\n');
|
||||
|
||||
if (cb) {
|
||||
const cbNode = body instanceof resolveSeq.Collection && body.items[0] ? body.items[0] : body;
|
||||
cbNode.commentBefore = cbNode.commentBefore ? `${cb}\n${cbNode.commentBefore}` : cb;
|
||||
}
|
||||
|
||||
doc.comment = comments.after.join('\n') || null;
|
||||
}
|
||||
}
|
||||
|
||||
function resolveTagDirective({
|
||||
tagPrefixes
|
||||
}, directive) {
|
||||
const [handle, prefix] = directive.parameters;
|
||||
|
||||
if (!handle || !prefix) {
|
||||
const msg = 'Insufficient parameters given for %TAG directive';
|
||||
throw new PlainValue.YAMLSemanticError(directive, msg);
|
||||
}
|
||||
|
||||
if (tagPrefixes.some(p => p.handle === handle)) {
|
||||
const msg = 'The %TAG directive must only be given at most once per handle in the same document.';
|
||||
throw new PlainValue.YAMLSemanticError(directive, msg);
|
||||
}
|
||||
|
||||
return {
|
||||
handle,
|
||||
prefix
|
||||
};
|
||||
}
|
||||
|
||||
function resolveYamlDirective(doc, directive) {
|
||||
let [version] = directive.parameters;
|
||||
if (directive.name === 'YAML:1.0') version = '1.0';
|
||||
|
||||
if (!version) {
|
||||
const msg = 'Insufficient parameters given for %YAML directive';
|
||||
throw new PlainValue.YAMLSemanticError(directive, msg);
|
||||
}
|
||||
|
||||
if (!documentOptions[version]) {
|
||||
const v0 = doc.version || doc.options.version;
|
||||
const msg = `Document will be parsed as YAML ${v0} rather than YAML ${version}`;
|
||||
doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
function parseDirectives(doc, directives, prevDoc) {
|
||||
const directiveComments = [];
|
||||
let hasDirectives = false;
|
||||
|
||||
for (const directive of directives) {
|
||||
const {
|
||||
comment,
|
||||
name
|
||||
} = directive;
|
||||
|
||||
switch (name) {
|
||||
case 'TAG':
|
||||
try {
|
||||
doc.tagPrefixes.push(resolveTagDirective(doc, directive));
|
||||
} catch (error) {
|
||||
doc.errors.push(error);
|
||||
}
|
||||
|
||||
hasDirectives = true;
|
||||
break;
|
||||
|
||||
case 'YAML':
|
||||
case 'YAML:1.0':
|
||||
if (doc.version) {
|
||||
const msg = 'The %YAML directive must only be given at most once per document.';
|
||||
doc.errors.push(new PlainValue.YAMLSemanticError(directive, msg));
|
||||
}
|
||||
|
||||
try {
|
||||
doc.version = resolveYamlDirective(doc, directive);
|
||||
} catch (error) {
|
||||
doc.errors.push(error);
|
||||
}
|
||||
|
||||
hasDirectives = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (name) {
|
||||
const msg = `YAML only supports %TAG and %YAML directives, and not %${name}`;
|
||||
doc.warnings.push(new PlainValue.YAMLWarning(directive, msg));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (comment) directiveComments.push(comment);
|
||||
}
|
||||
|
||||
if (prevDoc && !hasDirectives && '1.1' === (doc.version || prevDoc.version || doc.options.version)) {
|
||||
const copyTagPrefix = ({
|
||||
handle,
|
||||
prefix
|
||||
}) => ({
|
||||
handle,
|
||||
prefix
|
||||
});
|
||||
|
||||
doc.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix);
|
||||
doc.version = prevDoc.version;
|
||||
}
|
||||
|
||||
doc.commentBefore = directiveComments.join('\n') || null;
|
||||
}
|
||||
|
||||
function assertCollection(contents) {
|
||||
if (contents instanceof resolveSeq.Collection) return true;
|
||||
throw new Error('Expected a YAML collection as document contents');
|
||||
}
|
||||
|
||||
class Document {
|
||||
constructor(options) {
|
||||
this.anchors = new Anchors(options.anchorPrefix);
|
||||
this.commentBefore = null;
|
||||
this.comment = null;
|
||||
this.contents = null;
|
||||
this.directivesEndMarker = null;
|
||||
this.errors = [];
|
||||
this.options = options;
|
||||
this.schema = null;
|
||||
this.tagPrefixes = [];
|
||||
this.version = null;
|
||||
this.warnings = [];
|
||||
}
|
||||
|
||||
add(value) {
|
||||
assertCollection(this.contents);
|
||||
return this.contents.add(value);
|
||||
}
|
||||
|
||||
addIn(path, value) {
|
||||
assertCollection(this.contents);
|
||||
this.contents.addIn(path, value);
|
||||
}
|
||||
|
||||
delete(key) {
|
||||
assertCollection(this.contents);
|
||||
return this.contents.delete(key);
|
||||
}
|
||||
|
||||
deleteIn(path) {
|
||||
if (resolveSeq.isEmptyPath(path)) {
|
||||
if (this.contents == null) return false;
|
||||
this.contents = null;
|
||||
return true;
|
||||
}
|
||||
|
||||
assertCollection(this.contents);
|
||||
return this.contents.deleteIn(path);
|
||||
}
|
||||
|
||||
getDefaults() {
|
||||
return Document.defaults[this.version] || Document.defaults[this.options.version] || {};
|
||||
}
|
||||
|
||||
get(key, keepScalar) {
|
||||
return this.contents instanceof resolveSeq.Collection ? this.contents.get(key, keepScalar) : undefined;
|
||||
}
|
||||
|
||||
getIn(path, keepScalar) {
|
||||
if (resolveSeq.isEmptyPath(path)) return !keepScalar && this.contents instanceof resolveSeq.Scalar ? this.contents.value : this.contents;
|
||||
return this.contents instanceof resolveSeq.Collection ? this.contents.getIn(path, keepScalar) : undefined;
|
||||
}
|
||||
|
||||
has(key) {
|
||||
return this.contents instanceof resolveSeq.Collection ? this.contents.has(key) : false;
|
||||
}
|
||||
|
||||
hasIn(path) {
|
||||
if (resolveSeq.isEmptyPath(path)) return this.contents !== undefined;
|
||||
return this.contents instanceof resolveSeq.Collection ? this.contents.hasIn(path) : false;
|
||||
}
|
||||
|
||||
set(key, value) {
|
||||
assertCollection(this.contents);
|
||||
this.contents.set(key, value);
|
||||
}
|
||||
|
||||
setIn(path, value) {
|
||||
if (resolveSeq.isEmptyPath(path)) this.contents = value;else {
|
||||
assertCollection(this.contents);
|
||||
this.contents.setIn(path, value);
|
||||
}
|
||||
}
|
||||
|
||||
setSchema(id, customTags) {
|
||||
if (!id && !customTags && this.schema) return;
|
||||
if (typeof id === 'number') id = id.toFixed(1);
|
||||
|
||||
if (id === '1.0' || id === '1.1' || id === '1.2') {
|
||||
if (this.version) this.version = id;else this.options.version = id;
|
||||
delete this.options.schema;
|
||||
} else if (id && typeof id === 'string') {
|
||||
this.options.schema = id;
|
||||
}
|
||||
|
||||
if (Array.isArray(customTags)) this.options.customTags = customTags;
|
||||
const opt = Object.assign({}, this.getDefaults(), this.options);
|
||||
this.schema = new Schema.Schema(opt);
|
||||
}
|
||||
|
||||
parse(node, prevDoc) {
|
||||
if (this.options.keepCstNodes) this.cstNode = node;
|
||||
if (this.options.keepNodeTypes) this.type = 'DOCUMENT';
|
||||
const {
|
||||
directives = [],
|
||||
contents = [],
|
||||
directivesEndMarker,
|
||||
error,
|
||||
valueRange
|
||||
} = node;
|
||||
|
||||
if (error) {
|
||||
if (!error.source) error.source = this;
|
||||
this.errors.push(error);
|
||||
}
|
||||
|
||||
parseDirectives(this, directives, prevDoc);
|
||||
if (directivesEndMarker) this.directivesEndMarker = true;
|
||||
this.range = valueRange ? [valueRange.start, valueRange.end] : null;
|
||||
this.setSchema();
|
||||
this.anchors._cstAliases = [];
|
||||
parseContents(this, contents);
|
||||
this.anchors.resolveNodes();
|
||||
|
||||
if (this.options.prettyErrors) {
|
||||
for (const error of this.errors) if (error instanceof PlainValue.YAMLError) error.makePretty();
|
||||
|
||||
for (const warn of this.warnings) if (warn instanceof PlainValue.YAMLError) warn.makePretty();
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
listNonDefaultTags() {
|
||||
return listTagNames(this.contents).filter(t => t.indexOf(Schema.Schema.defaultPrefix) !== 0);
|
||||
}
|
||||
|
||||
setTagPrefix(handle, prefix) {
|
||||
if (handle[0] !== '!' || handle[handle.length - 1] !== '!') throw new Error('Handle must start and end with !');
|
||||
|
||||
if (prefix) {
|
||||
const prev = this.tagPrefixes.find(p => p.handle === handle);
|
||||
if (prev) prev.prefix = prefix;else this.tagPrefixes.push({
|
||||
handle,
|
||||
prefix
|
||||
});
|
||||
} else {
|
||||
this.tagPrefixes = this.tagPrefixes.filter(p => p.handle !== handle);
|
||||
}
|
||||
}
|
||||
|
||||
toJSON(arg, onAnchor) {
|
||||
const {
|
||||
keepBlobsInJSON,
|
||||
mapAsMap,
|
||||
maxAliasCount
|
||||
} = this.options;
|
||||
const keep = keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof resolveSeq.Scalar));
|
||||
const ctx = {
|
||||
doc: this,
|
||||
indentStep: ' ',
|
||||
keep,
|
||||
mapAsMap: keep && !!mapAsMap,
|
||||
maxAliasCount,
|
||||
stringify // Requiring directly in Pair would create circular dependencies
|
||||
|
||||
};
|
||||
const anchorNames = Object.keys(this.anchors.map);
|
||||
if (anchorNames.length > 0) ctx.anchors = new Map(anchorNames.map(name => [this.anchors.map[name], {
|
||||
alias: [],
|
||||
aliasCount: 0,
|
||||
count: 1
|
||||
}]));
|
||||
const res = resolveSeq.toJSON(this.contents, arg, ctx);
|
||||
if (typeof onAnchor === 'function' && ctx.anchors) for (const {
|
||||
count,
|
||||
res
|
||||
} of ctx.anchors.values()) onAnchor(res, count);
|
||||
return res;
|
||||
}
|
||||
|
||||
toString() {
|
||||
if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
|
||||
const indentSize = this.options.indent;
|
||||
|
||||
if (!Number.isInteger(indentSize) || indentSize <= 0) {
|
||||
const s = JSON.stringify(indentSize);
|
||||
throw new Error(`"indent" option must be a positive integer, not ${s}`);
|
||||
}
|
||||
|
||||
this.setSchema();
|
||||
const lines = [];
|
||||
let hasDirectives = false;
|
||||
|
||||
if (this.version) {
|
||||
let vd = '%YAML 1.2';
|
||||
|
||||
if (this.schema.name === 'yaml-1.1') {
|
||||
if (this.version === '1.0') vd = '%YAML:1.0';else if (this.version === '1.1') vd = '%YAML 1.1';
|
||||
}
|
||||
|
||||
lines.push(vd);
|
||||
hasDirectives = true;
|
||||
}
|
||||
|
||||
const tagNames = this.listNonDefaultTags();
|
||||
this.tagPrefixes.forEach(({
|
||||
handle,
|
||||
prefix
|
||||
}) => {
|
||||
if (tagNames.some(t => t.indexOf(prefix) === 0)) {
|
||||
lines.push(`%TAG ${handle} ${prefix}`);
|
||||
hasDirectives = true;
|
||||
}
|
||||
});
|
||||
if (hasDirectives || this.directivesEndMarker) lines.push('---');
|
||||
|
||||
if (this.commentBefore) {
|
||||
if (hasDirectives || !this.directivesEndMarker) lines.unshift('');
|
||||
lines.unshift(this.commentBefore.replace(/^/gm, '#'));
|
||||
}
|
||||
|
||||
const ctx = {
|
||||
anchors: {},
|
||||
doc: this,
|
||||
indent: '',
|
||||
indentStep: ' '.repeat(indentSize),
|
||||
stringify // Requiring directly in nodes would create circular dependencies
|
||||
|
||||
};
|
||||
let chompKeep = false;
|
||||
let contentComment = null;
|
||||
|
||||
if (this.contents) {
|
||||
if (this.contents instanceof resolveSeq.Node) {
|
||||
if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker)) lines.push('');
|
||||
if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment
|
||||
|
||||
ctx.forceBlockIndent = !!this.comment;
|
||||
contentComment = this.contents.comment;
|
||||
}
|
||||
|
||||
const onChompKeep = contentComment ? null : () => chompKeep = true;
|
||||
const body = stringify(this.contents, ctx, () => contentComment = null, onChompKeep);
|
||||
lines.push(resolveSeq.addComment(body, '', contentComment));
|
||||
} else if (this.contents !== undefined) {
|
||||
lines.push(stringify(this.contents, ctx));
|
||||
}
|
||||
|
||||
if (this.comment) {
|
||||
if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '') lines.push('');
|
||||
lines.push(this.comment.replace(/^/gm, '#'));
|
||||
}
|
||||
|
||||
return lines.join('\n') + '\n';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PlainValue._defineProperty(Document, "defaults", documentOptions);
|
||||
|
||||
exports.Document = Document;
|
||||
exports.defaultOptions = defaultOptions;
|
||||
exports.scalarOptions = scalarOptions;
|
||||
876
node_modules/yaml/dist/PlainValue-ec8e588e.js
generated
vendored
Normal file
876
node_modules/yaml/dist/PlainValue-ec8e588e.js
generated
vendored
Normal file
@@ -0,0 +1,876 @@
|
||||
'use strict';
|
||||
|
||||
const Char = {
|
||||
ANCHOR: '&',
|
||||
COMMENT: '#',
|
||||
TAG: '!',
|
||||
DIRECTIVES_END: '-',
|
||||
DOCUMENT_END: '.'
|
||||
};
|
||||
const Type = {
|
||||
ALIAS: 'ALIAS',
|
||||
BLANK_LINE: 'BLANK_LINE',
|
||||
BLOCK_FOLDED: 'BLOCK_FOLDED',
|
||||
BLOCK_LITERAL: 'BLOCK_LITERAL',
|
||||
COMMENT: 'COMMENT',
|
||||
DIRECTIVE: 'DIRECTIVE',
|
||||
DOCUMENT: 'DOCUMENT',
|
||||
FLOW_MAP: 'FLOW_MAP',
|
||||
FLOW_SEQ: 'FLOW_SEQ',
|
||||
MAP: 'MAP',
|
||||
MAP_KEY: 'MAP_KEY',
|
||||
MAP_VALUE: 'MAP_VALUE',
|
||||
PLAIN: 'PLAIN',
|
||||
QUOTE_DOUBLE: 'QUOTE_DOUBLE',
|
||||
QUOTE_SINGLE: 'QUOTE_SINGLE',
|
||||
SEQ: 'SEQ',
|
||||
SEQ_ITEM: 'SEQ_ITEM'
|
||||
};
|
||||
const defaultTagPrefix = 'tag:yaml.org,2002:';
|
||||
const defaultTags = {
|
||||
MAP: 'tag:yaml.org,2002:map',
|
||||
SEQ: 'tag:yaml.org,2002:seq',
|
||||
STR: 'tag:yaml.org,2002:str'
|
||||
};
|
||||
|
||||
function findLineStarts(src) {
|
||||
const ls = [0];
|
||||
let offset = src.indexOf('\n');
|
||||
|
||||
while (offset !== -1) {
|
||||
offset += 1;
|
||||
ls.push(offset);
|
||||
offset = src.indexOf('\n', offset);
|
||||
}
|
||||
|
||||
return ls;
|
||||
}
|
||||
|
||||
function getSrcInfo(cst) {
|
||||
let lineStarts, src;
|
||||
|
||||
if (typeof cst === 'string') {
|
||||
lineStarts = findLineStarts(cst);
|
||||
src = cst;
|
||||
} else {
|
||||
if (Array.isArray(cst)) cst = cst[0];
|
||||
|
||||
if (cst && cst.context) {
|
||||
if (!cst.lineStarts) cst.lineStarts = findLineStarts(cst.context.src);
|
||||
lineStarts = cst.lineStarts;
|
||||
src = cst.context.src;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
lineStarts,
|
||||
src
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @typedef {Object} LinePos - One-indexed position in the source
|
||||
* @property {number} line
|
||||
* @property {number} col
|
||||
*/
|
||||
|
||||
/**
|
||||
* Determine the line/col position matching a character offset.
|
||||
*
|
||||
* Accepts a source string or a CST document as the second parameter. With
|
||||
* the latter, starting indices for lines are cached in the document as
|
||||
* `lineStarts: number[]`.
|
||||
*
|
||||
* Returns a one-indexed `{ line, col }` location if found, or
|
||||
* `undefined` otherwise.
|
||||
*
|
||||
* @param {number} offset
|
||||
* @param {string|Document|Document[]} cst
|
||||
* @returns {?LinePos}
|
||||
*/
|
||||
|
||||
|
||||
function getLinePos(offset, cst) {
|
||||
if (typeof offset !== 'number' || offset < 0) return null;
|
||||
const {
|
||||
lineStarts,
|
||||
src
|
||||
} = getSrcInfo(cst);
|
||||
if (!lineStarts || !src || offset > src.length) return null;
|
||||
|
||||
for (let i = 0; i < lineStarts.length; ++i) {
|
||||
const start = lineStarts[i];
|
||||
|
||||
if (offset < start) {
|
||||
return {
|
||||
line: i,
|
||||
col: offset - lineStarts[i - 1] + 1
|
||||
};
|
||||
}
|
||||
|
||||
if (offset === start) return {
|
||||
line: i + 1,
|
||||
col: 1
|
||||
};
|
||||
}
|
||||
|
||||
const line = lineStarts.length;
|
||||
return {
|
||||
line,
|
||||
col: offset - lineStarts[line - 1] + 1
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Get a specified line from the source.
|
||||
*
|
||||
* Accepts a source string or a CST document as the second parameter. With
|
||||
* the latter, starting indices for lines are cached in the document as
|
||||
* `lineStarts: number[]`.
|
||||
*
|
||||
* Returns the line as a string if found, or `null` otherwise.
|
||||
*
|
||||
* @param {number} line One-indexed line number
|
||||
* @param {string|Document|Document[]} cst
|
||||
* @returns {?string}
|
||||
*/
|
||||
|
||||
function getLine(line, cst) {
|
||||
const {
|
||||
lineStarts,
|
||||
src
|
||||
} = getSrcInfo(cst);
|
||||
if (!lineStarts || !(line >= 1) || line > lineStarts.length) return null;
|
||||
const start = lineStarts[line - 1];
|
||||
let end = lineStarts[line]; // undefined for last line; that's ok for slice()
|
||||
|
||||
while (end && end > start && src[end - 1] === '\n') --end;
|
||||
|
||||
return src.slice(start, end);
|
||||
}
|
||||
/**
|
||||
* Pretty-print the starting line from the source indicated by the range `pos`
|
||||
*
|
||||
* Trims output to `maxWidth` chars while keeping the starting column visible,
|
||||
* using `…` at either end to indicate dropped characters.
|
||||
*
|
||||
* Returns a two-line string (or `null`) with `\n` as separator; the second line
|
||||
* will hold appropriately indented `^` marks indicating the column range.
|
||||
*
|
||||
* @param {Object} pos
|
||||
* @param {LinePos} pos.start
|
||||
* @param {LinePos} [pos.end]
|
||||
* @param {string|Document|Document[]*} cst
|
||||
* @param {number} [maxWidth=80]
|
||||
* @returns {?string}
|
||||
*/
|
||||
|
||||
function getPrettyContext({
|
||||
start,
|
||||
end
|
||||
}, cst, maxWidth = 80) {
|
||||
let src = getLine(start.line, cst);
|
||||
if (!src) return null;
|
||||
let {
|
||||
col
|
||||
} = start;
|
||||
|
||||
if (src.length > maxWidth) {
|
||||
if (col <= maxWidth - 10) {
|
||||
src = src.substr(0, maxWidth - 1) + '…';
|
||||
} else {
|
||||
const halfWidth = Math.round(maxWidth / 2);
|
||||
if (src.length > col + halfWidth) src = src.substr(0, col + halfWidth - 1) + '…';
|
||||
col -= src.length - maxWidth;
|
||||
src = '…' + src.substr(1 - maxWidth);
|
||||
}
|
||||
}
|
||||
|
||||
let errLen = 1;
|
||||
let errEnd = '';
|
||||
|
||||
if (end) {
|
||||
if (end.line === start.line && col + (end.col - start.col) <= maxWidth + 1) {
|
||||
errLen = end.col - start.col;
|
||||
} else {
|
||||
errLen = Math.min(src.length + 1, maxWidth) - col;
|
||||
errEnd = '…';
|
||||
}
|
||||
}
|
||||
|
||||
const offset = col > 1 ? ' '.repeat(col - 1) : '';
|
||||
const err = '^'.repeat(errLen);
|
||||
return `${src}\n${offset}${err}${errEnd}`;
|
||||
}
|
||||
|
||||
class Range {
|
||||
static copy(orig) {
|
||||
return new Range(orig.start, orig.end);
|
||||
}
|
||||
|
||||
constructor(start, end) {
|
||||
this.start = start;
|
||||
this.end = end || start;
|
||||
}
|
||||
|
||||
isEmpty() {
|
||||
return typeof this.start !== 'number' || !this.end || this.end <= this.start;
|
||||
}
|
||||
/**
|
||||
* Set `origStart` and `origEnd` to point to the original source range for
|
||||
* this node, which may differ due to dropped CR characters.
|
||||
*
|
||||
* @param {number[]} cr - Positions of dropped CR characters
|
||||
* @param {number} offset - Starting index of `cr` from the last call
|
||||
* @returns {number} - The next offset, matching the one found for `origStart`
|
||||
*/
|
||||
|
||||
|
||||
setOrigRange(cr, offset) {
|
||||
const {
|
||||
start,
|
||||
end
|
||||
} = this;
|
||||
|
||||
if (cr.length === 0 || end <= cr[0]) {
|
||||
this.origStart = start;
|
||||
this.origEnd = end;
|
||||
return offset;
|
||||
}
|
||||
|
||||
let i = offset;
|
||||
|
||||
while (i < cr.length) {
|
||||
if (cr[i] > start) break;else ++i;
|
||||
}
|
||||
|
||||
this.origStart = start + i;
|
||||
const nextOffset = i;
|
||||
|
||||
while (i < cr.length) {
|
||||
// if end was at \n, it should now be at \r
|
||||
if (cr[i] >= end) break;else ++i;
|
||||
}
|
||||
|
||||
this.origEnd = end + i;
|
||||
return nextOffset;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Root class of all nodes */
|
||||
|
||||
class Node {
|
||||
static addStringTerminator(src, offset, str) {
|
||||
if (str[str.length - 1] === '\n') return str;
|
||||
const next = Node.endOfWhiteSpace(src, offset);
|
||||
return next >= src.length || src[next] === '\n' ? str + '\n' : str;
|
||||
} // ^(---|...)
|
||||
|
||||
|
||||
static atDocumentBoundary(src, offset, sep) {
|
||||
const ch0 = src[offset];
|
||||
if (!ch0) return true;
|
||||
const prev = src[offset - 1];
|
||||
if (prev && prev !== '\n') return false;
|
||||
|
||||
if (sep) {
|
||||
if (ch0 !== sep) return false;
|
||||
} else {
|
||||
if (ch0 !== Char.DIRECTIVES_END && ch0 !== Char.DOCUMENT_END) return false;
|
||||
}
|
||||
|
||||
const ch1 = src[offset + 1];
|
||||
const ch2 = src[offset + 2];
|
||||
if (ch1 !== ch0 || ch2 !== ch0) return false;
|
||||
const ch3 = src[offset + 3];
|
||||
return !ch3 || ch3 === '\n' || ch3 === '\t' || ch3 === ' ';
|
||||
}
|
||||
|
||||
static endOfIdentifier(src, offset) {
|
||||
let ch = src[offset];
|
||||
const isVerbatim = ch === '<';
|
||||
const notOk = isVerbatim ? ['\n', '\t', ' ', '>'] : ['\n', '\t', ' ', '[', ']', '{', '}', ','];
|
||||
|
||||
while (ch && notOk.indexOf(ch) === -1) ch = src[offset += 1];
|
||||
|
||||
if (isVerbatim && ch === '>') offset += 1;
|
||||
return offset;
|
||||
}
|
||||
|
||||
static endOfIndent(src, offset) {
|
||||
let ch = src[offset];
|
||||
|
||||
while (ch === ' ') ch = src[offset += 1];
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static endOfLine(src, offset) {
|
||||
let ch = src[offset];
|
||||
|
||||
while (ch && ch !== '\n') ch = src[offset += 1];
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static endOfWhiteSpace(src, offset) {
|
||||
let ch = src[offset];
|
||||
|
||||
while (ch === '\t' || ch === ' ') ch = src[offset += 1];
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
static startOfLine(src, offset) {
|
||||
let ch = src[offset - 1];
|
||||
if (ch === '\n') return offset;
|
||||
|
||||
while (ch && ch !== '\n') ch = src[offset -= 1];
|
||||
|
||||
return offset + 1;
|
||||
}
|
||||
/**
|
||||
* End of indentation, or null if the line's indent level is not more
|
||||
* than `indent`
|
||||
*
|
||||
* @param {string} src
|
||||
* @param {number} indent
|
||||
* @param {number} lineStart
|
||||
* @returns {?number}
|
||||
*/
|
||||
|
||||
|
||||
static endOfBlockIndent(src, indent, lineStart) {
|
||||
const inEnd = Node.endOfIndent(src, lineStart);
|
||||
|
||||
if (inEnd > lineStart + indent) {
|
||||
return inEnd;
|
||||
} else {
|
||||
const wsEnd = Node.endOfWhiteSpace(src, inEnd);
|
||||
const ch = src[wsEnd];
|
||||
if (!ch || ch === '\n') return wsEnd;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
static atBlank(src, offset, endAsBlank) {
|
||||
const ch = src[offset];
|
||||
return ch === '\n' || ch === '\t' || ch === ' ' || endAsBlank && !ch;
|
||||
}
|
||||
|
||||
static nextNodeIsIndented(ch, indentDiff, indicatorAsIndent) {
|
||||
if (!ch || indentDiff < 0) return false;
|
||||
if (indentDiff > 0) return true;
|
||||
return indicatorAsIndent && ch === '-';
|
||||
} // should be at line or string end, or at next non-whitespace char
|
||||
|
||||
|
||||
static normalizeOffset(src, offset) {
|
||||
const ch = src[offset];
|
||||
return !ch ? offset : ch !== '\n' && src[offset - 1] === '\n' ? offset - 1 : Node.endOfWhiteSpace(src, offset);
|
||||
} // fold single newline into space, multiple newlines to N - 1 newlines
|
||||
// presumes src[offset] === '\n'
|
||||
|
||||
|
||||
static foldNewline(src, offset, indent) {
|
||||
let inCount = 0;
|
||||
let error = false;
|
||||
let fold = '';
|
||||
let ch = src[offset + 1];
|
||||
|
||||
while (ch === ' ' || ch === '\t' || ch === '\n') {
|
||||
switch (ch) {
|
||||
case '\n':
|
||||
inCount = 0;
|
||||
offset += 1;
|
||||
fold += '\n';
|
||||
break;
|
||||
|
||||
case '\t':
|
||||
if (inCount <= indent) error = true;
|
||||
offset = Node.endOfWhiteSpace(src, offset + 2) - 1;
|
||||
break;
|
||||
|
||||
case ' ':
|
||||
inCount += 1;
|
||||
offset += 1;
|
||||
break;
|
||||
}
|
||||
|
||||
ch = src[offset + 1];
|
||||
}
|
||||
|
||||
if (!fold) fold = ' ';
|
||||
if (ch && inCount <= indent) error = true;
|
||||
return {
|
||||
fold,
|
||||
offset,
|
||||
error
|
||||
};
|
||||
}
|
||||
|
||||
constructor(type, props, context) {
|
||||
Object.defineProperty(this, 'context', {
|
||||
value: context || null,
|
||||
writable: true
|
||||
});
|
||||
this.error = null;
|
||||
this.range = null;
|
||||
this.valueRange = null;
|
||||
this.props = props || [];
|
||||
this.type = type;
|
||||
this.value = null;
|
||||
}
|
||||
|
||||
getPropValue(idx, key, skipKey) {
|
||||
if (!this.context) return null;
|
||||
const {
|
||||
src
|
||||
} = this.context;
|
||||
const prop = this.props[idx];
|
||||
return prop && src[prop.start] === key ? src.slice(prop.start + (skipKey ? 1 : 0), prop.end) : null;
|
||||
}
|
||||
|
||||
get anchor() {
|
||||
for (let i = 0; i < this.props.length; ++i) {
|
||||
const anchor = this.getPropValue(i, Char.ANCHOR, true);
|
||||
if (anchor != null) return anchor;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
get comment() {
|
||||
const comments = [];
|
||||
|
||||
for (let i = 0; i < this.props.length; ++i) {
|
||||
const comment = this.getPropValue(i, Char.COMMENT, true);
|
||||
if (comment != null) comments.push(comment);
|
||||
}
|
||||
|
||||
return comments.length > 0 ? comments.join('\n') : null;
|
||||
}
|
||||
|
||||
commentHasRequiredWhitespace(start) {
|
||||
const {
|
||||
src
|
||||
} = this.context;
|
||||
if (this.header && start === this.header.end) return false;
|
||||
if (!this.valueRange) return false;
|
||||
const {
|
||||
end
|
||||
} = this.valueRange;
|
||||
return start !== end || Node.atBlank(src, end - 1);
|
||||
}
|
||||
|
||||
get hasComment() {
|
||||
if (this.context) {
|
||||
const {
|
||||
src
|
||||
} = this.context;
|
||||
|
||||
for (let i = 0; i < this.props.length; ++i) {
|
||||
if (src[this.props[i].start] === Char.COMMENT) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
get hasProps() {
|
||||
if (this.context) {
|
||||
const {
|
||||
src
|
||||
} = this.context;
|
||||
|
||||
for (let i = 0; i < this.props.length; ++i) {
|
||||
if (src[this.props[i].start] !== Char.COMMENT) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
get includesTrailingLines() {
|
||||
return false;
|
||||
}
|
||||
|
||||
get jsonLike() {
|
||||
const jsonLikeTypes = [Type.FLOW_MAP, Type.FLOW_SEQ, Type.QUOTE_DOUBLE, Type.QUOTE_SINGLE];
|
||||
return jsonLikeTypes.indexOf(this.type) !== -1;
|
||||
}
|
||||
|
||||
get rangeAsLinePos() {
|
||||
if (!this.range || !this.context) return undefined;
|
||||
const start = getLinePos(this.range.start, this.context.root);
|
||||
if (!start) return undefined;
|
||||
const end = getLinePos(this.range.end, this.context.root);
|
||||
return {
|
||||
start,
|
||||
end
|
||||
};
|
||||
}
|
||||
|
||||
get rawValue() {
|
||||
if (!this.valueRange || !this.context) return null;
|
||||
const {
|
||||
start,
|
||||
end
|
||||
} = this.valueRange;
|
||||
return this.context.src.slice(start, end);
|
||||
}
|
||||
|
||||
get tag() {
|
||||
for (let i = 0; i < this.props.length; ++i) {
|
||||
const tag = this.getPropValue(i, Char.TAG, false);
|
||||
|
||||
if (tag != null) {
|
||||
if (tag[1] === '<') {
|
||||
return {
|
||||
verbatim: tag.slice(2, -1)
|
||||
};
|
||||
} else {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const [_, handle, suffix] = tag.match(/^(.*!)([^!]*)$/);
|
||||
return {
|
||||
handle,
|
||||
suffix
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
get valueRangeContainsNewline() {
|
||||
if (!this.valueRange || !this.context) return false;
|
||||
const {
|
||||
start,
|
||||
end
|
||||
} = this.valueRange;
|
||||
const {
|
||||
src
|
||||
} = this.context;
|
||||
|
||||
for (let i = start; i < end; ++i) {
|
||||
if (src[i] === '\n') return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
parseComment(start) {
|
||||
const {
|
||||
src
|
||||
} = this.context;
|
||||
|
||||
if (src[start] === Char.COMMENT) {
|
||||
const end = Node.endOfLine(src, start + 1);
|
||||
const commentRange = new Range(start, end);
|
||||
this.props.push(commentRange);
|
||||
return end;
|
||||
}
|
||||
|
||||
return start;
|
||||
}
|
||||
/**
|
||||
* Populates the `origStart` and `origEnd` values of all ranges for this
|
||||
* node. Extended by child classes to handle descendant nodes.
|
||||
*
|
||||
* @param {number[]} cr - Positions of dropped CR characters
|
||||
* @param {number} offset - Starting index of `cr` from the last call
|
||||
* @returns {number} - The next offset, matching the one found for `origStart`
|
||||
*/
|
||||
|
||||
|
||||
setOrigRanges(cr, offset) {
|
||||
if (this.range) offset = this.range.setOrigRange(cr, offset);
|
||||
if (this.valueRange) this.valueRange.setOrigRange(cr, offset);
|
||||
this.props.forEach(prop => prop.setOrigRange(cr, offset));
|
||||
return offset;
|
||||
}
|
||||
|
||||
toString() {
|
||||
const {
|
||||
context: {
|
||||
src
|
||||
},
|
||||
range,
|
||||
value
|
||||
} = this;
|
||||
if (value != null) return value;
|
||||
const str = src.slice(range.start, range.end);
|
||||
return Node.addStringTerminator(src, range.end, str);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class YAMLError extends Error {
|
||||
constructor(name, source, message) {
|
||||
if (!message || !(source instanceof Node)) throw new Error(`Invalid arguments for new ${name}`);
|
||||
super();
|
||||
this.name = name;
|
||||
this.message = message;
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
makePretty() {
|
||||
if (!this.source) return;
|
||||
this.nodeType = this.source.type;
|
||||
const cst = this.source.context && this.source.context.root;
|
||||
|
||||
if (typeof this.offset === 'number') {
|
||||
this.range = new Range(this.offset, this.offset + 1);
|
||||
const start = cst && getLinePos(this.offset, cst);
|
||||
|
||||
if (start) {
|
||||
const end = {
|
||||
line: start.line,
|
||||
col: start.col + 1
|
||||
};
|
||||
this.linePos = {
|
||||
start,
|
||||
end
|
||||
};
|
||||
}
|
||||
|
||||
delete this.offset;
|
||||
} else {
|
||||
this.range = this.source.range;
|
||||
this.linePos = this.source.rangeAsLinePos;
|
||||
}
|
||||
|
||||
if (this.linePos) {
|
||||
const {
|
||||
line,
|
||||
col
|
||||
} = this.linePos.start;
|
||||
this.message += ` at line ${line}, column ${col}`;
|
||||
const ctx = cst && getPrettyContext(this.linePos, cst);
|
||||
if (ctx) this.message += `:\n\n${ctx}\n`;
|
||||
}
|
||||
|
||||
delete this.source;
|
||||
}
|
||||
|
||||
}
|
||||
class YAMLReferenceError extends YAMLError {
|
||||
constructor(source, message) {
|
||||
super('YAMLReferenceError', source, message);
|
||||
}
|
||||
|
||||
}
|
||||
class YAMLSemanticError extends YAMLError {
|
||||
constructor(source, message) {
|
||||
super('YAMLSemanticError', source, message);
|
||||
}
|
||||
|
||||
}
|
||||
class YAMLSyntaxError extends YAMLError {
|
||||
constructor(source, message) {
|
||||
super('YAMLSyntaxError', source, message);
|
||||
}
|
||||
|
||||
}
|
||||
class YAMLWarning extends YAMLError {
|
||||
constructor(source, message) {
|
||||
super('YAMLWarning', source, message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
class PlainValue extends Node {
|
||||
static endOfLine(src, start, inFlow) {
|
||||
let ch = src[start];
|
||||
let offset = start;
|
||||
|
||||
while (ch && ch !== '\n') {
|
||||
if (inFlow && (ch === '[' || ch === ']' || ch === '{' || ch === '}' || ch === ',')) break;
|
||||
const next = src[offset + 1];
|
||||
if (ch === ':' && (!next || next === '\n' || next === '\t' || next === ' ' || inFlow && next === ',')) break;
|
||||
if ((ch === ' ' || ch === '\t') && next === '#') break;
|
||||
offset += 1;
|
||||
ch = next;
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
get strValue() {
|
||||
if (!this.valueRange || !this.context) return null;
|
||||
let {
|
||||
start,
|
||||
end
|
||||
} = this.valueRange;
|
||||
const {
|
||||
src
|
||||
} = this.context;
|
||||
let ch = src[end - 1];
|
||||
|
||||
while (start < end && (ch === '\n' || ch === '\t' || ch === ' ')) ch = src[--end - 1];
|
||||
|
||||
let str = '';
|
||||
|
||||
for (let i = start; i < end; ++i) {
|
||||
const ch = src[i];
|
||||
|
||||
if (ch === '\n') {
|
||||
const {
|
||||
fold,
|
||||
offset
|
||||
} = Node.foldNewline(src, i, -1);
|
||||
str += fold;
|
||||
i = offset;
|
||||
} else if (ch === ' ' || ch === '\t') {
|
||||
// trim trailing whitespace
|
||||
const wsStart = i;
|
||||
let next = src[i + 1];
|
||||
|
||||
while (i < end && (next === ' ' || next === '\t')) {
|
||||
i += 1;
|
||||
next = src[i + 1];
|
||||
}
|
||||
|
||||
if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch;
|
||||
} else {
|
||||
str += ch;
|
||||
}
|
||||
}
|
||||
|
||||
const ch0 = src[start];
|
||||
|
||||
switch (ch0) {
|
||||
case '\t':
|
||||
{
|
||||
const msg = 'Plain value cannot start with a tab character';
|
||||
const errors = [new YAMLSemanticError(this, msg)];
|
||||
return {
|
||||
errors,
|
||||
str
|
||||
};
|
||||
}
|
||||
|
||||
case '@':
|
||||
case '`':
|
||||
{
|
||||
const msg = `Plain value cannot start with reserved character ${ch0}`;
|
||||
const errors = [new YAMLSemanticError(this, msg)];
|
||||
return {
|
||||
errors,
|
||||
str
|
||||
};
|
||||
}
|
||||
|
||||
default:
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
parseBlockValue(start) {
|
||||
const {
|
||||
indent,
|
||||
inFlow,
|
||||
src
|
||||
} = this.context;
|
||||
let offset = start;
|
||||
let valueEnd = start;
|
||||
|
||||
for (let ch = src[offset]; ch === '\n'; ch = src[offset]) {
|
||||
if (Node.atDocumentBoundary(src, offset + 1)) break;
|
||||
const end = Node.endOfBlockIndent(src, indent, offset + 1);
|
||||
if (end === null || src[end] === '#') break;
|
||||
|
||||
if (src[end] === '\n') {
|
||||
offset = end;
|
||||
} else {
|
||||
valueEnd = PlainValue.endOfLine(src, end, inFlow);
|
||||
offset = valueEnd;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.valueRange.isEmpty()) this.valueRange.start = start;
|
||||
this.valueRange.end = valueEnd;
|
||||
return valueEnd;
|
||||
}
|
||||
/**
|
||||
* Parses a plain value from the source
|
||||
*
|
||||
* Accepted forms are:
|
||||
* ```
|
||||
* #comment
|
||||
*
|
||||
* first line
|
||||
*
|
||||
* first line #comment
|
||||
*
|
||||
* first line
|
||||
* block
|
||||
* lines
|
||||
*
|
||||
* #comment
|
||||
* block
|
||||
* lines
|
||||
* ```
|
||||
* where block lines are empty or have an indent level greater than `indent`.
|
||||
*
|
||||
* @param {ParseContext} context
|
||||
* @param {number} start - Index of first character
|
||||
* @returns {number} - Index of the character after this scalar, may be `\n`
|
||||
*/
|
||||
|
||||
|
||||
parse(context, start) {
|
||||
this.context = context;
|
||||
const {
|
||||
inFlow,
|
||||
src
|
||||
} = context;
|
||||
let offset = start;
|
||||
const ch = src[offset];
|
||||
|
||||
if (ch && ch !== '#' && ch !== '\n') {
|
||||
offset = PlainValue.endOfLine(src, start, inFlow);
|
||||
}
|
||||
|
||||
this.valueRange = new Range(start, offset);
|
||||
offset = Node.endOfWhiteSpace(src, offset);
|
||||
offset = this.parseComment(offset);
|
||||
|
||||
if (!this.hasComment || this.valueRange.isEmpty()) {
|
||||
offset = this.parseBlockValue(offset);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.Char = Char;
|
||||
exports.Node = Node;
|
||||
exports.PlainValue = PlainValue;
|
||||
exports.Range = Range;
|
||||
exports.Type = Type;
|
||||
exports.YAMLError = YAMLError;
|
||||
exports.YAMLReferenceError = YAMLReferenceError;
|
||||
exports.YAMLSemanticError = YAMLSemanticError;
|
||||
exports.YAMLSyntaxError = YAMLSyntaxError;
|
||||
exports.YAMLWarning = YAMLWarning;
|
||||
exports._defineProperty = _defineProperty;
|
||||
exports.defaultTagPrefix = defaultTagPrefix;
|
||||
exports.defaultTags = defaultTags;
|
||||
522
node_modules/yaml/dist/Schema-42e9705c.js
generated
vendored
Normal file
522
node_modules/yaml/dist/Schema-42e9705c.js
generated
vendored
Normal file
@@ -0,0 +1,522 @@
|
||||
'use strict';
|
||||
|
||||
var PlainValue = require('./PlainValue-ec8e588e.js');
|
||||
var resolveSeq = require('./resolveSeq-4a68b39b.js');
|
||||
var warnings = require('./warnings-39684f17.js');
|
||||
|
||||
function createMap(schema, obj, ctx) {
|
||||
const map = new resolveSeq.YAMLMap(schema);
|
||||
|
||||
if (obj instanceof Map) {
|
||||
for (const [key, value] of obj) map.items.push(schema.createPair(key, value, ctx));
|
||||
} else if (obj && typeof obj === 'object') {
|
||||
for (const key of Object.keys(obj)) map.items.push(schema.createPair(key, obj[key], ctx));
|
||||
}
|
||||
|
||||
if (typeof schema.sortMapEntries === 'function') {
|
||||
map.items.sort(schema.sortMapEntries);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
const map = {
|
||||
createNode: createMap,
|
||||
default: true,
|
||||
nodeClass: resolveSeq.YAMLMap,
|
||||
tag: 'tag:yaml.org,2002:map',
|
||||
resolve: resolveSeq.resolveMap
|
||||
};
|
||||
|
||||
function createSeq(schema, obj, ctx) {
|
||||
const seq = new resolveSeq.YAMLSeq(schema);
|
||||
|
||||
if (obj && obj[Symbol.iterator]) {
|
||||
for (const it of obj) {
|
||||
const v = schema.createNode(it, ctx.wrapScalars, null, ctx);
|
||||
seq.items.push(v);
|
||||
}
|
||||
}
|
||||
|
||||
return seq;
|
||||
}
|
||||
|
||||
const seq = {
|
||||
createNode: createSeq,
|
||||
default: true,
|
||||
nodeClass: resolveSeq.YAMLSeq,
|
||||
tag: 'tag:yaml.org,2002:seq',
|
||||
resolve: resolveSeq.resolveSeq
|
||||
};
|
||||
|
||||
const string = {
|
||||
identify: value => typeof value === 'string',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:str',
|
||||
resolve: resolveSeq.resolveString,
|
||||
|
||||
stringify(item, ctx, onComment, onChompKeep) {
|
||||
ctx = Object.assign({
|
||||
actualString: true
|
||||
}, ctx);
|
||||
return resolveSeq.stringifyString(item, ctx, onComment, onChompKeep);
|
||||
},
|
||||
|
||||
options: resolveSeq.strOptions
|
||||
};
|
||||
|
||||
const failsafe = [map, seq, string];
|
||||
|
||||
/* global BigInt */
|
||||
|
||||
const intIdentify = value => typeof value === 'bigint' || Number.isInteger(value);
|
||||
|
||||
const intResolve = (src, part, radix) => resolveSeq.intOptions.asBigInt ? BigInt(src) : parseInt(part, radix);
|
||||
|
||||
function intStringify(node, radix, prefix) {
|
||||
const {
|
||||
value
|
||||
} = node;
|
||||
if (intIdentify(value) && value >= 0) return prefix + value.toString(radix);
|
||||
return resolveSeq.stringifyNumber(node);
|
||||
}
|
||||
|
||||
const nullObj = {
|
||||
identify: value => value == null,
|
||||
createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:null',
|
||||
test: /^(?:~|[Nn]ull|NULL)?$/,
|
||||
resolve: () => null,
|
||||
options: resolveSeq.nullOptions,
|
||||
stringify: () => resolveSeq.nullOptions.nullStr
|
||||
};
|
||||
const boolObj = {
|
||||
identify: value => typeof value === 'boolean',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
||||
resolve: str => str[0] === 't' || str[0] === 'T',
|
||||
options: resolveSeq.boolOptions,
|
||||
stringify: ({
|
||||
value
|
||||
}) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr
|
||||
};
|
||||
const octObj = {
|
||||
identify: value => intIdentify(value) && value >= 0,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'OCT',
|
||||
test: /^0o([0-7]+)$/,
|
||||
resolve: (str, oct) => intResolve(str, oct, 8),
|
||||
options: resolveSeq.intOptions,
|
||||
stringify: node => intStringify(node, 8, '0o')
|
||||
};
|
||||
const intObj = {
|
||||
identify: intIdentify,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
test: /^[-+]?[0-9]+$/,
|
||||
resolve: str => intResolve(str, str, 10),
|
||||
options: resolveSeq.intOptions,
|
||||
stringify: resolveSeq.stringifyNumber
|
||||
};
|
||||
const hexObj = {
|
||||
identify: value => intIdentify(value) && value >= 0,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'HEX',
|
||||
test: /^0x([0-9a-fA-F]+)$/,
|
||||
resolve: (str, hex) => intResolve(str, hex, 16),
|
||||
options: resolveSeq.intOptions,
|
||||
stringify: node => intStringify(node, 16, '0x')
|
||||
};
|
||||
const nanObj = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
||||
resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
||||
stringify: resolveSeq.stringifyNumber
|
||||
};
|
||||
const expObj = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
format: 'EXP',
|
||||
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
||||
resolve: str => parseFloat(str),
|
||||
stringify: ({
|
||||
value
|
||||
}) => Number(value).toExponential()
|
||||
};
|
||||
const floatObj = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/,
|
||||
|
||||
resolve(str, frac1, frac2) {
|
||||
const frac = frac1 || frac2;
|
||||
const node = new resolveSeq.Scalar(parseFloat(str));
|
||||
if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
|
||||
return node;
|
||||
},
|
||||
|
||||
stringify: resolveSeq.stringifyNumber
|
||||
};
|
||||
const core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
|
||||
|
||||
/* global BigInt */
|
||||
|
||||
const intIdentify$1 = value => typeof value === 'bigint' || Number.isInteger(value);
|
||||
|
||||
const stringifyJSON = ({
|
||||
value
|
||||
}) => JSON.stringify(value);
|
||||
|
||||
const json = [map, seq, {
|
||||
identify: value => typeof value === 'string',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:str',
|
||||
resolve: resolveSeq.resolveString,
|
||||
stringify: stringifyJSON
|
||||
}, {
|
||||
identify: value => value == null,
|
||||
createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:null',
|
||||
test: /^null$/,
|
||||
resolve: () => null,
|
||||
stringify: stringifyJSON
|
||||
}, {
|
||||
identify: value => typeof value === 'boolean',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^true|false$/,
|
||||
resolve: str => str === 'true',
|
||||
stringify: stringifyJSON
|
||||
}, {
|
||||
identify: intIdentify$1,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
test: /^-?(?:0|[1-9][0-9]*)$/,
|
||||
resolve: str => resolveSeq.intOptions.asBigInt ? BigInt(str) : parseInt(str, 10),
|
||||
stringify: ({
|
||||
value
|
||||
}) => intIdentify$1(value) ? value.toString() : JSON.stringify(value)
|
||||
}, {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
||||
resolve: str => parseFloat(str),
|
||||
stringify: stringifyJSON
|
||||
}];
|
||||
|
||||
json.scalarFallback = str => {
|
||||
throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(str)}`);
|
||||
};
|
||||
|
||||
/* global BigInt */
|
||||
|
||||
const boolStringify = ({
|
||||
value
|
||||
}) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr;
|
||||
|
||||
const intIdentify$2 = value => typeof value === 'bigint' || Number.isInteger(value);
|
||||
|
||||
function intResolve$1(sign, src, radix) {
|
||||
let str = src.replace(/_/g, '');
|
||||
|
||||
if (resolveSeq.intOptions.asBigInt) {
|
||||
switch (radix) {
|
||||
case 2:
|
||||
str = `0b${str}`;
|
||||
break;
|
||||
|
||||
case 8:
|
||||
str = `0o${str}`;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
str = `0x${str}`;
|
||||
break;
|
||||
}
|
||||
|
||||
const n = BigInt(str);
|
||||
return sign === '-' ? BigInt(-1) * n : n;
|
||||
}
|
||||
|
||||
const n = parseInt(str, radix);
|
||||
return sign === '-' ? -1 * n : n;
|
||||
}
|
||||
|
||||
function intStringify$1(node, radix, prefix) {
|
||||
const {
|
||||
value
|
||||
} = node;
|
||||
|
||||
if (intIdentify$2(value)) {
|
||||
const str = value.toString(radix);
|
||||
return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;
|
||||
}
|
||||
|
||||
return resolveSeq.stringifyNumber(node);
|
||||
}
|
||||
|
||||
const yaml11 = failsafe.concat([{
|
||||
identify: value => value == null,
|
||||
createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:null',
|
||||
test: /^(?:~|[Nn]ull|NULL)?$/,
|
||||
resolve: () => null,
|
||||
options: resolveSeq.nullOptions,
|
||||
stringify: () => resolveSeq.nullOptions.nullStr
|
||||
}, {
|
||||
identify: value => typeof value === 'boolean',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
||||
resolve: () => true,
|
||||
options: resolveSeq.boolOptions,
|
||||
stringify: boolStringify
|
||||
}, {
|
||||
identify: value => typeof value === 'boolean',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:bool',
|
||||
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
|
||||
resolve: () => false,
|
||||
options: resolveSeq.boolOptions,
|
||||
stringify: boolStringify
|
||||
}, {
|
||||
identify: intIdentify$2,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'BIN',
|
||||
test: /^([-+]?)0b([0-1_]+)$/,
|
||||
resolve: (str, sign, bin) => intResolve$1(sign, bin, 2),
|
||||
stringify: node => intStringify$1(node, 2, '0b')
|
||||
}, {
|
||||
identify: intIdentify$2,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'OCT',
|
||||
test: /^([-+]?)0([0-7_]+)$/,
|
||||
resolve: (str, sign, oct) => intResolve$1(sign, oct, 8),
|
||||
stringify: node => intStringify$1(node, 8, '0')
|
||||
}, {
|
||||
identify: intIdentify$2,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
test: /^([-+]?)([0-9][0-9_]*)$/,
|
||||
resolve: (str, sign, abs) => intResolve$1(sign, abs, 10),
|
||||
stringify: resolveSeq.stringifyNumber
|
||||
}, {
|
||||
identify: intIdentify$2,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'HEX',
|
||||
test: /^([-+]?)0x([0-9a-fA-F_]+)$/,
|
||||
resolve: (str, sign, hex) => intResolve$1(sign, hex, 16),
|
||||
stringify: node => intStringify$1(node, 16, '0x')
|
||||
}, {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
||||
resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
||||
stringify: resolveSeq.stringifyNumber
|
||||
}, {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
format: 'EXP',
|
||||
test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
||||
resolve: str => parseFloat(str.replace(/_/g, '')),
|
||||
stringify: ({
|
||||
value
|
||||
}) => Number(value).toExponential()
|
||||
}, {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
|
||||
|
||||
resolve(str, frac) {
|
||||
const node = new resolveSeq.Scalar(parseFloat(str.replace(/_/g, '')));
|
||||
|
||||
if (frac) {
|
||||
const f = frac.replace(/_/g, '');
|
||||
if (f[f.length - 1] === '0') node.minFractionDigits = f.length;
|
||||
}
|
||||
|
||||
return node;
|
||||
},
|
||||
|
||||
stringify: resolveSeq.stringifyNumber
|
||||
}], warnings.binary, warnings.omap, warnings.pairs, warnings.set, warnings.intTime, warnings.floatTime, warnings.timestamp);
|
||||
|
||||
const schemas = {
|
||||
core,
|
||||
failsafe,
|
||||
json,
|
||||
yaml11
|
||||
};
|
||||
const tags = {
|
||||
binary: warnings.binary,
|
||||
bool: boolObj,
|
||||
float: floatObj,
|
||||
floatExp: expObj,
|
||||
floatNaN: nanObj,
|
||||
floatTime: warnings.floatTime,
|
||||
int: intObj,
|
||||
intHex: hexObj,
|
||||
intOct: octObj,
|
||||
intTime: warnings.intTime,
|
||||
map,
|
||||
null: nullObj,
|
||||
omap: warnings.omap,
|
||||
pairs: warnings.pairs,
|
||||
seq,
|
||||
set: warnings.set,
|
||||
timestamp: warnings.timestamp
|
||||
};
|
||||
|
||||
function findTagObject(value, tagName, tags) {
|
||||
if (tagName) {
|
||||
const match = tags.filter(t => t.tag === tagName);
|
||||
const tagObj = match.find(t => !t.format) || match[0];
|
||||
if (!tagObj) throw new Error(`Tag ${tagName} not found`);
|
||||
return tagObj;
|
||||
} // TODO: deprecate/remove class check
|
||||
|
||||
|
||||
return tags.find(t => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format);
|
||||
}
|
||||
|
||||
function createNode(value, tagName, ctx) {
|
||||
if (value instanceof resolveSeq.Node) return value;
|
||||
const {
|
||||
defaultPrefix,
|
||||
onTagObj,
|
||||
prevObjects,
|
||||
schema,
|
||||
wrapScalars
|
||||
} = ctx;
|
||||
if (tagName && tagName.startsWith('!!')) tagName = defaultPrefix + tagName.slice(2);
|
||||
let tagObj = findTagObject(value, tagName, schema.tags);
|
||||
|
||||
if (!tagObj) {
|
||||
if (typeof value.toJSON === 'function') value = value.toJSON();
|
||||
if (typeof value !== 'object') return wrapScalars ? new resolveSeq.Scalar(value) : value;
|
||||
tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map;
|
||||
}
|
||||
|
||||
if (onTagObj) {
|
||||
onTagObj(tagObj);
|
||||
delete ctx.onTagObj;
|
||||
} // Detect duplicate references to the same object & use Alias nodes for all
|
||||
// after first. The `obj` wrapper allows for circular references to resolve.
|
||||
|
||||
|
||||
const obj = {};
|
||||
|
||||
if (value && typeof value === 'object' && prevObjects) {
|
||||
const prev = prevObjects.get(value);
|
||||
|
||||
if (prev) {
|
||||
const alias = new resolveSeq.Alias(prev); // leaves source dirty; must be cleaned by caller
|
||||
|
||||
ctx.aliasNodes.push(alias); // defined along with prevObjects
|
||||
|
||||
return alias;
|
||||
}
|
||||
|
||||
obj.value = value;
|
||||
prevObjects.set(value, obj);
|
||||
}
|
||||
|
||||
obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new resolveSeq.Scalar(value) : value;
|
||||
if (tagName && obj.node instanceof resolveSeq.Node) obj.node.tag = tagName;
|
||||
return obj.node;
|
||||
}
|
||||
|
||||
function getSchemaTags(schemas, knownTags, customTags, schemaId) {
|
||||
let tags = schemas[schemaId.replace(/\W/g, '')]; // 'yaml-1.1' -> 'yaml11'
|
||||
|
||||
if (!tags) {
|
||||
const keys = Object.keys(schemas).map(key => JSON.stringify(key)).join(', ');
|
||||
throw new Error(`Unknown schema "${schemaId}"; use one of ${keys}`);
|
||||
}
|
||||
|
||||
if (Array.isArray(customTags)) {
|
||||
for (const tag of customTags) tags = tags.concat(tag);
|
||||
} else if (typeof customTags === 'function') {
|
||||
tags = customTags(tags.slice());
|
||||
}
|
||||
|
||||
for (let i = 0; i < tags.length; ++i) {
|
||||
const tag = tags[i];
|
||||
|
||||
if (typeof tag === 'string') {
|
||||
const tagObj = knownTags[tag];
|
||||
|
||||
if (!tagObj) {
|
||||
const keys = Object.keys(knownTags).map(key => JSON.stringify(key)).join(', ');
|
||||
throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`);
|
||||
}
|
||||
|
||||
tags[i] = tagObj;
|
||||
}
|
||||
}
|
||||
|
||||
return tags;
|
||||
}
|
||||
|
||||
const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
||||
|
||||
class Schema {
|
||||
// TODO: remove in v2
|
||||
// TODO: remove in v2
|
||||
constructor({
|
||||
customTags,
|
||||
merge,
|
||||
schema,
|
||||
sortMapEntries,
|
||||
tags: deprecatedCustomTags
|
||||
}) {
|
||||
this.merge = !!merge;
|
||||
this.name = schema;
|
||||
this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null;
|
||||
if (!customTags && deprecatedCustomTags) warnings.warnOptionDeprecation('tags', 'customTags');
|
||||
this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema);
|
||||
}
|
||||
|
||||
createNode(value, wrapScalars, tagName, ctx) {
|
||||
const baseCtx = {
|
||||
defaultPrefix: Schema.defaultPrefix,
|
||||
schema: this,
|
||||
wrapScalars
|
||||
};
|
||||
const createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx;
|
||||
return createNode(value, tagName, createCtx);
|
||||
}
|
||||
|
||||
createPair(key, value, ctx) {
|
||||
if (!ctx) ctx = {
|
||||
wrapScalars: true
|
||||
};
|
||||
const k = this.createNode(key, ctx.wrapScalars, null, ctx);
|
||||
const v = this.createNode(value, ctx.wrapScalars, null, ctx);
|
||||
return new resolveSeq.Pair(k, v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PlainValue._defineProperty(Schema, "defaultPrefix", PlainValue.defaultTagPrefix);
|
||||
|
||||
PlainValue._defineProperty(Schema, "defaultTags", PlainValue.defaultTags);
|
||||
|
||||
exports.Schema = Schema;
|
||||
79
node_modules/yaml/dist/index.js
generated
vendored
Normal file
79
node_modules/yaml/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
'use strict';
|
||||
|
||||
var PlainValue = require('./PlainValue-ec8e588e.js');
|
||||
var parseCst = require('./parse-cst.js');
|
||||
require('./resolveSeq-4a68b39b.js');
|
||||
var Document$1 = require('./Document-2cf6b08c.js');
|
||||
var Schema = require('./Schema-42e9705c.js');
|
||||
var warnings = require('./warnings-39684f17.js');
|
||||
|
||||
function createNode(value, wrapScalars = true, tag) {
|
||||
if (tag === undefined && typeof wrapScalars === 'string') {
|
||||
tag = wrapScalars;
|
||||
wrapScalars = true;
|
||||
}
|
||||
|
||||
const options = Object.assign({}, Document$1.Document.defaults[Document$1.defaultOptions.version], Document$1.defaultOptions);
|
||||
const schema = new Schema.Schema(options);
|
||||
return schema.createNode(value, wrapScalars, tag);
|
||||
}
|
||||
|
||||
class Document extends Document$1.Document {
|
||||
constructor(options) {
|
||||
super(Object.assign({}, Document$1.defaultOptions, options));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function parseAllDocuments(src, options) {
|
||||
const stream = [];
|
||||
let prev;
|
||||
|
||||
for (const cstDoc of parseCst.parse(src)) {
|
||||
const doc = new Document(options);
|
||||
doc.parse(cstDoc, prev);
|
||||
stream.push(doc);
|
||||
prev = doc;
|
||||
}
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
function parseDocument(src, options) {
|
||||
const cst = parseCst.parse(src);
|
||||
const doc = new Document(options).parse(cst[0]);
|
||||
|
||||
if (cst.length > 1) {
|
||||
const errMsg = 'Source contains multiple documents; please use YAML.parseAllDocuments()';
|
||||
doc.errors.unshift(new PlainValue.YAMLSemanticError(cst[1], errMsg));
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
function parse(src, options) {
|
||||
const doc = parseDocument(src, options);
|
||||
doc.warnings.forEach(warning => warnings.warn(warning));
|
||||
if (doc.errors.length > 0) throw doc.errors[0];
|
||||
return doc.toJSON();
|
||||
}
|
||||
|
||||
function stringify(value, options) {
|
||||
const doc = new Document(options);
|
||||
doc.contents = value;
|
||||
return String(doc);
|
||||
}
|
||||
|
||||
const YAML = {
|
||||
createNode,
|
||||
defaultOptions: Document$1.defaultOptions,
|
||||
Document,
|
||||
parse,
|
||||
parseAllDocuments,
|
||||
parseCST: parseCst.parse,
|
||||
parseDocument,
|
||||
scalarOptions: Document$1.scalarOptions,
|
||||
stringify
|
||||
};
|
||||
|
||||
exports.YAML = YAML;
|
||||
16
node_modules/yaml/dist/legacy-exports.js
generated
vendored
Normal file
16
node_modules/yaml/dist/legacy-exports.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
require('./PlainValue-ec8e588e.js');
|
||||
require('./resolveSeq-4a68b39b.js');
|
||||
var warnings = require('./warnings-39684f17.js');
|
||||
|
||||
|
||||
|
||||
exports.binary = warnings.binary;
|
||||
exports.floatTime = warnings.floatTime;
|
||||
exports.intTime = warnings.intTime;
|
||||
exports.omap = warnings.omap;
|
||||
exports.pairs = warnings.pairs;
|
||||
exports.set = warnings.set;
|
||||
exports.timestamp = warnings.timestamp;
|
||||
exports.warnFileDeprecation = warnings.warnFileDeprecation;
|
||||
1747
node_modules/yaml/dist/parse-cst.js
generated
vendored
Normal file
1747
node_modules/yaml/dist/parse-cst.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2115
node_modules/yaml/dist/resolveSeq-4a68b39b.js
generated
vendored
Normal file
2115
node_modules/yaml/dist/resolveSeq-4a68b39b.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
162
node_modules/yaml/dist/test-events.js
generated
vendored
Normal file
162
node_modules/yaml/dist/test-events.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
'use strict';
|
||||
|
||||
require('./PlainValue-ec8e588e.js');
|
||||
var parseCst = require('./parse-cst.js');
|
||||
require('./resolveSeq-4a68b39b.js');
|
||||
var Document$1 = require('./Document-2cf6b08c.js');
|
||||
require('./Schema-42e9705c.js');
|
||||
require('./warnings-39684f17.js');
|
||||
|
||||
function testEvents(src, options) {
|
||||
const opt = Object.assign({
|
||||
keepCstNodes: true,
|
||||
keepNodeTypes: true,
|
||||
version: '1.2'
|
||||
}, options);
|
||||
const docs = parseCst.parse(src).map(cstDoc => new Document$1.Document(opt).parse(cstDoc));
|
||||
const errDoc = docs.find(doc => doc.errors.length > 0);
|
||||
const error = errDoc ? errDoc.errors[0].message : null;
|
||||
const events = ['+STR'];
|
||||
|
||||
try {
|
||||
for (let i = 0; i < docs.length; ++i) {
|
||||
const doc = docs[i];
|
||||
let root = doc.contents;
|
||||
if (Array.isArray(root)) root = root[0];
|
||||
const [rootStart, rootEnd] = doc.range || [0, 0];
|
||||
let e = doc.errors[0] && doc.errors[0].source;
|
||||
if (e && e.type === 'SEQ_ITEM') e = e.node;
|
||||
if (e && (e.type === 'DOCUMENT' || e.range.start < rootStart)) throw new Error();
|
||||
let docStart = '+DOC';
|
||||
const pre = src.slice(0, rootStart);
|
||||
const explicitDoc = /---\s*$/.test(pre);
|
||||
if (explicitDoc) docStart += ' ---';else if (!doc.contents) continue;
|
||||
events.push(docStart);
|
||||
addEvents(events, doc, e, root);
|
||||
if (doc.contents && doc.contents.length > 1) throw new Error();
|
||||
let docEnd = '-DOC';
|
||||
|
||||
if (rootEnd) {
|
||||
const post = src.slice(rootEnd);
|
||||
if (/^\.\.\./.test(post)) docEnd += ' ...';
|
||||
}
|
||||
|
||||
events.push(docEnd);
|
||||
}
|
||||
} catch (e) {
|
||||
return {
|
||||
events,
|
||||
error: error || e
|
||||
};
|
||||
}
|
||||
|
||||
events.push('-STR');
|
||||
return {
|
||||
events,
|
||||
error
|
||||
};
|
||||
}
|
||||
|
||||
function addEvents(events, doc, e, node) {
|
||||
if (!node) {
|
||||
events.push('=VAL :');
|
||||
return;
|
||||
}
|
||||
|
||||
if (e && node.cstNode === e) throw new Error();
|
||||
let props = '';
|
||||
let anchor = doc.anchors.getName(node);
|
||||
|
||||
if (anchor) {
|
||||
if (/\d$/.test(anchor)) {
|
||||
const alt = anchor.replace(/\d$/, '');
|
||||
if (doc.anchors.getNode(alt)) anchor = alt;
|
||||
}
|
||||
|
||||
props = ` &${anchor}`;
|
||||
}
|
||||
|
||||
if (node.cstNode && node.cstNode.tag) {
|
||||
const {
|
||||
handle,
|
||||
suffix
|
||||
} = node.cstNode.tag;
|
||||
props += handle === '!' && !suffix ? ' <!>' : ` <${node.tag}>`;
|
||||
}
|
||||
|
||||
let scalar = null;
|
||||
|
||||
switch (node.type) {
|
||||
case 'ALIAS':
|
||||
{
|
||||
let alias = doc.anchors.getName(node.source);
|
||||
|
||||
if (/\d$/.test(alias)) {
|
||||
const alt = alias.replace(/\d$/, '');
|
||||
if (doc.anchors.getNode(alt)) alias = alt;
|
||||
}
|
||||
|
||||
events.push(`=ALI${props} *${alias}`);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'BLOCK_FOLDED':
|
||||
scalar = '>';
|
||||
break;
|
||||
|
||||
case 'BLOCK_LITERAL':
|
||||
scalar = '|';
|
||||
break;
|
||||
|
||||
case 'PLAIN':
|
||||
scalar = ':';
|
||||
break;
|
||||
|
||||
case 'QUOTE_DOUBLE':
|
||||
scalar = '"';
|
||||
break;
|
||||
|
||||
case 'QUOTE_SINGLE':
|
||||
scalar = "'";
|
||||
break;
|
||||
|
||||
case 'PAIR':
|
||||
events.push(`+MAP${props}`);
|
||||
addEvents(events, doc, e, node.key);
|
||||
addEvents(events, doc, e, node.value);
|
||||
events.push('-MAP');
|
||||
break;
|
||||
|
||||
case 'FLOW_SEQ':
|
||||
case 'SEQ':
|
||||
events.push(`+SEQ${props}`);
|
||||
node.items.forEach(item => {
|
||||
addEvents(events, doc, e, item);
|
||||
});
|
||||
events.push('-SEQ');
|
||||
break;
|
||||
|
||||
case 'FLOW_MAP':
|
||||
case 'MAP':
|
||||
events.push(`+MAP${props}`);
|
||||
node.items.forEach(({
|
||||
key,
|
||||
value
|
||||
}) => {
|
||||
addEvents(events, doc, e, key);
|
||||
addEvents(events, doc, e, value);
|
||||
});
|
||||
events.push('-MAP');
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error(`Unexpected node type ${node.type}`);
|
||||
}
|
||||
|
||||
if (scalar) {
|
||||
const value = node.cstNode.strValue.replace(/\\/g, '\\\\').replace(/\0/g, '\\0').replace(/\x07/g, '\\a').replace(/\x08/g, '\\b').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\v/g, '\\v').replace(/\f/g, '\\f').replace(/\r/g, '\\r').replace(/\x1b/g, '\\e');
|
||||
events.push(`=VAL${props} ${scalar}${value}`);
|
||||
}
|
||||
}
|
||||
|
||||
exports.testEvents = testEvents;
|
||||
23
node_modules/yaml/dist/types.js
generated
vendored
Normal file
23
node_modules/yaml/dist/types.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
require('./PlainValue-ec8e588e.js');
|
||||
var resolveSeq = require('./resolveSeq-4a68b39b.js');
|
||||
var Schema = require('./Schema-42e9705c.js');
|
||||
require('./warnings-39684f17.js');
|
||||
|
||||
|
||||
|
||||
exports.Alias = resolveSeq.Alias;
|
||||
exports.Collection = resolveSeq.Collection;
|
||||
exports.Merge = resolveSeq.Merge;
|
||||
exports.Node = resolveSeq.Node;
|
||||
exports.Pair = resolveSeq.Pair;
|
||||
exports.Scalar = resolveSeq.Scalar;
|
||||
exports.YAMLMap = resolveSeq.YAMLMap;
|
||||
exports.YAMLSeq = resolveSeq.YAMLSeq;
|
||||
exports.binaryOptions = resolveSeq.binaryOptions;
|
||||
exports.boolOptions = resolveSeq.boolOptions;
|
||||
exports.intOptions = resolveSeq.intOptions;
|
||||
exports.nullOptions = resolveSeq.nullOptions;
|
||||
exports.strOptions = resolveSeq.strOptions;
|
||||
exports.Schema = Schema.Schema;
|
||||
19
node_modules/yaml/dist/util.js
generated
vendored
Normal file
19
node_modules/yaml/dist/util.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var PlainValue = require('./PlainValue-ec8e588e.js');
|
||||
var resolveSeq = require('./resolveSeq-4a68b39b.js');
|
||||
|
||||
|
||||
|
||||
exports.Type = PlainValue.Type;
|
||||
exports.YAMLError = PlainValue.YAMLError;
|
||||
exports.YAMLReferenceError = PlainValue.YAMLReferenceError;
|
||||
exports.YAMLSemanticError = PlainValue.YAMLSemanticError;
|
||||
exports.YAMLSyntaxError = PlainValue.YAMLSyntaxError;
|
||||
exports.YAMLWarning = PlainValue.YAMLWarning;
|
||||
exports.findPair = resolveSeq.findPair;
|
||||
exports.parseMap = resolveSeq.resolveMap;
|
||||
exports.parseSeq = resolveSeq.resolveSeq;
|
||||
exports.stringifyNumber = resolveSeq.stringifyNumber;
|
||||
exports.stringifyString = resolveSeq.stringifyString;
|
||||
exports.toJSON = resolveSeq.toJSON;
|
||||
416
node_modules/yaml/dist/warnings-39684f17.js
generated
vendored
Normal file
416
node_modules/yaml/dist/warnings-39684f17.js
generated
vendored
Normal file
@@ -0,0 +1,416 @@
|
||||
'use strict';
|
||||
|
||||
var PlainValue = require('./PlainValue-ec8e588e.js');
|
||||
var resolveSeq = require('./resolveSeq-4a68b39b.js');
|
||||
|
||||
/* global atob, btoa, Buffer */
|
||||
const binary = {
|
||||
identify: value => value instanceof Uint8Array,
|
||||
// Buffer inherits from Uint8Array
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:binary',
|
||||
|
||||
/**
|
||||
* Returns a Buffer in node and an Uint8Array in browsers
|
||||
*
|
||||
* To use the resulting buffer as an image, you'll want to do something like:
|
||||
*
|
||||
* const blob = new Blob([buffer], { type: 'image/jpeg' })
|
||||
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
||||
*/
|
||||
resolve: (doc, node) => {
|
||||
const src = resolveSeq.resolveString(doc, node);
|
||||
|
||||
if (typeof Buffer === 'function') {
|
||||
return Buffer.from(src, 'base64');
|
||||
} else if (typeof atob === 'function') {
|
||||
// On IE 11, atob() can't handle newlines
|
||||
const str = atob(src.replace(/[\n\r]/g, ''));
|
||||
const buffer = new Uint8Array(str.length);
|
||||
|
||||
for (let i = 0; i < str.length; ++i) buffer[i] = str.charCodeAt(i);
|
||||
|
||||
return buffer;
|
||||
} else {
|
||||
const msg = 'This environment does not support reading binary tags; either Buffer or atob is required';
|
||||
doc.errors.push(new PlainValue.YAMLReferenceError(node, msg));
|
||||
return null;
|
||||
}
|
||||
},
|
||||
options: resolveSeq.binaryOptions,
|
||||
stringify: ({
|
||||
comment,
|
||||
type,
|
||||
value
|
||||
}, ctx, onComment, onChompKeep) => {
|
||||
let src;
|
||||
|
||||
if (typeof Buffer === 'function') {
|
||||
src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64');
|
||||
} else if (typeof btoa === 'function') {
|
||||
let s = '';
|
||||
|
||||
for (let i = 0; i < value.length; ++i) s += String.fromCharCode(value[i]);
|
||||
|
||||
src = btoa(s);
|
||||
} else {
|
||||
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
||||
}
|
||||
|
||||
if (!type) type = resolveSeq.binaryOptions.defaultType;
|
||||
|
||||
if (type === PlainValue.Type.QUOTE_DOUBLE) {
|
||||
value = src;
|
||||
} else {
|
||||
const {
|
||||
lineWidth
|
||||
} = resolveSeq.binaryOptions;
|
||||
const n = Math.ceil(src.length / lineWidth);
|
||||
const lines = new Array(n);
|
||||
|
||||
for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
|
||||
lines[i] = src.substr(o, lineWidth);
|
||||
}
|
||||
|
||||
value = lines.join(type === PlainValue.Type.BLOCK_LITERAL ? '\n' : ' ');
|
||||
}
|
||||
|
||||
return resolveSeq.stringifyString({
|
||||
comment,
|
||||
type,
|
||||
value
|
||||
}, ctx, onComment, onChompKeep);
|
||||
}
|
||||
};
|
||||
|
||||
function parsePairs(doc, cst) {
|
||||
const seq = resolveSeq.resolveSeq(doc, cst);
|
||||
|
||||
for (let i = 0; i < seq.items.length; ++i) {
|
||||
let item = seq.items[i];
|
||||
if (item instanceof resolveSeq.Pair) continue;else if (item instanceof resolveSeq.YAMLMap) {
|
||||
if (item.items.length > 1) {
|
||||
const msg = 'Each pair must have its own sequence indicator';
|
||||
throw new PlainValue.YAMLSemanticError(cst, msg);
|
||||
}
|
||||
|
||||
const pair = item.items[0] || new resolveSeq.Pair();
|
||||
if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}\n${pair.commentBefore}` : item.commentBefore;
|
||||
if (item.comment) pair.comment = pair.comment ? `${item.comment}\n${pair.comment}` : item.comment;
|
||||
item = pair;
|
||||
}
|
||||
seq.items[i] = item instanceof resolveSeq.Pair ? item : new resolveSeq.Pair(item);
|
||||
}
|
||||
|
||||
return seq;
|
||||
}
|
||||
function createPairs(schema, iterable, ctx) {
|
||||
const pairs = new resolveSeq.YAMLSeq(schema);
|
||||
pairs.tag = 'tag:yaml.org,2002:pairs';
|
||||
|
||||
for (const it of iterable) {
|
||||
let key, value;
|
||||
|
||||
if (Array.isArray(it)) {
|
||||
if (it.length === 2) {
|
||||
key = it[0];
|
||||
value = it[1];
|
||||
} else throw new TypeError(`Expected [key, value] tuple: ${it}`);
|
||||
} else if (it && it instanceof Object) {
|
||||
const keys = Object.keys(it);
|
||||
|
||||
if (keys.length === 1) {
|
||||
key = keys[0];
|
||||
value = it[key];
|
||||
} else throw new TypeError(`Expected { key: value } tuple: ${it}`);
|
||||
} else {
|
||||
key = it;
|
||||
}
|
||||
|
||||
const pair = schema.createPair(key, value, ctx);
|
||||
pairs.items.push(pair);
|
||||
}
|
||||
|
||||
return pairs;
|
||||
}
|
||||
const pairs = {
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:pairs',
|
||||
resolve: parsePairs,
|
||||
createNode: createPairs
|
||||
};
|
||||
|
||||
class YAMLOMap extends resolveSeq.YAMLSeq {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
PlainValue._defineProperty(this, "add", resolveSeq.YAMLMap.prototype.add.bind(this));
|
||||
|
||||
PlainValue._defineProperty(this, "delete", resolveSeq.YAMLMap.prototype.delete.bind(this));
|
||||
|
||||
PlainValue._defineProperty(this, "get", resolveSeq.YAMLMap.prototype.get.bind(this));
|
||||
|
||||
PlainValue._defineProperty(this, "has", resolveSeq.YAMLMap.prototype.has.bind(this));
|
||||
|
||||
PlainValue._defineProperty(this, "set", resolveSeq.YAMLMap.prototype.set.bind(this));
|
||||
|
||||
this.tag = YAMLOMap.tag;
|
||||
}
|
||||
|
||||
toJSON(_, ctx) {
|
||||
const map = new Map();
|
||||
if (ctx && ctx.onCreate) ctx.onCreate(map);
|
||||
|
||||
for (const pair of this.items) {
|
||||
let key, value;
|
||||
|
||||
if (pair instanceof resolveSeq.Pair) {
|
||||
key = resolveSeq.toJSON(pair.key, '', ctx);
|
||||
value = resolveSeq.toJSON(pair.value, key, ctx);
|
||||
} else {
|
||||
key = resolveSeq.toJSON(pair, '', ctx);
|
||||
}
|
||||
|
||||
if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys');
|
||||
map.set(key, value);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PlainValue._defineProperty(YAMLOMap, "tag", 'tag:yaml.org,2002:omap');
|
||||
|
||||
function parseOMap(doc, cst) {
|
||||
const pairs = parsePairs(doc, cst);
|
||||
const seenKeys = [];
|
||||
|
||||
for (const {
|
||||
key
|
||||
} of pairs.items) {
|
||||
if (key instanceof resolveSeq.Scalar) {
|
||||
if (seenKeys.includes(key.value)) {
|
||||
const msg = 'Ordered maps must not include duplicate keys';
|
||||
throw new PlainValue.YAMLSemanticError(cst, msg);
|
||||
} else {
|
||||
seenKeys.push(key.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Object.assign(new YAMLOMap(), pairs);
|
||||
}
|
||||
|
||||
function createOMap(schema, iterable, ctx) {
|
||||
const pairs = createPairs(schema, iterable, ctx);
|
||||
const omap = new YAMLOMap();
|
||||
omap.items = pairs.items;
|
||||
return omap;
|
||||
}
|
||||
|
||||
const omap = {
|
||||
identify: value => value instanceof Map,
|
||||
nodeClass: YAMLOMap,
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:omap',
|
||||
resolve: parseOMap,
|
||||
createNode: createOMap
|
||||
};
|
||||
|
||||
class YAMLSet extends resolveSeq.YAMLMap {
|
||||
constructor() {
|
||||
super();
|
||||
this.tag = YAMLSet.tag;
|
||||
}
|
||||
|
||||
add(key) {
|
||||
const pair = key instanceof resolveSeq.Pair ? key : new resolveSeq.Pair(key);
|
||||
const prev = resolveSeq.findPair(this.items, pair.key);
|
||||
if (!prev) this.items.push(pair);
|
||||
}
|
||||
|
||||
get(key, keepPair) {
|
||||
const pair = resolveSeq.findPair(this.items, key);
|
||||
return !keepPair && pair instanceof resolveSeq.Pair ? pair.key instanceof resolveSeq.Scalar ? pair.key.value : pair.key : pair;
|
||||
}
|
||||
|
||||
set(key, value) {
|
||||
if (typeof value !== 'boolean') throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
|
||||
const prev = resolveSeq.findPair(this.items, key);
|
||||
|
||||
if (prev && !value) {
|
||||
this.items.splice(this.items.indexOf(prev), 1);
|
||||
} else if (!prev && value) {
|
||||
this.items.push(new resolveSeq.Pair(key));
|
||||
}
|
||||
}
|
||||
|
||||
toJSON(_, ctx) {
|
||||
return super.toJSON(_, ctx, Set);
|
||||
}
|
||||
|
||||
toString(ctx, onComment, onChompKeep) {
|
||||
if (!ctx) return JSON.stringify(this);
|
||||
if (this.hasAllNullValues()) return super.toString(ctx, onComment, onChompKeep);else throw new Error('Set items must all have null values');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PlainValue._defineProperty(YAMLSet, "tag", 'tag:yaml.org,2002:set');
|
||||
|
||||
function parseSet(doc, cst) {
|
||||
const map = resolveSeq.resolveMap(doc, cst);
|
||||
if (!map.hasAllNullValues()) throw new PlainValue.YAMLSemanticError(cst, 'Set items must all have null values');
|
||||
return Object.assign(new YAMLSet(), map);
|
||||
}
|
||||
|
||||
function createSet(schema, iterable, ctx) {
|
||||
const set = new YAMLSet();
|
||||
|
||||
for (const value of iterable) set.items.push(schema.createPair(value, null, ctx));
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
const set = {
|
||||
identify: value => value instanceof Set,
|
||||
nodeClass: YAMLSet,
|
||||
default: false,
|
||||
tag: 'tag:yaml.org,2002:set',
|
||||
resolve: parseSet,
|
||||
createNode: createSet
|
||||
};
|
||||
|
||||
const parseSexagesimal = (sign, parts) => {
|
||||
const n = parts.split(':').reduce((n, p) => n * 60 + Number(p), 0);
|
||||
return sign === '-' ? -n : n;
|
||||
}; // hhhh:mm:ss.sss
|
||||
|
||||
|
||||
const stringifySexagesimal = ({
|
||||
value
|
||||
}) => {
|
||||
if (isNaN(value) || !isFinite(value)) return resolveSeq.stringifyNumber(value);
|
||||
let sign = '';
|
||||
|
||||
if (value < 0) {
|
||||
sign = '-';
|
||||
value = Math.abs(value);
|
||||
}
|
||||
|
||||
const parts = [value % 60]; // seconds, including ms
|
||||
|
||||
if (value < 60) {
|
||||
parts.unshift(0); // at least one : is required
|
||||
} else {
|
||||
value = Math.round((value - parts[0]) / 60);
|
||||
parts.unshift(value % 60); // minutes
|
||||
|
||||
if (value >= 60) {
|
||||
value = Math.round((value - parts[0]) / 60);
|
||||
parts.unshift(value); // hours
|
||||
}
|
||||
}
|
||||
|
||||
return sign + parts.map(n => n < 10 ? '0' + String(n) : String(n)).join(':').replace(/000000\d*$/, '') // % 60 may introduce error
|
||||
;
|
||||
};
|
||||
|
||||
const intTime = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:int',
|
||||
format: 'TIME',
|
||||
test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/,
|
||||
resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, '')),
|
||||
stringify: stringifySexagesimal
|
||||
};
|
||||
const floatTime = {
|
||||
identify: value => typeof value === 'number',
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:float',
|
||||
format: 'TIME',
|
||||
test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/,
|
||||
resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, '')),
|
||||
stringify: stringifySexagesimal
|
||||
};
|
||||
const timestamp = {
|
||||
identify: value => value instanceof Date,
|
||||
default: true,
|
||||
tag: 'tag:yaml.org,2002:timestamp',
|
||||
// If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
|
||||
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
||||
// assumed to be 00:00:00Z (start of day, UTC).
|
||||
test: RegExp('^(?:' + '([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd
|
||||
'(?:(?:t|T|[ \\t]+)' + // t | T | whitespace
|
||||
'([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?
|
||||
'(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30
|
||||
')?' + ')$'),
|
||||
resolve: (str, year, month, day, hour, minute, second, millisec, tz) => {
|
||||
if (millisec) millisec = (millisec + '00').substr(1, 3);
|
||||
let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0);
|
||||
|
||||
if (tz && tz !== 'Z') {
|
||||
let d = parseSexagesimal(tz[0], tz.slice(1));
|
||||
if (Math.abs(d) < 30) d *= 60;
|
||||
date -= 60000 * d;
|
||||
}
|
||||
|
||||
return new Date(date);
|
||||
},
|
||||
stringify: ({
|
||||
value
|
||||
}) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '')
|
||||
};
|
||||
|
||||
/* global console, process, YAML_SILENCE_DEPRECATION_WARNINGS, YAML_SILENCE_WARNINGS */
|
||||
function shouldWarn(deprecation) {
|
||||
const env = typeof process !== 'undefined' && process.env || {};
|
||||
|
||||
if (deprecation) {
|
||||
if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== 'undefined') return !YAML_SILENCE_DEPRECATION_WARNINGS;
|
||||
return !env.YAML_SILENCE_DEPRECATION_WARNINGS;
|
||||
}
|
||||
|
||||
if (typeof YAML_SILENCE_WARNINGS !== 'undefined') return !YAML_SILENCE_WARNINGS;
|
||||
return !env.YAML_SILENCE_WARNINGS;
|
||||
}
|
||||
|
||||
function warn(warning, type) {
|
||||
if (shouldWarn(false)) {
|
||||
const emit = typeof process !== 'undefined' && process.emitWarning; // This will throw in Jest if `warning` is an Error instance due to
|
||||
// https://github.com/facebook/jest/issues/2549
|
||||
|
||||
if (emit) emit(warning, type);else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(type ? `${type}: ${warning}` : warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
function warnFileDeprecation(filename) {
|
||||
if (shouldWarn(true)) {
|
||||
const path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/');
|
||||
warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, 'DeprecationWarning');
|
||||
}
|
||||
}
|
||||
const warned = {};
|
||||
function warnOptionDeprecation(name, alternative) {
|
||||
if (!warned[name] && shouldWarn(true)) {
|
||||
warned[name] = true;
|
||||
let msg = `The option '${name}' will be removed in a future release`;
|
||||
msg += alternative ? `, use '${alternative}' instead.` : '.';
|
||||
warn(msg, 'DeprecationWarning');
|
||||
}
|
||||
}
|
||||
|
||||
exports.binary = binary;
|
||||
exports.floatTime = floatTime;
|
||||
exports.intTime = intTime;
|
||||
exports.omap = omap;
|
||||
exports.pairs = pairs;
|
||||
exports.set = set;
|
||||
exports.timestamp = timestamp;
|
||||
exports.warn = warn;
|
||||
exports.warnFileDeprecation = warnFileDeprecation;
|
||||
exports.warnOptionDeprecation = warnOptionDeprecation;
|
||||
372
node_modules/yaml/index.d.ts
generated
vendored
Normal file
372
node_modules/yaml/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,372 @@
|
||||
import { CST } from './parse-cst'
|
||||
import {
|
||||
AST,
|
||||
Alias,
|
||||
Collection,
|
||||
Merge,
|
||||
Node,
|
||||
Scalar,
|
||||
Schema,
|
||||
YAMLMap,
|
||||
YAMLSeq
|
||||
} from './types'
|
||||
import { Type, YAMLError, YAMLWarning } from './util'
|
||||
|
||||
export { AST, CST }
|
||||
export { default as parseCST } from './parse-cst'
|
||||
|
||||
/**
|
||||
* `yaml` defines document-specific options in three places: as an argument of
|
||||
* parse, create and stringify calls, in the values of `YAML.defaultOptions`,
|
||||
* and in the version-dependent `YAML.Document.defaults` object. Values set in
|
||||
* `YAML.defaultOptions` override version-dependent defaults, and argument
|
||||
* options override both.
|
||||
*/
|
||||
export const defaultOptions: Options
|
||||
|
||||
export interface Options extends Schema.Options {
|
||||
/**
|
||||
* Default prefix for anchors.
|
||||
*
|
||||
* Default: `'a'`, resulting in anchors `a1`, `a2`, etc.
|
||||
*/
|
||||
anchorPrefix?: string
|
||||
/**
|
||||
* The number of spaces to use when indenting code.
|
||||
*
|
||||
* Default: `2`
|
||||
*/
|
||||
indent?: number
|
||||
/**
|
||||
* Whether block sequences should be indented.
|
||||
*
|
||||
* Default: `true`
|
||||
*/
|
||||
indentSeq?: boolean
|
||||
/**
|
||||
* Allow non-JSON JavaScript objects to remain in the `toJSON` output.
|
||||
* Relevant with the YAML 1.1 `!!timestamp` and `!!binary` tags as well as BigInts.
|
||||
*
|
||||
* Default: `true`
|
||||
*/
|
||||
keepBlobsInJSON?: boolean
|
||||
/**
|
||||
* Include references in the AST to each node's corresponding CST node.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
keepCstNodes?: boolean
|
||||
/**
|
||||
* Store the original node type when parsing documents.
|
||||
*
|
||||
* Default: `true`
|
||||
*/
|
||||
keepNodeTypes?: boolean
|
||||
/**
|
||||
* When outputting JS, use Map rather than Object to represent mappings.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
mapAsMap?: boolean
|
||||
/**
|
||||
* Prevent exponential entity expansion attacks by limiting data aliasing count;
|
||||
* set to `-1` to disable checks; `0` disallows all alias nodes.
|
||||
*
|
||||
* Default: `100`
|
||||
*/
|
||||
maxAliasCount?: number
|
||||
/**
|
||||
* Include line position & node type directly in errors; drop their verbose source and context.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
prettyErrors?: boolean
|
||||
/**
|
||||
* When stringifying, require keys to be scalars and to use implicit rather than explicit notation.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
simpleKeys?: boolean
|
||||
/**
|
||||
* The YAML version used by documents without a `%YAML` directive.
|
||||
*
|
||||
* Default: `"1.2"`
|
||||
*/
|
||||
version?: '1.0' | '1.1' | '1.2'
|
||||
}
|
||||
|
||||
/**
|
||||
* Some customization options are availabe to control the parsing and
|
||||
* stringification of scalars. Note that these values are used by all documents.
|
||||
*/
|
||||
export const scalarOptions: {
|
||||
binary: scalarOptions.Binary
|
||||
bool: scalarOptions.Bool
|
||||
int: scalarOptions.Int
|
||||
null: scalarOptions.Null
|
||||
str: scalarOptions.Str
|
||||
}
|
||||
export namespace scalarOptions {
|
||||
interface Binary {
|
||||
/**
|
||||
* The type of string literal used to stringify `!!binary` values.
|
||||
*
|
||||
* Default: `'BLOCK_LITERAL'`
|
||||
*/
|
||||
defaultType: Scalar.Type
|
||||
/**
|
||||
* Maximum line width for `!!binary`.
|
||||
*
|
||||
* Default: `76`
|
||||
*/
|
||||
lineWidth: number
|
||||
}
|
||||
|
||||
interface Bool {
|
||||
/**
|
||||
* String representation for `true`. With the core schema, use `'true' | 'True' | 'TRUE'`.
|
||||
*
|
||||
* Default: `'true'`
|
||||
*/
|
||||
trueStr: string
|
||||
/**
|
||||
* String representation for `false`. With the core schema, use `'false' | 'False' | 'FALSE'`.
|
||||
*
|
||||
* Default: `'false'`
|
||||
*/
|
||||
falseStr: string
|
||||
}
|
||||
|
||||
interface Int {
|
||||
/**
|
||||
* Whether integers should be parsed into BigInt values.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
asBigInt: false
|
||||
}
|
||||
|
||||
interface Null {
|
||||
/**
|
||||
* String representation for `null`. With the core schema, use `'null' | 'Null' | 'NULL' | '~' | ''`.
|
||||
*
|
||||
* Default: `'null'`
|
||||
*/
|
||||
nullStr: string
|
||||
}
|
||||
|
||||
interface Str {
|
||||
/**
|
||||
* The default type of string literal used to stringify values
|
||||
*
|
||||
* Default: `'PLAIN'`
|
||||
*/
|
||||
defaultType: Scalar.Type
|
||||
doubleQuoted: {
|
||||
/**
|
||||
* Whether to restrict double-quoted strings to use JSON-compatible syntax.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
jsonEncoding: boolean
|
||||
/**
|
||||
* Minimum length to use multiple lines to represent the value.
|
||||
*
|
||||
* Default: `40`
|
||||
*/
|
||||
minMultiLineLength: number
|
||||
}
|
||||
fold: {
|
||||
/**
|
||||
* Maximum line width (set to `0` to disable folding).
|
||||
*
|
||||
* Default: `80`
|
||||
*/
|
||||
lineWidth: number
|
||||
/**
|
||||
* Minimum width for highly-indented content.
|
||||
*
|
||||
* Default: `20`
|
||||
*/
|
||||
minContentWidth: number
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Document extends Collection {
|
||||
cstNode?: CST.Document
|
||||
constructor(options?: Options)
|
||||
tag: never
|
||||
directivesEndMarker?: boolean
|
||||
type: Type.DOCUMENT
|
||||
/**
|
||||
* Anchors associated with the document's nodes;
|
||||
* also provides alias & merge node creators.
|
||||
*/
|
||||
anchors: Document.Anchors
|
||||
/** The document contents. */
|
||||
contents: any
|
||||
/** Errors encountered during parsing. */
|
||||
errors: YAMLError[]
|
||||
/**
|
||||
* The schema used with the document. Use `setSchema()` to change or
|
||||
* initialise.
|
||||
*/
|
||||
schema?: Schema
|
||||
/**
|
||||
* Array of prefixes; each will have a string `handle` that
|
||||
* starts and ends with `!` and a string `prefix` that the handle will be replaced by.
|
||||
*/
|
||||
tagPrefixes: Document.TagPrefix[]
|
||||
/**
|
||||
* The parsed version of the source document;
|
||||
* if true-ish, stringified output will include a `%YAML` directive.
|
||||
*/
|
||||
version?: string
|
||||
/** Warnings encountered during parsing. */
|
||||
warnings: YAMLWarning[]
|
||||
/**
|
||||
* List the tags used in the document that are not in the default
|
||||
* `tag:yaml.org,2002:` namespace.
|
||||
*/
|
||||
listNonDefaultTags(): string[]
|
||||
/** Parse a CST into this document */
|
||||
parse(cst: CST.Document): this
|
||||
/**
|
||||
* When a document is created with `new YAML.Document()`, the schema object is
|
||||
* not set as it may be influenced by parsed directives; call this with no
|
||||
* arguments to set it manually, or with arguments to change the schema used
|
||||
* by the document.
|
||||
**/
|
||||
setSchema(
|
||||
id?: Options['version'] | Schema.Name,
|
||||
customTags?: (Schema.TagId | Schema.Tag)[]
|
||||
): void
|
||||
/** Set `handle` as a shorthand string for the `prefix` tag namespace. */
|
||||
setTagPrefix(handle: string, prefix: string): void
|
||||
/**
|
||||
* A plain JavaScript representation of the document `contents`.
|
||||
*
|
||||
* @param arg Used by `JSON.stringify` to indicate the array index or property
|
||||
* name. If its value is a `string` and the document `contents` has a scalar
|
||||
* value, the `keepBlobsInJSON` option has no effect.
|
||||
* @param onAnchor If defined, called with the resolved `value` and reference
|
||||
* `count` for each anchor in the document.
|
||||
* */
|
||||
toJSON(arg?: string, onAnchor?: (value: any, count: number) => void): any
|
||||
/** A YAML representation of the document. */
|
||||
toString(): string
|
||||
}
|
||||
|
||||
export namespace Document {
|
||||
interface Parsed extends Document {
|
||||
contents: Node | null
|
||||
/** The schema used with the document. */
|
||||
schema: Schema
|
||||
}
|
||||
|
||||
interface Anchors {
|
||||
/**
|
||||
* Create a new `Alias` node, adding the required anchor for `node`.
|
||||
* If `name` is empty, a new anchor name will be generated.
|
||||
*/
|
||||
createAlias(node: Node, name?: string): Alias
|
||||
/**
|
||||
* Create a new `Merge` node with the given source nodes.
|
||||
* Non-`Alias` sources will be automatically wrapped.
|
||||
*/
|
||||
createMergePair(...nodes: Node[]): Merge
|
||||
/** The anchor name associated with `node`, if set. */
|
||||
getName(node: Node): undefined | string
|
||||
/** List of all defined anchor names. */
|
||||
getNames(): string[]
|
||||
/** The node associated with the anchor `name`, if set. */
|
||||
getNode(name: string): undefined | Node
|
||||
/**
|
||||
* Find an available anchor name with the given `prefix` and a
|
||||
* numerical suffix.
|
||||
*/
|
||||
newName(prefix: string): string
|
||||
/**
|
||||
* Associate an anchor with `node`. If `name` is empty, a new name will be generated.
|
||||
* To remove an anchor, use `setAnchor(null, name)`.
|
||||
*/
|
||||
setAnchor(node: Node | null, name?: string): void | string
|
||||
}
|
||||
|
||||
interface TagPrefix {
|
||||
handle: string
|
||||
prefix: string
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively turns objects into collections. Generic objects as well as `Map`
|
||||
* and its descendants become mappings, while arrays and other iterable objects
|
||||
* result in sequences.
|
||||
*
|
||||
* The primary purpose of this function is to enable attaching comments or other
|
||||
* metadata to a value, or to otherwise exert more fine-grained control over the
|
||||
* stringified output. To that end, you'll need to assign its return value to
|
||||
* the `contents` of a Document (or somewhere within said contents), as the
|
||||
* document's schema is required for YAML string output.
|
||||
*
|
||||
* @param wrapScalars If undefined or `true`, also wraps plain values in
|
||||
* `Scalar` objects; if `false` and `value` is not an object, it will be
|
||||
* returned directly.
|
||||
* @param tag Use to specify the collection type, e.g. `"!!omap"`. Note that
|
||||
* this requires the corresponding tag to be available based on the default
|
||||
* options. To use a specific document's schema, use `doc.schema.createNode`.
|
||||
*/
|
||||
export function createNode(
|
||||
value: any,
|
||||
wrapScalars?: true,
|
||||
tag?: string
|
||||
): YAMLMap | YAMLSeq | Scalar
|
||||
|
||||
/**
|
||||
* YAML.createNode recursively turns objects into Map and arrays to Seq collections.
|
||||
* Its primary use is to enable attaching comments or other metadata to a value,
|
||||
* or to otherwise exert more fine-grained control over the stringified output.
|
||||
*
|
||||
* Doesn't wrap plain values in Scalar objects.
|
||||
*/
|
||||
export function createNode(
|
||||
value: any,
|
||||
wrapScalars: false,
|
||||
tag?: string
|
||||
): YAMLMap | YAMLSeq | string | number | boolean | null
|
||||
|
||||
/**
|
||||
* Parse an input string into a single YAML.Document.
|
||||
*/
|
||||
export function parseDocument(str: string, options?: Options): Document.Parsed
|
||||
|
||||
/**
|
||||
* Parse the input as a stream of YAML documents.
|
||||
*
|
||||
* Documents should be separated from each other by `...` or `---` marker lines.
|
||||
*/
|
||||
export function parseAllDocuments(
|
||||
str: string,
|
||||
options?: Options
|
||||
): Document.Parsed[]
|
||||
|
||||
/**
|
||||
* Parse an input string into JavaScript.
|
||||
*
|
||||
* Only supports input consisting of a single YAML document; for multi-document
|
||||
* support you should use `YAML.parseAllDocuments`. May throw on error, and may
|
||||
* log warnings using `console.warn`.
|
||||
*
|
||||
* @param str A string with YAML formatting.
|
||||
* @returns The value will match the type of the root value of the parsed YAML
|
||||
* document, so Maps become objects, Sequences arrays, and scalars result in
|
||||
* nulls, booleans, numbers and strings.
|
||||
*/
|
||||
export function parse(str: string, options?: Options): any
|
||||
|
||||
/**
|
||||
* @returns Will always include \n as the last character, as is expected of YAML documents.
|
||||
*/
|
||||
export function stringify(value: any, options?: Options): string
|
||||
1
node_modules/yaml/index.js
generated
vendored
Normal file
1
node_modules/yaml/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./dist').YAML
|
||||
2
node_modules/yaml/map.js
generated
vendored
Normal file
2
node_modules/yaml/map.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = require('./dist/types').YAMLMap
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
106
node_modules/yaml/package.json
generated
vendored
Normal file
106
node_modules/yaml/package.json
generated
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"name": "yaml",
|
||||
"version": "1.10.0",
|
||||
"license": "ISC",
|
||||
"author": "Eemeli Aro <eemeli@gmail.com>",
|
||||
"repository": "github:eemeli/yaml",
|
||||
"description": "JavaScript parser and stringifier for YAML",
|
||||
"keywords": [
|
||||
"YAML",
|
||||
"parser",
|
||||
"stringifier"
|
||||
],
|
||||
"homepage": "https://eemeli.org/yaml/",
|
||||
"files": [
|
||||
"browser/",
|
||||
"dist/",
|
||||
"types/",
|
||||
"*.d.ts",
|
||||
"*.js",
|
||||
"*.mjs",
|
||||
"!*config.js"
|
||||
],
|
||||
"type": "commonjs",
|
||||
"main": "./index.js",
|
||||
"browser": {
|
||||
"./index.js": "./browser/index.js",
|
||||
"./map.js": "./browser/map.js",
|
||||
"./pair.js": "./browser/pair.js",
|
||||
"./parse-cst.js": "./browser/parse-cst.js",
|
||||
"./scalar.js": "./browser/scalar.js",
|
||||
"./schema.js": "./browser/schema.js",
|
||||
"./seq.js": "./browser/seq.js",
|
||||
"./types.js": "./browser/types.js",
|
||||
"./types.mjs": "./browser/types.js",
|
||||
"./types/binary.js": "./browser/types/binary.js",
|
||||
"./types/omap.js": "./browser/types/omap.js",
|
||||
"./types/pairs.js": "./browser/types/pairs.js",
|
||||
"./types/set.js": "./browser/types/set.js",
|
||||
"./types/timestamp.js": "./browser/types/timestamp.js",
|
||||
"./util.js": "./browser/util.js",
|
||||
"./util.mjs": "./browser/util.js"
|
||||
},
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./parse-cst": "./parse-cst.js",
|
||||
"./types": [
|
||||
{
|
||||
"import": "./types.mjs"
|
||||
},
|
||||
"./types.js"
|
||||
],
|
||||
"./util": [
|
||||
{
|
||||
"import": "./util.mjs"
|
||||
},
|
||||
"./util.js"
|
||||
],
|
||||
"./": "./"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:node && npm run build:browser",
|
||||
"build:browser": "rollup -c rollup.browser-config.js",
|
||||
"build:node": "rollup -c rollup.node-config.js",
|
||||
"clean": "git clean -fdxe node_modules",
|
||||
"lint": "eslint src/",
|
||||
"prettier": "prettier --write .",
|
||||
"start": "cross-env TRACE_LEVEL=log npm run build:node && node -i -e 'YAML=require(\".\")'",
|
||||
"test": "jest",
|
||||
"test:dist": "npm run build:node && jest",
|
||||
"test:types": "tsc --lib ES2017 --noEmit tests/typings.ts",
|
||||
"docs:install": "cd docs-slate && bundle install",
|
||||
"docs:deploy": "cd docs-slate && ./deploy.sh",
|
||||
"docs": "cd docs-slate && bundle exec middleman server",
|
||||
"preversion": "npm test && npm run build",
|
||||
"prepublishOnly": "npm run clean && npm test && npm run build"
|
||||
},
|
||||
"browserslist": "> 0.5%, not dead",
|
||||
"prettier": {
|
||||
"arrowParens": "avoid",
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.6",
|
||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||
"@babel/preset-env": "^7.9.6",
|
||||
"@rollup/plugin-babel": "^5.0.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-jest": "^26.0.1",
|
||||
"babel-plugin-trace": "^1.1.0",
|
||||
"common-tags": "^1.8.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-prettier": "^3.1.3",
|
||||
"fast-check": "^1.24.2",
|
||||
"jest": "^26.0.1",
|
||||
"prettier": "^2.0.5",
|
||||
"rollup": "^2.10.2",
|
||||
"typescript": "^3.9.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
}
|
||||
2
node_modules/yaml/pair.js
generated
vendored
Normal file
2
node_modules/yaml/pair.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = require('./dist/types').Pair
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
187
node_modules/yaml/parse-cst.d.ts
generated
vendored
Normal file
187
node_modules/yaml/parse-cst.d.ts
generated
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
import { Type, YAMLSyntaxError } from './util'
|
||||
|
||||
export default function parseCST(str: string): ParsedCST
|
||||
|
||||
export interface ParsedCST extends Array<CST.Document> {
|
||||
setOrigRanges(): boolean
|
||||
}
|
||||
|
||||
export namespace CST {
|
||||
interface Range {
|
||||
start: number
|
||||
end: number
|
||||
origStart?: number
|
||||
origEnd?: number
|
||||
isEmpty(): boolean
|
||||
}
|
||||
|
||||
interface ParseContext {
|
||||
/** Node starts at beginning of line */
|
||||
atLineStart: boolean
|
||||
/** true if currently in a collection context */
|
||||
inCollection: boolean
|
||||
/** true if currently in a flow context */
|
||||
inFlow: boolean
|
||||
/** Current level of indentation */
|
||||
indent: number
|
||||
/** Start of the current line */
|
||||
lineStart: number
|
||||
/** The parent of the node */
|
||||
parent: Node
|
||||
/** Source of the YAML document */
|
||||
src: string
|
||||
}
|
||||
|
||||
interface Node {
|
||||
context: ParseContext | null
|
||||
/** if not null, indicates a parser failure */
|
||||
error: YAMLSyntaxError | null
|
||||
/** span of context.src parsed into this node */
|
||||
range: Range | null
|
||||
valueRange: Range | null
|
||||
/** anchors, tags and comments */
|
||||
props: Range[]
|
||||
/** specific node type */
|
||||
type: Type
|
||||
/** if non-null, overrides source value */
|
||||
value: string | null
|
||||
|
||||
readonly anchor: string | null
|
||||
readonly comment: string | null
|
||||
readonly hasComment: boolean
|
||||
readonly hasProps: boolean
|
||||
readonly jsonLike: boolean
|
||||
readonly rawValue: string | null
|
||||
readonly tag:
|
||||
| null
|
||||
| { verbatim: string }
|
||||
| { handle: string; suffix: string }
|
||||
readonly valueRangeContainsNewline: boolean
|
||||
}
|
||||
|
||||
interface Alias extends Node {
|
||||
type: Type.ALIAS
|
||||
/** contain the anchor without the * prefix */
|
||||
readonly rawValue: string
|
||||
}
|
||||
|
||||
type Scalar = BlockValue | PlainValue | QuoteValue
|
||||
|
||||
interface BlockValue extends Node {
|
||||
type: Type.BLOCK_FOLDED | Type.BLOCK_LITERAL
|
||||
chomping: 'CLIP' | 'KEEP' | 'STRIP'
|
||||
blockIndent: number | null
|
||||
header: Range
|
||||
readonly strValue: string | null
|
||||
}
|
||||
|
||||
interface BlockFolded extends BlockValue {
|
||||
type: Type.BLOCK_FOLDED
|
||||
}
|
||||
|
||||
interface BlockLiteral extends BlockValue {
|
||||
type: Type.BLOCK_LITERAL
|
||||
}
|
||||
|
||||
interface PlainValue extends Node {
|
||||
type: Type.PLAIN
|
||||
readonly strValue: string | null
|
||||
}
|
||||
|
||||
interface QuoteValue extends Node {
|
||||
type: Type.QUOTE_DOUBLE | Type.QUOTE_SINGLE
|
||||
readonly strValue:
|
||||
| null
|
||||
| string
|
||||
| { str: string; errors: YAMLSyntaxError[] }
|
||||
}
|
||||
|
||||
interface QuoteDouble extends QuoteValue {
|
||||
type: Type.QUOTE_DOUBLE
|
||||
}
|
||||
|
||||
interface QuoteSingle extends QuoteValue {
|
||||
type: Type.QUOTE_SINGLE
|
||||
}
|
||||
|
||||
interface Comment extends Node {
|
||||
type: Type.COMMENT
|
||||
readonly anchor: null
|
||||
readonly comment: string
|
||||
readonly rawValue: null
|
||||
readonly tag: null
|
||||
}
|
||||
|
||||
interface BlankLine extends Node {
|
||||
type: Type.BLANK_LINE
|
||||
}
|
||||
|
||||
interface MapItem extends Node {
|
||||
type: Type.MAP_KEY | Type.MAP_VALUE
|
||||
node: ContentNode | null
|
||||
}
|
||||
|
||||
interface MapKey extends MapItem {
|
||||
type: Type.MAP_KEY
|
||||
}
|
||||
|
||||
interface MapValue extends MapItem {
|
||||
type: Type.MAP_VALUE
|
||||
}
|
||||
|
||||
interface Map extends Node {
|
||||
type: Type.MAP
|
||||
/** implicit keys are not wrapped */
|
||||
items: Array<BlankLine | Comment | Alias | Scalar | MapItem>
|
||||
}
|
||||
|
||||
interface SeqItem extends Node {
|
||||
type: Type.SEQ_ITEM
|
||||
node: ContentNode | null
|
||||
}
|
||||
|
||||
interface Seq extends Node {
|
||||
type: Type.SEQ
|
||||
items: Array<BlankLine | Comment | SeqItem>
|
||||
}
|
||||
|
||||
interface FlowChar {
|
||||
char: '{' | '}' | '[' | ']' | ',' | '?' | ':'
|
||||
offset: number
|
||||
origOffset?: number
|
||||
}
|
||||
|
||||
interface FlowCollection extends Node {
|
||||
type: Type.FLOW_MAP | Type.FLOW_SEQ
|
||||
items: Array<
|
||||
FlowChar | BlankLine | Comment | Alias | Scalar | FlowCollection
|
||||
>
|
||||
}
|
||||
|
||||
interface FlowMap extends FlowCollection {
|
||||
type: Type.FLOW_MAP
|
||||
}
|
||||
|
||||
interface FlowSeq extends FlowCollection {
|
||||
type: Type.FLOW_SEQ
|
||||
}
|
||||
|
||||
type ContentNode = Alias | Scalar | Map | Seq | FlowCollection
|
||||
|
||||
interface Directive extends Node {
|
||||
type: Type.DIRECTIVE
|
||||
name: string
|
||||
readonly anchor: null
|
||||
readonly parameters: string[]
|
||||
readonly tag: null
|
||||
}
|
||||
|
||||
interface Document extends Node {
|
||||
type: Type.DOCUMENT
|
||||
directives: Array<BlankLine | Comment | Directive>
|
||||
contents: Array<BlankLine | Comment | ContentNode>
|
||||
readonly anchor: null
|
||||
readonly comment: null
|
||||
readonly tag: null
|
||||
}
|
||||
}
|
||||
1
node_modules/yaml/parse-cst.js
generated
vendored
Normal file
1
node_modules/yaml/parse-cst.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('./dist/parse-cst').parse
|
||||
2
node_modules/yaml/scalar.js
generated
vendored
Normal file
2
node_modules/yaml/scalar.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = require('./dist/types').Scalar
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
9
node_modules/yaml/schema.js
generated
vendored
Normal file
9
node_modules/yaml/schema.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
const types = require('./dist/types')
|
||||
const util = require('./dist/util')
|
||||
|
||||
module.exports = types.Schema
|
||||
module.exports.nullOptions = types.nullOptions
|
||||
module.exports.strOptions = types.strOptions
|
||||
module.exports.stringify = util.stringifyString
|
||||
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
2
node_modules/yaml/seq.js
generated
vendored
Normal file
2
node_modules/yaml/seq.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = require('./dist/types').YAMLSeq
|
||||
require('./dist/legacy-exports').warnFileDeprecation(__filename)
|
||||
407
node_modules/yaml/types.d.ts
generated
vendored
Normal file
407
node_modules/yaml/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,407 @@
|
||||
import { Document, scalarOptions } from './index'
|
||||
import { CST } from './parse-cst'
|
||||
import { Type } from './util'
|
||||
|
||||
export const binaryOptions: scalarOptions.Binary
|
||||
export const boolOptions: scalarOptions.Bool
|
||||
export const intOptions: scalarOptions.Int
|
||||
export const nullOptions: scalarOptions.Null
|
||||
export const strOptions: scalarOptions.Str
|
||||
|
||||
export class Schema {
|
||||
/** Default: `'tag:yaml.org,2002:'` */
|
||||
static defaultPrefix: string
|
||||
static defaultTags: {
|
||||
/** Default: `'tag:yaml.org,2002:map'` */
|
||||
MAP: string
|
||||
/** Default: `'tag:yaml.org,2002:seq'` */
|
||||
SEQ: string
|
||||
/** Default: `'tag:yaml.org,2002:str'` */
|
||||
STR: string
|
||||
}
|
||||
constructor(options: Schema.Options)
|
||||
/**
|
||||
* Convert any value into a `Node` using this schema, recursively turning
|
||||
* objects into collections.
|
||||
*
|
||||
* @param wrapScalars If `true`, also wraps plain values in `Scalar` objects;
|
||||
* if undefined or `false` and `value` is not an object, it will be returned
|
||||
* directly.
|
||||
* @param tag Use to specify the collection type, e.g. `"!!omap"`. Note that
|
||||
* this requires the corresponding tag to be available in this schema.
|
||||
*/
|
||||
createNode(
|
||||
value: any,
|
||||
wrapScalars?: boolean,
|
||||
tag?: string,
|
||||
ctx?: Schema.CreateNodeContext
|
||||
): Node
|
||||
/**
|
||||
* Convert a key and a value into a `Pair` using this schema, recursively
|
||||
* wrapping all values as `Scalar` or `Collection` nodes.
|
||||
*
|
||||
* @param ctx To not wrap scalars, use a context `{ wrapScalars: false }`
|
||||
*/
|
||||
createPair(key: any, value: any, ctx?: Schema.CreateNodeContext): Pair
|
||||
merge: boolean
|
||||
name: Schema.Name
|
||||
sortMapEntries: ((a: Pair, b: Pair) => number) | null
|
||||
tags: Schema.Tag[]
|
||||
}
|
||||
|
||||
export namespace Schema {
|
||||
type Name = 'core' | 'failsafe' | 'json' | 'yaml-1.1'
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Array of additional tags to include in the schema, or a function that may
|
||||
* modify the schema's base tag array.
|
||||
*/
|
||||
customTags?: (TagId | Tag)[] | ((tags: Tag[]) => Tag[])
|
||||
/**
|
||||
* Enable support for `<<` merge keys.
|
||||
*
|
||||
* Default: `false` for YAML 1.2, `true` for earlier versions
|
||||
*/
|
||||
merge?: boolean
|
||||
/**
|
||||
* The base schema to use.
|
||||
*
|
||||
* Default: `"core"` for YAML 1.2, `"yaml-1.1"` for earlier versions
|
||||
*/
|
||||
schema?: Name
|
||||
/**
|
||||
* When stringifying, sort map entries. If `true`, sort by comparing key values with `<`.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
sortMapEntries?: boolean | ((a: Pair, b: Pair) => number)
|
||||
/**
|
||||
* @deprecated Use `customTags` instead.
|
||||
*/
|
||||
tags?: Options['customTags']
|
||||
}
|
||||
|
||||
interface CreateNodeContext {
|
||||
wrapScalars?: boolean
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
interface StringifyContext {
|
||||
forceBlockIndent?: boolean
|
||||
implicitKey?: boolean
|
||||
indent?: string
|
||||
indentAtStart?: number
|
||||
inFlow?: boolean
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
type TagId =
|
||||
| 'binary'
|
||||
| 'bool'
|
||||
| 'float'
|
||||
| 'floatExp'
|
||||
| 'floatNaN'
|
||||
| 'floatTime'
|
||||
| 'int'
|
||||
| 'intHex'
|
||||
| 'intOct'
|
||||
| 'intTime'
|
||||
| 'null'
|
||||
| 'omap'
|
||||
| 'pairs'
|
||||
| 'set'
|
||||
| 'timestamp'
|
||||
|
||||
type Tag = CustomTag | DefaultTag
|
||||
|
||||
interface BaseTag {
|
||||
/**
|
||||
* An optional factory function, used e.g. by collections when wrapping JS objects as AST nodes.
|
||||
*/
|
||||
createNode?: (
|
||||
schema: Schema,
|
||||
value: any,
|
||||
ctx: Schema.CreateNodeContext
|
||||
) => YAMLMap | YAMLSeq | Scalar
|
||||
/**
|
||||
* If a tag has multiple forms that should be parsed and/or stringified differently, use `format` to identify them.
|
||||
*/
|
||||
format?: string
|
||||
/**
|
||||
* Used by `YAML.createNode` to detect your data type, e.g. using `typeof` or
|
||||
* `instanceof`.
|
||||
*/
|
||||
identify(value: any): boolean
|
||||
/**
|
||||
* The `Node` child class that implements this tag. Required for collections and tags that have overlapping JS representations.
|
||||
*/
|
||||
nodeClass?: new () => any
|
||||
/**
|
||||
* Used by some tags to configure their stringification, where applicable.
|
||||
*/
|
||||
options?: object
|
||||
/**
|
||||
* Optional function stringifying the AST node in the current context. If your
|
||||
* data includes a suitable `.toString()` method, you can probably leave this
|
||||
* undefined and use the default stringifier.
|
||||
*
|
||||
* @param item The node being stringified.
|
||||
* @param ctx Contains the stringifying context variables.
|
||||
* @param onComment Callback to signal that the stringifier includes the
|
||||
* item's comment in its output.
|
||||
* @param onChompKeep Callback to signal that the output uses a block scalar
|
||||
* type with the `+` chomping indicator.
|
||||
*/
|
||||
stringify?: (
|
||||
item: Node,
|
||||
ctx: Schema.StringifyContext,
|
||||
onComment?: () => void,
|
||||
onChompKeep?: () => void
|
||||
) => string
|
||||
/**
|
||||
* The identifier for your data type, with which its stringified form will be
|
||||
* prefixed. Should either be a !-prefixed local `!tag`, or a fully qualified
|
||||
* `tag:domain,date:foo`.
|
||||
*/
|
||||
tag: string
|
||||
}
|
||||
|
||||
interface CustomTag extends BaseTag {
|
||||
/**
|
||||
* A JavaScript class that should be matched to this tag, e.g. `Date` for `!!timestamp`.
|
||||
* @deprecated Use `Tag.identify` instead
|
||||
*/
|
||||
class?: new () => any
|
||||
/**
|
||||
* Turns a CST node into an AST node. If returning a non-`Node` value, the
|
||||
* output will be wrapped as a `Scalar`.
|
||||
*/
|
||||
resolve(doc: Document, cstNode: CST.Node): Node | any
|
||||
}
|
||||
|
||||
interface DefaultTag extends BaseTag {
|
||||
/**
|
||||
* If `true`, together with `test` allows for values to be stringified without
|
||||
* an explicit tag. For most cases, it's unlikely that you'll actually want to
|
||||
* use this, even if you first think you do.
|
||||
*/
|
||||
default: true
|
||||
/**
|
||||
* Alternative form used by default tags; called with `test` match results.
|
||||
*/
|
||||
resolve(...match: string[]): Node | any
|
||||
/**
|
||||
* Together with `default` allows for values to be stringified without an
|
||||
* explicit tag and detected using a regular expression. For most cases, it's
|
||||
* unlikely that you'll actually want to use these, even if you first think
|
||||
* you do.
|
||||
*/
|
||||
test: RegExp
|
||||
}
|
||||
}
|
||||
|
||||
export class Node {
|
||||
/** A comment on or immediately after this */
|
||||
comment?: string | null
|
||||
/** A comment before this */
|
||||
commentBefore?: string | null
|
||||
/** Only available when `keepCstNodes` is set to `true` */
|
||||
cstNode?: CST.Node
|
||||
/**
|
||||
* The [start, end] range of characters of the source parsed
|
||||
* into this node (undefined for pairs or if not parsed)
|
||||
*/
|
||||
range?: [number, number] | null
|
||||
/** A blank line before this node and its commentBefore */
|
||||
spaceBefore?: boolean
|
||||
/** A fully qualified tag, if required */
|
||||
tag?: string
|
||||
/** A plain JS representation of this node */
|
||||
toJSON(arg?: any): any
|
||||
/** The type of this node */
|
||||
type?: Type | Pair.Type
|
||||
}
|
||||
|
||||
export class Scalar extends Node {
|
||||
constructor(value: any)
|
||||
type?: Scalar.Type
|
||||
/**
|
||||
* By default (undefined), numbers use decimal notation.
|
||||
* The YAML 1.2 core schema only supports 'HEX' and 'OCT'.
|
||||
*/
|
||||
format?: 'BIN' | 'HEX' | 'OCT' | 'TIME'
|
||||
value: any
|
||||
toJSON(arg?: any, ctx?: AST.NodeToJsonContext): any
|
||||
toString(): string
|
||||
}
|
||||
export namespace Scalar {
|
||||
type Type =
|
||||
| Type.BLOCK_FOLDED
|
||||
| Type.BLOCK_LITERAL
|
||||
| Type.PLAIN
|
||||
| Type.QUOTE_DOUBLE
|
||||
| Type.QUOTE_SINGLE
|
||||
}
|
||||
|
||||
export class Alias extends Node {
|
||||
type: Type.ALIAS
|
||||
source: Node
|
||||
cstNode?: CST.Alias
|
||||
toString(ctx: Schema.StringifyContext): string
|
||||
}
|
||||
|
||||
export class Pair extends Node {
|
||||
constructor(key: any, value?: any)
|
||||
type: Pair.Type.PAIR | Pair.Type.MERGE_PAIR
|
||||
/** Always Node or null when parsed, but can be set to anything. */
|
||||
key: any
|
||||
/** Always Node or null when parsed, but can be set to anything. */
|
||||
value: any
|
||||
cstNode?: never // no corresponding cstNode
|
||||
toJSON(arg?: any, ctx?: AST.NodeToJsonContext): object | Map<any, any>
|
||||
toString(
|
||||
ctx?: Schema.StringifyContext,
|
||||
onComment?: () => void,
|
||||
onChompKeep?: () => void
|
||||
): string
|
||||
}
|
||||
export namespace Pair {
|
||||
enum Type {
|
||||
PAIR = 'PAIR',
|
||||
MERGE_PAIR = 'MERGE_PAIR'
|
||||
}
|
||||
}
|
||||
|
||||
export class Merge extends Pair {
|
||||
type: Pair.Type.MERGE_PAIR
|
||||
/** Always Scalar('<<'), defined by the type specification */
|
||||
key: AST.PlainValue
|
||||
/** Always YAMLSeq<Alias(Map)>, stringified as *A if length = 1 */
|
||||
value: YAMLSeq
|
||||
toString(ctx?: Schema.StringifyContext, onComment?: () => void): string
|
||||
}
|
||||
|
||||
export class Collection extends Node {
|
||||
type?: Type.MAP | Type.FLOW_MAP | Type.SEQ | Type.FLOW_SEQ | Type.DOCUMENT
|
||||
items: any[]
|
||||
schema?: Schema
|
||||
|
||||
/**
|
||||
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
||||
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
||||
* that already exists in the map.
|
||||
*/
|
||||
add(value: any): void
|
||||
addIn(path: Iterable<any>, value: any): void
|
||||
/**
|
||||
* Removes a value from the collection.
|
||||
* @returns `true` if the item was found and removed.
|
||||
*/
|
||||
delete(key: any): boolean
|
||||
deleteIn(path: Iterable<any>): boolean
|
||||
/**
|
||||
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
||||
* scalar values from their surrounding node; to disable set `keepScalar` to
|
||||
* `true` (collections are always returned intact).
|
||||
*/
|
||||
get(key: any, keepScalar?: boolean): any
|
||||
getIn(path: Iterable<any>, keepScalar?: boolean): any
|
||||
/**
|
||||
* Checks if the collection includes a value with the key `key`.
|
||||
*/
|
||||
has(key: any): boolean
|
||||
hasIn(path: Iterable<any>): boolean
|
||||
/**
|
||||
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
||||
* boolean to add/remove the item from the set.
|
||||
*/
|
||||
set(key: any, value: any): void
|
||||
setIn(path: Iterable<any>, value: any): void
|
||||
}
|
||||
|
||||
export class YAMLMap extends Collection {
|
||||
type?: Type.FLOW_MAP | Type.MAP
|
||||
items: Array<Pair>
|
||||
hasAllNullValues(): boolean
|
||||
toJSON(arg?: any, ctx?: AST.NodeToJsonContext): object | Map<any, any>
|
||||
toString(
|
||||
ctx?: Schema.StringifyContext,
|
||||
onComment?: () => void,
|
||||
onChompKeep?: () => void
|
||||
): string
|
||||
}
|
||||
|
||||
export class YAMLSeq extends Collection {
|
||||
type?: Type.FLOW_SEQ | Type.SEQ
|
||||
delete(key: number | string | Scalar): boolean
|
||||
get(key: number | string | Scalar, keepScalar?: boolean): any
|
||||
has(key: number | string | Scalar): boolean
|
||||
set(key: number | string | Scalar, value: any): void
|
||||
hasAllNullValues(): boolean
|
||||
toJSON(arg?: any, ctx?: AST.NodeToJsonContext): any[]
|
||||
toString(
|
||||
ctx?: Schema.StringifyContext,
|
||||
onComment?: () => void,
|
||||
onChompKeep?: () => void
|
||||
): string
|
||||
}
|
||||
|
||||
export namespace AST {
|
||||
interface NodeToJsonContext {
|
||||
anchors?: any[]
|
||||
doc: Document
|
||||
keep?: boolean
|
||||
mapAsMap?: boolean
|
||||
maxAliasCount?: number
|
||||
onCreate?: (node: Node) => void
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
interface BlockFolded extends Scalar {
|
||||
type: Type.BLOCK_FOLDED
|
||||
cstNode?: CST.BlockFolded
|
||||
}
|
||||
|
||||
interface BlockLiteral extends Scalar {
|
||||
type: Type.BLOCK_LITERAL
|
||||
cstNode?: CST.BlockLiteral
|
||||
}
|
||||
|
||||
interface PlainValue extends Scalar {
|
||||
type: Type.PLAIN
|
||||
cstNode?: CST.PlainValue
|
||||
}
|
||||
|
||||
interface QuoteDouble extends Scalar {
|
||||
type: Type.QUOTE_DOUBLE
|
||||
cstNode?: CST.QuoteDouble
|
||||
}
|
||||
|
||||
interface QuoteSingle extends Scalar {
|
||||
type: Type.QUOTE_SINGLE
|
||||
cstNode?: CST.QuoteSingle
|
||||
}
|
||||
|
||||
interface FlowMap extends YAMLMap {
|
||||
type: Type.FLOW_MAP
|
||||
cstNode?: CST.FlowMap
|
||||
}
|
||||
|
||||
interface BlockMap extends YAMLMap {
|
||||
type: Type.MAP
|
||||
cstNode?: CST.Map
|
||||
}
|
||||
|
||||
interface FlowSeq extends YAMLSeq {
|
||||
type: Type.FLOW_SEQ
|
||||
items: Array<Node>
|
||||
cstNode?: CST.FlowSeq
|
||||
}
|
||||
|
||||
interface BlockSeq extends YAMLSeq {
|
||||
type: Type.SEQ
|
||||
items: Array<Node | null>
|
||||
cstNode?: CST.Seq
|
||||
}
|
||||
}
|
||||
17
node_modules/yaml/types.js
generated
vendored
Normal file
17
node_modules/yaml/types.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
const types = require('./dist/types')
|
||||
|
||||
exports.binaryOptions = types.binaryOptions
|
||||
exports.boolOptions = types.boolOptions
|
||||
exports.intOptions = types.intOptions
|
||||
exports.nullOptions = types.nullOptions
|
||||
exports.strOptions = types.strOptions
|
||||
|
||||
exports.Schema = types.Schema
|
||||
exports.Alias = types.Alias
|
||||
exports.Collection = types.Collection
|
||||
exports.Merge = types.Merge
|
||||
exports.Node = types.Node
|
||||
exports.Pair = types.Pair
|
||||
exports.Scalar = types.Scalar
|
||||
exports.YAMLMap = types.YAMLMap
|
||||
exports.YAMLSeq = types.YAMLSeq
|
||||
17
node_modules/yaml/types.mjs
generated
vendored
Normal file
17
node_modules/yaml/types.mjs
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import types from './dist/types.js'
|
||||
|
||||
export const binaryOptions = types.binaryOptions
|
||||
export const boolOptions = types.boolOptions
|
||||
export const intOptions = types.intOptions
|
||||
export const nullOptions = types.nullOptions
|
||||
export const strOptions = types.strOptions
|
||||
|
||||
export const Schema = types.Schema
|
||||
export const Alias = types.Alias
|
||||
export const Collection = types.Collection
|
||||
export const Merge = types.Merge
|
||||
export const Node = types.Node
|
||||
export const Pair = types.Pair
|
||||
export const Scalar = types.Scalar
|
||||
export const YAMLMap = types.YAMLMap
|
||||
export const YAMLSeq = types.YAMLSeq
|
||||
8
node_modules/yaml/types/binary.js
generated
vendored
Normal file
8
node_modules/yaml/types/binary.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
'use strict'
|
||||
Object.defineProperty(exports, '__esModule', { value: true })
|
||||
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
exports.binary = legacy.binary
|
||||
exports.default = [exports.binary]
|
||||
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
3
node_modules/yaml/types/omap.js
generated
vendored
Normal file
3
node_modules/yaml/types/omap.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
module.exports = legacy.omap
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
3
node_modules/yaml/types/pairs.js
generated
vendored
Normal file
3
node_modules/yaml/types/pairs.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
module.exports = legacy.pairs
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
3
node_modules/yaml/types/set.js
generated
vendored
Normal file
3
node_modules/yaml/types/set.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
module.exports = legacy.set
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
10
node_modules/yaml/types/timestamp.js
generated
vendored
Normal file
10
node_modules/yaml/types/timestamp.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict'
|
||||
Object.defineProperty(exports, '__esModule', { value: true })
|
||||
|
||||
const legacy = require('../dist/legacy-exports')
|
||||
exports.default = [legacy.intTime, legacy.floatTime, legacy.timestamp]
|
||||
exports.floatTime = legacy.floatTime
|
||||
exports.intTime = legacy.intTime
|
||||
exports.timestamp = legacy.timestamp
|
||||
|
||||
legacy.warnFileDeprecation(__filename)
|
||||
86
node_modules/yaml/util.d.ts
generated
vendored
Normal file
86
node_modules/yaml/util.d.ts
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
import { Document } from './index'
|
||||
import { CST } from './parse-cst'
|
||||
import { AST, Pair, Scalar, Schema } from './types'
|
||||
|
||||
export function findPair(items: any[], key: Scalar | any): Pair | undefined
|
||||
|
||||
export function parseMap(doc: Document, cst: CST.Map): AST.BlockMap
|
||||
export function parseMap(doc: Document, cst: CST.FlowMap): AST.FlowMap
|
||||
export function parseSeq(doc: Document, cst: CST.Seq): AST.BlockSeq
|
||||
export function parseSeq(doc: Document, cst: CST.FlowSeq): AST.FlowSeq
|
||||
|
||||
export function stringifyNumber(item: Scalar): string
|
||||
export function stringifyString(
|
||||
item: Scalar,
|
||||
ctx: Schema.StringifyContext,
|
||||
onComment?: () => void,
|
||||
onChompKeep?: () => void
|
||||
): string
|
||||
|
||||
export function toJSON(
|
||||
value: any,
|
||||
arg?: any,
|
||||
ctx?: Schema.CreateNodeContext
|
||||
): any
|
||||
|
||||
export enum Type {
|
||||
ALIAS = 'ALIAS',
|
||||
BLANK_LINE = 'BLANK_LINE',
|
||||
BLOCK_FOLDED = 'BLOCK_FOLDED',
|
||||
BLOCK_LITERAL = 'BLOCK_LITERAL',
|
||||
COMMENT = 'COMMENT',
|
||||
DIRECTIVE = 'DIRECTIVE',
|
||||
DOCUMENT = 'DOCUMENT',
|
||||
FLOW_MAP = 'FLOW_MAP',
|
||||
FLOW_SEQ = 'FLOW_SEQ',
|
||||
MAP = 'MAP',
|
||||
MAP_KEY = 'MAP_KEY',
|
||||
MAP_VALUE = 'MAP_VALUE',
|
||||
PLAIN = 'PLAIN',
|
||||
QUOTE_DOUBLE = 'QUOTE_DOUBLE',
|
||||
QUOTE_SINGLE = 'QUOTE_SINGLE',
|
||||
SEQ = 'SEQ',
|
||||
SEQ_ITEM = 'SEQ_ITEM'
|
||||
}
|
||||
|
||||
interface LinePos {
|
||||
line: number
|
||||
col: number
|
||||
}
|
||||
|
||||
export class YAMLError extends Error {
|
||||
name:
|
||||
| 'YAMLReferenceError'
|
||||
| 'YAMLSemanticError'
|
||||
| 'YAMLSyntaxError'
|
||||
| 'YAMLWarning'
|
||||
message: string
|
||||
source?: CST.Node
|
||||
|
||||
nodeType?: Type
|
||||
range?: CST.Range
|
||||
linePos?: { start: LinePos; end: LinePos }
|
||||
|
||||
/**
|
||||
* Drops `source` and adds `nodeType`, `range` and `linePos`, as well as
|
||||
* adding details to `message`. Run automatically for document errors if
|
||||
* the `prettyErrors` option is set.
|
||||
*/
|
||||
makePretty(): void
|
||||
}
|
||||
|
||||
export class YAMLReferenceError extends YAMLError {
|
||||
name: 'YAMLReferenceError'
|
||||
}
|
||||
|
||||
export class YAMLSemanticError extends YAMLError {
|
||||
name: 'YAMLSemanticError'
|
||||
}
|
||||
|
||||
export class YAMLSyntaxError extends YAMLError {
|
||||
name: 'YAMLSyntaxError'
|
||||
}
|
||||
|
||||
export class YAMLWarning extends YAMLError {
|
||||
name: 'YAMLWarning'
|
||||
}
|
||||
16
node_modules/yaml/util.js
generated
vendored
Normal file
16
node_modules/yaml/util.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
const util = require('./dist/util')
|
||||
|
||||
exports.findPair = util.findPair
|
||||
exports.toJSON = util.toJSON
|
||||
exports.parseMap = util.parseMap
|
||||
exports.parseSeq = util.parseSeq
|
||||
|
||||
exports.stringifyNumber = util.stringifyNumber
|
||||
exports.stringifyString = util.stringifyString
|
||||
exports.Type = util.Type
|
||||
|
||||
exports.YAMLError = util.YAMLError
|
||||
exports.YAMLReferenceError = util.YAMLReferenceError
|
||||
exports.YAMLSemanticError = util.YAMLSemanticError
|
||||
exports.YAMLSyntaxError = util.YAMLSyntaxError
|
||||
exports.YAMLWarning = util.YAMLWarning
|
||||
18
node_modules/yaml/util.mjs
generated
vendored
Normal file
18
node_modules/yaml/util.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import util from './dist/util.js'
|
||||
|
||||
export const findPair = util.findPair
|
||||
export const toJSON = util.toJSON
|
||||
|
||||
export const parseMap = util.parseMap
|
||||
export const parseSeq = util.parseSeq
|
||||
|
||||
export const stringifyNumber = util.stringifyNumber
|
||||
export const stringifyString = util.stringifyString
|
||||
|
||||
export const Type = util.Type
|
||||
|
||||
export const YAMLError = util.YAMLError
|
||||
export const YAMLReferenceError = util.YAMLReferenceError
|
||||
export const YAMLSemanticError = util.YAMLSemanticError
|
||||
export const YAMLSyntaxError = util.YAMLSyntaxError
|
||||
export const YAMLWarning = util.YAMLWarning
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user