@stxt-lang/core 0.7.0 → 0.7.1

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
@@ -7,6 +7,7 @@ STXT is a plain-text format for writing structured, semantic documents: no brace
7
7
  - Website and language reference: <https://stxt.dev>
8
8
  - VSCode extension: [STXT - Semantic Text](https://marketplace.visualstudio.com/items?itemName=stxt-lang.stxt)
9
9
  - Java implementation: [`dev.stxt:stxt-core`](https://central.sonatype.com/artifact/dev.stxt/stxt-core) on Maven Central
10
+ - Python implementation: [`stxt`](https://pypi.org/project/stxt/) on PyPI
10
11
 
11
12
  ## What STXT looks like
12
13
 
@@ -149,7 +150,7 @@ for (const error of result.getErrors()) {
149
150
  }
150
151
  ```
151
152
 
152
- Available value types: `INLINE`, `BLOCK`, `TEXT`, `BOOLEAN`, `INTEGER`, `NATURAL`, `NUMBER`, `DATE`, `TIMESTAMP`, `EMAIL`, `URL`, `HEXADECIMAL`, `BASE64`, `GROUP`, `ENUM`.
153
+ Available value types: `INLINE`, `BLOCK`, `TEXT`, `MARKDOWN`, `BOOLEAN`, `INTEGER`, `NATURAL`, `NUMBER`, `DATE`, `TIME`, `TIMESTAMP`, `UUID`, `EMAIL`, `URL`, `HEXADECIMAL`, `BINARY`, `BASE64`, `GROUP`, `ENUM`.
153
154
 
154
155
  ## Finding the schemas: discovery
155
156
 
@@ -1,2 +1,8 @@
1
- /** `EMAIL` type: checks that the value looks like an e-mail address. */
1
+ /**
2
+ * `EMAIL` type: checks that the value is an e-mail address, in either of the two forms of
3
+ * STXT-SCHEMA-SPEC 9.4: the bare address (`user@domain.tld`) or a display name followed by the
4
+ * address between angle brackets (`Joan Costa <joan@example.com>`). The display name is any
5
+ * non-empty text without `<` or `>` (quotes are not interpreted) and the space before `<` is
6
+ * optional; `<`/`>` without a name, unbalanced or followed by anything are rejected.
7
+ */
2
8
  export declare const EMAIL: import("../Type").Type;
@@ -2,6 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EMAIL = void 0;
4
4
  const regexType_1 = require("./regexType");
5
- /** `EMAIL` type: checks that the value looks like an e-mail address. */
6
- exports.EMAIL = (0, regexType_1.regexType)("EMAIL", /^(?=.{1,256}$)(?=.{1,64}@.{1,255}$)(?=.{1,64}@.{1,63}\..{1,63}$)[A-Za-z0-9!#$%&'*+/=?^_`{|}~.-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/, "Invalid email");
5
+ /**
6
+ * The address proper, `local@domain` with the usual length limits, as it reads when it ends the
7
+ * value (bare form)...
8
+ */
9
+ const ADDRESS = "(?=.{1,256}$)(?=.{1,64}@.{1,255}$)(?=.{1,64}@.{1,63}\\..{1,63}$)"
10
+ + "[A-Za-z0-9!#$%&'*+/=?^_`{|}~.-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}";
11
+ /** ...and the same address as it reads between `<` and `>` (the lookaheads stop at the `>`). */
12
+ const BRACKETED = "(?=[^>]{1,256}>$)(?=[^>]{1,64}@[^>]{1,255}>$)(?=[^>]{1,64}@[^>]{1,63}\\.[^>]{1,63}>$)"
13
+ + "[A-Za-z0-9!#$%&'*+/=?^_`{|}~.-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}";
14
+ /**
15
+ * `EMAIL` type: checks that the value is an e-mail address, in either of the two forms of
16
+ * STXT-SCHEMA-SPEC 9.4: the bare address (`user@domain.tld`) or a display name followed by the
17
+ * address between angle brackets (`Joan Costa <joan@example.com>`). The display name is any
18
+ * non-empty text without `<` or `>` (quotes are not interpreted) and the space before `<` is
19
+ * optional; `<`/`>` without a name, unbalanced or followed by anything are rejected.
20
+ */
21
+ exports.EMAIL = (0, regexType_1.regexType)("EMAIL", new RegExp(`^(?:[^<>]*[^<>\\s]\\s*<${BRACKETED}>|${ADDRESS})$`), "Invalid email");
7
22
  //# sourceMappingURL=EMAIL.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stxt-lang/core",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Parser and schema validator for STXT, an indentation-based structured-text format.",
5
5
  "main": "out/all.js",
6
6
  "types": "out/all.d.ts",