mirror of
https://github.com/s4u/maven-settings-action.git
synced 2026-02-12 00:05:49 +08:00
Compare commits
161 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| df02243d71 | |||
| a2731cf297 | |||
| fe12eba098 | |||
| fa0be5f968 | |||
| 2a1bf9c27e | |||
| 060e4442b5 | |||
| 4309eaf1f7 | |||
| 530d13699b | |||
| 78af212661 | |||
| 6781626242 | |||
| c2d71a67ea | |||
| 25300b87d9 | |||
| 75f172be63 | |||
| 7e15ec568d | |||
| a8a028af57 | |||
| 2426826ebc | |||
| b1f588d74f | |||
| bfee59b12a | |||
| d016a0cc3c | |||
| fbff164add | |||
| 96e7617cbc | |||
| e970e3e5f9 | |||
| 07702512f4 | |||
| d07365e2cd | |||
| 7b2fa81b55 | |||
| 772d1cd04c | |||
| 3d63f86fbc | |||
| 54bf9b072d | |||
| bda41227d8 | |||
| 9c42cb38ac | |||
| b034b76077 | |||
| ed5f8cf141 | |||
| ae0dfdae9b | |||
| f033cb9cb6 | |||
| e7ad595eea | |||
| 4037eb19d4 | |||
| c5205056ba | |||
| cdd3549d27 | |||
| 92800f80ea | |||
| ff8dced6da | |||
| a55e80ab14 | |||
| 27b9fae681 | |||
| 71886e4f1b | |||
| 468da7c285 | |||
| c36b106668 | |||
| ea8b3d6660 | |||
| 65892feef6 | |||
| 10548f9512 | |||
| f5daf9accb | |||
| 7e525dcd8d | |||
| 4f7bcf53f4 | |||
| 8a445a2687 | |||
| d9a39767e3 | |||
| a3e52fbc15 | |||
| d10b249608 | |||
| e357eee8b6 | |||
| 2a3de130be | |||
| ac18e25d5d | |||
| 6d2d96dbc0 | |||
| 7f8ec2fd15 | |||
| abac0c76e7 | |||
| 3c08118ca6 | |||
| c61c04a8ed | |||
| 4eefa8130f | |||
| af860eb623 | |||
| 8224e70aa0 | |||
| b6dea48d5e | |||
| 81a559fbbc | |||
| 6f1342e18b | |||
| c6417d63a2 | |||
| fcf49419d1 | |||
| cf94a9ebeb | |||
| 93bd53060c | |||
| c62d578537 | |||
| 79dd6f6b44 | |||
| 633099f72a | |||
| 9422b33d6f | |||
| 4f51703755 | |||
| d2be263333 | |||
| b7c480a93e | |||
| 47076d1d48 | |||
| a7f883dd5f | |||
| 783d40b5e0 | |||
| 6fb79721ff | |||
| d2ab3a2771 | |||
| 48be4c0ada | |||
| 94cb3ed880 | |||
| 055a005883 | |||
| b09e5585eb | |||
| 256fa3ecf6 | |||
| 2f4effcbc0 | |||
| 32c0b34c7b | |||
| af0727c4dd | |||
| a3c79af90d | |||
| f06d610f38 | |||
| 0b82524ef7 | |||
| 235574376d | |||
| 2cd2aae853 | |||
| 6438bb1dc9 | |||
| 2bd1df6691 | |||
| d5041555ff | |||
| 44e440d5a2 | |||
| d8160953aa | |||
| f313f0ba42 | |||
| 8d8ad4fc4e | |||
| 91a3862919 | |||
| 5070591660 | |||
| c61209d1cb | |||
| 0e30ec546c | |||
| 09d6dddb17 | |||
| 844e084ed1 | |||
| 3fd7e6914e | |||
| 082d702c3a | |||
| 7d928cbb6b | |||
| 89e2aa37f3 | |||
| be701aaad8 | |||
| c18afafd7e | |||
| f94dfbd262 | |||
| 534b1b1076 | |||
| 1dd5e0f3e7 | |||
| 5f6f6f6779 | |||
| 2350e84f5b | |||
| 0e8d6036b1 | |||
| 71b35fd976 | |||
| fcc46e4a85 | |||
| 41ac50e735 | |||
| 63ea49dafa | |||
| 64c06afaca | |||
| b818438be1 | |||
| 10967cd2f2 | |||
| d0b8b534b3 | |||
| 1b34539e65 | |||
| 79bc1c28ad | |||
| f2d19d8a3c | |||
| d38ae3dd0c | |||
| 1a566d6b1a | |||
| 68c0f5968a | |||
| fa170c9efb | |||
| b8e6d4c5c1 | |||
| c79b8c8bae | |||
| 19aa5326f7 | |||
| e754a0a431 | |||
| 79b590b1fa | |||
| 6e3efd3238 | |||
| c920943d3e | |||
| 6fd54e3151 | |||
| 2d2d5e94f6 | |||
| 42f81f61fc | |||
| c7c8114a65 | |||
| 5db73d2f08 | |||
| 8a73d2812b | |||
| 8800b3c2a1 | |||
| c56767da71 | |||
| fa7733af88 | |||
| 505f1cce2c | |||
| 1951d18467 | |||
| 19102415df | |||
| df80e35e53 | |||
| c17275b0ee | |||
| 9c1c20e659 | |||
| 113dd73fa6 |
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*.js eol=lf
|
||||
*.yml eol=lf
|
||||
*.xml eol=lf
|
||||
14
.github/dependabot.yml
vendored
Normal file
14
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '09:09'
|
||||
open-pull-requests-limit: 10
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
time: '09:09'
|
||||
open-pull-requests-limit: 10
|
||||
40
.github/release-drafter.yml
vendored
Normal file
40
.github/release-drafter.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
categories:
|
||||
|
||||
- title: 'New features'
|
||||
labels:
|
||||
- 'enhancement'
|
||||
|
||||
- title: 'Bug Fixes'
|
||||
labels:
|
||||
- 'bug'
|
||||
|
||||
- title: 'Maintenance'
|
||||
label:
|
||||
- 'code quality'
|
||||
- 'documentation'
|
||||
|
||||
- title: 'Dependency updates'
|
||||
label:
|
||||
- 'dependencies'
|
||||
|
||||
change-template: '- $TITLE #$NUMBER'
|
||||
|
||||
sort-direction: 'ascending'
|
||||
|
||||
template: |
|
||||
# What's Changed
|
||||
|
||||
$CHANGES
|
||||
|
||||
# Thanks
|
||||
Many thanks for collaboration on this release for: $CONTRIBUTORS
|
||||
|
||||
replacers:
|
||||
- search: '/(?:and )?@dependabot-preview(?:\[bot\])?,?/g'
|
||||
replace: ''
|
||||
|
||||
- search: '/(?:and )?@dependabot(?:\[bot\])?,?/g'
|
||||
replace: ''
|
||||
|
||||
- search: '/(?:and )?Github Action(?:\[bot\])?,?/g'
|
||||
replace: ''
|
||||
28
.github/workflows/audit.yml
vendored
Normal file
28
.github/workflows/audit.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
name: Audit
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'dependabot/**'
|
||||
schedule:
|
||||
- cron: '09 22 * * *'
|
||||
|
||||
jobs:
|
||||
audit:
|
||||
name: Audit
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
||||
- uses: actions/setup-node@v2.1.4
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
- run: npm version
|
||||
- run: npm ci
|
||||
- run: npm audit
|
||||
16
.github/workflows/release-drafter.yml
vendored
Normal file
16
.github/workflows/release-drafter.yml
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
name: Release Drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
# branches to consider in the event; optional, defaults to all
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
name: Update Release Draft
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5.12.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
22
.github/workflows/test.yml
vendored
22
.github/workflows/test.yml
vendored
@ -1,12 +1,15 @@
|
||||
name: "Test Action"
|
||||
name: Test
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'dependabot/**'
|
||||
schedule:
|
||||
- cron: '22 22 * * 5'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
@ -14,20 +17,29 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
||||
- uses: actions/setup-node@v2.1.4
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: '1.8'
|
||||
|
||||
- run: npm version
|
||||
- run: npm ci
|
||||
- run: npm audit
|
||||
- run: npm test
|
||||
|
||||
- uses: ./
|
||||
with:
|
||||
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
properties: '[{"prop1": "value1"}, {"prop2": "value2"}]'
|
||||
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
|
||||
apacheSnapshots: true
|
||||
sonatypeSnapshots: true
|
||||
oracleServers: '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]'
|
||||
oracleRepo: true
|
||||
|
||||
- run: cat ~/.m2/settings.xml
|
||||
shell: bash
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,8 +1,9 @@
|
||||
# comment this out distribution branches
|
||||
node_modules/
|
||||
# node_modules/
|
||||
|
||||
# Editors
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# Logs
|
||||
logs
|
||||
|
||||
163
README.md
163
README.md
@ -1,57 +1,188 @@
|
||||
# maven-settings-action
|
||||
[](https://github.com/s4u/maven-settings-action/actions)
|
||||
[](https://github.com/s4u/maven-settings-action/actions?query=workflow%3ATest)
|
||||
[](https://github.com/s4u/maven-settings-action/actions?query=workflow%3AAudit)
|
||||
|
||||
|
||||
This action setup maven environment for use in action by:
|
||||
- create maven settings.xml
|
||||
- set ```interactiveMode``` to false - useful in CI system
|
||||
- after job finish generated settings.xml will be removed to prevent cache or left sensitive data on build system
|
||||
- add server to servers with id=github, username=$GITHUB_ACTOR and password=$GITHUB_TOKEN
|
||||
|
||||
# Contributions
|
||||
- Contributions are welcome!
|
||||
- Give :star: - if you want to encourage me to work on a project
|
||||
- Don't hesitate create issue for new feature you dream of or if you suspect some bug
|
||||
|
||||
# Project versioning
|
||||
Project use [Semantic Versioning](https://semver.org/).
|
||||
We recommended to use the latest and specific release version.
|
||||
|
||||
In order to keep your project dependencies up to date you can watch this repository *(Releases only)*
|
||||
or use automatic tools like [Dependabot](https://dependabot.com/).
|
||||
|
||||
|
||||
# Usage
|
||||
See [action.yml](action.yml)
|
||||
|
||||
Create default ```settings.xml```:
|
||||
## default ```settings.xml```
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with server section:
|
||||
## ```settings.xml``` with servers section
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with maven properties:
|
||||
## ```settings.xml``` with servers section and additional configuration
|
||||
|
||||
``` yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
servers: |
|
||||
[{
|
||||
"id": "serverId",
|
||||
"configuration": {
|
||||
"item1": "value1",
|
||||
"item2": {
|
||||
"item21": "value21",
|
||||
"item22": "value22"
|
||||
}
|
||||
}
|
||||
}]
|
||||
```
|
||||
|
||||
result will be:
|
||||
|
||||
```xml
|
||||
<server>
|
||||
<id>serverId</id>
|
||||
<configuration>
|
||||
<item1>value1</item1>
|
||||
<item2>
|
||||
<item21>value21</item21>
|
||||
<item22>value22</item22>
|
||||
</item1>
|
||||
</configuration>
|
||||
</server></servers>
|
||||
```
|
||||
|
||||
|
||||
## ```settings.xml``` with mirrors section
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
|
||||
```
|
||||
|
||||
## ```settings.xml``` with properties
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
||||
```
|
||||
|
||||
Create ```settings.xml``` with https://oss.sonatype.org/content/repositories/snapshots in repository list
|
||||
## ```settings.xml``` with https://oss.sonatype.org/content/repositories/snapshots in repository list
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
sonatypeSnapshots: true
|
||||
```
|
||||
|
||||
Override existing existing ```settings.xml```:
|
||||
## ```settings.xml``` with https://repository.apache.org/snapshots/ in repository list
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
override: true
|
||||
apacheSnapshots: true
|
||||
```
|
||||
|
||||
## Do not override existing ```settings.xml```, from version **2.0** file is override by default :
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
override: false
|
||||
```
|
||||
|
||||
## Do not add github to server in ```settings.xml```, by default is added:
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
githubServer: false
|
||||
```
|
||||
|
||||
## ```settings.xml``` with special server item configuration for oracle repository [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9015)
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
oracleServers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
```
|
||||
|
||||
## ```settings.xml``` with [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017)
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
oracleRepo: true
|
||||
```
|
||||
|
||||
## GitHub actions secrets
|
||||
|
||||
It is also possible pass in Github Secrets e.g.
|
||||
|
||||
``` yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
with:
|
||||
servers: |
|
||||
[{
|
||||
"id": "sonatype-nexus-snapshots",
|
||||
"username": "${{ secrets.SONATYPE_USERNAME }}",
|
||||
"password": "${{ secrets.SONATYPE_PASSWORD }}"
|
||||
}]
|
||||
```
|
||||
|
||||
**Note**: secrets are *not* passed in if the workflow is triggered from a forked repository. See [here](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow) for further information. This can be avoided by using `if` triggers on the job e.g. `if: github.event_name == 'push'`.
|
||||
|
||||
# Notes
|
||||
|
||||
**maven-settings-action** should be put at the latest position before maven run in order to avoid override ```setting.xml``` by another action
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: maven-
|
||||
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
|
||||
- uses: s4u/maven-settings-action@v2.3.0
|
||||
|
||||
- run: mvn verify
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||
|
||||
# Contributions
|
||||
|
||||
Contributions are welcome!
|
||||
|
||||
23
action.yml
23
action.yml
@ -9,6 +9,9 @@ inputs:
|
||||
servers:
|
||||
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
required: false
|
||||
mirrors:
|
||||
description: 'mirrors definition in json array, eg: [{"id": "id", "name": "name", "mirrorOf": "mirrorOf", "url": "url"}]'
|
||||
required: false
|
||||
properties:
|
||||
description: 'json array with properties, eg [{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
||||
required: false
|
||||
@ -16,11 +19,25 @@ inputs:
|
||||
description: 'add https://oss.sonatype.org/content/repositories/snapshots to repository list - true or false'
|
||||
default: "false"
|
||||
required: false
|
||||
override:
|
||||
description: 'override existing settings.xml file'
|
||||
apacheSnapshots:
|
||||
description: 'add https://repository.apache.org/snapshots to repository list - true or false'
|
||||
default: "false"
|
||||
required: false
|
||||
override:
|
||||
description: 'override existing settings.xml file'
|
||||
default: "true"
|
||||
required: false
|
||||
githubServer:
|
||||
description: 'add to settings.xml servers server-id: github; username=$GITHUB_ACTOR and password=$GITHUB_TOKEN'
|
||||
default: "true"
|
||||
required: false
|
||||
oracleServers:
|
||||
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}] for Oracle repository'
|
||||
required: false
|
||||
oracleRepo:
|
||||
description: 'add Oracle Maven Repository'
|
||||
default: "false"
|
||||
required: false
|
||||
|
||||
|
||||
runs:
|
||||
using: 'node12'
|
||||
|
||||
163
index.test.js
163
index.test.js
@ -63,18 +63,165 @@ afterAll(() => {
|
||||
|
||||
test('run with all feature', () => {
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "username", "password": "password"}]';
|
||||
process.env['INPUT_PROPERTIES'] = '[{"prop1": "value1"}, {"prop2": "value2"}]'
|
||||
process.env['INPUT_SONATYPESNAPSHOT'] = true;
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "sUsername", "password": "sPassword", "configuration": {"props1": "value1"}}]';
|
||||
process.env['INPUT_ORACLESERVERS'] = '[{"id": "oServerId", "username": "oUsername", "password": "oPassword"}]';
|
||||
process.env['INPUT_GITHUBSERVER'] = true;
|
||||
|
||||
cp.execSync(`node ${indexPath}`, { env: process.env }).toString();
|
||||
process.env['INPUT_MIRRORS'] = '[{"id": "mirrorId", "name": "mirror Name", "mirrorOf": "mirror Off *", "url": "mirror url"}]';
|
||||
process.env['INPUT_PROPERTIES'] = '[{"prop1": "value1"}, {"prop2": "value2"}]'
|
||||
|
||||
process.env['INPUT_APACHESNAPSHOTS'] = true;
|
||||
process.env['INPUT_SONATYPESNAPSHOTS'] = true;
|
||||
process.env['INPUT_ORACLEREPO'] = true;
|
||||
|
||||
cp.execSync(`node ${indexPath}`, { env: process.env, stdio: 'inherit' });
|
||||
|
||||
const settingsStatus = fs.lstatSync(settingsPath);
|
||||
expect(settingsStatus.isFile()).toBeTruthy();
|
||||
expect(settingsStatus.size).toBeGreaterThan(0);
|
||||
|
||||
const settingsBody = fs.readFileSync(settingsPath).toString();
|
||||
expect(settingsBody).toMatch('<settings>');
|
||||
expect(settingsBody).toMatch('<servers><server><id>serverId</id><username>username</username><password>password</password></server></servers>');
|
||||
expect(settingsBody).toMatch('prop1');
|
||||
const settingsBody = fs.readFileSync(settingsPath).toString().replace(/^ $/mg, '');
|
||||
expect(settingsBody).toBe(`<settings>
|
||||
<interactiveMode>false</interactiveMode>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties><prop1>value1</prop1><prop2>value2</prop2></properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_apache-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_maven.oracle.com_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile></profiles>
|
||||
<servers>
|
||||
<server>
|
||||
<id>serverId</id>
|
||||
<username>sUsername</username>
|
||||
<password>sPassword</password>
|
||||
<configuration><props1>value1</props1></configuration>
|
||||
</server>
|
||||
<server>
|
||||
<id>oServerId</id>
|
||||
<username>oUsername</username>
|
||||
<password>oPassword</password>
|
||||
<configuration>
|
||||
<basicAuthScope>
|
||||
<host>ANY</host>
|
||||
<port>ANY</port>
|
||||
<realm>OAM 11g</realm>
|
||||
</basicAuthScope>
|
||||
<httpConfiguration>
|
||||
<all>
|
||||
<params>
|
||||
<property>
|
||||
<name>http.protocol.allow-circular-redirects</name>
|
||||
<value>%b,true</value>
|
||||
</property>
|
||||
</params>
|
||||
</all>
|
||||
</httpConfiguration>
|
||||
</configuration>
|
||||
</server>
|
||||
<server>
|
||||
<id>github</id>
|
||||
<username>\${env.GITHUB_ACTOR}</username>
|
||||
<password>\${env.GITHUB_TOKEN}</password>
|
||||
|
||||
</server></servers>
|
||||
<mirrors>
|
||||
<mirror>
|
||||
<id>mirrorId</id>
|
||||
<name>mirror Name</name>
|
||||
<mirrorOf>mirror Off *</mirrorOf>
|
||||
<url>mirror url</url>
|
||||
</mirror></mirrors>
|
||||
</settings>`);
|
||||
})
|
||||
|
||||
21
node_modules/.package-lock.json
generated
vendored
Normal file
21
node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "maven-settings-action",
|
||||
"version": "2.3.0",
|
||||
"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/xmldom": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.4.0.tgz",
|
||||
"integrity": "sha512-2E93k08T30Ugs+34HBSTQLVtpi6mCddaY8uO+pMNk1pqSjV5vElzn4mmh6KLxN3hki8rNcHSYzILoh3TEWORvA==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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",
|
||||
"."
|
||||
]
|
||||
],
|
||||
"_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": ".",
|
||||
"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"
|
||||
}
|
||||
185
node_modules/xmldom/CHANGELOG.md
generated
vendored
Normal file
185
node_modules/xmldom/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,185 @@
|
||||
## 0.4.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.3.0...0.4.0)
|
||||
|
||||
### Fixes
|
||||
- **BREAKING** Restore ` ` behavior from v0.1.27 [`#67`](https://github.com/xmldom/xmldom/pull/67)
|
||||
- **BREAKING** Typecheck source param before parsing [`#113`](https://github.com/xmldom/xmldom/pull/113)
|
||||
- Include documents in package files list [`#156`](https://github.com/xmldom/xmldom/pull/156)
|
||||
- Preserve doctype with sysid [`#144`](https://github.com/xmldom/xmldom/pull/144)
|
||||
- Remove ES6 syntax from getElementsByClassName [`#91`](https://github.com/xmldom/xmldom/pull/91)
|
||||
- Revert "Add lowercase of åäö in entityMap" due to duplicate entries [`#84`](https://github.com/xmldom/xmldom/pull/84)
|
||||
- fix: Convert all line separators to LF [`#66`](https://github.com/xmldom/xmldom/pull/66)
|
||||
|
||||
### Docs
|
||||
- Update CHANGELOG.md through version 0.3.0 [`#63`](https://github.com/xmldom/xmldom/pull/63)
|
||||
- Update badges [`#78`](https://github.com/xmldom/xmldom/pull/78)
|
||||
- Add .editorconfig file [`#104`](https://github.com/xmldom/xmldom/pull/104)
|
||||
- Add note about import [`#79`](https://github.com/xmldom/xmldom/pull/79)
|
||||
- Modernize & improve the example in readme.md [`#81`](https://github.com/xmldom/xmldom/pull/81)
|
||||
|
||||
### CI
|
||||
- Add Stryker Mutator [`#70`](https://github.com/xmldom/xmldom/pull/70)
|
||||
- Add Stryker action to update dashboard [`#77`](https://github.com/xmldom/xmldom/pull/77)
|
||||
- Add Node GitHub action workflow [`#64`](https://github.com/xmldom/xmldom/pull/64)
|
||||
- add & enable eslint [`#106`](https://github.com/xmldom/xmldom/pull/106)
|
||||
- Use eslint-plugin-es5 to enforce ES5 syntax [`#107`](https://github.com/xmldom/xmldom/pull/107)
|
||||
- Recover `vows` tests, drop `proof` tests [`#59`](https://github.com/xmldom/xmldom/pull/59)
|
||||
- Add jest tessuite and first tests [`#114`](https://github.com/xmldom/xmldom/pull/114)
|
||||
- Add jest testsuite with `xmltest` cases [`#112`](https://github.com/xmldom/xmldom/pull/112)
|
||||
- Configure Renovate [`#108`](https://github.com/xmldom/xmldom/pull/108)
|
||||
- Test European HTML entities [`#86`](https://github.com/xmldom/xmldom/pull/86)
|
||||
- Updated devDependencies
|
||||
|
||||
### Other
|
||||
- Remove files that are not of any use [`#131`](https://github.com/xmldom/xmldom/pull/131), [`#65`](https://github.com/xmldom/xmldom/pull/65), [`#33`](https://github.com/xmldom/xmldom/pull/33)
|
||||
|
||||
## 0.3.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.2.1...0.3.0)
|
||||
|
||||
- **BREAKING** Node >=10.x is now required.
|
||||
- **BREAKING** Remove `component.json` (deprecated package manager https://github.com/componentjs/guide)
|
||||
- **BREAKING** Move existing sources into `lib` subdirectory.
|
||||
- **POSSIBLY BREAKING** Introduce `files` entry in `package.json` and remove use of `.npmignore`.
|
||||
- [Add `Document.getElementsByClassName`](https://github.com/xmldom/xmldom/issues/24).
|
||||
- [Add `Node` to the list of exports](https://github.com/xmldom/xmldom/pull/27)
|
||||
- [Add lowercase of åäö in `entityMap`](https://github.com/xmldom/xmldom/pull/23).
|
||||
- Move CHANGELOG to markdown file.
|
||||
- Move LICENSE to markdown file.
|
||||
|
||||
## 0.2.1
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.2.0...0.2.1)
|
||||
|
||||
- Correct `homepage`, `repository` and `bugs` URLs in `package.json`.
|
||||
|
||||
## 0.2.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...0.2.0)
|
||||
|
||||
- Includes all **BREAKING** changes introduced in [`xmldom-alpha@v0.1.28`](#0128) by the original authors.
|
||||
- **POSSIBLY BREAKING** [remove the `Object.create` check from the `_extends` method of `dom.js` that added a `__proto__` property](https://github.com/xmldom/xmldom/commit/0be2ae910a8a22c9ec2cac042e04de4c04317d2a#diff-7d1c5d97786fdf9af5446a241d0b6d56L19-L22) ().
|
||||
- **POSSIBLY BREAKING** [remove code that added a `__proto__` property](https://github.com/xmldom/xmldom/commit/366159a76a181ce9a0d83f5dc48205686cfaf9cc)
|
||||
- formatting/corrections in `package.json`
|
||||
|
||||
## 0.1.31
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...v0.1.31)
|
||||
|
||||
The patch versions (`v0.1.29` - `v0.1.31`) that have been released on the [v0.1.x branch](https://github.com/xmldom/xmldom/tree/0.1.x), to reflect the changed maintainers, **are branched off from [`v0.1.27`](#0127) so they don't include the breaking changes introduced in [`xmldom-alpha@v0.1.28`](#0128)**:
|
||||
|
||||
## Maintainer changes
|
||||
|
||||
After the last commit to the original repository <https://github.com/jindw/xmldom> on the 9th of May 2017, the first commit to <https://github.com/xmldom/xmldom> is from the 19th of December 2019. [The fork has been announced in the original repository on the 2nd of March 2020.](https://github.com/jindw/xmldom/issues/259)
|
||||
|
||||
The versions listed below have been published to one or both of the following packages:
|
||||
- <https://www.npmjs.com/package/xmldom-alpha>
|
||||
- <https://www.npmjs.com/package/xmldom>
|
||||
|
||||
It is currently not planned to continue publishing the `xmldom-alpha` package.
|
||||
|
||||
The new maintainers did not invest time to understand changes that led to the last `xmldom` version [`0.1.27`](#0127) published by the original maintainer, but consider it the basis for their work.
|
||||
A timeline of all the changes that happened from that version until `0.3.0` is available in <https://github.com/xmldom/xmldom/issues/62>. Any related questions should be asked there.
|
||||
|
||||
## 0.1.28
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/v0.1.27...xmldom-alpha@v0.1.28)
|
||||
|
||||
Published by @jindw on the 9th of May 2017 as
|
||||
- `xmldom-alpha@0.1.28`
|
||||
|
||||
- **BREAKING** includes [regression regarding ` ` (issue #57)](https://github.com/xmldom/xmldom/issues/57)
|
||||
- [Fix `license` field in `package.json`](https://github.com/jindw/xmldom/pull/178)
|
||||
- [Conditional converting of HTML entities](https://github.com/jindw/xmldom/pull/80)
|
||||
- Fix `dom.js` serialization issue for missing document element ([example that failed on `toString()` before this change](https://github.com/xmldom/xmldom/blob/a58dcf7a265522e80ce520fe3be0cddb1b976f6f/test/parse/unclosedcomment.js#L10-L11))
|
||||
- Add new module `entities.js`
|
||||
|
||||
## 0.1.27
|
||||
|
||||
Published by @jindw on the 28th of Nov 2016 as
|
||||
- `xmldom@0.1.27`
|
||||
- `xmldom-alpha@0.1.27`
|
||||
|
||||
- Various bug fixes.
|
||||
|
||||
## 0.1.26
|
||||
|
||||
Published on the 18th of Nov 2016
|
||||
as `xmldom@0.1.26`
|
||||
|
||||
- Details unknown
|
||||
|
||||
## 0.1.25
|
||||
|
||||
Published on the 18th of Nov 2016 as
|
||||
- `xmldom@0.1.25`
|
||||
|
||||
- Details unknown
|
||||
|
||||
## 0.1.24
|
||||
|
||||
Published on the 27th of November 2016 as
|
||||
- `xmldom@0.1.24`
|
||||
- `xmldom-alpha@0.1.24`
|
||||
|
||||
- Added node filter.
|
||||
|
||||
## 0.1.23
|
||||
|
||||
Published on the 5th of May 2016 as
|
||||
- `xmldom-alpha@0.1.23`
|
||||
|
||||
- Add namespace support for nest node serialize.
|
||||
- Various other bug fixes.
|
||||
|
||||
## 0.1.22
|
||||
|
||||
- Merge XMLNS serialization.
|
||||
- Remove \r from source string.
|
||||
- Print namespaces for child elements.
|
||||
- Switch references to nodeType to use named constants.
|
||||
- Add nodelist toString support.
|
||||
|
||||
## 0.1.21
|
||||
|
||||
- Fix serialize bug.
|
||||
|
||||
## 0.1.20
|
||||
|
||||
- Optimize invalid XML support.
|
||||
- Add toString sorter for attributes output.
|
||||
- Add html self closed node button.
|
||||
- Add `*` NS support for getElementsByTagNameNS.
|
||||
- Convert attribute's value to string in setAttributeNS.
|
||||
- Add support for HTML entities for HTML docs only.
|
||||
- Fix TypeError when Document is created with DocumentType.
|
||||
|
||||
## 0.1.19
|
||||
|
||||
- Fix [infinite loop on unclosed comment (jindw/xmldom#68)](https://github.com/jindw/xmldom/issues/68)
|
||||
- Add error report for unclosed tag.
|
||||
- Various other fixes.
|
||||
|
||||
## 0.1.18
|
||||
|
||||
- Add default `ns` support.
|
||||
- parseFromString now renders entirely plain text documents as textNode.
|
||||
- Enable option to ignore white space on parsing.
|
||||
|
||||
## 0.1.17
|
||||
|
||||
**Details missing for this and potential earlier version**
|
||||
|
||||
## 0.1.16
|
||||
|
||||
- Correctly handle multibyte Unicode greater than two byts. #57. #56.
|
||||
- Initial unit testing and test coverage. #53. #46. #19.
|
||||
- Create Bower `component.json` #52.
|
||||
|
||||
## 0.1.8
|
||||
|
||||
- Add: some test case from node-o3-xml(excludes xpath support)
|
||||
- Fix: remove existed attribute before setting (bug introduced in v0.1.5)
|
||||
- Fix: index direct access for childNodes and any NodeList collection(not w3c standard)
|
||||
- Fix: remove last child bug
|
||||
4
node_modules/xmldom/LICENSE.md
generated
vendored
Normal file
4
node_modules/xmldom/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
You can choose any one of these licenses:
|
||||
|
||||
- MIT: https://opensource.org/licenses/MIT
|
||||
- LGPL: http://www.gnu.org/licenses/lgpl.html
|
||||
2
node_modules/xmldom/lib/.eslintrc.yml
generated
vendored
Normal file
2
node_modules/xmldom/lib/.eslintrc.yml
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
extends:
|
||||
- 'plugin:es5/no-es2015'
|
||||
251
node_modules/xmldom/lib/dom-parser.js
generated
vendored
Normal file
251
node_modules/xmldom/lib/dom-parser.js
generated
vendored
Normal file
@ -0,0 +1,251 @@
|
||||
function DOMParser(options){
|
||||
this.options = options ||{locator:{}};
|
||||
}
|
||||
|
||||
DOMParser.prototype.parseFromString = function(source,mimeType){
|
||||
var options = this.options;
|
||||
var sax = new XMLReader();
|
||||
var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler
|
||||
var errorHandler = options.errorHandler;
|
||||
var locator = options.locator;
|
||||
var defaultNSMap = options.xmlns||{};
|
||||
var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1;
|
||||
var entityMap = isHTML?htmlEntity.entityMap:{'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"};
|
||||
if(locator){
|
||||
domBuilder.setDocumentLocator(locator)
|
||||
}
|
||||
|
||||
sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);
|
||||
sax.domBuilder = options.domBuilder || domBuilder;
|
||||
if(isHTML){
|
||||
defaultNSMap['']= 'http://www.w3.org/1999/xhtml';
|
||||
}
|
||||
defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace';
|
||||
if(source && typeof source === 'string'){
|
||||
sax.parse(source,defaultNSMap,entityMap);
|
||||
}else{
|
||||
sax.errorHandler.error("invalid doc source");
|
||||
}
|
||||
return domBuilder.doc;
|
||||
}
|
||||
function buildErrorHandler(errorImpl,domBuilder,locator){
|
||||
if(!errorImpl){
|
||||
if(domBuilder instanceof DOMHandler){
|
||||
return domBuilder;
|
||||
}
|
||||
errorImpl = domBuilder ;
|
||||
}
|
||||
var errorHandler = {}
|
||||
var isCallback = errorImpl instanceof Function;
|
||||
locator = locator||{}
|
||||
function build(key){
|
||||
var fn = errorImpl[key];
|
||||
if(!fn && isCallback){
|
||||
fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;
|
||||
}
|
||||
errorHandler[key] = fn && function(msg){
|
||||
fn('[xmldom '+key+']\t'+msg+_locator(locator));
|
||||
}||function(){};
|
||||
}
|
||||
build('warning');
|
||||
build('error');
|
||||
build('fatalError');
|
||||
return errorHandler;
|
||||
}
|
||||
|
||||
//console.log('#\n\n\n\n\n\n\n####')
|
||||
/**
|
||||
* +ContentHandler+ErrorHandler
|
||||
* +LexicalHandler+EntityResolver2
|
||||
* -DeclHandler-DTDHandler
|
||||
*
|
||||
* DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler
|
||||
* DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html
|
||||
*/
|
||||
function DOMHandler() {
|
||||
this.cdata = false;
|
||||
}
|
||||
function position(locator,node){
|
||||
node.lineNumber = locator.lineNumber;
|
||||
node.columnNumber = locator.columnNumber;
|
||||
}
|
||||
/**
|
||||
* @see org.xml.sax.ContentHandler#startDocument
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html
|
||||
*/
|
||||
DOMHandler.prototype = {
|
||||
startDocument : function() {
|
||||
this.doc = new DOMImplementation().createDocument(null, null, null);
|
||||
if (this.locator) {
|
||||
this.doc.documentURI = this.locator.systemId;
|
||||
}
|
||||
},
|
||||
startElement:function(namespaceURI, localName, qName, attrs) {
|
||||
var doc = this.doc;
|
||||
var el = doc.createElementNS(namespaceURI, qName||localName);
|
||||
var len = attrs.length;
|
||||
appendElement(this, el);
|
||||
this.currentElement = el;
|
||||
|
||||
this.locator && position(this.locator,el)
|
||||
for (var i = 0 ; i < len; i++) {
|
||||
var namespaceURI = attrs.getURI(i);
|
||||
var value = attrs.getValue(i);
|
||||
var qName = attrs.getQName(i);
|
||||
var attr = doc.createAttributeNS(namespaceURI, qName);
|
||||
this.locator &&position(attrs.getLocator(i),attr);
|
||||
attr.value = attr.nodeValue = value;
|
||||
el.setAttributeNode(attr)
|
||||
}
|
||||
},
|
||||
endElement:function(namespaceURI, localName, qName) {
|
||||
var current = this.currentElement
|
||||
var tagName = current.tagName;
|
||||
this.currentElement = current.parentNode;
|
||||
},
|
||||
startPrefixMapping:function(prefix, uri) {
|
||||
},
|
||||
endPrefixMapping:function(prefix) {
|
||||
},
|
||||
processingInstruction:function(target, data) {
|
||||
var ins = this.doc.createProcessingInstruction(target, data);
|
||||
this.locator && position(this.locator,ins)
|
||||
appendElement(this, ins);
|
||||
},
|
||||
ignorableWhitespace:function(ch, start, length) {
|
||||
},
|
||||
characters:function(chars, start, length) {
|
||||
chars = _toString.apply(this,arguments)
|
||||
//console.log(chars)
|
||||
if(chars){
|
||||
if (this.cdata) {
|
||||
var charNode = this.doc.createCDATASection(chars);
|
||||
} else {
|
||||
var charNode = this.doc.createTextNode(chars);
|
||||
}
|
||||
if(this.currentElement){
|
||||
this.currentElement.appendChild(charNode);
|
||||
}else if(/^\s*$/.test(chars)){
|
||||
this.doc.appendChild(charNode);
|
||||
//process xml
|
||||
}
|
||||
this.locator && position(this.locator,charNode)
|
||||
}
|
||||
},
|
||||
skippedEntity:function(name) {
|
||||
},
|
||||
endDocument:function() {
|
||||
this.doc.normalize();
|
||||
},
|
||||
setDocumentLocator:function (locator) {
|
||||
if(this.locator = locator){// && !('lineNumber' in locator)){
|
||||
locator.lineNumber = 0;
|
||||
}
|
||||
},
|
||||
//LexicalHandler
|
||||
comment:function(chars, start, length) {
|
||||
chars = _toString.apply(this,arguments)
|
||||
var comm = this.doc.createComment(chars);
|
||||
this.locator && position(this.locator,comm)
|
||||
appendElement(this, comm);
|
||||
},
|
||||
|
||||
startCDATA:function() {
|
||||
//used in characters() methods
|
||||
this.cdata = true;
|
||||
},
|
||||
endCDATA:function() {
|
||||
this.cdata = false;
|
||||
},
|
||||
|
||||
startDTD:function(name, publicId, systemId) {
|
||||
var impl = this.doc.implementation;
|
||||
if (impl && impl.createDocumentType) {
|
||||
var dt = impl.createDocumentType(name, publicId, systemId);
|
||||
this.locator && position(this.locator,dt)
|
||||
appendElement(this, dt);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @see org.xml.sax.ErrorHandler
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
|
||||
*/
|
||||
warning:function(error) {
|
||||
console.warn('[xmldom warning]\t'+error,_locator(this.locator));
|
||||
},
|
||||
error:function(error) {
|
||||
console.error('[xmldom error]\t'+error,_locator(this.locator));
|
||||
},
|
||||
fatalError:function(error) {
|
||||
console.error('[xmldom fatalError]\t'+error,_locator(this.locator));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
function _locator(l){
|
||||
if(l){
|
||||
return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']'
|
||||
}
|
||||
}
|
||||
function _toString(chars,start,length){
|
||||
if(typeof chars == 'string'){
|
||||
return chars.substr(start,length)
|
||||
}else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)")
|
||||
if(chars.length >= start+length || start){
|
||||
return new java.lang.String(chars,start,length)+'';
|
||||
}
|
||||
return chars;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html
|
||||
* used method of org.xml.sax.ext.LexicalHandler:
|
||||
* #comment(chars, start, length)
|
||||
* #startCDATA()
|
||||
* #endCDATA()
|
||||
* #startDTD(name, publicId, systemId)
|
||||
*
|
||||
*
|
||||
* IGNORED method of org.xml.sax.ext.LexicalHandler:
|
||||
* #endDTD()
|
||||
* #startEntity(name)
|
||||
* #endEntity(name)
|
||||
*
|
||||
*
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html
|
||||
* IGNORED method of org.xml.sax.ext.DeclHandler
|
||||
* #attributeDecl(eName, aName, type, mode, value)
|
||||
* #elementDecl(name, model)
|
||||
* #externalEntityDecl(name, publicId, systemId)
|
||||
* #internalEntityDecl(name, value)
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html
|
||||
* IGNORED method of org.xml.sax.EntityResolver2
|
||||
* #resolveEntity(String name,String publicId,String baseURI,String systemId)
|
||||
* #resolveEntity(publicId, systemId)
|
||||
* #getExternalSubset(name, baseURI)
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html
|
||||
* IGNORED method of org.xml.sax.DTDHandler
|
||||
* #notationDecl(name, publicId, systemId) {};
|
||||
* #unparsedEntityDecl(name, publicId, systemId, notationName) {};
|
||||
*/
|
||||
"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){
|
||||
DOMHandler.prototype[key] = function(){return null}
|
||||
})
|
||||
|
||||
/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */
|
||||
function appendElement (hander,node) {
|
||||
if (!hander.currentElement) {
|
||||
hander.doc.appendChild(node);
|
||||
} else {
|
||||
hander.currentElement.appendChild(node);
|
||||
}
|
||||
}//appendChild and setAttributeNS are preformance key
|
||||
|
||||
//if(typeof require == 'function'){
|
||||
var htmlEntity = require('./entities');
|
||||
var XMLReader = require('./sax').XMLReader;
|
||||
var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation;
|
||||
exports.XMLSerializer = require('./dom').XMLSerializer ;
|
||||
exports.DOMParser = DOMParser;
|
||||
//}
|
||||
1256
node_modules/xmldom/lib/dom.js
generated
vendored
Normal file
1256
node_modules/xmldom/lib/dom.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
243
node_modules/xmldom/lib/entities.js
generated
vendored
Normal file
243
node_modules/xmldom/lib/entities.js
generated
vendored
Normal file
@ -0,0 +1,243 @@
|
||||
exports.entityMap = {
|
||||
lt: '<',
|
||||
gt: '>',
|
||||
amp: '&',
|
||||
quot: '"',
|
||||
apos: "'",
|
||||
Agrave: "À",
|
||||
Aacute: "Á",
|
||||
Acirc: "Â",
|
||||
Atilde: "Ã",
|
||||
Auml: "Ä",
|
||||
Aring: "Å",
|
||||
AElig: "Æ",
|
||||
Ccedil: "Ç",
|
||||
Egrave: "È",
|
||||
Eacute: "É",
|
||||
Ecirc: "Ê",
|
||||
Euml: "Ë",
|
||||
Igrave: "Ì",
|
||||
Iacute: "Í",
|
||||
Icirc: "Î",
|
||||
Iuml: "Ï",
|
||||
ETH: "Ð",
|
||||
Ntilde: "Ñ",
|
||||
Ograve: "Ò",
|
||||
Oacute: "Ó",
|
||||
Ocirc: "Ô",
|
||||
Otilde: "Õ",
|
||||
Ouml: "Ö",
|
||||
Oslash: "Ø",
|
||||
Ugrave: "Ù",
|
||||
Uacute: "Ú",
|
||||
Ucirc: "Û",
|
||||
Uuml: "Ü",
|
||||
Yacute: "Ý",
|
||||
THORN: "Þ",
|
||||
szlig: "ß",
|
||||
agrave: "à",
|
||||
aacute: "á",
|
||||
acirc: "â",
|
||||
atilde: "ã",
|
||||
auml: "ä",
|
||||
aring: "å",
|
||||
aelig: "æ",
|
||||
ccedil: "ç",
|
||||
egrave: "è",
|
||||
eacute: "é",
|
||||
ecirc: "ê",
|
||||
euml: "ë",
|
||||
igrave: "ì",
|
||||
iacute: "í",
|
||||
icirc: "î",
|
||||
iuml: "ï",
|
||||
eth: "ð",
|
||||
ntilde: "ñ",
|
||||
ograve: "ò",
|
||||
oacute: "ó",
|
||||
ocirc: "ô",
|
||||
otilde: "õ",
|
||||
ouml: "ö",
|
||||
oslash: "ø",
|
||||
ugrave: "ù",
|
||||
uacute: "ú",
|
||||
ucirc: "û",
|
||||
uuml: "ü",
|
||||
yacute: "ý",
|
||||
thorn: "þ",
|
||||
yuml: "ÿ",
|
||||
nbsp: "\u00a0",
|
||||
iexcl: "¡",
|
||||
cent: "¢",
|
||||
pound: "£",
|
||||
curren: "¤",
|
||||
yen: "¥",
|
||||
brvbar: "¦",
|
||||
sect: "§",
|
||||
uml: "¨",
|
||||
copy: "©",
|
||||
ordf: "ª",
|
||||
laquo: "«",
|
||||
not: "¬",
|
||||
shy: "",
|
||||
reg: "®",
|
||||
macr: "¯",
|
||||
deg: "°",
|
||||
plusmn: "±",
|
||||
sup2: "²",
|
||||
sup3: "³",
|
||||
acute: "´",
|
||||
micro: "µ",
|
||||
para: "¶",
|
||||
middot: "·",
|
||||
cedil: "¸",
|
||||
sup1: "¹",
|
||||
ordm: "º",
|
||||
raquo: "»",
|
||||
frac14: "¼",
|
||||
frac12: "½",
|
||||
frac34: "¾",
|
||||
iquest: "¿",
|
||||
times: "×",
|
||||
divide: "÷",
|
||||
forall: "∀",
|
||||
part: "∂",
|
||||
exist: "∃",
|
||||
empty: "∅",
|
||||
nabla: "∇",
|
||||
isin: "∈",
|
||||
notin: "∉",
|
||||
ni: "∋",
|
||||
prod: "∏",
|
||||
sum: "∑",
|
||||
minus: "−",
|
||||
lowast: "∗",
|
||||
radic: "√",
|
||||
prop: "∝",
|
||||
infin: "∞",
|
||||
ang: "∠",
|
||||
and: "∧",
|
||||
or: "∨",
|
||||
cap: "∩",
|
||||
cup: "∪",
|
||||
'int': "∫",
|
||||
there4: "∴",
|
||||
sim: "∼",
|
||||
cong: "≅",
|
||||
asymp: "≈",
|
||||
ne: "≠",
|
||||
equiv: "≡",
|
||||
le: "≤",
|
||||
ge: "≥",
|
||||
sub: "⊂",
|
||||
sup: "⊃",
|
||||
nsub: "⊄",
|
||||
sube: "⊆",
|
||||
supe: "⊇",
|
||||
oplus: "⊕",
|
||||
otimes: "⊗",
|
||||
perp: "⊥",
|
||||
sdot: "⋅",
|
||||
Alpha: "Α",
|
||||
Beta: "Β",
|
||||
Gamma: "Γ",
|
||||
Delta: "Δ",
|
||||
Epsilon: "Ε",
|
||||
Zeta: "Ζ",
|
||||
Eta: "Η",
|
||||
Theta: "Θ",
|
||||
Iota: "Ι",
|
||||
Kappa: "Κ",
|
||||
Lambda: "Λ",
|
||||
Mu: "Μ",
|
||||
Nu: "Ν",
|
||||
Xi: "Ξ",
|
||||
Omicron: "Ο",
|
||||
Pi: "Π",
|
||||
Rho: "Ρ",
|
||||
Sigma: "Σ",
|
||||
Tau: "Τ",
|
||||
Upsilon: "Υ",
|
||||
Phi: "Φ",
|
||||
Chi: "Χ",
|
||||
Psi: "Ψ",
|
||||
Omega: "Ω",
|
||||
alpha: "α",
|
||||
beta: "β",
|
||||
gamma: "γ",
|
||||
delta: "δ",
|
||||
epsilon: "ε",
|
||||
zeta: "ζ",
|
||||
eta: "η",
|
||||
theta: "θ",
|
||||
iota: "ι",
|
||||
kappa: "κ",
|
||||
lambda: "λ",
|
||||
mu: "μ",
|
||||
nu: "ν",
|
||||
xi: "ξ",
|
||||
omicron: "ο",
|
||||
pi: "π",
|
||||
rho: "ρ",
|
||||
sigmaf: "ς",
|
||||
sigma: "σ",
|
||||
tau: "τ",
|
||||
upsilon: "υ",
|
||||
phi: "φ",
|
||||
chi: "χ",
|
||||
psi: "ψ",
|
||||
omega: "ω",
|
||||
thetasym: "ϑ",
|
||||
upsih: "ϒ",
|
||||
piv: "ϖ",
|
||||
OElig: "Œ",
|
||||
oelig: "œ",
|
||||
Scaron: "Š",
|
||||
scaron: "š",
|
||||
Yuml: "Ÿ",
|
||||
fnof: "ƒ",
|
||||
circ: "ˆ",
|
||||
tilde: "˜",
|
||||
ensp: " ",
|
||||
emsp: " ",
|
||||
thinsp: " ",
|
||||
zwnj: "",
|
||||
zwj: "",
|
||||
lrm: "",
|
||||
rlm: "",
|
||||
ndash: "–",
|
||||
mdash: "—",
|
||||
lsquo: "‘",
|
||||
rsquo: "’",
|
||||
sbquo: "‚",
|
||||
ldquo: "“",
|
||||
rdquo: "”",
|
||||
bdquo: "„",
|
||||
dagger: "†",
|
||||
Dagger: "‡",
|
||||
bull: "•",
|
||||
hellip: "…",
|
||||
permil: "‰",
|
||||
prime: "′",
|
||||
Prime: "″",
|
||||
lsaquo: "‹",
|
||||
rsaquo: "›",
|
||||
oline: "‾",
|
||||
euro: "€",
|
||||
trade: "™",
|
||||
larr: "←",
|
||||
uarr: "↑",
|
||||
rarr: "→",
|
||||
darr: "↓",
|
||||
harr: "↔",
|
||||
crarr: "↵",
|
||||
lceil: "⌈",
|
||||
rceil: "⌉",
|
||||
lfloor: "⌊",
|
||||
rfloor: "⌋",
|
||||
loz: "◊",
|
||||
spades: "♠",
|
||||
clubs: "♣",
|
||||
hearts: "♥",
|
||||
diams: "♦"
|
||||
};
|
||||
624
node_modules/xmldom/lib/sax.js
generated
vendored
Normal file
624
node_modules/xmldom/lib/sax.js
generated
vendored
Normal file
@ -0,0 +1,624 @@
|
||||
//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
||||
//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
|
||||
//[5] Name ::= NameStartChar (NameChar)*
|
||||
var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF
|
||||
var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
|
||||
var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$');
|
||||
//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/
|
||||
//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')
|
||||
|
||||
//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
|
||||
//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
|
||||
var S_TAG = 0;//tag name offerring
|
||||
var S_ATTR = 1;//attr name offerring
|
||||
var S_ATTR_SPACE=2;//attr name end and space offer
|
||||
var S_EQ = 3;//=space?
|
||||
var S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)
|
||||
var S_ATTR_END = 5;//attr value end and no space(quot end)
|
||||
var S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer)
|
||||
var S_TAG_CLOSE = 7;//closed el<el />
|
||||
|
||||
function XMLReader(){
|
||||
|
||||
}
|
||||
|
||||
XMLReader.prototype = {
|
||||
parse:function(source,defaultNSMap,entityMap){
|
||||
var domBuilder = this.domBuilder;
|
||||
domBuilder.startDocument();
|
||||
_copy(defaultNSMap ,defaultNSMap = {})
|
||||
parse(source,defaultNSMap,entityMap,
|
||||
domBuilder,this.errorHandler);
|
||||
domBuilder.endDocument();
|
||||
}
|
||||
}
|
||||
function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
function fixedFromCharCode(code) {
|
||||
// String.prototype.fromCharCode does not supports
|
||||
// > 2 bytes unicode chars directly
|
||||
if (code > 0xffff) {
|
||||
code -= 0x10000;
|
||||
var surrogate1 = 0xd800 + (code >> 10)
|
||||
, surrogate2 = 0xdc00 + (code & 0x3ff);
|
||||
|
||||
return String.fromCharCode(surrogate1, surrogate2);
|
||||
} else {
|
||||
return String.fromCharCode(code);
|
||||
}
|
||||
}
|
||||
function entityReplacer(a){
|
||||
var k = a.slice(1,-1);
|
||||
if(k in entityMap){
|
||||
return entityMap[k];
|
||||
}else if(k.charAt(0) === '#'){
|
||||
return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))
|
||||
}else{
|
||||
errorHandler.error('entity not found:'+a);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
function appendText(end){//has some bugs
|
||||
if(end>start){
|
||||
var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer);
|
||||
locator&&position(start);
|
||||
domBuilder.characters(xt,0,end-start);
|
||||
start = end
|
||||
}
|
||||
}
|
||||
function position(p,m){
|
||||
while(p>=lineEnd && (m = linePattern.exec(source))){
|
||||
lineStart = m.index;
|
||||
lineEnd = lineStart + m[0].length;
|
||||
locator.lineNumber++;
|
||||
//console.log('line++:',locator,startPos,endPos)
|
||||
}
|
||||
locator.columnNumber = p-lineStart+1;
|
||||
}
|
||||
var lineStart = 0;
|
||||
var lineEnd = 0;
|
||||
var linePattern = /.*(?:\r\n?|\n)|.*$/g
|
||||
var locator = domBuilder.locator;
|
||||
|
||||
var parseStack = [{currentNSMap:defaultNSMapCopy}]
|
||||
var closeMap = {};
|
||||
var start = 0;
|
||||
while(true){
|
||||
try{
|
||||
var tagStart = source.indexOf('<',start);
|
||||
if(tagStart<0){
|
||||
if(!source.substr(start).match(/^\s*$/)){
|
||||
var doc = domBuilder.doc;
|
||||
var text = doc.createTextNode(source.substr(start));
|
||||
doc.appendChild(text);
|
||||
domBuilder.currentElement = text;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(tagStart>start){
|
||||
appendText(tagStart);
|
||||
}
|
||||
switch(source.charAt(tagStart+1)){
|
||||
case '/':
|
||||
var end = source.indexOf('>',tagStart+3);
|
||||
var tagName = source.substring(tagStart+2,end);
|
||||
var config = parseStack.pop();
|
||||
if(end<0){
|
||||
|
||||
tagName = source.substring(tagStart+2).replace(/[\s<].*/,'');
|
||||
//console.error('#@@@@@@'+tagName)
|
||||
errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName);
|
||||
end = tagStart+1+tagName.length;
|
||||
}else if(tagName.match(/\s</)){
|
||||
tagName = tagName.replace(/[\s<].*/,'');
|
||||
errorHandler.error("end tag name: "+tagName+' maybe not complete');
|
||||
end = tagStart+1+tagName.length;
|
||||
}
|
||||
//console.error(parseStack.length,parseStack)
|
||||
//console.error(config);
|
||||
var localNSMap = config.localNSMap;
|
||||
var endMatch = config.tagName == tagName;
|
||||
var endIgnoreCaseMach = endMatch || config.tagName&&config.tagName.toLowerCase() == tagName.toLowerCase()
|
||||
if(endIgnoreCaseMach){
|
||||
domBuilder.endElement(config.uri,config.localName,tagName);
|
||||
if(localNSMap){
|
||||
for(var prefix in localNSMap){
|
||||
domBuilder.endPrefixMapping(prefix) ;
|
||||
}
|
||||
}
|
||||
if(!endMatch){
|
||||
errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName );
|
||||
}
|
||||
}else{
|
||||
parseStack.push(config)
|
||||
}
|
||||
|
||||
end++;
|
||||
break;
|
||||
// end elment
|
||||
case '?':// <?...?>
|
||||
locator&&position(tagStart);
|
||||
end = parseInstruction(source,tagStart,domBuilder);
|
||||
break;
|
||||
case '!':// <!doctype,<![CDATA,<!--
|
||||
locator&&position(tagStart);
|
||||
end = parseDCC(source,tagStart,domBuilder,errorHandler);
|
||||
break;
|
||||
default:
|
||||
locator&&position(tagStart);
|
||||
var el = new ElementAttributes();
|
||||
var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
|
||||
//elStartEnd
|
||||
var end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler);
|
||||
var len = el.length;
|
||||
|
||||
|
||||
if(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){
|
||||
el.closed = true;
|
||||
if(!entityMap.nbsp){
|
||||
errorHandler.warning('unclosed xml attribute');
|
||||
}
|
||||
}
|
||||
if(locator && len){
|
||||
var locator2 = copyLocator(locator,{});
|
||||
//try{//attribute position fixed
|
||||
for(var i = 0;i<len;i++){
|
||||
var a = el[i];
|
||||
position(a.offset);
|
||||
a.locator = copyLocator(locator,{});
|
||||
}
|
||||
//}catch(e){console.error('@@@@@'+e)}
|
||||
domBuilder.locator = locator2
|
||||
if(appendElement(el,domBuilder,currentNSMap)){
|
||||
parseStack.push(el)
|
||||
}
|
||||
domBuilder.locator = locator;
|
||||
}else{
|
||||
if(appendElement(el,domBuilder,currentNSMap)){
|
||||
parseStack.push(el)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){
|
||||
end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder)
|
||||
}else{
|
||||
end++;
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
errorHandler.error('element parse error: '+e)
|
||||
//errorHandler.error('element parse error: '+e);
|
||||
end = -1;
|
||||
//throw e;
|
||||
}
|
||||
if(end>start){
|
||||
start = end;
|
||||
}else{
|
||||
//TODO: 这里有可能sax回退,有位置错误风险
|
||||
appendText(Math.max(tagStart,start)+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function copyLocator(f,t){
|
||||
t.lineNumber = f.lineNumber;
|
||||
t.columnNumber = f.columnNumber;
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);
|
||||
* @return end of the elementStartPart(end of elementEndPart for selfClosed el)
|
||||
*/
|
||||
function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){
|
||||
var attrName;
|
||||
var value;
|
||||
var p = ++start;
|
||||
var s = S_TAG;//status
|
||||
while(true){
|
||||
var c = source.charAt(p);
|
||||
switch(c){
|
||||
case '=':
|
||||
if(s === S_ATTR){//attrName
|
||||
attrName = source.slice(start,p);
|
||||
s = S_EQ;
|
||||
}else if(s === S_ATTR_SPACE){
|
||||
s = S_EQ;
|
||||
}else{
|
||||
//fatalError: equal must after attrName or space after attrName
|
||||
throw new Error('attribute equal must after attrName');
|
||||
}
|
||||
break;
|
||||
case '\'':
|
||||
case '"':
|
||||
if(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE
|
||||
){//equal
|
||||
if(s === S_ATTR){
|
||||
errorHandler.warning('attribute value must after "="')
|
||||
attrName = source.slice(start,p)
|
||||
}
|
||||
start = p+1;
|
||||
p = source.indexOf(c,start)
|
||||
if(p>0){
|
||||
value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
|
||||
el.add(attrName,value,start-1);
|
||||
s = S_ATTR_END;
|
||||
}else{
|
||||
//fatalError: no end quot match
|
||||
throw new Error('attribute value no end \''+c+'\' match');
|
||||
}
|
||||
}else if(s == S_ATTR_NOQUOT_VALUE){
|
||||
value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
|
||||
//console.log(attrName,value,start,p)
|
||||
el.add(attrName,value,start);
|
||||
//console.dir(el)
|
||||
errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!');
|
||||
start = p+1;
|
||||
s = S_ATTR_END
|
||||
}else{
|
||||
//fatalError: no equal before
|
||||
throw new Error('attribute value must after "="');
|
||||
}
|
||||
break;
|
||||
case '/':
|
||||
switch(s){
|
||||
case S_TAG:
|
||||
el.setTagName(source.slice(start,p));
|
||||
case S_ATTR_END:
|
||||
case S_TAG_SPACE:
|
||||
case S_TAG_CLOSE:
|
||||
s =S_TAG_CLOSE;
|
||||
el.closed = true;
|
||||
case S_ATTR_NOQUOT_VALUE:
|
||||
case S_ATTR:
|
||||
case S_ATTR_SPACE:
|
||||
break;
|
||||
//case S_EQ:
|
||||
default:
|
||||
throw new Error("attribute invalid close char('/')")
|
||||
}
|
||||
break;
|
||||
case ''://end document
|
||||
//throw new Error('unexpected end of input')
|
||||
errorHandler.error('unexpected end of input');
|
||||
if(s == S_TAG){
|
||||
el.setTagName(source.slice(start,p));
|
||||
}
|
||||
return p;
|
||||
case '>':
|
||||
switch(s){
|
||||
case S_TAG:
|
||||
el.setTagName(source.slice(start,p));
|
||||
case S_ATTR_END:
|
||||
case S_TAG_SPACE:
|
||||
case S_TAG_CLOSE:
|
||||
break;//normal
|
||||
case S_ATTR_NOQUOT_VALUE://Compatible state
|
||||
case S_ATTR:
|
||||
value = source.slice(start,p);
|
||||
if(value.slice(-1) === '/'){
|
||||
el.closed = true;
|
||||
value = value.slice(0,-1)
|
||||
}
|
||||
case S_ATTR_SPACE:
|
||||
if(s === S_ATTR_SPACE){
|
||||
value = attrName;
|
||||
}
|
||||
if(s == S_ATTR_NOQUOT_VALUE){
|
||||
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
|
||||
el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start)
|
||||
}else{
|
||||
if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !value.match(/^(?:disabled|checked|selected)$/i)){
|
||||
errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
|
||||
}
|
||||
el.add(value,value,start)
|
||||
}
|
||||
break;
|
||||
case S_EQ:
|
||||
throw new Error('attribute value missed!!');
|
||||
}
|
||||
// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName))
|
||||
return p;
|
||||
/*xml space '\x20' | #x9 | #xD | #xA; */
|
||||
case '\u0080':
|
||||
c = ' ';
|
||||
default:
|
||||
if(c<= ' '){//space
|
||||
switch(s){
|
||||
case S_TAG:
|
||||
el.setTagName(source.slice(start,p));//tagName
|
||||
s = S_TAG_SPACE;
|
||||
break;
|
||||
case S_ATTR:
|
||||
attrName = source.slice(start,p)
|
||||
s = S_ATTR_SPACE;
|
||||
break;
|
||||
case S_ATTR_NOQUOT_VALUE:
|
||||
var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
|
||||
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
|
||||
el.add(attrName,value,start)
|
||||
case S_ATTR_END:
|
||||
s = S_TAG_SPACE;
|
||||
break;
|
||||
//case S_TAG_SPACE:
|
||||
//case S_EQ:
|
||||
//case S_ATTR_SPACE:
|
||||
// void();break;
|
||||
//case S_TAG_CLOSE:
|
||||
//ignore warning
|
||||
}
|
||||
}else{//not space
|
||||
//S_TAG, S_ATTR, S_EQ, S_ATTR_NOQUOT_VALUE
|
||||
//S_ATTR_SPACE, S_ATTR_END, S_TAG_SPACE, S_TAG_CLOSE
|
||||
switch(s){
|
||||
//case S_TAG:void();break;
|
||||
//case S_ATTR:void();break;
|
||||
//case S_ATTR_NOQUOT_VALUE:void();break;
|
||||
case S_ATTR_SPACE:
|
||||
var tagName = el.tagName;
|
||||
if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !attrName.match(/^(?:disabled|checked|selected)$/i)){
|
||||
errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!')
|
||||
}
|
||||
el.add(attrName,attrName,start);
|
||||
start = p;
|
||||
s = S_ATTR;
|
||||
break;
|
||||
case S_ATTR_END:
|
||||
errorHandler.warning('attribute space is required"'+attrName+'"!!')
|
||||
case S_TAG_SPACE:
|
||||
s = S_ATTR;
|
||||
start = p;
|
||||
break;
|
||||
case S_EQ:
|
||||
s = S_ATTR_NOQUOT_VALUE;
|
||||
start = p;
|
||||
break;
|
||||
case S_TAG_CLOSE:
|
||||
throw new Error("elements closed character '/' and '>' must be connected to");
|
||||
}
|
||||
}
|
||||
}//end outer switch
|
||||
//console.log('p++',p)
|
||||
p++;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @return true if has new namespace define
|
||||
*/
|
||||
function appendElement(el,domBuilder,currentNSMap){
|
||||
var tagName = el.tagName;
|
||||
var localNSMap = null;
|
||||
//var currentNSMap = parseStack[parseStack.length-1].currentNSMap;
|
||||
var i = el.length;
|
||||
while(i--){
|
||||
var a = el[i];
|
||||
var qName = a.qName;
|
||||
var value = a.value;
|
||||
var nsp = qName.indexOf(':');
|
||||
if(nsp>0){
|
||||
var prefix = a.prefix = qName.slice(0,nsp);
|
||||
var localName = qName.slice(nsp+1);
|
||||
var nsPrefix = prefix === 'xmlns' && localName
|
||||
}else{
|
||||
localName = qName;
|
||||
prefix = null
|
||||
nsPrefix = qName === 'xmlns' && ''
|
||||
}
|
||||
//can not set prefix,because prefix !== ''
|
||||
a.localName = localName ;
|
||||
//prefix == null for no ns prefix attribute
|
||||
if(nsPrefix !== false){//hack!!
|
||||
if(localNSMap == null){
|
||||
localNSMap = {}
|
||||
//console.log(currentNSMap,0)
|
||||
_copy(currentNSMap,currentNSMap={})
|
||||
//console.log(currentNSMap,1)
|
||||
}
|
||||
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
|
||||
a.uri = 'http://www.w3.org/2000/xmlns/'
|
||||
domBuilder.startPrefixMapping(nsPrefix, value)
|
||||
}
|
||||
}
|
||||
var i = el.length;
|
||||
while(i--){
|
||||
a = el[i];
|
||||
var prefix = a.prefix;
|
||||
if(prefix){//no prefix attribute has no namespace
|
||||
if(prefix === 'xml'){
|
||||
a.uri = 'http://www.w3.org/XML/1998/namespace';
|
||||
}if(prefix !== 'xmlns'){
|
||||
a.uri = currentNSMap[prefix || '']
|
||||
|
||||
//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}
|
||||
}
|
||||
}
|
||||
}
|
||||
var nsp = tagName.indexOf(':');
|
||||
if(nsp>0){
|
||||
prefix = el.prefix = tagName.slice(0,nsp);
|
||||
localName = el.localName = tagName.slice(nsp+1);
|
||||
}else{
|
||||
prefix = null;//important!!
|
||||
localName = el.localName = tagName;
|
||||
}
|
||||
//no prefix element has default namespace
|
||||
var ns = el.uri = currentNSMap[prefix || ''];
|
||||
domBuilder.startElement(ns,localName,tagName,el);
|
||||
//endPrefixMapping and startPrefixMapping have not any help for dom builder
|
||||
//localNSMap = null
|
||||
if(el.closed){
|
||||
domBuilder.endElement(ns,localName,tagName);
|
||||
if(localNSMap){
|
||||
for(prefix in localNSMap){
|
||||
domBuilder.endPrefixMapping(prefix)
|
||||
}
|
||||
}
|
||||
}else{
|
||||
el.currentNSMap = currentNSMap;
|
||||
el.localNSMap = localNSMap;
|
||||
//parseStack.push(el);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){
|
||||
if(/^(?:script|textarea)$/i.test(tagName)){
|
||||
var elEndStart = source.indexOf('</'+tagName+'>',elStartEnd);
|
||||
var text = source.substring(elStartEnd+1,elEndStart);
|
||||
if(/[&<]/.test(text)){
|
||||
if(/^script$/i.test(tagName)){
|
||||
//if(!/\]\]>/.test(text)){
|
||||
//lexHandler.startCDATA();
|
||||
domBuilder.characters(text,0,text.length);
|
||||
//lexHandler.endCDATA();
|
||||
return elEndStart;
|
||||
//}
|
||||
}//}else{//text area
|
||||
text = text.replace(/&#?\w+;/g,entityReplacer);
|
||||
domBuilder.characters(text,0,text.length);
|
||||
return elEndStart;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
return elStartEnd+1;
|
||||
}
|
||||
function fixSelfClosed(source,elStartEnd,tagName,closeMap){
|
||||
//if(tagName in closeMap){
|
||||
var pos = closeMap[tagName];
|
||||
if(pos == null){
|
||||
//console.log(tagName)
|
||||
pos = source.lastIndexOf('</'+tagName+'>')
|
||||
if(pos<elStartEnd){//忘记闭合
|
||||
pos = source.lastIndexOf('</'+tagName)
|
||||
}
|
||||
closeMap[tagName] =pos
|
||||
}
|
||||
return pos<elStartEnd;
|
||||
//}
|
||||
}
|
||||
function _copy(source,target){
|
||||
for(var n in source){target[n] = source[n]}
|
||||
}
|
||||
function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
|
||||
var next= source.charAt(start+2)
|
||||
switch(next){
|
||||
case '-':
|
||||
if(source.charAt(start + 3) === '-'){
|
||||
var end = source.indexOf('-->',start+4);
|
||||
//append comment source.substring(4,end)//<!--
|
||||
if(end>start){
|
||||
domBuilder.comment(source,start+4,end-start-4);
|
||||
return end+3;
|
||||
}else{
|
||||
errorHandler.error("Unclosed comment");
|
||||
return -1;
|
||||
}
|
||||
}else{
|
||||
//error
|
||||
return -1;
|
||||
}
|
||||
default:
|
||||
if(source.substr(start+3,6) == 'CDATA['){
|
||||
var end = source.indexOf(']]>',start+9);
|
||||
domBuilder.startCDATA();
|
||||
domBuilder.characters(source,start+9,end-start-9);
|
||||
domBuilder.endCDATA()
|
||||
return end+3;
|
||||
}
|
||||
//<!DOCTYPE
|
||||
//startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
|
||||
var matchs = split(source,start);
|
||||
var len = matchs.length;
|
||||
if(len>1 && /!doctype/i.test(matchs[0][0])){
|
||||
var name = matchs[1][0];
|
||||
var pubid = false;
|
||||
var sysid = false;
|
||||
if(len>3){
|
||||
if(/^public$/i.test(matchs[2][0])){
|
||||
pubid = matchs[3][0];
|
||||
sysid = len>4 && matchs[4][0];
|
||||
}else if(/^system$/i.test(matchs[2][0])){
|
||||
sysid = matchs[3][0];
|
||||
}
|
||||
}
|
||||
var lastMatch = matchs[len-1]
|
||||
domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'),
|
||||
sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2'));
|
||||
domBuilder.endDTD();
|
||||
|
||||
return lastMatch.index+lastMatch[0].length
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function parseInstruction(source,start,domBuilder){
|
||||
var end = source.indexOf('?>',start);
|
||||
if(end){
|
||||
var match = source.substring(start,end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
|
||||
if(match){
|
||||
var len = match[0].length;
|
||||
domBuilder.processingInstruction(match[1], match[2]) ;
|
||||
return end+2;
|
||||
}else{//error
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param source
|
||||
*/
|
||||
function ElementAttributes(source){
|
||||
|
||||
}
|
||||
ElementAttributes.prototype = {
|
||||
setTagName:function(tagName){
|
||||
if(!tagNamePattern.test(tagName)){
|
||||
throw new Error('invalid tagName:'+tagName)
|
||||
}
|
||||
this.tagName = tagName
|
||||
},
|
||||
add:function(qName,value,offset){
|
||||
if(!tagNamePattern.test(qName)){
|
||||
throw new Error('invalid attribute:'+qName)
|
||||
}
|
||||
this[this.length++] = {qName:qName,value:value,offset:offset}
|
||||
},
|
||||
length:0,
|
||||
getLocalName:function(i){return this[i].localName},
|
||||
getLocator:function(i){return this[i].locator},
|
||||
getQName:function(i){return this[i].qName},
|
||||
getURI:function(i){return this[i].uri},
|
||||
getValue:function(i){return this[i].value}
|
||||
// ,getIndex:function(uri, localName)){
|
||||
// if(localName){
|
||||
//
|
||||
// }else{
|
||||
// var qName = uri
|
||||
// }
|
||||
// },
|
||||
// getValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},
|
||||
// getType:function(uri,localName){}
|
||||
// getType:function(i){},
|
||||
}
|
||||
|
||||
|
||||
|
||||
function split(source,start){
|
||||
var match;
|
||||
var buf = [];
|
||||
var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
|
||||
reg.lastIndex = start;
|
||||
reg.exec(source);//skip <
|
||||
while(match = reg.exec(source)){
|
||||
buf.push(match);
|
||||
if(match[1])return buf;
|
||||
}
|
||||
}
|
||||
|
||||
exports.XMLReader = XMLReader;
|
||||
|
||||
94
node_modules/xmldom/package.json
generated
vendored
Normal file
94
node_modules/xmldom/package.json
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
"name": "xmldom",
|
||||
"version": "0.4.0",
|
||||
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
|
||||
"keywords": [
|
||||
"w3c",
|
||||
"dom",
|
||||
"xml",
|
||||
"parser",
|
||||
"javascript",
|
||||
"DOMParser",
|
||||
"XMLSerializer"
|
||||
],
|
||||
"author": "jindw <jindw@xidea.org> (http://www.xidea.org)",
|
||||
"homepage": "https://github.com/xmldom/xmldom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/xmldom/xmldom.git"
|
||||
},
|
||||
"main": "lib/dom-parser.js",
|
||||
"files": [
|
||||
"CHANGELOG.md",
|
||||
"LICENSE.md",
|
||||
"readme.md",
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "npm-run-all lint:eslint",
|
||||
"lint:eslint": "eslint lib test",
|
||||
"start": "nodemon --watch package.json --watch lib --watch test --exec 'npm --silent run test'",
|
||||
"stryker": "stryker run",
|
||||
"test": "npm-run-all test:unit lint",
|
||||
"test:unit": "npm-run-all test:jest",
|
||||
"test:jest": "jest"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@stryker-mutator/core": "^3.3.1",
|
||||
"@stryker-mutator/javascript-mutator": "^3.3.1",
|
||||
"dom-js": "0.0.9",
|
||||
"eslint": "^7.12.0",
|
||||
"eslint-config-prettier": "^6.14.0",
|
||||
"eslint-plugin-es5": "^1.5.0",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"get-stream": "^6.0.0",
|
||||
"jest": "^26.6.1",
|
||||
"nodemon": "^2.0.6",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.1.2",
|
||||
"xmltest": "^1.4.0",
|
||||
"yauzl": "^2.10.0"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "brodybits",
|
||||
"email": "chris@brody.consulting",
|
||||
"url": "https://github.com/brodybits"
|
||||
}
|
||||
],
|
||||
"contributors": [
|
||||
{
|
||||
"name": "jindw",
|
||||
"email": "jindw@xidea.org",
|
||||
"url": "http://www.xidea.org"
|
||||
},
|
||||
{
|
||||
"name": "Yaron Naveh",
|
||||
"email": "yaronn01@gmail.com",
|
||||
"web": "http://webservices20.blogspot.com/"
|
||||
},
|
||||
{
|
||||
"name": "Harutyun Amirjanyan",
|
||||
"email": "amirjanyan@gmail.com",
|
||||
"web": "https://github.com/nightwing"
|
||||
},
|
||||
{
|
||||
"name": "Alan Gutierrez",
|
||||
"email": "alan@prettyrobots.com",
|
||||
"web": "http://www.prettyrobots.com/"
|
||||
},
|
||||
{
|
||||
"name": "Eric Newport",
|
||||
"email": "kethinov@gmail.com",
|
||||
"web": "https://github.com/kethinov"
|
||||
}
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/xmldom/xmldom/issues"
|
||||
},
|
||||
"license": "(LGPL-2.0 OR MIT)"
|
||||
}
|
||||
237
node_modules/xmldom/readme.md
generated
vendored
Normal file
237
node_modules/xmldom/readme.md
generated
vendored
Normal file
@ -0,0 +1,237 @@
|
||||
# XMLDOM
|
||||
|
||||
[](./LICENSE.md)
|
||||
[](https://www.npmjs.com/package/xmldom)
|
||||
[](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
|
||||
[](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
|
||||
[](https://dashboard.stryker-mutator.io/reports/github.com/brodybits/xmldom/master)
|
||||
|
||||
A JavaScript implementation of W3C DOM for Node.js, Rhino and the browser. Fully
|
||||
compatible with `W3C DOM level2`; and some compatible with `level3`. Supports
|
||||
`DOMParser` and `XMLSerializer` interface such as in browser.
|
||||
|
||||
**Original project location:** <https://github.com/jindw/xmldom>
|
||||
|
||||
Install:
|
||||
-------
|
||||
>npm install xmldom
|
||||
|
||||
Example:
|
||||
====
|
||||
```javascript
|
||||
const { DOMParser } = require('xmldom')
|
||||
|
||||
const doc = new DOMParser().parseFromString(
|
||||
'<xml xmlns="a" xmlns:c="./lite">\n' +
|
||||
'\t<child>test</child>\n' +
|
||||
'\t<child></child>\n' +
|
||||
'\t<child/>\n' +
|
||||
'</xml>',
|
||||
'text/xml'
|
||||
)
|
||||
doc.documentElement.setAttribute('x', 'y')
|
||||
doc.documentElement.setAttributeNS('./lite', 'c:x', 'y2')
|
||||
console.info(doc)
|
||||
|
||||
const nsAttr = doc.documentElement.getAttributeNS('./lite', 'x')
|
||||
console.info(nsAttr)
|
||||
```
|
||||
|
||||
Note: in Typescript and ES6 you can use the import approach, as follows:
|
||||
|
||||
```javascript
|
||||
import { DOMParser } from 'xmldom'
|
||||
```
|
||||
|
||||
API Reference
|
||||
=====
|
||||
|
||||
* [DOMParser](https://developer.mozilla.org/en/DOMParser):
|
||||
|
||||
```javascript
|
||||
parseFromString(xmlsource,mimeType)
|
||||
```
|
||||
* **options extension** _by xmldom_(not BOM standard!!)
|
||||
|
||||
```javascript
|
||||
//added the options argument
|
||||
new DOMParser(options)
|
||||
|
||||
//errorHandler is supported
|
||||
new DOMParser({
|
||||
/**
|
||||
* locator is always need for error position info
|
||||
*/
|
||||
locator:{},
|
||||
/**
|
||||
* you can override the errorHandler for xml parser
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
|
||||
*/
|
||||
errorHandler:{warning:function(w){console.warn(w)},error:callback,fatalError:callback}
|
||||
//only callback model
|
||||
//errorHandler:function(level,msg){console.log(level,msg)}
|
||||
})
|
||||
|
||||
```
|
||||
|
||||
* [XMLSerializer](https://developer.mozilla.org/en/XMLSerializer)
|
||||
|
||||
```javascript
|
||||
serializeToString(node)
|
||||
```
|
||||
DOM level2 method and attribute:
|
||||
------
|
||||
|
||||
* [Node](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247)
|
||||
|
||||
attribute:
|
||||
nodeValue|prefix
|
||||
readonly attribute:
|
||||
nodeName|nodeType|parentNode|childNodes|firstChild|lastChild|previousSibling|nextSibling|attributes|ownerDocument|namespaceURI|localName
|
||||
method:
|
||||
insertBefore(newChild, refChild)
|
||||
replaceChild(newChild, oldChild)
|
||||
removeChild(oldChild)
|
||||
appendChild(newChild)
|
||||
hasChildNodes()
|
||||
cloneNode(deep)
|
||||
normalize()
|
||||
isSupported(feature, version)
|
||||
hasAttributes()
|
||||
|
||||
* [DOMImplementation](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-102161490)
|
||||
|
||||
method:
|
||||
hasFeature(feature, version)
|
||||
createDocumentType(qualifiedName, publicId, systemId)
|
||||
createDocument(namespaceURI, qualifiedName, doctype)
|
||||
|
||||
* [Document](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#i-Document) : Node
|
||||
|
||||
readonly attribute:
|
||||
doctype|implementation|documentElement
|
||||
method:
|
||||
createElement(tagName)
|
||||
createDocumentFragment()
|
||||
createTextNode(data)
|
||||
createComment(data)
|
||||
createCDATASection(data)
|
||||
createProcessingInstruction(target, data)
|
||||
createAttribute(name)
|
||||
createEntityReference(name)
|
||||
getElementsByTagName(tagname)
|
||||
importNode(importedNode, deep)
|
||||
createElementNS(namespaceURI, qualifiedName)
|
||||
createAttributeNS(namespaceURI, qualifiedName)
|
||||
getElementsByTagNameNS(namespaceURI, localName)
|
||||
getElementById(elementId)
|
||||
|
||||
* [DocumentFragment](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-B63ED1A3) : Node
|
||||
* [Element](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-745549614) : Node
|
||||
|
||||
readonly attribute:
|
||||
tagName
|
||||
method:
|
||||
getAttribute(name)
|
||||
setAttribute(name, value)
|
||||
removeAttribute(name)
|
||||
getAttributeNode(name)
|
||||
setAttributeNode(newAttr)
|
||||
removeAttributeNode(oldAttr)
|
||||
getElementsByTagName(name)
|
||||
getAttributeNS(namespaceURI, localName)
|
||||
setAttributeNS(namespaceURI, qualifiedName, value)
|
||||
removeAttributeNS(namespaceURI, localName)
|
||||
getAttributeNodeNS(namespaceURI, localName)
|
||||
setAttributeNodeNS(newAttr)
|
||||
getElementsByTagNameNS(namespaceURI, localName)
|
||||
hasAttribute(name)
|
||||
hasAttributeNS(namespaceURI, localName)
|
||||
|
||||
* [Attr](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-637646024) : Node
|
||||
|
||||
attribute:
|
||||
value
|
||||
readonly attribute:
|
||||
name|specified|ownerElement
|
||||
|
||||
* [NodeList](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177)
|
||||
|
||||
readonly attribute:
|
||||
length
|
||||
method:
|
||||
item(index)
|
||||
|
||||
* [NamedNodeMap](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1780488922)
|
||||
|
||||
readonly attribute:
|
||||
length
|
||||
method:
|
||||
getNamedItem(name)
|
||||
setNamedItem(arg)
|
||||
removeNamedItem(name)
|
||||
item(index)
|
||||
getNamedItemNS(namespaceURI, localName)
|
||||
setNamedItemNS(arg)
|
||||
removeNamedItemNS(namespaceURI, localName)
|
||||
|
||||
* [CharacterData](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-FF21A306) : Node
|
||||
|
||||
method:
|
||||
substringData(offset, count)
|
||||
appendData(arg)
|
||||
insertData(offset, arg)
|
||||
deleteData(offset, count)
|
||||
replaceData(offset, count, arg)
|
||||
|
||||
* [Text](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1312295772) : CharacterData
|
||||
|
||||
method:
|
||||
splitText(offset)
|
||||
|
||||
* [CDATASection](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-667469212)
|
||||
* [Comment](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1728279322) : CharacterData
|
||||
|
||||
* [DocumentType](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-412266927)
|
||||
|
||||
readonly attribute:
|
||||
name|entities|notations|publicId|systemId|internalSubset
|
||||
|
||||
* Notation : Node
|
||||
|
||||
readonly attribute:
|
||||
publicId|systemId
|
||||
|
||||
* Entity : Node
|
||||
|
||||
readonly attribute:
|
||||
publicId|systemId|notationName
|
||||
|
||||
* EntityReference : Node
|
||||
* ProcessingInstruction : Node
|
||||
|
||||
attribute:
|
||||
data
|
||||
readonly attribute:
|
||||
target
|
||||
|
||||
DOM level 3 support:
|
||||
-----
|
||||
|
||||
* [Node](http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent)
|
||||
|
||||
attribute:
|
||||
textContent
|
||||
method:
|
||||
isDefaultNamespace(namespaceURI){
|
||||
lookupNamespaceURI(prefix)
|
||||
|
||||
DOM extension by xmldom
|
||||
---
|
||||
* [Node] Source position extension;
|
||||
|
||||
attribute:
|
||||
//Numbered starting from '1'
|
||||
lineNumber
|
||||
//Numbered starting from '1'
|
||||
columnNumber
|
||||
11772
package-lock.json
generated
11772
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "maven-settings-action",
|
||||
"version": "1.0.0",
|
||||
"version": "2.3.0",
|
||||
"description": "Prepare maven settings",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -24,12 +24,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/s4u/maven-settings-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.2",
|
||||
"xmldom": "^0.2.1",
|
||||
"xpath": "0.0.27"
|
||||
"@actions/core": "^1.2.6",
|
||||
"xmldom": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.1.0"
|
||||
"eslint": "^7.16.0",
|
||||
"jest": "^26.6.3"
|
||||
}
|
||||
}
|
||||
|
||||
176
settings.js
176
settings.js
@ -28,15 +28,13 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const DOMParser = require('xmldom').DOMParser;
|
||||
const XMLSerializer = require('xmldom').XMLSerializer;
|
||||
const xpath = require('xpath');
|
||||
|
||||
|
||||
function getSettingsPath() {
|
||||
return path.join(os.homedir(), '.m2', 'settings.xml');
|
||||
}
|
||||
|
||||
function getSettingsTemplate() {
|
||||
const templatePath = path.join(__dirname, 'templates', 'settings.xml');
|
||||
function getTemplate(templateName) {
|
||||
const templatePath = path.join(__dirname, 'templates', templateName);
|
||||
const templateStr = fs.readFileSync(templatePath).toString();
|
||||
return new DOMParser().parseFromString(templateStr, 'text/xml');
|
||||
}
|
||||
@ -52,63 +50,155 @@ function writeSettings(settingsPath, templateXml) {
|
||||
fs.writeFileSync(settingsPath, settingStr);
|
||||
}
|
||||
|
||||
function fillServers(template) {
|
||||
function jsonToXml(templateXml, xmlTag, json) {
|
||||
for (const key in json) {
|
||||
const keyXml = templateXml.createElement(key);
|
||||
const value = json[key];
|
||||
if ( value instanceof Object) {
|
||||
jsonToXml(templateXml, keyXml, value);
|
||||
} else {
|
||||
keyXml.textContent = value;
|
||||
}
|
||||
xmlTag.appendChild(keyXml);
|
||||
}
|
||||
}
|
||||
|
||||
const servers = core.getInput('servers');
|
||||
function fillServer(templateXml, templateName, id, username, password, configurations) {
|
||||
|
||||
if (!id || ((!username || !password) && !configurations) ) {
|
||||
core.setFailed(templateName + ' must contain id, (username and password) or configuration');
|
||||
return;
|
||||
}
|
||||
|
||||
const serverXml = getTemplate(templateName + '.xml')
|
||||
serverXml.getElementsByTagName('id')[0].textContent = id;
|
||||
|
||||
const usernameTag = serverXml.getElementsByTagName('username')[0];
|
||||
if (username) {
|
||||
usernameTag.textContent = username;
|
||||
} else {
|
||||
serverXml.documentElement.removeChild(usernameTag);
|
||||
}
|
||||
|
||||
const passwordTag = serverXml.getElementsByTagName('password')[0];
|
||||
if (password) {
|
||||
passwordTag.textContent = password;
|
||||
} else {
|
||||
serverXml.documentElement.removeChild(passwordTag);
|
||||
}
|
||||
|
||||
const configurationTag = serverXml.getElementsByTagName('configuration')[0];
|
||||
if (configurations) {
|
||||
jsonToXml(templateXml, configurationTag, configurations);
|
||||
} else {
|
||||
if (configurationTag.childNodes.length == 0) {
|
||||
serverXml.documentElement.removeChild(configurationTag);
|
||||
}
|
||||
}
|
||||
|
||||
const serversXml = templateXml.getElementsByTagName('servers')[0];
|
||||
serversXml.appendChild(serverXml);
|
||||
}
|
||||
|
||||
function fillServers(template, templateName) {
|
||||
|
||||
const servers = core.getInput(templateName);
|
||||
|
||||
if (!servers) {
|
||||
return;
|
||||
}
|
||||
|
||||
const serversXml = template.getElementsByTagName('servers')[0];
|
||||
|
||||
JSON.parse(servers).forEach((server) => {
|
||||
|
||||
const serverXml = template.createElement('server');
|
||||
serversXml.appendChild(serverXml);
|
||||
|
||||
for (const key in server) {
|
||||
const keyXml = template.createElement(key);
|
||||
keyXml.textContent = server[key];
|
||||
serverXml.appendChild(keyXml);
|
||||
}
|
||||
});
|
||||
JSON.parse(servers).forEach((server) =>
|
||||
fillServer(template, templateName, server.id, server.username, server.password, server.configuration));
|
||||
}
|
||||
|
||||
function activateProfile(template, profileId) {
|
||||
const activeByDefault = xpath
|
||||
.select(`/settings/profiles/profile[id[contains(text(),"${profileId}")]]/activation/activeByDefault`, template);
|
||||
function fillMirror(template, id, name, mirrorOf, url) {
|
||||
|
||||
if (activeByDefault) {
|
||||
activeByDefault[0].textContent = 'true';
|
||||
if (!id || !name || !mirrorOf || !url) {
|
||||
core.setFailed('mirrors must contain id, name, mirrorOf and url');
|
||||
return;
|
||||
}
|
||||
|
||||
const mirrorXml = getTemplate('mirrors.xml');
|
||||
mirrorXml.getElementsByTagName('id')[0].textContent = id;
|
||||
mirrorXml.getElementsByTagName('name')[0].textContent = name;
|
||||
mirrorXml.getElementsByTagName('mirrorOf')[0].textContent = mirrorOf;
|
||||
mirrorXml.getElementsByTagName('url')[0].textContent = url;
|
||||
|
||||
const mirrorsXml = template.getElementsByTagName('mirrors')[0];
|
||||
mirrorsXml.appendChild(mirrorXml);
|
||||
}
|
||||
|
||||
function fillMirrors(template) {
|
||||
|
||||
const mirrors = core.getInput('mirrors');
|
||||
|
||||
if (!mirrors) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSON.parse(mirrors).forEach((mirror) => fillMirror(template, mirror.id, mirror.name, mirror.mirrorOf, mirror.url));
|
||||
}
|
||||
|
||||
function isInputTrue(inputName) {
|
||||
const val = core.getInput(inputName);
|
||||
return val && val.toLocaleLowerCase() == 'true';
|
||||
}
|
||||
|
||||
function fillServerForGithub(templateXml) {
|
||||
|
||||
if (!isInputTrue('githubServer')) {
|
||||
return;
|
||||
}
|
||||
|
||||
fillServer(templateXml, 'servers', 'github', '${env.GITHUB_ACTOR}', '${env.GITHUB_TOKEN}');
|
||||
}
|
||||
|
||||
function fillProperties(template) {
|
||||
|
||||
const properties = core.getInput('properties');
|
||||
|
||||
if (!properties) {
|
||||
return;
|
||||
}
|
||||
|
||||
activateProfile(template, '_properties_')
|
||||
const propertiesXml = xpath
|
||||
.select(`/settings/profiles/profile[id[contains(text(),"_properties_")]]/properties`, template)[0];
|
||||
const propertiesProfileXml = getTemplate('properties.xml');
|
||||
const propertiesXml = propertiesProfileXml.getElementsByTagName('properties')[0];
|
||||
|
||||
JSON.parse(properties).forEach((property) => {
|
||||
|
||||
for (const key in property) {
|
||||
const keyXml = template.createElement(key);
|
||||
keyXml.textContent = property[key];
|
||||
propertiesXml.appendChild(keyXml);
|
||||
}
|
||||
});
|
||||
|
||||
const profilesXml = template.getElementsByTagName('profiles')[0];
|
||||
profilesXml.appendChild(propertiesProfileXml);
|
||||
|
||||
}
|
||||
|
||||
function addProfile(template, profileName) {
|
||||
const sonatypeXml = getTemplate(profileName);
|
||||
const profilesXml = template.getElementsByTagName('profiles')[0];
|
||||
profilesXml.appendChild(sonatypeXml);
|
||||
}
|
||||
|
||||
function addApacheSnapshots(template) {
|
||||
if (isInputTrue('apacheSnapshots')) {
|
||||
addProfile(template, 'apache-snapshot.xml')
|
||||
}
|
||||
}
|
||||
|
||||
function addSonatypeSnapshots(template) {
|
||||
const val = core.getInput('sonatypeSnapshots');
|
||||
if (val && val.toLocaleLowerCase() == 'true') {
|
||||
activateProfile(template, '_sonatype-snapshots_')
|
||||
if (isInputTrue('sonatypeSnapshots')) {
|
||||
addProfile(template, 'sonatype-snapshot.xml')
|
||||
}
|
||||
}
|
||||
|
||||
function addOracleRepo(template) {
|
||||
if (isInputTrue('oracleRepo')) {
|
||||
addProfile(template, 'oracle-repo.xml')
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,8 +209,7 @@ function generate() {
|
||||
core.info('Prepare maven setings: ' + settingsPath);
|
||||
|
||||
if (fs.existsSync(settingsPath)) {
|
||||
const val = core.getInput("override");
|
||||
if (val && val.toLocaleLowerCase() == 'true') {
|
||||
if (isInputTrue('override')) {
|
||||
core.info('maven settings.xml already exists - override');
|
||||
} else {
|
||||
core.warning('maven settings.xml already exists - skip');
|
||||
@ -128,11 +217,16 @@ function generate() {
|
||||
}
|
||||
}
|
||||
|
||||
const templateXml = getSettingsTemplate();
|
||||
fillServers(templateXml);
|
||||
fillProperties(templateXml);
|
||||
addSonatypeSnapshots(templateXml);
|
||||
writeSettings(settingsPath, templateXml);
|
||||
const settingsXml = getTemplate('settings.xml');
|
||||
fillMirrors(settingsXml);
|
||||
fillServers(settingsXml, 'servers');
|
||||
fillServers(settingsXml, 'oracleServers');
|
||||
fillServerForGithub(settingsXml);
|
||||
fillProperties(settingsXml);
|
||||
addApacheSnapshots(settingsXml);
|
||||
addSonatypeSnapshots(settingsXml);
|
||||
addOracleRepo(settingsXml);
|
||||
writeSettings(settingsPath, settingsXml);
|
||||
core.saveState('maven-settings', 'ok');
|
||||
}
|
||||
|
||||
@ -153,11 +247,15 @@ function cleanup() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSettingsTemplate,
|
||||
getTemplate,
|
||||
writeSettings,
|
||||
fillMirrors,
|
||||
fillServers,
|
||||
fillServerForGithub,
|
||||
fillProperties,
|
||||
addApacheSnapshots,
|
||||
addSonatypeSnapshots,
|
||||
addOracleRepo,
|
||||
generate,
|
||||
cleanup
|
||||
}
|
||||
|
||||
440
settings.test.js
440
settings.test.js
@ -87,7 +87,7 @@ afterAll(() => {
|
||||
afterEach(() => {
|
||||
|
||||
for (key in process.env) {
|
||||
if (key.match(/^INPUT_/)) {
|
||||
if (key.match(/^INPUT_/) || key.match(/^GITHUB_/)) {
|
||||
delete process.env[key];
|
||||
}
|
||||
}
|
||||
@ -99,8 +99,7 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
test('template should be read', () => {
|
||||
|
||||
const template = settings.getSettingsTemplate();
|
||||
const template = settings.getTemplate('settings.xml');
|
||||
|
||||
expect(template).toBeDefined();
|
||||
});
|
||||
@ -122,7 +121,7 @@ test('fillServers do nothing if no params', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
settings.fillServers(xml);
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
@ -133,16 +132,96 @@ test('fillServers one server', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
|
||||
|
||||
settings.fillServers(xml);
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '');
|
||||
|
||||
expect(xmlStr).toBe("<servers>" +
|
||||
"<server><id>id1</id><username>username1</username><password>password1</password></server>" +
|
||||
"</servers>");
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
<password>password1</password>
|
||||
|
||||
</server></servers>`);
|
||||
|
||||
});
|
||||
|
||||
test('fillServers with username and configuration', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '')
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username</username>
|
||||
|
||||
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with username, password and configuration', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "password": "password", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '')
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username</username>
|
||||
<password>password</password>
|
||||
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with configuration', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '')
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
|
||||
|
||||
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with configuration subLevel', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": {"prop11": "value11", "prop12": "value12"}, "prop2": "value2"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '')
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
|
||||
|
||||
<configuration><prop1><prop11>value11</prop11><prop12>value12</prop12></prop1><prop2>value2</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers two servers', () => {
|
||||
@ -152,66 +231,317 @@ test('fillServers two servers', () => {
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"},\
|
||||
{"id": "id2", "username": "username2", "password":"password2"}]';
|
||||
|
||||
settings.fillServers(xml);
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '');
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
<password>password1</password>
|
||||
|
||||
</server>
|
||||
<server>
|
||||
<id>id2</id>
|
||||
<username>username2</username>
|
||||
<password>password2</password>
|
||||
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fill servers incorrect fields', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"idx": "id1"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe("<servers>" +
|
||||
"<server><id>id1</id><username>username1</username><password>password1</password></server>" +
|
||||
"<server><id>id2</id><username>username2</username><password>password2</password></server>" +
|
||||
"</servers>");
|
||||
expect(xmlStr).toBe('<servers/>');
|
||||
expect(consoleOutput).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.stringMatching(/::error::servers must contain id, \(username and password\) or configuration/)
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
test('addSonatypeSnapshots activate', () => {
|
||||
test('fill oracleServers', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
process.env['INPUT_ORACLESERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
|
||||
|
||||
settings.fillServers(xml, 'oracleServers');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
<password>password1</password>
|
||||
<configuration>
|
||||
<basicAuthScope>
|
||||
<host>ANY</host>
|
||||
<port>ANY</port>
|
||||
<realm>OAM 11g</realm>
|
||||
</basicAuthScope>
|
||||
<httpConfiguration>
|
||||
<all>
|
||||
<params>
|
||||
<property>
|
||||
<name>http.protocol.allow-circular-redirects</name>
|
||||
<value>%b,true</value>
|
||||
</property>
|
||||
</params>
|
||||
</all>
|
||||
</httpConfiguration>
|
||||
</configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers github', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
process.env['INPUT_GITHUBSERVER'] = 'true';
|
||||
|
||||
settings.fillServerForGithub(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '');
|
||||
|
||||
expect(xmlStr).toBe(`<servers>
|
||||
<server>
|
||||
<id>github</id>
|
||||
<username>\${env.GITHUB_ACTOR}</username>
|
||||
<password>\${env.GITHUB_TOKEN}</password>
|
||||
|
||||
</server></servers>`);
|
||||
expect(consoleOutput).toEqual([]);
|
||||
});
|
||||
|
||||
test('fillMirrors do nothing if no params', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<mirrors/>");
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe("<mirrors/>");
|
||||
expect(consoleOutput).toEqual([]);
|
||||
});
|
||||
|
||||
test('fillMirrors one mirror', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<mirrors/>");
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"id": "id1", "name": "name", "mirrorOf":"mirrorOf", "url":"url"}]';
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe(`<mirrors>
|
||||
<mirror>
|
||||
<id>id1</id>
|
||||
<name>name</name>
|
||||
<mirrorOf>mirrorOf</mirrorOf>
|
||||
<url>url</url>
|
||||
</mirror></mirrors>`);
|
||||
expect(consoleOutput).toEqual([]);
|
||||
});
|
||||
|
||||
test('fillMirrors two mirrors', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<mirrors/>");
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"id": "id1", "name": "name1", "mirrorOf":"mirrorOf1", "url":"url1"},{"id": "id2", "name": "name2", "mirrorOf":"mirrorOf2", "url":"url2"}]';
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe(`<mirrors>
|
||||
<mirror>
|
||||
<id>id1</id>
|
||||
<name>name1</name>
|
||||
<mirrorOf>mirrorOf1</mirrorOf>
|
||||
<url>url1</url>
|
||||
</mirror>
|
||||
<mirror>
|
||||
<id>id2</id>
|
||||
<name>name2</name>
|
||||
<mirrorOf>mirrorOf2</mirrorOf>
|
||||
<url>url2</url>
|
||||
</mirror></mirrors>`);
|
||||
expect(consoleOutput).toEqual([]);
|
||||
});
|
||||
|
||||
test('fillMirrors incorrect fields', () => {
|
||||
|
||||
const xml = new DOMParser().parseFromString("<mirrors/>");
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"idx": "id1"}]';
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe('<mirrors/>');
|
||||
expect(consoleOutput).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.stringMatching(/::error::mirrors must contain id, name, mirrorOf and url/)
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
test('addApacheSnapshots', () => {
|
||||
|
||||
process.env['INPUT_APACHESNAPSHOTS'] = "true";
|
||||
|
||||
const xml = new DOMParser().parseFromString('<profiles/>');
|
||||
|
||||
settings.addApacheSnapshots(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlStr).toBe(`<profiles>
|
||||
<profile>
|
||||
<id>_apache-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile></profiles>`);
|
||||
});
|
||||
|
||||
test('addSonatypeSnapshots', () => {
|
||||
|
||||
process.env['INPUT_SONATYPESNAPSHOTS'] = "true";
|
||||
|
||||
settings.addSonatypeSnapshots(xmlTestProfile);
|
||||
const xml = new DOMParser().parseFromString('<profiles/>');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xmlTestProfile);
|
||||
expect(xmlStr).toBe(`<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties/>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
</profiles>
|
||||
</settings>`);
|
||||
settings.addSonatypeSnapshots(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlStr).toBe(`<profiles>
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile></profiles>`);
|
||||
});
|
||||
|
||||
test('addOracleRepo', () => {
|
||||
|
||||
process.env['INPUT_ORACLEREPO'] = "true";
|
||||
|
||||
const xml = new DOMParser().parseFromString('<profiles/>');
|
||||
|
||||
settings.addOracleRepo(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlStr).toBe(`<profiles>
|
||||
<profile>
|
||||
<id>_maven.oracle.com_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile></profiles>`);
|
||||
});
|
||||
|
||||
test('fillProperties', () => {
|
||||
|
||||
process.env['INPUT_PROPERTIES'] = '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]';
|
||||
|
||||
settings.fillProperties(xmlTestProfile);
|
||||
const xml = new DOMParser().parseFromString('<profiles/>');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xmlTestProfile);
|
||||
expect(xmlStr).toBe(`<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties><propertyName1>propertyValue1</propertyName1><propertyName2>propertyValue2</propertyName2></properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
</profiles>
|
||||
</settings>`);
|
||||
settings.fillProperties(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlStr).toBe(`<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties><propertyName1>propertyValue1</propertyName1><propertyName2>propertyValue2</propertyName2></properties>
|
||||
</profile></profiles>`);
|
||||
})
|
||||
|
||||
test('fillProperties do nothing if no params', () => {
|
||||
@ -279,7 +609,7 @@ test('cleanup - ok', () => {
|
||||
|
||||
test('genereate', () => {
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "username", "password": "password"}]';
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "serverId", "username": "username", "password": "password"}]';
|
||||
process.env['INPUT_PROPERTIES'] = '[{"prop1": "value1"}, {"prop2": "value2"}]'
|
||||
process.env['INPUT_SONATYPESNAPSHOT'] = true;
|
||||
|
||||
|
||||
31
templates/apache-snapshot.xml
Normal file
31
templates/apache-snapshot.xml
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
<profile>
|
||||
<id>_apache-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>apache.snapshots.https</id>
|
||||
<url>https://repository.apache.org/snapshots/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
7
templates/mirrors.xml
Normal file
7
templates/mirrors.xml
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
<mirror>
|
||||
<id/>
|
||||
<name/>
|
||||
<mirrorOf/>
|
||||
<url/>
|
||||
</mirror>
|
||||
31
templates/oracle-repo.xml
Normal file
31
templates/oracle-repo.xml
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
<profile>
|
||||
<id>_maven.oracle.com_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>maven.oracle.com</id>
|
||||
<url>https://maven.oracle.com</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
23
templates/oracleServers.xml
Normal file
23
templates/oracleServers.xml
Normal file
@ -0,0 +1,23 @@
|
||||
|
||||
<server>
|
||||
<id />
|
||||
<username />
|
||||
<password />
|
||||
<configuration>
|
||||
<basicAuthScope>
|
||||
<host>ANY</host>
|
||||
<port>ANY</port>
|
||||
<realm>OAM 11g</realm>
|
||||
</basicAuthScope>
|
||||
<httpConfiguration>
|
||||
<all>
|
||||
<params>
|
||||
<property>
|
||||
<name>http.protocol.allow-circular-redirects</name>
|
||||
<value>%b,true</value>
|
||||
</property>
|
||||
</params>
|
||||
</all>
|
||||
</httpConfiguration>
|
||||
</configuration>
|
||||
</server>
|
||||
8
templates/properties.xml
Normal file
8
templates/properties.xml
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties />
|
||||
</profile>
|
||||
7
templates/servers.xml
Normal file
7
templates/servers.xml
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
<server>
|
||||
<id />
|
||||
<username />
|
||||
<password />
|
||||
<configuration />
|
||||
</server>
|
||||
@ -1,48 +1,6 @@
|
||||
<settings>
|
||||
|
||||
<interactiveMode>false</interactiveMode>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties />
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
<profiles/>
|
||||
<servers />
|
||||
<mirrors />
|
||||
</settings>
|
||||
|
||||
31
templates/sonatype-snapshot.xml
Normal file
31
templates/sonatype-snapshot.xml
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
<profile>
|
||||
<id>_sonatype-snapshots_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
Reference in New Issue
Block a user