@shopify/hydrogen-codegen 0.3.0 → 0.3.1
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/dist/cjs/schema.cjs +1 -1
- package/dist/cjs/schema.cjs.map +1 -1
- package/dist/esm/index.d.ts +1 -8
- package/dist/esm/schema.js +1 -1
- package/dist/esm/schema.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/schema.cjs
CHANGED
|
@@ -8,7 +8,7 @@ function getSchema(api, options) {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
try {
|
|
11
|
-
return require.resolve(`@shopify/hydrogen
|
|
11
|
+
return require.resolve(`@shopify/hydrogen/${api}.schema.json`);
|
|
12
12
|
} catch {
|
|
13
13
|
if (options?.throwIfMissing !== false) {
|
|
14
14
|
throw new Error(
|
package/dist/cjs/schema.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema.ts"],"names":[],"mappings":"AACA;AAgBO,SAAS,UAAU,KAAU,SAA4B;AAC9D,MAAI,QAAQ,gBAAgB,QAAQ,oBAAoB;AACtD,UAAM,IAAI;AAAA,MACR,0BAA0B,GAAG;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI;AACF,WAAO,QAAQ,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../src/schema.ts"],"names":[],"mappings":"AACA;AAgBO,SAAS,UAAU,KAAU,SAA4B;AAC9D,MAAI,QAAQ,gBAAgB,QAAQ,oBAAoB;AACtD,UAAM,IAAI;AAAA,MACR,0BAA0B,GAAG;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI;AACF,WAAO,QAAQ,QAAQ,qBAAqB,GAAG,cAAc;AAAA,EAC/D,QAAQ;AACN,QAAI,SAAS,mBAAmB,OAAO;AACrC,YAAM,IAAI;AAAA,QACR,gCAAgC,GAAG;AAAA;AAAA,MACrC;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["// This comment is used during ESM build:\n//! import {createRequire} from 'module'; const require = createRequire(import.meta.url);\n\ntype Api = 'storefront' | 'customer-account';\ntype Options<T extends boolean> = {throwIfMissing?: T};\n\n/**\n * Resolves a schema path for the provided API type. Only the API types currently\n * bundled in Hydrogen are allowed: \"storefront\" and \"customer\".\n * @param api\n * @returns\n */\nexport function getSchema(api: Api, options?: Options<true>): string;\nexport function getSchema(\n api: Api,\n options: Options<false>,\n): string | undefined;\nexport function getSchema(api: Api, options?: Options<boolean>) {\n if (api !== 'storefront' && api !== 'customer-account') {\n throw new Error(\n `The provided API type \"${api}\" is unknown. Please use \"storefront\" or \"customer-account\".`,\n );\n }\n\n try {\n return require.resolve(`@shopify/hydrogen/${api}.schema.json`);\n } catch {\n if (options?.throwIfMissing !== false) {\n throw new Error(\n `Could not find a schema for \"${api}\".\\nPlease make sure a recent version of \\`@shopify/hydrogen\\` is installed.`,\n );\n }\n }\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -176,14 +176,7 @@ Useful in type utilities, such as checking if something does not occur.
|
|
|
176
176
|
|
|
177
177
|
@example
|
|
178
178
|
```
|
|
179
|
-
import type {IsNever} from 'type-fest';
|
|
180
|
-
|
|
181
|
-
type And<A, B> =
|
|
182
|
-
A extends true
|
|
183
|
-
? B extends true
|
|
184
|
-
? true
|
|
185
|
-
: false
|
|
186
|
-
: false;
|
|
179
|
+
import type {IsNever, And} from 'type-fest';
|
|
187
180
|
|
|
188
181
|
// https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
|
|
189
182
|
type AreStringsEqual<A extends string, B extends string> =
|
package/dist/esm/schema.js
CHANGED
|
@@ -6,7 +6,7 @@ function getSchema(api, options) {
|
|
|
6
6
|
);
|
|
7
7
|
}
|
|
8
8
|
try {
|
|
9
|
-
return require.resolve(`@shopify/hydrogen
|
|
9
|
+
return require.resolve(`@shopify/hydrogen/${api}.schema.json`);
|
|
10
10
|
} catch {
|
|
11
11
|
if (options?.throwIfMissing !== false) {
|
|
12
12
|
throw new Error(
|
package/dist/esm/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema.ts"],"names":[],"mappings":"AACA;AAgBO,SAAS,UAAU,KAAU,SAA4B;AAC9D,MAAI,QAAQ,gBAAgB,QAAQ,oBAAoB;AACtD,UAAM,IAAI;AAAA,MACR,0BAA0B,GAAG;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI;AACF,WAAO,QAAQ,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../src/schema.ts"],"names":[],"mappings":"AACA;AAgBO,SAAS,UAAU,KAAU,SAA4B;AAC9D,MAAI,QAAQ,gBAAgB,QAAQ,oBAAoB;AACtD,UAAM,IAAI;AAAA,MACR,0BAA0B,GAAG;AAAA,IAC/B;AAAA,EACF;AAEA,MAAI;AACF,WAAO,QAAQ,QAAQ,qBAAqB,GAAG,cAAc;AAAA,EAC/D,QAAQ;AACN,QAAI,SAAS,mBAAmB,OAAO;AACrC,YAAM,IAAI;AAAA,QACR,gCAAgC,GAAG;AAAA;AAAA,MACrC;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["// This comment is used during ESM build:\n//! import {createRequire} from 'module'; const require = createRequire(import.meta.url);\n\ntype Api = 'storefront' | 'customer-account';\ntype Options<T extends boolean> = {throwIfMissing?: T};\n\n/**\n * Resolves a schema path for the provided API type. Only the API types currently\n * bundled in Hydrogen are allowed: \"storefront\" and \"customer\".\n * @param api\n * @returns\n */\nexport function getSchema(api: Api, options?: Options<true>): string;\nexport function getSchema(\n api: Api,\n options: Options<false>,\n): string | undefined;\nexport function getSchema(api: Api, options?: Options<boolean>) {\n if (api !== 'storefront' && api !== 'customer-account') {\n throw new Error(\n `The provided API type \"${api}\" is unknown. Please use \"storefront\" or \"customer-account\".`,\n );\n }\n\n try {\n return require.resolve(`@shopify/hydrogen/${api}.schema.json`);\n } catch {\n if (options?.throwIfMissing !== false) {\n throw new Error(\n `Could not find a schema for \"${api}\".\\nPlease make sure a recent version of \\`@shopify/hydrogen\\` is installed.`,\n );\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"@shopify:registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.3.
|
|
7
|
+
"version": "0.3.1",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"main": "dist/cjs/index.cjs",
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
"vitest": "^1.0.4"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@shopify/graphql-codegen": "^0.0.
|
|
46
|
+
"@shopify/graphql-codegen": "^0.0.2"
|
|
47
47
|
}
|
|
48
48
|
}
|