@leancodepl/cyberware-contract-generator-dart 10.1.3
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.
- package/LICENSE +201 -0
- package/README.md +128 -0
- package/dist/bin.cjs +2 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +27 -0
- package/dist/config.d.ts +61 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/dart/DartRenderer.d.ts +17 -0
- package/dist/dart/DartRenderer.d.ts.map +1 -0
- package/dist/dart/language.d.ts +10 -0
- package/dist/dart/language.d.ts.map +1 -0
- package/dist/dart/utils.d.ts +3 -0
- package/dist/dart/utils.d.ts.map +1 -0
- package/dist/generate-5ek5I4YO.js +337 -0
- package/dist/generate-Dv3_3Ssg.cjs +3 -0
- package/dist/generate.d.ts +29 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/loadConfig.d.ts +30 -0
- package/dist/loadConfig.d.ts.map +1 -0
- package/package.json +65 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# @leancodepl/cyberware-contract-generator-dart
|
|
2
|
+
|
|
3
|
+
Generates Dart extension type files from an `"@leancodepl/cyberware-contract"` Zod schema, producing type-safe JS
|
|
4
|
+
interop code for Flutter web applications.
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @leancodepl/cyberware-contract-generator-dart
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## API
|
|
13
|
+
|
|
14
|
+
### `generate(config, outputDir)`
|
|
15
|
+
|
|
16
|
+
Generates Dart extension type files from an iframe contract schema. Produces three files in the output directory:
|
|
17
|
+
`contract.dart`, `types.dart`, and `connect_to_host.dart`.
|
|
18
|
+
|
|
19
|
+
**Parameters:**
|
|
20
|
+
|
|
21
|
+
- `config` (`Pick<CyberwareContractGeneratorDartConfig, "schema">`) - Configuration containing the Zod contract schema
|
|
22
|
+
- `outputDir` (`string`) - Absolute or relative path to the directory where Dart files will be written
|
|
23
|
+
|
|
24
|
+
### `cyberwareContractGeneratorDartConfigSchema`
|
|
25
|
+
|
|
26
|
+
Validates the configuration for the Dart code generator.
|
|
27
|
+
|
|
28
|
+
**Type:** Zod schema that validates to `CyberwareContractGeneratorDartConfig`
|
|
29
|
+
|
|
30
|
+
**Shape:**
|
|
31
|
+
|
|
32
|
+
- `schema` (`z.ZodType<ContractSchemaType>`) - A Zod contract schema created with `mkZodContractSchema` from
|
|
33
|
+
`"@leancodepl/cyberware-contract"`
|
|
34
|
+
- `outputDir` (`string`) - Directory where Dart files will be written
|
|
35
|
+
|
|
36
|
+
### `CyberwareContractGeneratorDartConfig`
|
|
37
|
+
|
|
38
|
+
TypeScript type inferred from `cyberwareContractGeneratorDartConfigSchema`.
|
|
39
|
+
|
|
40
|
+
## Usage Examples
|
|
41
|
+
|
|
42
|
+
### CLI
|
|
43
|
+
|
|
44
|
+
Run the generator from the command line:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx cyberware-contract-generator-dart
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Pass a custom config path:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx cyberware-contract-generator-dart --config ./my-config.mjs
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Configuration file
|
|
57
|
+
|
|
58
|
+
Create an `cyberware-contract-generator-dart.config.mjs` in your project root:
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
import { z } from "zod"
|
|
62
|
+
import { methodDef, mkZodContractSchema } from "@leancodepl/cyberware-contract"
|
|
63
|
+
|
|
64
|
+
const schema = mkZodContractSchema({
|
|
65
|
+
hostMethods: {
|
|
66
|
+
navigateTo: methodDef({ params: z.object({ path: z.string() }) }),
|
|
67
|
+
},
|
|
68
|
+
remoteMethods: {
|
|
69
|
+
getCurrentPath: methodDef({ returns: z.string() }),
|
|
70
|
+
},
|
|
71
|
+
remoteParams: { userId: z.string().optional() },
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
export default {
|
|
75
|
+
schema,
|
|
76
|
+
outputDir: "./lib/generated",
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Programmatic usage
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { generate } from "@leancodepl/cyberware-contract-generator-dart"
|
|
84
|
+
import { mkZodContractSchema, methodDef } from "@leancodepl/cyberware-contract"
|
|
85
|
+
import { z } from "zod"
|
|
86
|
+
|
|
87
|
+
const schema = mkZodContractSchema({
|
|
88
|
+
hostMethods: {
|
|
89
|
+
navigateTo: methodDef({ params: z.object({ path: z.string() }) }),
|
|
90
|
+
},
|
|
91
|
+
remoteMethods: {
|
|
92
|
+
getCurrentPath: methodDef({ returns: z.string() }),
|
|
93
|
+
},
|
|
94
|
+
remoteParams: { userId: z.string() },
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
await generate({ schema }, "./lib/generated")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Validating configuration
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
import { cyberwareContractGeneratorDartConfigSchema } from "@leancodepl/cyberware-contract-generator-dart"
|
|
104
|
+
|
|
105
|
+
const config = cyberwareContractGeneratorDartConfigSchema.parse({
|
|
106
|
+
schema: myContractSchema,
|
|
107
|
+
outputDir: "./lib/generated",
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Generated output
|
|
112
|
+
|
|
113
|
+
The generator produces three Dart files:
|
|
114
|
+
|
|
115
|
+
- **`contract.dart`** - Extension types wrapping `JSObject` for method parameters and result typedefs
|
|
116
|
+
- **`types.dart`** - Host/remote method abstractions, JS interop bridge types, URL parameter accessors, and
|
|
117
|
+
`ConnectToHostState` typedef
|
|
118
|
+
- **`connect_to_host.dart`** - Typed `connectToHost` function wiring remote methods and returning host methods
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
The CLI searches for config files in the following order:
|
|
123
|
+
|
|
124
|
+
- `cyberware-contract-generator-dart.config.js`
|
|
125
|
+
- `cyberware-contract-generator-dart.config.cjs`
|
|
126
|
+
- `cyberware-contract-generator-dart.config.mjs`
|
|
127
|
+
|
|
128
|
+
Alternatively, pass an explicit path with `--config` / `-c`.
|
package/dist/bin.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";const u=require("yargs/helpers"),g=require("yargs/yargs"),a=require("./generate-Dv3_3Ssg.cjs"),f=require("lilconfig"),n=require("node:path"),t="cyberware-contract-generator-dart",p={searchPlaces:[`${t}.config.js`,`${t}.config.cjs`,`${t}.config.mjs`]};function l(r,e){return n.isAbsolute(r.outputDir)?r.outputDir:n.resolve(e,r.outputDir)}async function h(r){const e=f.lilconfig(t,p),o=r?await e.load(r):await e.search();if(!o)throw new Error(`No config found. Create ${t}.config.js (or .${t}rc.json) with schema and outputDir, or pass --config <path>.`);const c=a.cyberwareContractGeneratorDartConfigSchema.parse(o.config),s=n.dirname(o.filepath??process.cwd()),i=l(c,s);return{config:c,outputDir:i}}const d=g(u.hideBin(process.argv)).option("config",{alias:"c",type:"string",description:"Path to config file (cyberware-contract-generator-dart.config.js or .cyberware-contract-generator-dartrc.json)"}).parseSync();h(d.config).then(({config:r,outputDir:e})=>a.generate(r,e));
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { hideBin as s } from "yargs/helpers";
|
|
3
|
+
import f from "yargs/yargs";
|
|
4
|
+
import { c as p, g } from "./generate-5ek5I4YO.js";
|
|
5
|
+
import { lilconfig as u } from "lilconfig";
|
|
6
|
+
import n from "node:path";
|
|
7
|
+
const t = "cyberware-contract-generator-dart", m = {
|
|
8
|
+
searchPlaces: [`${t}.config.js`, `${t}.config.cjs`, `${t}.config.mjs`]
|
|
9
|
+
};
|
|
10
|
+
function h(r, o) {
|
|
11
|
+
return n.isAbsolute(r.outputDir) ? r.outputDir : n.resolve(o, r.outputDir);
|
|
12
|
+
}
|
|
13
|
+
async function d(r) {
|
|
14
|
+
const o = u(t, m), e = r ? await o.load(r) : await o.search();
|
|
15
|
+
if (!e)
|
|
16
|
+
throw new Error(
|
|
17
|
+
`No config found. Create ${t}.config.js (or .${t}rc.json) with schema and outputDir, or pass --config <path>.`
|
|
18
|
+
);
|
|
19
|
+
const c = p.parse(e.config), a = n.dirname(e.filepath ?? process.cwd()), i = h(c, a);
|
|
20
|
+
return { config: c, outputDir: i };
|
|
21
|
+
}
|
|
22
|
+
const l = f(s(process.argv)).option("config", {
|
|
23
|
+
alias: "c",
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Path to config file (cyberware-contract-generator-dart.config.js or .cyberware-contract-generator-dartrc.json)"
|
|
26
|
+
}).parseSync();
|
|
27
|
+
d(l.config).then(({ config: r, outputDir: o }) => g(r, o));
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Validates the configuration for the Dart code generator.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* import { cyberwareContractGeneratorDartConfigSchema } from "@leancodepl/cyberware-contract-generator-dart";
|
|
8
|
+
*
|
|
9
|
+
* const config = cyberwareContractGeneratorDartConfigSchema.parse({
|
|
10
|
+
* schema: myContractSchema,
|
|
11
|
+
* outputDir: "./lib/generated",
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const cyberwareContractGeneratorDartConfigSchema: z.ZodObject<{
|
|
16
|
+
schema: z.ZodCustom<z.ZodType<{
|
|
17
|
+
hostMethods: Record<string, {
|
|
18
|
+
params?: unknown;
|
|
19
|
+
returns?: unknown;
|
|
20
|
+
}>;
|
|
21
|
+
remoteMethods: Record<string, {
|
|
22
|
+
params?: unknown;
|
|
23
|
+
returns?: unknown;
|
|
24
|
+
}>;
|
|
25
|
+
remoteParams: Record<string, string>;
|
|
26
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
27
|
+
hostMethods: Record<string, {
|
|
28
|
+
params?: unknown;
|
|
29
|
+
returns?: unknown;
|
|
30
|
+
}>;
|
|
31
|
+
remoteMethods: Record<string, {
|
|
32
|
+
params?: unknown;
|
|
33
|
+
returns?: unknown;
|
|
34
|
+
}>;
|
|
35
|
+
remoteParams: Record<string, string>;
|
|
36
|
+
}, unknown>>, z.ZodType<{
|
|
37
|
+
hostMethods: Record<string, {
|
|
38
|
+
params?: unknown;
|
|
39
|
+
returns?: unknown;
|
|
40
|
+
}>;
|
|
41
|
+
remoteMethods: Record<string, {
|
|
42
|
+
params?: unknown;
|
|
43
|
+
returns?: unknown;
|
|
44
|
+
}>;
|
|
45
|
+
remoteParams: Record<string, string>;
|
|
46
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
47
|
+
hostMethods: Record<string, {
|
|
48
|
+
params?: unknown;
|
|
49
|
+
returns?: unknown;
|
|
50
|
+
}>;
|
|
51
|
+
remoteMethods: Record<string, {
|
|
52
|
+
params?: unknown;
|
|
53
|
+
returns?: unknown;
|
|
54
|
+
}>;
|
|
55
|
+
remoteParams: Record<string, string>;
|
|
56
|
+
}, unknown>>>;
|
|
57
|
+
outputDir: z.ZodString;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
/** Configuration for the Dart code generator, inferred from {@link cyberwareContractGeneratorDartConfigSchema}. */
|
|
60
|
+
export type CyberwareContractGeneratorDartConfig = z.infer<typeof cyberwareContractGeneratorDartConfigSchema>;
|
|
61
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKrD,CAAA;AAEF,mHAAmH;AACnH,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0CAA0C,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ForbiddenWordsInfo } from 'quicktype-core/dist/ConvenienceRenderer';
|
|
2
|
+
import { Name, Namer } from 'quicktype-core/dist/Naming';
|
|
3
|
+
import { ClassProperty, ObjectType } from 'quicktype-core/dist/Type';
|
|
4
|
+
import { ConvenienceRenderer, RenderContext, TargetLanguage } from 'quicktype-core';
|
|
5
|
+
export declare class DartExtensionTypesRenderer extends ConvenienceRenderer {
|
|
6
|
+
private readonly _resolvedPropertyNames;
|
|
7
|
+
constructor(targetLanguage: TargetLanguage, renderContext: RenderContext);
|
|
8
|
+
protected forbiddenNamesForGlobalNamespace(): readonly string[];
|
|
9
|
+
protected forbiddenForObjectProperties(_o: ObjectType, _className: Name): ForbiddenWordsInfo;
|
|
10
|
+
protected makeNamedTypeNamer(): Namer;
|
|
11
|
+
protected namerForObjectProperty(_o: ObjectType, _p: ClassProperty): Namer | null;
|
|
12
|
+
protected makeUnionMemberNamer(): Namer | null;
|
|
13
|
+
protected makeEnumCaseNamer(): Namer | null;
|
|
14
|
+
private resolvePropertyName;
|
|
15
|
+
protected emitSourceStructure(): void;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=DartRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DartRenderer.d.ts","sourceRoot":"","sources":["../../src/dart/DartRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AACjF,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAEzE,OAAO,EAEL,mBAAmB,EAGnB,KAAK,aAAa,EAClB,cAAc,EAEf,MAAM,gBAAgB,CAAA;AAuavB,qBAAa,0BAA2B,SAAQ,mBAAmB;IACjE,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAA6C;gBAExE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa;cAIrD,gCAAgC,IAAI,SAAS,MAAM,EAAE;cAIrD,4BAA4B,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,GAAG,kBAAkB;IAIrG,SAAS,CAAC,kBAAkB,IAAI,KAAK;IAIrC,SAAS,CAAC,sBAAsB,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,aAAa,GAAG,KAAK,GAAG,IAAI;IAIjF,SAAS,CAAC,oBAAoB,IAAI,KAAK,GAAG,IAAI;IAI9C,SAAS,CAAC,iBAAiB,IAAI,KAAK,GAAG,IAAI;IAI3C,OAAO,CAAC,mBAAmB;IAI3B,SAAS,CAAC,mBAAmB,IAAI,IAAI;CA2BtC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RenderContext, TargetLanguage } from 'quicktype-core';
|
|
2
|
+
import { DartExtensionTypesRenderer } from './DartRenderer';
|
|
3
|
+
export declare const dartOptions: {};
|
|
4
|
+
export declare class DartExtensionTypesTargetLanguage extends TargetLanguage {
|
|
5
|
+
constructor();
|
|
6
|
+
getOptions(): typeof dartOptions;
|
|
7
|
+
get supportsUnionsWithBothNumberTypes(): boolean;
|
|
8
|
+
protected makeRenderer(renderContext: RenderContext): DartExtensionTypesRenderer;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=language.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../src/dart/language.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAA;AAE3D,eAAO,MAAM,WAAW,IAAK,CAAA;AAE7B,qBAAa,gCAAiC,SAAQ,cAAc;;IAS3D,UAAU,IAAI,OAAO,WAAW;IAIvC,IAAoB,iCAAiC,IAAI,OAAO,CAE/D;IAED,SAAS,CAAC,YAAY,CAAC,aAAa,EAAE,aAAa,GAAG,0BAA0B;CAGjF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/dart/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAIxD;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEnD"}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { z as T } from "zod";
|
|
2
|
+
import w from "node:fs";
|
|
3
|
+
import X from "node:path";
|
|
4
|
+
import { ConvenienceRenderer as Y, ClassType as f, matchType as A, nullableFromUnion as L, TargetLanguage as Z, InputData as ee, JSONSchemaInput as te, quicktypeMultiFile as oe } from "quicktype-core";
|
|
5
|
+
import { keywords as se } from "quicktype-core/dist/language/Dart/constants.js";
|
|
6
|
+
import { dartNameStyle as G, typeNamingFunction as re, propertyNamingFunction as H, enumCaseNamingFunction as ne } from "quicktype-core/dist/language/Dart/utils.js";
|
|
7
|
+
const Pe = T.object({
|
|
8
|
+
schema: T.custom(),
|
|
9
|
+
outputDir: T.string().describe("Directory where Dart files will be written (contract.dart, types.dart, connect_to_host.dart)")
|
|
10
|
+
});
|
|
11
|
+
function ae(o) {
|
|
12
|
+
return o === "hostMethods" ? "Host" : o === "remoteMethods" ? "Remote" : "";
|
|
13
|
+
}
|
|
14
|
+
function P(o) {
|
|
15
|
+
return G(!0, !1, o);
|
|
16
|
+
}
|
|
17
|
+
const M = "RemoteMethodsBase", $ = "HostMethods", N = "JSRemoteMethods", C = "JSHostMethods", E = "RemoteUrlParams";
|
|
18
|
+
function x(o, t) {
|
|
19
|
+
return A(
|
|
20
|
+
o,
|
|
21
|
+
(e) => ({ dart: "dynamic", js: "JSAny" }),
|
|
22
|
+
(e) => ({ dart: "dynamic", js: "JSAny" }),
|
|
23
|
+
(e) => ({ dart: "bool", js: "JSBoolean" }),
|
|
24
|
+
(e) => ({ dart: "int", js: "JSNumber" }),
|
|
25
|
+
(e) => ({ dart: "double", js: "JSNumber" }),
|
|
26
|
+
(e) => ({ dart: "String", js: "JSString" }),
|
|
27
|
+
(e) => ({ dart: "List", js: "JSArray" }),
|
|
28
|
+
(e) => {
|
|
29
|
+
const s = e;
|
|
30
|
+
return { dart: t?.get(s) ?? s.getCombinedName(), js: "JSObject" };
|
|
31
|
+
},
|
|
32
|
+
(e) => ({ dart: "Map", js: "JSObject" }),
|
|
33
|
+
(e) => ({ dart: "String", js: "JSString" }),
|
|
34
|
+
(e) => {
|
|
35
|
+
const s = L(e);
|
|
36
|
+
if (s) {
|
|
37
|
+
const r = x(s, t);
|
|
38
|
+
return { dart: `${r.dart}?`, js: `${r.js}?` };
|
|
39
|
+
}
|
|
40
|
+
return { dart: "dynamic", js: "JSAny" };
|
|
41
|
+
},
|
|
42
|
+
(e) => ({ dart: "String", js: "JSString" })
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function I(o, t) {
|
|
46
|
+
return x(o, t).dart;
|
|
47
|
+
}
|
|
48
|
+
function U(o) {
|
|
49
|
+
return A(
|
|
50
|
+
o,
|
|
51
|
+
(t) => !1,
|
|
52
|
+
(t) => !1,
|
|
53
|
+
(t) => !0,
|
|
54
|
+
(t) => !0,
|
|
55
|
+
(t) => !0,
|
|
56
|
+
(t) => !0,
|
|
57
|
+
(t) => !1,
|
|
58
|
+
(t) => !1,
|
|
59
|
+
(t) => !1,
|
|
60
|
+
(t) => !0,
|
|
61
|
+
(t) => {
|
|
62
|
+
const e = L(t);
|
|
63
|
+
return e ? U(e) : !1;
|
|
64
|
+
},
|
|
65
|
+
(t) => !0
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
const V = ["hostMethods", "remoteMethods", "remoteParams"];
|
|
69
|
+
function me(o) {
|
|
70
|
+
const t = o.getProperties();
|
|
71
|
+
if (t.size !== V.length) return !1;
|
|
72
|
+
for (const e of V)
|
|
73
|
+
if (!t.has(e)) return !1;
|
|
74
|
+
return !0;
|
|
75
|
+
}
|
|
76
|
+
function B(o) {
|
|
77
|
+
const t = o.topLevels;
|
|
78
|
+
if (!t?.size)
|
|
79
|
+
return null;
|
|
80
|
+
for (const [, e] of t)
|
|
81
|
+
if (e instanceof f)
|
|
82
|
+
return e;
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
function ce(o, t, e, s) {
|
|
86
|
+
const r = t.get(o) ?? o.getCombinedName(), a = [...(o.getSortedProperties?.() ?? o.getProperties()).entries()];
|
|
87
|
+
e.push(`extension type ${r}._(JSObject _) implements JSObject {`, ` external ${r}({`);
|
|
88
|
+
for (const [m, d] of a) {
|
|
89
|
+
const c = I(d.type, t), u = s(o, m);
|
|
90
|
+
e.push(` ${c} ${u},`);
|
|
91
|
+
}
|
|
92
|
+
e.push(" });", "");
|
|
93
|
+
for (const [m, d] of a) {
|
|
94
|
+
const c = I(d.type, t), u = s(o, m);
|
|
95
|
+
e.push(` external ${c} ${u};`);
|
|
96
|
+
}
|
|
97
|
+
e.push("}", "");
|
|
98
|
+
}
|
|
99
|
+
function ie(o, t) {
|
|
100
|
+
const e = B(o);
|
|
101
|
+
if (!e || !me(e))
|
|
102
|
+
throw new Error("Root type not found or is not a valid contract root");
|
|
103
|
+
const s = e.getProperties(), r = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), c = [], u = [], _ = [];
|
|
104
|
+
for (const [h, J] of s) {
|
|
105
|
+
const i = J.type;
|
|
106
|
+
if (!(i instanceof f)) continue;
|
|
107
|
+
if (p.add(i), h === "remoteParams") {
|
|
108
|
+
const y = i.getProperties();
|
|
109
|
+
for (const [j] of y)
|
|
110
|
+
c.push(t(i, j));
|
|
111
|
+
r.set(i, "RemoteParams");
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const n = ae(h), z = i.getProperties();
|
|
115
|
+
for (const [y, j] of z) {
|
|
116
|
+
const b = j.type;
|
|
117
|
+
if (!(b instanceof f)) continue;
|
|
118
|
+
a.add(b);
|
|
119
|
+
const S = b.getProperties().get("params")?.type, l = b.getProperties().get("returns")?.type, F = `${n}${P(y)}Params`, q = `${n}${P(y)}Returns`, K = `${n}${P(y)}Result`;
|
|
120
|
+
S instanceof f && (m.add(S), r.set(S, F)), l instanceof f && (d.add(l), r.set(l, q));
|
|
121
|
+
let g = "void", D = "JSAny", R = !0, O = !1;
|
|
122
|
+
if (l) {
|
|
123
|
+
const k = x(l, r);
|
|
124
|
+
g = k.dart, D = k.js, R = g === "void", O = g.endsWith("?");
|
|
125
|
+
}
|
|
126
|
+
const W = S instanceof f && S.getProperties().size > 0, Q = l ? U(l) : !1, v = {
|
|
127
|
+
methodName: t(i, y),
|
|
128
|
+
paramsTypeName: F,
|
|
129
|
+
resultTypeName: K,
|
|
130
|
+
resultDartType: g,
|
|
131
|
+
jsResultType: D,
|
|
132
|
+
resultIsVoid: R,
|
|
133
|
+
resultIsNullable: O,
|
|
134
|
+
resultNeedsToJS: Q,
|
|
135
|
+
hasParams: W
|
|
136
|
+
};
|
|
137
|
+
h === "remoteMethods" ? u.push(v) : h === "hostMethods" && _.push(v);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return { remoteParamKeys: c, remoteMethods: u, hostMethods: _, typeDisplayNames: r, sectionClasses: p, methodContainerTypes: a };
|
|
141
|
+
}
|
|
142
|
+
function pe(o) {
|
|
143
|
+
const t = [
|
|
144
|
+
"// Generated from JSON Schema. Do not edit by hand.",
|
|
145
|
+
"",
|
|
146
|
+
"import 'dart:js_interop';",
|
|
147
|
+
"import 'package:leancode_cyberware_contract_base/leancode_cyberware_contract_base.dart' as base;",
|
|
148
|
+
"import 'contract.dart';",
|
|
149
|
+
"",
|
|
150
|
+
"export 'package:leancode_cyberware_contract_base/src/connect_to_host_cubit.dart' hide ConnectToHostState, ConnectToHostCubitOptions, ConnectToHostCubit;",
|
|
151
|
+
"",
|
|
152
|
+
`typedef ConnectToHostState = base.ConnectToHostState<${$}>;`,
|
|
153
|
+
"",
|
|
154
|
+
`class ${E} extends base.UrlParamsBase {`,
|
|
155
|
+
` const ${E}();`,
|
|
156
|
+
""
|
|
157
|
+
];
|
|
158
|
+
for (const e of o.remoteParamKeys)
|
|
159
|
+
t.push(` String get ${e} => base.UrlParamsBase.params['${e}']!;`);
|
|
160
|
+
t.push("}", "", `abstract class ${M} {`);
|
|
161
|
+
for (const e of o.remoteMethods) {
|
|
162
|
+
const s = e.hasParams ? `${e.paramsTypeName} params` : "";
|
|
163
|
+
t.push(` Future<${e.resultTypeName}> ${e.methodName}(${s});`);
|
|
164
|
+
}
|
|
165
|
+
t.push(
|
|
166
|
+
"}",
|
|
167
|
+
"",
|
|
168
|
+
`extension type ${N}._(JSObject _) implements JSObject {`,
|
|
169
|
+
` external ${N}({`
|
|
170
|
+
);
|
|
171
|
+
for (const e of o.remoteMethods)
|
|
172
|
+
t.push(` required JSFunction ${e.methodName},`);
|
|
173
|
+
t.push(
|
|
174
|
+
" });",
|
|
175
|
+
"",
|
|
176
|
+
` factory ${N}.fromDart(${M} methods) {`,
|
|
177
|
+
" JSPromise promiseVoid(Future<void> f) => f.then((_) => null).toJS;",
|
|
178
|
+
" JSPromise promiseValue<T extends JSAny?>(Future<T> f) => f.toJS;",
|
|
179
|
+
"",
|
|
180
|
+
` return ${N}(`
|
|
181
|
+
);
|
|
182
|
+
for (const e of o.remoteMethods) {
|
|
183
|
+
const s = e.hasParams ? `(${e.paramsTypeName} params)` : "()", r = e.hasParams ? "(params)" : "()";
|
|
184
|
+
e.resultIsVoid ? t.push(
|
|
185
|
+
` ${e.methodName}: (${s} => promiseVoid(methods.${e.methodName}${r})).toJS,`
|
|
186
|
+
) : e.resultNeedsToJS ? t.push(
|
|
187
|
+
` ${e.methodName}: (${s} => promiseValue(methods.${e.methodName}${r}.then((s) => s.toJS))).toJS,`
|
|
188
|
+
) : t.push(
|
|
189
|
+
` ${e.methodName}: (${s} => promiseValue(methods.${e.methodName}${r})).toJS,`
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
t.push(" );", " }", "");
|
|
193
|
+
for (const e of o.remoteMethods)
|
|
194
|
+
t.push(` external JSFunction ${e.methodName};`);
|
|
195
|
+
t.push("}", "", `extension type ${C}._(JSObject _) implements JSObject {`);
|
|
196
|
+
for (const e of o.hostMethods) {
|
|
197
|
+
const s = e.hasParams ? `(${e.paramsTypeName} params)` : "()", r = e.resultIsVoid ? "JSPromise" : `JSPromise<${e.jsResultType}>`;
|
|
198
|
+
t.push(` external ${r} ${e.methodName}${s};`);
|
|
199
|
+
}
|
|
200
|
+
t.push(
|
|
201
|
+
"}",
|
|
202
|
+
"",
|
|
203
|
+
`class ${$} {`,
|
|
204
|
+
` const ${$}(this._jsMethods);`,
|
|
205
|
+
"",
|
|
206
|
+
` final ${C} _jsMethods;`,
|
|
207
|
+
""
|
|
208
|
+
);
|
|
209
|
+
for (const e of o.hostMethods) {
|
|
210
|
+
const s = e.hasParams ? "(params)" : "()", r = e.hasParams ? `(${e.paramsTypeName} params)` : "()";
|
|
211
|
+
e.resultIsVoid ? t.push(
|
|
212
|
+
` Future<${e.resultTypeName}> ${e.methodName}${r} => _jsMethods.${e.methodName}${s}.toDart;`
|
|
213
|
+
) : e.resultIsNullable ? t.push(
|
|
214
|
+
` Future<${e.resultTypeName}> ${e.methodName}${r} => _jsMethods.${e.methodName}${s}.toDart.then((v) => v?.toDart);`
|
|
215
|
+
) : t.push(
|
|
216
|
+
` Future<${e.resultTypeName}> ${e.methodName}${r} => _jsMethods.${e.methodName}${s}.toDart.then((v) => v.toDart);`
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
return t.push("}"), t;
|
|
220
|
+
}
|
|
221
|
+
function de() {
|
|
222
|
+
return [
|
|
223
|
+
"// Generated from JSON Schema. Do not edit by hand.",
|
|
224
|
+
"",
|
|
225
|
+
"import 'package:leancode_cyberware_contract_base/leancode_cyberware_contract_base.dart';",
|
|
226
|
+
"import 'types.dart';",
|
|
227
|
+
"",
|
|
228
|
+
`Future<ConnectToHostResult<${$}>> connectToHost(${M} methods) async {`,
|
|
229
|
+
` final raw = await connectToHostRaw<${C}>(${N}.fromDart(methods));`,
|
|
230
|
+
` return raw.toTyped(${$}.new);`,
|
|
231
|
+
"}"
|
|
232
|
+
];
|
|
233
|
+
}
|
|
234
|
+
function ue(o, t, e) {
|
|
235
|
+
const s = B(o);
|
|
236
|
+
if (!s)
|
|
237
|
+
throw new Error("Root type not found");
|
|
238
|
+
const r = ["// Generated from JSON Schema. Do not edit by hand.", "", "import 'dart:js_interop';", ""], a = [...o.allNamedTypes?.() ?? /* @__PURE__ */ new Set()].filter((n) => n.kind === "class"), { typeDisplayNames: m, sectionClasses: d, methodContainerTypes: c, hostMethods: u, remoteMethods: _ } = e;
|
|
239
|
+
for (const n of a)
|
|
240
|
+
n !== s && !d.has(n) && !c.has(n) && !m.has(n) && m.set(n, P(n.getCombinedName()));
|
|
241
|
+
const h = s.getProperties().get("remoteParams"), J = h?.type instanceof f ? h.type : void 0, i = a.filter(
|
|
242
|
+
(n) => n !== s && !c.has(n) && (!d.has(n) || n === J)
|
|
243
|
+
);
|
|
244
|
+
for (const n of i)
|
|
245
|
+
ce(n, m, r, t);
|
|
246
|
+
for (const n of [...u, ..._])
|
|
247
|
+
r.push(`typedef ${n.resultTypeName} = ${n.resultDartType};`);
|
|
248
|
+
return r;
|
|
249
|
+
}
|
|
250
|
+
class he extends Y {
|
|
251
|
+
_resolvedPropertyNames = /* @__PURE__ */ new Map();
|
|
252
|
+
constructor(t, e) {
|
|
253
|
+
super(t, e);
|
|
254
|
+
}
|
|
255
|
+
forbiddenNamesForGlobalNamespace() {
|
|
256
|
+
return se;
|
|
257
|
+
}
|
|
258
|
+
forbiddenForObjectProperties(t, e) {
|
|
259
|
+
return { names: [], includeGlobalForbidden: !0 };
|
|
260
|
+
}
|
|
261
|
+
makeNamedTypeNamer() {
|
|
262
|
+
return re;
|
|
263
|
+
}
|
|
264
|
+
namerForObjectProperty(t, e) {
|
|
265
|
+
return H;
|
|
266
|
+
}
|
|
267
|
+
makeUnionMemberNamer() {
|
|
268
|
+
return H;
|
|
269
|
+
}
|
|
270
|
+
makeEnumCaseNamer() {
|
|
271
|
+
return ne;
|
|
272
|
+
}
|
|
273
|
+
resolvePropertyName(t, e) {
|
|
274
|
+
return this._resolvedPropertyNames.get(t)?.get(e) ?? G(!1, !1, e);
|
|
275
|
+
}
|
|
276
|
+
emitSourceStructure() {
|
|
277
|
+
this.forEachObject("none", (s) => {
|
|
278
|
+
const r = /* @__PURE__ */ new Map();
|
|
279
|
+
this.forEachClassProperty(s, "none", (p, a) => {
|
|
280
|
+
r.set(a, this.sourcelikeToString(p));
|
|
281
|
+
}), this._resolvedPropertyNames.set(s, r);
|
|
282
|
+
});
|
|
283
|
+
const t = (s, r) => this.resolvePropertyName(s, r), e = ie(this.typeGraph, t);
|
|
284
|
+
for (const s of ue(this.typeGraph, t, e))
|
|
285
|
+
this.emitLine(s);
|
|
286
|
+
this.finishFile("contract.dart");
|
|
287
|
+
for (const s of pe(e))
|
|
288
|
+
this.emitLine(s);
|
|
289
|
+
this.finishFile("types.dart");
|
|
290
|
+
for (const s of de())
|
|
291
|
+
this.emitLine(s);
|
|
292
|
+
this.finishFile("connect_to_host.dart");
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const le = {};
|
|
296
|
+
class fe extends Z {
|
|
297
|
+
constructor() {
|
|
298
|
+
super({
|
|
299
|
+
displayName: "Dart Extension Types (JS Interop)",
|
|
300
|
+
names: ["dart-extension-types"],
|
|
301
|
+
extension: "dart"
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
getOptions() {
|
|
305
|
+
return le;
|
|
306
|
+
}
|
|
307
|
+
get supportsUnionsWithBothNumberTypes() {
|
|
308
|
+
return !0;
|
|
309
|
+
}
|
|
310
|
+
makeRenderer(t) {
|
|
311
|
+
return new he(this, t);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function ye(o) {
|
|
315
|
+
const t = T.toJSONSchema(o, { unrepresentable: "any", reused: "ref", target: "draft-7" });
|
|
316
|
+
return JSON.stringify(t);
|
|
317
|
+
}
|
|
318
|
+
async function Se(o, t) {
|
|
319
|
+
const e = new ee(), s = new te(void 0);
|
|
320
|
+
await s.addSource({ name: "contract", schema: o }), e.addInput(s);
|
|
321
|
+
const r = await oe({
|
|
322
|
+
lang: new fe(),
|
|
323
|
+
inputData: e
|
|
324
|
+
});
|
|
325
|
+
for (const [p, { lines: a }] of r)
|
|
326
|
+
w.writeFileSync(X.join(t, p), a.join(`
|
|
327
|
+
`), "utf8");
|
|
328
|
+
}
|
|
329
|
+
async function Je(o, t) {
|
|
330
|
+
const e = ye(o.schema);
|
|
331
|
+
w.existsSync(t) || w.mkdirSync(t, { recursive: !0 }), await Se(e, t), process.stdout.write(`Dart generated in ${t}
|
|
332
|
+
`);
|
|
333
|
+
}
|
|
334
|
+
export {
|
|
335
|
+
Pe as c,
|
|
336
|
+
Je as g
|
|
337
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";const P=require("zod"),w=require("node:fs"),K=require("node:path"),a=require("quicktype-core"),W=require("quicktype-core/dist/language/Dart/constants.js"),S=require("quicktype-core/dist/language/Dart/utils.js"),Q=P.z.object({schema:P.z.custom(),outputDir:P.z.string().describe("Directory where Dart files will be written (contract.dart, types.dart, connect_to_host.dart)")});function X(o){return o==="hostMethods"?"Host":o==="remoteMethods"?"Remote":""}function J(o){return S.dartNameStyle(!0,!1,o)}const M="RemoteMethodsBase",_="HostMethods",$="JSRemoteMethods",F="JSHostMethods",E="RemoteUrlParams";function x(o,t){return a.matchType(o,e=>({dart:"dynamic",js:"JSAny"}),e=>({dart:"dynamic",js:"JSAny"}),e=>({dart:"bool",js:"JSBoolean"}),e=>({dart:"int",js:"JSNumber"}),e=>({dart:"double",js:"JSNumber"}),e=>({dart:"String",js:"JSString"}),e=>({dart:"List",js:"JSArray"}),e=>{const s=e;return{dart:t?.get(s)??s.getCombinedName(),js:"JSObject"}},e=>({dart:"Map",js:"JSObject"}),e=>({dart:"String",js:"JSString"}),e=>{const s=a.nullableFromUnion(e);if(s){const r=x(s,t);return{dart:`${r.dart}?`,js:`${r.js}?`}}return{dart:"dynamic",js:"JSAny"}},e=>({dart:"String",js:"JSString"}))}function I(o,t){return x(o,t).dart}function q(o){return a.matchType(o,t=>!1,t=>!1,t=>!0,t=>!0,t=>!0,t=>!0,t=>!1,t=>!1,t=>!1,t=>!0,t=>{const e=a.nullableFromUnion(t);return e?q(e):!1},t=>!0)}const V=["hostMethods","remoteMethods","remoteParams"];function Y(o){const t=o.getProperties();if(t.size!==V.length)return!1;for(const e of V)if(!t.has(e))return!1;return!0}function z(o){const t=o.topLevels;if(!t?.size)return null;for(const[,e]of t)if(e instanceof a.ClassType)return e;return null}function Z(o,t,e,s){const r=t.get(o)??o.getCombinedName(),c=[...(o.getSortedProperties?.()??o.getProperties()).entries()];e.push(`extension type ${r}._(JSObject _) implements JSObject {`,` external ${r}({`);for(const[i,d]of c){const m=I(d.type,t),l=s(o,i);e.push(` ${m} ${l},`)}e.push(" });","");for(const[i,d]of c){const m=I(d.type,t),l=s(o,i);e.push(` external ${m} ${l};`)}e.push("}","")}function ee(o,t){const e=z(o);if(!e||!Y(e))throw new Error("Root type not found or is not a valid contract root");const s=e.getProperties(),r=new Map,p=new Set,c=new Set,i=new Set,d=new Set,m=[],l=[],T=[];for(const[h,j]of s){const u=j.type;if(!(u instanceof a.ClassType))continue;if(p.add(u),h==="remoteParams"){const y=u.getProperties();for(const[C]of y)m.push(t(u,C));r.set(u,"RemoteParams");continue}const n=X(h),A=u.getProperties();for(const[y,C]of A){const b=C.type;if(!(b instanceof a.ClassType))continue;c.add(b);const N=b.getProperties().get("params")?.type,f=b.getProperties().get("returns")?.type,D=`${n}${J(y)}Params`,G=`${n}${J(y)}Returns`,L=`${n}${J(y)}Result`;N instanceof a.ClassType&&(i.add(N),r.set(N,D)),f instanceof a.ClassType&&(d.add(f),r.set(f,G));let g="void",R="JSAny",O=!0,v=!1;if(f){const H=x(f,r);g=H.dart,R=H.js,O=g==="void",v=g.endsWith("?")}const U=N instanceof a.ClassType&&N.getProperties().size>0,B=f?q(f):!1,k={methodName:t(u,y),paramsTypeName:D,resultTypeName:L,resultDartType:g,jsResultType:R,resultIsVoid:O,resultIsNullable:v,resultNeedsToJS:B,hasParams:U};h==="remoteMethods"?l.push(k):h==="hostMethods"&&T.push(k)}}return{remoteParamKeys:m,remoteMethods:l,hostMethods:T,typeDisplayNames:r,sectionClasses:p,methodContainerTypes:c}}function te(o){const t=["// Generated from JSON Schema. Do not edit by hand.","","import 'dart:js_interop';","import 'package:leancode_cyberware_contract_base/leancode_cyberware_contract_base.dart' as base;","import 'contract.dart';","","export 'package:leancode_cyberware_contract_base/src/connect_to_host_cubit.dart' hide ConnectToHostState, ConnectToHostCubitOptions, ConnectToHostCubit;","",`typedef ConnectToHostState = base.ConnectToHostState<${_}>;`,"",`class ${E} extends base.UrlParamsBase {`,` const ${E}();`,""];for(const e of o.remoteParamKeys)t.push(` String get ${e} => base.UrlParamsBase.params['${e}']!;`);t.push("}","",`abstract class ${M} {`);for(const e of o.remoteMethods){const s=e.hasParams?`${e.paramsTypeName} params`:"";t.push(` Future<${e.resultTypeName}> ${e.methodName}(${s});`)}t.push("}","",`extension type ${$}._(JSObject _) implements JSObject {`,` external ${$}({`);for(const e of o.remoteMethods)t.push(` required JSFunction ${e.methodName},`);t.push(" });","",` factory ${$}.fromDart(${M} methods) {`," JSPromise promiseVoid(Future<void> f) => f.then((_) => null).toJS;"," JSPromise promiseValue<T extends JSAny?>(Future<T> f) => f.toJS;","",` return ${$}(`);for(const e of o.remoteMethods){const s=e.hasParams?`(${e.paramsTypeName} params)`:"()",r=e.hasParams?"(params)":"()";e.resultIsVoid?t.push(` ${e.methodName}: (${s} => promiseVoid(methods.${e.methodName}${r})).toJS,`):e.resultNeedsToJS?t.push(` ${e.methodName}: (${s} => promiseValue(methods.${e.methodName}${r}.then((s) => s.toJS))).toJS,`):t.push(` ${e.methodName}: (${s} => promiseValue(methods.${e.methodName}${r})).toJS,`)}t.push(" );"," }","");for(const e of o.remoteMethods)t.push(` external JSFunction ${e.methodName};`);t.push("}","",`extension type ${F}._(JSObject _) implements JSObject {`);for(const e of o.hostMethods){const s=e.hasParams?`(${e.paramsTypeName} params)`:"()",r=e.resultIsVoid?"JSPromise":`JSPromise<${e.jsResultType}>`;t.push(` external ${r} ${e.methodName}${s};`)}t.push("}","",`class ${_} {`,` const ${_}(this._jsMethods);`,"",` final ${F} _jsMethods;`,"");for(const e of o.hostMethods){const s=e.hasParams?"(params)":"()",r=e.hasParams?`(${e.paramsTypeName} params)`:"()";e.resultIsVoid?t.push(` Future<${e.resultTypeName}> ${e.methodName}${r} => _jsMethods.${e.methodName}${s}.toDart;`):e.resultIsNullable?t.push(` Future<${e.resultTypeName}> ${e.methodName}${r} => _jsMethods.${e.methodName}${s}.toDart.then((v) => v?.toDart);`):t.push(` Future<${e.resultTypeName}> ${e.methodName}${r} => _jsMethods.${e.methodName}${s}.toDart.then((v) => v.toDart);`)}return t.push("}"),t}function oe(){return["// Generated from JSON Schema. Do not edit by hand.","","import 'package:leancode_cyberware_contract_base/leancode_cyberware_contract_base.dart';","import 'types.dart';","",`Future<ConnectToHostResult<${_}>> connectToHost(${M} methods) async {`,` final raw = await connectToHostRaw<${F}>(${$}.fromDart(methods));`,` return raw.toTyped(${_}.new);`,"}"]}function se(o,t,e){const s=z(o);if(!s)throw new Error("Root type not found");const r=["// Generated from JSON Schema. Do not edit by hand.","","import 'dart:js_interop';",""],c=[...o.allNamedTypes?.()??new Set].filter(n=>n.kind==="class"),{typeDisplayNames:i,sectionClasses:d,methodContainerTypes:m,hostMethods:l,remoteMethods:T}=e;for(const n of c)n!==s&&!d.has(n)&&!m.has(n)&&!i.has(n)&&i.set(n,J(n.getCombinedName()));const h=s.getProperties().get("remoteParams"),j=h?.type instanceof a.ClassType?h.type:void 0,u=c.filter(n=>n!==s&&!m.has(n)&&(!d.has(n)||n===j));for(const n of u)Z(n,i,r,t);for(const n of[...l,...T])r.push(`typedef ${n.resultTypeName} = ${n.resultDartType};`);return r}class re extends a.ConvenienceRenderer{_resolvedPropertyNames=new Map;constructor(t,e){super(t,e)}forbiddenNamesForGlobalNamespace(){return W.keywords}forbiddenForObjectProperties(t,e){return{names:[],includeGlobalForbidden:!0}}makeNamedTypeNamer(){return S.typeNamingFunction}namerForObjectProperty(t,e){return S.propertyNamingFunction}makeUnionMemberNamer(){return S.propertyNamingFunction}makeEnumCaseNamer(){return S.enumCaseNamingFunction}resolvePropertyName(t,e){return this._resolvedPropertyNames.get(t)?.get(e)??S.dartNameStyle(!1,!1,e)}emitSourceStructure(){this.forEachObject("none",s=>{const r=new Map;this.forEachClassProperty(s,"none",(p,c)=>{r.set(c,this.sourcelikeToString(p))}),this._resolvedPropertyNames.set(s,r)});const t=(s,r)=>this.resolvePropertyName(s,r),e=ee(this.typeGraph,t);for(const s of se(this.typeGraph,t,e))this.emitLine(s);this.finishFile("contract.dart");for(const s of te(e))this.emitLine(s);this.finishFile("types.dart");for(const s of oe())this.emitLine(s);this.finishFile("connect_to_host.dart")}}const ne={};class ae extends a.TargetLanguage{constructor(){super({displayName:"Dart Extension Types (JS Interop)",names:["dart-extension-types"],extension:"dart"})}getOptions(){return ne}get supportsUnionsWithBothNumberTypes(){return!0}makeRenderer(t){return new re(this,t)}}function ce(o){const t=P.z.toJSONSchema(o,{unrepresentable:"any",reused:"ref",target:"draft-7"});return JSON.stringify(t)}async function ie(o,t){const e=new a.InputData,s=new a.JSONSchemaInput(void 0);await s.addSource({name:"contract",schema:o}),e.addInput(s);const r=await a.quicktypeMultiFile({lang:new ae,inputData:e});for(const[p,{lines:c}]of r)w.writeFileSync(K.join(t,p),c.join(`
|
|
2
|
+
`),"utf8")}async function me(o,t){const e=ce(o.schema);w.existsSync(t)||w.mkdirSync(t,{recursive:!0}),await ie(e,t),process.stdout.write(`Dart generated in ${t}
|
|
3
|
+
`)}exports.cyberwareContractGeneratorDartConfigSchema=Q;exports.generate=me;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CyberwareContractGeneratorDartConfig } from './config';
|
|
2
|
+
/**
|
|
3
|
+
* Generates Dart extension type files from an iframe contract schema. Produces three files in the
|
|
4
|
+
* output directory: `contract.dart`, `types.dart`, and `connect_to_host.dart`.
|
|
5
|
+
*
|
|
6
|
+
* @param config - Configuration containing the Zod contract schema
|
|
7
|
+
* @param outputDir - Absolute or relative path to the directory where Dart files will be written
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { generate } from "@leancodepl/cyberware-contract-generator-dart";
|
|
12
|
+
* import { mkZodContractSchema, methodDef } from "@leancodepl/cyberware-contract";
|
|
13
|
+
* import { z } from "zod";
|
|
14
|
+
*
|
|
15
|
+
* const schema = mkZodContractSchema({
|
|
16
|
+
* hostMethods: {
|
|
17
|
+
* navigateTo: methodDef({ params: z.object({ path: z.string() }) }),
|
|
18
|
+
* },
|
|
19
|
+
* remoteMethods: {
|
|
20
|
+
* getCurrentPath: methodDef({ returns: z.string() }),
|
|
21
|
+
* },
|
|
22
|
+
* remoteParams: { userId: z.string() },
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* await generate({ schema }, "./lib/generated");
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function generate(config: Pick<CyberwareContractGeneratorDartConfig, "schema">, outputDir: string): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oCAAoC,EAAE,MAAM,UAAU,CAAA;AA0B/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,oCAAoC,EAAE,QAAQ,CAAC,EAAE,SAAS,EAAE,MAAM,iBAU7G"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./generate-Dv3_3Ssg.cjs");exports.cyberwareContractGeneratorDartConfigSchema=e.cyberwareContractGeneratorDartConfigSchema;exports.generate=e.generate;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CyberwareContractGeneratorDartConfig } from './config';
|
|
2
|
+
export declare function resolveOutputDir(config: CyberwareContractGeneratorDartConfig, configDir: string): string;
|
|
3
|
+
export declare function loadConfig(configPath?: string): Promise<{
|
|
4
|
+
config: {
|
|
5
|
+
schema: import('zod').ZodType<{
|
|
6
|
+
hostMethods: Record<string, {
|
|
7
|
+
params?: unknown;
|
|
8
|
+
returns?: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
remoteMethods: Record<string, {
|
|
11
|
+
params?: unknown;
|
|
12
|
+
returns?: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
remoteParams: Record<string, string>;
|
|
15
|
+
}, unknown, import('zod/v4/core').$ZodTypeInternals<{
|
|
16
|
+
hostMethods: Record<string, {
|
|
17
|
+
params?: unknown;
|
|
18
|
+
returns?: unknown;
|
|
19
|
+
}>;
|
|
20
|
+
remoteMethods: Record<string, {
|
|
21
|
+
params?: unknown;
|
|
22
|
+
returns?: unknown;
|
|
23
|
+
}>;
|
|
24
|
+
remoteParams: Record<string, string>;
|
|
25
|
+
}, unknown>>;
|
|
26
|
+
outputDir: string;
|
|
27
|
+
};
|
|
28
|
+
outputDir: string;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=loadConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadConfig.d.ts","sourceRoot":"","sources":["../src/loadConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oCAAoC,EAA8C,MAAM,UAAU,CAAA;AAQ3G,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,oCAAoC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExG;AAED,wBAAsB,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;GAenD"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@leancodepl/cyberware-contract-generator-dart",
|
|
3
|
+
"version": "10.1.3",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"cyberware-contract-generator-dart": "./dist/bin.js"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@leancodepl/cyberware-contract": "10.1.3",
|
|
22
|
+
"lilconfig": "^3.1.3",
|
|
23
|
+
"quicktype-core": "^23.2.6",
|
|
24
|
+
"yargs": "^18.0.0",
|
|
25
|
+
"zod": "^4.0.5"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"registry": "https://registry.npmjs.org/"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22.0.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"vitest": "*"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/leancodepl/js_corelibrary.git",
|
|
41
|
+
"directory": "packages/cyberware/cyberware-contract-generator-dart"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/leancodepl/js_corelibrary",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/leancodepl/js_corelibrary/issues"
|
|
46
|
+
},
|
|
47
|
+
"description": "Generates Dart code from a JSON Schema contract.",
|
|
48
|
+
"keywords": [
|
|
49
|
+
"dart",
|
|
50
|
+
"json-schema",
|
|
51
|
+
"generator",
|
|
52
|
+
"contract",
|
|
53
|
+
"leancode"
|
|
54
|
+
],
|
|
55
|
+
"author": {
|
|
56
|
+
"name": "LeanCode",
|
|
57
|
+
"url": "https://leancode.co"
|
|
58
|
+
},
|
|
59
|
+
"sideEffects": false,
|
|
60
|
+
"files": [
|
|
61
|
+
"dist",
|
|
62
|
+
"CHANGELOG.md",
|
|
63
|
+
"!**/*.tsbuildinfo"
|
|
64
|
+
]
|
|
65
|
+
}
|