@haneullabs/codegen 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +259 -0
  2. package/README.md +195 -0
  3. package/dist/cjs/bin/bash-complete.d.ts +2 -0
  4. package/dist/cjs/bin/bash-complete.js +51 -0
  5. package/dist/cjs/bin/bash-complete.js.map +7 -0
  6. package/dist/cjs/bin/cli.d.ts +2 -0
  7. package/dist/cjs/bin/cli.js +34 -0
  8. package/dist/cjs/bin/cli.js.map +7 -0
  9. package/dist/cjs/cli/cli.d.ts +1 -0
  10. package/dist/cjs/cli/cli.js +49 -0
  11. package/dist/cjs/cli/cli.js.map +7 -0
  12. package/dist/cjs/cli/commands/generate/command.d.ts +1 -0
  13. package/dist/cjs/cli/commands/generate/command.js +80 -0
  14. package/dist/cjs/cli/commands/generate/command.js.map +7 -0
  15. package/dist/cjs/cli/commands/generate/impl.d.ts +8 -0
  16. package/dist/cjs/cli/commands/generate/impl.js +66 -0
  17. package/dist/cjs/cli/commands/generate/impl.js.map +7 -0
  18. package/dist/cjs/cli/context.d.ts +6 -0
  19. package/dist/cjs/cli/context.js +45 -0
  20. package/dist/cjs/cli/context.js.map +7 -0
  21. package/dist/cjs/config.d.ts +51 -0
  22. package/dist/cjs/config.js +75 -0
  23. package/dist/cjs/config.js.map +7 -0
  24. package/dist/cjs/file-builder.d.ts +13 -0
  25. package/dist/cjs/file-builder.js +83 -0
  26. package/dist/cjs/file-builder.js.map +7 -0
  27. package/dist/cjs/generate-utils.d.ts +1 -0
  28. package/dist/cjs/generate-utils.js +187 -0
  29. package/dist/cjs/generate-utils.js.map +7 -0
  30. package/dist/cjs/index.d.ts +8 -0
  31. package/dist/cjs/index.js +124 -0
  32. package/dist/cjs/index.js.map +7 -0
  33. package/dist/cjs/move-module-builder.d.ts +26 -0
  34. package/dist/cjs/move-module-builder.js +464 -0
  35. package/dist/cjs/move-module-builder.js.map +7 -0
  36. package/dist/cjs/package.json +5 -0
  37. package/dist/cjs/render-types.d.ts +19 -0
  38. package/dist/cjs/render-types.js +313 -0
  39. package/dist/cjs/render-types.js.map +7 -0
  40. package/dist/cjs/summary.d.ts +3 -0
  41. package/dist/cjs/summary.js +218 -0
  42. package/dist/cjs/summary.js.map +7 -0
  43. package/dist/cjs/types/deserialized.d.ts +89 -0
  44. package/dist/cjs/types/deserialized.js +17 -0
  45. package/dist/cjs/types/deserialized.js.map +7 -0
  46. package/dist/cjs/types/summary.d.ts +105 -0
  47. package/dist/cjs/types/summary.js +17 -0
  48. package/dist/cjs/types/summary.js.map +7 -0
  49. package/dist/cjs/utils.d.ts +22 -0
  50. package/dist/cjs/utils.js +164 -0
  51. package/dist/cjs/utils.js.map +7 -0
  52. package/dist/esm/bin/bash-complete.d.ts +2 -0
  53. package/dist/esm/bin/bash-complete.js +31 -0
  54. package/dist/esm/bin/bash-complete.js.map +7 -0
  55. package/dist/esm/bin/cli.d.ts +2 -0
  56. package/dist/esm/bin/cli.js +32 -0
  57. package/dist/esm/bin/cli.js.map +7 -0
  58. package/dist/esm/cli/cli.d.ts +1 -0
  59. package/dist/esm/cli/cli.js +29 -0
  60. package/dist/esm/cli/cli.js.map +7 -0
  61. package/dist/esm/cli/commands/generate/command.d.ts +1 -0
  62. package/dist/esm/cli/commands/generate/command.js +50 -0
  63. package/dist/esm/cli/commands/generate/command.js.map +7 -0
  64. package/dist/esm/cli/commands/generate/impl.d.ts +8 -0
  65. package/dist/esm/cli/commands/generate/impl.js +46 -0
  66. package/dist/esm/cli/commands/generate/impl.js.map +7 -0
  67. package/dist/esm/cli/context.d.ts +6 -0
  68. package/dist/esm/cli/context.js +15 -0
  69. package/dist/esm/cli/context.js.map +7 -0
  70. package/dist/esm/config.d.ts +51 -0
  71. package/dist/esm/config.js +45 -0
  72. package/dist/esm/config.js.map +7 -0
  73. package/dist/esm/file-builder.d.ts +13 -0
  74. package/dist/esm/file-builder.js +63 -0
  75. package/dist/esm/file-builder.js.map +7 -0
  76. package/dist/esm/generate-utils.d.ts +1 -0
  77. package/dist/esm/generate-utils.js +167 -0
  78. package/dist/esm/generate-utils.js.map +7 -0
  79. package/dist/esm/index.d.ts +8 -0
  80. package/dist/esm/index.js +104 -0
  81. package/dist/esm/index.js.map +7 -0
  82. package/dist/esm/move-module-builder.d.ts +26 -0
  83. package/dist/esm/move-module-builder.js +457 -0
  84. package/dist/esm/move-module-builder.js.map +7 -0
  85. package/dist/esm/package.json +5 -0
  86. package/dist/esm/render-types.d.ts +19 -0
  87. package/dist/esm/render-types.js +293 -0
  88. package/dist/esm/render-types.js.map +7 -0
  89. package/dist/esm/summary.d.ts +3 -0
  90. package/dist/esm/summary.js +198 -0
  91. package/dist/esm/summary.js.map +7 -0
  92. package/dist/esm/types/deserialized.d.ts +89 -0
  93. package/dist/esm/types/deserialized.js +1 -0
  94. package/dist/esm/types/deserialized.js.map +7 -0
  95. package/dist/esm/types/summary.d.ts +105 -0
  96. package/dist/esm/types/summary.js +1 -0
  97. package/dist/esm/types/summary.js.map +7 -0
  98. package/dist/esm/utils.d.ts +22 -0
  99. package/dist/esm/utils.js +134 -0
  100. package/dist/esm/utils.js.map +7 -0
  101. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  102. package/dist/tsconfig.tsbuildinfo +1 -0
  103. package/package.json +70 -0
  104. package/src/bin/bash-complete.ts +35 -0
  105. package/src/bin/cli.ts +40 -0
  106. package/src/cli/cli.ts +29 -0
  107. package/src/cli/commands/generate/command.ts +50 -0
  108. package/src/cli/commands/generate/impl.ts +66 -0
  109. package/src/cli/context.ts +21 -0
  110. package/src/config.ts +54 -0
  111. package/src/file-builder.ts +74 -0
  112. package/src/generate-utils.ts +163 -0
  113. package/src/index.ts +131 -0
  114. package/src/move-module-builder.ts +599 -0
  115. package/src/render-types.ts +349 -0
  116. package/src/summary.ts +242 -0
  117. package/src/types/deserialized.ts +107 -0
  118. package/src/types/summary.ts +144 -0
  119. package/src/utils.ts +180 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,259 @@
1
+ # @haneullabs/codegen
2
+
3
+ ## 0.5.13
4
+
5
+ ### Patch Changes
6
+
7
+ - 40f7878: Fix hasFunctions() to respect privateMethods configuration
8
+
9
+ This change fixes a bug where modules with only entry functions (no types or public functions)
10
+ were not being generated even when privateMethods was set to 'entry'. The hasFunctions() method
11
+ now checks the #includedFunctions set instead of only looking for public functions, ensuring
12
+ consistency with the privateMethods option added in version 0.5.0.
13
+
14
+ ## 0.5.12
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [29e8b92]
19
+ - @haneullabs/haneul@1.45.2
20
+
21
+ ## 0.5.11
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [e3811f1]
26
+ - @haneullabs/haneul@1.45.1
27
+
28
+ ## 0.5.10
29
+
30
+ ### Patch Changes
31
+
32
+ - baf3a35: Fix hasFunctions() to respect privateMethods configuration
33
+
34
+ This change fixes a bug where modules with only entry functions (no types or public functions)
35
+ were not being generated even when privateMethods was set to 'entry'. The hasFunctions() method
36
+ now checks the #includedFunctions set instead of only looking for public functions, ensuring
37
+ consistency with the privateMethods option added in version 0.5.0.
38
+
39
+ - Updated dependencies [88bdbac]
40
+ - @haneullabs/haneul@1.45.0
41
+
42
+ ## 0.5.9
43
+
44
+ ### Patch Changes
45
+
46
+ - Updated dependencies [44d9b4f]
47
+ - @haneullabs/haneul@1.44.0
48
+
49
+ ## 0.5.8
50
+
51
+ ### Patch Changes
52
+
53
+ - Updated dependencies [89fa2dc]
54
+ - @haneullabs/bcs@1.9.2
55
+ - @haneullabs/haneul@1.43.2
56
+
57
+ ## 0.5.7
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [a37829f]
62
+ - @haneullabs/bcs@1.9.1
63
+ - @haneullabs/haneul@1.43.1
64
+
65
+ ## 0.5.6
66
+
67
+ ### Patch Changes
68
+
69
+ - Updated dependencies [f3b19a7]
70
+ - Updated dependencies [f3b19a7]
71
+ - Updated dependencies [bf9f85c]
72
+ - @haneullabs/haneul@1.43.0
73
+ - @haneullabs/bcs@1.9.0
74
+
75
+ ## 0.5.5
76
+
77
+ ### Patch Changes
78
+
79
+ - Updated dependencies [98c8a27]
80
+ - @haneullabs/haneul@1.42.0
81
+
82
+ ## 0.5.4
83
+
84
+ ### Patch Changes
85
+
86
+ - Updated dependencies [a17c337]
87
+ - Updated dependencies [d554cd2]
88
+ - Updated dependencies [04fcfbc]
89
+ - @haneullabs/bcs@1.8.1
90
+ - @haneullabs/haneul@1.41.0
91
+
92
+ ## 0.5.3
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [f5fc0c0]
97
+ - @haneullabs/haneul@1.40.0
98
+
99
+ ## 0.5.2
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [a9f9035]
104
+ - @haneullabs/haneul@1.39.1
105
+
106
+ ## 0.5.1
107
+
108
+ ### Patch Changes
109
+
110
+ - 24e6b36: Optional struct generation should be bcs.option instead of bcs.vector
111
+ - Updated dependencies [ca92487]
112
+ - Updated dependencies [5ab3c0a]
113
+ - @haneullabs/haneul@1.39.0
114
+
115
+ ## 0.5.0
116
+
117
+ ### Minor Changes
118
+
119
+ - 223d075: Add option to codegen private functions which defaults to generating only private entry
120
+ functions
121
+ - ea1ac70: Update dependencies and improve support for typescript 5.9
122
+
123
+ ### Patch Changes
124
+
125
+ - Updated dependencies [3c1741f]
126
+ - Updated dependencies [ea1ac70]
127
+ - @haneullabs/haneul@1.38.0
128
+ - @haneullabs/bcs@1.8.0
129
+
130
+ ## 0.4.5
131
+
132
+ ### Patch Changes
133
+
134
+ - 78bd0e9: Update codegen arg normalization for object args
135
+ - Updated dependencies [c689b98]
136
+ - Updated dependencies [5b9ff1a]
137
+ - @haneullabs/haneul@1.37.6
138
+
139
+ ## 0.4.4
140
+
141
+ ### Patch Changes
142
+
143
+ - Updated dependencies [3980d04]
144
+ - @haneullabs/haneul@1.37.5
145
+
146
+ ## 0.4.3
147
+
148
+ ### Patch Changes
149
+
150
+ - Updated dependencies [6b03e57]
151
+ - @haneullabs/haneul@1.37.4
152
+
153
+ ## 0.4.2
154
+
155
+ ### Patch Changes
156
+
157
+ - Updated dependencies [8ff1471]
158
+ - @haneullabs/haneul@1.37.3
159
+
160
+ ## 0.4.1
161
+
162
+ ### Patch Changes
163
+
164
+ - Updated dependencies [660377c]
165
+ - @haneullabs/haneul@1.37.2
166
+
167
+ ## 0.4.0
168
+
169
+ ### Minor Changes
170
+
171
+ - 22d727d: Execute `sui move summary` when generating code
172
+
173
+ ## 0.3.0
174
+
175
+ ### Minor Changes
176
+
177
+ - 33230ed: Add typenames to exported bcs types
178
+ - 33230ed: Export non-generic BCS types directly rather than wrapping with a function
179
+ - 33230ed: Use new MoveStruct, MoveEnum, and MoveTuple classes for bcs types
180
+
181
+ ### Patch Changes
182
+
183
+ - Updated dependencies [33230ed]
184
+ - Updated dependencies [33230ed]
185
+ - Updated dependencies [33230ed]
186
+ - @haneullabs/bcs@1.7.0
187
+ - @haneullabs/haneul@1.37.1
188
+
189
+ ## 0.2.5
190
+
191
+ ### Patch Changes
192
+
193
+ - Updated dependencies [72168f0]
194
+ - @haneullabs/haneul@1.37.0
195
+
196
+ ## 0.2.4
197
+
198
+ ### Patch Changes
199
+
200
+ - Updated dependencies [44354ab]
201
+ - @haneullabs/haneul@1.36.2
202
+
203
+ ## 0.2.3
204
+
205
+ ### Patch Changes
206
+
207
+ - Updated dependencies [c76ddc5]
208
+ - @haneullabs/haneul@1.36.1
209
+
210
+ ## 0.2.2
211
+
212
+ ### Patch Changes
213
+
214
+ - 319e234: Update arg fields' naming when an std arg is featured
215
+
216
+ ## 0.2.1
217
+
218
+ ### Patch Changes
219
+
220
+ - 1c4a82d: update links in package.json
221
+ - 470e3a7: Update codegen args' normalization
222
+ - Updated dependencies [1c4a82d]
223
+ - Updated dependencies [783bb9e]
224
+ - Updated dependencies [783bb9e]
225
+ - Updated dependencies [5cbbb21]
226
+ - @haneullabs/bcs@1.6.4
227
+ - @haneullabs/haneul@1.36.0
228
+
229
+ ## 0.2.0
230
+
231
+ ### Minor Changes
232
+
233
+ - 4ee5185: remove init function for generated modules. package addresses are now passed into move
234
+ calls or resolved via mvr
235
+ - 4ee5185: Filter out well-known objects from move calls (clock, random, system, denyList)
236
+ - 4ee5185: Allow move arguments to be passed as objects
237
+
238
+ ### Patch Changes
239
+
240
+ - 888afe6: Fix falsy args
241
+ - 4ee5185: Add argument interfaces for move calls
242
+ - Updated dependencies [888afe6]
243
+ - @haneullabs/haneul@1.35.0
244
+
245
+ ## 0.1.0
246
+
247
+ ### Minor Changes
248
+
249
+ - f3f2a08: Add support for config files and update cli to use positional args for packages to allow
250
+ for easier globbing
251
+
252
+ ## 0.0.1
253
+
254
+ ### Patch Changes
255
+
256
+ - c0560fe: Fix check for context arg
257
+ - c0560fe: remove support for generating from bytecode
258
+ - Updated dependencies [3fb7a83]
259
+ - @haneullabs/haneul@1.34.0
package/README.md ADDED
@@ -0,0 +1,195 @@
1
+ # Sui typescript codegen
2
+
3
+ ⚠️ **Warning**: This package is currently in development and may have breaking changes.
4
+
5
+ ## Setup
6
+
7
+ To use this package you will need to install it from npm:
8
+
9
+ ```bash
10
+ pnpm install @haneullabs/codegen
11
+ ```
12
+
13
+ Then create a `sui-codegen.config.ts` to define what packages you want to generate code for:
14
+
15
+ ```ts
16
+ import type { SuiCodegenConfig } from './src/config.js';
17
+
18
+ const config: SuiCodegenConfig = {
19
+ output: './src/generated',
20
+ generateSummaries: true,
21
+ prune: true,
22
+ packages: [
23
+ {
24
+ package: '@your-scope/your-package',
25
+ path: './move/your-package',
26
+ },
27
+ ],
28
+ };
29
+
30
+ export default config;
31
+ ```
32
+
33
+ The `package` field should be the MVR name for your move package. If you have not registered your
34
+ package on MVR yet, you can use the `@local-pkg` scope, and set up an override in your `HaneulClient`
35
+ to resolve it to the correct address.
36
+
37
+ ## Generating code
38
+
39
+ To generate code, you will first need to create `package_summaries` for your package. You can do
40
+ this by running the following command in the root of you move package:
41
+
42
+ ```bash
43
+ sui move summary
44
+ ```
45
+
46
+ this will create a new `package_summaries` directory (which can be added to `.gitignore`) for the
47
+ codegen tool to analyze when generating code for your package.
48
+
49
+ If you are having trouble with this command, ensure you are using the latest version of the sui cli
50
+ (version `1.51.1` or later).
51
+
52
+ Now that you have the `package_summaries` you can generate you typescript code, by running
53
+
54
+ ```bash
55
+ pnpm sui-ts-codegen generate
56
+ ```
57
+
58
+ or by adding something the following script to your package.json and running `pnpm codegen`
59
+
60
+ ```json
61
+ {
62
+ "scripts": {
63
+ "codegen": "sui-ts-codegen generate"
64
+ }
65
+ }
66
+ ```
67
+
68
+ ## Setting up HaneulClient
69
+
70
+ If your package is registered on MVR, the generated code should work without additional
71
+ configuration. If you are using a `@local-pkg` name, you will need to configure your `HaneulClient` to
72
+ resolver the package name correctly:
73
+
74
+ ```ts
75
+ const client = new HaneulClient({
76
+ network: 'testnet',
77
+ url: testnetRpcUrl,
78
+ mvr: {
79
+ overrides: {
80
+ packages: {
81
+ '@local-pkg/your-package': YOUR_PACKAGE_ID,
82
+ },
83
+ },
84
+ },
85
+ });
86
+ ```
87
+
88
+ If you are using `dapp-kit`, you may need to set up your network config and `HaneulClientProvider`:
89
+
90
+ ```ts
91
+ const { networkConfig, useNetworkVariable, useNetworkVariables } = createNetworkConfig({
92
+ testnet: {
93
+ url: getFullnodeUrl('testnet'),
94
+ variables: {
95
+ yourPackageId: YOUR_TESTNET_PACKAGE_ID,
96
+ },
97
+ },
98
+ });
99
+ ```
100
+
101
+ ```tsx
102
+ <HaneulClientProvider
103
+ networks={networkConfig}
104
+ defaultNetwork="testnet"
105
+ createClient={(network, config) => {
106
+ return new HaneulClient({
107
+ network,
108
+ url: config.url,
109
+ mvr: {
110
+ overrides: {
111
+ packages: {
112
+ '@local-pkg/your-package': config.variables.yourPackageId,
113
+ },
114
+ },
115
+ },
116
+ });
117
+ }}
118
+ >
119
+ <App />
120
+ </HaneulClientProvider>
121
+ ```
122
+
123
+ ## Calling Move Functions
124
+
125
+ The generated code provides type-safe functions for calling Move functions. Here's how to use them:
126
+
127
+ ### Creating Objects
128
+
129
+ To create new objects from your Move package, use the generated `create` function:
130
+
131
+ This example assumes a simple `counter` package based on the `create-dapp` template:
132
+
133
+ ```tsx
134
+ import { Transaction } from '@haneullabs/haneul/transactions';
135
+ import * as counter from './generated/counter/counter';
136
+
137
+ async function createCounter() {
138
+ // create a new Transaction
139
+ const tx = new Transaction();
140
+ // Add a create call
141
+ tx.add(counter.create());
142
+
143
+ const { digest } = suiClient.signAndExecuteTransaction({
144
+ transaction: tx,
145
+ signer: keypair,
146
+ });
147
+
148
+ return digest;
149
+ }
150
+
151
+ async function incrementCount(id: string) {
152
+ const tx = tx.add(
153
+ counter.increment({
154
+ // Arguments can be passed in by name as an object, or as an array of values
155
+ arguments: {
156
+ // Argument values can be js primitives, or use methods like tx.pure or tx.object, or results of other move calls
157
+ counter: id,
158
+ },
159
+ }),
160
+ );
161
+
162
+ const { digest } = suiClient.signAndExecuteTransaction({
163
+ transaction: tx,
164
+ signer: keypair,
165
+ });
166
+
167
+ return digest;
168
+ }
169
+ ```
170
+
171
+ ## Parsing BCS Types
172
+
173
+ The generated code also provides BCS definitions for your Move types:
174
+
175
+ First, you will need to load the bcs data for your object, then parse it with your generated type:
176
+
177
+ ```tsx
178
+ import * as counter from './generated/counter/counter';
179
+
180
+ async await function readCounter(id: string) {
181
+ const data = suiClient.getObject({
182
+ id,
183
+ options: {
184
+ // request the bcs data when loading your object
185
+ showBcs: true,
186
+ }
187
+ })
188
+
189
+ if (data.data.bcs?.dataType !== 'moveObject') {
190
+ throw new Error('Expected a move object')
191
+ }
192
+
193
+ return counter.Counter.fromBase64(data.data.bcs.bcsBytes)
194
+ }
195
+ ```
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare function main(): Promise<void>;
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var bash_complete_exports = {};
21
+ __export(bash_complete_exports, {
22
+ main: () => main
23
+ });
24
+ module.exports = __toCommonJS(bash_complete_exports);
25
+ var import_core = require("@stricli/core");
26
+ var import_context = require("../cli/context.js");
27
+ var import_cli = require("../cli/cli.js");
28
+ const { version } = require("../../../package.json");
29
+ const cli = (0, import_cli.buildCli)(version);
30
+ const inputs = process.argv.slice(3);
31
+ if (process.env["COMP_LINE"]?.endsWith(" ")) {
32
+ inputs.push("");
33
+ }
34
+ async function main() {
35
+ await (0, import_core.proposeCompletions)(cli, inputs, (0, import_context.buildContext)(process));
36
+ try {
37
+ for (const { completion } of await (0, import_core.proposeCompletions)(cli, inputs, (0, import_context.buildContext)(process))) {
38
+ process.stdout.write(`${completion}
39
+ `);
40
+ }
41
+ } catch {
42
+ }
43
+ }
44
+ main().then(
45
+ () => process.exit(0),
46
+ (error) => {
47
+ console.error(error);
48
+ process.exit(1);
49
+ }
50
+ );
51
+ //# sourceMappingURL=bash-complete.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/bin/bash-complete.ts"],
4
+ "sourcesContent": ["#!/usr/bin/env node\n// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { proposeCompletions } from '@stricli/core';\nimport { buildContext } from '../cli/context.js';\nimport { buildCli } from '../cli/cli.js';\n\nconst { version }: { version: string } = require('../../../package.json');\nconst cli = buildCli(version);\n\nconst inputs = process.argv.slice(3);\nif (process.env['COMP_LINE']?.endsWith(' ')) {\n\tinputs.push('');\n}\n\nexport async function main() {\n\tawait proposeCompletions(cli, inputs, buildContext(process));\n\n\ttry {\n\t\tfor (const { completion } of await proposeCompletions(cli, inputs, buildContext(process))) {\n\t\t\tprocess.stdout.write(`${completion}\\n`);\n\t\t}\n\t} catch {\n\t\t// ignore\n\t}\n}\n\nmain().then(\n\t() => process.exit(0),\n\t(error) => {\n\t\tconsole.error(error);\n\t\tprocess.exit(1);\n\t},\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAmC;AACnC,qBAA6B;AAC7B,iBAAyB;AAEzB,MAAM,EAAE,QAAQ,IAAyB,QAAQ,uBAAuB;AACxE,MAAM,UAAM,qBAAS,OAAO;AAE5B,MAAM,SAAS,QAAQ,KAAK,MAAM,CAAC;AACnC,IAAI,QAAQ,IAAI,WAAW,GAAG,SAAS,GAAG,GAAG;AAC5C,SAAO,KAAK,EAAE;AACf;AAEA,eAAsB,OAAO;AAC5B,YAAM,gCAAmB,KAAK,YAAQ,6BAAa,OAAO,CAAC;AAE3D,MAAI;AACH,eAAW,EAAE,WAAW,KAAK,UAAM,gCAAmB,KAAK,YAAQ,6BAAa,OAAO,CAAC,GAAG;AAC1F,cAAQ,OAAO,MAAM,GAAG,UAAU;AAAA,CAAI;AAAA,IACvC;AAAA,EACD,QAAQ;AAAA,EAER;AACD;AAEA,KAAK,EAAE;AAAA,EACN,MAAM,QAAQ,KAAK,CAAC;AAAA,EACpB,CAAC,UAAU;AACV,YAAQ,MAAM,KAAK;AACnB,YAAQ,KAAK,CAAC;AAAA,EACf;AACD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var import_core = require("@stricli/core");
4
+ var import_context = require("../cli/context.js");
5
+ var import_cli = require("../cli/cli.js");
6
+ var import_promises = require("node:fs/promises");
7
+ var import_node_path = require("node:path");
8
+ const import_meta = {};
9
+ async function getVersion() {
10
+ let dirname;
11
+ try {
12
+ dirname = __dirname;
13
+ } catch {
14
+ dirname = import_meta.dirname;
15
+ }
16
+ const packageJsonPath = (0, import_node_path.resolve)(
17
+ dirname,
18
+ dirname.endsWith("src/bin") ? "../../package.json" : "../../../package.json"
19
+ );
20
+ const packageJson = JSON.parse(await (0, import_promises.readFile)(packageJsonPath, "utf-8"));
21
+ return packageJson.version;
22
+ }
23
+ async function main() {
24
+ const version = await getVersion();
25
+ await (0, import_core.run)((0, import_cli.buildCli)(version), process.argv.slice(2), (0, import_context.buildContext)(process));
26
+ }
27
+ main().then(
28
+ () => process.exit(0),
29
+ (error) => {
30
+ console.error(error);
31
+ process.exit(1);
32
+ }
33
+ );
34
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/bin/cli.ts"],
4
+ "sourcesContent": ["#!/usr/bin/env node\n// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { run } from '@stricli/core';\nimport { buildContext } from '../cli/context.js';\nimport { buildCli } from '../cli/cli.js';\nimport { readFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\n\nasync function getVersion() {\n\tlet dirname;\n\n\ttry {\n\t\tdirname = __dirname;\n\t} catch {\n\t\t// @ts-ignore\n\t\tdirname = import.meta.dirname;\n\t}\n\n\tconst packageJsonPath = resolve(\n\t\tdirname,\n\t\tdirname.endsWith('src/bin') ? '../../package.json' : '../../../package.json',\n\t);\n\tconst packageJson: { version: string } = JSON.parse(await readFile(packageJsonPath, 'utf-8'));\n\treturn packageJson.version;\n}\n\nasync function main() {\n\tconst version = await getVersion();\n\tawait run(buildCli(version), process.argv.slice(2), buildContext(process));\n}\n\nmain().then(\n\t() => process.exit(0),\n\t(error) => {\n\t\tconsole.error(error);\n\t\tprocess.exit(1);\n\t},\n);\n"],
5
+ "mappings": ";;AAIA,kBAAoB;AACpB,qBAA6B;AAC7B,iBAAyB;AACzB,sBAAyB;AACzB,uBAAwB;AARxB;AAUA,eAAe,aAAa;AAC3B,MAAI;AAEJ,MAAI;AACH,cAAU;AAAA,EACX,QAAQ;AAEP,cAAU,YAAY;AAAA,EACvB;AAEA,QAAM,sBAAkB;AAAA,IACvB;AAAA,IACA,QAAQ,SAAS,SAAS,IAAI,uBAAuB;AAAA,EACtD;AACA,QAAM,cAAmC,KAAK,MAAM,UAAM,0BAAS,iBAAiB,OAAO,CAAC;AAC5F,SAAO,YAAY;AACpB;AAEA,eAAe,OAAO;AACrB,QAAM,UAAU,MAAM,WAAW;AACjC,YAAM,qBAAI,qBAAS,OAAO,GAAG,QAAQ,KAAK,MAAM,CAAC,OAAG,6BAAa,OAAO,CAAC;AAC1E;AAEA,KAAK,EAAE;AAAA,EACN,MAAM,QAAQ,KAAK,CAAC;AAAA,EACpB,CAAC,UAAU;AACV,YAAQ,MAAM,KAAK;AACnB,YAAQ,KAAK,CAAC;AAAA,EACf;AACD;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export declare function buildCli(version: string): import("@stricli/core").Application<import("./context.js").LocalContext>;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var cli_exports = {};
20
+ __export(cli_exports, {
21
+ buildCli: () => buildCli
22
+ });
23
+ module.exports = __toCommonJS(cli_exports);
24
+ var import_core = require("@stricli/core");
25
+ var import_auto_complete = require("@stricli/auto-complete");
26
+ var import_command = require("./commands/generate/command.js");
27
+ function buildCli(version) {
28
+ const routes = (0, import_core.buildRouteMap)({
29
+ routes: {
30
+ generate: import_command.generateCommand,
31
+ install: (0, import_auto_complete.buildInstallCommand)("haneul-ts-codegen", { bash: "__haneul-ts-codegen_bash_complete" }),
32
+ uninstall: (0, import_auto_complete.buildUninstallCommand)("haneul-ts-codegen", { bash: true })
33
+ },
34
+ docs: {
35
+ brief: "Generate TypeScript bindings for your Move code",
36
+ hideRoute: {
37
+ install: true,
38
+ uninstall: true
39
+ }
40
+ }
41
+ });
42
+ return (0, import_core.buildApplication)(routes, {
43
+ name: "haneul-ts-codegen",
44
+ versionInfo: {
45
+ currentVersion: version
46
+ }
47
+ });
48
+ }
49
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/cli/cli.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { buildApplication, buildRouteMap } from '@stricli/core';\nimport { buildInstallCommand, buildUninstallCommand } from '@stricli/auto-complete';\nimport { generateCommand } from './commands/generate/command.js';\n\nexport function buildCli(version: string) {\n\tconst routes = buildRouteMap({\n\t\troutes: {\n\t\t\tgenerate: generateCommand,\n\t\t\tinstall: buildInstallCommand('haneul-ts-codegen', { bash: '__haneul-ts-codegen_bash_complete' }),\n\t\t\tuninstall: buildUninstallCommand('haneul-ts-codegen', { bash: true }),\n\t\t},\n\t\tdocs: {\n\t\t\tbrief: 'Generate TypeScript bindings for your Move code',\n\t\t\thideRoute: {\n\t\t\t\tinstall: true,\n\t\t\t\tuninstall: true,\n\t\t\t},\n\t\t},\n\t});\n\n\treturn buildApplication(routes, {\n\t\tname: 'haneul-ts-codegen',\n\t\tversionInfo: {\n\t\t\tcurrentVersion: version,\n\t\t},\n\t});\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAgD;AAChD,2BAA2D;AAC3D,qBAAgC;AAEzB,SAAS,SAAS,SAAiB;AACzC,QAAM,aAAS,2BAAc;AAAA,IAC5B,QAAQ;AAAA,MACP,UAAU;AAAA,MACV,aAAS,0CAAoB,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAAA,MAC/F,eAAW,4CAAsB,qBAAqB,EAAE,MAAM,KAAK,CAAC;AAAA,IACrE;AAAA,IACA,MAAM;AAAA,MACL,OAAO;AAAA,MACP,WAAW;AAAA,QACV,SAAS;AAAA,QACT,WAAW;AAAA,MACZ;AAAA,IACD;AAAA,EACD,CAAC;AAED,aAAO,8BAAiB,QAAQ;AAAA,IAC/B,MAAM;AAAA,IACN,aAAa;AAAA,MACZ,gBAAgB;AAAA,IACjB;AAAA,EACD,CAAC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export declare const generateCommand: import("@stricli/core").Command<import("../../context.js").LocalContext>;