@noldova/context.diagnostics 0.0.2 → 0.0.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 +34 -0
  2. package/package.json +5 -4
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # noldova.context.diagnostics
2
+
3
+ The diagnostic model CONTEXT parsers and tools report through: codes in an
4
+ authority's namespace (`TS` or `CTX`), categories, structured message chains,
5
+ source locations, related information and tags. A `Diagnostic` is complete and
6
+ immutable once created; reusable `DiagnosticTemplate`s create occurrences from a
7
+ catalog.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @noldova/context.diagnostics
13
+ ```
14
+
15
+ ## Use
16
+
17
+ ```ts
18
+ import { DiagnosticAuthority, DiagnosticCategory, DiagnosticCode, DiagnosticLocation, DiagnosticTemplate } from "@noldova/context.diagnostics";
19
+
20
+ const code = new DiagnosticCode(DiagnosticAuthority.typeScript, 2304);
21
+ const template = new DiagnosticTemplate(code, DiagnosticCategory.Error, "Cannot find name '{0}'.");
22
+
23
+ const diagnostic = template.create(new DiagnosticLocation("example.ts", 12, 5), ["value"]);
24
+ diagnostic.code.displayText; // "TS2304"
25
+ diagnostic.message.text; // "Cannot find name 'value'."
26
+ diagnostic.location?.start; // 12
27
+ ```
28
+
29
+ Locations are UTF-16 offsets and lengths in a source. The declaration file
30
+ `api/index.d.ts` documents every member with its contract and examples.
31
+
32
+ ## License
33
+
34
+ MIT; see `LICENSE`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noldova/context.diagnostics",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "main": "api/index.js",
6
6
  "types": "api/index.d.ts",
@@ -19,7 +19,8 @@
19
19
  "registry": "https://registry.npmjs.org/"
20
20
  },
21
21
  "dependencies": {
22
- "@noldova/context.core": "0.0.2",
23
- "@noldova/context.exceptions": "0.0.2"
24
- }
22
+ "@noldova/context.core": "0.0.4",
23
+ "@noldova/context.exceptions": "0.0.4"
24
+ },
25
+ "gitHead": "15e2532ec1c46998b0403aeb8c009bd903b15362"
25
26
  }