vnu-jar 21.7.12 → 21.9.2

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/README.md CHANGED
@@ -19,61 +19,47 @@ code][10].
19
19
  [9]: https://github.com/validator/validator
20
20
  [10]: https://validator.github.io/validator/#build-instructions
21
21
 
22
- A [Dockerfile][11] (see **Pulling the Docker image** below) and [npm][12],
23
- [pip][13], and [brew][14] packages are also available.
22
+ `vnu.jar` is a packaged version of the Nu Html Checker for batch-checking
23
+ documents from the command line and from other scripts/apps.
24
24
 
25
- [11]: https://ghcr.io/validator/validator
26
- [12]: https://www.npmjs.com/package/vnu-jar
27
- [13]: https://github.com/svenkreiss/html5validator
28
- [14]: https://formulae.brew.sh/formula/vnu
25
+ You can work with `vnu.jar` in CommonJS modules.
29
26
 
30
- It is released upstream in these formats:
27
+ ## Install latest release version
31
28
 
32
- * pre-compiled Linux, Windows, and macOS binaries that include an embedded
33
- Java runtime
29
+ ```sh
30
+ npm install --save vnu-jar
31
+ ```
34
32
 
35
- * `vnu.jar` a portable version you can use on any system that has Java 8 or
36
- above installed
33
+ ## Install 'next' version
37
34
 
38
- * `vnu.war` — for [deploying the checker service through a servlet container
39
- such as Tomcat][15]
35
+ ```sh
36
+ npm install --save vnu-jar@next
37
+ ```
40
38
 
41
- [15]: https://validator.github.io/validator/#servlet
39
+ ## Example
42
40
 
43
- **Note:** The _vnu.jar_ and _vnu.war_ files require you to have Java 8 or above
44
- installed. The pre-compiled Linux, Windows, and macOS binaries don’t require you
45
- to have any version of Java already installed at all.
41
+ For Node.js 6+
46
42
 
47
- You can [get the latest release][16] or run [`docker run -it --rm -p 8888:8888
48
- ghcr.io/validator/validator:latest`][17], [`npm install vnu-jar`][18],
49
- [`brew install vnu`][19], or [`pip install html5validator`][20] and see the
50
- **Usage** and **Web-based checking** sections below. Or automate your document
51
- checking with a frontend such as:
43
+ ```js
44
+ 'use strict';
52
45
 
53
- [16]: https://github.com/validator/validator/releases/latest
54
- [17]: https://github.com/validator/validator/pkgs/container/validator
55
- [18]: https://www.npmjs.com/package/vnu-jar
56
- [19]: https://libraries.io/homebrew/vnu
46
+ const exec = require('child_process').exec;
47
+ const vnu = require('vnu-jar');
57
48
 
58
- [20]: https://github.com/svenkreiss/html5validator
59
-
60
- * [Grunt plugin for HTML validation][21] or [Gulp plugin for HTML
61
- validation][22] or [Maven plugin for HTML validation][23]
62
-
63
- * [html5validator `pip` package][24] (for integration in Travis CI, CircleCI,
64
- CodeShip, Jekyll, Pelican, etc.)
65
-
66
- * [LMVTFY: Let Me Validate That For You][25] (auto-check JSFiddle/JSBin, etc.,
67
- links in GitHub issue comments)
68
-
69
- [21]: https://github.com/validator/grunt-html
70
- [22]: https://github.com/validator/gulp-html
71
- [23]: https://github.com/validator/maven-plugin
72
- [24]: https://github.com/svenkreiss/html5validator
73
- [25]: https://github.com/cvrebert/lmvtfy/
49
+ // Print path to vnu.jar
50
+ console.log(vnu);
74
51
 
52
+ // Work with vnu.jar
53
+ // for example get vnu.jar version
54
+ exec(`java -jar ${vnu} --version`, (error, stdout) => {
55
+ if (error) {
56
+ console.error(`exec error: ${error}`);
57
+ return;
58
+ }
59
+ console.log(stdout);
60
+ });
61
+ ```
75
62
  ## Usage
76
-
77
63
  Run the checker with one of the following invocations:
78
64
 
79
65
  • `vnu-runtime-image/bin/vnu OPTIONS FILES` (Linux or macOS)
@@ -91,10 +77,10 @@ the following options:
91
77
  --skip-non-svg --also-check-svg --html --skip-non-html
92
78
  --format gnu|xml|json|text --help --verbose --version
93
79
 
94
- The [Options][26] section below provides details on each option, and the rest of
80
+ The [Options][27] section below provides details on each option, and the rest of
95
81
  this section provides some specific examples.
96
82
 
97
- [26]: https://validator.github.io/validator/#options
83
+ [27]: https://validator.github.io/validator/#options
98
84
 
99
85
  **Note:** Throughout these examples, replace `~/vnu.jar` with the actual path to
100
86
  that jar file on your system, and replace `vnu-runtime-image/bin/vnu` and
@@ -341,389 +327,3 @@ provides the following options:
341
327
 
342
328
  Shows the checker version number.
343
329
 
344
- ## Web-based checking
345
-
346
- The Nu Html Checker — along with being usable as [a standalone command-line
347
- client][27] — can be run as an HTTP service, similar to
348
- [validator.w3.org/nu][28], for browser-based checking of HTML documents, CSS
349
- stylesheets, and SVG images over the Web. To that end, the checker is released
350
- as several separate packages:
351
-
352
- [27]: https://validator.github.io/validator/#usage
353
- [28]: https://validator.w3.org/nu/
354
-
355
- * Linux, Windows, and macOS binaries for deploying the checker as a simple
356
- self-contained service on any system
357
-
358
- * `vnu.jar` for deploying the checker as a simple self-contained service on a
359
- system with Java installed
360
-
361
- * `vnu.war` for deploying the checker to a servlet container such as Tomcat
362
-
363
- All deployments expose a REST API that enables checking of HTML documents, CSS
364
- stylesheets, and SVG images from other clients, not just web browsers. And the
365
- Linux, Windows, and macOS binaries and `vnu.jar` package also include a simple
366
- HTTP client that enables you to either send documents to a locally-running
367
- instance of the checker HTTP service — for fast command-line checking — or to
368
- any remote instance of the checker HTTP service running anywhere on the Web.
369
-
370
- The [latest releases of the Linux, Windows, and macOS binaries and vnu.jar and
371
- vnu.war packages][29] are available from the `validator` project at github. The
372
- following are detailed instructions on using them.
373
-
374
- [29]: https://github.com/validator/validator/releases/latest
375
-
376
- **Note:** Throughout these instructions, replace `~/vnu.jar` with the actual
377
- path to that jar file on your system, and replace `vnu-runtime-image/bin/java`
378
- and `vnu-runtime-image\bin\java.exe` with the actual path to the checker `java`
379
- or `java.exe` program on your system — or if you add the `vnu-runtime-image/bin`
380
- or `vnu-runtime-image\bin` directory your system `PATH` environment variable,
381
- you can invoke the checker with just `java nu.validator.servlet.Main 8888`.
382
-
383
- ### Standalone web server
384
-
385
- To run the checker as a standalone service (using a built-in Jetty server), open
386
- a new terminal window and invoke the checker like this:
387
-
388
- java -cp ~/vnu.jar nu.validator.servlet.Main 8888
389
-
390
- vnu-runtime-image/bin/java nu.validator.servlet.Main 8888
391
-
392
- vnu-runtime-image\bin\java.exe nu.validator.servlet.Main 8888
393
-
394
- Then open [http://0.0.0.0:8888][30] in a browser. (To listen on a different
395
- port, replace `8888` with the port number.)
396
-
397
- [30]: http://0.0.0.0:8888
398
-
399
- **Warning:** Future checker releases will bind by default to the address
400
- `127.0.0.1`. Your checker deployment might become unreachable unless you use the
401
- `nu.validator.servlet.bind-address` system property to bind the checker to a
402
- different address:
403
-
404
- java -cp ~/vnu.jar \
405
- -Dnu.validator.servlet.bind-address=128.30.52.73 \
406
- nu.validator.servlet.Main 8888
407
-
408
- vnu-runtime-image/bin/java \
409
- -Dnu.validator.servlet.bind-address=128.30.52.73 \
410
- nu.validator.servlet.Main 8888
411
-
412
- vnu-runtime-image\bin\java.exe \
413
- -Dnu.validator.servlet.bind-address=128.30.52.73 \
414
- nu.validator.servlet.Main 8888
415
-
416
- When you open [http://0.0.0.0:8888][31] (or whatever URL corresponds to the
417
- `nu.validator.servlet.bind-address` value you’re using), you’ll see a form
418
- similar to [validator.w3.org/nu][32] that allows you to enter the URL of an HTML
419
- document, CSS stylesheet, or SVG image, and have the results of checking that
420
- resource displayed in the browser.
421
-
422
- [31]: http://0.0.0.0:8888
423
- [32]: https://validator.w3.org/nu/
424
-
425
- **Note:** If you get a `StackOverflowError` error when using the checker, try
426
- adjusting the thread stack size by providing the `-Xss` option to java:
427
-
428
- java -Xss512k -cp ~/vnu.jar nu.validator.servlet.Main 8888
429
-
430
- vnu-runtime-image/bin/java -Xss512k -m vnu/nu.validator.servlet.Main 8888
431
-
432
- ### Deployment to servlet container
433
-
434
- To run the checker inside of an existing servlet container such as Apache Tomcat
435
- you will need to deploy the `vnu.war` file to that server following its
436
- documentation. For example, on Apache Tomcat you could do this using the
437
- [Manager][33] application or simply by copying the file to the `webapps`
438
- directory (since that is the default `appBase` setting). Typically you would see
439
- a message similar to the following in the `catalina.out` log file.
440
-
441
- [33]: https://tomcat.apache.org/tomcat-8.0-doc/manager-howto.html
442
-
443
- May 7, 2014 4:42:04 PM org.apache.catalina.startup.HostConfig deployWAR
444
- INFO: Deploying web application archive /var/lib/tomcat7/webapps/vnu.war
445
-
446
- Assuming your servlet container is configured to receive HTTP requests sent to
447
- `localhost` on port `80` and the context root of this application is `vnu`
448
- (often the default behavior is to use the WAR file's filename as the context
449
- root unless one is explicitly specified) you should be able to access the
450
- application by connecting to [http://localhost/vnu/][34].
451
-
452
- [34]: http://localhost/vnu/
453
-
454
- **Note:** You may want to customize the `/WEB-INF/web.xml` file inside the WAR
455
- file (you can use any ZIP-handling program) to modify the servlet filter
456
- configuration. For example, if you wanted to disable the inbound-size-limit
457
- filter, you could comment out that filter like this:
458
-
459
- <!--
460
- <filter>
461
- <filter-name>inbound-size-limit-filter</filter-name>
462
- <filter-class>nu.validator.servlet.InboundSizeLimitFilter</filter-class>
463
- </filter>
464
- <filter-mapping>
465
- <filter-name>inbound-size-limit-filter</filter-name>
466
- <url-pattern>/*</url-pattern>
467
- </filter-mapping>
468
- -->
469
-
470
- ### HTTP client (for fast command-line checking)
471
-
472
- The checker is packaged with an HTTP client you can use from the command line to
473
- either send documents to a locally-running instance of the checker HTTP service
474
- — for fast command-line checking — or to a remote instance anywhere on the Web.
475
-
476
- To check documents locally using the packaged HTTP client, do this:
477
-
478
- 1. Start up the checker as a local HTTP service, as described in the
479
- **Standalone web server** section.
480
-
481
- 2. Open a new terminal window and invoke the HTTP client like this:
482
-
483
- java -cp ~/vnu.jar nu.validator.client.HttpClient FILE.html...
484
-
485
- vnu-runtime-image/bin/java nu.validator.client.HttpClient FILE.html...
486
-
487
- To send documents to an instance of the checker on the Web, such as
488
- [html5.validator.nu/][35], use the nu.validator.client.host and
489
- nu.validator.client.port options, like this:
490
-
491
- [35]: https://html5.validator.nu/
492
-
493
- java -cp ~/vnu.jar -Dnu.validator.client.port=80 \
494
- -Dnu.validator.client.host=html5.validator.nu \
495
- nu.validator.client.HttpClient FILE.html...
496
-
497
- …or like this:
498
-
499
- vnu-runtime-image/bin/java -Dnu.validator.client.port=80 \
500
- -Dnu.validator.client.host=html5.validator.nu \
501
- nu.validator.client.HttpClient FILE.html...
502
-
503
- Other options are documented below.
504
-
505
- ### HTTP client options
506
-
507
- When using the packaged HTTP client for sending documents to an instance of the
508
- checker HTTP service for checking, you can set Java system properties to control
509
- configuration options for the checker behavior.
510
-
511
- For example, you can suppress warning-level messages and only show error-level
512
- ones by setting the value of the `nu.validator.client.level` system property to
513
- `error`, like this:
514
-
515
- java -Dnu.validator.client.level=error \
516
- -cp ~/vnu.jar nu.validator.client.HttpClient FILE.html...
517
-
518
- …or like this:
519
-
520
- vnu-runtime-image/bin/java -Dnu.validator.client.level=error \
521
- -cp ~/vnu.jar nu.validator.client.HttpClient FILE.html...
522
-
523
- Most of the properties listed below map to the common input parameters for the
524
- checker service, as documented at
525
- [github.com/validator/validator/wiki/Service-»-Common-params][36].
526
-
527
- [36]: https://github.com/validator/validator/wiki/Service-%C2%BB-Common-params
528
-
529
- #### nu.validator.client.host
530
-
531
- Specifies the hostname of the checker for the client to connect to.
532
-
533
- default: "127.0.0.1"
534
-
535
- #### nu.validator.client.port
536
-
537
- Specifies the hostname of the checker for the client to connect to.
538
-
539
- default: "8888"
540
-
541
- example: java -Dnu.validator.client.port=8080 -jar ~/vnu.jar FILE.html
542
-
543
- #### nu.validator.client.level
544
-
545
- Specifies the severity level of messages to report; to suppress
546
- warning-level messages, and only show error-level ones, set this property to
547
- "error".
548
-
549
- default: [unset]
550
-
551
- possible values: "error"
552
-
553
- example: java -Dnu.validator.client.level=error -jar ~/vnu.jar FILE.html
554
-
555
- #### nu.validator.client.parser
556
-
557
- Specifies which parser to use.
558
-
559
- default: "html"; or, for *.xhtml input files, "xml"
560
-
561
- possible values: [see information at URL below]
562
-
563
- https://github.com/validator/validator/wiki/Service-%C2%BB-Common-params#parser
564
-
565
- #### nu.validator.client.charset
566
-
567
- Specifies the encoding of the input document.
568
-
569
- default: [unset]
570
-
571
- #### nu.validator.client.content-type
572
-
573
- Specifies the content-type of the input document.
574
-
575
- default: "text/html"; or, for *.xhtml files, "application/xhtml+xml"
576
-
577
- #### nu.validator.client.out
578
-
579
- Specifies the output format for messages.
580
-
581
- default: "gnu"
582
-
583
- possible values: [see information at URL below]
584
-
585
- https://github.com/validator/validator/wiki/Service-%C2%BB-Common-params#out
586
-
587
- #### nu.validator.client.asciiquotes
588
-
589
- Specifies whether ASCII quotation marks are substituted for Unicode smart
590
- quotation marks in messages.
591
-
592
- default: "yes"
593
-
594
- possible values: "yes" or "no"
595
-
596
- ### HTTP servlet options
597
-
598
- #### nu.validator.servlet.bind-address
599
-
600
- Binds the validator service to the specified IP address.
601
-
602
- default: 0.0.0.0 [causes the checker to listen on all interfaces]
603
-
604
- possible values: The IP address of any network interface
605
-
606
- example: -Dnu.validator.servlet.bind-address=127.0.0.1
607
-
608
- #### nu.validator.servlet.connection-timeout
609
-
610
- Specifies the connection timeout.
611
-
612
- default: 5000
613
-
614
- possible values: number of milliseconds
615
-
616
- example: -Dnu.validator.servlet.connection-timeout=5000
617
-
618
- #### nu.validator.servlet.socket-timeout
619
-
620
- Specifies the socket timeout.
621
-
622
- default: 5000
623
-
624
- possible values: number of milliseconds
625
-
626
- example: -Dnu.validator.servlet.socket-timeout=5000
627
-
628
- ## Pulling the Docker image
629
-
630
- You can pull the checker Docker image from
631
- [https://ghcr.io/validator/validator][37] in the GitHub container registry.
632
-
633
- [37]: https://ghcr.io/validator/validator
634
-
635
- To pull and run the latest version of the checker:
636
-
637
- docker run -it --rm -p 8888:8888 ghcr.io/validator/validator:latest
638
-
639
- To pull and run a specific tag/version of the checker from the container
640
- registry — for example, the `17.11.1` version:
641
-
642
- docker run -it --rm -p 8888:8888 ghcr.io/validator/validator:17.11.1
643
-
644
- To bind the checker to a specific address (rather than have it listening on all
645
- interfaces):
646
-
647
- docker run -it --rm -p 128.30.52.73:8888:8888
648
- ghcr.io/validator/validator:latest
649
-
650
- To make the checker run with a connection timeout and socket timeout different
651
- than the default 5 seconds, use the `CONNECTION_TIMEOUT_SECONDS` and
652
- `SOCKET_TIMEOUT_SECONDS` environment variables:
653
-
654
- docker run -it --rm \
655
- -e CONNECTION_TIMEOUT_SECONDS=15 \
656
- -e SOCKET_TIMEOUT_SECONDS=15 \
657
- -p 8888:8888 \
658
- validator/validator
659
-
660
- To make the checker run with particular Java system properties set, use the
661
- `JAVA_TOOL_OPTIONS` environment variable:
662
-
663
- docker run -it --rm \
664
- -e JAVA_TOOL_OPTIONS=-Dnu.validator.client.asciiquotes=yes \
665
- -p 8888:8888 \
666
- validator/validator
667
-
668
- To define a service named `vnu` for use with `docker compose`, create a Compose
669
- file named `docker-compose.yml` (for example), with contents such as the
670
- following:
671
-
672
- version: '2' services:
673
- vnu:
674
- image: validator/validator ports:
675
- - "8888:8888"
676
- network_mode: "host" #so "localhost" refers to the host machine.
677
-
678
- ## Build instructions
679
-
680
- Follow the steps below to build, test, and run the checker such that you can
681
- open `http://0.0.0.0:8888/` in a Web browser to use the checker Web UI.
682
-
683
- 1. Make sure you have git, python, and JDK 8 or above installed.
684
-
685
- 2. Set the `JAVA_HOME` environment variable:
686
-
687
- export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 <-- Ubuntu, etc.
688
-
689
- export JAVA_HOME=$(/usr/libexec/java_home) <-- MacOS
690
-
691
- 3. Create a working directory:
692
-
693
- git clone https://github.com/validator/validator.git
694
-
695
- 4. Change into your working directory:
696
-
697
- cd validator
698
-
699
- 5. Start the checker Python script:
700
-
701
- python ./checker.py all
702
-
703
- The first time you run the checker Python script, you’ll need to be online and
704
- the build will need time to download several megabytes of dependencies.
705
-
706
- The steps above will build, test, and run the checker such that you can open
707
- `http://0.0.0.0:8888/` in a Web browser to use the checker Web UI.
708
-
709
- **Warning:** Future checker releases will bind by default to the address
710
- `127.0.0.1`. Your checker deployment might become unreachable unless you use the
711
- `--bind-address` option to bind the checker to a different address:
712
-
713
- python ./checker.py --bind-address=128.30.52.73 all
714
-
715
- Use `python ./checker.py --help` to see command-line options for controlling the
716
- behavior of the script, as well as build-target names you can call separately;
717
- e.g.:
718
-
719
- * python ./checker.py build # to build only
720
-
721
- * python ./checker.py build # test to build and test
722
-
723
- * python ./checker.py run # to run only
724
-
725
- * python ./checker.py jar # to compile vnu.jar
726
-
727
- * python ./checker.py update-shallow && \
728
-   python ./checker.py dldeps && \
729
-   python ./checker.py jar  # compile vnu.jar faster
Binary file
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "vnu-jar", "version": "21.7.12", "description": "Provides the Nu Html Checker \u00abvnu.jar\u00bb file", "main": "vnu-jar.js", "author": "Michael[tm] Smith <mike@w3.org>", "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-jar.js"]}
1
+ {"name": "vnu-jar", "version": "21.9.2", "description": "Provides the Nu Html Checker \u00abvnu.jar\u00bb file", "main": "vnu-jar.js", "author": "Michael[tm] Smith <mike@w3.org>", "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-jar.js"]}