quicktype 24.0.0 → 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.
Files changed (2) hide show
  1. package/README.md +17 -0
  2. package/package.json +5 -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.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",
@@ -32,6 +32,7 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@glideapps/ts-necessities": "^2.2.3",
35
+ "@types/readable-stream": "4.0.10",
35
36
  "chalk": "^4.1.2",
36
37
  "collection-utils": "^1.0.1",
37
38
  "command-line-args": "^5.2.1",
@@ -39,9 +40,9 @@
39
40
  "graphql": "^16.11.0",
40
41
  "lodash": "^4.18.1",
41
42
  "moment": "^2.30.1",
42
- "quicktype-core": "24.0.0",
43
- "quicktype-graphql-input": "24.0.0",
44
- "quicktype-typescript-input": "24.0.0",
43
+ "quicktype-core": "24.0.2",
44
+ "quicktype-graphql-input": "24.0.2",
45
+ "quicktype-typescript-input": "24.0.2",
45
46
  "readable-stream": "^4.5.2",
46
47
  "stream-json": "1.8.0",
47
48
  "string-to-stream": "^3.0.1",