@loomcli/core 0.6.0 → 0.8.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 (52) hide show
  1. package/NOTICE +34 -0
  2. package/dist/application.d.ts +11 -6
  3. package/dist/application.js +57 -19
  4. package/dist/capture.d.ts +65 -0
  5. package/dist/capture.js +99 -0
  6. package/dist/chain.d.ts +28 -17
  7. package/dist/chain.js +11 -10
  8. package/dist/command-rules.d.ts +1 -1
  9. package/dist/command-rules.js +2 -2
  10. package/dist/command.d.ts +31 -47
  11. package/dist/command.js +204 -209
  12. package/dist/errors.d.ts +22 -21
  13. package/dist/errors.js +38 -18
  14. package/dist/facts.d.ts +5 -0
  15. package/dist/facts.js +8 -1
  16. package/dist/globals.d.ts +48 -22
  17. package/dist/globals.js +72 -29
  18. package/dist/glyphs.generated.js +1 -1
  19. package/dist/index.d.ts +5 -3
  20. package/dist/index.js +3 -1
  21. package/dist/input-rules.d.ts +20 -2
  22. package/dist/input-rules.js +47 -5
  23. package/dist/inspect.d.ts +33 -17
  24. package/dist/inspect.js +74 -87
  25. package/dist/locate.js +52 -60
  26. package/dist/options.d.ts +101 -83
  27. package/dist/options.js +311 -267
  28. package/dist/parse.d.ts +162 -0
  29. package/dist/parse.js +601 -0
  30. package/dist/plain.d.ts +52 -2
  31. package/dist/plain.js +228 -2
  32. package/dist/plugin-rules.d.ts +8 -4
  33. package/dist/plugin-rules.js +13 -9
  34. package/dist/plugin-settings.d.ts +18 -0
  35. package/dist/plugin-settings.js +38 -0
  36. package/dist/plugin.d.ts +32 -27
  37. package/dist/plugin.js +107 -89
  38. package/dist/sources.d.ts +18 -9
  39. package/dist/sources.js +50 -20
  40. package/dist/style-layout.js +2 -2
  41. package/dist/style-width.d.ts +13 -0
  42. package/dist/style-width.js +170 -0
  43. package/dist/types.d.ts +70 -30
  44. package/dist/unicode.generated.d.ts +27 -0
  45. package/dist/unicode.generated.js +1036 -0
  46. package/dist/validation.d.ts +108 -34
  47. package/dist/validation.js +282 -125
  48. package/dist/view.d.ts +16 -11
  49. package/dist/view.js +13 -4
  50. package/licenses/unicode-LICENSE.txt +41 -0
  51. package/licenses/uucode-LICENSE.md +35 -0
  52. package/package.json +9 -5
package/dist/view.d.ts CHANGED
@@ -56,7 +56,7 @@ interface FailureViewContext extends ViewContext {
56
56
  interface FailureView<Failure extends LoomError> {
57
57
  render: (failure: Readonly<Failure>, context: FailureViewContext) => string;
58
58
  /** A failure view has one shape, as a view does. */
59
- row?: never;
59
+ row?: undefined;
60
60
  }
61
61
  /**
62
62
  * One stored view function, with the data type and the context erased. A registry holds one entry
@@ -125,17 +125,22 @@ declare class OverrideDeclaration {
125
125
  type ViewOverride = Pick<OverrideDeclaration, typeof viewOverride>;
126
126
  /** What a plugin's own list holds: the views it declares and the overrides it makes. */
127
127
  type ViewContribution = AnyDeclaredView | ViewOverride;
128
+ /** Every value an override can key on: a declared view of either shape or a failure class. */
129
+ type AnyOverrideKey = AnyDeclaredView | FailureClass<LoomError>;
128
130
  /**
129
- * One override pairing a key with a replacement view. Under a declared view the replacement is
130
- * typed from the view's data; under a failure class it is typed from the class's instances, which
131
- * is the typed path for a class-keyed list, because an array literal cannot carry a different type
132
- * parameter per element.
131
+ * The replacement view one key takes, derived from the key alone. The declared-view branches come
132
+ * first, so a declared view is never read as a failure class. Each check is wrapped in a tuple so a
133
+ * union key is not split into a union of replacements that each answer only one of its members.
133
134
  */
134
- declare function override<Data>(key: DeclaredView<Data>, replacement: NoInfer<View<Data>>): ViewOverride;
135
- declare function override<Row>(key: DeclaredRowView<Row>, replacement: NoInfer<RowView<Row>>): ViewOverride;
136
- declare function override<Failure extends LoomError>(key: FailureClass<Failure> & {
137
- readonly [declaredView]?: never;
138
- }, replacement: NoInfer<FailureView<Failure>>): ViewOverride;
135
+ type ReplacementView<Key> = [Key] extends [DeclaredView<infer Data>] ? View<Data> : [Key] extends [DeclaredRowView<infer Row>] ? RowView<Row> : [Key] extends [FailureClass<infer Failure>] ? FailureView<Failure> : never;
136
+ /**
137
+ * One override pairing a key with a replacement view. The replacement's type is derived from the
138
+ * key: under a declared view it is typed from the view's data, and under a failure class from the
139
+ * class's instances, which is the typed path for a class-keyed list, because an array literal cannot
140
+ * carry a different type parameter per element. One signature serves every key, so a mismatch
141
+ * names the replacement's type against the one the key expects.
142
+ */
143
+ declare function override<Key extends AnyOverrideKey>(key: Key, replacement: NoInfer<ReplacementView<Key>>): ViewOverride;
139
144
  /** One contributor's overrides, read once per build and consulted in contributor order. */
140
145
  interface ViewContributions {
141
146
  failures: Map<unknown, StoredView>;
@@ -210,5 +215,5 @@ type FailureReport = {
210
215
  * carries the same default text without hints, which the plain fallback path writes.
211
216
  */
212
217
  declare function describeFailure(registry: ViewRegistry, failure: LoomError, context: FailureViewContext): FailureReport;
213
- export type { AnyDeclaredView, DeclaredRowView, DeclaredView, DeclaredViewBrand, FailureClass, FailureReport, FailureView, FailureViewContext, ResolvedRowView, ViewContribution, ViewContributions, ViewSubject, ViewIdentities, ViewOverride, ViewRegistry, ViewShape, };
218
+ export type { AnyDeclaredView, AnyOverrideKey, DeclaredRowView, DeclaredView, DeclaredViewBrand, FailureClass, FailureReport, FailureView, FailureViewContext, ReplacementView, ResolvedRowView, ViewContribution, ViewContributions, ViewSubject, ViewIdentities, ViewOverride, ViewRegistry, ViewShape, };
214
219
  export { buildViews, describeFailure, override, resolveRowView, resolveView, shapeOf, view, viewIdentities, };
package/dist/view.js CHANGED
@@ -84,12 +84,21 @@ class OverrideDeclaration {
84
84
  Object.freeze(this);
85
85
  }
86
86
  }
87
+ /**
88
+ * One override pairing a key with a replacement view. The replacement's type is derived from the
89
+ * key: under a declared view it is typed from the view's data, and under a failure class from the
90
+ * class's instances, which is the typed path for a class-keyed list, because an array literal cannot
91
+ * carry a different type parameter per element. One signature serves every key, so a mismatch
92
+ * names the replacement's type against the one the key expects.
93
+ */
87
94
  function override(key, replacement) {
95
+ // Every replacement a key derives is a stored view, so it widens here with no check.
96
+ const supplied = replacement;
88
97
  const stored = {
89
- head: replacement.head,
90
- render: replacement.render,
91
- row: replacement.row,
92
- tail: replacement.tail,
98
+ head: supplied.head,
99
+ render: supplied.render,
100
+ row: supplied.row,
101
+ tail: supplied.tail,
93
102
  };
94
103
  const declared = declarations.get(key);
95
104
  if (declared) {
@@ -0,0 +1,41 @@
1
+ https://www.unicode.org/license.txt
2
+
3
+ UNICODE LICENSE V3
4
+
5
+ COPYRIGHT AND PERMISSION NOTICE
6
+
7
+ Copyright © 1991-2025 Unicode, Inc.
8
+
9
+ NOTICE TO USER: Carefully read the following legal agreement. BY
10
+ DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR
11
+ SOFTWARE, YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
12
+ TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT
13
+ DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a
16
+ copy of data files and any associated documentation (the "Data Files") or
17
+ software and any associated documentation (the "Software") to deal in the
18
+ Data Files or Software without restriction, including without limitation
19
+ the rights to use, copy, modify, merge, publish, distribute, and/or sell
20
+ copies of the Data Files or Software, and to permit persons to whom the
21
+ Data Files or Software are furnished to do so, provided that either (a)
22
+ this copyright and permission notice appear with all copies of the Data
23
+ Files or Software, or (b) this copyright and permission notice appear in
24
+ associated Documentation.
25
+
26
+ THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
27
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
29
+ THIRD PARTY RIGHTS.
30
+
31
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE
32
+ BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES,
33
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
34
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
35
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA
36
+ FILES OR SOFTWARE.
37
+
38
+ Except as contained in this notice, the name of a copyright holder shall
39
+ not be used in advertising or otherwise to promote the sale, use or other
40
+ dealings in these Data Files or Software without prior written
41
+ authorization of the copyright holder.
@@ -0,0 +1,35 @@
1
+ # uucode license
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2026 Tim Culverhouse
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
8
+ this software and associated documentation files (the "Software"), to deal in
9
+ the Software without restriction, including without limitation the rights to
10
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
11
+ of the Software, and to permit persons to whom the Software is furnished to do
12
+ so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
24
+
25
+ ## Attribution
26
+
27
+ This TypeScript implementation is based on the design and table strategy of
28
+ Jacob Sandlund's `uucode`:
29
+
30
+ - https://github.com/jacobsandlund/uucode
31
+
32
+ The bundled Unicode Character Database files are provided by Unicode, Inc. and
33
+ are subject to the Unicode terms of use:
34
+
35
+ - https://www.unicode.org/terms_of_use.html
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@loomcli/core",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "The Loom CLI core package. Provides the scaffolding for creating new Loom CLI applications.",
5
- "license": "MIT",
5
+ "license": "MIT AND Unicode-3.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/dbtlr/loomcli.git"
9
9
  },
10
10
  "files": [
11
11
  "dist",
12
- "LICENSE"
12
+ "LICENSE",
13
+ "licenses",
14
+ "NOTICE"
13
15
  ],
14
16
  "type": "module",
15
17
  "exports": {
@@ -19,9 +21,11 @@
19
21
  }
20
22
  },
21
23
  "dependencies": {
22
- "@rockorager/uucode": "2.2.1",
23
24
  "@standard-schema/spec": "^1.1.0",
24
- "@types/node": "22.20.1"
25
+ "@types/node": "22.20.5"
26
+ },
27
+ "devDependencies": {
28
+ "@rockorager/uucode": "2.2.1"
25
29
  },
26
30
  "engines": {
27
31
  "bun": ">=1.4.0",