vnu-jar 25.12.21 → 25.12.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dist/vnu.jar +0 -0
- package/package.json +1 -1
- package/vnu-java-downloader.js +20 -1
package/build/dist/vnu.jar
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "vnu-jar", "version": "25.12.
|
|
1
|
+
{"name": "vnu-jar", "version": "25.12.22", "description": "Provides the Nu Html Checker \u00abvnu.jar\u00bb file", "main": "vnu-jar.js", "author": "sideshowbarker@gmail.com", "engines": {"node": ">=0.10"}, "repository": {"type": "git", "url": "git+https://github.com/validator/validator.git"}, "license": "MIT", "bugs": {"url": "https://github.com/validator/validator/issues"}, "homepage": "https://github.com/validator/validator#readme", "keywords": ["checker", "html", "lint", "linter", "jar", "nu", "validator", "vnu", "w3c"], "files": ["build/dist/vnu.jar", "vnu-java-downloader.js", "vnu-jar.js"], "bin": {"vnu": "./vnu-jar.js"}, "scripts": {"postinstall": "node vnu-java-downloader.js"}}
|
package/vnu-java-downloader.js
CHANGED
|
@@ -27,11 +27,30 @@ const CACHE_DIR = join(NODE_MODULES_DIR, '.cache', 'vnu-jar', 'java');
|
|
|
27
27
|
const TEMURIN_VERSION = '17.0.17+10';
|
|
28
28
|
const TEMURIN_BASE_URL = `https://github.com/adoptium/temurin17-binaries/releases/download/jdk-${TEMURIN_VERSION}/`;
|
|
29
29
|
|
|
30
|
+
function getJavaVersion(javaPath) {
|
|
31
|
+
try {
|
|
32
|
+
const result = spawnSync(javaPath, ['-version'], { encoding: 'utf8' });
|
|
33
|
+
const versionOutput = result.stderr || result.stdout || '';
|
|
34
|
+
const match = versionOutput.match(/version "(\d+)(?:\.(\d+))?/);
|
|
35
|
+
if (match) {
|
|
36
|
+
const majorVersion = parseInt(match[1], 10);
|
|
37
|
+
return majorVersion;
|
|
38
|
+
}
|
|
39
|
+
} catch (err) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
30
45
|
function findSystemJava() {
|
|
31
46
|
const whichCmd = process.platform === 'win32' ? 'where' : 'which';
|
|
32
47
|
const result = spawnSync(whichCmd, ['java'], { encoding: 'utf8' });
|
|
33
48
|
if (result.status === 0 && result.stdout) {
|
|
34
|
-
|
|
49
|
+
const javaPath = result.stdout.split(/\r?\n/)[0].trim();
|
|
50
|
+
const version = getJavaVersion(javaPath);
|
|
51
|
+
if (version !== null && version >= 11) {
|
|
52
|
+
return javaPath;
|
|
53
|
+
}
|
|
35
54
|
}
|
|
36
55
|
return null;
|
|
37
56
|
}
|