schemastore-to-typescript 1.3.0 → 1.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.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,139 @@
2
2
  "name": "schemastore-to-typescript",
3
3
  "entries": [
4
4
  {
5
- "date": "Sun, 01 Nov 2026 16:58:53 GMT",
5
+ "date": "Tue, 10 Nov 2026 03:35:54 GMT",
6
+ "version": "1.5.0",
7
+ "tag": "schemastore-to-typescript_v1.5.0",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "author": "filip.dupanovic@gmail.com",
12
+ "package": "schemastore-to-typescript",
13
+ "commit": "640730f9cafde3b3fe1ef256091f1b70dcfe8d4e",
14
+ "comment": "Refuse schema references to local files and over http, which the compiler read from the working directory and fetched"
15
+ },
16
+ {
17
+ "author": "filip.dupanovic@gmail.com",
18
+ "package": "schemastore-to-typescript",
19
+ "commit": "640730f9cafde3b3fe1ef256091f1b70dcfe8d4e",
20
+ "comment": "Sanitize the documents that schema references point to, and fetch them through the cache"
21
+ }
22
+ ],
23
+ "patch": [
24
+ {
25
+ "author": "filip.dupanovic@gmail.com",
26
+ "package": "schemastore-to-typescript",
27
+ "commit": "640730f9cafde3b3fe1ef256091f1b70dcfe8d4e",
28
+ "comment": "Ignore tsType in schemas, which the compiler would write into the typings as code"
29
+ },
30
+ {
31
+ "author": "email not defined",
32
+ "package": "schemastore-to-typescript",
33
+ "commit": "640730f9cafde3b3fe1ef256091f1b70dcfe8d4e",
34
+ "comment": "Update dependency commander to v15.1.0"
35
+ },
36
+ {
37
+ "author": "filip.dupanovic@gmail.com",
38
+ "package": "schemastore-to-typescript",
39
+ "commit": "640730f9cafde3b3fe1ef256091f1b70dcfe8d4e",
40
+ "comment": "Escape every comment terminator in the patterns of pattern properties"
41
+ }
42
+ ]
43
+ }
44
+ },
45
+ {
46
+ "date": "Mon, 09 Nov 2026 14:18:24 GMT",
47
+ "version": "1.4.0",
48
+ "tag": "schemastore-to-typescript_v1.4.0",
49
+ "comments": {
50
+ "none": [
51
+ {
52
+ "author": "filip.dupanovic@gmail.com",
53
+ "package": "schemastore-to-typescript",
54
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
55
+ "comment": "Upgrade @langri-sha/projen-project to 0.51.0"
56
+ },
57
+ {
58
+ "author": "filip.dupanovic@gmail.com",
59
+ "package": "schemastore-to-typescript",
60
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
61
+ "comment": "Upgrade to TypeScript 6"
62
+ }
63
+ ],
64
+ "minor": [
65
+ {
66
+ "author": "filip.dupanovic@gmail.com",
67
+ "package": "schemastore-to-typescript",
68
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
69
+ "comment": "Compile a schema from its https URL, as well as from its catalog name"
70
+ }
71
+ ],
72
+ "patch": [
73
+ {
74
+ "author": "email not defined",
75
+ "package": "schemastore-to-typescript",
76
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
77
+ "comment": "Update dependency @langri-sha/projen-project to v0.49.0"
78
+ },
79
+ {
80
+ "author": "email not defined",
81
+ "package": "schemastore-to-typescript",
82
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
83
+ "comment": "Update dependency @langri-sha/tsconfig to v3"
84
+ },
85
+ {
86
+ "author": "email not defined",
87
+ "package": "schemastore-to-typescript",
88
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
89
+ "comment": "Update dependency @langri-sha/projen-project to v0.49.2"
90
+ },
91
+ {
92
+ "author": "email not defined",
93
+ "package": "schemastore-to-typescript",
94
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
95
+ "comment": "Update dependency @langri-sha/tsconfig to v2"
96
+ },
97
+ {
98
+ "author": "email not defined",
99
+ "package": "schemastore-to-typescript",
100
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
101
+ "comment": "Update dependency @langri-sha/projen-project to v0.48.2"
102
+ },
103
+ {
104
+ "author": "email not defined",
105
+ "package": "schemastore-to-typescript",
106
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
107
+ "comment": "Update dependency pnpm to v12.18.0"
108
+ },
109
+ {
110
+ "author": "email not defined",
111
+ "package": "schemastore-to-typescript",
112
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
113
+ "comment": "Update dependency got to v16.2.0"
114
+ },
115
+ {
116
+ "author": "email not defined",
117
+ "package": "schemastore-to-typescript",
118
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
119
+ "comment": "Update dependency @langri-sha/projen-project to v0.48.3"
120
+ },
121
+ {
122
+ "author": "email not defined",
123
+ "package": "schemastore-to-typescript",
124
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
125
+ "comment": "Update dependency pnpm to v12.17.0"
126
+ },
127
+ {
128
+ "author": "email not defined",
129
+ "package": "schemastore-to-typescript",
130
+ "commit": "299736e72267bac65189693fb68ed6b734030060",
131
+ "comment": "Update dependency @langri-sha/projen-project to v0.52.0"
132
+ }
133
+ ]
134
+ }
135
+ },
136
+ {
137
+ "date": "Sun, 01 Nov 2026 16:59:00 GMT",
6
138
  "version": "1.3.0",
7
139
  "tag": "schemastore-to-typescript_v1.3.0",
8
140
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,48 @@
1
1
  # Change Log - schemastore-to-typescript
2
2
 
3
- <!-- This log was last generated on Sun, 01 Nov 2026 16:58:53 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Tue, 10 Nov 2026 03:35:54 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 1.5.0
8
+
9
+ Tue, 10 Nov 2026 03:35:54 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Refuse schema references to local files and over http, which the compiler read from the working directory and fetched (filip.dupanovic@gmail.com)
14
+ - Sanitize the documents that schema references point to, and fetch them through the cache (filip.dupanovic@gmail.com)
15
+
16
+ ### Patches
17
+
18
+ - Ignore tsType in schemas, which the compiler would write into the typings as code (filip.dupanovic@gmail.com)
19
+ - Update dependency commander to v15.1.0
20
+ - Escape every comment terminator in the patterns of pattern properties (filip.dupanovic@gmail.com)
21
+
22
+ ## 1.4.0
23
+
24
+ Mon, 09 Nov 2026 14:18:24 GMT
25
+
26
+ ### Minor changes
27
+
28
+ - Compile a schema from its https URL, as well as from its catalog name (filip.dupanovic@gmail.com)
29
+
30
+ ### Patches
31
+
32
+ - Update dependency @langri-sha/projen-project to v0.49.0
33
+ - Update dependency @langri-sha/tsconfig to v3
34
+ - Update dependency @langri-sha/projen-project to v0.49.2
35
+ - Update dependency @langri-sha/tsconfig to v2
36
+ - Update dependency @langri-sha/projen-project to v0.48.2
37
+ - Update dependency pnpm to v12.18.0
38
+ - Update dependency got to v16.2.0
39
+ - Update dependency @langri-sha/projen-project to v0.48.3
40
+ - Update dependency pnpm to v12.17.0
41
+ - Update dependency @langri-sha/projen-project to v0.52.0
42
+
7
43
  ## 1.3.0
8
44
 
9
- Sun, 01 Nov 2026 16:58:53 GMT
45
+ Sun, 01 Nov 2026 16:59:00 GMT
10
46
 
11
47
  ### Minor changes
12
48
 
package/dist/cli.js CHANGED
@@ -4,12 +4,13 @@ import * as path from 'node:path';
4
4
  import { Command, Option } from 'commander';
5
5
  import createDebug from 'debug';
6
6
  import esMain from 'es-main';
7
+ import { isSchemaUrl, urlName } from './url.js';
7
8
  import { compile } from './index.js';
8
9
  const debug = createDebug('schema-store-to-typescript');
9
10
  export const program = new Command()
10
11
  .name('schemastore-to-typescript')
11
12
  .description('Compile a JSON schema store schema to TypeScript definitions')
12
- .argument('<schema>', 'JSON schema store schema')
13
+ .argument('<schema>', 'JSON schema store schema name, or the https URL of a JSON schema')
13
14
  .argument('[output]', 'Path to output the TypeScript definition')
14
15
  .option('-n, --no-cache', 'Skip caching requests')
15
16
  .option('--jsii', 'Emit typings that jsii can compile')
@@ -17,7 +18,7 @@ export const program = new Command()
17
18
  .option('--type-name <name>', 'Name the root interface')
18
19
  .showHelpAfterError()
19
20
  .action(async (schema, output, { cache, jsii, keepNull, typeName }) => {
20
- output ??= `${schema}.d.ts`;
21
+ output ??= `${isSchemaUrl(schema) ? urlName(schema) : schema}.d.ts`;
21
22
  const compiled = await compile(schema, cache, {
22
23
  jsii,
23
24
  keepNull,
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,WAAW,MAAM,OAAO,CAAA;AAC/B,OAAO,MAAM,MAAM,SAAS,CAAA;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAEpC,MAAM,KAAK,GAAG,WAAW,CAAC,4BAA4B,CAAC,CAAA;AAEvD,MAAM,CAAC,MAAM,OAAO,GAAY,IAAI,OAAO,EAAE;KAC1C,IAAI,CAAC,2BAA2B,CAAC;KACjC,WAAW,CAAC,8DAA8D,CAAC;KAC3E,QAAQ,CAAC,UAAU,EAAE,0BAA0B,CAAC;KAChD,QAAQ,CAAC,UAAU,EAAE,0CAA0C,CAAC;KAChE,MAAM,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;KACjD,MAAM,CAAC,QAAQ,EAAE,oCAAoC,CAAC;KACtD,SAAS,CACR,IAAI,MAAM,CACR,aAAa,EACb,+FAA+F,CAChG,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAC1B;KACA,MAAM,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;KACvD,kBAAkB,EAAE;KACpB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpE,MAAM,KAAK,GAAG,MAAM,OAAO,CAAA;IAE3B,MAAM,QA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CAAC,CAAC,CAAA;IACjB,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC,CAAC,CAAA;AACN,CAAC"}
package/dist/index.d.ts CHANGED
@@ -13,7 +13,8 @@ export interface CompileOptions {
13
13
  */
14
14
  keepNull?: boolean;
15
15
  /**
16
- * Name the root interface, instead of the catalog's name for the schema.
16
+ * Name the root interface, instead of the catalog's name for the schema, or
17
+ * the name of the file of a schema given by its URL.
17
18
  */
18
19
  typeName?: string;
19
20
  }
package/dist/index.js CHANGED
@@ -6,7 +6,8 @@ import { compile as compileSource, } from 'json-schema-to-typescript';
6
6
  import Keyv from 'keyv';
7
7
  import { KeyvFile } from 'keyv-file';
8
8
  import { compilerOptions as jsiiCompilerOptions, jsiiSchema, jsiiTypings, } from './jsii.js';
9
- import { normalizeSchema } from './normalize.js';
9
+ import { namedSchemaKeys, normalizeSchema } from './normalize.js';
10
+ import { isSchemaUrl, urlName } from './url.js';
10
11
  const debug = createDebug('schema-store-to-typescript');
11
12
  const paths = envPaths('schemastore-to-typescript');
12
13
  const store = new KeyvFile({
@@ -37,6 +38,7 @@ const flushCache = async () => {
37
38
  await flushable.save();
38
39
  await flushable.saveToDisk();
39
40
  };
41
+ const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
40
42
  // Holds literal instance data rather than nested schemas, so it must not be
41
43
  // walked as if it were part of the schema shape.
42
44
  const nonSchemaKeys = new Set(['default', 'examples', 'const', 'enum']);
@@ -76,18 +78,28 @@ const nonSchemaKeys = new Set(['default', 'examples', 'const', 'enum']);
76
78
  * on an intersection with no parameters. The `allOf` already carries what the
77
79
  * self-reference would inherit, so the `$ref` goes.
78
80
  */
79
- const sanitizeSchema = (node, isRoot = true) => {
81
+ const sanitizeSchema = (node, isRoot = true, inSchema = true) => {
80
82
  if (Array.isArray(node)) {
81
- return node.map((item) => sanitizeSchema(item, false));
83
+ return node.map((item) => sanitizeSchema(item, false, inSchema));
82
84
  }
83
85
  if (node === null || typeof node !== 'object') {
84
86
  return node;
85
87
  }
86
88
  const sanitized = {};
87
89
  for (const [key, value] of Object.entries(node)) {
88
- sanitized[key] = nonSchemaKeys.has(key)
89
- ? value
90
- : sanitizeSchema(value, false);
90
+ sanitized[key] =
91
+ inSchema && nonSchemaKeys.has(key)
92
+ ? value
93
+ : sanitizeSchema(value, false, !inSchema || !namedSchemaKeys.has(key));
94
+ }
95
+ if (inSchema) {
96
+ delete sanitized.tsType;
97
+ }
98
+ if (inSchema && isRecord(sanitized.patternProperties)) {
99
+ sanitized.patternProperties = Object.fromEntries(Object.entries(sanitized.patternProperties).map(([pattern, value]) => [
100
+ pattern.replaceAll('*/', '*\\/'),
101
+ value,
102
+ ]));
91
103
  }
92
104
  if (typeof sanitized.$ref === 'string' &&
93
105
  typeof sanitized.additionalProperties === 'object' &&
@@ -146,55 +158,71 @@ export const compile = async (name, cache = true, { jsii = false, keepNull = fal
146
158
  throw e;
147
159
  }
148
160
  };
149
- try {
150
- // First, fetch the catalog
151
- catalog = await fetchWithRetry(catalogUrl);
152
- }
153
- catch (e) {
154
- debug(e);
155
- if (e instanceof HTTPError) {
156
- throw new Error(`Couldn't retrieve catalog from ${catalogUrl}. [${e.code}]`, { cause: e });
161
+ let catalogSchema;
162
+ if (!isSchemaUrl(name)) {
163
+ try {
164
+ // First, fetch the catalog
165
+ catalog = await fetchWithRetry(catalogUrl);
166
+ }
167
+ catch (e) {
168
+ debug(e);
169
+ if (e instanceof HTTPError) {
170
+ throw new Error(`Couldn't retrieve catalog from ${catalogUrl}. [${e.code}]`, { cause: e });
171
+ }
172
+ throw e;
173
+ }
174
+ const schemaMap = new Map();
175
+ for (const schema of catalog.schemas) {
176
+ schemaMap.set(schema.name.toLowerCase(), schema);
177
+ }
178
+ catalogSchema = schemaMap.get(name.toLowerCase());
179
+ if (!catalogSchema) {
180
+ throw new Error(`Couldn't find schema ${name} in the catalog. Are you sure it exists?`);
157
181
  }
158
- throw e;
159
- }
160
- const schemaMap = new Map();
161
- for (const schema of catalog.schemas) {
162
- schemaMap.set(schema.name.toLowerCase(), schema);
163
- }
164
- const catalogSchema = schemaMap.get(name.toLowerCase());
165
- if (!catalogSchema) {
166
- throw new Error(`Couldn't find schema ${name} in the catalog. Are you sure it exists?`);
167
182
  }
183
+ const schemaUrl = catalogSchema?.url ?? name;
168
184
  try {
169
185
  // Fetch the actual schema from the found URL
170
- debug(`Fetching schema from: ${catalogSchema.url}`);
171
- schema = await fetchWithRetry(catalogSchema.url);
186
+ debug(`Fetching schema from: ${schemaUrl}`);
187
+ schema = await fetchWithRetry(schemaUrl);
172
188
  if (typeof schema === 'object' && schema !== null) {
173
- schema.title = typeName ?? catalogSchema.name;
189
+ schema.title = typeName ?? catalogSchema?.name ?? urlName(name);
174
190
  }
175
191
  }
176
192
  catch (e) {
177
193
  debug(e);
178
194
  if (e instanceof HTTPError) {
179
195
  if (e.response.statusCode === 404) {
180
- throw new Error(`Couldn't find schema ${name} at ${catalogSchema.url}. Are you sure it exists?`, { cause: e });
196
+ throw new Error(`Couldn't find schema ${name}${catalogSchema ? ` at ${schemaUrl}` : ''}. Are you sure it exists?`, { cause: e });
181
197
  }
182
- throw new Error(`Couldn't retrieve schema from ${catalogSchema.url}. [${e.code}] Status: ${e.response.statusCode}`, { cause: e });
198
+ throw new Error(`Couldn't retrieve schema from ${schemaUrl}. [${e.code}] Status: ${e.response.statusCode}`, { cause: e });
183
199
  }
184
200
  if (e instanceof Error && e.message.includes('is not valid JSON')) {
185
- throw new Error(`Failed to parse JSON from ${catalogSchema.url}. The server might be returning invalid or compressed content. Error: ${e.message}`, { cause: e });
201
+ throw new Error(`Failed to parse JSON from ${schemaUrl}. The server might be returning invalid or compressed content. Error: ${e.message}`, { cause: e });
186
202
  }
187
203
  throw e;
188
204
  }
189
205
  if (cache) {
190
206
  await flushCache();
191
207
  }
208
+ const schemaName = catalogSchema ? name : urlName(name);
192
209
  const normalized = sanitizeSchema(normalizeSchema(schema));
210
+ const compilerOptions = {
211
+ $refOptions: {
212
+ resolve: {
213
+ file: false,
214
+ http: {
215
+ canRead: ({ url }) => isSchemaUrl(url),
216
+ read: async ({ url }) => sanitizeSchema(await fetchWithRetry(url)),
217
+ },
218
+ },
219
+ },
220
+ };
193
221
  if (!jsii && !keepNull) {
194
- return compileSource(normalized, name);
222
+ return compileSource(normalized, schemaName, compilerOptions);
195
223
  }
196
- return jsiiTypings(await compileSource(jsiiSchema(normalized, { keepNull }), name, keepNull
197
- ? { ...jsiiCompilerOptions, unknownAny: false }
198
- : jsiiCompilerOptions));
224
+ return jsiiTypings(await compileSource(jsiiSchema(normalized, { keepNull }), schemaName, keepNull
225
+ ? { ...jsiiCompilerOptions, ...compilerOptions, unknownAny: false }
226
+ : { ...jsiiCompilerOptions, ...compilerOptions }));
199
227
  };
200
228
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,WAAW,MAAM,OAAO,CAAA;AAC/B,OAAO,QAAQ,MAAM,WAAW,CAAA;AAChC,OAAO,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACpC,OAAO,EAEL,OAAO,IAAI,aAAa,GACzB,MAAM,2BAA2B,CAAA;AAClC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAEpC,OAAO,EACL,eAAe,IAAI,mBAAmB,EACtC,UAAU,EACV,WAAW,GACZ,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,MAAM,KAAK,GAAG,WAAW,CAAC,4BAA4B,CAAC,CAA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CAAC;QACV,MAAM,UAAU,EAAE,CAAA;IACpB,CAAC;IAED,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACvD,MAAM,UAAU,GAAG,cAAc,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAA;IAE1D,MAAM,eAAe,GAAqB;QACxC,WAAW,EAAE;YACX,OAAO,EAAE;gBACP,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE;oBACJ,OAAO,EAAE,CAAC,EAAE,GAAG,EAAmB,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC;oBACvD,IAAI,EAAE,KAAK,EAAE,EAAE,GAAG,EAAmB,EAAE,EAAE,CACvC,cAAc,CAAC,MAAM,cAAc,CAAa,GAAG,CAAC,CAAC;iBACxD;aACF;SACF;KACF,CAAA;IAED,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QACvB,OAAO,aAAa,CAAC,UAAU,EAAE,UAAU,EAAE,eAAe,CAAC,CAAA;IAC/D,CAAC;IAED,OAAO,WAAW,CAChB,MAAM,aAAa,CACjB,UAAU,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,EACpC,UAAU,EACV,QAAQ;QACN,CAAC,CAAC,EAAE,GAAG,mBAAmB,EAAE,GAAG,eAAe,EAAE,UAAU,EAAE,KAAK,EAAE;QACnE,CAAC,CAAC,EAAE,GAAG,mBAAmB,EAAE,GAAG,eAAe,EAAE,CACnD,CACF,CAAA;AACH,CAAC,CAAA"}
package/dist/url.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const isSchemaUrl: (schema: string) => boolean;
2
+ export declare const urlName: (url: string) => string;
package/dist/url.js ADDED
@@ -0,0 +1,4 @@
1
+ import * as path from 'node:path';
2
+ export const isSchemaUrl = (schema) => /^https:\/\//i.test(schema);
3
+ export const urlName = (url) => path.posix.basename(new URL(url).pathname).replace(/\.[^.]*$/, '');
4
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAW,EAAE,CACrD,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAU,EAAE,CAC7C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "schemastore-to-typescript",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Fetch JSON schemas from the JSON Schema Store catalog and compile them to TypeScript typings",
5
5
  "keywords": [
6
6
  "cli",
@@ -40,36 +40,36 @@
40
40
  "worktrunk:show": "projen worktrunk:show"
41
41
  },
42
42
  "dependencies": {
43
- "commander": "15.0.0",
43
+ "commander": "15.1.0",
44
44
  "debug": "4.4.3",
45
45
  "env-paths": "4.0.0",
46
46
  "es-main": "1.4.0",
47
- "got": "16.1.0",
47
+ "got": "16.2.0",
48
48
  "json-schema-to-typescript": "16.0.0",
49
49
  "keyv": "5.6.0",
50
50
  "keyv-file": "5.3.5"
51
51
  },
52
52
  "devDependencies": {
53
- "@langri-sha/eslint-config": "0.12.0",
53
+ "@langri-sha/eslint-config": "0.13.0",
54
54
  "@langri-sha/lint-staged": "0.9.11",
55
55
  "@langri-sha/prettier": "0.4.11",
56
- "@langri-sha/projen-project": "0.48.1",
57
- "@langri-sha/tsconfig": "1.1.1",
56
+ "@langri-sha/projen-project": "0.52.0",
57
+ "@langri-sha/tsconfig": "3.0.0",
58
58
  "@langri-sha/vitest": "0.2.3",
59
59
  "@types/debug": "4.1.13",
60
60
  "@types/node": "24.19.2",
61
61
  "beachball": "2.66.0",
62
- "eslint": "10.13.0",
62
+ "eslint": "10.14.0",
63
63
  "husky": "9.1.7",
64
64
  "lint-staged": "17.6.0",
65
65
  "prettier": "3.9.9",
66
66
  "projen": "0.104.1",
67
- "skills": "1.7.4",
67
+ "skills": "1.7.6",
68
68
  "tsx": "4.23.15",
69
- "typescript": "5.9.3",
69
+ "typescript": "6.0.3",
70
70
  "vitest": "5.0.5"
71
71
  },
72
- "packageManager": "pnpm@12.16.1",
72
+ "packageManager": "pnpm@12.18.0",
73
73
  "devEngines": {
74
74
  "runtime": {
75
75
  "name": "node",
package/readme.md CHANGED
@@ -26,6 +26,19 @@ schemastore-to-typescript 'cargo manifest' src/cargo.ts
26
26
 
27
27
  Downloads are cached; pass `--no-cache` to skip the cache.
28
28
 
29
+ An `https` URL takes the place of the name, to compile a schema at a fixed
30
+ location, such as a file of a tagged release, without the catalog. The options
31
+ apply as they do to a name, and the output defaults to `<file>.d.ts`. Without
32
+ `--type-name`, the root interface takes the name of its file, so pass
33
+ `--type-name` for a URL that pins a version. A `$ref` to another `https`
34
+ document is fetched through the cache and compiled like the schema; a reference
35
+ to a local file or over `http` is an error. The `tsType` keyword, which the
36
+ compiler would write into the typings as code, is ignored.
37
+
38
+ ```sh
39
+ schemastore-to-typescript https://unpkg.com/renovate@44.168.4/renovate-schema.json src/renovate.ts
40
+ ```
41
+
29
42
  The same is available as a function, which resolves to the generated module and
30
43
  takes `false` as its second argument to skip the cache:
31
44
 
@@ -35,6 +48,8 @@ import { compile } from 'schemastore-to-typescript'
35
48
  const typings = await compile('swcrc')
36
49
  ```
37
50
 
51
+ It takes a URL where the name goes, as the command does.
52
+
38
53
  ## Usage with jsii
39
54
 
40
55
  Typings exported from the API of a [jsii] package have to fit what jsii can