70 Commits

Author SHA1 Message Date
902651b0f8 update dependency after merge from masterupdate dependency after merge from master 2021-08-20 13:33:39 +02:00
9d88753cb7 Merge remote-tracking branch 'origin/master' into releases/v2 2021-08-20 13:29:55 +02:00
9ecac33057 prepare release 2.4.1 2021-08-20 13:28:18 +02:00
a71cff0af4 Merge pull request #136 from s4u/update-readme-by-npm
update readme during npm version runs
2021-08-20 13:26:50 +02:00
74b488d6b5 update readme during npm version runs 2021-08-20 13:20:03 +02:00
0679058832 Merge pull request #135 from s4u/npm-update
update transitive dependencies
2021-08-20 11:58:44 +02:00
4e79deaadf update transitive dependencies 2021-08-20 11:54:36 +02:00
b071b0592f Bump actions/setup-java from 2.1.0 to 2.2.0
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v2.1.0...v2.2.0)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-20 11:49:45 +02:00
e087497fdf Bump actions/setup-node from 2.3.0 to 2.4.0
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-20 11:49:09 +02:00
ae3ee5e171 Bump @actions/core from 1.4.0 to 1.5.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-20 11:46:18 +02:00
6c0723a451 Merge pull request #133 from s4u/fix-xmldom
Update xmldom to @xmldom/xmldom
2021-08-20 11:44:29 +02:00
1c0881314a Update xmldom to @xmldom/xmldom 2021-08-20 11:39:29 +02:00
3d30ad6b13 Bump eslint from 7.31.0 to 7.32.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.31.0 to 7.32.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.31.0...v7.32.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-02 11:02:13 +02:00
09765986ab Bump actions/setup-node from 2.2.0 to 2.3.0
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.2.0 to 2.3.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.2.0...v2.3.0)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-21 11:01:58 +02:00
3a0220074b Bump eslint from 7.30.0 to 7.31.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.30.0 to 7.31.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.30.0...v7.31.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-19 11:01:56 +02:00
e2b4671ab7 Bump eslint from 7.29.0 to 7.30.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.29.0 to 7.30.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.29.0...v7.30.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-05 11:02:03 +02:00
503fafc2f9 Bump actions/setup-node from 2.1.5 to 2.2.0
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2.1.5 to 2.2.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.1.5...v2.2.0)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-07-01 11:02:26 +02:00
b8ae32e043 File sync from s4u/.github - enable auto merge 2021-06-30 23:49:15 +00:00
9ad80eb4e3 Bump jest from 27.0.4 to 27.0.6
Bumps [jest](https://github.com/facebook/jest) from 27.0.4 to 27.0.6.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.0.4...v27.0.6)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-30 20:26:33 +00:00
f44510e5ab enable auto merge 2021-06-30 22:23:36 +02:00
0de22f6a26 Bump eslint from 7.28.0 to 7.29.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.28.0 to 7.29.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.28.0...v7.29.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-30 21:17:09 +02:00
1615e72b3a Bump @actions/core from 1.3.0 to 1.4.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-18 08:32:30 +02:00
24a1a88f1e Bump eslint from 7.27.0 to 7.28.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.27.0 to 7.28.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.27.0...v7.28.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-07 23:01:02 +02:00
5878d2e8e2 Bump jest from 27.0.3 to 27.0.4
Bumps [jest](https://github.com/facebook/jest) from 27.0.3 to 27.0.4.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.0.3...v27.0.4)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-07 22:50:46 +02:00
2c9c4267b8 Bump jest from 27.0.1 to 27.0.3
Bumps [jest](https://github.com/facebook/jest) from 27.0.1 to 27.0.3.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.0.1...v27.0.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-02 18:41:23 +02:00
273dffbe20 Bump jest from 27.0.0 to 27.0.1
Bumps [jest](https://github.com/facebook/jest) from 27.0.0 to 27.0.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v27.0.0...v27.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-27 21:40:37 +02:00
a29bb45705 Bump @actions/core from 1.2.7 to 1.3.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.7 to 1.3.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-25 11:53:34 +02:00
cc53414d90 Bump eslint from 7.26.0 to 7.27.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.26.0 to 7.27.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.26.0...v7.27.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-25 11:37:57 +02:00
6fd30a11d2 Bump jest from 26.6.3 to 27.0.0
Bumps [jest](https://github.com/facebook/jest) from 26.6.3 to 27.0.0.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/compare/v26.6.3...v27.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-25 11:24:44 +02:00
86c0b9f97d organization wide release-drafter configuration 2021-05-18 23:12:33 +02:00
11c40ea0e1 Bump eslint from 7.25.0 to 7.26.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.25.0 to 7.26.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.25.0...v7.26.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-18 22:47:13 +02:00
c451ddf0ee Bump actions/setup-java from 2.0.0 to 2.1.0
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v2.0.0...v2.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-18 22:46:15 +02:00
5935b2506f Merge pull request #111 from s4u/fix-audit-1677
bump hosted-git-info to fix security issue
2021-05-18 22:41:03 +02:00
6c6439978a bump hosted-git-info to fix security issue
https://npmjs.com/advisories/1677
2021-05-18 22:33:56 +02:00
cc60484bd8 Bump eslint from 7.24.0 to 7.25.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.24.0 to 7.25.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.24.0...v7.25.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-26 23:55:19 +02:00
51e9e89b47 Bump xmldom from 0.5.0 to 0.6.0
Bumps [xmldom](https://github.com/xmldom/xmldom) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xmldom/xmldom/compare/0.5.0...0.6.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-23 13:57:21 +02:00
2c41469899 File sync from s4u/.github 2021-04-19 21:03:48 +00:00
8636f71a85 Bump @actions/core from 1.2.6 to 1.2.7
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.6 to 1.2.7.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-14 11:53:05 +02:00
02b233c563 Bump eslint from 7.23.0 to 7.24.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.23.0 to 7.24.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.23.0...v7.24.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-13 19:17:19 +02:00
fc211602ad File sync from s4u/.github 2021-04-10 07:32:49 +00:00
b6682b450c File sync from s4u/.github 2021-04-09 17:59:49 +00:00
7ded67fa42 Merge pull request #104 from s4u/dependabot/github_actions/actions/setup-java-v2
Bump actions/setup-java from v1 to v2
2021-04-06 19:17:14 +02:00
fbbf52f12f actions/setup-java@v2 - migration 2021-04-06 19:14:10 +02:00
9feb081430 Bump actions/setup-java from v1 to v2
Bumps [actions/setup-java](https://github.com/actions/setup-java) from v1 to v2.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v1...8764a52df183aa0ccea74521dfd9d506ffc7a19a)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-06 09:00:30 +00:00
7c53eac0ad Bump eslint from 7.22.0 to 7.23.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.22.0 to 7.23.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.22.0...v7.23.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-29 22:27:38 +02:00
49d8434231 Grammar fixes 2021-03-29 22:27:14 +02:00
189ee46453 Bump eslint from 7.21.0 to 7.22.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.21.0 to 7.22.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.21.0...v7.22.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-26 14:59:53 +01:00
59c3eb5376 File sync from s4u/.github 2021-03-17 21:42:20 +00:00
4723e93063 File sync from s4u/.github 2021-03-17 21:24:20 +00:00
8bb0fda6df Bump xmldom from 0.4.0 to 0.5.0
Bumps [xmldom](https://github.com/xmldom/xmldom) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/xmldom/xmldom/compare/0.4.0...0.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-09 22:09:24 +01:00
5e8470faff File sync from s4u/.github 2021-03-06 11:18:14 +00:00
e967605742 update dependency after merge from master 2021-02-28 20:25:07 +01:00
e65dc96bde Merge remote-tracking branch 'origin/master' into releases/v2 2021-02-28 20:22:43 +01:00
b742fc533f prepare release 2.4.0 2021-02-28 20:20:35 +01:00
d1f8f65870 Merge pull request #97 from s4u/dependabot/github_actions/actions/setup-node-v2.1.5
Bump actions/setup-node from v2.1.4 to v2.1.5
2021-02-28 11:42:22 +01:00
de53ea431e Bump actions/setup-node from v2.1.4 to v2.1.5
Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.1.4...46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-23 09:00:30 +00:00
cd16d8406c Completed the attribute support for servers. (#95)
* Completed the attribute support for servers, and password is optional. Resolves #92.

* Updated oracleServers.xml template to match new servers.xml template.

* Revised tests to match code and template changes.

* Added documentation for server attributes.

* Added additional use cases to exercise server attribute handling.
2021-02-16 22:46:27 +01:00
abf1253b29 Merge pull request #94 from awhitford/typos
Corrected typos. Resolves #93.
2021-02-16 08:29:57 +01:00
7a5cb7ba33 Merge pull request #91 from s4u/dependabot/npm_and_yarn/eslint-7.20.0
Bump eslint from 7.19.0 to 7.20.0
2021-02-16 08:27:27 +01:00
7799be5210 Bump eslint from 7.19.0 to 7.20.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.19.0 to 7.20.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.19.0...v7.20.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-16 07:19:24 +00:00
82e778d8d7 File sync from s4u/.github 2021-02-16 07:05:18 +00:00
175b85e48d Corrected typos. Resolves #93. 2021-02-15 14:23:05 -08:00
40cb7c6ba4 Merge pull request #89 from s4u/dependabot/npm_and_yarn/eslint-7.19.0
Bump eslint from 7.18.0 to 7.19.0
2021-02-07 14:43:44 +01:00
a154ae5bb3 Bump eslint from 7.18.0 to 7.19.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.18.0 to 7.19.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.18.0...v7.19.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 09:06:12 +00:00
26b06607c7 Merge pull request #88 from s4u/dependabot/npm_and_yarn/eslint-7.18.0
Bump eslint from 7.17.0 to 7.18.0
2021-01-18 20:00:27 +01:00
5391894326 Bump eslint from 7.17.0 to 7.18.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.17.0 to 7.18.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.17.0...v7.18.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-18 09:01:10 +00:00
a9c25dcc48 Merge pull request #87 from s4u/dependabot/npm_and_yarn/eslint-7.17.0
Bump eslint from 7.16.0 to 7.17.0
2021-01-04 11:22:39 +01:00
6240d8dec2 Bump eslint from 7.16.0 to 7.17.0
Bumps [eslint](https://github.com/eslint/eslint) from 7.16.0 to 7.17.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v7.16.0...v7.17.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-04 09:01:04 +00:00
0ae2055ed1 File sync from s4u/.github 2020-12-29 18:32:24 +00:00
eb98cf558d File sync from s4u/.github 2020-12-28 00:31:56 +00:00
41 changed files with 3781 additions and 6410 deletions

View File

@ -1,40 +0,0 @@
categories:
- title: 'New features'
labels:
- 'enhancement'
- title: 'Bug Fixes'
labels:
- 'bug'
- title: 'Maintenance'
label:
- 'code quality'
- 'documentation'
- title: 'Dependency updates'
label:
- 'dependencies'
change-template: '- $TITLE #$NUMBER'
sort-direction: 'ascending'
template: |
# What's Changed
$CHANGES
# Thanks
Many thanks for collaboration on this release for: $CONTRIBUTORS
replacers:
- search: '/(?:and )?@dependabot-preview(?:\[bot\])?,?/g'
replace: ''
- search: '/(?:and )?@dependabot(?:\[bot\])?,?/g'
replace: ''
- search: '/(?:and )?Github Action(?:\[bot\])?,?/g'
replace: ''

View File

@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-node@v2.1.4
- uses: actions/setup-node@v2.4.0
with:
node-version: '12.x'

25
.github/workflows/auto-approve.yml vendored Normal file
View File

@ -0,0 +1,25 @@
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 }}"

View File

@ -2,15 +2,20 @@ name: Release Drafter
on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- master
- '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.12.1
- uses: release-drafter/release-drafter@v5.15.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -19,13 +19,15 @@ jobs:
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-node@v2.1.4
- uses: actions/setup-node@v2.4.0
with:
node-version: '12.x'
- uses: actions/setup-java@v1
- uses: actions/setup-java@v2.2.0
with:
java-version: '1.8'
distribution: 'adopt'
java-version: '8'
- run: npm version
- run: npm ci

View File

@ -3,7 +3,7 @@
[![Audit](https://github.com/s4u/maven-settings-action/workflows/Audit/badge.svg)](https://github.com/s4u/maven-settings-action/actions?query=workflow%3AAudit)
This action setup maven environment for use in action by:
This action sets up Maven environments for use in GitHub Actions 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
@ -12,10 +12,10 @@ This action setup maven environment for use in action by:
# Contributions
- Contributions are welcome!
- Give :star: - if you want to encourage me to work on a project
- Don't hesitate create issue for new feature you dream of or if you suspect some bug
- Don't hesitate to create issues for new features you dream of or if you suspect some bug
# Project versioning
Project use [Semantic Versioning](https://semver.org/).
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)*
@ -28,23 +28,35 @@ See [action.yml](action.yml)
## default ```settings.xml```
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
```
## ```settings.xml``` with servers section
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
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.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
servers: |
[{
@ -78,7 +90,7 @@ result will be:
## ```settings.xml``` with mirrors section
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
mirrors: '[{"id": "mirrorId", "name": "mirrorName", "mirrorOf": "mirrorOf", "url": "mirrorUrl"}]'
```
@ -86,7 +98,7 @@ steps:
## ```settings.xml``` with properties
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'
```
@ -95,7 +107,7 @@ steps:
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
sonatypeSnapshots: true
```
@ -104,7 +116,7 @@ steps:
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
apacheSnapshots: true
```
@ -112,7 +124,7 @@ steps:
## Do not override existing ```settings.xml```, from version **2.0** file is override by default :
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
override: false
```
@ -120,7 +132,7 @@ steps:
## Do not add github to server in ```settings.xml```, by default is added:
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
githubServer: false
```
@ -129,7 +141,7 @@ steps:
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
oracleServers: '[{"id": "serverId", "username": "username", "password": "password"}]'
```
@ -137,7 +149,7 @@ steps:
## ```settings.xml``` with [Oracle Maven Repository](https://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9017)
```yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
oracleRepo: true
```
@ -148,7 +160,7 @@ It is also possible pass in Github Secrets e.g.
``` yml
steps:
- uses: s4u/maven-settings-action@v2.3.0
- uses: s4u/maven-settings-action@v2.4.1
with:
servers: |
[{
@ -178,11 +190,11 @@ steps:
with:
java-version: 8
- uses: s4u/maven-settings-action@v2.3.0
- 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).

View File

@ -1,4 +1,4 @@
name: 'maven-setings-action'
name: 'maven-settings-action'
description: 'Prepare maven settings.xml'
branding:
@ -7,7 +7,7 @@ branding:
inputs:
servers:
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}]'
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"}]'
@ -32,7 +32,7 @@ inputs:
default: "true"
required: false
oracleServers:
description: 'servers definition in joson array, eg: [{"id": "serverId", "username": "username", "password": "password"}] for Oracle repository'
description: 'servers definition in json array, eg: [{"id": "serverId", "username": "username", "password": "password"}] for Oracle repository'
required: false
oracleRepo:
description: 'add Oracle Maven Repository'

View File

@ -63,11 +63,11 @@ 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_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_MIRRORS'] = '[{"id": "mirrorId", "name": "mirror Name", "mirrorOf": "mirror Off *", "url": "mirror url"}]';
process.env['INPUT_PROPERTIES'] = '[{"prop1": "value1"}, {"prop2": "value2"}]'
process.env['INPUT_APACHESNAPSHOTS'] = true;
@ -80,7 +80,7 @@ test('run with all feature', () => {
expect(settingsStatus.isFile()).toBeTruthy();
expect(settingsStatus.size).toBeGreaterThan(0);
const settingsBody = fs.readFileSync(settingsPath).toString().replace(/^ $/mg, '');
const settingsBody = fs.readFileSync(settingsPath).toString().replace(/^\s*$(?:\r\n?|\n)/gm, '');
expect(settingsBody).toBe(`<settings>
<interactiveMode>false</interactiveMode>
<profiles>
@ -214,7 +214,6 @@ test('run with all feature', () => {
<id>github</id>
<username>\${env.GITHUB_ACTOR}</username>
<password>\${env.GITHUB_TOKEN}</password>
</server></servers>
<mirrors>
<mirror>

16
node_modules/.package-lock.json generated vendored
View File

@ -1,18 +1,18 @@
{
"name": "maven-settings-action",
"version": "2.3.0",
"version": "2.4.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/@actions/core": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
"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": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.4.0.tgz",
"integrity": "sha512-2E93k08T30Ugs+34HBSTQLVtpi6mCddaY8uO+pMNk1pqSjV5vElzn4mmh6KLxN3hki8rNcHSYzILoh3TEWORvA==",
"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"
}

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

@ -16,11 +16,14 @@ import * as core from '@actions/core';
#### Inputs/Outputs
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
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.
```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');
```
@ -62,11 +65,10 @@ 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).
@ -90,6 +92,8 @@ try {
// 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`);
@ -113,11 +117,118 @@ 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:
![Annotations Image](../../docs/assets/annotations.png)
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:
You can use this library to save state and get state for sharing information between a given wrapper action:
**action.yml**:
**action.yml**
```yaml
name: 'Wrapper action sample'
inputs:
@ -138,6 +249,7 @@ core.saveState("pidToKill", 12345);
```
In action's `cleanup.js`:
```js
const core = require('@actions/core');

View File

@ -1,4 +1,4 @@
interface CommandProperties {
export interface CommandProperties {
[key: string]: any;
}
/**
@ -13,4 +13,3 @@ interface CommandProperties {
*/
export declare function issueCommand(command: string, properties: CommandProperties, message: any): void;
export declare function issue(name: string, message?: string): void;
export {};

View File

@ -1,12 +1,25 @@
"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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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.issue = exports.issueCommand = void 0;
const os = __importStar(require("os"));
const utils_1 = require("./utils");
/**

View File

@ -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,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AC,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"}

View File

@ -4,6 +4,8 @@
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
@ -18,6 +20,33 @@ 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
@ -35,13 +64,35 @@ export declare function setSecret(secret: string): void;
*/
export declare function addPath(inputPath: string): void;
/**
* Gets the value of an input. The value is also trimmed.
* 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.
*
* @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.
*
@ -73,13 +124,21 @@ 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.
*/
export declare function error(message: string | Error): void;
export declare function error(message: string | Error, properties?: AnnotationProperties): void;
/**
* Adds an warning issue
* 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.
*/
export declare function warning(message: string | Error): void;
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;
/**
* Writes info to log with console.log.
* @param message info message

View File

@ -1,4 +1,23 @@
"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) {
@ -8,14 +27,8 @@ 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");
@ -82,7 +95,9 @@ function addPath(inputPath) {
}
exports.addPath = addPath;
/**
* Gets the value of an input. The value is also trimmed.
* 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.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
@ -93,9 +108,49 @@ 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.
*
@ -104,6 +159,7 @@ exports.getInput = getInput;
*/
// 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;
@ -150,19 +206,30 @@ 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.
*/
function error(message) {
command_1.issue('error', message instanceof Error ? message.toString() : message);
function error(message, properties = {}) {
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
}
exports.error = error;
/**
* Adds an warning issue
* 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.
*/
function warning(message) {
command_1.issue('warning', message instanceof Error ? message.toString() : message);
function warning(message, properties = {}) {
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : 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

View File

@ -1 +1 @@
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;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AAC,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"}

View File

@ -1,13 +1,26 @@
"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 (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
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"));

View File

@ -1 +1 @@
{"version":3,"file":"file-command.js","sourceRoot":"","sources":["../src/file-command.ts"],"names":[],"mappings":";AAAA,uCAAuC;;;;;;;;;AAEvC,mCAAmC;AACnC,uDAAuD;AAEvD,uCAAwB;AACxB,uCAAwB;AACxB,mCAAsC;AAEtC,SAAgB,YAAY,CAAC,OAAe,EAAE,OAAY;IACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,OAAO,EAAE,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,wDAAwD,OAAO,EAAE,CAClE,CAAA;KACF;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,EAAE,CAAC,CAAA;KACrD;IAED,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,sBAAc,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;QACjE,QAAQ,EAAE,MAAM;KACjB,CAAC,CAAA;AACJ,CAAC;AAdD,oCAcC"}
{"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"}

View File

@ -1,5 +1,14 @@
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;

View File

@ -2,6 +2,7 @@
// 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
@ -16,4 +17,23 @@ function toCommandValue(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

View File

@ -1 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AAAA,mCAAmC;AACnC,uDAAuD;;AAEvD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAAU;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,OAAO,EAAE,CAAA;KACV;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,EAAE;QAC/D,OAAO,KAAe,CAAA;KACvB;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAC9B,CAAC;AAPD,wCAOC"}
{"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"}

View File

@ -1,40 +1,16 @@
{
"_args": [
[
"@actions/core@1.2.6",
"."
]
],
"_from": "@actions/core@1.2.6",
"_id": "@actions/core@1.2.6",
"_inBundle": false,
"_integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA==",
"_location": "/@actions/core",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@actions/core@1.2.6",
"name": "@actions/core",
"escapedName": "@actions%2fcore",
"scope": "@actions",
"rawSpec": "1.2.6",
"saveSpec": null,
"fetchSpec": "1.2.6"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
"_spec": "1.2.6",
"_where": ".",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"name": "@actions/core",
"version": "1.5.0",
"description": "Actions core lib",
"devDependencies": {
"@types/node": "^12.0.2"
},
"keywords": [
"github",
"actions",
"core"
],
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
"license": "MIT",
"main": "lib/core.js",
"types": "lib/core.d.ts",
"directories": {
"lib": "lib",
"test": "__tests__"
@ -43,15 +19,6 @@
"lib",
"!.DS_Store"
],
"homepage": "https://github.com/actions/toolkit/tree/main/packages/core",
"keywords": [
"github",
"actions",
"core"
],
"license": "MIT",
"main": "lib/core.js",
"name": "@actions/core",
"publishConfig": {
"access": "public"
},
@ -65,6 +32,10 @@
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"types": "lib/core.d.ts",
"version": "1.2.6"
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"devDependencies": {
"@types/node": "^12.0.2"
}
}

View File

@ -1,3 +1,93 @@
# 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 `&lt;` 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 `]]&gt;` 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)

8
node_modules/@xmldom/xmldom/LICENSE generated vendored Normal file
View File

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

144
node_modules/@xmldom/xmldom/lib/conventions.js generated vendored Normal file
View File

@ -0,0 +1,144 @@
'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;

View File

@ -1,3 +1,8 @@
var conventions = require("./conventions");
var entities = require('./entities');
var NAMESPACE = conventions.NAMESPACE;
function DOMParser(options){
this.options = options ||{locator:{}};
}
@ -10,7 +15,7 @@ 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?htmlEntity.entityMap:{'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"};
var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
if(locator){
domBuilder.setDocumentLocator(locator)
}
@ -18,9 +23,9 @@ DOMParser.prototype.parseFromString = function(source,mimeType){
sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);
sax.domBuilder = options.domBuilder || domBuilder;
if(isHTML){
defaultNSMap['']= 'http://www.w3.org/1999/xhtml';
defaultNSMap[''] = NAMESPACE.HTML;
}
defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace';
defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
if(source && typeof source === 'string'){
sax.parse(source,defaultNSMap,entityMap);
}else{
@ -178,8 +183,7 @@ DOMHandler.prototype = {
console.error('[xmldom error]\t'+error,_locator(this.locator));
},
fatalError:function(error) {
console.error('[xmldom fatalError]\t'+error,_locator(this.locator));
throw error;
throw new ParseError(error, this.locator);
}
}
function _locator(l){
@ -243,9 +247,11 @@ function appendElement (hander,node) {
}//appendChild and setAttributeNS are preformance key
//if(typeof require == 'function'){
var htmlEntity = require('./entities');
var XMLReader = require('./sax').XMLReader;
var sax = require('./sax');
var XMLReader = sax.XMLReader;
var ParseError = sax.ParseError;
var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation;
exports.XMLSerializer = require('./dom').XMLSerializer ;
exports.DOMParser = DOMParser;
exports.__DOMHandler = DOMHandler;
//}

View File

@ -1,15 +1,71 @@
/*
* 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
var conventions = require("./conventions");
var NAMESPACE = conventions.NAMESPACE;
/**
* A prerequisite for `[].filter`, to drop elements that are empty
* @param {string} input
* @returns {boolean}
*/
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]));?
@ -30,7 +86,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;
@ -66,7 +122,12 @@ 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;
@ -82,6 +143,7 @@ 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.
@ -113,6 +175,7 @@ NodeList.prototype = {
return buf.join('');
}
};
function LiveNodeList(node,refresh){
this._node = node;
this._refresh = refresh
@ -134,9 +197,15 @@ 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
*/
@ -248,55 +317,108 @@ NamedNodeMap.prototype = {
return null;
}
};
/**
* @see http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490
* 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
*/
function DOMImplementation(/* Object */ features) {
this._features = {};
if (features) {
for (var feature in features) {
this._features = features[feature];
}
}
};
function DOMImplementation() {
}
DOMImplementation.prototype = {
hasFeature: function(/* string */ feature, /* string */ version) {
var versions = this._features[feature.toLowerCase()];
if (versions && (!version || version in versions)) {
/**
* 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) {
return true;
} else {
return false;
}
},
// Introduced in DOM Level 2:
createDocument:function(namespaceURI, qualifiedName, doctype){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR,WRONG_DOCUMENT_ERR
/**
* 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){
var doc = new Document();
doc.implementation = this;
doc.childNodes = new NodeList();
doc.doctype = doctype;
if(doctype){
doc.doctype = doctype || null;
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;
},
// Introduced in DOM Level 2:
createDocumentType:function(qualifiedName, publicId, systemId){// raises:INVALID_CHARACTER_ERR,NAMESPACE_ERR
/**
* 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){
var node = new DocumentType();
node.name = qualifiedName;
node.nodeName = qualifiedName;
node.publicId = publicId;
node.systemId = systemId;
// Introduced in DOM Level 2:
//readonly attribute DOMString internalSubset;
//TODO:..
// readonly attribute NamedNodeMap entities;
// readonly attribute NamedNodeMap notations;
node.publicId = publicId || '';
node.systemId = systemId || '';
return node;
}
};
@ -436,22 +558,25 @@ function _visitNode(node,callback){
function Document(){
}
function _onAddAttribute(doc,el,newAttr){
doc && doc._inc++;
var ns = newAttr.namespaceURI ;
if(ns == 'http://www.w3.org/2000/xmlns/'){
if(ns === NAMESPACE.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 == 'http://www.w3.org/2000/xmlns/'){
if(ns === NAMESPACE.XMLNS){
//update namespace
delete el._nsMap[newAttr.prefix?newAttr.localName:'']
}
}
function _onUpdateChild(doc,el,newChild){
if(doc && doc._inc){
doc._inc++;
@ -567,8 +692,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){
@ -581,7 +706,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){
@ -607,28 +732,58 @@ Document.prototype = {
})
return rtv;
},
getElementsByClassName: function(className) {
var pattern = new RegExp("(^|\\s)" + className + "(\\s|$)");
/**
* 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 = [];
_visitNode(base.documentElement, function(node) {
if(node !== base && node.nodeType == ELEMENT_NODE) {
if(pattern.test(node.getAttribute('class'))) {
ls.push(node);
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;
@ -946,36 +1101,49 @@ 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;
if (!prefix && !uri){
// 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) {
return false;
}
if (prefix === "xml" && uri === "http://www.w3.org/XML/1998/namespace"
|| uri == 'http://www.w3.org/2000/xmlns/'){
if (prefix === "xml" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {
return false;
}
var i = visibleNamespaces.length
//console.log('@@@@',node.tagName,prefix,uri,visibleNamespaces)
while (i--) {
var ns = visibleNamespaces[i];
// get namespace prefix
//console.log(node.nodeType,node.tagName,ns.prefix,prefix)
if (ns.prefix == prefix){
return ns.namespace != uri;
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){
@ -988,20 +1156,40 @@ 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 = (htmlns === node.namespaceURI) ||isHTML
buf.push('<',nodeName);
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);
for(var i=0;i<len;i++){
// add namespaces for attributes
var attr = attrs.item(i);
@ -1011,23 +1199,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;
var ns = prefix ? ' xmlns:' + prefix : " xmlns";
buf.push(ns, '="' , uri , '"');
addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
visibleNamespaces.push({ prefix: prefix, namespace:uri });
}
serializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);
}
// add namespace for current node
if (needNamespaceDefine(node,isHTML, visibleNamespaces)) {
if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
var prefix = node.prefix||'';
var uri = node.namespaceURI;
var ns = prefix ? ' xmlns:' + prefix : " xmlns";
buf.push(ns, '="' , uri , '"');
addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : "xmlns", uri);
visibleNamespaces.push({ prefix: prefix, namespace:uri });
}
@ -1039,18 +1227,18 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
if(child.data){
buf.push(child.data);
}else{
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
}
child = child.nextSibling;
}
}else
{
while(child){
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
child = child.nextSibling;
}
}
buf.push('</',nodeName,'>');
buf.push('</',prefixedNodeName,'>');
}else{
buf.push('/>');
}
@ -1061,14 +1249,32 @@ function serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){
case DOCUMENT_FRAGMENT_NODE:
var child = node.firstChild;
while(child){
serializeToString(child,buf,isHTML,nodeFilter,visibleNamespaces);
serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
child = child.nextSibling;
}
return;
case ATTRIBUTE_NODE:
return buf.push(' ',node.name,'="',node.value.replace(/[<&"]/g,_xmlEncoder),'"');
return addSerializedAttribute(buf, node.name, node.value);
case TEXT_NODE:
return buf.push(node.data.replace(/[<&]/g,_xmlEncoder));
/**
* 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
* `&amp;` and `&lt;` respectively.
* The right angle bracket (>) may be represented using the string " &gt; ", and must, for compatibility,
* be escaped using either `&gt;` 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, ']]&gt;')
);
case CDATA_SECTION_NODE:
return buf.push( '<![CDATA[',node.data,']]>');
case COMMENT_NODE:
@ -1078,13 +1284,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){
@ -1200,10 +1406,12 @@ try{
return this.$$length;
}
});
Object.defineProperty(Node.prototype,'textContent',{
get:function(){
return getTextContent(this);
},
set:function(data){
switch(this.nodeType){
case ELEMENT_NODE:
@ -1215,8 +1423,8 @@ try{
this.appendChild(this.ownerDocument.createTextNode(data));
}
break;
default:
//TODO:
this.data = data;
this.value = data;
this.nodeValue = data;
@ -1241,6 +1449,7 @@ try{
return node.nodeValue;
}
}
__set__ = function(object,key,value){
//console.log(value)
object['$$'+key] = value
@ -1250,7 +1459,11 @@ try{
}
//if(typeof require == 'function'){
exports.Node = Node;
exports.DocumentType = DocumentType;
exports.DOMException = DOMException;
exports.DOMImplementation = DOMImplementation;
exports.Element = Element;
exports.Node = Node;
exports.NodeList = NodeList;
exports.XMLSerializer = XMLSerializer;
//}

View File

@ -1,4 +1,28 @@
exports.entityMap = {
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({
lt: '<',
gt: '>',
amp: '&',
@ -240,4 +264,10 @@ exports.entityMap = {
clubs: "♣",
hearts: "♥",
diams: "♦"
};
});
/**
* @deprecated use `HTML_ENTITIES` instead
* @see HTML_ENTITIES
*/
exports.entityMap = exports.HTML_ENTITIES

View File

@ -1,3 +1,5 @@
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)*
@ -18,6 +20,21 @@ 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(){
}
@ -100,12 +117,11 @@ 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);
var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, '');
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</)){
@ -113,8 +129,6 @@ 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()
@ -126,7 +140,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 );
errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName ); // No known test case
}
}else{
parseStack.push(config)
@ -166,7 +180,6 @@ 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)
@ -177,20 +190,19 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){
parseStack.push(el)
}
}
if(el.uri === 'http://www.w3.org/1999/xhtml' && !el.closed){
if (NAMESPACE.isHTML(el.uri) && !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;
@ -211,6 +223,16 @@ 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;
@ -226,7 +248,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');
throw new Error('attribute equal must after attrName'); // No known test case
}
break;
case '\'':
@ -241,7 +263,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);
el.add(attrName,value,start-1);
addAttribute(attrName, value, start-1);
s = S_ATTR_END;
}else{
//fatalError: no end quot match
@ -250,14 +272,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)
el.add(attrName,value,start);
addAttribute(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 "="');
throw new Error('attribute value must after "="'); // No known test case
}
break;
case '/':
@ -275,11 +297,10 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error
break;
//case S_EQ:
default:
throw new Error("attribute invalid close char('/')")
throw new Error("attribute invalid close char('/')") // No known test case
}
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));
@ -305,13 +326,13 @@ function parseElementStartPart(source,start,el,currentNSMap,entityReplacer,error
value = attrName;
}
if(s == S_ATTR_NOQUOT_VALUE){
errorHandler.warning('attribute "'+value+'" missed quot(")!!');
el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start)
errorHandler.warning('attribute "'+value+'" missed quot(")!');
addAttribute(attrName, value.replace(/&#?\w+;/g,entityReplacer), start)
}else{
if(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !value.match(/^(?:disabled|checked|selected)$/i)){
if(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){
errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!')
}
el.add(value,value,start)
addAttribute(value, value, start)
}
break;
case S_EQ:
@ -336,7 +357,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(")!!');
el.add(attrName,value,start)
addAttribute(attrName, value, start)
case S_ATTR_END:
s = S_TAG_SPACE;
break;
@ -356,10 +377,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(currentNSMap[''] !== 'http://www.w3.org/1999/xhtml' || !attrName.match(/^(?:disabled|checked|selected)$/i)){
if (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead2!!')
}
el.add(attrName,attrName,start);
addAttribute(attrName, attrName, start);
start = p;
s = S_ATTR;
break;
@ -415,7 +436,7 @@ function appendElement(el,domBuilder,currentNSMap){
//console.log(currentNSMap,1)
}
currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
a.uri = 'http://www.w3.org/2000/xmlns/'
a.uri = NAMESPACE.XMLNS
domBuilder.startPrefixMapping(nsPrefix, value)
}
}
@ -425,7 +446,7 @@ function appendElement(el,domBuilder,currentNSMap){
var prefix = a.prefix;
if(prefix){//no prefix attribute has no namespace
if(prefix === 'xml'){
a.uri = 'http://www.w3.org/XML/1998/namespace';
a.uri = NAMESPACE.XML;
}if(prefix !== 'xmlns'){
a.uri = currentNSMap[prefix || '']
@ -542,8 +563,7 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
}
}
var lastMatch = matchs[len-1]
domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'),
sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2'));
domBuilder.startDTD(name, pubid, sysid);
domBuilder.endDTD();
return lastMatch.index+lastMatch[0].length
@ -569,11 +589,8 @@ function parseInstruction(source,start,domBuilder){
return -1;
}
/**
* @param source
*/
function ElementAttributes(source){
function ElementAttributes(){
this.attributeNames = {}
}
ElementAttributes.prototype = {
setTagName:function(tagName){
@ -582,10 +599,11 @@ ElementAttributes.prototype = {
}
this.tagName = tagName
},
add:function(qName,value,offset){
addValue: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,
@ -621,4 +639,4 @@ function split(source,start){
}
exports.XMLReader = XMLReader;
exports.ParseError = ParseError;

59
node_modules/@xmldom/xmldom/package.json generated vendored Normal file
View File

@ -0,0 +1,59 @@
{
"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"
}

View File

@ -1,25 +1,96 @@
# XMLDOM
# @xmldom/xmldom
[![license](https://img.shields.io/npm/l/xmldom?color=blue&style=flat-square)](./LICENSE.md)
[![npm](https://img.shields.io/npm/v/xmldom?style=flat-square)](https://www.npmjs.com/package/xmldom)
[![license](https://img.shields.io/npm/l/@xmldom/xmldom?color=blue&style=flat-square)](LICENSE)
[![npm](https://img.shields.io/npm/v/@xmldom/xmldom?style=flat-square)](https://www.npmjs.com/package/@xmldom/xmldom)
[![bug issues](https://img.shields.io/github/issues/xmldom/xmldom/bug?color=red&style=flat-square)](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
[!["help wanted" issues](https://img.shields.io/github/issues/xmldom/xmldom/help%20wanted?color=darkgreen&style=flat-square)](https://github.com/xmldom/xmldom/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![Mutation report](https://camo.githubusercontent.com/ee312c4ebce7784ce9f785757eba5d6e33e6d950/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d25324662726f647962697473253246786d6c646f6d2532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/brodybits/xmldom/master)
A JavaScript implementation of W3C DOM for Node.js, Rhino and the browser. Fully
compatible with `W3C DOM level2`; and some compatible with `level3`. Supports
`DOMParser` and `XMLSerializer` interface such as in browser.
**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" >![Overview of related specifications and their relations](docs/specs.svg)</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>
Install:
-------
>npm install 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:
Example:
====
```javascript
const { DOMParser } = require('xmldom')
const { DOMParser } = require('@xmldom/xmldom')
const doc = new DOMParser().parseFromString(
'<xml xmlns="a" xmlns:c="./lite">\n' +
@ -40,13 +111,12 @@ console.info(nsAttr)
Note: in Typescript and ES6 you can use the import approach, as follows:
```javascript
import { DOMParser } from 'xmldom'
import { DOMParser } from '@xmldom/xmldom'
```
API Reference
=====
## API Reference
* [DOMParser](https://developer.mozilla.org/en/DOMParser):
* [DOMParser](https://developer.mozilla.org/en-US/docs/Web/API/DOMParser):
```javascript
parseFromString(xmlsource,mimeType)
@ -74,13 +144,12 @@ API Reference
```
* [XMLSerializer](https://developer.mozilla.org/en/XMLSerializer)
* [XMLSerializer](https://developer.mozilla.org/en-US/docs/Web/API/XMLSerializer)
```javascript
serializeToString(node)
```
DOM level2 method and attribute:
------
### DOM level2 method and attribute:
* [Node](http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247)
@ -98,6 +167,30 @@ DOM level2 method and attribute:
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)
@ -215,8 +308,7 @@ DOM level2 method and attribute:
readonly attribute:
target
DOM level 3 support:
-----
### DOM level 3 support:
* [Node](http://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-textContent)
@ -226,9 +318,9 @@ DOM level 3 support:
isDefaultNamespace(namespaceURI){
lookupNamespaceURI(prefix)
DOM extension by xmldom
---
* [Node] Source position extension;
### DOM extension by xmldom
* [Node] Source position extension;
attribute:
//Numbered starting from '1'

4
node_modules/xmldom/LICENSE.md generated vendored
View File

@ -1,4 +0,0 @@
You can choose any one of these licenses:
- MIT: https://opensource.org/licenses/MIT
- LGPL: http://www.gnu.org/licenses/lgpl.html

94
node_modules/xmldom/package.json generated vendored
View File

@ -1,94 +0,0 @@
{
"name": "xmldom",
"version": "0.4.0",
"description": "A pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module.",
"keywords": [
"w3c",
"dom",
"xml",
"parser",
"javascript",
"DOMParser",
"XMLSerializer"
],
"author": "jindw <jindw@xidea.org> (http://www.xidea.org)",
"homepage": "https://github.com/xmldom/xmldom",
"repository": {
"type": "git",
"url": "git://github.com/xmldom/xmldom.git"
},
"main": "lib/dom-parser.js",
"files": [
"CHANGELOG.md",
"LICENSE.md",
"readme.md",
"lib"
],
"scripts": {
"lint": "npm-run-all lint:eslint",
"lint:eslint": "eslint lib test",
"start": "nodemon --watch package.json --watch lib --watch test --exec 'npm --silent run test'",
"stryker": "stryker run",
"test": "npm-run-all test:unit lint",
"test:unit": "npm-run-all test:jest",
"test:jest": "jest"
},
"engines": {
"node": ">=10.0.0"
},
"dependencies": {},
"devDependencies": {
"@stryker-mutator/core": "^3.3.1",
"@stryker-mutator/javascript-mutator": "^3.3.1",
"dom-js": "0.0.9",
"eslint": "^7.12.0",
"eslint-config-prettier": "^6.14.0",
"eslint-plugin-es5": "^1.5.0",
"eslint-plugin-prettier": "^3.1.4",
"get-stream": "^6.0.0",
"jest": "^26.6.1",
"nodemon": "^2.0.6",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2",
"xmltest": "^1.4.0",
"yauzl": "^2.10.0"
},
"maintainers": [
{
"name": "brodybits",
"email": "chris@brody.consulting",
"url": "https://github.com/brodybits"
}
],
"contributors": [
{
"name": "jindw",
"email": "jindw@xidea.org",
"url": "http://www.xidea.org"
},
{
"name": "Yaron Naveh",
"email": "yaronn01@gmail.com",
"web": "http://webservices20.blogspot.com/"
},
{
"name": "Harutyun Amirjanyan",
"email": "amirjanyan@gmail.com",
"web": "https://github.com/nightwing"
},
{
"name": "Alan Gutierrez",
"email": "alan@prettyrobots.com",
"web": "http://www.prettyrobots.com/"
},
{
"name": "Eric Newport",
"email": "kethinov@gmail.com",
"web": "https://github.com/kethinov"
}
],
"bugs": {
"url": "https://github.com/xmldom/xmldom/issues"
},
"license": "(LGPL-2.0 OR MIT)"
}

8296
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,13 @@
{
"name": "maven-settings-action",
"version": "2.3.0",
"version": "2.4.1",
"description": "Prepare maven settings",
"main": "index.js",
"scripts": {
"lint": "eslint index.js settings.js",
"test": "eslint index.js settings.js && jest --coverage"
"test": "eslint index.js settings.js && jest --coverage",
"version": "./update-readme.sh",
"postversion": "git tag --delete v$npm_new_version"
},
"repository": {
"type": "git",
@ -24,11 +26,11 @@
},
"homepage": "https://github.com/s4u/maven-settings-action#readme",
"dependencies": {
"@actions/core": "^1.2.6",
"xmldom": "^0.4.0"
"@actions/core": "^1.5.0",
"@xmldom/xmldom": "^0.7.1"
},
"devDependencies": {
"eslint": "^7.16.0",
"jest": "^26.6.3"
"eslint": "^7.32.0",
"jest": "^27.0.6"
}
}

View File

@ -26,8 +26,8 @@ const core = require('@actions/core');
const os = require('os');
const path = require('path');
const fs = require('fs');
const DOMParser = require('xmldom').DOMParser;
const XMLSerializer = require('xmldom').XMLSerializer;
const DOMParser = require('@xmldom/xmldom').DOMParser;
const XMLSerializer = require('@xmldom/xmldom').XMLSerializer;
function getSettingsPath() {
return path.join(os.homedir(), '.m2', 'settings.xml');
@ -54,7 +54,7 @@ function jsonToXml(templateXml, xmlTag, json) {
for (const key in json) {
const keyXml = templateXml.createElement(key);
const value = json[key];
if ( value instanceof Object) {
if (value instanceof Object) {
jsonToXml(templateXml, keyXml, value);
} else {
keyXml.textContent = value;
@ -63,28 +63,32 @@ function jsonToXml(templateXml, xmlTag, json) {
}
}
function fillServer(templateXml, templateName, id, username, password, configurations) {
function fillServer(templateXml, templateName, id, username, password, privateKey, passphrase, filePermissions, directoryPermissions, configurations) {
if (!id || ((!username || !password) && !configurations) ) {
core.setFailed(templateName + ' must contain id, (username and password) or configuration');
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 usernameTag = serverXml.getElementsByTagName('username')[0];
if (username) {
usernameTag.textContent = username;
} else {
serverXml.documentElement.removeChild(usernameTag);
}
const passwordTag = serverXml.getElementsByTagName('password')[0];
if (password) {
passwordTag.textContent = password;
} else {
serverXml.documentElement.removeChild(passwordTag);
const 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];
@ -109,7 +113,10 @@ function fillServers(template, templateName) {
}
JSON.parse(servers).forEach((server) =>
fillServer(template, templateName, server.id, server.username, server.password, server.configuration));
fillServer(template, templateName, server.id, server.username,
server.password, server.privateKey, server.passphrase,
server.filePermissions, server.directoryPermissions,
server.configuration));
}
function fillMirror(template, id, name, mirrorOf, url) {

View File

@ -24,8 +24,8 @@ THE SOFTWARE.
const os = require('os');
const process = require('process');
const DOMParser = require('xmldom').DOMParser;
const XMLSerializer = require('xmldom').XMLSerializer;
const DOMParser = require('@xmldom/xmldom').DOMParser;
const XMLSerializer = require('@xmldom/xmldom').XMLSerializer;
const fs = require('fs');
const path = require('path');
@ -38,6 +38,14 @@ 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);
@ -51,7 +59,7 @@ beforeAll(() => {
});
beforeEach(() => {
xmlTestProfile = new DOMParser().parseFromString(`<settings>
xmlTestProfile = stringAsXml(`<settings>
<profiles>
<profile>
<id>_properties_</id>
@ -119,7 +127,7 @@ test('xml should be write', () => {
test('fillServers do nothing if no params', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
settings.fillServers(xml, 'servers');
@ -130,54 +138,46 @@ test('fillServers do nothing if no params', () => {
test('fillServers one server', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
settings.fillServers(xml, 'servers');
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '');
expect(xmlStr).toBe(`<servers>
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username1</username>
<password>password1</password>
</server></servers>`);
});
test('fillServers with username and configuration', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
settings.fillServers(xml, 'servers');
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '')
expect(xmlStr).toBe(`<servers>
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 = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username", "password": "password", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
settings.fillServers(xml, 'servers');
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '')
expect(xmlStr).toBe(`<servers>
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username</username>
@ -186,73 +186,115 @@ test('fillServers with username, password and 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 = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": "prop1Value", "prop2": "prop2Value"}}]';
settings.fillServers(xml, 'servers');
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '')
expect(xmlStr).toBe(`<servers>
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 = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "configuration": {"prop1": {"prop11": "value11", "prop12": "value12"}, "prop2": "value2"}}]';
settings.fillServers(xml, 'servers');
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '')
expect(xmlStr).toBe(`<servers>
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<configuration><prop1><prop11>value11</prop11><prop12>value12</prop12></prop1><prop2>value2</prop2></configuration>
</server></servers>`);
});
test('fillServers two servers', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"},\
{"id": "id2", "username": "username2", "password":"password2"}]';
settings.fillServers(xml, 'servers');
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '');
expect(xmlStr).toBe(`<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 = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_SERVERS'] = '[{"idx": "id1"}]';
@ -263,22 +305,20 @@ test('fill servers incorrect fields', () => {
expect(xmlStr).toBe('<servers/>');
expect(consoleOutput).toEqual(
expect.arrayContaining([
expect.stringMatching(/::error::servers must contain id, \(username and password\) or configuration/)
expect.stringMatching(/::error::servers must contain id, and username or configuration/)
])
);
});
test('fill oracleServers', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_ORACLESERVERS'] = '[{"id": "id1", "username": "username1", "password":"password1"}]';
settings.fillServers(xml, 'oracleServers');
const xmlStr = new XMLSerializer().serializeToString(xml);
expect(xmlStr).toBe(`<servers>
expect(xmlAsString(xml)).toBe(`<servers>
<server>
<id>id1</id>
<username>username1</username>
@ -305,27 +345,24 @@ test('fill oracleServers', () => {
test('fillServers github', () => {
const xml = new DOMParser().parseFromString("<servers/>");
const xml = stringAsXml("<servers/>");
process.env['INPUT_GITHUBSERVER'] = 'true';
settings.fillServerForGithub(xml);
const xmlStr = new XMLSerializer().serializeToString(xml).replace(/^ $/mg, '');
expect(xmlStr).toBe(`<servers>
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 = new DOMParser().parseFromString("<mirrors/>");
const xml = stringAsXml("<mirrors/>");
settings.fillMirrors(xml);
@ -337,7 +374,7 @@ test('fillMirrors do nothing if no params', () => {
test('fillMirrors one mirror', () => {
const xml = new DOMParser().parseFromString("<mirrors/>");
const xml = stringAsXml("<mirrors/>");
process.env['INPUT_MIRRORS'] = '[{"id": "id1", "name": "name", "mirrorOf":"mirrorOf", "url":"url"}]';
@ -357,7 +394,7 @@ test('fillMirrors one mirror', () => {
test('fillMirrors two mirrors', () => {
const xml = new DOMParser().parseFromString("<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"}]';
@ -383,7 +420,7 @@ test('fillMirrors two mirrors', () => {
test('fillMirrors incorrect fields', () => {
const xml = new DOMParser().parseFromString("<mirrors/>");
const xml = stringAsXml("<mirrors/>");
process.env['INPUT_MIRRORS'] = '[{"idx": "id1"}]';
@ -403,7 +440,7 @@ test('addApacheSnapshots', () => {
process.env['INPUT_APACHESNAPSHOTS'] = "true";
const xml = new DOMParser().parseFromString('<profiles/>');
const xml = stringAsXml('<profiles/>');
settings.addApacheSnapshots(xml);
@ -445,7 +482,7 @@ test('addSonatypeSnapshots', () => {
process.env['INPUT_SONATYPESNAPSHOTS'] = "true";
const xml = new DOMParser().parseFromString('<profiles/>');
const xml = stringAsXml('<profiles/>');
settings.addSonatypeSnapshots(xml);
@ -487,7 +524,7 @@ test('addOracleRepo', () => {
process.env['INPUT_ORACLEREPO'] = "true";
const xml = new DOMParser().parseFromString('<profiles/>');
const xml = stringAsXml('<profiles/>');
settings.addOracleRepo(xml);
@ -529,7 +566,7 @@ test('fillProperties', () => {
process.env['INPUT_PROPERTIES'] = '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]';
const xml = new DOMParser().parseFromString('<profiles/>');
const xml = stringAsXml('<profiles/>');
settings.fillProperties(xml);

View File

@ -3,6 +3,10 @@
<id />
<username />
<password />
<privateKey />
<passphrase />
<filePermissions />
<directoryPermissions />
<configuration>
<basicAuthScope>
<host>ANY</host>

View File

@ -3,5 +3,9 @@
<id />
<username />
<password />
<privateKey />
<passphrase />
<filePermissions />
<directoryPermissions />
<configuration />
</server>

9
update-readme.sh Executable file
View File

@ -0,0 +1,9 @@
#!/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