@effected/templates 0.9.0 → 0.10.0

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/CommentStyle.js CHANGED
@@ -23,8 +23,7 @@ const Delimiter = Schema.String.check(Schema.isPattern(/^\P{Cc}+$/u));
23
23
  * @remarks
24
24
  * A **line** style carries only a `prefix` (`#`, `//`); a **wrapped** style
25
25
  * carries a `suffix` as well (`<!--` … `-->`). The wrapped form is what makes
26
- * managed sections representable in Markdown, HTML and XML, which the two-way
27
- * literal union this replaces could not express.
26
+ * managed sections representable in Markdown, HTML and XML.
28
27
  *
29
28
  * The preset set is a convenience, not a closed world: a format nobody
30
29
  * anticipated is one `CommentStyle.make({ prefix: "%" })` away.
@@ -54,7 +53,7 @@ var CommentStyle = class CommentStyle extends Schema.Class("CommentStyle")({
54
53
  static semicolon = CommentStyle.make({ prefix: ";" });
55
54
  /** SQL, Lua, Haskell. */
56
55
  static dash = CommentStyle.make({ prefix: "--" });
57
- /** Markdown, HTML, XML — the wrapped style v3 could not represent. */
56
+ /** Markdown, HTML, XML — a wrapped style. */
58
57
  static html = CommentStyle.make({
59
58
  prefix: "<!--",
60
59
  suffix: "-->"
@@ -88,8 +87,8 @@ var CommentStyle = class CommentStyle extends Schema.Class("CommentStyle")({
88
87
  * The `NUL` separator is not cosmetic: without it `{ prefix: "ab" }`
89
88
  * and `{ prefix: "a", suffix: "b" }` would produce the same id and two
90
89
  * genuinely different styles would collide in a lookup table. `NUL`
91
- * cannot occur in a delimiter, which the single-line check guarantees is
92
- * printable-ish, so the encoding is unambiguous.
90
+ * cannot occur in a delimiter, because delimiters exclude control characters,
91
+ * so the encoding is unambiguous.
93
92
  */
94
93
  get id() {
95
94
  return `${this.prefix}\u0000${this.suffix ?? ""}`;
package/ManagedSection.js CHANGED
@@ -40,9 +40,7 @@ const notFound = (error) => error.reason._tag === "NotFound";
40
40
  * BOM-carrying file silently delete the BOM, which violates this package's
41
41
  * central promise that every byte outside a managed span survives. Reading
42
42
  * bytes and decoding with `ignoreBOM: true` keeps the mark in the leading
43
- * text span, where it is preserved like any other content — pinned by
44
- * `__test__/integration/ManagedSection.int.test.ts`'s "preserves a
45
- * byte-order mark through a sync".
43
+ * text span, where it is preserved like any other content.
46
44
  */
47
45
  const decoder = new TextDecoder("utf-8", { ignoreBOM: true });
48
46
  const make = (options = {}) => Effect.gen(function* () {
package/README.md CHANGED
@@ -7,10 +7,10 @@
7
7
 
8
8
  Managed sections: delimited `BEGIN`/`END` blocks inside files whose surrounding content belongs to the user. A tool owns the block, the user owns everything else, and neither destroys the other — the mechanism behind a generated hook, a managed config fragment, or any file your tool and your user both need to edit.
9
9
 
10
- > **Pre-release.** This package is part of the `@effected/*` kit, in pre-`1.0.0`
11
- > development against a single pinned Effect v4 prerelease. Packages graduate to
12
- > `1.0.0` once Effect `4.0.0` ships. To hold your own `effect` versions at
13
- > exactly the ones the kit is built and tested against, install
10
+ > **Pre-`1.0.0`.** This package is part of the `@effected/*` kit, built on stable
11
+ > Effect v4 (`effect` `^4.0.0`) and still in `0.x` development. Stable Effect
12
+ > makes a kit `1.0.0` possible, not automatic. To keep your `effect` and
13
+ > `@effect/*` versions on the line the kit is built and tested against, install
14
14
  > [`@effected/pnpm-plugin-effect`](https://www.npmjs.com/package/@effected/pnpm-plugin-effect).
15
15
  >
16
16
  > **Stability: unstable.** This package's API surface is not yet considered
package/Section.js CHANGED
@@ -22,7 +22,7 @@ import { Effect, Schema } from "effect";
22
22
  *
23
23
  * @public
24
24
  */
25
- const SectionKey = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]*$/));
25
+ const SectionKey = Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u));
26
26
  /**
27
27
  * What identifies a managed section inside a document: its key and the
28
28
  * comment style its markers are written in.
@@ -74,10 +74,8 @@ var SectionId = class extends Schema.Class("SectionId")({
74
74
  * markers.
75
75
  *
76
76
  * @remarks
77
- * Equality is **structural and whitespace-significant**. The v3 model this
78
- * replaces compared trimmed, whitespace-collapsed content, which silently
79
- * swallowed any template change that altered only indentation — the change
80
- * compared equal, reported `Unchanged`, and never reached the file. The one
77
+ * Equality is **structural and whitespace-significant**: a template change that
78
+ * alters only indentation is a real change and reaches the file. The one
81
79
  * normalization this package applies is to line endings, and it happens at
82
80
  * parse time rather than inside equality, so `Equal.equals` stays honest for
83
81
  * a consumer comparing two sections directly.
package/SectionDialect.js CHANGED
@@ -56,9 +56,7 @@ const escapeRegex = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
56
56
  const GAP = "[ \\t]+";
57
57
  /**
58
58
  * Compiled matchers are cached per dialect instance. A `WeakMap` rather than
59
- * a field keeps `SectionDialect` a pure schema class — v3 hung a non-schema
60
- * private field off its definition class and had to hand-copy it on every
61
- * derivation.
59
+ * a field keeps `SectionDialect` a pure schema class.
62
60
  */
63
61
  const matcherCache = /* @__PURE__ */ new WeakMap();
64
62
  /**
@@ -86,7 +84,7 @@ var SectionDialect = class SectionDialect extends Schema.Class("SectionDialect")
86
84
  * phrase can never contain the `---` rule and make a marker ambiguous
87
85
  * against itself.
88
86
  */
89
- phrase: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9 _]*$/)),
87
+ phrase: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9][A-Za-z0-9 _]*$/u)),
90
88
  /** Which comment styles the document scanner recognizes. At least one. */
91
89
  styles: Schema.Array(CommentStyle).check(Schema.isMinLength(1))
92
90
  }) {
package/index.d.ts CHANGED
@@ -12,8 +12,7 @@ declare const CommentStyle_base: Schema.Class<CommentStyle, Schema.Struct<{
12
12
  * @remarks
13
13
  * A **line** style carries only a `prefix` (`#`, `//`); a **wrapped** style
14
14
  * carries a `suffix` as well (`<!--` … `-->`). The wrapped form is what makes
15
- * managed sections representable in Markdown, HTML and XML, which the two-way
16
- * literal union this replaces could not express.
15
+ * managed sections representable in Markdown, HTML and XML.
17
16
  *
18
17
  * The preset set is a convenience, not a closed world: a format nobody
19
18
  * anticipated is one `CommentStyle.make({ prefix: "%" })` away.
@@ -38,7 +37,7 @@ export declare class CommentStyle extends CommentStyle_base {
38
37
  static readonly semicolon: CommentStyle;
39
38
  /** SQL, Lua, Haskell. */
40
39
  static readonly dash: CommentStyle;
41
- /** Markdown, HTML, XML — the wrapped style v3 could not represent. */
40
+ /** Markdown, HTML, XML — a wrapped style. */
42
41
  static readonly html: CommentStyle;
43
42
  /** CSS, and the block form of every C-family language. */
44
43
  static readonly block: CommentStyle;
@@ -59,8 +58,8 @@ export declare class CommentStyle extends CommentStyle_base {
59
58
  * The `NUL` separator is not cosmetic: without it `{ prefix: "ab" }`
60
59
  * and `{ prefix: "a", suffix: "b" }` would produce the same id and two
61
60
  * genuinely different styles would collide in a lookup table. `NUL`
62
- * cannot occur in a delimiter, which the single-line check guarantees is
63
- * printable-ish, so the encoding is unambiguous.
61
+ * cannot occur in a delimiter, because delimiters exclude control characters,
62
+ * so the encoding is unambiguous.
64
63
  */
65
64
  get id(): string;
66
65
  /** True when the style wraps its content, i.e. it carries a suffix. */
@@ -144,10 +143,8 @@ declare const Section_base: Schema.Class<Section, Schema.Struct<{
144
143
  * markers.
145
144
  *
146
145
  * @remarks
147
- * Equality is **structural and whitespace-significant**. The v3 model this
148
- * replaces compared trimmed, whitespace-collapsed content, which silently
149
- * swallowed any template change that altered only indentation — the change
150
- * compared equal, reported `Unchanged`, and never reached the file. The one
146
+ * Equality is **structural and whitespace-significant**: a template change that
147
+ * alters only indentation is a real change and reaches the file. The one
151
148
  * normalization this package applies is to line endings, and it happens at
152
149
  * parse time rather than inside equality, so `Equal.equals` stays honest for
153
150
  * a consumer comparing two sections directly.
@@ -319,11 +316,8 @@ export declare class SectionDialect extends SectionDialect_base {
319
316
  * What a sync did to one declared section.
320
317
  *
321
318
  * @remarks
322
- * `Updated` carries **both sides** rather than a diff. The model this replaces
323
- * computed a set difference over lines, which deduplicated, ignored order, and
324
- * reported a pure line reordering as no change at all — a diff that could say
325
- * "nothing changed" about changed content. Every consumer of that model read
326
- * only the tag, so the honest primitive is the pair; a caller wanting a
319
+ * `Updated` carries **both sides** rather than a diff, so a pure line
320
+ * reordering is never reported as "nothing changed". A caller wanting a
327
321
  * rendering diffs `before.content` against `after.content` with the diff
328
322
  * library of its choice.
329
323
  *
@@ -438,10 +432,8 @@ export declare const SyncOutcome: {
438
432
  * What a check found, without touching the document.
439
433
  *
440
434
  * @remarks
441
- * Three flat variants rather than the `Found({ isUpToDate, diff })` +
442
- * `NotFound` pair they replace: a boolean beside a diff that already encodes
443
- * the same fact is two sources of truth for one question, and it forces every
444
- * caller through a nested branch.
435
+ * Three flat variants (`Absent`, `UpToDate`, `Drifted`), so every caller
436
+ * branches once on one tag instead of through a nested check.
445
437
  *
446
438
  * @public
447
439
  */
@@ -729,11 +721,9 @@ export declare class SectionFileError extends SectionFileError_base {
729
721
  * the service class, and so the surface is a reviewable declaration rather
730
722
  * than whatever the implementation happened to return.
731
723
  *
732
- * Every member is **data-first**: the path comes first and nothing is dual.
733
- * The model this replaces made all seven members dual, which doubled the
734
- * declared surface for a data-last form no call site used — and a dual member
735
- * cannot be stubbed with a one-line override in {@link ManagedSection.layerTest},
736
- * because the override has to satisfy both overloads.
724
+ * Every member is **data-first**: the path comes first and nothing is dual,
725
+ * so a member can be stubbed with a one-line override in
726
+ * {@link ManagedSection.layerTest}.
737
727
  *
738
728
  * @public
739
729
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effected/templates",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "private": false,
5
5
  "description": "Managed-section blocks in user-editable files: parse, reconcile, sync and check delimited regions.",
6
6
  "keywords": [
@@ -37,7 +37,7 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "peerDependencies": {
40
- "effect": "4.0.0-rc.118"
40
+ "effect": "^4.0.0"
41
41
  },
42
42
  "engines": {
43
43
  "node": ">=24.11.0"