mirror of
https://github.com/s4u/maven-settings-action.git
synced 2026-02-12 00:05:49 +08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fa46b1d3e0 | |||
| 2fcbb003a0 | |||
| 24fd865d62 | |||
| c16c7e68b1 | |||
| caa38170bf | |||
| 524b9d4c60 | |||
| bc5e386b37 | |||
| cf4f2545cb |
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1,3 +0,0 @@
|
||||
*.js eol=lf
|
||||
*.yml eol=lf
|
||||
*.xml eol=lf
|
||||
14
.github/dependabot.yml
vendored
14
.github/dependabot.yml
vendored
@ -1,14 +0,0 @@
|
||||
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
|
||||
28
.github/workflows/audit.yml
vendored
28
.github/workflows/audit.yml
vendored
@ -1,28 +0,0 @@
|
||||
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.4.0
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
- run: npm version
|
||||
- run: npm ci
|
||||
- run: npm audit
|
||||
25
.github/workflows/auto-approve.yml
vendored
25
.github/workflows/auto-approve.yml
vendored
@ -1,25 +0,0 @@
|
||||
name: Auto approve
|
||||
|
||||
on:
|
||||
pull_request_target
|
||||
|
||||
jobs:
|
||||
auto-approve:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
- uses: alexwilson/enable-github-automerge-action@1.0.0
|
||||
if: >
|
||||
github.actor == 'dependabot[bot]'
|
||||
|| github.actor == 'dependabot-preview[bot]'
|
||||
with:
|
||||
merge-method: "REBASE"
|
||||
github-token: "${{ secrets.TECH_TOKEN }}"
|
||||
|
||||
- uses: hmarr/auto-approve-action@v2.1.0
|
||||
if: >
|
||||
github.actor == 'dependabot[bot]'
|
||||
|| github.actor == 'dependabot-preview[bot]'
|
||||
|| github.actor == 'slawekjaranowski'
|
||||
with:
|
||||
github-token: "${{ secrets.TECH_TOKEN }}"
|
||||
21
.github/workflows/release-drafter.yml
vendored
21
.github/workflows/release-drafter.yml
vendored
@ -1,21 +0,0 @@
|
||||
name: Release Drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
name: Update Release Draft
|
||||
runs-on: ubuntu-latest
|
||||
concurrency: release-drafter
|
||||
|
||||
if: >
|
||||
github.repository_owner == 's4u'
|
||||
&& !startsWith(github.event.head_commit.message , '[maven-release-plugin]')
|
||||
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5.15.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
24
.github/workflows/test.yml
vendored
24
.github/workflows/test.yml
vendored
@ -1,15 +1,12 @@
|
||||
name: Test
|
||||
name: "Test Action"
|
||||
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]
|
||||
@ -17,31 +14,20 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
||||
- uses: actions/setup-node@v2.4.0
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
|
||||
- uses: actions/setup-java@v2.2.0
|
||||
with:
|
||||
distribution: 'adopt'
|
||||
java-version: '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
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,7 +3,6 @@
|
||||
|
||||
# Editors
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# Logs
|
||||
logs
|
||||
|
||||
179
README.md
179
README.md
@ -1,200 +1,57 @@
|
||||
# maven-settings-action
|
||||
[](https://github.com/s4u/maven-settings-action/actions?query=workflow%3ATest)
|
||||
[](https://github.com/s4u/maven-settings-action/actions?query=workflow%3AAudit)
|
||||
[](https://github.com/s4u/maven-settings-action/actions)
|
||||
|
||||
|
||||
This action sets up Maven environments for use in GitHub Actions by:
|
||||
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 to create issues for new features you dream of or if you suspect some bug
|
||||
|
||||
# Project versioning
|
||||
This project uses [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)
|
||||
|
||||
## default ```settings.xml```
|
||||
Create default ```settings.xml```:
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
```
|
||||
|
||||
## ```settings.xml``` with servers section
|
||||
|
||||
Create ```settings.xml``` with server section:
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
with:
|
||||
servers: '[{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
```
|
||||
|
||||
All `server` attributes may be specified:
|
||||
* `id` _(required)_
|
||||
* `username`
|
||||
* `password`
|
||||
* `privateKey`
|
||||
* `passphrase`
|
||||
* `filePermissions`
|
||||
* `directoryPermissions`
|
||||
* `configuration`
|
||||
|
||||
Please refer to the [servers](http://maven.apache.org/settings.html#Servers) documentation for more information.
|
||||
|
||||
## ```settings.xml``` with servers section and additional configuration
|
||||
|
||||
``` yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
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
|
||||
Create ```settings.xml``` with maven properties:
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
with:
|
||||
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
|
||||
```
|
||||
|
||||
## ```settings.xml``` with properties
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
with:
|
||||
properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
||||
```
|
||||
|
||||
## ```settings.xml``` with https://oss.sonatype.org/content/repositories/snapshots in repository list
|
||||
|
||||
Create ```settings.xml``` with https://oss.sonatype.org/content/repositories/snapshots in repository list
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
with:
|
||||
sonatypeSnapshots: true
|
||||
```
|
||||
|
||||
## ```settings.xml``` with https://repository.apache.org/snapshots/ in repository list
|
||||
|
||||
Override existing existing ```settings.xml```:
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
- uses: s4u/maven-settings-action@v1
|
||||
with:
|
||||
apacheSnapshots: true
|
||||
override: true
|
||||
```
|
||||
|
||||
## Do not override existing ```settings.xml```, from version **2.0** file is override by default :
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
with:
|
||||
override: false
|
||||
```
|
||||
|
||||
## Do not add github to server in ```settings.xml```, by default is added:
|
||||
```yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
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.4.1
|
||||
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.4.1
|
||||
with:
|
||||
oracleRepo: true
|
||||
```
|
||||
|
||||
## GitHub actions secrets
|
||||
|
||||
It is also possible pass in Github Secrets e.g.
|
||||
|
||||
``` yml
|
||||
steps:
|
||||
- uses: s4u/maven-settings-action@v2.4.1
|
||||
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.4.1
|
||||
|
||||
- run: mvn verify
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
The scripts and documentation in this project are released under the [MIT License](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
@ -1,4 +1,4 @@
|
||||
name: 'maven-settings-action'
|
||||
name: 'maven-setings-action'
|
||||
description: 'Prepare maven settings.xml'
|
||||
|
||||
branding:
|
||||
@ -7,10 +7,7 @@ branding:
|
||||
|
||||
inputs:
|
||||
servers:
|
||||
description: 'servers definition in json 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"}]'
|
||||
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
|
||||
required: false
|
||||
properties:
|
||||
description: 'json array with properties, eg [{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
|
||||
@ -19,26 +16,12 @@ inputs:
|
||||
description: 'add https://oss.sonatype.org/content/repositories/snapshots to repository list - true or false'
|
||||
default: "false"
|
||||
required: false
|
||||
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 json 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'
|
||||
main: 'index.js'
|
||||
|
||||
160
index.test.js
160
index.test.js
@ -63,164 +63,18 @@ afterAll(() => {
|
||||
|
||||
test('run with all feature', () => {
|
||||
|
||||
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;
|
||||
|
||||
process.env['INPUT_MIRRORS'] = '[{"id": "mirrorId", "name": "mirror Name", "mirrorOf": "mirror Off *", "url": "mirror url"}]';
|
||||
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_APACHESNAPSHOTS'] = true;
|
||||
process.env['INPUT_SONATYPESNAPSHOTS'] = true;
|
||||
process.env['INPUT_ORACLEREPO'] = true;
|
||||
|
||||
cp.execSync(`node ${indexPath}`, { env: process.env, stdio: 'inherit' });
|
||||
cp.execSync(`node ${indexPath}`, { env: process.env }).toString();
|
||||
|
||||
const settingsStatus = fs.lstatSync(settingsPath);
|
||||
expect(settingsStatus.isFile()).toBeTruthy();
|
||||
expect(settingsStatus.size).toBeGreaterThan(0);
|
||||
|
||||
const settingsBody = fs.readFileSync(settingsPath).toString().replace(/^\s*$(?:\r\n?|\n)/gm, '');
|
||||
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>`);
|
||||
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');
|
||||
})
|
||||
|
||||
21
node_modules/.package-lock.json
generated
vendored
21
node_modules/.package-lock.json
generated
vendored
@ -1,21 +0,0 @@
|
||||
{
|
||||
"name": "maven-settings-action",
|
||||
"version": "2.4.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@actions/core": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.5.0.tgz",
|
||||
"integrity": "sha512-eDOLH1Nq9zh+PJlYLqEMkS/jLQxhksPNmUGNBHfa4G+tQmnIhzpctxmchETtVGyBOvXgOVVpYuE40+eS4cUnwQ=="
|
||||
},
|
||||
"node_modules/@xmldom/xmldom": {
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.7.1.tgz",
|
||||
"integrity": "sha512-EOzJBMOjJ657nmlTt5RsyEwJrMTMu0aX15pI96GmpyFPj33a9J4mkcEk0KqYGplqInQ6JsPUxv/R25jR+I5ADA==",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
node_modules/@actions/core/LICENSE.md
generated
vendored
9
node_modules/@actions/core/LICENSE.md
generated
vendored
@ -1,9 +0,0 @@
|
||||
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.
|
||||
133
node_modules/@actions/core/README.md
generated
vendored
133
node_modules/@actions/core/README.md
generated
vendored
@ -16,14 +16,11 @@ import * as core from '@actions/core';
|
||||
|
||||
#### Inputs/Outputs
|
||||
|
||||
Action inputs can be read with `getInput` which returns a `string` or `getBooleanInput` which parses a boolean based on the [yaml 1.2 specification](https://yaml.org/spec/1.2/spec.html#id2804923). If `required` set to be false, the input should have a default value in `action.yml`.
|
||||
|
||||
Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
||||
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 });
|
||||
const myBooleanInput = core.getBooleanInput('booleanInputName', { required: true });
|
||||
const myMultilineInput = core.getMultilineInput('multilineInputName', { required: true });
|
||||
|
||||
core.setOutput('outputKey', 'outputVal');
|
||||
```
|
||||
|
||||
@ -65,10 +62,11 @@ 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).
|
||||
@ -84,16 +82,7 @@ try {
|
||||
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')
|
||||
|
||||
core.notice('This is a message that will also emit an annotation')
|
||||
}
|
||||
catch (err) {
|
||||
core.error(`Error ${err}, action may still succeed though`);
|
||||
@ -117,118 +106,11 @@ const result = await core.group('Do something async', async () => {
|
||||
})
|
||||
```
|
||||
|
||||
#### Annotations
|
||||
|
||||
This library has 3 methods that will produce [annotations](https://docs.github.com/en/rest/reference/checks#create-a-check-run).
|
||||
```js
|
||||
core.error('This is a bad error. This will also fail the build.')
|
||||
|
||||
core.warning('Something went wrong, but it\'s not bad enough to fail the build.')
|
||||
|
||||
core.notice('Something happened that you might want to know about.')
|
||||
```
|
||||
|
||||
These will surface to the UI in the Actions page and on Pull Requests. They look something like this:
|
||||
|
||||

|
||||
|
||||
These annotations can also be attached to particular lines and columns of your source files to show exactly where a problem is occuring.
|
||||
|
||||
These options are:
|
||||
```typescript
|
||||
export interface AnnotationProperties {
|
||||
/**
|
||||
* A title for the annotation.
|
||||
*/
|
||||
title?: string
|
||||
|
||||
/**
|
||||
* The start line for the annotation.
|
||||
*/
|
||||
startLine?: number
|
||||
|
||||
/**
|
||||
* The end line for the annotation. Defaults to `startLine` when `startLine` is provided.
|
||||
*/
|
||||
endLine?: number
|
||||
|
||||
/**
|
||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||
*/
|
||||
startColumn?: number
|
||||
|
||||
/**
|
||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||
* Defaults to `startColumn` when `startColumn` is provided.
|
||||
*/
|
||||
endColumn?: number
|
||||
}
|
||||
```
|
||||
|
||||
#### Styling output
|
||||
|
||||
Colored output is supported in the Action logs via standard [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code). 3/4 bit, 8 bit and 24 bit colors are all supported.
|
||||
|
||||
Foreground colors:
|
||||
|
||||
```js
|
||||
// 3/4 bit
|
||||
core.info('\u001b[35mThis foreground will be magenta')
|
||||
|
||||
// 8 bit
|
||||
core.info('\u001b[38;5;6mThis foreground will be cyan')
|
||||
|
||||
// 24 bit
|
||||
core.info('\u001b[38;2;255;0;0mThis foreground will be bright red')
|
||||
```
|
||||
|
||||
Background colors:
|
||||
|
||||
```js
|
||||
// 3/4 bit
|
||||
core.info('\u001b[43mThis background will be yellow');
|
||||
|
||||
// 8 bit
|
||||
core.info('\u001b[48;5;6mThis background will be cyan')
|
||||
|
||||
// 24 bit
|
||||
core.info('\u001b[48;2;255;0;0mThis background will be bright red')
|
||||
```
|
||||
|
||||
Special styles:
|
||||
|
||||
```js
|
||||
core.info('\u001b[1mBold text')
|
||||
core.info('\u001b[3mItalic text')
|
||||
core.info('\u001b[4mUnderlined text')
|
||||
```
|
||||
|
||||
ANSI escape codes can be combined with one another:
|
||||
|
||||
```js
|
||||
core.info('\u001b[31;46mRed foreground with a cyan background and \u001b[1mbold text at the end');
|
||||
```
|
||||
|
||||
> Note: Escape codes reset at the start of each line
|
||||
|
||||
```js
|
||||
core.info('\u001b[35mThis foreground will be magenta')
|
||||
core.info('This foreground will reset to the default')
|
||||
```
|
||||
|
||||
Manually typing escape codes can be a little difficult, but you can use third party modules such as [ansi-styles](https://github.com/chalk/ansi-styles).
|
||||
|
||||
```js
|
||||
const style = require('ansi-styles');
|
||||
core.info(style.color.ansi16m.hex('#abcdef') + 'Hello world!')
|
||||
```
|
||||
|
||||
#### Action state
|
||||
|
||||
You can use this library to save state and get state for sharing information between a given wrapper action:
|
||||
|
||||
**action.yml**:
|
||||
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:
|
||||
@ -249,11 +131,10 @@ core.saveState("pidToKill", 12345);
|
||||
```
|
||||
|
||||
In action's `cleanup.js`:
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
var pid = core.getState("pidToKill");
|
||||
|
||||
process.kill(pid);
|
||||
```
|
||||
```
|
||||
7
node_modules/@actions/core/lib/command.d.ts
generated
vendored
7
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@ -1,5 +1,5 @@
|
||||
export interface CommandProperties {
|
||||
[key: string]: any;
|
||||
interface CommandProperties {
|
||||
[key: string]: string;
|
||||
}
|
||||
/**
|
||||
* Commands
|
||||
@ -11,5 +11,6 @@ export interface CommandProperties {
|
||||
* ::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 issueCommand(command: string, properties: CommandProperties, message: string): void;
|
||||
export declare function issue(name: string, message?: string): void;
|
||||
export {};
|
||||
|
||||
22
node_modules/@actions/core/lib/command.js
generated
vendored
22
node_modules/@actions/core/lib/command.js
generated
vendored
@ -1,27 +1,13 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
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 });
|
||||
exports.issue = exports.issueCommand = void 0;
|
||||
const os = __importStar(require("os"));
|
||||
const utils_1 = require("./utils");
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
@ -76,13 +62,13 @@ class Command {
|
||||
}
|
||||
}
|
||||
function escapeData(s) {
|
||||
return utils_1.toCommandValue(s)
|
||||
return (s || '')
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A');
|
||||
}
|
||||
function escapeProperty(s) {
|
||||
return utils_1.toCommandValue(s)
|
||||
return (s || '')
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
|
||||
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
@ -1 +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,OAAO,GAAG,EAAE;IAC9C,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"}
|
||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;;;;;;;;AAAA,uCAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,IAAI,KAAK,GAAG,IAAI,CAAA;YAChB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,IAAI,KAAK,EAAE;4BACT,KAAK,GAAG,KAAK,CAAA;yBACd;6BAAM;4BACL,MAAM,IAAI,GAAG,CAAA;yBACd;wBAED,MAAM,IAAI,GAAG,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,EAAE,CAAA;qBAC1C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAA;QACpD,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;SACb,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;SACb,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
||||
95
node_modules/@actions/core/lib/core.d.ts
generated
vendored
95
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@ -4,8 +4,6 @@
|
||||
export interface InputOptions {
|
||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||
required?: boolean;
|
||||
/** Optional. Whether leading/trailing whitespace will be trimmed for the input. Defaults to true */
|
||||
trimWhitespace?: boolean;
|
||||
}
|
||||
/**
|
||||
* The code to exit an action
|
||||
@ -20,39 +18,12 @@ export declare enum ExitCode {
|
||||
*/
|
||||
Failure = 1
|
||||
}
|
||||
/**
|
||||
* Optional properties that can be sent with annotatation commands (notice, error, and warning)
|
||||
* See: https://docs.github.com/en/rest/reference/checks#create-a-check-run for more information about annotations.
|
||||
*/
|
||||
export interface AnnotationProperties {
|
||||
/**
|
||||
* A title for the annotation.
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* The start line for the annotation.
|
||||
*/
|
||||
startLine?: number;
|
||||
/**
|
||||
* The end line for the annotation. Defaults to `startLine` when `startLine` is provided.
|
||||
*/
|
||||
endLine?: number;
|
||||
/**
|
||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||
*/
|
||||
startColumn?: number;
|
||||
/**
|
||||
* The start column for the annotation. Cannot be sent when `startLine` and `endLine` are different values.
|
||||
* Defaults to `startColumn` when `startColumn` is provided.
|
||||
*/
|
||||
endColumn?: number;
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
* @param val the value of the variable
|
||||
*/
|
||||
export declare function exportVariable(name: string, val: any): void;
|
||||
export declare function exportVariable(name: string, val: string): void;
|
||||
/**
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
@ -64,58 +35,26 @@ export declare function setSecret(secret: string): void;
|
||||
*/
|
||||
export declare function addPath(inputPath: string): void;
|
||||
/**
|
||||
* Gets the value of an input.
|
||||
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
||||
* Returns an empty string if the value is not defined.
|
||||
* 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;
|
||||
/**
|
||||
* Gets the values of an multiline input. Each value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string[]
|
||||
*
|
||||
*/
|
||||
export declare function getMultilineInput(name: string, options?: InputOptions): string[];
|
||||
/**
|
||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
||||
* The return value is also in boolean type.
|
||||
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns boolean
|
||||
*/
|
||||
export declare function getBooleanInput(name: string, options?: InputOptions): boolean;
|
||||
/**
|
||||
* 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
|
||||
* @param value value to store
|
||||
*/
|
||||
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;
|
||||
export declare function setOutput(name: string, value: string): 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;
|
||||
export declare function setFailed(message: string): void;
|
||||
/**
|
||||
* Writes debug message to user log
|
||||
* @param message debug message
|
||||
@ -123,22 +62,14 @@ export declare function isDebug(): boolean;
|
||||
export declare function debug(message: string): void;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
* @param properties optional properties to add to the annotation.
|
||||
* @param message error issue message
|
||||
*/
|
||||
export declare function error(message: string | Error, properties?: AnnotationProperties): void;
|
||||
export declare function error(message: string): void;
|
||||
/**
|
||||
* Adds a warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
* @param properties optional properties to add to the annotation.
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message
|
||||
*/
|
||||
export declare function warning(message: string | Error, properties?: AnnotationProperties): void;
|
||||
/**
|
||||
* Adds a notice issue
|
||||
* @param message notice issue message. Errors will be converted to string via toString()
|
||||
* @param properties optional properties to add to the annotation.
|
||||
*/
|
||||
export declare function notice(message: string | Error, properties?: AnnotationProperties): void;
|
||||
export declare function warning(message: string): void;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
@ -169,9 +100,9 @@ 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
|
||||
* @param value value to store
|
||||
*/
|
||||
export declare function saveState(name: string, value: any): void;
|
||||
export declare function saveState(name: string, value: string): void;
|
||||
/**
|
||||
* Gets the value of an state set by this action's main execution.
|
||||
*
|
||||
|
||||
145
node_modules/@actions/core/lib/core.js
generated
vendored
145
node_modules/@actions/core/lib/core.js
generated
vendored
@ -1,23 +1,4 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
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) {
|
||||
@ -27,11 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
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 });
|
||||
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
||||
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"));
|
||||
/**
|
||||
@ -54,21 +39,11 @@ var ExitCode;
|
||||
/**
|
||||
* 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
|
||||
* @param val the value of the variable
|
||||
*/
|
||||
// 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);
|
||||
}
|
||||
process.env[name] = val;
|
||||
command_1.issueCommand('set-env', { name }, val);
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
@ -84,20 +59,12 @@ exports.setSecret = setSecret;
|
||||
* @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);
|
||||
}
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
/**
|
||||
* Gets the value of an input.
|
||||
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
||||
* Returns an empty string if the value is not defined.
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
@ -108,70 +75,19 @@ function getInput(name, options) {
|
||||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
if (options && options.trimWhitespace === false) {
|
||||
return val;
|
||||
}
|
||||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
/**
|
||||
* Gets the values of an multiline input. Each value is also trimmed.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns string[]
|
||||
*
|
||||
*/
|
||||
function getMultilineInput(name, options) {
|
||||
const inputs = getInput(name, options)
|
||||
.split('\n')
|
||||
.filter(x => x !== '');
|
||||
return inputs;
|
||||
}
|
||||
exports.getMultilineInput = getMultilineInput;
|
||||
/**
|
||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
||||
* The return value is also in boolean type.
|
||||
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns boolean
|
||||
*/
|
||||
function getBooleanInput(name, options) {
|
||||
const trueValue = ['true', 'True', 'TRUE'];
|
||||
const falseValue = ['false', 'False', 'FALSE'];
|
||||
const val = getInput(name, options);
|
||||
if (trueValue.includes(val))
|
||||
return true;
|
||||
if (falseValue.includes(val))
|
||||
return false;
|
||||
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
||||
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
||||
}
|
||||
exports.getBooleanInput = getBooleanInput;
|
||||
/**
|
||||
* 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
|
||||
* @param value value to store
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function setOutput(name, value) {
|
||||
process.stdout.write(os.EOL);
|
||||
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
|
||||
//-----------------------------------------------------------------------
|
||||
@ -188,13 +104,6 @@ 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
|
||||
@ -205,31 +114,20 @@ function debug(message) {
|
||||
exports.debug = debug;
|
||||
/**
|
||||
* Adds an error issue
|
||||
* @param message error issue message. Errors will be converted to string via toString()
|
||||
* @param properties optional properties to add to the annotation.
|
||||
* @param message error issue message
|
||||
*/
|
||||
function error(message, properties = {}) {
|
||||
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
||||
function error(message) {
|
||||
command_1.issue('error', message);
|
||||
}
|
||||
exports.error = error;
|
||||
/**
|
||||
* Adds a warning issue
|
||||
* @param message warning issue message. Errors will be converted to string via toString()
|
||||
* @param properties optional properties to add to the annotation.
|
||||
* Adds an warning issue
|
||||
* @param message warning issue message
|
||||
*/
|
||||
function warning(message, properties = {}) {
|
||||
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
||||
function warning(message) {
|
||||
command_1.issue('warning', message);
|
||||
}
|
||||
exports.warning = warning;
|
||||
/**
|
||||
* Adds a notice issue
|
||||
* @param message notice issue message. Errors will be converted to string via toString()
|
||||
* @param properties optional properties to add to the annotation.
|
||||
*/
|
||||
function notice(message, properties = {}) {
|
||||
command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
||||
}
|
||||
exports.notice = notice;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
@ -285,9 +183,8 @@ exports.group = group;
|
||||
* 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
|
||||
* @param value value to store
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function saveState(name, value) {
|
||||
command_1.issueCommand('save-state', { name }, value);
|
||||
}
|
||||
|
||||
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAC7C,iDAA+D;AAC/D,mCAA2D;AAE3D,uCAAwB;AACxB,2CAA4B;AAa5B;;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;AAkCD,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;;;;;;;;GAQG;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,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,KAAK,KAAK,EAAE;QAC/C,OAAO,GAAG,CAAA;KACX;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AAZD,4BAYC;AAED;;;;;;;GAOG;AACH,SAAgB,iBAAiB,CAC/B,IAAY,EACZ,OAAsB;IAEtB,MAAM,MAAM,GAAa,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;SAC7C,KAAK,CAAC,IAAI,CAAC;SACX,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;IAExB,OAAO,MAAM,CAAA;AACf,CAAC;AATD,8CASC;AAED;;;;;;;;;GASG;AACH,SAAgB,eAAe,CAAC,IAAY,EAAE,OAAsB;IAClE,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAC1C,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACnC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IACxC,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA;IAC1C,MAAM,IAAI,SAAS,CACjB,6DAA6D,IAAI,IAAI;QACnE,4EAA4E,CAC/E,CAAA;AACH,CAAC;AAVD,0CAUC;AAED;;;;;GAKG;AACH,8DAA8D;AAC9D,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAU;IAChD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;IAC5B,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAHD,8BAGC;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;;;;GAIG;AACH,SAAgB,KAAK,CACnB,OAAuB,EACvB,aAAmC,EAAE;IAErC,sBAAY,CACV,OAAO,EACP,2BAAmB,CAAC,UAAU,CAAC,EAC/B,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CACxD,CAAA;AACH,CAAC;AATD,sBASC;AAED;;;;GAIG;AACH,SAAgB,OAAO,CACrB,OAAuB,EACvB,aAAmC,EAAE;IAErC,sBAAY,CACV,SAAS,EACT,2BAAmB,CAAC,UAAU,CAAC,EAC/B,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CACxD,CAAA;AACH,CAAC;AATD,0BASC;AAED;;;;GAIG;AACH,SAAgB,MAAM,CACpB,OAAuB,EACvB,aAAmC,EAAE;IAErC,sBAAY,CACV,QAAQ,EACR,2BAAmB,CAAC,UAAU,CAAC,EAC/B,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,OAAO,CACxD,CAAA;AACH,CAAC;AATD,wBASC;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"}
|
||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,uCAA6C;AAE7C,uCAAwB;AACxB,2CAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
|
||||
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
1
node_modules/@actions/core/lib/file-command.d.ts
generated
vendored
@ -1 +0,0 @@
|
||||
export declare function issueCommand(command: string, message: any): void;
|
||||
42
node_modules/@actions/core/lib/file-command.js
generated
vendored
42
node_modules/@actions/core/lib/file-command.js
generated
vendored
@ -1,42 +0,0 @@
|
||||
"use strict";
|
||||
// For internal use, subject to change.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.issueCommand = void 0;
|
||||
// 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
1
node_modules/@actions/core/lib/file-command.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"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"}
|
||||
14
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
14
node_modules/@actions/core/lib/utils.d.ts
generated
vendored
@ -1,14 +0,0 @@
|
||||
import { AnnotationProperties } from './core';
|
||||
import { CommandProperties } from './command';
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
*
|
||||
* @param annotationProperties
|
||||
* @returns The command properties to send with the actual annotation command
|
||||
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
|
||||
*/
|
||||
export declare function toCommandProperties(annotationProperties: AnnotationProperties): CommandProperties;
|
||||
39
node_modules/@actions/core/lib/utils.js
generated
vendored
39
node_modules/@actions/core/lib/utils.js
generated
vendored
@ -1,39 +0,0 @@
|
||||
"use strict";
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.toCommandProperties = exports.toCommandValue = void 0;
|
||||
/**
|
||||
* 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;
|
||||
/**
|
||||
*
|
||||
* @param annotationProperties
|
||||
* @returns The command properties to send with the actual annotation command
|
||||
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
|
||||
*/
|
||||
function toCommandProperties(annotationProperties) {
|
||||
if (!Object.keys(annotationProperties).length) {
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
title: annotationProperties.title,
|
||||
line: annotationProperties.startLine,
|
||||
endLine: annotationProperties.endLine,
|
||||
col: annotationProperties.startColumn,
|
||||
endColumn: annotationProperties.endColumn
|
||||
};
|
||||
}
|
||||
exports.toCommandProperties = toCommandProperties;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
1
node_modules/@actions/core/lib/utils.js.map
generated
vendored
@ -1 +0,0 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;;AAKvD;;;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;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,oBAA0C;IAE1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE;QAC7C,OAAO,EAAE,CAAA;KACV;IAED,OAAO;QACL,KAAK,EAAE,oBAAoB,CAAC,KAAK;QACjC,IAAI,EAAE,oBAAoB,CAAC,SAAS;QACpC,OAAO,EAAE,oBAAoB,CAAC,OAAO;QACrC,GAAG,EAAE,oBAAoB,CAAC,WAAW;QACrC,SAAS,EAAE,oBAAoB,CAAC,SAAS;KAC1C,CAAA;AACH,CAAC;AAdD,kDAcC"}
|
||||
68
node_modules/@actions/core/package.json
generated
vendored
68
node_modules/@actions/core/package.json
generated
vendored
@ -1,24 +1,56 @@
|
||||
{
|
||||
"name": "@actions/core",
|
||||
"version": "1.5.0",
|
||||
"description": "Actions core lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
"_args": [
|
||||
[
|
||||
"@actions/core@1.2.2",
|
||||
"."
|
||||
]
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"types": "lib/core.d.ts",
|
||||
"_from": "@actions/core@1.2.2",
|
||||
"_id": "@actions/core@1.2.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@actions/core@1.2.2",
|
||||
"name": "@actions/core",
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "1.2.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.2.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
|
||||
"_spec": "1.2.2",
|
||||
"_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"
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"name": "@actions/core",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
@ -28,14 +60,10 @@
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"scripts": {
|
||||
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
|
||||
"audit-moderate": "npm install && npm audit --audit-level=moderate",
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
}
|
||||
"types": "lib/core.d.ts",
|
||||
"version": "1.2.2"
|
||||
}
|
||||
|
||||
275
node_modules/@xmldom/xmldom/CHANGELOG.md
generated
vendored
275
node_modules/@xmldom/xmldom/CHANGELOG.md
generated
vendored
@ -1,275 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## 0.7.1
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.7.0...0.7.1)
|
||||
|
||||
### Fixes:
|
||||
|
||||
- Types: Copy types from DefinitelyTyped [`#283`](https://github.com/xmldom/xmldom/pull/283)
|
||||
Thank you [@kachkaev](https://github.com/kachkaev)
|
||||
|
||||
### Chore:
|
||||
- package.json: remove author, maintainers, etc. [`#279`](https://github.com/xmldom/xmldom/pull/279)
|
||||
|
||||
## 0.7.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.6.0...0.7.0)
|
||||
|
||||
Due to [`#271`](https://github.com/xmldom/xmldom/issue/271) this version was published as
|
||||
- unscoped `xmldom` package to github (git tags [`0.7.0`](https://github.com/xmldom/xmldom/tree/0.7.0) and [`0.7.0+unscoped`](https://github.com/xmldom/xmldom/tree/0.7.0%2Bunscoped))
|
||||
- scoped `@xmldom/xmldom` package to npm (git tag `0.7.0+scoped`)
|
||||
For more details look at [`#278`](https://github.com/xmldom/xmldom/pull/278#issuecomment-902172483)
|
||||
|
||||
### Fixes:
|
||||
|
||||
- Security: Misinterpretation of malicious XML input [`CVE-2021-32796`](https://github.com/xmldom/xmldom/security/advisories/GHSA-5fg8-2547-mr8q)
|
||||
- Implement `Document.getElementsByClassName` as specified [`#213`](https://github.com/xmldom/xmldom/pull/213), thank you [@ChALkeR](https://github.com/ChALkeR)
|
||||
- Inherit namespace prefix from parent when required [`#268`](https://github.com/xmldom/xmldom/pull/268)
|
||||
- Handle whitespace in closing tags [`#267`](https://github.com/xmldom/xmldom/pull/267)
|
||||
- Update `DOMImplementation` according to recent specs [`#210`](https://github.com/xmldom/xmldom/pull/210)
|
||||
BREAKING CHANGE: Only if you "passed features to be marked as available as a constructor arguments" and expected it to "magically work".
|
||||
- No longer serializes any namespaces with an empty URI [`#244`](https://github.com/xmldom/xmldom/pull/244)
|
||||
(related to [`#168`](https://github.com/xmldom/xmldom/pull/168) released in 0.6.0)
|
||||
BREAKING CHANGE: Only if you rely on ["unsetting" a namespace prefix](https://github.com/xmldom/xmldom/pull/168#issuecomment-886984994) by setting it to an empty string
|
||||
- Set `localName` as part of `Document.createElement` [`#229`](https://github.com/xmldom/xmldom/pull/229), thank you [@rrthomas](https://github.com/rrthomas)
|
||||
|
||||
### CI
|
||||
|
||||
- We are now additionally running tests against node v16
|
||||
- Stryker tests on the master branch now run against node v14
|
||||
|
||||
### Docs
|
||||
|
||||
- Describe relations with and between specs: [`#211`](https://github.com/xmldom/xmldom/pull/211), [`#247`](https://github.com/xmldom/xmldom/pull/247)
|
||||
|
||||
## 0.6.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.5.0...0.6.0)
|
||||
|
||||
### Fixes
|
||||
|
||||
- Stop serializing empty namespace values like `xmlns:ds=""` [`#168`](https://github.com/xmldom/xmldom/pull/168)
|
||||
BREAKING CHANGE: If your code expected empty namespaces attributes to be serialized.
|
||||
Thank you [@pdecat](https://github.com/pdecat) and [@FranckDepoortere](https://github.com/FranckDepoortere)
|
||||
- Escape `<` to `<` when serializing attribute values [`#198`](https://github.com/xmldom/xmldom/issues/198) / [`#199`](https://github.com/xmldom/xmldom/pull/199)
|
||||
|
||||
## 0.5.0
|
||||
|
||||
[Commits](https://github.com/xmldom/xmldom/compare/0.4.0...0.5.0)
|
||||
|
||||
### Fixes
|
||||
- Avoid misinterpretation of malicious XML input - [`GHSA-h6q6-9hqw-rwfv`](https://github.com/xmldom/xmldom/security/advisories/GHSA-h6q6-9hqw-rwfv) (CVE-2021-21366)
|
||||
- Improve error reporting; throw on duplicate attribute\
|
||||
BREAKING CHANGE: It is currently not clear how to consistently deal with duplicate attributes, so it's also safer for our users to fail when detecting them.
|
||||
It's possible to configure the `DOMParser.errorHandler` before parsing, to handle those errors differently.
|
||||
|
||||
To accomplish this and also be able to verify it in tests I needed to
|
||||
- create a new `Error` type `ParseError` and export it
|
||||
- Throw `ParseError` from `errorHandler.fatalError` and prevent those from being caught in `XMLReader`.
|
||||
- export `DOMHandler` constructor as `__DOMHandler`
|
||||
- Preserve quotes in DOCTYPE declaration
|
||||
Since the only purpose of parsing the DOCTYPE is to be able to restore it when serializing, we decided that it would be best to leave the parsed `publicId` and `systemId` as is, including any quotes.
|
||||
BREAKING CHANGE: If somebody relies on the actual unquoted values of those ids, they will need to take care of either single or double quotes and the right escaping.
|
||||
(Without this change this would not have been possible because the SAX parser already dropped the information about the quotes that have been used in the source.)
|
||||
|
||||
https://www.w3.org/TR/2006/REC-xml11-20060816/#dtd
|
||||
https://www.w3.org/TR/2006/REC-xml11-20060816/#IDAX1KS (External Entity Declaration)
|
||||
|
||||
- Fix breaking preprocessors' directives when parsing attributes [`#171`](https://github.com/xmldom/xmldom/pull/171)
|
||||
- fix(dom): Escape `]]>` when serializing CharData [`#181`](https://github.com/xmldom/xmldom/pull/181)
|
||||
- Switch to (only) MIT license (drop problematic LGPL license option) [`#178`](https://github.com/xmldom/xmldom/pull/178)
|
||||
- Export DOMException; remove custom assertions; etc. [`#174`](https://github.com/xmldom/xmldom/pull/174)
|
||||
|
||||
### Docs
|
||||
- Update MDN links in `readme.md` [`#188`](https://github.com/xmldom/xmldom/pull/188)
|
||||
|
||||
## 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
|
||||
8
node_modules/@xmldom/xmldom/LICENSE
generated
vendored
8
node_modules/@xmldom/xmldom/LICENSE
generated
vendored
@ -1,8 +0,0 @@
|
||||
Copyright 2019 - present Christopher J. Brody and other contributors, as listed in: https://github.com/xmldom/xmldom/graphs/contributors
|
||||
Copyright 2012 - 2017 @jindw <jindw@xidea.org> and other contributors, as listed in: https://github.com/jindw/xmldom/graphs/contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
2
node_modules/@xmldom/xmldom/lib/.eslintrc.yml
generated
vendored
2
node_modules/@xmldom/xmldom/lib/.eslintrc.yml
generated
vendored
@ -1,2 +0,0 @@
|
||||
extends:
|
||||
- 'plugin:es5/no-es2015'
|
||||
144
node_modules/@xmldom/xmldom/lib/conventions.js
generated
vendored
144
node_modules/@xmldom/xmldom/lib/conventions.js
generated
vendored
@ -1,144 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* "Shallow freezes" an object to render it immutable.
|
||||
* Uses `Object.freeze` if available,
|
||||
* otherwise the immutability is only in the type.
|
||||
*
|
||||
* Is used to create "enum like" objects.
|
||||
*
|
||||
* @template T
|
||||
* @param {T} object the object to freeze
|
||||
* @param {Pick<ObjectConstructor, 'freeze'> = Object} oc `Object` by default,
|
||||
* allows to inject custom object constructor for tests
|
||||
* @returns {Readonly<T>}
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
|
||||
*/
|
||||
function freeze(object, oc) {
|
||||
if (oc === undefined) {
|
||||
oc = Object
|
||||
}
|
||||
return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object
|
||||
}
|
||||
|
||||
/**
|
||||
* All mime types that are allowed as input to `DOMParser.parseFromString`
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN
|
||||
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec
|
||||
* @see DOMParser.prototype.parseFromString
|
||||
*/
|
||||
var MIME_TYPE = freeze({
|
||||
/**
|
||||
* `text/html`, the only mime type that triggers treating an XML document as HTML.
|
||||
*
|
||||
* @see DOMParser.SupportedType.isHTML
|
||||
* @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
|
||||
* @see https://en.wikipedia.org/wiki/HTML Wikipedia
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
|
||||
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec
|
||||
*/
|
||||
HTML: 'text/html',
|
||||
|
||||
/**
|
||||
* Helper method to check a mime type if it indicates an HTML document
|
||||
*
|
||||
* @param {string} [value]
|
||||
* @returns {boolean}
|
||||
*
|
||||
* @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration
|
||||
* @see https://en.wikipedia.org/wiki/HTML Wikipedia
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN
|
||||
* @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */
|
||||
isHTML: function (value) {
|
||||
return value === MIME_TYPE.HTML
|
||||
},
|
||||
|
||||
/**
|
||||
* `application/xml`, the standard mime type for XML documents.
|
||||
*
|
||||
* @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration
|
||||
* @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303
|
||||
* @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
|
||||
*/
|
||||
XML_APPLICATION: 'application/xml',
|
||||
|
||||
/**
|
||||
* `text/html`, an alias for `application/xml`.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303
|
||||
* @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration
|
||||
* @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia
|
||||
*/
|
||||
XML_TEXT: 'text/xml',
|
||||
|
||||
/**
|
||||
* `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,
|
||||
* but is parsed as an XML document.
|
||||
*
|
||||
* @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration
|
||||
* @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec
|
||||
* @see https://en.wikipedia.org/wiki/XHTML Wikipedia
|
||||
*/
|
||||
XML_XHTML_APPLICATION: 'application/xhtml+xml',
|
||||
|
||||
/**
|
||||
* `image/svg+xml`,
|
||||
*
|
||||
* @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration
|
||||
* @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1
|
||||
* @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia
|
||||
*/
|
||||
XML_SVG_IMAGE: 'image/svg+xml',
|
||||
})
|
||||
|
||||
/**
|
||||
* Namespaces that are used in this code base.
|
||||
*
|
||||
* @see http://www.w3.org/TR/REC-xml-names
|
||||
*/
|
||||
var NAMESPACE = freeze({
|
||||
/**
|
||||
* The XHTML namespace.
|
||||
*
|
||||
* @see http://www.w3.org/1999/xhtml
|
||||
*/
|
||||
HTML: 'http://www.w3.org/1999/xhtml',
|
||||
|
||||
/**
|
||||
* Checks if `uri` equals `NAMESPACE.HTML`.
|
||||
*
|
||||
* @param {string} [uri]
|
||||
*
|
||||
* @see NAMESPACE.HTML
|
||||
*/
|
||||
isHTML: function (uri) {
|
||||
return uri === NAMESPACE.HTML
|
||||
},
|
||||
|
||||
/**
|
||||
* The SVG namespace.
|
||||
*
|
||||
* @see http://www.w3.org/2000/svg
|
||||
*/
|
||||
SVG: 'http://www.w3.org/2000/svg',
|
||||
|
||||
/**
|
||||
* The `xml:` namespace.
|
||||
*
|
||||
* @see http://www.w3.org/XML/1998/namespace
|
||||
*/
|
||||
XML: 'http://www.w3.org/XML/1998/namespace',
|
||||
|
||||
/**
|
||||
* The `xmlns:` namespace
|
||||
*
|
||||
* @see https://www.w3.org/2000/xmlns/
|
||||
*/
|
||||
XMLNS: 'http://www.w3.org/2000/xmlns/',
|
||||
})
|
||||
|
||||
exports.freeze = freeze;
|
||||
exports.MIME_TYPE = MIME_TYPE;
|
||||
exports.NAMESPACE = NAMESPACE;
|
||||
59
node_modules/@xmldom/xmldom/package.json
generated
vendored
59
node_modules/@xmldom/xmldom/package.json
generated
vendored
@ -1,59 +0,0 @@
|
||||
{
|
||||
"name": "@xmldom/xmldom",
|
||||
"version": "0.7.1",
|
||||
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
|
||||
"keywords": [
|
||||
"w3c",
|
||||
"dom",
|
||||
"xml",
|
||||
"parser",
|
||||
"javascript",
|
||||
"DOMParser",
|
||||
"XMLSerializer",
|
||||
"ponyfill"
|
||||
],
|
||||
"homepage": "https://github.com/xmldom/xmldom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/xmldom/xmldom.git"
|
||||
},
|
||||
"main": "lib/dom-parser.js",
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"CHANGELOG.md",
|
||||
"LICENSE",
|
||||
"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": "^5.2.2",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-es5": "^1.5.0",
|
||||
"eslint-plugin-prettier": "^3.4.0",
|
||||
"get-stream": "^6.0.1",
|
||||
"jest": "^27.0.6",
|
||||
"nodemon": "^2.0.12",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.3.2",
|
||||
"xmltest": "^1.5.0",
|
||||
"yauzl": "^2.10.0"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/xmldom/xmldom/issues"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
329
node_modules/@xmldom/xmldom/readme.md
generated
vendored
329
node_modules/@xmldom/xmldom/readme.md
generated
vendored
@ -1,329 +0,0 @@
|
||||
# @xmldom/xmldom
|
||||
|
||||
[](LICENSE)
|
||||
[](https://www.npmjs.com/package/@xmldom/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)
|
||||
|
||||
**The currently active maintainers decided to publish this code as `@xmldom/xmldom` because [the npm library `xmldom` contains security issues but can currently not be published by us](https://github.com/xmldom/xmldom/issues/271).**
|
||||
|
||||
*For better readability in the docs we will continue to talk about this library as "xmldom".*
|
||||
|
||||
xmldom is a javascript [ponyfill](https://ponyfill.com/) for the following APIs supported in browsers:
|
||||
- convert an XML string into a DOM tree (`new DOMParser().parseFromString(xml, mimeType)` => `Document`)
|
||||
- create, access and modify a DOM tree (`new DOMImplementation().createDocument(...)` => `Document`, )
|
||||
- serialize a DOM tree back into an XML string (`new XMLSerializer().serializeToString(node)` => `string`)
|
||||
|
||||
Note that this `xmldom` library is not required if your code targets a modern browser. But this library is recommended if your code needs to also work in other runtimes like NodeJS or Rhino.
|
||||
|
||||
## Specs
|
||||
|
||||
The implementation is based on several specifications:
|
||||
|
||||
<!-- Should open in new tab and the links in the SVG should be clickable there! -->
|
||||
<a href="https://raw.githubusercontent.com/xmldom/xmldom/master/docs/specs.svg" target="_blank" rel="noopener noreferrer nofollow" ></a>
|
||||
|
||||
### DOM Parsing and Serialization
|
||||
|
||||
From the [W3C DOM Parsing and Serialization (WD 2016)](https://www.w3.org/TR/2016/WD-DOM-Parsing-20160517/) `xmldom` provides an implementation for the interfaces:
|
||||
- `DOMParser`
|
||||
- `XMLSerializer`
|
||||
|
||||
Note that there are some known deviations between this implementation and the W3 specifications.
|
||||
|
||||
Note: [The latest version of this spec](https://w3c.github.io/DOM-Parsing/) has the status "Editors Draft", since it is under active development. One major change is that [the definition of the `DOMParser` interface has been moved to the HTML spec](https://w3c.github.io/DOM-Parsing/#the-domparser-interface)
|
||||
|
||||
|
||||
### DOM
|
||||
|
||||
The original author claims that xmldom implements [DOM Level 2] in a "fully compatible" way and some parts of [DOM Level 3], but there are not enough tests to prove this. Both Specifications are now superseded by the [DOM Level 4 aka Living standard] wich has a much broader scope than xmldom.
|
||||
|
||||
xmldom implements the following interfaces (most constructors are currently not exposed):
|
||||
- `Attr`
|
||||
- `CDATASection`
|
||||
- `CharacterData`
|
||||
- `Comment`
|
||||
- `Document`
|
||||
- `DocumentFragment`
|
||||
- `DocumentType`
|
||||
- `DOMException` (constructor exposed)
|
||||
- `DOMImplementation` (constructor exposed)
|
||||
- `Element`
|
||||
- `Entity`
|
||||
- `EntityReference`
|
||||
- `LiveNodeList`
|
||||
- `NamedNodeMap`
|
||||
- `Node` (constructor exposed)
|
||||
- `NodeList`
|
||||
- `Notation`
|
||||
- `ProcessingInstruction`
|
||||
- `Text`
|
||||
|
||||
more details are available in the (incomplete) [API Reference](#api-reference) section.
|
||||
|
||||
### HTML
|
||||
|
||||
xmldom does not have any goal of supporting the full spec, but it has some capability to parse, report and serialize things differently when "detecting HTML" (by checking the default namespace).
|
||||
There is an upcoming change to better align the implementation with the latest specs, related to <https://github.com/xmldom/xmldom/issues/203>.
|
||||
|
||||
### SAX, XML, XMLNS
|
||||
|
||||
xmldom has an own SAX parser implementation to do the actual parsing, which implements some interfaces in alignment with the Java interfaces SAX defines:
|
||||
- `XMLReader`
|
||||
- `DOMHandler`
|
||||
|
||||
There is an idea/proposal to make ti possible to replace it with something else in <https://github.com/xmldom/xmldom/issues/55>
|
||||
|
||||
## Forked
|
||||
|
||||
**Original project location:** <https://github.com/jindw/xmldom>
|
||||
|
||||
More details about the transition can be found in the [CHANGELOG](CHANGELOG.md#maintainer-changes) and in <https://github.com/xmldom/xmldom/issues/62>
|
||||
|
||||
## Usage
|
||||
|
||||
### Install:
|
||||
|
||||
> npm install @xmldom/xmldom
|
||||
|
||||
### Example:
|
||||
|
||||
```javascript
|
||||
const { DOMParser } = require('@xmldom/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/xmldom'
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
* [DOMParser](https://developer.mozilla.org/en-US/docs/Web/API/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-US/docs/Web/API/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()
|
||||
* [DOMException](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html)
|
||||
The DOMException class has the following constants (and `value` of type `Number`):
|
||||
|
||||
1. `DOMException.INDEX_SIZE_ERR` (`1`)
|
||||
1. `DOMException.DOMSTRING_SIZE_ERR` (`2`)
|
||||
1. `DOMException.HIERARCHY_REQUEST_ERR` (`3`)
|
||||
1. `DOMException.WRONG_DOCUMENT_ERR` (`4`)
|
||||
1. `DOMException.INVALID_CHARACTER_ERR` (`5`)
|
||||
1. `DOMException.NO_DATA_ALLOWED_ERR` (`6`)
|
||||
1. `DOMException.NO_MODIFICATION_ALLOWED_ERR` (`7`)
|
||||
1. `DOMException.NOT_FOUND_ERR` (`8`)
|
||||
1. `DOMException.NOT_SUPPORTED_ERR` (`9`)
|
||||
1. `DOMException.INUSE_ATTRIBUTE_ERR` (`10`)
|
||||
1. `DOMException.INVALID_STATE_ERR` (`11`)
|
||||
1. `DOMException.SYNTAX_ERR` (`12`)
|
||||
1. `DOMException.INVALID_MODIFICATION_ERR` (`13`)
|
||||
1. `DOMException.NAMESPACE_ERR` (`14`)
|
||||
1. `DOMException.INVALID_ACCESS_ERR` (`15`)
|
||||
|
||||
The DOMException object has the following properties:
|
||||
code
|
||||
This property is of type Number.
|
||||
|
||||
* extends the Error type thrown as part of DOM API:
|
||||
|
||||
* [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
|
||||
15
node_modules/xmldom/.travis.yml
generated
vendored
Normal file
15
node_modules/xmldom/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
language: node_js
|
||||
|
||||
cache:
|
||||
npm: false
|
||||
|
||||
node_js:
|
||||
- '0.10'
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- proof
|
||||
- travis-ci
|
||||
|
||||
script: npm test
|
||||
8
node_modules/xmldom/LICENSE
generated
vendored
Normal file
8
node_modules/xmldom/LICENSE
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
You can choose any one of those:
|
||||
|
||||
The MIT License (MIT):
|
||||
|
||||
link:http://opensource.org/licenses/MIT
|
||||
|
||||
LGPL:
|
||||
http://www.gnu.org/licenses/lgpl.html
|
||||
4
node_modules/xmldom/__package__.js
generated
vendored
Normal file
4
node_modules/xmldom/__package__.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
this.addScript('dom.js',['DOMImplementation','XMLSerializer']);
|
||||
this.addScript('dom-parser.js',['DOMHandler','DOMParser'],
|
||||
['DOMImplementation','XMLReader']);
|
||||
this.addScript('sax.js','XMLReader');
|
||||
14
node_modules/xmldom/changelog
generated
vendored
Normal file
14
node_modules/xmldom/changelog
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
### Version 0.1.16
|
||||
|
||||
Sat May 4 14:58:03 UTC 2013
|
||||
|
||||
* Correctly handle multibyte Unicode greater than two byts. #57. #56.
|
||||
* Initial unit testing and test coverage. #53. #46. #19.
|
||||
* Create Bower `component.json` #52.
|
||||
|
||||
### Version 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
|
||||
10
node_modules/xmldom/component.json
generated
vendored
Normal file
10
node_modules/xmldom/component.json
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "xmldom",
|
||||
"version": "0.1.15",
|
||||
"main": "dom-parser.js",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"components"
|
||||
]
|
||||
}
|
||||
37
node_modules/@xmldom/xmldom/lib/dom-parser.js → node_modules/xmldom/dom-parser.js
generated
vendored
37
node_modules/@xmldom/xmldom/lib/dom-parser.js → node_modules/xmldom/dom-parser.js
generated
vendored
@ -1,10 +1,6 @@
|
||||
var conventions = require("./conventions");
|
||||
var entities = require('./entities');
|
||||
|
||||
var NAMESPACE = conventions.NAMESPACE;
|
||||
|
||||
function DOMParser(options){
|
||||
this.options = options ||{locator:{}};
|
||||
|
||||
}
|
||||
|
||||
DOMParser.prototype.parseFromString = function(source,mimeType){
|
||||
@ -15,18 +11,18 @@ DOMParser.prototype.parseFromString = function(source,mimeType){
|
||||
var locator = options.locator;
|
||||
var defaultNSMap = options.xmlns||{};
|
||||
var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1;
|
||||
var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
|
||||
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[''] = NAMESPACE.HTML;
|
||||
defaultNSMap['']= 'http://www.w3.org/1999/xhtml';
|
||||
}
|
||||
defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
|
||||
if(source && typeof source === 'string'){
|
||||
defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace';
|
||||
if(source){
|
||||
sax.parse(source,defaultNSMap,entityMap);
|
||||
}else{
|
||||
sax.errorHandler.error("invalid doc source");
|
||||
@ -62,8 +58,8 @@ function buildErrorHandler(errorImpl,domBuilder,locator){
|
||||
/**
|
||||
* +ContentHandler+ErrorHandler
|
||||
* +LexicalHandler+EntityResolver2
|
||||
* -DeclHandler-DTDHandler
|
||||
*
|
||||
* -DeclHandler-DTDHandler
|
||||
*
|
||||
* DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler
|
||||
* DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2
|
||||
* @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html
|
||||
@ -78,7 +74,7 @@ function position(locator,node){
|
||||
/**
|
||||
* @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);
|
||||
@ -92,7 +88,7 @@ DOMHandler.prototype = {
|
||||
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);
|
||||
@ -155,7 +151,7 @@ DOMHandler.prototype = {
|
||||
this.locator && position(this.locator,comm)
|
||||
appendElement(this, comm);
|
||||
},
|
||||
|
||||
|
||||
startCDATA:function() {
|
||||
//used in characters() methods
|
||||
this.cdata = true;
|
||||
@ -163,7 +159,7 @@ DOMHandler.prototype = {
|
||||
endCDATA:function() {
|
||||
this.cdata = false;
|
||||
},
|
||||
|
||||
|
||||
startDTD:function(name, publicId, systemId) {
|
||||
var impl = this.doc.implementation;
|
||||
if (impl && impl.createDocumentType) {
|
||||
@ -183,7 +179,8 @@ DOMHandler.prototype = {
|
||||
console.error('[xmldom error]\t'+error,_locator(this.locator));
|
||||
},
|
||||
fatalError:function(error) {
|
||||
throw new ParseError(error, this.locator);
|
||||
console.error('[xmldom fatalError]\t'+error,_locator(this.locator));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
function _locator(l){
|
||||
@ -247,11 +244,9 @@ function appendElement (hander,node) {
|
||||
}//appendChild and setAttributeNS are preformance key
|
||||
|
||||
//if(typeof require == 'function'){
|
||||
var sax = require('./sax');
|
||||
var XMLReader = sax.XMLReader;
|
||||
var ParseError = sax.ParseError;
|
||||
var htmlEntity = require('./entities');
|
||||
var XMLReader = require('./sax').XMLReader;
|
||||
var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation;
|
||||
exports.XMLSerializer = require('./dom').XMLSerializer ;
|
||||
exports.DOMParser = DOMParser;
|
||||
exports.__DOMHandler = DOMHandler;
|
||||
//}
|
||||
397
node_modules/@xmldom/xmldom/lib/dom.js → node_modules/xmldom/dom.js
generated
vendored
397
node_modules/@xmldom/xmldom/lib/dom.js → node_modules/xmldom/dom.js
generated
vendored
@ -1,71 +1,15 @@
|
||||
var conventions = require("./conventions");
|
||||
|
||||
var NAMESPACE = conventions.NAMESPACE;
|
||||
|
||||
/**
|
||||
* A prerequisite for `[].filter`, to drop elements that are empty
|
||||
* @param {string} input
|
||||
* @returns {boolean}
|
||||
/*
|
||||
* DOM Level 2
|
||||
* Object DOMException
|
||||
* @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html
|
||||
* @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html
|
||||
*/
|
||||
function notEmptyString (input) {
|
||||
return input !== ''
|
||||
}
|
||||
/**
|
||||
* @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace
|
||||
* @see https://infra.spec.whatwg.org/#ascii-whitespace
|
||||
*
|
||||
* @param {string} input
|
||||
* @returns {string[]} (can be empty)
|
||||
*/
|
||||
function splitOnASCIIWhitespace(input) {
|
||||
// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE
|
||||
return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : []
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds element as a key to current if it is not already present.
|
||||
*
|
||||
* @param {Record<string, boolean | undefined>} current
|
||||
* @param {string} element
|
||||
* @returns {Record<string, boolean | undefined>}
|
||||
*/
|
||||
function orderedSetReducer (current, element) {
|
||||
if (!current.hasOwnProperty(element)) {
|
||||
current[element] = true;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://infra.spec.whatwg.org/#ordered-set
|
||||
* @param {string} input
|
||||
* @returns {string[]}
|
||||
*/
|
||||
function toOrderedSet(input) {
|
||||
if (!input) return [];
|
||||
var list = splitOnASCIIWhitespace(input);
|
||||
return Object.keys(list.reduce(orderedSetReducer, {}))
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses `list.indexOf` to implement something like `Array.prototype.includes`,
|
||||
* which we can not rely on being available.
|
||||
*
|
||||
* @param {any[]} list
|
||||
* @returns {function(any): boolean}
|
||||
*/
|
||||
function arrayIncludes (list) {
|
||||
return function(element) {
|
||||
return list && list.indexOf(element) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
function copy(src,dest){
|
||||
for(var p in src){
|
||||
dest[p] = src[p];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\S]*?^})|\S.*?(?=[;\r\n]));?
|
||||
^\w+\.prototype\.([_\w]+)\s*=\s*(\S.*?(?=[;\r\n]));?
|
||||
@ -86,7 +30,7 @@ function _extends(Class,Super){
|
||||
pt.constructor = Class
|
||||
}
|
||||
}
|
||||
|
||||
var htmlns = 'http://www.w3.org/1999/xhtml' ;
|
||||
// Node Types
|
||||
var NodeType = {}
|
||||
var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
|
||||
@ -122,12 +66,7 @@ var INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = ((Exce
|
||||
var NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = ((ExceptionMessage[14]="Invalid namespace"),14);
|
||||
var INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = ((ExceptionMessage[15]="Invalid access"),15);
|
||||
|
||||
/**
|
||||
* DOM Level 2
|
||||
* Object DOMException
|
||||
* @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html
|
||||
* @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html
|
||||
*/
|
||||
|
||||
function DOMException(code, message) {
|
||||
if(message instanceof Error){
|
||||
var error = message;
|
||||
@ -143,7 +82,6 @@ function DOMException(code, message) {
|
||||
};
|
||||
DOMException.prototype = Error.prototype;
|
||||
copy(ExceptionCode,DOMException)
|
||||
|
||||
/**
|
||||
* @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177
|
||||
* The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.
|
||||
@ -175,7 +113,6 @@ NodeList.prototype = {
|
||||
return buf.join('');
|
||||
}
|
||||
};
|
||||
|
||||
function LiveNodeList(node,refresh){
|
||||
this._node = node;
|
||||
this._refresh = refresh
|
||||
@ -197,15 +134,9 @@ LiveNodeList.prototype.item = function(i){
|
||||
}
|
||||
|
||||
_extends(LiveNodeList,NodeList);
|
||||
|
||||
/**
|
||||
* Objects implementing the NamedNodeMap interface are used
|
||||
* to represent collections of nodes that can be accessed by name.
|
||||
* Note that NamedNodeMap does not inherit from NodeList;
|
||||
* NamedNodeMaps are not maintained in any particular order.
|
||||
* Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index,
|
||||
* but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,
|
||||
* and does not imply that the DOM specifies an order to these Nodes.
|
||||
*
|
||||
* Objects implementing the NamedNodeMap interface are used to represent collections of nodes that can be accessed by name. Note that NamedNodeMap does not inherit from NodeList; NamedNodeMaps are not maintained in any particular order. Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a NamedNodeMap, and does not imply that the DOM specifies an order to these Nodes.
|
||||
* NamedNodeMap objects in the DOM are live.
|
||||
* used for attributes or DocumentType entities
|
||||
*/
|
||||
@ -317,108 +248,55 @@ NamedNodeMap.prototype = {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The DOMImplementation interface represents an object providing methods
|
||||
* which are not dependent on any particular document.
|
||||
* Such an object is returned by the `Document.implementation` property.
|
||||
*
|
||||
* __The individual methods describe the differences compared to the specs.__
|
||||
*
|
||||
* @constructor
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN
|
||||
* @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)
|
||||
* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core
|
||||
* @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core
|
||||
* @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard
|
||||
* @see http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490
|
||||
*/
|
||||
function DOMImplementation() {
|
||||
}
|
||||
function DOMImplementation(/* Object */ features) {
|
||||
this._features = {};
|
||||
if (features) {
|
||||
for (var feature in features) {
|
||||
this._features = features[feature];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
DOMImplementation.prototype = {
|
||||
/**
|
||||
* The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.
|
||||
* The different implementations fairly diverged in what kind of features were reported.
|
||||
* The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.
|
||||
*
|
||||
* @deprecated It is deprecated and modern browsers return true in all cases.
|
||||
*
|
||||
* @param {string} feature
|
||||
* @param {string} [version]
|
||||
* @returns {boolean} always true
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN
|
||||
* @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core
|
||||
* @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard
|
||||
*/
|
||||
hasFeature: function(feature, version) {
|
||||
hasFeature: function(/* string */ feature, /* string */ version) {
|
||||
var versions = this._features[feature.toLowerCase()];
|
||||
if (versions && (!version || version in versions)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Creates an XML Document object of the specified type with its document element.
|
||||
*
|
||||
* __It behaves slightly different from the description in the living standard__:
|
||||
* - There is no interface/class `XMLDocument`, it returns a `Document` instance.
|
||||
* - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.
|
||||
* - this implementation is not validating names or qualified names
|
||||
* (when parsing XML strings, the SAX parser takes care of that)
|
||||
*
|
||||
* @param {string|null} namespaceURI
|
||||
* @param {string} qualifiedName
|
||||
* @param {DocumentType=null} doctype
|
||||
* @returns {Document}
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN
|
||||
* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)
|
||||
* @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core
|
||||
*
|
||||
* @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
|
||||
* @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
|
||||
* @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
|
||||
*/
|
||||
createDocument: function(namespaceURI, qualifiedName, doctype){
|
||||
// Introduced in DOM Level 2:
|
||||
createDocument:function(namespaceURI, qualifiedName, doctype){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR,WRONG_DOCUMENT_ERR
|
||||
var doc = new Document();
|
||||
doc.implementation = this;
|
||||
doc.childNodes = new NodeList();
|
||||
doc.doctype = doctype || null;
|
||||
if (doctype){
|
||||
doc.doctype = doctype;
|
||||
if(doctype){
|
||||
doc.appendChild(doctype);
|
||||
}
|
||||
if (qualifiedName){
|
||||
var root = doc.createElementNS(namespaceURI, qualifiedName);
|
||||
if(qualifiedName){
|
||||
var root = doc.createElementNS(namespaceURI,qualifiedName);
|
||||
doc.appendChild(root);
|
||||
}
|
||||
return doc;
|
||||
},
|
||||
/**
|
||||
* Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.
|
||||
*
|
||||
* __This behavior is slightly different from the in the specs__:
|
||||
* - this implementation is not validating names or qualified names
|
||||
* (when parsing XML strings, the SAX parser takes care of that)
|
||||
*
|
||||
* @param {string} qualifiedName
|
||||
* @param {string} [publicId]
|
||||
* @param {string} [systemId]
|
||||
* @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation
|
||||
* or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN
|
||||
* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core
|
||||
* @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard
|
||||
*
|
||||
* @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract
|
||||
* @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names
|
||||
* @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names
|
||||
*/
|
||||
createDocumentType: function(qualifiedName, publicId, systemId){
|
||||
// Introduced in DOM Level 2:
|
||||
createDocumentType:function(qualifiedName, publicId, systemId){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR
|
||||
var node = new DocumentType();
|
||||
node.name = qualifiedName;
|
||||
node.nodeName = qualifiedName;
|
||||
node.publicId = publicId || '';
|
||||
node.systemId = systemId || '';
|
||||
|
||||
node.publicId = publicId;
|
||||
node.systemId = systemId;
|
||||
// Introduced in DOM Level 2:
|
||||
//readonly attribute DOMString internalSubset;
|
||||
|
||||
//TODO:..
|
||||
// readonly attribute NamedNodeMap entities;
|
||||
// readonly attribute NamedNodeMap notations;
|
||||
return node;
|
||||
}
|
||||
};
|
||||
@ -558,25 +436,22 @@ function _visitNode(node,callback){
|
||||
|
||||
function Document(){
|
||||
}
|
||||
|
||||
function _onAddAttribute(doc,el,newAttr){
|
||||
doc && doc._inc++;
|
||||
var ns = newAttr.namespaceURI ;
|
||||
if(ns === NAMESPACE.XMLNS){
|
||||
if(ns == 'http://www.w3.org/2000/xmlns/'){
|
||||
//update namespace
|
||||
el._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value
|
||||
}
|
||||
}
|
||||
|
||||
function _onRemoveAttribute(doc,el,newAttr,remove){
|
||||
doc && doc._inc++;
|
||||
var ns = newAttr.namespaceURI ;
|
||||
if(ns === NAMESPACE.XMLNS){
|
||||
if(ns == 'http://www.w3.org/2000/xmlns/'){
|
||||
//update namespace
|
||||
delete el._nsMap[newAttr.prefix?newAttr.localName:'']
|
||||
}
|
||||
}
|
||||
|
||||
function _onUpdateChild(doc,el,newChild){
|
||||
if(doc && doc._inc){
|
||||
doc._inc++;
|
||||
@ -692,8 +567,8 @@ Document.prototype = {
|
||||
doctype : null,
|
||||
documentElement : null,
|
||||
_inc : 1,
|
||||
|
||||
insertBefore : function(newChild, refChild){//raises
|
||||
|
||||
insertBefore : function(newChild, refChild){//raises
|
||||
if(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){
|
||||
var child = newChild.firstChild;
|
||||
while(child){
|
||||
@ -706,7 +581,7 @@ Document.prototype = {
|
||||
if(this.documentElement == null && newChild.nodeType == ELEMENT_NODE){
|
||||
this.documentElement = newChild;
|
||||
}
|
||||
|
||||
|
||||
return _insertBefore(this,newChild,refChild),(newChild.ownerDocument = this),newChild;
|
||||
},
|
||||
removeChild : function(oldChild){
|
||||
@ -732,58 +607,13 @@ Document.prototype = {
|
||||
})
|
||||
return rtv;
|
||||
},
|
||||
|
||||
/**
|
||||
* The `getElementsByClassName` method of `Document` interface returns an array-like object
|
||||
* of all child elements which have **all** of the given class name(s).
|
||||
*
|
||||
* Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.
|
||||
*
|
||||
*
|
||||
* Warning: This is a live LiveNodeList.
|
||||
* Changes in the DOM will reflect in the array as the changes occur.
|
||||
* If an element selected by this array no longer qualifies for the selector,
|
||||
* it will automatically be removed. Be aware of this for iteration purposes.
|
||||
*
|
||||
* @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName
|
||||
* @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname
|
||||
*/
|
||||
getElementsByClassName: function(classNames) {
|
||||
var classNamesSet = toOrderedSet(classNames)
|
||||
return new LiveNodeList(this, function(base) {
|
||||
var ls = [];
|
||||
if (classNamesSet.length > 0) {
|
||||
_visitNode(base.documentElement, function(node) {
|
||||
if(node !== base && node.nodeType === ELEMENT_NODE) {
|
||||
var nodeClassNames = node.getAttribute('class')
|
||||
// can be null if the attribute does not exist
|
||||
if (nodeClassNames) {
|
||||
// before splitting and iterating just compare them for the most common case
|
||||
var matches = classNames === nodeClassNames;
|
||||
if (!matches) {
|
||||
var nodeClassNamesSet = toOrderedSet(nodeClassNames)
|
||||
matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet))
|
||||
}
|
||||
if(matches) {
|
||||
ls.push(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return ls;
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
//document factory method:
|
||||
createElement : function(tagName){
|
||||
var node = new Element();
|
||||
node.ownerDocument = this;
|
||||
node.nodeName = tagName;
|
||||
node.tagName = tagName;
|
||||
node.localName = tagName;
|
||||
node.childNodes = new NodeList();
|
||||
var attrs = node.attributes = new NamedNodeMap();
|
||||
attrs._ownerElement = node;
|
||||
@ -1101,49 +931,36 @@ function nodeSerializeToString(isHtml,nodeFilter){
|
||||
//console.log('###',this.nodeType,uri,prefix,buf.join(''))
|
||||
return buf.join('');
|
||||
}
|
||||
|
||||
function needNamespaceDefine(node, isHTML, visibleNamespaces) {
|
||||
var prefix = node.prefix || '';
|
||||
function needNamespaceDefine(node,isHTML, visibleNamespaces) {
|
||||
var prefix = node.prefix||'';
|
||||
var uri = node.namespaceURI;
|
||||
// According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) ,
|
||||
// and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl :
|
||||
// > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty.
|
||||
// in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using)
|
||||
// and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared :
|
||||
// > [...] Furthermore, the attribute value [...] must not be an empty string.
|
||||
// so serializing empty namespace value like xmlns:ds="" would produce an invalid XML document.
|
||||
if (!uri) {
|
||||
if (!prefix && !uri){
|
||||
return false;
|
||||
}
|
||||
if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {
|
||||
if (prefix === "xml" && uri === "http://www.w3.org/XML/1998/namespace"
|
||||
|| uri == 'http://www.w3.org/2000/xmlns/'){
|
||||
return false;
|
||||
}
|
||||
|
||||
var i = visibleNamespaces.length
|
||||
//console.log('@@@@',node.tagName,prefix,uri,visibleNamespaces)
|
||||
while (i--) {
|
||||
var ns = visibleNamespaces[i];
|
||||
// get namespace prefix
|
||||
if (ns.prefix === prefix) {
|
||||
return ns.namespace !== uri;
|
||||
//console.log(node.nodeType,node.tagName,ns.prefix,prefix)
|
||||
if (ns.prefix == prefix){
|
||||
return ns.namespace != uri;
|
||||
}
|
||||
}
|
||||
//console.log(isHTML,uri,prefix=='')
|
||||
//if(isHTML && prefix ==null && uri == 'http://www.w3.org/1999/xhtml'){
|
||||
// return false;
|
||||
//}
|
||||
//node.flag = '11111'
|
||||
//console.error(3,true,node.flag,node.prefix,node.namespaceURI)
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Well-formed constraint: No < in Attribute Values
|
||||
* The replacement text of any entity referred to directly or indirectly in an attribute value must not contain a <.
|
||||
* @see https://www.w3.org/TR/xml/#CleanAttrVals
|
||||
* @see https://www.w3.org/TR/xml/#NT-AttValue
|
||||
*/
|
||||
function addSerializedAttribute(buf, qualifiedName, value) {
|
||||
buf.push(' ', qualifiedName, '="', value.replace(/[<&"]/g,_xmlEncoder), '"')
|
||||
}
|
||||
|
||||
function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
||||
if (!visibleNamespaces) {
|
||||
visibleNamespaces = [];
|
||||
}
|
||||
|
||||
if(nodeFilter){
|
||||
node = nodeFilter(node);
|
||||
if(node){
|
||||
@ -1156,40 +973,20 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
||||
}
|
||||
//buf.sort.apply(attrs, attributeSorter);
|
||||
}
|
||||
|
||||
switch(node.nodeType){
|
||||
case ELEMENT_NODE:
|
||||
if (!visibleNamespaces) visibleNamespaces = [];
|
||||
var startVisibleNamespaces = visibleNamespaces.length;
|
||||
var attrs = node.attributes;
|
||||
var len = attrs.length;
|
||||
var child = node.firstChild;
|
||||
var nodeName = node.tagName;
|
||||
|
||||
isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML
|
||||
|
||||
var prefixedNodeName = nodeName
|
||||
if (!isHTML && !node.prefix && node.namespaceURI) {
|
||||
var defaultNS
|
||||
for (var ai = 0; ai < attrs.length; ai++) {
|
||||
if (attrs.item(ai).name === 'xmlns') {
|
||||
defaultNS = attrs.item(ai).value
|
||||
break
|
||||
}
|
||||
}
|
||||
if (defaultNS !== node.namespaceURI) {
|
||||
for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
|
||||
var namespace = visibleNamespaces[nsi]
|
||||
if (namespace.namespace === node.namespaceURI) {
|
||||
if (namespace.prefix) {
|
||||
prefixedNodeName = namespace.prefix + ':' + nodeName
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buf.push('<', prefixedNodeName);
|
||||
|
||||
isHTML = (htmlns === node.namespaceURI) ||isHTML
|
||||
buf.push('<',nodeName);
|
||||
|
||||
|
||||
|
||||
for(var i=0;i<len;i++){
|
||||
// add namespaces for attributes
|
||||
var attr = attrs.item(i);
|
||||
@ -1199,23 +996,23 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
||||
visibleNamespaces.push({ prefix: '', namespace: attr.value });
|
||||
}
|
||||
}
|
||||
|
||||
for(var i=0;i<len;i++){
|
||||
var attr = attrs.item(i);
|
||||
if (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {
|
||||
var prefix = attr.prefix||'';
|
||||
var uri = attr.namespaceURI;
|
||||
addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
|
||||
var ns = prefix ? ' xmlns:' + prefix : " xmlns";
|
||||
buf.push(ns, '="' , uri , '"');
|
||||
visibleNamespaces.push({ prefix: prefix, namespace:uri });
|
||||
}
|
||||
serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
|
||||
}
|
||||
|
||||
// add namespace for current node
|
||||
if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
|
||||
if (needNamespaceDefine(node,isHTML, visibleNamespaces)) {
|
||||
var prefix = node.prefix||'';
|
||||
var uri = node.namespaceURI;
|
||||
addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
|
||||
var ns = prefix ? ' xmlns:' + prefix : " xmlns";
|
||||
buf.push(ns, '="' , uri , '"');
|
||||
visibleNamespaces.push({ prefix: prefix, namespace:uri });
|
||||
}
|
||||
|
||||
@ -1227,18 +1024,18 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
||||
if(child.data){
|
||||
buf.push(child.data);
|
||||
}else{
|
||||
serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
|
||||
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
|
||||
}
|
||||
child = child.nextSibling;
|
||||
}
|
||||
}else
|
||||
{
|
||||
while(child){
|
||||
serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
|
||||
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
|
||||
child = child.nextSibling;
|
||||
}
|
||||
}
|
||||
buf.push('</',prefixedNodeName,'>');
|
||||
buf.push('</',nodeName,'>');
|
||||
}else{
|
||||
buf.push('/>');
|
||||
}
|
||||
@ -1249,32 +1046,14 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
||||
case DOCUMENT_FRAGMENT_NODE:
|
||||
var child = node.firstChild;
|
||||
while(child){
|
||||
serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
|
||||
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
|
||||
child = child.nextSibling;
|
||||
}
|
||||
return;
|
||||
case ATTRIBUTE_NODE:
|
||||
return addSerializedAttribute(buf, node.name, node.value);
|
||||
return buf.push(' ',node.name,'="',node.value.replace(/[<&"]/g,_xmlEncoder),'"');
|
||||
case TEXT_NODE:
|
||||
/**
|
||||
* The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,
|
||||
* except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.
|
||||
* If they are needed elsewhere, they must be escaped using either numeric character references or the strings
|
||||
* `&` and `<` respectively.
|
||||
* The right angle bracket (>) may be represented using the string " > ", and must, for compatibility,
|
||||
* be escaped using either `>` or a character reference when it appears in the string `]]>` in content,
|
||||
* when that string is not marking the end of a CDATA section.
|
||||
*
|
||||
* In the content of elements, character data is any string of characters
|
||||
* which does not contain the start-delimiter of any markup
|
||||
* and does not include the CDATA-section-close delimiter, `]]>`.
|
||||
*
|
||||
* @see https://www.w3.org/TR/xml/#NT-CharData
|
||||
*/
|
||||
return buf.push(node.data
|
||||
.replace(/[<&]/g,_xmlEncoder)
|
||||
.replace(/]]>/g, ']]>')
|
||||
);
|
||||
return buf.push(node.data.replace(/[<&]/g,_xmlEncoder));
|
||||
case CDATA_SECTION_NODE:
|
||||
return buf.push( '<![CDATA[',node.data,']]>');
|
||||
case COMMENT_NODE:
|
||||
@ -1284,13 +1063,13 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
|
||||
var sysid = node.systemId;
|
||||
buf.push('<!DOCTYPE ',node.name);
|
||||
if(pubid){
|
||||
buf.push(' PUBLIC ', pubid);
|
||||
buf.push(' PUBLIC "',pubid);
|
||||
if (sysid && sysid!='.') {
|
||||
buf.push(' ', sysid);
|
||||
buf.push( '" "',sysid);
|
||||
}
|
||||
buf.push('>');
|
||||
buf.push('">');
|
||||
}else if(sysid && sysid!='.'){
|
||||
buf.push(' SYSTEM ', sysid, '>');
|
||||
buf.push(' SYSTEM "',sysid,'">');
|
||||
}else{
|
||||
var sub = node.internalSubset;
|
||||
if(sub){
|
||||
@ -1406,12 +1185,10 @@ try{
|
||||
return this.$$length;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(Node.prototype,'textContent',{
|
||||
get:function(){
|
||||
return getTextContent(this);
|
||||
},
|
||||
|
||||
set:function(data){
|
||||
switch(this.nodeType){
|
||||
case ELEMENT_NODE:
|
||||
@ -1423,8 +1200,8 @@ try{
|
||||
this.appendChild(this.ownerDocument.createTextNode(data));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
//TODO:
|
||||
this.data = data;
|
||||
this.value = data;
|
||||
this.nodeValue = data;
|
||||
@ -1449,7 +1226,6 @@ try{
|
||||
return node.nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
__set__ = function(object,key,value){
|
||||
//console.log(value)
|
||||
object['$$'+key] = value
|
||||
@ -1459,11 +1235,6 @@ try{
|
||||
}
|
||||
|
||||
//if(typeof require == 'function'){
|
||||
exports.DocumentType = DocumentType;
|
||||
exports.DOMException = DOMException;
|
||||
exports.DOMImplementation = DOMImplementation;
|
||||
exports.Element = Element;
|
||||
exports.Node = Node;
|
||||
exports.NodeList = NodeList;
|
||||
exports.XMLSerializer = XMLSerializer;
|
||||
//}
|
||||
37
node_modules/@xmldom/xmldom/lib/entities.js → node_modules/xmldom/entities.js
generated
vendored
37
node_modules/@xmldom/xmldom/lib/entities.js → node_modules/xmldom/entities.js
generated
vendored
@ -1,28 +1,4 @@
|
||||
var freeze = require('./conventions').freeze;
|
||||
|
||||
/**
|
||||
* The entities that are predefined in every XML document.
|
||||
*
|
||||
* @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1
|
||||
* @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0
|
||||
* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia
|
||||
*/
|
||||
exports.XML_ENTITIES = freeze({amp:'&', apos:"'", gt:'>', lt:'<', quot:'"'})
|
||||
|
||||
/**
|
||||
* A map of currently 241 entities that are detected in an HTML document.
|
||||
* They contain all entries from `XML_ENTITIES`.
|
||||
*
|
||||
* @see XML_ENTITIES
|
||||
* @see DOMParser.parseFromString
|
||||
* @see DOMImplementation.prototype.createHTMLDocument
|
||||
* @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec
|
||||
* @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names
|
||||
* @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML
|
||||
* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)
|
||||
* @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)
|
||||
*/
|
||||
exports.HTML_ENTITIES = freeze({
|
||||
exports.entityMap = {
|
||||
lt: '<',
|
||||
gt: '>',
|
||||
amp: '&',
|
||||
@ -90,7 +66,7 @@ exports.HTML_ENTITIES = freeze({
|
||||
yacute: "ý",
|
||||
thorn: "þ",
|
||||
yuml: "ÿ",
|
||||
nbsp: "\u00a0",
|
||||
nbsp: " ",
|
||||
iexcl: "¡",
|
||||
cent: "¢",
|
||||
pound: "£",
|
||||
@ -264,10 +240,5 @@ exports.HTML_ENTITIES = freeze({
|
||||
clubs: "♣",
|
||||
hearts: "♥",
|
||||
diams: "♦"
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated use `HTML_ENTITIES` instead
|
||||
* @see HTML_ENTITIES
|
||||
*/
|
||||
exports.entityMap = exports.HTML_ENTITIES
|
||||
};
|
||||
//for(var n in exports.entityMap){console.log(exports.entityMap[n].charCodeAt())}
|
||||
92
node_modules/xmldom/package.json
generated
vendored
Normal file
92
node_modules/xmldom/package.json
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"xmldom@0.2.1",
|
||||
"."
|
||||
]
|
||||
],
|
||||
"_from": "xmldom@0.2.1",
|
||||
"_id": "xmldom@0.2.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-kXXiYvmblIgEemGeB75y97FyaZavx6SQhGppLw5TKWAD2Wd0KAly0g23eVLh17YcpxZpnFym1Qk/eaRjy1APPg==",
|
||||
"_location": "/xmldom",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "xmldom@0.2.1",
|
||||
"name": "xmldom",
|
||||
"escapedName": "xmldom",
|
||||
"rawSpec": "0.2.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.2.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.2.1.tgz",
|
||||
"_spec": "0.2.1",
|
||||
"_where": ".",
|
||||
"author": {
|
||||
"name": "jindw",
|
||||
"email": "jindw@xidea.org",
|
||||
"url": "http://www.xidea.org"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/xmldom/xmldom/issues",
|
||||
"email": "jindw@xidea.org"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Yaron Naveh",
|
||||
"email": "yaronn01@gmail.com",
|
||||
"url": "http://webservices20.blogspot.com/"
|
||||
},
|
||||
{
|
||||
"name": "Harutyun Amirjanyan",
|
||||
"email": "amirjanyan@gmail.com",
|
||||
"url": "https://github.com/nightwing"
|
||||
},
|
||||
{
|
||||
"name": "Alan Gutierrez",
|
||||
"email": "alan@prettyrobots.com",
|
||||
"url": "http://www.prettyrobots.com/"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "A W3C Standard XML DOM(Level2 CORE) implementation and parser(DOMParser/XMLSerializer).",
|
||||
"devDependencies": {
|
||||
"proof": "0.0.28"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.1"
|
||||
},
|
||||
"homepage": "https://github.com/xmldom/xmldom",
|
||||
"keywords": [
|
||||
"w3c",
|
||||
"dom",
|
||||
"xml",
|
||||
"parser",
|
||||
"javascript",
|
||||
"DOMParser",
|
||||
"XMLSerializer"
|
||||
],
|
||||
"license": "(LGPL-2.0 or MIT)",
|
||||
"main": "./dom-parser.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "jindw",
|
||||
"email": "jindw@xidea.org",
|
||||
"url": "http://www.xidea.org"
|
||||
}
|
||||
],
|
||||
"name": "xmldom",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/xmldom/xmldom.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "proof platform win32 && proof test */*/*.t.js || t/test"
|
||||
},
|
||||
"version": "0.2.1"
|
||||
}
|
||||
219
node_modules/xmldom/readme.md
generated
vendored
Normal file
219
node_modules/xmldom/readme.md
generated
vendored
Normal file
@ -0,0 +1,219 @@
|
||||
# XMLDOM [](http://travis-ci.org/bigeasy/xmldom) [](https://coveralls.io/r/bigeasy/xmldom) [](http://badge.fury.io/js/xmldom)
|
||||
|
||||
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.
|
||||
|
||||
Install:
|
||||
-------
|
||||
>npm install xmldom
|
||||
|
||||
Example:
|
||||
====
|
||||
```javascript
|
||||
var DOMParser = require('xmldom').DOMParser;
|
||||
var 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');
|
||||
var nsAttr = doc.documentElement.getAttributeNS('./lite','x')
|
||||
console.info(nsAttr)
|
||||
console.info(doc)
|
||||
```
|
||||
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
|
||||
104
node_modules/@xmldom/xmldom/lib/sax.js → node_modules/xmldom/sax.js
generated
vendored
104
node_modules/@xmldom/xmldom/lib/sax.js → node_modules/xmldom/sax.js
generated
vendored
@ -1,5 +1,3 @@
|
||||
var NAMESPACE = require("./conventions").NAMESPACE;
|
||||
|
||||
//[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)*
|
||||
@ -20,21 +18,6 @@ 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 />
|
||||
|
||||
/**
|
||||
* Creates an error that will not be caught by XMLReader aka the SAX parser.
|
||||
*
|
||||
* @param {string} message
|
||||
* @param {any?} locator Optional, can provide details about the location in the source
|
||||
* @constructor
|
||||
*/
|
||||
function ParseError(message, locator) {
|
||||
this.message = message
|
||||
this.locator = locator
|
||||
if(Error.captureStackTrace) Error.captureStackTrace(this, ParseError);
|
||||
}
|
||||
ParseError.prototype = new Error();
|
||||
ParseError.prototype.name = ParseError.name
|
||||
|
||||
function XMLReader(){
|
||||
|
||||
}
|
||||
@ -117,11 +100,12 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
switch(source.charAt(tagStart+1)){
|
||||
case '/':
|
||||
var end = source.indexOf('>',tagStart+3);
|
||||
var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
|
||||
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</)){
|
||||
@ -129,6 +113,8 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
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()
|
||||
@ -140,7 +126,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
}
|
||||
}
|
||||
if(!endMatch){
|
||||
errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName ); // No known test case
|
||||
errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName );
|
||||
}
|
||||
}else{
|
||||
parseStack.push(config)
|
||||
@ -180,6 +166,7 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
position(a.offset);
|
||||
a.locator = copyLocator(locator,{});
|
||||
}
|
||||
//}catch(e){console.error('@@@@@'+e)}
|
||||
domBuilder.locator = locator2
|
||||
if(appendElement(el,domBuilder,currentNSMap)){
|
||||
parseStack.push(el)
|
||||
@ -190,19 +177,20 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
|
||||
parseStack.push(el)
|
||||
}
|
||||
}
|
||||
|
||||
if (NAMESPACE.isHTML(el.uri) && !el.closed) {
|
||||
|
||||
|
||||
|
||||
if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){
|
||||
end = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder)
|
||||
} else {
|
||||
}else{
|
||||
end++;
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
if (e instanceof ParseError) {
|
||||
throw e;
|
||||
}
|
||||
errorHandler.error('element parse error: '+e)
|
||||
//errorHandler.error('element parse error: '+e);
|
||||
end = -1;
|
||||
//throw e;
|
||||
}
|
||||
if(end>start){
|
||||
start = end;
|
||||
@ -223,16 +211,6 @@ function copyLocator(f,t){
|
||||
* @return end of the elementStartPart(end of elementEndPart for selfClosed el)
|
||||
*/
|
||||
function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){
|
||||
|
||||
/**
|
||||
* @param {string} qname
|
||||
* @param {string} value
|
||||
* @param {number} startIndex
|
||||
*/
|
||||
function addAttribute(qname, value, startIndex) {
|
||||
if (qname in el.attributeNames) errorHandler.fatalError('Attribute ' + qname + ' redefined')
|
||||
el.addValue(qname, value, startIndex)
|
||||
}
|
||||
var attrName;
|
||||
var value;
|
||||
var p = ++start;
|
||||
@ -248,7 +226,7 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error
|
||||
s = S_EQ;
|
||||
}else{
|
||||
//fatalError: equal must after attrName or space after attrName
|
||||
throw new Error('attribute equal must after attrName'); // No known test case
|
||||
throw new Error('attribute equal must after attrName');
|
||||
}
|
||||
break;
|
||||
case '\'':
|
||||
@ -263,7 +241,7 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error
|
||||
p = source.indexOf(c,start)
|
||||
if(p>0){
|
||||
value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
|
||||
addAttribute(attrName, value, start-1);
|
||||
el.add(attrName,value,start-1);
|
||||
s = S_ATTR_END;
|
||||
}else{
|
||||
//fatalError: no end quot match
|
||||
@ -272,14 +250,14 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error
|
||||
}else if(s == S_ATTR_NOQUOT_VALUE){
|
||||
value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
|
||||
//console.log(attrName,value,start,p)
|
||||
addAttribute(attrName, value, start);
|
||||
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 "="'); // No known test case
|
||||
throw new Error('attribute value must after "="');
|
||||
}
|
||||
break;
|
||||
case '/':
|
||||
@ -297,10 +275,11 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error
|
||||
break;
|
||||
//case S_EQ:
|
||||
default:
|
||||
throw new Error("attribute invalid close char('/')") // No known test case
|
||||
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));
|
||||
@ -326,13 +305,13 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error
|
||||
value = attrName;
|
||||
}
|
||||
if(s == S_ATTR_NOQUOT_VALUE){
|
||||
errorHandler.warning('attribute "'+value+'" missed quot(")!');
|
||||
addAttribute(attrName, value.replace(/&#?\w+;/g,entityReplacer), start)
|
||||
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
|
||||
el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start)
|
||||
}else{
|
||||
if(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){
|
||||
if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !value.match(/^(?:disabled|checked|selected)$/i)){
|
||||
errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
|
||||
}
|
||||
addAttribute(value, value, start)
|
||||
el.add(value,value,start)
|
||||
}
|
||||
break;
|
||||
case S_EQ:
|
||||
@ -357,7 +336,7 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error
|
||||
case S_ATTR_NOQUOT_VALUE:
|
||||
var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer);
|
||||
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
|
||||
addAttribute(attrName, value, start)
|
||||
el.add(attrName,value,start)
|
||||
case S_ATTR_END:
|
||||
s = S_TAG_SPACE;
|
||||
break;
|
||||
@ -377,10 +356,10 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error
|
||||
//case S_ATTR_NOQUOT_VALUE:void();break;
|
||||
case S_ATTR_SPACE:
|
||||
var tagName = el.tagName;
|
||||
if (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
|
||||
if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !attrName.match(/^(?:disabled|checked|selected)$/i)){
|
||||
errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!')
|
||||
}
|
||||
addAttribute(attrName, attrName, start);
|
||||
el.add(attrName,attrName,start);
|
||||
start = p;
|
||||
s = S_ATTR;
|
||||
break;
|
||||
@ -436,7 +415,7 @@ function appendElement(el,domBuilder,currentNSMap){
|
||||
//console.log(currentNSMap,1)
|
||||
}
|
||||
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
|
||||
a.uri = NAMESPACE.XMLNS
|
||||
a.uri = 'http://www.w3.org/2000/xmlns/'
|
||||
domBuilder.startPrefixMapping(nsPrefix, value)
|
||||
}
|
||||
}
|
||||
@ -446,7 +425,7 @@ function appendElement(el,domBuilder,currentNSMap){
|
||||
var prefix = a.prefix;
|
||||
if(prefix){//no prefix attribute has no namespace
|
||||
if(prefix === 'xml'){
|
||||
a.uri = NAMESPACE.XML;
|
||||
a.uri = 'http://www.w3.org/XML/1998/namespace';
|
||||
}if(prefix !== 'xmlns'){
|
||||
a.uri = currentNSMap[prefix || '']
|
||||
|
||||
@ -552,18 +531,11 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
|
||||
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 pubid = len>3 && /^public$/i.test(matchs[2][0]) && matchs[3][0]
|
||||
var sysid = len>4 && matchs[4][0];
|
||||
var lastMatch = matchs[len-1]
|
||||
domBuilder.startDTD(name, pubid, sysid);
|
||||
domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'),
|
||||
sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2'));
|
||||
domBuilder.endDTD();
|
||||
|
||||
return lastMatch.index+lastMatch[0].length
|
||||
@ -589,8 +561,11 @@ function parseInstruction(source,start,domBuilder){
|
||||
return -1;
|
||||
}
|
||||
|
||||
function ElementAttributes(){
|
||||
this.attributeNames = {}
|
||||
/**
|
||||
* @param source
|
||||
*/
|
||||
function ElementAttributes(source){
|
||||
|
||||
}
|
||||
ElementAttributes.prototype = {
|
||||
setTagName:function(tagName){
|
||||
@ -599,11 +574,10 @@ ElementAttributes.prototype = {
|
||||
}
|
||||
this.tagName = tagName
|
||||
},
|
||||
addValue:function(qName, value, offset) {
|
||||
add:function(qName,value,offset){
|
||||
if(!tagNamePattern.test(qName)){
|
||||
throw new Error('invalid attribute:'+qName)
|
||||
}
|
||||
this.attributeNames[qName] = this.length;
|
||||
this[this.length++] = {qName:qName,value:value,offset:offset}
|
||||
},
|
||||
length:0,
|
||||
@ -639,4 +613,4 @@ function split(source,start){
|
||||
}
|
||||
|
||||
exports.XMLReader = XMLReader;
|
||||
exports.ParseError = ParseError;
|
||||
|
||||
1
node_modules/xpath/.npmignore
generated
vendored
Normal file
1
node_modules/xpath/.npmignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
||||
133
node_modules/xpath/README.md
generated
vendored
Normal file
133
node_modules/xpath/README.md
generated
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
## xpath
|
||||
DOM 3 XPath 1.0 implemention and helper for JavaScript, with node.js support.
|
||||
|
||||
Originally written by Cameron McCormack ([blog](http://mcc.id.au/xpathjs)).
|
||||
|
||||
Additional contributions from
|
||||
Yaron Naveh ([blog](http://webservices20.blogspot.com/))
|
||||
goto100
|
||||
Thomas Weinert
|
||||
Jimmy Rishe
|
||||
and [others](https://github.com/goto100/xpath/graphs/contributors)
|
||||
|
||||
## Install
|
||||
Install with [npm](http://github.com/isaacs/npm):
|
||||
|
||||
npm install xpath
|
||||
|
||||
xpath is xml engine agnostic but I recommend to use [xmldom](https://github.com/jindw/xmldom):
|
||||
|
||||
npm install xmldom
|
||||
|
||||
## API Documentation
|
||||
|
||||
Can be found [here](https://github.com/goto100/xpath/blob/master/docs/xpath%20methods.md). See below for example usage.
|
||||
|
||||
## Your first xpath:
|
||||
`````javascript
|
||||
var xpath = require('xpath')
|
||||
, dom = require('xmldom').DOMParser
|
||||
|
||||
var xml = "<book><title>Harry Potter</title></book>"
|
||||
var doc = new dom().parseFromString(xml)
|
||||
var nodes = xpath.select("//title", doc)
|
||||
|
||||
console.log(nodes[0].localName + ": " + nodes[0].firstChild.data)
|
||||
console.log("Node: " + nodes[0].toString())
|
||||
`````
|
||||
➡
|
||||
|
||||
title: Harry Potter
|
||||
Node: <title>Harry Potter</title>
|
||||
|
||||
### Alternatively
|
||||
|
||||
Using the same interface you have on modern browsers ([MDN])
|
||||
|
||||
`````javascript
|
||||
var node = null;
|
||||
var xml = "<book author='J. K. Rowling'><title>Harry Potter</title></book>"
|
||||
var doc = new dom().parseFromString(xml)
|
||||
var result = xpath.evaluate(
|
||||
"/book/title", // xpathExpression
|
||||
doc, // contextNode
|
||||
null, // namespaceResolver
|
||||
xpath.XPathResult.ANY_TYPE, // resultType
|
||||
null // result
|
||||
)
|
||||
|
||||
node = result.iterateNext();
|
||||
while (node) {
|
||||
console.log(node.localName + ": " + node.firstChild.data);
|
||||
console.log("Node: " + node.toString());
|
||||
|
||||
node = result.iterateNext();
|
||||
}
|
||||
`````
|
||||
➡
|
||||
|
||||
title: Harry Potter
|
||||
Node: <title>Harry Potter</title>
|
||||
|
||||
## Evaluate string values directly:
|
||||
`````javascript
|
||||
var xml = "<book><title>Harry Potter</title></book>";
|
||||
var doc = new dom().parseFromString(xml);
|
||||
var title = xpath.select("string(//title)", doc);
|
||||
|
||||
console.log(title);
|
||||
`````
|
||||
➡
|
||||
|
||||
Harry Potter
|
||||
|
||||
## Namespaces
|
||||
`````javascript
|
||||
var xml = "<book><title xmlns='myns'>Harry Potter</title></book>"
|
||||
var doc = new dom().parseFromString(xml)
|
||||
var node = xpath.select("//*[local-name(.)='title' and namespace-uri(.)='myns']", doc)[0]
|
||||
|
||||
console.log(node.namespaceURI)
|
||||
`````
|
||||
➡
|
||||
|
||||
myns
|
||||
|
||||
## Namespaces with easy mappings
|
||||
`````javascript
|
||||
var xml = "<book xmlns:bookml='http://example.com/book'><bookml:title>Harry Potter</bookml:title></book>"
|
||||
var select = xpath.useNamespaces({"bookml": "http://example.com/book"});
|
||||
|
||||
console.log(select('//bookml:title/text()', doc)[0].nodeValue);
|
||||
`````
|
||||
➡
|
||||
|
||||
Harry Potter
|
||||
|
||||
## Default namespace with mapping
|
||||
`````javascript
|
||||
var xml = "<book xmlns='http://example.com/book'><title>Harry Potter</title></book>"
|
||||
var select = xpath.useNamespaces({"bookml": "http://example.com/book"});
|
||||
|
||||
console.log(select('//bookml:title/text()', doc)[0].nodeValue);
|
||||
`````
|
||||
➡
|
||||
|
||||
Harry Potter
|
||||
|
||||
## Attributes
|
||||
`````javascript
|
||||
var xml = "<book author='J. K. Rowling'><title>Harry Potter</title></book>"
|
||||
var doc = new dom().parseFromString(xml)
|
||||
var author = xpath.select1("/book/@author", doc).value
|
||||
|
||||
console.log(author)
|
||||
`````
|
||||
➡
|
||||
|
||||
J. K. Rowling
|
||||
|
||||
[MDN]: https://developer.mozilla.org/en/docs/Web/API/Document/evaluate
|
||||
|
||||
## License
|
||||
MIT
|
||||
62
node_modules/xpath/docs/XPathEvaluator.md
generated
vendored
Normal file
62
node_modules/xpath/docs/XPathEvaluator.md
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
# `XPathEvaluator`
|
||||
|
||||
The `xpath.parse()` method returns an `XPathEvaluator`, which contains the following methods.
|
||||
|
||||
Each of these methods takes an optional `options` object, which can contain any of the following properties:
|
||||
|
||||
`namespaces` - a namespace resolver. See the [documentation page](namespace%20resolvers.md) for details.
|
||||
|
||||
`variables` - a variable resolver. See the [documentation page](variable%20resolvers.md) for details.
|
||||
|
||||
`functions` - a function resolver. See the [documentation page](function%20resolvers.md) for details.
|
||||
|
||||
`node` - the context node for evaluating the expression
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/characters/character[@greeting = $greeting]');
|
||||
var character = evaluator.select1({
|
||||
node: myCharacterDoc,
|
||||
variables: {
|
||||
greeting: "Hello, I'm Harry, Harry Potter."
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## `XPathEvaluator` methods
|
||||
|
||||
`evaluate([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result. The resulting type is determined based on the type of the expression, using the same criteria as [`xpath.select`](xpath%20methods.md).
|
||||
|
||||
`evaluateNumber([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result as a number.
|
||||
|
||||
`evaluateString([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result as a string.
|
||||
|
||||
`evaluateBoolean([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result as a boolean value.
|
||||
|
||||
`evaluateNodeSet([options])`
|
||||
|
||||
Evaluates the XPath expression and returns the result as an XNodeSet. See the [documentation page](#) for details on this interface.
|
||||
|
||||
This is only valid for expressions that evaluate to a node set.
|
||||
|
||||
`select([options])`
|
||||
|
||||
Evaluates the XPath expression and returns an array of the resulting nodes, in document order.
|
||||
|
||||
This is only valid for expressions that evaluate to a node set.
|
||||
|
||||
`select1([options])`
|
||||
|
||||
Evaluates the XPath expression and the first node in the resulting node set, in document order. Returns `undefined`
|
||||
|
||||
This is only valid for expressions that evaluate to a node set.
|
||||
|
||||
47
node_modules/xpath/docs/XPathResult.md
generated
vendored
Normal file
47
node_modules/xpath/docs/XPathResult.md
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
# XPathResult interface
|
||||
|
||||
Represents the result of an XPath expression. This interface is used for the parameters passed into custom functions
|
||||
used in [function resolvers](function resolvers.md) and can represent a number, a string, a boolean value, or a node set.
|
||||
|
||||
## Methods
|
||||
|
||||
```js
|
||||
booleanValue() -> boolean
|
||||
```
|
||||
|
||||
Returns the boolean value of the result in accordance with the XPath 1.0 spec.
|
||||
|
||||
```js
|
||||
numberValue() -> number
|
||||
```
|
||||
|
||||
Returns the numeric value of the result in accordance with the XPath 1.0 spec.
|
||||
|
||||
```js
|
||||
stringValue() -> string
|
||||
```
|
||||
|
||||
Returns the string value of the result in accordance with the XPath 1.0 spec.
|
||||
|
||||
## Methods and properties that are only present on `XPathResult`s representing node sets
|
||||
|
||||
```js
|
||||
toArray() -> Array of nodes
|
||||
```
|
||||
|
||||
Returns an array of the nodes in the node set, in document order.
|
||||
|
||||
```js
|
||||
first() -> Node
|
||||
```
|
||||
|
||||
Returns the first node in the node set, in document order.
|
||||
|
||||
```js
|
||||
size -> number
|
||||
```
|
||||
|
||||
Returns the number of nodes in this node set
|
||||
|
||||
|
||||
|
||||
88
node_modules/xpath/docs/function resolvers.md
generated
vendored
Normal file
88
node_modules/xpath/docs/function resolvers.md
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
# Function Resolvers
|
||||
|
||||
The methods on the [XPathEvaluator](XPathEvaluator.md) type can optionally take a function resolver to resolve
|
||||
function references in the XPath expression being evaluated.
|
||||
|
||||
There are three ways to specify a function resolver and you can use any one of them depending on which is
|
||||
most suited to your particular situation.
|
||||
|
||||
Note that if your functions are in a namespace (e.g. `fn:myFunction()`), you must use the second or third
|
||||
type as the plain object implementation does not support namespaces.
|
||||
|
||||
## Function implementations
|
||||
|
||||
Custom XPath functions are implemented as JavaScript functions taking one or more arguments.
|
||||
|
||||
The first argument passed in is a context object containing a number of properties relating to the execution context,
|
||||
the most important being `contextNode`, the context in which the function is being evaluated.
|
||||
|
||||
The remaining arguments are the arguments passed into the XPath function, as instances of the `XPathResult` interface.
|
||||
Please see [the documentation on that interface](XPathResult.md) for details.
|
||||
|
||||
As the return value, you can return a string, number, boolean, single node, or array of nodes.
|
||||
|
||||
## Function Resolver Type 1: Plain object
|
||||
|
||||
A plain object with function names as the keys and function implementations as the values.
|
||||
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('squareRoot(10)');
|
||||
var aboutPi = evaluator.evaluateNumber({
|
||||
functions: {
|
||||
'squareRoot': function (c, value) {
|
||||
return Math.sqrt(value.numberValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Function Resolver Type 2: Function
|
||||
|
||||
A function that takes a function name as its first parameter and an optional namespace URI as its second parameter
|
||||
and returns a function based on the name and namespace.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('math:squareRoot(10)');
|
||||
var aboutPi = evaluator.evaluateNumber({
|
||||
functions: function (name, namespace) {
|
||||
if (name === 'squareRoot' && namespace === 'http://sample.org/math/') {
|
||||
return function (c, value) {
|
||||
return Math.sqrt(value.numberValue());
|
||||
};
|
||||
}
|
||||
},
|
||||
namespaces: {
|
||||
math: 'http://sample.org/math/'
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Function Resolver Type 3: Object with `getFunction` method
|
||||
|
||||
An object with a method named `getFunction` that works in the same way as the function-based function resolver
|
||||
described above.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('math:squareRoot(10)');
|
||||
var aboutPi = evaluator.evaluateNumber({
|
||||
functions: {
|
||||
getFunction: function (name, namespace) {
|
||||
if (name === 'squareRoot' && namespace === 'http://sample.org/math/') {
|
||||
return function (c, value) {
|
||||
return Math.sqrt(value.numberValue());
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
namespaces: {
|
||||
math: 'http://sample.org/math/'
|
||||
}
|
||||
});
|
||||
```
|
||||
69
node_modules/xpath/docs/namespace resolvers.md
generated
vendored
Normal file
69
node_modules/xpath/docs/namespace resolvers.md
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
# Namespace Resolvers
|
||||
|
||||
The methods on the [XPathEvaluator](XPathEvaluator.md) type can optionally take a namespace resolver to resolve
|
||||
namespace references in the XPath expression being evaluated.
|
||||
|
||||
There are three ways to specify a namespace resolver and you can use any one of them depending on which is
|
||||
most suited to your particular situation.
|
||||
|
||||
## Namespace Resolver Type 1: Plain object
|
||||
|
||||
A plain object with namespace prefixes as the keys and namespace URIs as the values:
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/bk:book/hp:characters');
|
||||
var characters = evaluator.select({
|
||||
node: myBookNode,
|
||||
namespaces: {
|
||||
'bk': 'http://sample.org/books/',
|
||||
'hp': 'http://sample.org/harrypotter/'
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Namespace Resolver Type 2: Function
|
||||
|
||||
A function that takes a namespace prefix as a parameter and returns the corresponding namespace URI.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/bk:book/hp:characters');
|
||||
var characters = evaluator.select({
|
||||
node: myBookNode,
|
||||
namespaces: function (prefix) {
|
||||
if (prefix === 'bk') {
|
||||
return 'http://sample.org/books/';
|
||||
}
|
||||
if (prefix === 'hp') {
|
||||
return 'http://sample.org/books/';
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Namespace Resolver Type 3: Object with `getNamespace` method
|
||||
|
||||
An object with a method named `getNamespace` that works in the same way as the function-based namespace resolver
|
||||
described above.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/bk:book/hp:characters');
|
||||
var characters = evaluator.select({
|
||||
node: myBookNode,
|
||||
namespaces: {
|
||||
getNamespace: function (prefix) {
|
||||
if (prefix === 'bk') {
|
||||
return 'http://sample.org/books/';
|
||||
}
|
||||
if (prefix === 'hp') {
|
||||
return 'http://sample.org/books/';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
21
node_modules/xpath/docs/parsed expressions.md
generated
vendored
Normal file
21
node_modules/xpath/docs/parsed expressions.md
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Using Parsed Expressions
|
||||
|
||||
The `xpath.parse()` method allows pre-parsing an XPath expression and creating an XPath executor to evaluate the XPath as many times as needed.
|
||||
|
||||
This can provide a performance benefit if you plan to evaluate the same XPath multiple times, because the expression only needs to be parsed once.
|
||||
|
||||
This also provides access to additional features such as the use of variables and custom XPath functions, which are not available using the evaluation methods on the `xpath` object.
|
||||
|
||||
#### xpath.parse(expression)
|
||||
|
||||
Parses the specified XPath expression and returns an `XPathEvaluator`. See the [documentation page](XPathEvaluator.md) for API details.
|
||||
|
||||
`expression` should be a string.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var evaluator = xpath.parse('/book/characters');
|
||||
```
|
||||
|
||||
|
||||
89
node_modules/xpath/docs/variable resolvers.md
generated
vendored
Normal file
89
node_modules/xpath/docs/variable resolvers.md
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
# Variable Resolvers
|
||||
|
||||
The methods on the [XPathEvaluator](#) type can optionally take a variable resolver to resolve
|
||||
variable references in the XPath expression being evaluated.
|
||||
|
||||
There are three ways to specify a variable resolver and you can use any one of them depending on which is
|
||||
most suited to your particular situation.
|
||||
|
||||
Note that if your variables are in a namespace (e.g. `$myVars:var`), you must use the second or third
|
||||
type as the plain object implementation does not support namespaces.
|
||||
|
||||
## Variable values
|
||||
|
||||
You can use any of five types of values to specify the values of variables:
|
||||
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
- single node (will be treated as a node set)
|
||||
- array of nodes or array-like collection of nodes (will be treated as a node set)
|
||||
|
||||
## Variable Resolver Type 1: Plain object
|
||||
|
||||
A plain object with variable names as the keys and variable values as the values.
|
||||
|
||||
Example usage:
|
||||
|
||||
````
|
||||
var evaluator = xpath.parse('concat($character1, ", ", $character2, ", and ", $character3)');
|
||||
var mainCharacters = evaluator.evaluateString({
|
||||
variables: {
|
||||
character1: 'Harry',
|
||||
character2: 'Ron',
|
||||
character3: 'Hermione'
|
||||
}
|
||||
});
|
||||
````
|
||||
|
||||
## Variable Resolver Type 2: Function
|
||||
|
||||
A function that takes a variable name as its first parameter and an optional namespace URI as its second parameter
|
||||
and returns a value based on the name and namespace.
|
||||
|
||||
Example usage:
|
||||
|
||||
````
|
||||
var evaluator = xpath.parse('concat($hp:character1, ", ", $hp:character2, ", and ", $hp:character3)');
|
||||
var mainCharacters = evaluator.evaluateString({
|
||||
variables: function (name, namespace) {
|
||||
if (namespace === 'http://sample.org/harrypotter/') {
|
||||
switch (name) {
|
||||
case 'character1': return 'Harry';
|
||||
case 'character2': return 'Ron';
|
||||
case 'character3': return 'Hermione';
|
||||
}
|
||||
}
|
||||
},
|
||||
namespaces: {
|
||||
hp: 'http://sample.org/harrypotter/'
|
||||
}
|
||||
});
|
||||
````
|
||||
|
||||
## Function Resolver Type 3: Object with `getFunction` method
|
||||
|
||||
An object with a method named `getVariable` that works in the same way as the function-based variable resolver
|
||||
described above.
|
||||
|
||||
Example usage:
|
||||
|
||||
````
|
||||
var evaluator = xpath.parse('concat($hp:character1, ", ", $hp:character2, ", and ", $hp:character3)');
|
||||
var mainCharacters = evaluator.evaluateString({
|
||||
variables: {
|
||||
getVariable: function (name, namespace) {
|
||||
if (namespace === 'http://sample.org/harrypotter/') {
|
||||
switch (name) {
|
||||
case 'character1': return 'Harry';
|
||||
case 'character2': return 'Ron';
|
||||
case 'character3': return 'Hermione';
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
namespaces: {
|
||||
hp: 'http://sample.org/harrypotter/'
|
||||
}
|
||||
});
|
||||
````
|
||||
39
node_modules/xpath/docs/xpath methods.md
generated
vendored
Normal file
39
node_modules/xpath/docs/xpath methods.md
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# xpath methods
|
||||
|
||||
This page details the methods exposed on the `xpath` object.
|
||||
|
||||
### `xpath.parse(expression)`
|
||||
|
||||
Creates a parsed expression. See the [documentation page](parsed%20expressions.md) for details.
|
||||
|
||||
### `xpath.select(expression[, node[, single]])`
|
||||
|
||||
Evaluates an XPath expression and returns the result. The return value is determined based on the result type of the expression (which can always be predicted ahead of time based on the expression's syntax):
|
||||
|
||||
- A boolean value if the expression evaluates to a boolean value.
|
||||
- A number if the expression evaluates to a numeric value.
|
||||
- A string if the expression evaluates to a string.
|
||||
- If the expression evaluates to a nodeset:
|
||||
- An array of 0 or more nodes if `single` is unspecified or falsy
|
||||
- A single node (the first node in document order) or `undefined` if `single` is truthy
|
||||
|
||||
`node` is optional and if specified, is used as the context node for evaluating the expression. (It is necessary if the expression makes use of the current contex.)
|
||||
|
||||
`single` is optional and is ignored if the expression evaluates to anything other than a nodeset.
|
||||
|
||||
### `xpath.select1(expression[, node])`
|
||||
|
||||
Alias for [`xpath.select(expression, node, true)`](#xpathselectexpression-node-single). Selects a single node or value.
|
||||
|
||||
### `xpath.useNamespaces(mappings)`
|
||||
|
||||
Produces a function with the same signature as [`xpath.select()`](#xpathselectexpression-node-single) that evaluates the provided xpath expression using the XML namespace definitions provided in `mapppings`.
|
||||
|
||||
`mappings` should be an object with namespace prefixes as its property names and namespace URIs as its property values.
|
||||
|
||||
Example usage:
|
||||
|
||||
```js
|
||||
var expr = xpath.useNamespaces({ hp: 'http://www.example.com/harryPotter', bk: 'http://www.example.com/books' });
|
||||
var result = expr('/bk:books/bk:book[@name = "Harry Potter and the Half-Blood Prince"]/hp:characters', myBooks);
|
||||
```
|
||||
70
node_modules/xpath/package.json
generated
vendored
Normal file
70
node_modules/xpath/package.json
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"xpath@0.0.27",
|
||||
"."
|
||||
]
|
||||
],
|
||||
"_from": "xpath@0.0.27",
|
||||
"_id": "xpath@0.0.27",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-fg03WRxtkCV6ohClePNAECYsmpKKTv5L8y/X3Dn1hQrec3POx2jHZ/0P2qQ6HvsrU1BmeqXcof3NGGueG6LxwQ==",
|
||||
"_location": "/xpath",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "xpath@0.0.27",
|
||||
"name": "xpath",
|
||||
"escapedName": "xpath",
|
||||
"rawSpec": "0.0.27",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.0.27"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.27.tgz",
|
||||
"_spec": "0.0.27",
|
||||
"_where": ".",
|
||||
"author": {
|
||||
"name": "Cameron McCormack"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/goto100/xpath/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "goto100"
|
||||
},
|
||||
{
|
||||
"name": "James Rishe"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "DOM 3 XPath implemention and helper for node.js.",
|
||||
"devDependencies": {
|
||||
"nodeunit": ">=0.6.4",
|
||||
"xmldom": "^0.1.19"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6.0"
|
||||
},
|
||||
"homepage": "https://github.com/goto100/xpath#readme",
|
||||
"keywords": [
|
||||
"xpath",
|
||||
"xml"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./xpath.js",
|
||||
"name": "xpath",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/goto100/xpath.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "nodeunit test.js"
|
||||
},
|
||||
"typings": "./xpath.d.ts",
|
||||
"version": "0.0.27"
|
||||
}
|
||||
1092
node_modules/xpath/test.js
generated
vendored
Normal file
1092
node_modules/xpath/test.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9
node_modules/xpath/xpath.d.ts
generated
vendored
Normal file
9
node_modules/xpath/xpath.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
type SelectedValue = Node | Attr | string | number | boolean;
|
||||
interface XPathSelect {
|
||||
(expression: string, node?: Node): Array<SelectedValue>;
|
||||
(expression: string, node: Node, single: true): SelectedValue;
|
||||
}
|
||||
export var select: XPathSelect;
|
||||
export function select1(expression: string, node?: Node): SelectedValue;
|
||||
export function evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver, type: number, result: XPathResult): XPathResult;
|
||||
export function useNamespaces(namespaceMap: { [name: string]: string }): XPathSelect;
|
||||
4764
node_modules/xpath/xpath.js
generated
vendored
Normal file
4764
node_modules/xpath/xpath.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10970
package-lock.json
generated
10970
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@ -1,13 +1,11 @@
|
||||
{
|
||||
"name": "maven-settings-action",
|
||||
"version": "2.4.1",
|
||||
"version": "1.0.0",
|
||||
"description": "Prepare maven settings",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint index.js settings.js",
|
||||
"test": "eslint index.js settings.js && jest --coverage",
|
||||
"version": "./update-readme.sh",
|
||||
"postversion": "git tag --delete v$npm_new_version"
|
||||
"test": "eslint index.js settings.js && jest --coverage"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -26,11 +24,12 @@
|
||||
},
|
||||
"homepage": "https://github.com/s4u/maven-settings-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.5.0",
|
||||
"@xmldom/xmldom": "^0.7.1"
|
||||
"@actions/core": "^1.2.2",
|
||||
"xmldom": "^0.2.1",
|
||||
"xpath": "0.0.27"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^7.32.0",
|
||||
"jest": "^27.0.6"
|
||||
"eslint": "^6.8.0",
|
||||
"jest": "^25.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
187
settings.js
187
settings.js
@ -26,15 +26,17 @@ const core = require('@actions/core');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const DOMParser = require('@xmldom/xmldom').DOMParser;
|
||||
const XMLSerializer = require('@xmldom/xmldom').XMLSerializer;
|
||||
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 getTemplate(templateName) {
|
||||
const templatePath = path.join(__dirname, 'templates', templateName);
|
||||
function getSettingsTemplate() {
|
||||
const templatePath = path.join(__dirname, 'templates', 'settings.xml');
|
||||
const templateStr = fs.readFileSync(templatePath).toString();
|
||||
return new DOMParser().parseFromString(templateStr, 'text/xml');
|
||||
}
|
||||
@ -50,162 +52,63 @@ function writeSettings(settingsPath, templateXml) {
|
||||
fs.writeFileSync(settingsPath, settingStr);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
function fillServers(template) {
|
||||
|
||||
function fillServer(templateXml, templateName, id, username, password, privateKey, passphrase, filePermissions, directoryPermissions, configurations) {
|
||||
|
||||
if (!id || (!username && !configurations)) {
|
||||
core.setFailed(templateName + ' must contain id, and username or configuration');
|
||||
return;
|
||||
}
|
||||
|
||||
const serverXml = getTemplate(templateName + '.xml')
|
||||
serverXml.getElementsByTagName('id')[0].textContent = id;
|
||||
|
||||
const serverTags = {
|
||||
'username': username,
|
||||
'password': password,
|
||||
'privateKey': privateKey,
|
||||
'passphrase': passphrase,
|
||||
'filePermissions': filePermissions,
|
||||
'directoryPermissions': directoryPermissions
|
||||
};
|
||||
for (const tag in serverTags) {
|
||||
const serverTag = serverXml.getElementsByTagName(tag)[0];
|
||||
const tagValue = serverTags[tag];
|
||||
if (tagValue) {
|
||||
serverTag.textContent = tagValue;
|
||||
} else {
|
||||
serverXml.documentElement.removeChild(serverTag);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
const servers = core.getInput('servers');
|
||||
|
||||
if (!servers) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSON.parse(servers).forEach((server) =>
|
||||
fillServer(template, templateName, server.id, server.username,
|
||||
server.password, server.privateKey, server.passphrase,
|
||||
server.filePermissions, server.directoryPermissions,
|
||||
server.configuration));
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function fillMirror(template, id, name, mirrorOf, url) {
|
||||
function activateProfile(template, profileId) {
|
||||
const activeByDefault = xpath
|
||||
.select(`/settings/profiles/profile[id[contains(text(),"${profileId}")]]/activation/activeByDefault`, template);
|
||||
|
||||
if (!id || !name || !mirrorOf || !url) {
|
||||
core.setFailed('mirrors must contain id, name, mirrorOf and url');
|
||||
return;
|
||||
if (activeByDefault) {
|
||||
activeByDefault[0].textContent = 'true';
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const propertiesProfileXml = getTemplate('properties.xml');
|
||||
const propertiesXml = propertiesProfileXml.getElementsByTagName('properties')[0];
|
||||
activateProfile(template, '_properties_')
|
||||
const propertiesXml = xpath
|
||||
.select(`/settings/profiles/profile[id[contains(text(),"_properties_")]]/properties`, template)[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) {
|
||||
if (isInputTrue('sonatypeSnapshots')) {
|
||||
addProfile(template, 'sonatype-snapshot.xml')
|
||||
}
|
||||
}
|
||||
|
||||
function addOracleRepo(template) {
|
||||
if (isInputTrue('oracleRepo')) {
|
||||
addProfile(template, 'oracle-repo.xml')
|
||||
const val = core.getInput('sonatypeSnapshots');
|
||||
if (val && val.toLocaleLowerCase() == 'true') {
|
||||
activateProfile(template, '_sonatype-snapshots_')
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,7 +119,8 @@ function generate() {
|
||||
core.info('Prepare maven setings: ' + settingsPath);
|
||||
|
||||
if (fs.existsSync(settingsPath)) {
|
||||
if (isInputTrue('override')) {
|
||||
const val = core.getInput("override");
|
||||
if (val && val.toLocaleLowerCase() == 'true') {
|
||||
core.info('maven settings.xml already exists - override');
|
||||
} else {
|
||||
core.warning('maven settings.xml already exists - skip');
|
||||
@ -224,16 +128,11 @@ function generate() {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
const templateXml = getSettingsTemplate();
|
||||
fillServers(templateXml);
|
||||
fillProperties(templateXml);
|
||||
addSonatypeSnapshots(templateXml);
|
||||
writeSettings(settingsPath, templateXml);
|
||||
core.saveState('maven-settings', 'ok');
|
||||
}
|
||||
|
||||
@ -254,15 +153,11 @@ function cleanup() {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getTemplate,
|
||||
getSettingsTemplate,
|
||||
writeSettings,
|
||||
fillMirrors,
|
||||
fillServers,
|
||||
fillServerForGithub,
|
||||
fillProperties,
|
||||
addApacheSnapshots,
|
||||
addSonatypeSnapshots,
|
||||
addOracleRepo,
|
||||
generate,
|
||||
cleanup
|
||||
}
|
||||
|
||||
489
settings.test.js
489
settings.test.js
@ -24,8 +24,8 @@ THE SOFTWARE.
|
||||
|
||||
const os = require('os');
|
||||
const process = require('process');
|
||||
const DOMParser = require('@xmldom/xmldom').DOMParser;
|
||||
const XMLSerializer = require('@xmldom/xmldom').XMLSerializer;
|
||||
const DOMParser = require('xmldom').DOMParser;
|
||||
const XMLSerializer = require('xmldom').XMLSerializer;
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
@ -38,14 +38,6 @@ const settingsPath = path.join(testHomePath, '.m2', 'settings.xml');
|
||||
|
||||
var consoleOutput = [];
|
||||
|
||||
function stringAsXml(str) {
|
||||
return new DOMParser().parseFromString(str, 'text/xml');
|
||||
}
|
||||
|
||||
function xmlAsString(xml) {
|
||||
return new XMLSerializer().serializeToString(xml).replace(/^\s*$(?:\r\n?|\n)/gm, '');
|
||||
}
|
||||
|
||||
beforeAll(() => {
|
||||
if (!fs.existsSync(testHomePath)) {
|
||||
fs.mkdirSync(testHomePath);
|
||||
@ -59,7 +51,7 @@ beforeAll(() => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
xmlTestProfile = stringAsXml(`<settings>
|
||||
xmlTestProfile = new DOMParser().parseFromString(`<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
@ -95,7 +87,7 @@ afterAll(() => {
|
||||
afterEach(() => {
|
||||
|
||||
for (key in process.env) {
|
||||
if (key.match(/^INPUT_/) || key.match(/^GITHUB_/)) {
|
||||
if (key.match(/^INPUT_/)) {
|
||||
delete process.env[key];
|
||||
}
|
||||
}
|
||||
@ -107,7 +99,8 @@ afterEach(() => {
|
||||
});
|
||||
|
||||
test('template should be read', () => {
|
||||
const template = settings.getTemplate('settings.xml');
|
||||
|
||||
const template = settings.getSettingsTemplate();
|
||||
|
||||
expect(template).toBeDefined();
|
||||
});
|
||||
@ -127,9 +120,9 @@ test('xml should be write', () => {
|
||||
|
||||
test('fillServers do nothing if no params', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
settings.fillServers(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
@ -138,447 +131,87 @@ test('fillServers do nothing if no params', () => {
|
||||
|
||||
test('fillServers one server', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
settings.fillServers(xml);
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username1</username>
|
||||
<password>password1</password>
|
||||
</server></servers>`);
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
});
|
||||
|
||||
test('fillServers with username and configuration', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).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 = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "password": "password", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).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 username, privateKey', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "privateKey": "${user.home}/.ssh/id_rsa"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username</username>
|
||||
<privateKey>\${user.home}/.ssh/id_rsa</privateKey>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with username, privateKey, and passphrase', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "privateKey": "${user.home}/.ssh/id_rsa", "passphrase": "secret"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<username>username</username>
|
||||
<privateKey>\${user.home}/.ssh/id_rsa</privateKey>
|
||||
<passphrase>secret</passphrase>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with all attributes', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "server001", "username": "my_login", "password": "my_password", "privateKey": "${user.home}/.ssh/id_dsa", "passphrase": "some_passphrase", "filePermissions": "664", "directoryPermissions": "775", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"} }]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>server001</id>
|
||||
<username>my_login</username>
|
||||
<password>my_password</password>
|
||||
<privateKey>\${user.home}/.ssh/id_dsa</privateKey>
|
||||
<passphrase>some_passphrase</passphrase>
|
||||
<filePermissions>664</filePermissions>
|
||||
<directoryPermissions>775</directoryPermissions>
|
||||
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with configuration', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<configuration><prop1>prop1Value</prop1><prop2>prop2Value</prop2></configuration>
|
||||
</server></servers>`);
|
||||
});
|
||||
|
||||
test('fillServers with configuration subLevel', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": {"prop11": "value11", "prop12": "value12"}, "prop2": "value2"}}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).toBe(`<servers>
|
||||
<server>
|
||||
<id>id1</id>
|
||||
<configuration><prop1><prop11>value11</prop11><prop12>value12</prop12></prop1><prop2>value2</prop2></configuration>
|
||||
</server></servers>`);
|
||||
expect(xmlStr).toBe("<servers>" +
|
||||
"<server><id>id1</id><username>username1</username><password>password1</password></server>" +
|
||||
"</servers>");
|
||||
});
|
||||
|
||||
test('fillServers two servers', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
const xml = new DOMParser().parseFromString("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"},\
|
||||
{"id": "id2", "username": "username2", "password":"password2"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
|
||||
expect(xmlAsString(xml)).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 = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_SERVERS'] = '[{"idx": "id1"}]';
|
||||
|
||||
settings.fillServers(xml, 'servers');
|
||||
settings.fillServers(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe('<servers/>');
|
||||
expect(consoleOutput).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.stringMatching(/::error::servers must contain id, and username or configuration/)
|
||||
])
|
||||
);
|
||||
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 oracleServers', () => {
|
||||
|
||||
const xml = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_ORACLESERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
|
||||
|
||||
settings.fillServers(xml, 'oracleServers');
|
||||
|
||||
expect(xmlAsString(xml)).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 = stringAsXml("<servers/>");
|
||||
|
||||
process.env['INPUT_GITHUBSERVER'] = 'true';
|
||||
|
||||
settings.fillServerForGithub(xml);
|
||||
|
||||
expect(xmlAsString(xml)).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 = stringAsXml("<mirrors/>");
|
||||
|
||||
settings.fillMirrors(xml);
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
|
||||
expect(xmlStr).toBe("<mirrors/>");
|
||||
expect(consoleOutput).toEqual([]);
|
||||
});
|
||||
|
||||
test('fillMirrors one mirror', () => {
|
||||
|
||||
const xml = stringAsXml("<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 = stringAsXml("<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 = stringAsXml("<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 = stringAsXml('<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', () => {
|
||||
test('addSonatypeSnapshots activate', () => {
|
||||
|
||||
process.env['INPUT_SONATYPESNAPSHOTS'] = "true";
|
||||
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
settings.addSonatypeSnapshots(xmlTestProfile);
|
||||
|
||||
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 = stringAsXml('<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>`);
|
||||
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>`);
|
||||
});
|
||||
|
||||
test('fillProperties', () => {
|
||||
|
||||
process.env['INPUT_PROPERTIES'] = '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]';
|
||||
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
settings.fillProperties(xmlTestProfile);
|
||||
|
||||
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>`);
|
||||
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>`);
|
||||
})
|
||||
|
||||
test('fillProperties do nothing if no params', () => {
|
||||
@ -646,7 +279,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;
|
||||
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
|
||||
<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>
|
||||
@ -1,7 +0,0 @@
|
||||
|
||||
<mirror>
|
||||
<id/>
|
||||
<name/>
|
||||
<mirrorOf/>
|
||||
<url/>
|
||||
</mirror>
|
||||
@ -1,31 +0,0 @@
|
||||
|
||||
<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>
|
||||
@ -1,27 +0,0 @@
|
||||
|
||||
<server>
|
||||
<id />
|
||||
<username />
|
||||
<password />
|
||||
<privateKey />
|
||||
<passphrase />
|
||||
<filePermissions />
|
||||
<directoryPermissions />
|
||||
<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>
|
||||
@ -1,8 +0,0 @@
|
||||
|
||||
<profile>
|
||||
<id>_properties_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<properties />
|
||||
</profile>
|
||||
@ -1,11 +0,0 @@
|
||||
|
||||
<server>
|
||||
<id />
|
||||
<username />
|
||||
<password />
|
||||
<privateKey />
|
||||
<passphrase />
|
||||
<filePermissions />
|
||||
<directoryPermissions />
|
||||
<configuration />
|
||||
</server>
|
||||
@ -1,6 +1,48 @@
|
||||
<settings>
|
||||
|
||||
<interactiveMode>false</interactiveMode>
|
||||
<profiles/>
|
||||
|
||||
<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>
|
||||
|
||||
<servers />
|
||||
<mirrors />
|
||||
</settings>
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
|
||||
<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>
|
||||
@ -1,9 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "old_version: $npm_old_version"
|
||||
echo "new_version: $npm_new_version"
|
||||
echo "package_name: $npm_package_name"
|
||||
|
||||
sed -i '' "s/$npm_package_name@v$npm_old_version/$npm_package_name@v$npm_new_version/g" README.md
|
||||
|
||||
git add README.md
|
||||
Reference in New Issue
Block a user