dialog-ide 0.5.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 (225) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/LICENSE +201 -0
  3. package/README.md +211 -0
  4. package/THIRD_PARTY_LICENSES.md +157 -0
  5. package/bin/darwin-arm64/aambundle +0 -0
  6. package/bin/darwin-arm64/dgdebug +0 -0
  7. package/bin/darwin-arm64/dialogc +0 -0
  8. package/bin/dialog-lib/stddebug.dg +112 -0
  9. package/bin/dialog-lib/stdlib.dg +6730 -0
  10. package/bin/dialog-lib/unit.dg +187 -0
  11. package/dist/cli/commands/run-skein.d.ts +17 -0
  12. package/dist/cli/commands/run-skein.d.ts.map +1 -0
  13. package/dist/cli/commands/run-skein.js +105 -0
  14. package/dist/cli/commands/run-skein.js.map +1 -0
  15. package/dist/cli/commands/sources.d.ts +12 -0
  16. package/dist/cli/commands/sources.d.ts.map +1 -0
  17. package/dist/cli/commands/sources.js +42 -0
  18. package/dist/cli/commands/sources.js.map +1 -0
  19. package/dist/cli/commands/test.d.ts +9 -0
  20. package/dist/cli/commands/test.d.ts.map +1 -0
  21. package/dist/cli/commands/test.js +41 -0
  22. package/dist/cli/commands/test.js.map +1 -0
  23. package/dist/cli/context.d.ts +9 -0
  24. package/dist/cli/context.d.ts.map +1 -0
  25. package/dist/cli/context.js +78 -0
  26. package/dist/cli/context.js.map +1 -0
  27. package/dist/cli.d.ts +3 -0
  28. package/dist/cli.d.ts.map +1 -0
  29. package/dist/cli.js +32 -0
  30. package/dist/cli.js.map +1 -0
  31. package/dist/dialog-cover-resize.d.ts +2 -0
  32. package/dist/dialog-cover-resize.d.ts.map +1 -0
  33. package/dist/dialog-cover-resize.js +46 -0
  34. package/dist/dialog-cover-resize.js.map +1 -0
  35. package/dist/dialog-export.d.ts +23 -0
  36. package/dist/dialog-export.d.ts.map +1 -0
  37. package/dist/dialog-export.js +133 -0
  38. package/dist/dialog-export.js.map +1 -0
  39. package/dist/dialog-feelies.d.ts +4 -0
  40. package/dist/dialog-feelies.d.ts.map +1 -0
  41. package/dist/dialog-feelies.js +62 -0
  42. package/dist/dialog-feelies.js.map +1 -0
  43. package/dist/dialog-outline.d.ts +19 -0
  44. package/dist/dialog-outline.d.ts.map +1 -0
  45. package/dist/dialog-outline.js +122 -0
  46. package/dist/dialog-outline.js.map +1 -0
  47. package/dist/dialog-project-init.d.ts +5 -0
  48. package/dist/dialog-project-init.d.ts.map +1 -0
  49. package/dist/dialog-project-init.js +107 -0
  50. package/dist/dialog-project-init.js.map +1 -0
  51. package/dist/dialog-source-coverage.d.ts +9 -0
  52. package/dist/dialog-source-coverage.d.ts.map +1 -0
  53. package/dist/dialog-source-coverage.js +61 -0
  54. package/dist/dialog-source-coverage.js.map +1 -0
  55. package/dist/dialog-source-decoration-provider.d.ts +11 -0
  56. package/dist/dialog-source-decoration-provider.d.ts.map +1 -0
  57. package/dist/dialog-source-decoration-provider.js +79 -0
  58. package/dist/dialog-source-decoration-provider.js.map +1 -0
  59. package/dist/dialog-symbol-index.d.ts +19 -0
  60. package/dist/dialog-symbol-index.d.ts.map +1 -0
  61. package/dist/dialog-symbol-index.js +107 -0
  62. package/dist/dialog-symbol-index.js.map +1 -0
  63. package/dist/dialog-symbol-provider.d.ts +5 -0
  64. package/dist/dialog-symbol-provider.d.ts.map +1 -0
  65. package/dist/dialog-symbol-provider.js +56 -0
  66. package/dist/dialog-symbol-provider.js.map +1 -0
  67. package/dist/dialog-web-export.d.ts +25 -0
  68. package/dist/dialog-web-export.d.ts.map +1 -0
  69. package/dist/dialog-web-export.js +283 -0
  70. package/dist/dialog-web-export.js.map +1 -0
  71. package/dist/dialog-workspace-symbol-provider.d.ts +16 -0
  72. package/dist/dialog-workspace-symbol-provider.d.ts.map +1 -0
  73. package/dist/dialog-workspace-symbol-provider.js +107 -0
  74. package/dist/dialog-workspace-symbol-provider.js.map +1 -0
  75. package/dist/dialog-workspace-watcher.d.ts +22 -0
  76. package/dist/dialog-workspace-watcher.d.ts.map +1 -0
  77. package/dist/dialog-workspace-watcher.js +102 -0
  78. package/dist/dialog-workspace-watcher.js.map +1 -0
  79. package/dist/dialoged/skein/compile-error.d.ts +10 -0
  80. package/dist/dialoged/skein/compile-error.d.ts.map +1 -0
  81. package/dist/dialoged/skein/compile-error.js +28 -0
  82. package/dist/dialoged/skein/compile-error.js.map +1 -0
  83. package/dist/dialoged/skein/dynamic.d.ts +14 -0
  84. package/dist/dialoged/skein/dynamic.d.ts.map +1 -0
  85. package/dist/dialoged/skein/dynamic.js +176 -0
  86. package/dist/dialoged/skein/dynamic.js.map +1 -0
  87. package/dist/dialoged/skein/frotz-build.d.ts +10 -0
  88. package/dist/dialoged/skein/frotz-build.d.ts.map +1 -0
  89. package/dist/dialoged/skein/frotz-build.js +70 -0
  90. package/dist/dialoged/skein/frotz-build.js.map +1 -0
  91. package/dist/dialoged/skein/index.d.ts +15 -0
  92. package/dist/dialoged/skein/index.d.ts.map +1 -0
  93. package/dist/dialoged/skein/index.js +31 -0
  94. package/dist/dialoged/skein/index.js.map +1 -0
  95. package/dist/dialoged/skein/io.d.ts +15 -0
  96. package/dist/dialoged/skein/io.d.ts.map +1 -0
  97. package/dist/dialoged/skein/io.js +53 -0
  98. package/dist/dialoged/skein/io.js.map +1 -0
  99. package/dist/dialoged/skein/persistence.d.ts +13 -0
  100. package/dist/dialoged/skein/persistence.d.ts.map +1 -0
  101. package/dist/dialoged/skein/persistence.js +228 -0
  102. package/dist/dialoged/skein/persistence.js.map +1 -0
  103. package/dist/dialoged/skein/process.d.ts +38 -0
  104. package/dist/dialoged/skein/process.d.ts.map +1 -0
  105. package/dist/dialoged/skein/process.js +189 -0
  106. package/dist/dialoged/skein/process.js.map +1 -0
  107. package/dist/dialoged/skein/progress.d.ts +17 -0
  108. package/dist/dialoged/skein/progress.d.ts.map +1 -0
  109. package/dist/dialoged/skein/progress.js +9 -0
  110. package/dist/dialoged/skein/progress.js.map +1 -0
  111. package/dist/dialoged/skein/project.d.ts +44 -0
  112. package/dist/dialoged/skein/project.d.ts.map +1 -0
  113. package/dist/dialoged/skein/project.js +223 -0
  114. package/dist/dialoged/skein/project.js.map +1 -0
  115. package/dist/dialoged/skein/search.d.ts +15 -0
  116. package/dist/dialoged/skein/search.d.ts.map +1 -0
  117. package/dist/dialoged/skein/search.js +99 -0
  118. package/dist/dialoged/skein/search.js.map +1 -0
  119. package/dist/dialoged/skein/service.d.ts +91 -0
  120. package/dist/dialoged/skein/service.d.ts.map +1 -0
  121. package/dist/dialoged/skein/service.js +1097 -0
  122. package/dist/dialoged/skein/service.js.map +1 -0
  123. package/dist/dialoged/skein/session.d.ts +96 -0
  124. package/dist/dialoged/skein/session.d.ts.map +1 -0
  125. package/dist/dialoged/skein/session.js +690 -0
  126. package/dist/dialoged/skein/session.js.map +1 -0
  127. package/dist/dialoged/skein/syntax.d.ts +5 -0
  128. package/dist/dialoged/skein/syntax.d.ts.map +1 -0
  129. package/dist/dialoged/skein/syntax.js +150 -0
  130. package/dist/dialoged/skein/syntax.js.map +1 -0
  131. package/dist/dialoged/skein/trace.d.ts +31 -0
  132. package/dist/dialoged/skein/trace.d.ts.map +1 -0
  133. package/dist/dialoged/skein/trace.js +172 -0
  134. package/dist/dialoged/skein/trace.js.map +1 -0
  135. package/dist/dialoged/skein/tree.d.ts +114 -0
  136. package/dist/dialoged/skein/tree.d.ts.map +1 -0
  137. package/dist/dialoged/skein/tree.js +701 -0
  138. package/dist/dialoged/skein/tree.js.map +1 -0
  139. package/dist/dialoged/skein/ui/ansi.d.ts +4 -0
  140. package/dist/dialoged/skein/ui/ansi.d.ts.map +1 -0
  141. package/dist/dialoged/skein/ui/ansi.js +215 -0
  142. package/dist/dialoged/skein/ui/ansi.js.map +1 -0
  143. package/dist/dialoged/skein/ui/diff.d.ts +7 -0
  144. package/dist/dialoged/skein/ui/diff.d.ts.map +1 -0
  145. package/dist/dialoged/skein/ui/diff.js +17 -0
  146. package/dist/dialoged/skein/ui/diff.js.map +1 -0
  147. package/dist/dialoged/skein/ui/knot-menu.d.ts +5 -0
  148. package/dist/dialoged/skein/ui/knot-menu.d.ts.map +1 -0
  149. package/dist/dialoged/skein/ui/knot-menu.js +89 -0
  150. package/dist/dialoged/skein/ui/knot-menu.js.map +1 -0
  151. package/dist/dialoged/skein/ui/marker-colors.d.ts +5 -0
  152. package/dist/dialoged/skein/ui/marker-colors.d.ts.map +1 -0
  153. package/dist/dialoged/skein/ui/marker-colors.js +18 -0
  154. package/dist/dialoged/skein/ui/marker-colors.js.map +1 -0
  155. package/dist/dialoged/skein/ui/render.d.ts +13 -0
  156. package/dist/dialoged/skein/ui/render.d.ts.map +1 -0
  157. package/dist/dialoged/skein/ui/render.js +332 -0
  158. package/dist/dialoged/skein/ui/render.js.map +1 -0
  159. package/dist/dialoged/skein/ui/traceRender.d.ts +11 -0
  160. package/dist/dialoged/skein/ui/traceRender.d.ts.map +1 -0
  161. package/dist/dialoged/skein/ui/traceRender.js +139 -0
  162. package/dist/dialoged/skein/ui/traceRender.js.map +1 -0
  163. package/dist/dialoged/skein/ui/tree-pane.d.ts +3 -0
  164. package/dist/dialoged/skein/ui/tree-pane.d.ts.map +1 -0
  165. package/dist/dialoged/skein/ui/tree-pane.js +135 -0
  166. package/dist/dialoged/skein/ui/tree-pane.js.map +1 -0
  167. package/dist/dialoged/skein/ui/webExportPage.d.ts +29 -0
  168. package/dist/dialoged/skein/ui/webExportPage.d.ts.map +1 -0
  169. package/dist/dialoged/skein/ui/webExportPage.js +72 -0
  170. package/dist/dialoged/skein/ui/webExportPage.js.map +1 -0
  171. package/dist/extension.d.ts +4 -0
  172. package/dist/extension.d.ts.map +1 -0
  173. package/dist/extension.js +885 -0
  174. package/dist/extension.js.map +1 -0
  175. package/dist/session-runner.d.ts +23 -0
  176. package/dist/session-runner.d.ts.map +1 -0
  177. package/dist/session-runner.js +92 -0
  178. package/dist/session-runner.js.map +1 -0
  179. package/language-configuration.json +43 -0
  180. package/media/icon.png +0 -0
  181. package/media/icons/arrow-down-circle-solid.svg +3 -0
  182. package/media/icons/arrow-down-solid.svg +3 -0
  183. package/media/icons/arrow-path-solid.svg +3 -0
  184. package/media/icons/arrow-right-solid.svg +3 -0
  185. package/media/icons/arrow-up-on-square-stack-solid.svg +5 -0
  186. package/media/icons/arrow-up-solid.svg +3 -0
  187. package/media/icons/arrow-uturn-left.svg +3 -0
  188. package/media/icons/arrow-uturn-right.svg +3 -0
  189. package/media/icons/bookmark-solid.svg +3 -0
  190. package/media/icons/bug-ant-solid.svg +3 -0
  191. package/media/icons/check-badge-solid.svg +3 -0
  192. package/media/icons/check-circle-solid.svg +3 -0
  193. package/media/icons/chevron-double-down-solid.svg +4 -0
  194. package/media/icons/chevron-double-up-solid.svg +4 -0
  195. package/media/icons/command-line-solid.svg +3 -0
  196. package/media/icons/cpu-chip-solid.svg +4 -0
  197. package/media/icons/dg-file-dark.svg +6 -0
  198. package/media/icons/dg-file-light.svg +6 -0
  199. package/media/icons/ellipsis-vertical-solid.svg +3 -0
  200. package/media/icons/exclamation-triangle.svg +3 -0
  201. package/media/icons/folder-arrow-down-solid.svg +3 -0
  202. package/media/icons/globe-alt.svg +3 -0
  203. package/media/icons/lock-closed-solid.svg +3 -0
  204. package/media/icons/magnifying-glass-solid.svg +3 -0
  205. package/media/icons/pencil-solid.svg +4 -0
  206. package/media/icons/play-solid.svg +3 -0
  207. package/media/icons/plus-circle-solid.svg +3 -0
  208. package/media/icons/scissors-solid.svg +5 -0
  209. package/media/icons/tag-solid.svg +3 -0
  210. package/media/icons/trash-solid.svg +3 -0
  211. package/media/icons/x-circle-solid.svg +3 -0
  212. package/media/js/datastar.js +9 -0
  213. package/media/js/main.js +1109 -0
  214. package/media/js/skein-loader.js +10 -0
  215. package/media/js/trace-loader.js +4 -0
  216. package/media/js/trace.js +147 -0
  217. package/media/style.css +5783 -0
  218. package/package.json +231 -0
  219. package/resources/bundle/default-cover.png +0 -0
  220. package/resources/bundle/introduction-to-if.pdf +0 -0
  221. package/resources/bundle/play-if-card.pdf +1990 -1
  222. package/resources/bundle/play.css +432 -0
  223. package/resources/bundle/style.css +450 -0
  224. package/resources/dfrotz-skein-patch.dg +4 -0
  225. package/syntaxes/dialog.tmLanguage.json +490 -0
@@ -0,0 +1,187 @@
1
+ %% unit.dg
2
+ (extension version) Unit test runner 1.2.1 by Susan Davis.
3
+
4
+ %% See example(s) in test/unit in Dialog source distribution, and chapter 12 of
5
+ %% the library manual.
6
+
7
+ %% Copyright © 2021-2026, Susan Davis. All rights reserved. Licensed under the
8
+ %% same license as the rest of Dialog; see license.txt or LICENSE for details.
9
+
10
+ %%-------------------------------- INTERFACES --------------------------------
11
+
12
+ %% Give all your tests the (test *) trait.
13
+
14
+ (interface (test $Testname))
15
+
16
+ %% (run #foo) expr will pass if expr is true and fail if expr is false.
17
+ %% Include #foo in the global variable (list of tests [test1 test2 ...])
18
+
19
+ (interface (run $<Testname))
20
+
21
+ (interface (set up $<Testname)) %% special setup for the test
22
+
23
+ (interface (clean up $<Testname)) %% restore to original state afterward
24
+
25
+ (interface (assert $<Var = $<Val))
26
+
27
+ (interface (assert $<Var > $<Val))
28
+
29
+ (interface (assert $<Var < $<Val))
30
+
31
+ (keep running on failure) %% negate to stop at first failed test
32
+
33
+ (using color) %% negate to use default output instead of green and red
34
+
35
+ ~(list failing tests) %% un-negate to summarize failing tests at the end
36
+
37
+ %%----------------------------- IMPLEMENTATION -----------------------------
38
+
39
+ %% We almost don't need these, since that final line already does what we
40
+ %% want, but adding binding checks can be useful.
41
+
42
+ (assert $Thing1 = $Thing2) %% true if both are bound and ($Thing1 = $Thing2)
43
+ (fully bound $Thing1)
44
+ (bound $Thing2)
45
+ ($Thing1 = $Thing2)
46
+
47
+ (assert $Thing1 > $Thing2)
48
+ (fully bound $Thing1)
49
+ (bound $Thing2)
50
+ ($Thing1 > $Thing2)
51
+
52
+ (assert $Thing1 < $Thing2)
53
+ (fully bound $Thing1)
54
+ (bound $Thing2)
55
+ ($Thing1 < $Thing2)
56
+
57
+ (style class @green-bar)
58
+ color: green;
59
+
60
+ (style class @red-bar)
61
+ color: red;
62
+
63
+ (global variable (list of failures []))
64
+
65
+ (program entry point)
66
+ (accumulate 1) *(test $) (into $Number)
67
+ (bold) Attempting $Number test
68
+ (if) ~($Number = 1) (then) (no space) s (endif)
69
+ (no space) . (roman) (line)
70
+ (stoppable) (exhaust) {
71
+ *(test $Test)
72
+ (run test $Test)
73
+ }
74
+ (reset body style)
75
+ (list of failures $Failures)
76
+ (if) ($Failures = []) (then)
77
+ (bold) $Number test
78
+ (if) ~($Number = 1) (then) (no space) s (endif)
79
+ (bold) passed successfully. (roman) (par)
80
+ (quit 0)
81
+ (else)
82
+ (length of $Failures into $Num)
83
+ (bold) $Num TEST
84
+ (if) ~($Num = 1) (then) (no space) S (endif)
85
+ FAILED
86
+ (if) (list failing tests) (then)
87
+ (roman) $Failures (bold)
88
+ (endif)
89
+ (no space) . (roman) (par)
90
+ (quit 1)
91
+ (endif)
92
+
93
+ (update body style)
94
+ (if) (using color) (then)
95
+ (list of failures $Failures)
96
+ (if) ($Failures = []) (then)
97
+ (body style @green-bar)
98
+ (else)
99
+ (body style @red-bar)
100
+ (endif)
101
+ (else)
102
+ (reset body style)
103
+ (endif)
104
+
105
+ ($Test has failed)
106
+ (list of failures $List)
107
+ (append $List [$Test] $ListPlusTest)
108
+ (now) (list of failures $ListPlusTest)
109
+
110
+ (run test $Test)
111
+ (update body style)
112
+ Testing $Test :
113
+ (reset body style) %% display output from the test itself in default colours
114
+ (if)
115
+ (stoppable) (exhaust) *(set up $Test) %% don't fail if absent
116
+ (run $Test)
117
+ (stoppable) (exhaust) *(clean up $Test) %% don't fail if absent
118
+ (then)
119
+ (update body style)
120
+ Passed! (line)
121
+ (else)
122
+ ($Test has failed)
123
+ (update body style)
124
+ (bold) Failed. (roman) (space) :-\( (line)
125
+ (if) ~(keep running on failure) (then) (stop) (endif)
126
+ (endif)
127
+
128
+ (report fatal error 1) Heap space exhausted.
129
+ (report fatal error 2) Auxiliary heap space exhausted.
130
+ (report fatal error 3) Type error: Expected object.
131
+ (report fatal error 4) Type error: Expected bound value.
132
+ (report fatal error 5) Invalid dynamic operation.
133
+ (report fatal error 6) Long-term heap space exhausted.
134
+ (report fatal error 7) Invalid output state.
135
+ (report fatal error $) Invalid error code!
136
+
137
+ (error $Code entry point)
138
+ (if) (using color) (then)
139
+ (body style @red-bar)
140
+ (endif)
141
+ (bold) FAILED TEST -- FATAL ERROR $Code: (roman)
142
+ (report fatal error $Code) (par)
143
+ (quit 2)
144
+
145
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
146
+ %% License and copyright notice
147
+ %% Copyright 2018-2026 the Dialog Project contributors
148
+ %%
149
+ %% Redistribution and use in source and binary forms, with or without
150
+ %% modification, are permitted provided that the following conditions are met:
151
+ %%
152
+ %% 1. Redistributions of source code must retain the above copyright
153
+ %% notice, this list of conditions and the following disclaimer.
154
+ %%
155
+ %% 2. Redistributions in binary form must reproduce the above copyright
156
+ %% notice, this list of conditions and the following disclaimer in the
157
+ %% documentation and/or other materials provided with the distribution.
158
+ %%
159
+ %% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
160
+ %% IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
161
+ %% TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
162
+ %% PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
163
+ %% HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
164
+ %% SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
165
+ %% LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
166
+ %% DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
167
+ %% THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
168
+ %% (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
169
+ %% OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
170
+ %%
171
+ %% This license is intended to apply to the Dialog compiler and debugger and
172
+ %% the source code of the standard libraries. Any time those components are
173
+ %% distributed, this copyright notice should be attached. But it is not meant
174
+ %% to limit what the compiler's output can be used for, even for projects that
175
+ %% include the standard libraries. To make this explicit, the project is ALSO
176
+ %% released under a modified two-clause BSD license, which is exactly the same
177
+ %% as the above but adds this exception:
178
+ %%
179
+ %% As an exception, if, as a result of you compiling your source code,
180
+ %% portions of this software are embedded into compiler output in binary
181
+ %% form, you may redistribute such embedded portions without complying
182
+ %% with condition 2 of the license.
183
+ %%
184
+ %% In other words, you can distribute the Z-machine and Å-machine bytecode that
185
+ %% the compiler produces in any way you like, without needing to include this
186
+ %% license file or comply with the attribution requirements (for the library
187
+ %% or for the Z-machine runtime routines).
@@ -0,0 +1,17 @@
1
+ import { Command } from 'commander';
2
+ import { SkeinTree } from '../../dialoged/skein';
3
+ export interface RunSkeinOptions {
4
+ project?: string;
5
+ verbose?: boolean;
6
+ cwd?: string;
7
+ }
8
+ export interface SkeinStatusCounts {
9
+ valid: number;
10
+ new: number;
11
+ error: number;
12
+ }
13
+ export declare function countKnotStatuses(tree: SkeinTree): SkeinStatusCounts;
14
+ export declare function deriveSkeinExitCode(tree: SkeinTree): number;
15
+ export declare function runSkeinCommand(namesOrFiles: string[], options: RunSkeinOptions): Promise<number>;
16
+ export declare function registerRunSkeinCommand(program: Command): void;
17
+ //# sourceMappingURL=run-skein.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-skein.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/run-skein.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAIL,SAAS,EAEV,MAAM,sBAAsB,CAAC;AAU9B,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,CAMpE;AAGD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAE3D;AA6CD,wBAAsB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAiDvG;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAU9D"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.countKnotStatuses = countKnotStatuses;
4
+ exports.deriveSkeinExitCode = deriveSkeinExitCode;
5
+ exports.runSkeinCommand = runSkeinCommand;
6
+ exports.registerRunSkeinCommand = registerRunSkeinCommand;
7
+ const skein_1 = require("../../dialoged/skein");
8
+ const session_runner_1 = require("../../session-runner");
9
+ const context_1 = require("../context");
10
+ function countKnotStatuses(tree) {
11
+ return {
12
+ valid: tree.knotIdsWithStatus('valid').length,
13
+ new: tree.knotIdsWithStatus('new').length,
14
+ error: tree.knotIdsWithStatus('error').length
15
+ };
16
+ }
17
+ function deriveSkeinExitCode(tree) {
18
+ return countKnotStatuses(tree).error > 0 ? 1 : 0;
19
+ }
20
+ function formatCounts(counts) {
21
+ return `${counts.valid}/${counts.new}/${counts.error}`;
22
+ }
23
+ function reportErrorKnots(sessionId, tree) {
24
+ for (const id of tree.knotIdsWithStatus('error')) {
25
+ const knot = tree.getDerivedKnot(id);
26
+ const label = knot?.label ? ` (${knot.label})` : '';
27
+ console.error(`${sessionId} - knot #${id}${label}: "${knot?.command}" is invalid`);
28
+ }
29
+ }
30
+ async function replayOneSkein(sessionId, projectRoot) {
31
+ const manager = new skein_1.PersistenceManager(projectRoot);
32
+ const tree = await manager.loadSession(sessionId);
33
+ const config = (0, session_runner_1.sessionConfigFromTree)(tree, projectRoot, (0, context_1.resolveCliBundledBinDir)(), (0, context_1.resolveCliPatchSourcePath)());
34
+ const session = skein_1.SkeinSession.createLoaded(tree, config);
35
+ try {
36
+ await session.start();
37
+ await session.replayAll();
38
+ }
39
+ catch (error) {
40
+ if (error instanceof skein_1.DialogCompileError) {
41
+ const where = error.filePath ? ` (${error.filePath}${error.line ? `:${error.line}` : ''})` : '';
42
+ throw new context_1.CliError(`${sessionId}: compile error${where}: ${error.message}`);
43
+ }
44
+ throw error;
45
+ }
46
+ finally {
47
+ await session.stop();
48
+ }
49
+ const finalTree = session.getTree();
50
+ reportErrorKnots(sessionId, finalTree);
51
+ return countKnotStatuses(finalTree);
52
+ }
53
+ async function runSkeinCommand(namesOrFiles, options) {
54
+ const projectRoot = (0, context_1.resolveCliProjectRoot)(options.cwd ?? process.cwd(), options.project);
55
+ (0, skein_1.readProject)(projectRoot);
56
+ const targets = namesOrFiles.length > 0 ? namesOrFiles : [session_runner_1.DEFAULT_SESSION_ID];
57
+ const sessionIds = targets.map((nameOrFile) => {
58
+ const sessionId = (0, session_runner_1.toSessionId)(nameOrFile);
59
+ if (!(0, session_runner_1.isValidSessionId)(sessionId)) {
60
+ throw new context_1.CliError(`"${nameOrFile}" is not a valid skein name.`);
61
+ }
62
+ return sessionId;
63
+ });
64
+ const manager = new skein_1.PersistenceManager(projectRoot);
65
+ const missing = [];
66
+ for (const sessionId of sessionIds) {
67
+ if (!(await manager.sessionExists(sessionId))) {
68
+ missing.push(`${sessionId}.skein`);
69
+ }
70
+ }
71
+ if (missing.length > 0) {
72
+ throw new context_1.CliError(`${missing.join(', ')} not found in ${projectRoot}.`);
73
+ }
74
+ const results = await (0, context_1.withQuietLogging)(!options.verbose, async () => {
75
+ const collected = [];
76
+ for (const sessionId of sessionIds) {
77
+ collected.push({ sessionId, counts: await replayOneSkein(sessionId, projectRoot) });
78
+ }
79
+ return collected;
80
+ });
81
+ for (const { sessionId, counts } of results) {
82
+ console.log(`${sessionId}: ${formatCounts(counts)} (valid/new/error)`);
83
+ }
84
+ const total = results.reduce((acc, { counts }) => ({
85
+ valid: acc.valid + counts.valid,
86
+ new: acc.new + counts.new,
87
+ error: acc.error + counts.error
88
+ }), { valid: 0, new: 0, error: 0 });
89
+ if (results.length > 1) {
90
+ console.log(`total: ${formatCounts(total)} (valid/new/error)`);
91
+ }
92
+ return total.error > 0 ? 1 : 0;
93
+ }
94
+ function registerRunSkeinCommand(program) {
95
+ program
96
+ .command('run-skein')
97
+ .description('Replay one or more saved skeins and exit non-zero if any knot is invalid')
98
+ .argument('[names...]', `skein names or filenames (default: "${session_runner_1.DEFAULT_SESSION_ID}")`)
99
+ .option('-p, --project <dir>', 'project directory (default: current directory)')
100
+ .option('-v, --verbose', 'print the underlying dgdebug process commands/lifecycle logging')
101
+ .action(async (names, options) => {
102
+ process.exitCode = await runSkeinCommand(names, options);
103
+ });
104
+ }
105
+ //# sourceMappingURL=run-skein.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-skein.js","sourceRoot":"","sources":["../../../src/cli/commands/run-skein.ts"],"names":[],"mappings":";;AAsCA,8CAMC;AAGD,kDAEC;AA6CD,0CAiDC;AAED,0DAUC;AAlJD,gDAM8B;AAC9B,yDAAgH;AAChH,wCAMoB;AAepB,SAAgB,iBAAiB,CAAC,IAAe;IAC/C,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM;QAC7C,GAAG,EA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
4
+ debug?: boolean;
5
+ test?: boolean;
6
+ target?: string;
7
+ singleLine?: boolean;
8
+ cwd?: string;
9
+ }
10
+ export declare function listSourcesCommand(options: SourcesOptions): number;
11
+ export declare function registerSourcesCommand(program: Command): void;
12
+ //# sourceMappingURL=sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/sources.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAQD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAsBlE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAY7D"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listSourcesCommand = listSourcesCommand;
4
+ exports.registerSourcesCommand = registerSourcesCommand;
5
+ const skein_1 = require("../../dialoged/skein");
6
+ const context_1 = require("../context");
7
+ function listSourcesCommand(options) {
8
+ const projectRoot = (0, context_1.resolveCliProjectRoot)(options.cwd ?? process.cwd(), options.project);
9
+ const project = (0, skein_1.readProject)(projectRoot);
10
+ const paths = (0, skein_1.expandSources)(project, {
11
+ debug: options.debug,
12
+ test: options.test,
13
+ target: options.target
14
+ });
15
+ if (paths.length === 0) {
16
+ console.error('No matching source files');
17
+ return 0;
18
+ }
19
+ if (options.singleLine) {
20
+ console.log(paths.join(':'));
21
+ }
22
+ else {
23
+ for (const p of paths) {
24
+ console.log(p);
25
+ }
26
+ }
27
+ return 0;
28
+ }
29
+ function registerSourcesCommand(program) {
30
+ program
31
+ .command('sources')
32
+ .description('Print the expanded list of a project\'s source files')
33
+ .option('-p, --project <dir>', 'project directory (default: current directory)')
34
+ .option('-d, --debug', 'include the project\'s debug sources')
35
+ .option('-t, --test', 'include the project\'s test sources')
36
+ .option('-T, --target <suffix>', 'only include sources matching this target suffix (e.g. "zblorb")')
37
+ .option('-1, --single-line', 'print all paths colon-joined on a single line, for scripting')
38
+ .action((options) => {
39
+ process.exitCode = listSourcesCommand(options);
40
+ });
41
+ }
42
+ //# sourceMappingURL=sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../src/cli/commands/sources.ts"],"names":[],"mappings":";;AA0BA,gDAsBC;AAED,wDAYC;AAtDD,gDAAkE;AAClE,wCAAmD;AAiBnD,SAAgB,kBAAkB,CAAC,OAAuB;IACxD,MAAM,WAAW,GAAG,IAAA,+BAAqB,EAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACzF,MAAM,OAAO,GAAG,IAAA,mBAAW,EAAC,WAAW,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,IAAA,qBAAa,EAAC,OAAO,EAAE;QACnC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC1C,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,sBAAsB,CAAC,OAAgB;IACrD,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,sDAAsD,CAAC;SACnE,MAAM,CAAC,qBAAqB,EAAE,gDAAgD,CAAC;SAC/E,MAAM,CAAC,aAAa,EAAE,sCAAsC,CAAC;SAC7D,MAAM,CAAC,YAAY,EAAE,qCAAqC,CAAC;SAC3D,MAAM,CAAC,uBAAuB,EAAE,kEAAkE,CAAC;SACnG,MAAM,CAAC,mBAAmB,EAAE,8DAA8D,CAAC;SAC3F,MAAM,CAAC,CAAC,OAAuB,EAAE,EAAE;QAClC,OAAO,CAAC,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Command } from 'commander';
2
+ export interface TestOptions {
3
+ project?: string;
4
+ debug?: boolean;
5
+ cwd?: string;
6
+ }
7
+ export declare function runTestsCommand(options: TestOptions, extraArgs?: string[]): Promise<number>;
8
+ export declare function registerTestCommand(program: Command): void;
9
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/test.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAwBrG;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAU1D"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runTestsCommand = runTestsCommand;
4
+ exports.registerTestCommand = registerTestCommand;
5
+ const child_process_1 = require("child_process");
6
+ const skein_1 = require("../../dialoged/skein");
7
+ const session_runner_1 = require("../../session-runner");
8
+ const context_1 = require("../context");
9
+ async function runTestsCommand(options, extraArgs = []) {
10
+ const projectRoot = (0, context_1.resolveCliProjectRoot)(options.cwd ?? process.cwd(), options.project);
11
+ const project = (0, skein_1.readProject)(projectRoot);
12
+ const bundledBinDir = (0, context_1.resolveCliBundledBinDir)();
13
+ if (!(await (0, session_runner_1.isDgdebugAvailable)(project.binDir, bundledBinDir))) {
14
+ throw new context_1.CliError('dgdebug not found - install the Dialog toolchain, or set dialog.json\'s binDir.');
15
+ }
16
+ const debug = options.debug ?? true;
17
+ const sourceFiles = (0, skein_1.expandSources)(project, { debug, test: true, target: 'dgdebug' });
18
+ const withoutTest = (0, skein_1.expandSources)(project, { debug, test: false, target: 'dgdebug' });
19
+ if (sourceFiles.length === withoutTest.length) {
20
+ throw new context_1.CliError('No test sources declared in dialog.json\'s "test" category - nothing to run.');
21
+ }
22
+ const dgdebugPath = (0, skein_1.resolveCommandPath)(project.binDir, 'dgdebug', bundledBinDir);
23
+ const args = ['--unit-test', ...extraArgs, ...sourceFiles];
24
+ return new Promise((resolve, reject) => {
25
+ const child = (0, child_process_1.spawn)(dgdebugPath, args, { stdio: 'inherit' });
26
+ child.on('error', reject);
27
+ child.on('exit', (code, signal) => resolve(signal ? 1 : (code ?? 1)));
28
+ });
29
+ }
30
+ function registerTestCommand(program) {
31
+ program
32
+ .command('test')
33
+ .description('Run a project\'s unit tests, exiting non-zero on any failure')
34
+ .option('-p, --project <dir>', 'project directory (default: current directory)')
35
+ .option('--no-debug', 'exclude the project\'s debug sources')
36
+ .argument('[args...]', 'extra arguments passed through to dgdebug')
37
+ .action(async (extraArgs, options) => {
38
+ process.exitCode = await runTestsCommand(options, extraArgs);
39
+ });
40
+ }
41
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../../../src/cli/commands/test.ts"],"names":[],"mappings":";;AAwBA,0CAwBC;AAED,kDAUC;AA/CD,iDAAsC;AACtC,gDAAsF;AACtF,yDAA0D;AAC1D,wCAAsF;AAQ/E,KAAK,UAAU,eAAe,CAAC,OAAoB,EAAE,YAAsB,EAAE;IAClF,MAAM,WAAW,GAAG,IAAA,+BAAqB,EAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACzF,MAAM,OAAO,GAAG,IAAA,mBAAW,EAAC,WAAW,CAAC,CAAC;IACzC,MAAM,aAAa,GAAG,IAAA,iCAAuB,GAAE,CAAC;IAEhD,IAAI,CAAC,CAAC,MAAM,IAAA,mCAAkB,EAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC;QAC/D,MAAM,IAAI,kBAAQ,CAAC,iFAAiF,CAAC,CAAC;IACxG,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC;IACpC,MAAM,WAAW,GAAG,IAAA,qBAAa,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACrF,MAAM,WAAW,GAAG,IAAA,qBAAa,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACtF,IAAI,WAAW,CAAC,MAAM,KAAK,WAAW,CAAC,MAAM,EAAE,CAAC;QAC9C,MAAM,IAAI,kBAAQ,CAAC,8EAA8E,CAAC,CAAC;IACrG,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,0BAAkB,EAAC,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;IACjF,MAAM,IAAI,GAAG,CAAC,aAAa,EAAE,GAAG,SAAS,EAAE,GAAG,WAAW,CAAC,CAAC;IAE3D,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7C,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,WAAW,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QAC7D,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC1B,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,mBAAmB,CAAC,OAAgB;IAClD,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,8DAA8D,CAAC;SAC3E,MAAM,CAAC,qBAAqB,EAAE,gDAAgD,CAAC;SAC/E,MAAM,CAAC,YAAY,EAAE,sCAAsC,CAAC;SAC5D,QAAQ,CAAC,WAAW,EAAE,2CAA2C,CAAC;SAClE,MAAM,CAAC,KAAK,EAAE,SAAmB,EAAE,OAAoB,EAAE,EAAE;QAC1D,OAAO,CAAC,QAAQ,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare class CliError extends Error {
2
+ }
3
+ export declare function cliPackageRoot(): string;
4
+ export declare function cliVersion(): string;
5
+ export declare function resolveCliBundledBinDir(): string | undefined;
6
+ export declare function resolveCliPatchSourcePath(): string;
7
+ export declare function withQuietLogging<T>(quiet: boolean, fn: () => Promise<T>): Promise<T>;
8
+ export declare function resolveCliProjectRoot(cwd: string, projectOption?: string): string;
9
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/cli/context.ts"],"names":[],"mappings":"AAUA,qBAAa,QAAS,SAAQ,KAAK;CAAG;AAUtC,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,UAAU,IAAI,MAAM,CAGnC;AAED,wBAAgB,uBAAuB,IAAI,MAAM,GAAG,SAAS,CAE5D;AAED,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAUD,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAW1F;AAQD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjF"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.CliError = void 0;
37
+ exports.cliPackageRoot = cliPackageRoot;
38
+ exports.cliVersion = cliVersion;
39
+ exports.resolveCliBundledBinDir = resolveCliBundledBinDir;
40
+ exports.resolveCliPatchSourcePath = resolveCliPatchSourcePath;
41
+ exports.withQuietLogging = withQuietLogging;
42
+ exports.resolveCliProjectRoot = resolveCliProjectRoot;
43
+ const fs = __importStar(require("fs"));
44
+ const path = __importStar(require("path"));
45
+ const skein_1 = require("../dialoged/skein");
46
+ class CliError extends Error {
47
+ }
48
+ exports.CliError = CliError;
49
+ function cliPackageRoot() {
50
+ return path.join(__dirname, '..', '..');
51
+ }
52
+ function cliVersion() {
53
+ const pkgPath = path.join(cliPackageRoot(), 'package.json');
54
+ return JSON.parse(fs.readFileSync(pkgPath, 'utf8')).version;
55
+ }
56
+ function resolveCliBundledBinDir() {
57
+ return (0, skein_1.resolveBundledBinDir)(cliPackageRoot());
58
+ }
59
+ function resolveCliPatchSourcePath() {
60
+ return path.join(cliPackageRoot(), 'resources', 'dfrotz-skein-patch.dg');
61
+ }
62
+ async function withQuietLogging(quiet, fn) {
63
+ if (!quiet) {
64
+ return fn();
65
+ }
66
+ const original = console.log;
67
+ console.log = () => { };
68
+ try {
69
+ return await fn();
70
+ }
71
+ finally {
72
+ console.log = original;
73
+ }
74
+ }
75
+ function resolveCliProjectRoot(cwd, projectOption) {
76
+ return projectOption ? path.resolve(cwd, projectOption) : cwd;
77
+ }
78
+ //# source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C;AACH,CAAC;AAQD,SAAgB,qBAAqB,CAAC,GAAW,EAAE,aAAsB;IACvE,OAAO,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AAChE,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const commander_1 = require("commander");
5
+ const skein_1 = require("./dialoged/skein");
6
+ const context_1 = require("./cli/context");
7
+ const run_skein_1 = require("./cli/commands/run-skein");
8
+ const sources_1 = require("./cli/commands/sources");
9
+ const test_1 = require("./cli/commands/test");
10
+ const program = new commander_1.Command();
11
+ program
12
+ .name('dgbuild')
13
+ .description('Headless CLI for Dialog IDE project operations (scripting/CI use)')
14
+ .version((0, context_1.cliVersion)());
15
+ (0, test_1.registerTestCommand)(program);
16
+ (0, run_skein_1.registerRunSkeinCommand)(program);
17
+ (0, sources_1.registerSourcesCommand)(program);
18
+ program.exitOverride();
19
+ program.parseAsync(process.argv).catch((error) => {
20
+ if (error instanceof commander_1.CommanderError) {
21
+ process.exitCode = error.exitCode;
22
+ return;
23
+ }
24
+ if (error instanceof context_1.CliError || error instanceof skein_1.DialogCompileError) {
25
+ console.error(error.message);
26
+ }
27
+ else {
28
+ console.error(error);
29
+ }
30
+ process.exitCode = process.exitCode ?? 1;
31
+ });
32
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAQA,yCAAoD;AACpD,4CAAsD;AACtD,2CAAqD;AACrD,wDAAmE;AACnE,oDAAgE;AAChE,8CAA0D;AAE1D,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAC9B,OAAO;KACJ,IAAI,CAAC,SAAS,CAAC;KACf,WAAW,CAAC,mEAAmE,CAAC;KAChF,OAAO,CAAC,IAAA,oBAAU,GAAE,CAAC,CAAC;AAEzB,IAAA,0BAAmB,EAAC,OAAO,CAAC,CAAC;AAC7B,IAAA,mCAAuB,EAAC,OAAO,CAAC,CAAC;AACjC,IAAA,gCAAsB,EAAC,OAAO,CAAC,CAAC;AAIhC,OAAO,CAAC,YAAY,EAAE,CAAC;AAEvB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC/C,IAAI,KAAK,YAAY,0BAAc,EAAE,CAAC;QAEpC,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAClC,OAAO;IACT,CAAC;IACD,IAAI,KAAK,YAAY,kBAAQ,IAAI,KAAK,YAAY,0BAAkB,EAAE,CAAC;QACrE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;AAC3C,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function resizeCoverPng(source: Buffer, maxDimension?: number): Buffer;
2
+ //# sourceMappingURL=dialog-cover-resize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-cover-resize.d.ts","sourceRoot":"","sources":["../src/dialog-cover-resize.ts"],"names":[],"mappings":"AAgBA,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,GAAE,MAAY,GAAG,MAAM,CASjF"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resizeCoverPng = resizeCoverPng;
4
+ const pngjs_1 = require("pngjs");
5
+ function resizeCoverPng(source, maxDimension = 120) {
6
+ const png = pngjs_1.PNG.sync.read(source);
7
+ const scale = Math.min(1, maxDimension / Math.max(png.width, png.height));
8
+ const targetWidth = Math.max(1, Math.round(png.width * scale));
9
+ const targetHeight = Math.max(1, Math.round(png.height * scale));
10
+ const resized = new pngjs_1.PNG({ width: targetWidth, height: targetHeight });
11
+ boxResize(png, resized);
12
+ return pngjs_1.PNG.sync.write(resized);
13
+ }
14
+ function boxResize(src, dest) {
15
+ const xRatio = src.width / dest.width;
16
+ const yRatio = src.height / dest.height;
17
+ for (let destY = 0; destY < dest.height; destY++) {
18
+ const srcYStart = Math.floor(destY * yRatio);
19
+ const srcYEnd = Math.max(srcYStart + 1, Math.floor((destY + 1) * yRatio));
20
+ for (let destX = 0; destX < dest.width; destX++) {
21
+ const srcXStart = Math.floor(destX * xRatio);
22
+ const srcXEnd = Math.max(srcXStart + 1, Math.floor((destX + 1) * xRatio));
23
+ let r = 0;
24
+ let g = 0;
25
+ let b = 0;
26
+ let a = 0;
27
+ let count = 0;
28
+ for (let srcY = srcYStart; srcY < srcYEnd && srcY < src.height; srcY++) {
29
+ for (let srcX = srcXStart; srcX < srcXEnd && srcX < src.width; srcX++) {
30
+ const srcIdx = (src.width * srcY + srcX) << 2;
31
+ r += src.data[srcIdx];
32
+ g += src.data[srcIdx + 1];
33
+ b += src.data[srcIdx + 2];
34
+ a += src.data[srcIdx + 3];
35
+ count++;
36
+ }
37
+ }
38
+ const destIdx = (dest.width * destY + destX) << 2;
39
+ dest.data[destIdx] = Math.round(r / count);
40
+ dest.data[destIdx + 1] = Math.round(g / count);
41
+ dest.data[destIdx + 2] = Math.round(b / count);
42
+ dest.data[destIdx + 3] = Math.round(a / count);
43
+ }
44
+ }
45
+ }
46
+ //# sourceMappingURL=dialog-cover-resize.js.map