deltafold 0.0.0 → 0.1.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.
Files changed (57) hide show
  1. package/README.md +278 -4
  2. package/dist/changelog.d.ts +116 -0
  3. package/dist/changelog.d.ts.map +1 -0
  4. package/dist/changelog.js +304 -0
  5. package/dist/changelog.js.map +1 -0
  6. package/dist/document-BZcZo9nr.js +171 -0
  7. package/dist/document-BZcZo9nr.js.map +1 -0
  8. package/dist/document-DWHsgywm.d.ts +257 -0
  9. package/dist/document-DWHsgywm.d.ts.map +1 -0
  10. package/dist/html.d.ts +8 -0
  11. package/dist/html.d.ts.map +1 -0
  12. package/dist/html.js +13 -0
  13. package/dist/html.js.map +1 -0
  14. package/dist/index.d.ts +517 -1
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +2126 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/markdown.d.ts +8 -0
  19. package/dist/markdown.d.ts.map +1 -0
  20. package/dist/markdown.js +16 -0
  21. package/dist/markdown.js.map +1 -0
  22. package/dist/mdast-DiRsYwPU.js +108 -0
  23. package/dist/mdast-DiRsYwPU.js.map +1 -0
  24. package/dist/package-BfBYnaCz.d.ts +1125 -0
  25. package/dist/package-BfBYnaCz.d.ts.map +1 -0
  26. package/dist/rolldown-runtime-D8jQpDG7.js +12 -0
  27. package/package.json +13 -1
  28. package/src/features/documents/changelog.ts +450 -0
  29. package/src/features/documents/document.ts +357 -0
  30. package/src/features/documents/index.ts +4 -0
  31. package/src/features/documents/public-document.ts +31 -0
  32. package/src/features/documents/sections.ts +44 -0
  33. package/src/features/execution/executor.ts +968 -0
  34. package/src/features/execution/handler.ts +485 -0
  35. package/src/features/execution/settlement.ts +52 -0
  36. package/src/features/package.ts +32 -0
  37. package/src/features/planning/guide.ts +56 -0
  38. package/src/features/planning/history.ts +174 -0
  39. package/src/features/planning/identifiers.ts +43 -0
  40. package/src/features/planning/resolve-error.ts +201 -0
  41. package/src/features/planning/resolve.ts +724 -0
  42. package/src/features/planning/rewrite.ts +331 -0
  43. package/src/features/planning/validate.ts +388 -0
  44. package/src/foundation/action.ts +188 -0
  45. package/src/foundation/change.ts +147 -0
  46. package/src/foundation/instruction.ts +110 -0
  47. package/src/foundation/migration.ts +236 -0
  48. package/src/foundation/plan.ts +245 -0
  49. package/src/foundation/rule.ts +74 -0
  50. package/src/foundation/shortcut.ts +79 -0
  51. package/src/foundation/template.ts +28 -0
  52. package/src/foundation/version.ts +78 -0
  53. package/src/index.ts +22 -11
  54. package/src/renderers/html.ts +12 -0
  55. package/src/renderers/markdown.ts +12 -0
  56. package/src/renderers/mdast.ts +120 -0
  57. package/src/types.ts +2 -0
@@ -0,0 +1,257 @@
1
+ import { f as Version, t as Package } from "./package-BfBYnaCz.js";
2
+ import { Pipeable } from "effect";
3
+ /** @since @next */
4
+ type Text = {
5
+ readonly _tag: "Text";
6
+ readonly value: string;
7
+ };
8
+ /** @since @next */
9
+ type Code = {
10
+ readonly _tag: "Code";
11
+ readonly value: string;
12
+ };
13
+ /** @since @next */
14
+ type Link = {
15
+ readonly _tag: "Link";
16
+ readonly url: string;
17
+ readonly children: ReadonlyArray<Inline>;
18
+ };
19
+ /** @since @next */
20
+ type Strong = {
21
+ readonly _tag: "Strong";
22
+ readonly children: ReadonlyArray<Inline>;
23
+ };
24
+ /** @since @next */
25
+ type Emphasis = {
26
+ readonly _tag: "Emphasis";
27
+ readonly children: ReadonlyArray<Inline>;
28
+ };
29
+ /**
30
+ * Phrasing content.
31
+ *
32
+ * @since @next
33
+ */
34
+ type Inline = Text | Code | Link | Strong | Emphasis;
35
+ /** @since @next */
36
+ type Paragraph = {
37
+ readonly _tag: "Paragraph";
38
+ readonly children: ReadonlyArray<Inline>;
39
+ };
40
+ /** @since @next */
41
+ type List = {
42
+ readonly _tag: "List";
43
+ readonly ordered: boolean;
44
+ /** One entry per item. */
45
+ readonly items: ReadonlyArray<ReadonlyArray<Block>>;
46
+ };
47
+ /** @since @next */
48
+ type CodeBlock = {
49
+ readonly _tag: "CodeBlock";
50
+ readonly value: string;
51
+ readonly lang: string | undefined;
52
+ };
53
+ /** @since @next */
54
+ type Title = Pipeable.Pipeable & {
55
+ readonly _tag: "Title";
56
+ readonly children: ReadonlyArray<Inline>;
57
+ /** An absolute heading level. Absent means the level follows section nesting. */
58
+ readonly level: number | undefined;
59
+ };
60
+ /**
61
+ * A titled part of a document. Its `id` must be unique within the containing release,
62
+ * or within the document outside releases.
63
+ *
64
+ * @since @next
65
+ */
66
+ type Section = Pipeable.Pipeable & {
67
+ readonly _tag: "Section";
68
+ readonly id: string;
69
+ readonly title: Title | undefined;
70
+ /** Content inserted before the title. */
71
+ readonly before: ReadonlyArray<Block>;
72
+ /** Content inserted after the title, before the body. */
73
+ readonly after: ReadonlyArray<Block>;
74
+ readonly children: ReadonlyArray<Block>;
75
+ /** Set on a release section, which scopes the identifiers of its sections. */
76
+ readonly release: Version | undefined;
77
+ };
78
+ /** @since @next */
79
+ type Block = Paragraph | List | CodeBlock | Section;
80
+ /**
81
+ * A complete document returned by changelog builders.
82
+ *
83
+ * @since @next
84
+ */
85
+ type Document = {
86
+ readonly _tag: "Document";
87
+ readonly kind: "change" | "release" | "history" | "upgrade" | "downgrade";
88
+ readonly children: ReadonlyArray<Block>;
89
+ };
90
+ /**
91
+ * Text, or inline nodes.
92
+ *
93
+ * @since @next
94
+ */
95
+ type InlineInput = string | Inline | ReadonlyArray<string | Inline>;
96
+ /** @since @next */
97
+ declare const Text: (value: string) => Text;
98
+ /** @since @next */
99
+ declare const Code: (value: string) => Code;
100
+ /** @since @next */
101
+ declare const Link: (text: InlineInput, url: string) => Link;
102
+ /** @since @next */
103
+ declare const Strong: (children: InlineInput) => Strong;
104
+ /** @since @next */
105
+ declare const Emphasis: (children: InlineInput) => Emphasis;
106
+ /** @since @next */
107
+ declare const Paragraph: (children: InlineInput) => Paragraph;
108
+ /** @since @next */
109
+ declare const CodeBlock: (value: string, options?: {
110
+ readonly lang?: string;
111
+ }) => CodeBlock;
112
+ /**
113
+ * Builds a list. Each item is text, an inline node, a block, or several blocks.
114
+ *
115
+ * @since @next
116
+ */
117
+ declare const List: (items: ReadonlyArray<string | Inline | Block | ReadonlyArray<Block>>, options?: {
118
+ readonly ordered?: boolean;
119
+ }) => List;
120
+ /**
121
+ * An insertion point inside a plugin's scope.
122
+ *
123
+ * @since @next
124
+ */
125
+ type Anchor = {
126
+ readonly _tag: "Anchor";
127
+ readonly part: "title" | "body";
128
+ readonly position: "pre" | "post";
129
+ };
130
+ declare const makeTitle: (text: InlineInput, options?: {
131
+ readonly level?: number;
132
+ }) => Title;
133
+ /**
134
+ * Builds a title. `Document.Title.pre` and `Document.Title.post` are the insertion points
135
+ * around a scoped section's title.
136
+ *
137
+ * @since @next
138
+ */
139
+ declare const Title: typeof makeTitle & {
140
+ pre: Anchor;
141
+ post: Anchor;
142
+ };
143
+ /**
144
+ * The insertion points around a scoped section's body.
145
+ *
146
+ * @since @next
147
+ */
148
+ declare const Body: {
149
+ readonly pre: Anchor;
150
+ readonly post: Anchor;
151
+ };
152
+ /** @since @next */
153
+ declare const Section: (id: string, options?: SectionOptions) => Section;
154
+ type SectionOptions = {
155
+ readonly title?: Title | string;
156
+ readonly children?: ReadonlyArray<Block>;
157
+ };
158
+ /**
159
+ * Sets an absolute heading level on a title. Levels outside 1 to 6 fail at render time.
160
+ *
161
+ * @since @next
162
+ */
163
+ declare const withLevel: (level: number) => (title: Title) => Title;
164
+ /**
165
+ * Sets the title of a section.
166
+ *
167
+ * @since @next
168
+ */
169
+ declare const withTitle: (title: Title | string) => (section: Section) => Section;
170
+ /**
171
+ * Appends blocks to a section's body.
172
+ *
173
+ * @since @next
174
+ */
175
+ declare const append: (...blocks: ReadonlyArray<Block>) => (section: Section) => Section;
176
+ declare const DocumentError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
177
+ readonly _tag: "DocumentError";
178
+ } & Readonly<A>;
179
+ /**
180
+ * A document structure that cannot be rendered.
181
+ *
182
+ * @since @next
183
+ */
184
+ declare class DocumentError extends DocumentError_base<{
185
+ readonly reason: "duplicate-section" | "heading-level" | "reserved-id";
186
+ readonly message: string;
187
+ }> {}
188
+ /**
189
+ * Release-scoped plugins run once per included release.
190
+ *
191
+ * @since @next
192
+ */
193
+ declare const Release = "release";
194
+ /**
195
+ * History-scoped plugins run once per history document.
196
+ *
197
+ * @since @next
198
+ */
199
+ declare const History = "history";
200
+ /** @since @next */
201
+ type ReleaseContext<M> = {
202
+ readonly package: Package;
203
+ readonly version: Version;
204
+ readonly metadata: M;
205
+ };
206
+ /** @since @next */
207
+ type HistoryContext<M> = {
208
+ readonly package: Package;
209
+ readonly releases: ReadonlyArray<ReleaseContext<M>>;
210
+ };
211
+ /**
212
+ * Plugin output: blocks to insert, or `null` for nothing.
213
+ *
214
+ * @since @next
215
+ */
216
+ type PluginOutput = Block | ReadonlyArray<Block> | null;
217
+ /**
218
+ * Where a plugin's content goes. `scope` is `Document.Release`, once per included
219
+ * release, or `Document.History`, once per history document. `at` is
220
+ * `Document.Title.pre`, `Document.Title.post`, `Document.Body.pre`, or
221
+ * `Document.Body.post` of that scope's section. Each insertion point receives every
222
+ * plugin's content in configuration order.
223
+ *
224
+ * @since @next
225
+ */
226
+ type PluginOptions<M> = {
227
+ readonly scope: typeof Release;
228
+ readonly at: Anchor;
229
+ readonly resolve: (context: ReleaseContext<M>) => PluginOutput;
230
+ } | {
231
+ readonly scope: typeof History;
232
+ readonly at: Anchor;
233
+ readonly resolve: (context: HistoryContext<M>) => PluginOutput;
234
+ };
235
+ /**
236
+ * Contributes content at an insertion point. Plugins work on format-neutral content:
237
+ * they must not fetch metadata or execute migrations. Output is inserted once and is not
238
+ * processed by other plugins.
239
+ *
240
+ * @since @next
241
+ */
242
+ type Plugin<M> = {
243
+ readonly _tag: "Plugin";
244
+ readonly id: string;
245
+ } & PluginOptions<M>;
246
+ /** @since @next */
247
+ declare const makePlugin: <M>(id: string, options: PluginOptions<M>) => Plugin<M>;
248
+ /**
249
+ * `Document.Plugin.make`
250
+ *
251
+ * @since @next
252
+ */
253
+ declare const Plugin: {
254
+ readonly make: typeof makePlugin;
255
+ };
256
+ export { Text as C, withTitle as D, withLevel as E, Strong as S, append as T, PluginOptions as _, CodeBlock as a, ReleaseContext as b, Emphasis as c, Inline as d, InlineInput as f, Plugin as g, Paragraph as h, Code as i, History as l, List as m, Block as n, Document as o, Link as p, Body as r, DocumentError as s, Anchor as t, HistoryContext as u, PluginOutput as v, Title as w, Section as x, Release as y };
257
+ //# sourceMappingURL=document-DWHsgywm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-DWHsgywm.d.ts","names":[],"sources":["../src/features/documents/document.ts"],"mappings":";;;KAMY;WAAkB;WAAuB;;;KAEzC;WAAkB;WAAuB;;;KAEzC;WACF;WACA;WACA,UAAU,cAAc;;;KAGtB;WAAoB;WAAyB,UAAU,cAAc;;;KAErE;WAAsB;WAA2B,UAAU,cAAc;;;;;;;KAOzE,SAAS,OAAO,OAAO,OAAO,SAAS;;KAGvC;WAAuB;WAA4B,UAAU,cAAc;;;KAE3E;WACF;WACA;;WAEA,OAAO,cAAc,cAAc;;;KAGjC;WACF;WACA;WACA;;;KAIE,QAAQ,SAAS;WACnB;WACA,UAAU,cAAc;;WAExB;;;;;;;;KASE,UAAU,SAAS;WACrB;WACA;WACA,OAAO;;WAEP,QAAQ,cAAc;;WAEtB,OAAO,cAAc;WACrB,UAAU,cAAc;;WAExB,SAAS;;;KAIP,QAAQ,YAAY,OAAO,YAAY;;;;;;KAOvC;WACF;WACA;WACA,UAAU,cAAc;;;;;;;KAQtB,uBAAuB,SAAS,uBAAuB;;cAuBtD,OAAI,kBAAoB;;cAExB,OAAI,kBAAoB;;cAExB,OAAI,MAAU,aAAW,gBAAgB;;cAMzC,SAAM,UAAc,gBAAc;;cAKlC,WAAQ,UAAc,gBAAc;;cAKpC,YAAS,UAAc,gBAAc;;cAKrC,YAAS,eAAiB;WAAsB;MAAuB;;;;;;cAWvE,OAAI,OACT,uBAAuB,SAAS,QAAQ,cAAc,SAAO;WAChD;MAClB;;;;;;KAgBS;WACF;WACA;WACA;;cAcJ,YAAS,MAAU,aAAW;WAAsB;MAAwB;;;;;;;cASrE,cAAK;;;;;;;;;cAUL;WAAS,KAAG;WAAyB,MAAI;;;cAMzC,UAAO,YAAc,UAAW,mBAAsB;KAW9D;WACK,QAAQ;WACR,WAAW,cAAc;;;;;;;cAsBtB,YAAS,mBACP,OACN,UAAQ;;;;;;cAQJ,YAAS,OACb,oBAAc,SACZ,YAAU;;;;;;cAQR,YAAM,QACN,cAAc,YAAM,SACtB,YAAU;;;;;;;;;cAQR,sBAAsB;WACzB;WACA;;;;;;;cAUG;;;;;;cAMA;;KAGD,eAAe;WACjB,SAAS;WACT,SAAS;WACT,UAAU;;;KAIR,eAAe;WACjB,SAAS;WACT,UAAU,cAAc,eAAe;;;;;;;KAQrC,eAAe,QAAQ,cAAc;;;;;;;;;;KAWrC,cAAc;WAEd,cAAc;WACd,IAAI;WACJ,UAAU,SAAS,eAAe,OAAO;;WAGzC,cAAc;WACd,IAAI;WACJ,UAAU,SAAS,eAAe,OAAO;;;;;;;;;KAUzC,OAAO;WAAgB;WAAyB;IAAe,cAAc;;cAG5E,aAAc,GAAC,YAAY,SAAW,cAAc,OAAK,OAAO;;;;;;cAWhE;WAAW,aAAI"}
package/dist/html.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { o as Document } from "./document-DWHsgywm.js";
2
+ /**
3
+ * Renders a document as an HTML fragment. Throws `DocumentError` for unsupported structure.
4
+ *
5
+ * @since @next
6
+ */
7
+ export declare const render: (document: Document) => string;
8
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","names":[],"sources":["../src/renderers/html.ts"],"mappings":";;;;;;qBAWa,SAAM,UAAc"}
package/dist/html.js ADDED
@@ -0,0 +1,13 @@
1
+ import { t as toMdast } from "./mdast-DiRsYwPU.js";
2
+ import { toHtml } from "hast-util-to-html";
3
+ import { toHast } from "mdast-util-to-hast";
4
+ // src/renderers/html.ts
5
+ /**
6
+ * Renders a document as an HTML fragment. Throws `DocumentError` for unsupported structure.
7
+ *
8
+ * @since @next
9
+ */
10
+ const render = (document) => toHtml(toHast(toMdast(document)));
11
+ export { render };
12
+
13
+ //# sourceMappingURL=html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.js","names":[],"sources":["../src/renderers/html.ts"],"sourcesContent":["import { toHtml } from \"hast-util-to-html\";\nimport { toHast } from \"mdast-util-to-hast\";\n\nimport type { Document } from \"../features/documents/document.ts\";\nimport { toMdast } from \"./mdast.ts\";\n\n/**\n * Renders a document as an HTML fragment. Throws `DocumentError` for unsupported structure.\n *\n * @since @next\n */\nexport const render = (document: Document): string => toHtml(toHast(toMdast(document)));\n"],"mappings":";;;;;;;;;AAWA,MAAa,UAAU,aAA+B,OAAO,OAAO,QAAQ,QAAQ,CAAC,CAAC"}