quicktype 24.0.1 → 24.0.2
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/README.md +17 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -189,6 +189,23 @@ main();
|
|
|
189
189
|
|
|
190
190
|
The argument to `quicktype` is a complex object with many optional properties. [Explore its definition](https://github.com/quicktype/quicktype/blob/master/packages/quicktype-core/src/Run.ts#L637) to understand what options are allowed.
|
|
191
191
|
|
|
192
|
+
#### Bundling `quicktype-core` as ESM
|
|
193
|
+
|
|
194
|
+
`quicktype-core` ships both CommonJS and ESM builds. If you bundle it into an ESM output for Node with esbuild (`--format=esm --platform=node`), the bundle may throw at runtime:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
Error: Dynamic require of "process" is not supported
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
This is not specific to quicktype: some of its dependencies (e.g. `yaml`) expose an ESM entry that wraps a CommonJS core, and esbuild replaces `require` calls inside inlined CommonJS with a shim that throws in ESM output. The standard workaround is to inject a `createRequire` banner:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
esbuild main.js --bundle --format=esm --platform=node \
|
|
204
|
+
--banner:js="import { createRequire } from 'module'; const require = createRequire(import.meta.url);"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Bundling to CommonJS output (`--format=cjs`) works without any workaround.
|
|
208
|
+
|
|
192
209
|
### Adding Custom logic or Rendering:
|
|
193
210
|
|
|
194
211
|
Quicktype supports creating your own custom languages and rendering output, you can extend existing classes or create your own to be using by the `quicktype function`.<br/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quicktype",
|
|
3
|
-
"version": "24.0.
|
|
3
|
+
"version": "24.0.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"graphql": "^16.11.0",
|
|
41
41
|
"lodash": "^4.18.1",
|
|
42
42
|
"moment": "^2.30.1",
|
|
43
|
-
"quicktype-core": "24.0.
|
|
44
|
-
"quicktype-graphql-input": "24.0.
|
|
45
|
-
"quicktype-typescript-input": "24.0.
|
|
43
|
+
"quicktype-core": "24.0.2",
|
|
44
|
+
"quicktype-graphql-input": "24.0.2",
|
|
45
|
+
"quicktype-typescript-input": "24.0.2",
|
|
46
46
|
"readable-stream": "^4.5.2",
|
|
47
47
|
"stream-json": "1.8.0",
|
|
48
48
|
"string-to-stream": "^3.0.1",
|