@shopify/hydrogen-codegen 0.3.1 → 0.3.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.
@@ -34,7 +34,7 @@ const caapiDefaultValues = {
34
34
  )
35
35
  };
36
36
  function getDefaultOptions(outputFile = "") {
37
- return /^(customer|caapi\.)/i.test(outputFile) ? caapiDefaultValues : sfapiDefaultValues;
37
+ return /(customer|caapi\.)/i.test(outputFile) ? caapiDefaultValues : sfapiDefaultValues;
38
38
  }
39
39
 
40
40
  exports.getDefaultOptions = getDefaultOptions;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/defaults.ts"],"names":[],"mappings":"AAEA,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAE9B,MAAM,qCAAqC;AAAA;AAAA,wCAEH,mBAAmB;AAAA,0CACjB,qBAAqB;AAAA;AAG/D,MAAM,qCAAqC;AAAA;AAAA,6CAEE,mBAAmB;AAAA,+CACjB,qBAAqB;AAAA;AAGpE,SAAS,oBACP,MACA,WACA,cACA;AACA,SAAO,KACJ,QAAQ,qBAAqB,SAAS,EACtC,QAAQ,uBAAuB,YAAY;AAChD;AAQA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEO,SAAS,kBAAkB,aAAa,IAAI;AACjD,SAAO,uBAAuB,KAAK,UAAU,IACzC,qBACA;AACN","sourcesContent":["import type {PresetConfig} from './preset';\n\nconst QUERIES_PLACEHOLDER = '%queries%';\nconst MUTATIONS_PLACEHOLDER = '%mutations%';\n\nconst sfapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n interface StorefrontQueries extends ${QUERIES_PLACEHOLDER} {}\n interface StorefrontMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nconst caapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n interface CustomerAccountQueries extends ${QUERIES_PLACEHOLDER} {}\n interface CustomerAccountMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nfunction replacePlaceholders(\n code: string,\n queryType: string,\n mutationType: string,\n) {\n return code\n .replace(QUERIES_PLACEHOLDER, queryType)\n .replace(MUTATIONS_PLACEHOLDER, mutationType);\n}\n\ntype DefaultValues = {\n importTypesFrom: string;\n namespacedImportName: string;\n interfaceExtensionCode: NonNullable<PresetConfig['interfaceExtension']>;\n};\n\nconst sfapiDefaultValues: DefaultValues = {\n importTypesFrom: '@shopify/hydrogen/storefront-api-types',\n namespacedImportName: 'StorefrontAPI',\n interfaceExtensionCode: ({queryType, mutationType}) =>\n replacePlaceholders(\n sfapiDefaultInterfaceExtensionCode,\n queryType,\n mutationType,\n ),\n};\n\nconst caapiDefaultValues: DefaultValues = {\n importTypesFrom: '@shopify/hydrogen/customer-account-api-types',\n namespacedImportName: 'CustomerAccountAPI',\n interfaceExtensionCode: ({queryType, mutationType}) =>\n replacePlaceholders(\n caapiDefaultInterfaceExtensionCode,\n queryType,\n mutationType,\n ),\n};\n\nexport function getDefaultOptions(outputFile = '') {\n return /^(customer|caapi\\.)/i.test(outputFile)\n ? caapiDefaultValues\n : sfapiDefaultValues;\n}\n"]}
1
+ {"version":3,"sources":["../../src/defaults.ts"],"names":[],"mappings":"AAEA,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAE9B,MAAM,qCAAqC;AAAA;AAAA,wCAEH,mBAAmB;AAAA,0CACjB,qBAAqB;AAAA;AAG/D,MAAM,qCAAqC;AAAA;AAAA,6CAEE,mBAAmB;AAAA,+CACjB,qBAAqB;AAAA;AAGpE,SAAS,oBACP,MACA,WACA,cACA;AACA,SAAO,KACJ,QAAQ,qBAAqB,SAAS,EACtC,QAAQ,uBAAuB,YAAY;AAChD;AAQA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEO,SAAS,kBAAkB,aAAa,IAAI;AACjD,SAAO,sBAAsB,KAAK,UAAU,IACxC,qBACA;AACN","sourcesContent":["import type {PresetConfig} from './preset';\n\nconst QUERIES_PLACEHOLDER = '%queries%';\nconst MUTATIONS_PLACEHOLDER = '%mutations%';\n\nconst sfapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n interface StorefrontQueries extends ${QUERIES_PLACEHOLDER} {}\n interface StorefrontMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nconst caapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n interface CustomerAccountQueries extends ${QUERIES_PLACEHOLDER} {}\n interface CustomerAccountMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nfunction replacePlaceholders(\n code: string,\n queryType: string,\n mutationType: string,\n) {\n return code\n .replace(QUERIES_PLACEHOLDER, queryType)\n .replace(MUTATIONS_PLACEHOLDER, mutationType);\n}\n\ntype DefaultValues = {\n importTypesFrom: string;\n namespacedImportName: string;\n interfaceExtensionCode: NonNullable<PresetConfig['interfaceExtension']>;\n};\n\nconst sfapiDefaultValues: DefaultValues = {\n importTypesFrom: '@shopify/hydrogen/storefront-api-types',\n namespacedImportName: 'StorefrontAPI',\n interfaceExtensionCode: ({queryType, mutationType}) =>\n replacePlaceholders(\n sfapiDefaultInterfaceExtensionCode,\n queryType,\n mutationType,\n ),\n};\n\nconst caapiDefaultValues: DefaultValues = {\n importTypesFrom: '@shopify/hydrogen/customer-account-api-types',\n namespacedImportName: 'CustomerAccountAPI',\n interfaceExtensionCode: ({queryType, mutationType}) =>\n replacePlaceholders(\n caapiDefaultInterfaceExtensionCode,\n queryType,\n mutationType,\n ),\n};\n\nexport function getDefaultOptions(outputFile = '') {\n return /(customer|caapi\\.)/i.test(outputFile)\n ? caapiDefaultValues\n : sfapiDefaultValues;\n}\n"]}
@@ -6,23 +6,23 @@ var graphqlCodegen = require('@shopify/graphql-codegen');
6
6
 
7
7
 
8
8
 
9
- Object.defineProperty(exports, 'preset', {
9
+ Object.defineProperty(exports, "preset", {
10
10
  enumerable: true,
11
11
  get: function () { return preset_js.preset; }
12
12
  });
13
- Object.defineProperty(exports, 'getSchema', {
13
+ Object.defineProperty(exports, "getSchema", {
14
14
  enumerable: true,
15
15
  get: function () { return schema_js.getSchema; }
16
16
  });
17
- Object.defineProperty(exports, 'pluckConfig', {
17
+ Object.defineProperty(exports, "pluckConfig", {
18
18
  enumerable: true,
19
19
  get: function () { return graphqlCodegen.pluckConfig; }
20
20
  });
21
- Object.defineProperty(exports, 'plugin', {
21
+ Object.defineProperty(exports, "plugin", {
22
22
  enumerable: true,
23
23
  get: function () { return graphqlCodegen.plugin; }
24
24
  });
25
- Object.defineProperty(exports, 'processSources', {
25
+ Object.defineProperty(exports, "processSources", {
26
26
  enumerable: true,
27
27
  get: function () { return graphqlCodegen.processSources; }
28
28
  });
@@ -32,7 +32,7 @@ const caapiDefaultValues = {
32
32
  )
33
33
  };
34
34
  function getDefaultOptions(outputFile = "") {
35
- return /^(customer|caapi\.)/i.test(outputFile) ? caapiDefaultValues : sfapiDefaultValues;
35
+ return /(customer|caapi\.)/i.test(outputFile) ? caapiDefaultValues : sfapiDefaultValues;
36
36
  }
37
37
 
38
38
  export { getDefaultOptions };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/defaults.ts"],"names":[],"mappings":"AAEA,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAE9B,MAAM,qCAAqC;AAAA;AAAA,wCAEH,mBAAmB;AAAA,0CACjB,qBAAqB;AAAA;AAG/D,MAAM,qCAAqC;AAAA;AAAA,6CAEE,mBAAmB;AAAA,+CACjB,qBAAqB;AAAA;AAGpE,SAAS,oBACP,MACA,WACA,cACA;AACA,SAAO,KACJ,QAAQ,qBAAqB,SAAS,EACtC,QAAQ,uBAAuB,YAAY;AAChD;AAQA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEO,SAAS,kBAAkB,aAAa,IAAI;AACjD,SAAO,uBAAuB,KAAK,UAAU,IACzC,qBACA;AACN","sourcesContent":["import type {PresetConfig} from './preset';\n\nconst QUERIES_PLACEHOLDER = '%queries%';\nconst MUTATIONS_PLACEHOLDER = '%mutations%';\n\nconst sfapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n interface StorefrontQueries extends ${QUERIES_PLACEHOLDER} {}\n interface StorefrontMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nconst caapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n interface CustomerAccountQueries extends ${QUERIES_PLACEHOLDER} {}\n interface CustomerAccountMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nfunction replacePlaceholders(\n code: string,\n queryType: string,\n mutationType: string,\n) {\n return code\n .replace(QUERIES_PLACEHOLDER, queryType)\n .replace(MUTATIONS_PLACEHOLDER, mutationType);\n}\n\ntype DefaultValues = {\n importTypesFrom: string;\n namespacedImportName: string;\n interfaceExtensionCode: NonNullable<PresetConfig['interfaceExtension']>;\n};\n\nconst sfapiDefaultValues: DefaultValues = {\n importTypesFrom: '@shopify/hydrogen/storefront-api-types',\n namespacedImportName: 'StorefrontAPI',\n interfaceExtensionCode: ({queryType, mutationType}) =>\n replacePlaceholders(\n sfapiDefaultInterfaceExtensionCode,\n queryType,\n mutationType,\n ),\n};\n\nconst caapiDefaultValues: DefaultValues = {\n importTypesFrom: '@shopify/hydrogen/customer-account-api-types',\n namespacedImportName: 'CustomerAccountAPI',\n interfaceExtensionCode: ({queryType, mutationType}) =>\n replacePlaceholders(\n caapiDefaultInterfaceExtensionCode,\n queryType,\n mutationType,\n ),\n};\n\nexport function getDefaultOptions(outputFile = '') {\n return /^(customer|caapi\\.)/i.test(outputFile)\n ? caapiDefaultValues\n : sfapiDefaultValues;\n}\n"]}
1
+ {"version":3,"sources":["../../src/defaults.ts"],"names":[],"mappings":"AAEA,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAE9B,MAAM,qCAAqC;AAAA;AAAA,wCAEH,mBAAmB;AAAA,0CACjB,qBAAqB;AAAA;AAG/D,MAAM,qCAAqC;AAAA;AAAA,6CAEE,mBAAmB;AAAA,+CACjB,qBAAqB;AAAA;AAGpE,SAAS,oBACP,MACA,WACA,cACA;AACA,SAAO,KACJ,QAAQ,qBAAqB,SAAS,EACtC,QAAQ,uBAAuB,YAAY;AAChD;AAQA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEA,MAAM,qBAAoC;AAAA,EACxC,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,wBAAwB,CAAC,EAAC,WAAW,aAAY,MAC/C;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACJ;AAEO,SAAS,kBAAkB,aAAa,IAAI;AACjD,SAAO,sBAAsB,KAAK,UAAU,IACxC,qBACA;AACN","sourcesContent":["import type {PresetConfig} from './preset';\n\nconst QUERIES_PLACEHOLDER = '%queries%';\nconst MUTATIONS_PLACEHOLDER = '%mutations%';\n\nconst sfapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n interface StorefrontQueries extends ${QUERIES_PLACEHOLDER} {}\n interface StorefrontMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nconst caapiDefaultInterfaceExtensionCode = `\ndeclare module '@shopify/hydrogen' {\n interface CustomerAccountQueries extends ${QUERIES_PLACEHOLDER} {}\n interface CustomerAccountMutations extends ${MUTATIONS_PLACEHOLDER} {}\n}`;\n\nfunction replacePlaceholders(\n code: string,\n queryType: string,\n mutationType: string,\n) {\n return code\n .replace(QUERIES_PLACEHOLDER, queryType)\n .replace(MUTATIONS_PLACEHOLDER, mutationType);\n}\n\ntype DefaultValues = {\n importTypesFrom: string;\n namespacedImportName: string;\n interfaceExtensionCode: NonNullable<PresetConfig['interfaceExtension']>;\n};\n\nconst sfapiDefaultValues: DefaultValues = {\n importTypesFrom: '@shopify/hydrogen/storefront-api-types',\n namespacedImportName: 'StorefrontAPI',\n interfaceExtensionCode: ({queryType, mutationType}) =>\n replacePlaceholders(\n sfapiDefaultInterfaceExtensionCode,\n queryType,\n mutationType,\n ),\n};\n\nconst caapiDefaultValues: DefaultValues = {\n importTypesFrom: '@shopify/hydrogen/customer-account-api-types',\n namespacedImportName: 'CustomerAccountAPI',\n interfaceExtensionCode: ({queryType, mutationType}) =>\n replacePlaceholders(\n caapiDefaultInterfaceExtensionCode,\n queryType,\n mutationType,\n ),\n};\n\nexport function getDefaultOptions(outputFile = '') {\n return /(customer|caapi\\.)/i.test(outputFile)\n ? caapiDefaultValues\n : sfapiDefaultValues;\n}\n"]}
@@ -159,7 +159,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
159
159
  ```
160
160
 
161
161
  @link https://github.com/microsoft/TypeScript/issues/15300
162
-
162
+ @see SimplifyDeep
163
163
  @category Object
164
164
  */
165
165
  export type Simplify<T> = {
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.1",
7
+ "version": "0.3.2",
8
8
  "license": "MIT",
9
9
  "type": "module",
10
10
  "main": "dist/cjs/index.cjs",
@@ -39,7 +39,7 @@
39
39
  "@graphql-codegen/cli": "^5.0.1",
40
40
  "@graphql-codegen/plugin-helpers": "^5.0.2",
41
41
  "dts-bundle-generator": "^9.3.1",
42
- "type-fest": "^4.5.0",
42
+ "type-fest": "^4.26.1",
43
43
  "vitest": "^1.0.4"
44
44
  },
45
45
  "dependencies": {