@voxgig/sdkgen 3.4.7 → 3.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 (194) hide show
  1. package/bin/voxgig-sdkgen +78 -10
  2. package/dist/action/action.d.ts +5 -2
  3. package/dist/action/action.js +113 -6
  4. package/dist/action/action.js.map +1 -1
  5. package/dist/action/check.d.ts +15 -0
  6. package/dist/action/check.js +347 -0
  7. package/dist/action/check.js.map +1 -0
  8. package/dist/action/dispatch.d.ts +8 -0
  9. package/dist/action/dispatch.js +74 -0
  10. package/dist/action/dispatch.js.map +1 -0
  11. package/dist/action/docs.d.ts +4 -0
  12. package/dist/action/docs.js +236 -0
  13. package/dist/action/docs.js.map +1 -0
  14. package/dist/action/doctor.d.ts +5 -2
  15. package/dist/action/doctor.js +526 -74
  16. package/dist/action/doctor.js.map +1 -1
  17. package/dist/action/feature.js +96 -17
  18. package/dist/action/feature.js.map +1 -1
  19. package/dist/action/kind.d.ts +30 -0
  20. package/dist/action/kind.js +258 -0
  21. package/dist/action/kind.js.map +1 -0
  22. package/dist/action/package.d.ts +25 -0
  23. package/dist/action/package.js +852 -0
  24. package/dist/action/package.js.map +1 -0
  25. package/dist/action/resolve.d.ts +18 -0
  26. package/dist/action/resolve.js +280 -0
  27. package/dist/action/resolve.js.map +1 -0
  28. package/dist/action/target.d.ts +7 -1
  29. package/dist/action/target.js +240 -97
  30. package/dist/action/target.js.map +1 -1
  31. package/dist/cmp/Docs.d.ts +4 -0
  32. package/dist/cmp/Docs.js +98 -0
  33. package/dist/cmp/Docs.js.map +1 -0
  34. package/dist/cmp/ExternalDocs.d.ts +2 -0
  35. package/dist/cmp/ExternalDocs.js +43 -0
  36. package/dist/cmp/ExternalDocs.js.map +1 -0
  37. package/dist/helpers/definition.d.ts +5 -0
  38. package/dist/helpers/definition.js +72 -0
  39. package/dist/helpers/definition.js.map +1 -0
  40. package/dist/helpers/featureSource.d.ts +8 -2
  41. package/dist/helpers/featureSource.js +61 -12
  42. package/dist/helpers/featureSource.js.map +1 -1
  43. package/dist/helpers/junk.d.ts +11 -0
  44. package/dist/helpers/junk.js +149 -0
  45. package/dist/helpers/junk.js.map +1 -0
  46. package/dist/helpers/manifest.d.ts +50 -0
  47. package/dist/helpers/manifest.js +328 -0
  48. package/dist/helpers/manifest.js.map +1 -0
  49. package/dist/helpers/modelcheck.d.ts +22 -0
  50. package/dist/helpers/modelcheck.js +203 -0
  51. package/dist/helpers/modelcheck.js.map +1 -0
  52. package/dist/helpers/semver.d.ts +4 -0
  53. package/dist/helpers/semver.js +174 -0
  54. package/dist/helpers/semver.js.map +1 -0
  55. package/dist/helpers/shipped.d.ts +4 -0
  56. package/dist/helpers/shipped.js +36 -0
  57. package/dist/helpers/shipped.js.map +1 -0
  58. package/dist/helpers/stdrep.d.ts +9 -1
  59. package/dist/helpers/stdrep.js +22 -0
  60. package/dist/helpers/stdrep.js.map +1 -1
  61. package/dist/sdkgen.d.ts +15 -3
  62. package/dist/sdkgen.js +233 -67
  63. package/dist/sdkgen.js.map +1 -1
  64. package/dist/tsconfig.tsbuildinfo +1 -1
  65. package/dist/types.d.ts +10 -2
  66. package/dist/utility.js +17 -0
  67. package/dist/utility.js.map +1 -1
  68. package/model/sdkgen.aontu +69 -0
  69. package/package.json +3 -2
  70. package/project/.sdk/model/feature/audit.aontu +1 -0
  71. package/project/.sdk/model/feature/cache.aontu +1 -0
  72. package/project/.sdk/model/feature/clienttrack.aontu +1 -0
  73. package/project/.sdk/model/feature/debug.aontu +1 -0
  74. package/project/.sdk/model/feature/idempotency.aontu +1 -0
  75. package/project/.sdk/model/feature/log.aontu +1 -0
  76. package/project/.sdk/model/feature/metrics.aontu +1 -0
  77. package/project/.sdk/model/feature/netsim.aontu +1 -0
  78. package/project/.sdk/model/feature/paging.aontu +1 -0
  79. package/project/.sdk/model/feature/proxy.aontu +1 -0
  80. package/project/.sdk/model/feature/ratelimit.aontu +1 -0
  81. package/project/.sdk/model/feature/rbac.aontu +1 -0
  82. package/project/.sdk/model/feature/retry.aontu +1 -0
  83. package/project/.sdk/model/feature/streaming.aontu +1 -0
  84. package/project/.sdk/model/feature/telemetry.aontu +1 -0
  85. package/project/.sdk/model/feature/test.aontu +1 -0
  86. package/project/.sdk/model/feature/timeout.aontu +1 -0
  87. package/project/.sdk/model/target/c.aontu +1 -0
  88. package/project/.sdk/model/target/clojure.aontu +1 -0
  89. package/project/.sdk/model/target/cpp.aontu +1 -0
  90. package/project/.sdk/model/target/dart.aontu +1 -0
  91. package/project/.sdk/model/target/elixir.aontu +1 -0
  92. package/project/.sdk/model/target/go-cli.aontu +1 -0
  93. package/project/.sdk/model/target/go-mcp.aontu +1 -0
  94. package/project/.sdk/model/target/go.aontu +1 -0
  95. package/project/.sdk/model/target/haskell.aontu +1 -0
  96. package/project/.sdk/model/target/java.aontu +1 -0
  97. package/project/.sdk/model/target/js.aontu +1 -0
  98. package/project/.sdk/model/target/kotlin.aontu +1 -0
  99. package/project/.sdk/model/target/lean.aontu +1 -0
  100. package/project/.sdk/model/target/lua.aontu +1 -0
  101. package/project/.sdk/model/target/ocaml.aontu +1 -0
  102. package/project/.sdk/model/target/perl.aontu +1 -0
  103. package/project/.sdk/model/target/php.aontu +1 -0
  104. package/project/.sdk/model/target/py-data.aontu +1 -0
  105. package/project/.sdk/model/target/py.aontu +1 -0
  106. package/project/.sdk/model/target/rb.aontu +1 -0
  107. package/project/.sdk/model/target/rust.aontu +1 -0
  108. package/project/.sdk/model/target/scala.aontu +1 -0
  109. package/project/.sdk/model/target/seneca-provider.aontu +1 -0
  110. package/project/.sdk/model/target/zig.aontu +1 -0
  111. package/project/.sdk/src/cmp/c/Config_c.ts +44 -0
  112. package/project/.sdk/src/cmp/c/fragment/Main.fragment.c +3 -1
  113. package/project/.sdk/src/cmp/clojure/Config_clojure.ts +37 -42
  114. package/project/.sdk/src/cmp/clojure/utility_clojure.ts +42 -0
  115. package/project/.sdk/src/cmp/cpp/Config_cpp.ts +18 -0
  116. package/project/.sdk/src/cmp/csharp/Config_csharp.ts +125 -52
  117. package/project/.sdk/src/cmp/csharp/fragment/Main.fragment.cs +3 -1
  118. package/project/.sdk/src/cmp/csharp/utility_csharp.ts +94 -6
  119. package/project/.sdk/src/cmp/dart/Config_dart.ts +43 -5
  120. package/project/.sdk/src/cmp/dart/fragment/Config.data.fragment.dart +74 -0
  121. package/project/.sdk/src/cmp/dart/fragment/Config.fragment.dart +6 -9
  122. package/project/.sdk/src/cmp/dart/fragment/Main.fragment.dart +16 -5
  123. package/project/.sdk/src/cmp/dart/utility_dart.ts +18 -0
  124. package/project/.sdk/src/cmp/elixir/Config_elixir.ts +128 -13
  125. package/project/.sdk/src/cmp/elixir/fragment/Main.fragment.ex +3 -1
  126. package/project/.sdk/src/cmp/elixir/utility_elixir.ts +6 -0
  127. package/project/.sdk/src/cmp/haskell/Config_haskell.ts +35 -52
  128. package/project/.sdk/src/cmp/haskell/Package_haskell.ts +1 -0
  129. package/project/.sdk/src/cmp/haskell/Test_haskell.ts +1 -1
  130. package/project/.sdk/src/cmp/haskell/utility_haskell.ts +15 -5
  131. package/project/.sdk/src/cmp/java/Config_java.ts +21 -0
  132. package/project/.sdk/src/cmp/kotlin/Config_kotlin.ts +15 -0
  133. package/project/.sdk/src/cmp/ocaml/Config_ocaml.ts +42 -39
  134. package/project/.sdk/src/cmp/perl/Config_perl.ts +15 -0
  135. package/project/.sdk/src/cmp/perl/fragment/Main.fragment.pm +3 -1
  136. package/project/.sdk/src/cmp/rust/Config_rust.ts +44 -0
  137. package/project/.sdk/src/cmp/rust/fragment/Main.fragment.rs +4 -2
  138. package/project/.sdk/src/cmp/scala/Config_scala.ts +15 -0
  139. package/project/.sdk/src/cmp/swift/Config_swift.ts +17 -0
  140. package/project/.sdk/src/cmp/swift/fragment/Main.fragment.swift +3 -1
  141. package/project/.sdk/src/cmp/zig/Config_zig.ts +44 -0
  142. package/project/.sdk/src/cmp/zig/TestEntity_zig.ts +9 -2
  143. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +3 -1
  144. package/project/.sdk/tm/c/core/sdk.h +1 -0
  145. package/project/.sdk/tm/c/utility/make_options.c +5 -1
  146. package/project/.sdk/tm/clojure/src/sdk/core.clj +51 -3
  147. package/project/.sdk/tm/cpp/core/types.hpp +4 -1
  148. package/project/.sdk/tm/cpp/utility/pipeline.hpp +5 -1
  149. package/project/.sdk/tm/csharp/test/PipelineTest.cs +15 -0
  150. package/project/.sdk/tm/csharp/utility/MakeOptions.cs +67 -1
  151. package/project/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +43 -0
  152. package/project/.sdk/tm/elixir/lib/projectname/utility.ex +58 -2
  153. package/project/.sdk/tm/haskell/{test/TestJson.hs → src/SdkJson.hs} +8 -4
  154. package/project/.sdk/tm/haskell/src/SdkRuntime.hs +55 -2
  155. package/project/.sdk/tm/haskell/test/Runner.hs +1 -1
  156. package/project/.sdk/tm/haskell/test/StructCorpus.hs +1 -1
  157. package/project/.sdk/tm/java/core/SdkClient.java +3 -1
  158. package/project/.sdk/tm/java/utility/MakeOptions.java +5 -1
  159. package/project/.sdk/tm/kotlin/core/SdkClient.kt +3 -1
  160. package/project/.sdk/tm/kotlin/utility/MakeOptions.kt +5 -1
  161. package/project/.sdk/tm/ocaml/Makefile +3 -2
  162. package/project/.sdk/tm/ocaml/sdk_json.ml +106 -0
  163. package/project/.sdk/tm/ocaml/sdk_runtime.ml +56 -0
  164. package/project/.sdk/tm/ocaml/test/struct_corpus.ml +4 -86
  165. package/project/.sdk/tm/perl/utility/make_options.pm +5 -1
  166. package/project/.sdk/tm/rust/utility/make_options.rs +79 -1
  167. package/project/.sdk/tm/scala/core/SdkClient.scala +3 -1
  168. package/project/.sdk/tm/scala/utility/Make.scala +5 -1
  169. package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/MakeOptions.swift +5 -1
  170. package/project/.sdk/tm/zig/core/utility.zig +85 -1
  171. package/project/sdkgen-package.json +57 -0
  172. package/src/action/action.ts +136 -6
  173. package/src/action/check.ts +495 -0
  174. package/src/action/dispatch.ts +105 -0
  175. package/src/action/docs.ts +310 -0
  176. package/src/action/doctor.ts +692 -81
  177. package/src/action/feature.ts +109 -17
  178. package/src/action/kind.ts +375 -0
  179. package/src/action/package.ts +1173 -0
  180. package/src/action/resolve.ts +362 -0
  181. package/src/action/target.ts +290 -108
  182. package/src/cmp/Docs.ts +125 -0
  183. package/src/cmp/ExternalDocs.ts +54 -0
  184. package/src/helpers/definition.ts +82 -0
  185. package/src/helpers/featureSource.ts +83 -13
  186. package/src/helpers/junk.ts +168 -0
  187. package/src/helpers/manifest.ts +474 -0
  188. package/src/helpers/modelcheck.ts +262 -0
  189. package/src/helpers/semver.ts +211 -0
  190. package/src/helpers/shipped.ts +41 -0
  191. package/src/helpers/stdrep.ts +70 -0
  192. package/src/sdkgen.ts +294 -66
  193. package/src/types.ts +33 -3
  194. package/src/utility.ts +17 -0
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // The Root for a DOCS item that generates outside the SDK repo
3
+ // (`main: kit: docs: <n>: output: path`).
4
+ //
5
+ // Out of tree is the NORMAL case for a docs item, not the exception it is for
6
+ // a target: a documentation site usually has its own repo, and in-tree it
7
+ // would collide with the SDK repo's own README and CI workflows.
8
+ //
9
+ // The two facts that make this a separate `generate()` pass rather than a
10
+ // folder are the ones `ExternalTarget` documents at length: jostraca's
11
+ // `FileHandler.validName` refuses a `..` segment in a folder name (the guard
12
+ // that keeps generation inside the tree it was pointed at, not an oversight
13
+ // to route around), and the output root is `jopts.folder` PER CALL — so
14
+ // writing somewhere else means another call.
15
+ //
16
+ // No Folder wraps the item: the destination IS the site, so its files go at
17
+ // the root of the output path.
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ExternalDocs = void 0;
20
+ const jostraca_1 = require("jostraca");
21
+ const Docs_1 = require("./Docs");
22
+ const ExternalDocs = (0, jostraca_1.cmp)(function ExternalDocs(props) {
23
+ const { model, item, cmpfolder, sdkrelpath } = props;
24
+ const ctx$ = props.ctx$;
25
+ // Components live in the PROJECT, not in the repo being written to. This
26
+ // pass has retargeted jostraca's output folder, which is what requirePath
27
+ // otherwise resolves against — see utility.resolvePath. Losing this line
28
+ // makes the pass look for components under the DESTINATION.
29
+ ctx$.cmpfolder = cmpfolder;
30
+ // The path from the destination back to the SDK project, for a site that
31
+ // sits beside the SDK in a known layout and needs to name it.
32
+ ctx$.sdkrelpath = sdkrelpath;
33
+ // The same preamble the in-tree pass performs — one definition, both
34
+ // callers, because a project whose ONLY docs item is out of tree must
35
+ // generate exactly as one with both.
36
+ (0, Docs_1.prepareModel)(model, ctx$);
37
+ (0, jostraca_1.Project)({}, () => {
38
+ (0, jostraca_1.names)(item, item.name ?? item.key$);
39
+ (0, Docs_1.DocsItem)({ item });
40
+ });
41
+ });
42
+ exports.ExternalDocs = ExternalDocs;
43
+ //# sourceMappingURL=ExternalDocs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExternalDocs.js","sourceRoot":"","sources":["../../src/cmp/ExternalDocs.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,0CAA0C;AAC1C,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,iEAAiE;AACjE,EAAE;AACF,0EAA0E;AAC1E,uEAAuE;AACvE,6EAA6E;AAC7E,4EAA4E;AAC5E,wEAAwE;AACxE,6CAA6C;AAC7C,EAAE;AACF,4EAA4E;AAC5E,+BAA+B;;;AAE/B,uCAA8C;AAI9C,iCAA+C;AAG/C,MAAM,YAAY,GAAG,IAAA,cAAG,EAAC,SAAS,YAAY,CAAC,KAAU;IACvD,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,KAAK,CAAA;IACpD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;IAEvB,yEAAyE;IACzE,0EAA0E;IAC1E,yEAAyE;IACzE,4DAA4D;IAC5D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAE1B,yEAAyE;IACzE,8DAA8D;IAC9D,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAE5B,qEAAqE;IACrE,sEAAsE;IACtE,qCAAqC;IACrC,IAAA,mBAAY,EAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAEzB,IAAA,kBAAO,EAAC,EAAE,EAAE,GAAG,EAAE;QACf,IAAA,gBAAK,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;QAEnC,IAAA,eAAQ,EAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;QAIA,YAAY"}
@@ -0,0 +1,5 @@
1
+ declare function definitionPath(sdkfolder: string, kind: string, name: string): string;
2
+ declare function definitionFolder(sdkfolder: string, kind: string): string;
3
+ declare function indexName(kind: string): string;
4
+ declare function definitionNames(fs: any, sdkfolder: string, kind: string): string[];
5
+ export { definitionPath, definitionFolder, definitionNames, indexName, };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ // WHERE A KIND'S DEFINITION FILES LIVE.
3
+ //
4
+ // `model/<kind>/<name>.aontu`, with `model/<kind>/<kind>-index.aontu` as the
5
+ // include list beside them. One line of path-building — and it was written out
6
+ // longhand in three places (the resolver, the feature catalogue, doctor), each
7
+ // with its own idea of which files in that directory count.
8
+ //
9
+ // That is the same shape of defect this workstream has now fixed four times:
10
+ // the same rule expressed twice, drifting. The manifest makes it four callers,
11
+ // so it becomes one function first.
12
+ //
13
+ // The EXCLUSIONS matter as much as the path. A `model/<kind>/` directory holds
14
+ // the index file (a list of includes, not a definition) and, in the shipped
15
+ // scaffold, a `README.md`. Neither is an item, and a caller that forgets one
16
+ // invents a `feature-index` feature.
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.definitionPath = definitionPath;
22
+ exports.definitionFolder = definitionFolder;
23
+ exports.definitionNames = definitionNames;
24
+ exports.indexName = indexName;
25
+ const node_path_1 = __importDefault(require("node:path"));
26
+ const junk_1 = require("./junk");
27
+ // The definition file for one item.
28
+ function definitionPath(sdkfolder, kind, name) {
29
+ return node_path_1.default.join(sdkfolder, 'model', kind, name + '.aontu');
30
+ }
31
+ // The directory holding a kind's definitions.
32
+ function definitionFolder(sdkfolder, kind) {
33
+ return node_path_1.default.join(sdkfolder, 'model', kind);
34
+ }
35
+ // The include list beside them.
36
+ function indexName(kind) {
37
+ return kind + '-index.aontu';
38
+ }
39
+ // Every item of `kind` a `.sdk` folder DEFINES, sorted. Sorted because it
40
+ // feeds an exact-set comparison against a manifest and, through
41
+ // `availableFeatures`, the feature-trim catalogue — both of which are compared
42
+ // as text, so a readdir order that varies by filesystem would vary the result.
43
+ //
44
+ // An absent directory is not an error: a package providing only features has
45
+ // no `model/target/`, and that is the normal shape of a feature package.
46
+ function definitionNames(fs, sdkfolder, kind) {
47
+ const dir = definitionFolder(sdkfolder, kind);
48
+ const index = indexName(kind);
49
+ // `existsSync` is true for a REGULAR FILE and for a directory this process
50
+ // cannot read, so guarding on it and then calling `readdirSync` let a bare
51
+ // `ENOTDIR`/`EACCES` escape to callers that have no catch — including
52
+ // `featureCatalogue`, which runs on every ordinary `target add`, so the
53
+ // whole add aborted with an errno instead of a diagnostic. Not-a-readable-
54
+ // directory is the same answer as not-there: this kind defines nothing
55
+ // here.
56
+ let entries;
57
+ try {
58
+ entries = fs.readdirSync(dir);
59
+ }
60
+ catch (err) {
61
+ return [];
62
+ }
63
+ // The `.aontu` suffix is not enough on its own: an emacs lock link is named
64
+ // `.#target.aontu` and a merge leaves `target.aontu.orig`, so an editor open
65
+ // in the wrong window invents an item called `.#target`, which then fails to
66
+ // resolve everywhere it is named. See helpers/junk.
67
+ return entries
68
+ .filter((n) => n.endsWith('.aontu') && index !== n && !(0, junk_1.isJunk)(n))
69
+ .map((n) => n.replace(/\.aontu$/, ''))
70
+ .sort();
71
+ }
72
+ //# sourceMappingURL=definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/helpers/definition.ts"],"names":[],"mappings":";AAAA,wCAAwC;AACxC,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,+EAA+E;AAC/E,4DAA4D;AAC5D,EAAE;AACF,6EAA6E;AAC7E,+EAA+E;AAC/E,oCAAoC;AACpC,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,6EAA6E;AAC7E,qCAAqC;;;;;QA+DnC,cAAc;QACd,gBAAgB;QAChB,eAAe;QACf,SAAS;AAhEX,0DAA4B;AAE5B,iCAA+B;AAG/B,oCAAoC;AACpC,SAAS,cAAc,CAAC,SAAiB,EAAE,IAAY,EAAE,IAAY;IACnE,OAAO,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,QAAQ,CAAC,CAAA;AAC7D,CAAC;AAGD,8CAA8C;AAC9C,SAAS,gBAAgB,CAAC,SAAiB,EAAE,IAAY;IACvD,OAAO,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;AAC5C,CAAC;AAGD,gCAAgC;AAChC,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,GAAG,cAAc,CAAA;AAC9B,CAAC;AAGD,0EAA0E;AAC1E,gEAAgE;AAChE,+EAA+E;AAC/E,+EAA+E;AAC/E,EAAE;AACF,6EAA6E;AAC7E,yEAAyE;AACzE,SAAS,eAAe,CAAC,EAAO,EAAE,SAAiB,EAAE,IAAY;IAC/D,MAAM,GAAG,GAAG,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;IAC7C,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAE7B,2EAA2E;IAC3E,2EAA2E;IAC3E,sEAAsE;IACtE,wEAAwE;IACxE,2EAA2E;IAC3E,uEAAuE;IACvE,QAAQ;IACR,IAAI,OAAiB,CAAA;IACrB,IAAI,CAAC;QACH,OAAO,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IAC/B,CAAC;IACD,OAAO,GAAQ,EAAE,CAAC;QAChB,OAAO,EAAE,CAAA;IACX,CAAC;IAED,4EAA4E;IAC5E,6EAA6E;IAC7E,6EAA6E;IAC7E,oDAAoD;IACpD,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,IAAA,aAAM,EAAC,CAAC,CAAC,CAAC;SACxE,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;SAC7C,IAAI,EAAE,CAAA;AACX,CAAC"}
@@ -3,11 +3,17 @@ type FeatureSource = {
3
3
  path: string;
4
4
  folder: boolean;
5
5
  };
6
+ type FeatureEntry = FeatureSource & {
7
+ shaped: boolean;
8
+ };
9
+ declare const BASE_FEATURE = "base";
6
10
  declare function featureOf(entry: string, folder: boolean): string;
7
11
  declare function availableFeatures(fs: any, sdkfolder: string): string[];
12
+ declare function featureShaped(entry: string, folder: boolean): boolean;
13
+ declare function findFeatureEntries(fs: any, tmfolder: string, known: Set<string>): FeatureEntry[];
8
14
  declare function findFeatureSources(fs: any, tmfolder: string, available: string[]): FeatureSource[];
9
15
  declare function featureExcludes(sources: FeatureSource[]): RegExp[];
10
16
  declare function fullsetExcludes(paths: string[]): RegExp[];
11
17
  declare function srcFeatureExcludes(model: any): RegExp[];
12
- export type { FeatureSource, };
13
- export { featureOf, availableFeatures, findFeatureSources, featureExcludes, fullsetExcludes, srcFeatureExcludes, };
18
+ export type { FeatureSource, FeatureEntry, };
19
+ export { BASE_FEATURE, featureOf, featureShaped, availableFeatures, findFeatureEntries, findFeatureSources, featureExcludes, fullsetExcludes, srcFeatureExcludes, };
@@ -37,18 +37,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.BASE_FEATURE = void 0;
40
41
  exports.featureOf = featureOf;
42
+ exports.featureShaped = featureShaped;
41
43
  exports.availableFeatures = availableFeatures;
44
+ exports.findFeatureEntries = findFeatureEntries;
42
45
  exports.findFeatureSources = findFeatureSources;
43
46
  exports.featureExcludes = featureExcludes;
44
47
  exports.fullsetExcludes = fullsetExcludes;
45
48
  exports.srcFeatureExcludes = srcFeatureExcludes;
46
49
  const node_path_1 = __importDefault(require("node:path"));
47
50
  const apidef_1 = require("@voxgig/apidef");
51
+ const definition_1 = require("./definition");
52
+ const junk_1 = require("./junk");
48
53
  // Directory name that marks a feature container. Kept exact (not a substring
49
54
  // match) so `utility/feature_add.go` and `test/feature_test.go` — which are
50
55
  // shared machinery, not per-feature source — are never treated as features.
51
56
  const FEATURE_DIR = 'feature';
57
+ // The always-present foundation every other feature builds on. It has no
58
+ // model file, so it is in no catalogue, and it must never be trimmed or
59
+ // reported as an unrecognised stray — every target ships one.
60
+ const BASE_FEATURE = 'base';
61
+ exports.BASE_FEATURE = BASE_FEATURE;
52
62
  // Derive the feature name an entry inside a feature directory belongs to.
53
63
  // Returns the lowercased name, which the caller then checks against the
54
64
  // available set.
@@ -75,20 +85,42 @@ function featureOf(entry, folder) {
75
85
  // Feature names this generator can supply, read from the scaffold's
76
86
  // `model/feature/*.aontu`. This is the authoritative catalogue: a name not in
77
87
  // it is not a feature, so nothing outside it is ever excluded.
88
+ //
89
+ // LOWERCASED, unlike `definitionNames`, because these are matched against
90
+ // names DERIVED FROM FILENAMES (`RetryFeature.swift` -> `retry`), and the
91
+ // languages disagree about case. The manifest compares definition names as
92
+ // written, so the two callers cannot share the lowercasing.
78
93
  function availableFeatures(fs, sdkfolder) {
79
- const dir = node_path_1.default.join(sdkfolder, 'model', 'feature');
80
- if (!fs.existsSync(dir)) {
81
- return [];
82
- }
83
- return fs.readdirSync(dir)
84
- .filter((n) => n.endsWith('.aontu') && 'feature-index.aontu' !== n)
85
- .map((n) => n.replace(/\.aontu$/, '').toLowerCase())
94
+ return (0, definition_1.definitionNames)(fs, sdkfolder, 'feature')
95
+ .map((n) => n.toLowerCase())
86
96
  .sort();
87
97
  }
88
- // Walk a target's template tree and return every per-feature source entry.
89
- // `tmfolder` is the target template root (`<sdk>/tm/<lang>`).
90
- function findFeatureSources(fs, tmfolder, available) {
91
- const known = new Set(available);
98
+ // Does the entry LOOK like per-feature source, whatever it is called?
99
+ //
100
+ // The naming conventions carry the intent: `<name>_feature.<ext>`,
101
+ // `<Name>Feature.<ext>`, and a directory named for the feature. A bare
102
+ // `<name>.<ext>` does NOT — `retry.rs` and `support.rs` are written the same
103
+ // way, so shape cannot separate rust's feature source from rust's shared
104
+ // machinery, and only the catalogue can. That is the deliberate blind spot of
105
+ // `package check`'s unrecognised-source finding: it reports what it can prove
106
+ // looks like a feature, and stays quiet where it would have to guess.
107
+ function featureShaped(entry, folder) {
108
+ if (folder) {
109
+ return true;
110
+ }
111
+ const stem = entry.replace(/\.[^.]+$/, '');
112
+ return /_feature$/i.test(stem) || /Feature$/.test(stem);
113
+ }
114
+ // Every entry inside a feature container of a target's template tree —
115
+ // whether or not its derived name is a feature this generator knows.
116
+ //
117
+ // `known` decides DESCENT, not membership: a directory that names a known
118
+ // feature is the whole feature, so the walk stops there, and one that does
119
+ // not is walked through (`src/feature/base/` holds `BaseFeature.ts`, and the
120
+ // container rule below then ignores it because its parent is not `feature`).
121
+ // The unknown entries are what `package check` reports and what
122
+ // `findFeatureSources` drops; both need the same walk, so there is one.
123
+ function findFeatureEntries(fs, tmfolder, known) {
92
124
  const found = [];
93
125
  if (!fs.existsSync(tmfolder)) {
94
126
  return found;
@@ -98,6 +130,13 @@ function findFeatureSources(fs, tmfolder, available) {
98
130
  const abs = '' === rel ? tmfolder : node_path_1.default.join(tmfolder, rel);
99
131
  const entries = fs.readdirSync(abs).sort();
100
132
  for (const entry of entries) {
133
+ // A `__pycache__` inside `src/feature/` is not a feature — but every
134
+ // rule here derives a feature NAME from an entry name, so without this
135
+ // it becomes one: reported by `package check` as an unknown feature, and
136
+ // trimmed (or not) as if it were source. See helpers/junk.
137
+ if ((0, junk_1.isJunk)(entry)) {
138
+ continue;
139
+ }
101
140
  const entryrel = '' === rel ? entry : rel + '/' + entry;
102
141
  const folder = fs.statSync(node_path_1.default.join(tmfolder, entryrel)).isDirectory();
103
142
  // Inside a feature container every entry is a candidate, and a
@@ -105,8 +144,10 @@ function findFeatureSources(fs, tmfolder, available) {
105
144
  // looking for more.
106
145
  if (FEATURE_DIR === node_path_1.default.basename(rel)) {
107
146
  const name = featureOf(entry, folder);
147
+ found.push({
148
+ name, path: entryrel, folder, shaped: featureShaped(entry, folder),
149
+ });
108
150
  if (known.has(name)) {
109
- found.push({ name, path: entryrel, folder });
110
151
  continue;
111
152
  }
112
153
  }
@@ -118,6 +159,14 @@ function findFeatureSources(fs, tmfolder, available) {
118
159
  walk('');
119
160
  return found;
120
161
  }
162
+ // Walk a target's template tree and return every per-feature source entry.
163
+ // `tmfolder` is the target template root (`<sdk>/tm/<lang>`).
164
+ function findFeatureSources(fs, tmfolder, available) {
165
+ const known = new Set(available);
166
+ return findFeatureEntries(fs, tmfolder, known)
167
+ .filter((e) => known.has(e.name))
168
+ .map(({ name, path, folder }) => ({ name, path, folder }));
169
+ }
121
170
  // Turn discovered sources into path patterns for a jostraca `Copy` exclude.
122
171
  //
123
172
  // jostraca tests each candidate against the path built up during its walk,
@@ -1 +1 @@
1
- {"version":3,"file":"featureSource.js","sourceRoot":"","sources":["../../src/helpers/featureSource.ts"],"names":[],"mappings":";AAAA,iEAAiE;AACjE,EAAE;AACF,kBAAkB;AAClB,EAAE;AACF,qEAAqE;AACrE,yEAAyE;AACzE,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AAqE;AACrE,EAAE;AACF,uEAAuE;AACvE,yEAAyE;AACzE,wEAAwE;AACxE,4EAA4E;AAC5E,sDAAsD;AACtD,EAAE;AACF,6EAA6E;AAC7E,0CAA0C;AAC1C,SAAS,kBAAkB,CAAC,KAAU;IACpC,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,KAAK,EAAE,QAAQ,YAAG,UAAU,EACnD,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,CAAA;IAChD,MAAM,MAAM,GAAG,IAAA,qBAAY,EAAC,KAAK,EAAE,QAAQ,YAAG,UAAU,EACtD,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,CAAA;IAE5B,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;SACpB,MAAM,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;SAC9C,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,MAAM,CAC/B,mBAAmB,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG,GAAG,CACxE,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,11 @@
1
+ declare const NOISE: RegExp[];
2
+ declare const BUILD: RegExp[];
3
+ declare const JUNK: RegExp[];
4
+ declare function isJunk(name: string): boolean;
5
+ declare function isNoise(name: string): boolean;
6
+ declare function copyOpts(): {
7
+ Copy: {
8
+ ignore: RegExp[];
9
+ };
10
+ };
11
+ export { JUNK, NOISE, BUILD, isJunk, isNoise, copyOpts, };
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ // WHAT NEVER COUNTS AS CONTENT.
3
+ //
4
+ // Every tree sdkgen reads — the scaffold's `tm/<lang>` and `src/cmp/<lang>`, an
5
+ // external package's `.sdk`, a project's own copies of both — is a DIRECTORY ON
6
+ // A DEVELOPER'S MACHINE, and a developer's machine drops things in directories:
7
+ // `.DS_Store` from the Finder, `__pycache__` from running a python module,
8
+ // `node_modules` from an `npm install` in the wrong shell, a `~` backup from an
9
+ // editor. None of it is authored, none of it is tracked (it is all gitignored),
10
+ // and all of it is invisible in `git status` — so the first thing that notices
11
+ // is whatever compares two trees.
12
+ //
13
+ // It bit as: a stray `tm/py/utility/__pycache__/make_options.cpython-314.pyc`,
14
+ // created in August by running that module in place, copied verbatim by
15
+ // `target add py` into the add output, and reported by the golden-manifest test
16
+ // as toolchain drift. The copy is the real problem — the test only saw it. Left
17
+ // alone, that `.pyc` ships into every consumer's SDK repo, compiled against
18
+ // whatever python the maintainer happened to have.
19
+ //
20
+ // The rule is one list, in one place, applied by everything that walks a tree:
21
+ // the WRITER (jostraca's Copy, through `cmp.Copy.ignore`, plus the two walks
22
+ // target-add does itself) and every READER that compares against what the
23
+ // writer produced (doctor's drift walk, the feature-source scan, the definition
24
+ // listing). A writer and a reader that disagree about what counts report the
25
+ // whole tree as a fork — the same discipline `templateReplacements` and
26
+ // `aliasCmpName` are held to, and for the same reason.
27
+ //
28
+ // MEMBERSHIP IS A PROMISE that no template will ever legitimately carry that
29
+ // name, so this list holds only what a TOOL creates and a person does not: no
30
+ // `build`, `dist`, `bin` or `out` (a template may well ship one), and
31
+ // emphatically no `target` — sdkgen's own model directory is called that, and
32
+ // it is also where cargo and maven put their output. `test/junk.test.ts` checks
33
+ // the list against every name in the shipped scaffold, so an over-broad pattern
34
+ // fails there rather than by silently dropping a file from someone's SDK.
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.BUILD = exports.NOISE = exports.JUNK = void 0;
37
+ exports.isJunk = isJunk;
38
+ exports.isNoise = isNoise;
39
+ exports.copyOpts = copyOpts;
40
+ // All of these are matched against the BARE NAME of a directory entry, not its
41
+ // path — the same way jostraca's `cmp.Copy.ignore` is applied, so that naming a
42
+ // directory prunes its whole subtree without every caller having to spell out
43
+ // what is inside it.
44
+ // Droppings that are not output of anything: an editor, the Finder, or a
45
+ // version control system left them, and they occupy no space in the meaning of
46
+ // the tree. Kept separate from BUILD because "would we copy this" and "is this
47
+ // directory empty" are different questions, and only this half answers both —
48
+ // a destination holding `node_modules` is not empty by any reading.
49
+ const NOISE = [
50
+ // Editors and merges. `~` duplicates jostraca's built-in `IGNORED_RE`,
51
+ // deliberately: that one governs its Copy walk alone, and the walks sdkgen
52
+ // does itself (the prune, the feature scan) have to agree with it.
53
+ /~$/, // editor backup
54
+ /^\.#/, // emacs lock link
55
+ /^#.*#$/, // emacs autosave
56
+ /\.sw[a-p]$/, // vim swap
57
+ /\.(bak|orig|rej)$/, // backups, and what a conflicted merge leaves behind
58
+ // Operating systems.
59
+ /^\.DS_Store$/,
60
+ /^__MACOSX$/,
61
+ /^Thumbs\.db$/i,
62
+ /^desktop\.ini$/i,
63
+ // Version control. A nested checkout inside a template tree is never the
64
+ // payload, and copying one produces a project git cannot make sense of.
65
+ /^\.git$/,
66
+ /^\.svn$/,
67
+ /^\.hg$/,
68
+ /^\.idea$/, // not `.vscode` — an SDK may ship editor settings
69
+ ];
70
+ exports.NOISE = NOISE;
71
+ // Toolchain output, per language. Each of these appears exactly when someone
72
+ // runs that language's tools inside a template tree, which is the normal way to
73
+ // check that a template actually works — and none of them is ever the payload.
74
+ const BUILD = [
75
+ /^node_modules$/,
76
+ /^__pycache__$/,
77
+ /\.py[co]$/,
78
+ /^\.(pytest|mypy|ruff)_cache$/,
79
+ /^\.tox$/,
80
+ /^\.venv$/,
81
+ /^\.gradle$/,
82
+ /\.class$/,
83
+ /^\.dart_tool$/,
84
+ /^\.?zig-cache$/,
85
+ /^zig-out$/,
86
+ /^_build$/, // mix, dune
87
+ /^\.elixir_ls$/,
88
+ /^\.cpcache$/, // clojure
89
+ /^\.stack-work$/,
90
+ /^dist-newstyle$/, // cabal
91
+ /^\.cargo$/,
92
+ ];
93
+ exports.BUILD = BUILD;
94
+ const JUNK = [...NOISE, ...BUILD];
95
+ exports.JUNK = JUNK;
96
+ // Is this directory entry something no tree operation should see?
97
+ function isJunk(name) {
98
+ return matches(name, JUNK);
99
+ }
100
+ // Weaker: does this entry leave a directory as good as empty? Toolchain output
101
+ // does NOT — it is junk to copy and content to find.
102
+ function isNoise(name) {
103
+ return matches(name, NOISE);
104
+ }
105
+ function matches(name, patterns) {
106
+ for (const re of patterns) {
107
+ // These are module-level regexes reused across every entry of every tree.
108
+ // None carries `g` or `y` today, but a `test` on a stateful regex resumes
109
+ // from the previous match and would skip every other file — the exact bug
110
+ // jostraca's own `excluded()` carries a comment about.
111
+ re.lastIndex = 0;
112
+ if (re.test(name)) {
113
+ return true;
114
+ }
115
+ }
116
+ return false;
117
+ }
118
+ // The jostraca `cmp` option block, which is how the WRITER side of the rule is
119
+ // applied: jostraca tests `cmp.Copy.ignore` against the bare name of every
120
+ // entry it walks, directories included, and prunes what matches.
121
+ //
122
+ // Passed PER CALL by each action, not left to the Jostraca instance — the same
123
+ // discipline `control.dryrun` is held to, and for a related reason: the actions
124
+ // take whatever instance their caller hands them (`actx.jostraca`), and a
125
+ // consumer that builds its own would otherwise silently lose the filter. A
126
+ // per-call value is merged last and wins.
127
+ //
128
+ // `/~$/` is first, and must stay first while any supported jostraca is at or
129
+ // below 0.31.0. That merge takes this list over its own default of `[/~$/]`
130
+ // with `deep()`, which recursed INTO index 0 — two RegExps are both objects, so
131
+ // it iterated the incoming one's enumerable properties, of which a RegExp has
132
+ // none, and kept the default. Whatever sat at index 0 was silently discarded.
133
+ // Leading with the value already there makes that a no-op instead of a hole,
134
+ // and jostraca's built-in `IGNORED_RE` covers `~` anyway.
135
+ //
136
+ // FIXED UPSTREAM (jostraca `deep` now replaces a custom-constructor value
137
+ // rather than walking into it), so this is compatibility, not a live
138
+ // workaround: harmless on a fixed jostraca, load-bearing on an older one.
139
+ //
140
+ // A FRESH object each call: `deep` mutates its base, and jostraca's merge order
141
+ // leaves these values reachable from options it keeps.
142
+ function copyOpts() {
143
+ return {
144
+ Copy: {
145
+ ignore: [/~$/, ...JUNK]
146
+ }
147
+ };
148
+ }
149
+ //# sourceMappingURL=junk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"junk.js","sourceRoot":"","sources":["../../src/helpers/junk.ts"],"names":[],"mappings":";AAAA,gCAAgC;AAChC,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAChF,2EAA2E;AAC3E,gFAAgF;AAChF,gFAAgF;AAChF,+EAA+E;AAC/E,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,wEAAwE;AACxE,gFAAgF;AAChF,gFAAgF;AAChF,4EAA4E;AAC5E,mDAAmD;AACnD,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,0EAA0E;AAC1E,gFAAgF;AAChF,6EAA6E;AAC7E,wEAAwE;AACxE,uDAAuD;AACvD,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,sEAAsE;AACtE,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,0EAA0E;;;QAoIxE,MAAM;QACN,OAAO;QACP,QAAQ;AApIV,+EAA+E;AAC/E,gFAAgF;AAChF,8EAA8E;AAC9E,qBAAqB;AAGrB,yEAAyE;AACzE,+EAA+E;AAC/E,+EAA+E;AAC/E,8EAA8E;AAC9E,oEAAoE;AACpE,MAAM,KAAK,GAAa;IACtB,uEAAuE;IACvE,2EAA2E;IAC3E,mEAAmE;IACnE,IAAI,EAAkB,gBAAgB;IACtC,MAAM,EAAgB,kBAAkB;IACxC,QAAQ,EAAc,iBAAiB;IACvC,YAAY,EAAU,WAAW;IACjC,mBAAmB,EAAG,qDAAqD;IAE3E,qBAAqB;IACrB,cAAc;IACd,YAAY;IACZ,eAAe;IACf,iBAAiB;IAEjB,yEAAyE;IACzE,wEAAwE;IACxE,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU,EAAY,kDAAkD;CACzE,CAAA;QA+FC,KAAK;AA5FP,6EAA6E;AAC7E,gFAAgF;AAChF,+EAA+E;AAC/E,MAA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;AAC1E,qEAAqE;AACrE,0EAA0E;AAC1E,EAAE;AACF,gFAAgF;AAChF,uDAAuD;AACvD,SAAS,QAAQ;IACf,OAAO;QACL,IAAI,EAAE;YACJ,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;SACxB;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,50 @@
1
+ declare const MANIFEST = "sdkgen-package.json";
2
+ declare const SCHEMA = 1;
3
+ type Manifest = {
4
+ sdkgen: {
5
+ package: number;
6
+ };
7
+ name: string;
8
+ version?: string;
9
+ engines?: {
10
+ sdkgen?: string;
11
+ };
12
+ provides: Record<string, string[]>;
13
+ targetsSupported?: Record<string, string[]>;
14
+ parity?: Record<string, string>;
15
+ };
16
+ type ManifestRead = {
17
+ file: string;
18
+ manifest?: Manifest;
19
+ err?: string;
20
+ };
21
+ type Finding = {
22
+ level: 'error' | 'warn' | 'info';
23
+ point: string;
24
+ note: string;
25
+ kind?: string;
26
+ name?: string;
27
+ file?: string;
28
+ };
29
+ declare function manifestPath(sdkfolder: string): string;
30
+ declare function readManifest(fs: any, sdkfolder: string): ManifestRead;
31
+ declare function checkShape(manifest: Manifest, file: string): Finding[];
32
+ declare const ITEM_NAME_RE: RegExp;
33
+ declare function validateManifest(fs: any, sdkfolder: string, manifest: Manifest, kinds: Record<string, {
34
+ trees?: {
35
+ path: string;
36
+ required: boolean;
37
+ }[];
38
+ }>): Finding[];
39
+ type PackageProbe = {
40
+ ref: string;
41
+ root: string;
42
+ sdk: string;
43
+ read: ManifestRead;
44
+ };
45
+ declare function probePackage(fs: any, project: string, ref: string): {
46
+ found?: PackageProbe;
47
+ search: string[];
48
+ };
49
+ export type { Manifest, ManifestRead, PackageProbe, Finding, };
50
+ export { MANIFEST, SCHEMA, ITEM_NAME_RE, manifestPath, probePackage, readManifest, validateManifest, checkShape, };