@aljazmc/syntax 0.7.2 → 0.7.4

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.
Files changed (2) hide show
  1. package/README.md +42 -9
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,12 +1,30 @@
1
- # > syntax
1
+ # @aljazmc/syntax
2
2
 
3
- Shared, dependency-free scanner and recursive descent parser for CSS,
4
- HTML, JavaScript, JSON, JSX, Markdown, TypeScript and YAML, bundled into
5
- `@aljazmc/formatero` and `@aljazmc/lintero` and published for their
6
- types. Invalid sources throw a `ParseError` with the position of the
7
- problem.
3
+ [![CI](https://github.com/aljazmc/aljazmc/actions/workflows/ci.yml/badge.svg)](https://github.com/aljazmc/aljazmc/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/@aljazmc/syntax?logo=npm&color=cb3837)](https://www.npmjs.com/package/@aljazmc/syntax)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+ [![Dependencies: none](https://img.shields.io/badge/dependencies-none-brightgreen)](package.json)
7
+ [![ESTree](https://img.shields.io/badge/AST-ESTree-f7df1e?logo=javascript&logoColor=black)](https://github.com/estree/estree)
8
+ [![CommonMark + GFM](https://img.shields.io/badge/Markdown-CommonMark%20%2B%20GFM-000000?logo=markdown&logoColor=white)](https://github.github.com/gfm/)
9
+ [![Bundled](https://img.shields.io/badge/bundled%20into-formatero%20·%20lintero-6e7781)](../../README.md#packages)
10
+ [![Tests](https://img.shields.io/badge/tests-31%20passing-brightgreen)](#tests)
11
+ [![TypeScript 7](https://img.shields.io/badge/TypeScript-7%20strict-3178c6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
8
12
 
9
- ## > Features
13
+ The scanner and recursive descent parsers behind formatero and lintero,
14
+ for CSS, HTML, JavaScript, JSON, JSX, Markdown, TypeScript and YAML, in
15
+ plain TypeScript. esbuild bundles this code into both packages; it is
16
+ published on npm only for its types.
17
+
18
+ ## Features
19
+
20
+ - **Eight languages, one package.** Every parser is hand-written, with no
21
+ generated grammars and no dependencies.
22
+ - **ESTree trees.** JavaScript, JSX, TypeScript and JSON parse to ESTree,
23
+ with Babel-style literals and TypeScript nodes.
24
+ - **Comments kept.** Every parser keeps the comments, and HTML its
25
+ whitespace, as a formatter needs them.
26
+ - **Precise errors.** Invalid sources throw a `ParseError` with the line
27
+ and column of the problem; CSS can recover and list them instead.
10
28
 
11
29
  | Language | Entry points | Tree |
12
30
  | --------------------------- | ----------------------------- | ---------------------------------------------------------------------------------- |
@@ -25,7 +43,7 @@ problem.
25
43
  | `tagOf` | The known tag of an element name, like `div` for `DIV`. |
26
44
  | `Walker` | Lists the child nodes of a node in source order. |
27
45
 
28
- ## > Usage
46
+ ## Usage
29
47
 
30
48
  ```ts
31
49
  import {
@@ -44,6 +62,21 @@ const doc = parseMarkdown("# Title\n\n- [x] done\n");
44
62
  const stream = parseYaml("a:\n - b: 1 # c\n");
45
63
  ```
46
64
 
47
- ## > License
65
+ ## Tests
66
+
67
+ ```sh
68
+ docker compose run --rm node yarn t:syntax
69
+ ```
70
+
71
+ 31 tests, run by [testero](../../packages/testero), each checking many
72
+ sources: JavaScript, JSX and TypeScript, Markdown blocks and inlines by
73
+ CommonMark, HTML, CSS and YAML, and regressions. formatero and lintero
74
+ test the parser further, through 1,898 cases of their own that compare
75
+ with Biome.
76
+
77
+ A change here is bundled into formatero and lintero, so run their tests
78
+ too: `yarn t:formatero` and `yarn t:lintero`.
79
+
80
+ ## License
48
81
 
49
82
  MIT, see [LICENSE](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aljazmc/syntax",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Shared, dependency-free parser for CSS, HTML, JavaScript, JSON, JSX, Markdown, TypeScript and YAML, bundled into @aljazmc/formatero and @aljazmc/lintero.",
5
5
  "keywords": [
6
6
  "parser",