@graphcommerce/next-config 9.1.0-canary.15 → 9.1.0-canary.17

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.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.1.0-canary.17
4
+
5
+ ## 9.1.0-canary.16
6
+
3
7
  ## 9.1.0-canary.15
4
8
 
5
9
  ## 9.0.4-canary.14
@@ -297,7 +297,14 @@ it('finds plugins', () => {
297
297
  },
298
298
  {
299
299
  "enabled": true,
300
- "ifConfig": "googleRecaptchaKey",
300
+ "sourceExport": "meshConfig",
301
+ "sourceModule": "@graphcommerce/googlerecaptcha/plugins/meshRecaptcha",
302
+ "targetExport": "meshConfig",
303
+ "targetModule": "@graphcommerce/graphql-mesh/meshConfig",
304
+ "type": "function",
305
+ },
306
+ {
307
+ "enabled": true,
301
308
  "sourceExport": "GraphQLProvider",
302
309
  "sourceModule": "@graphcommerce/googlerecaptcha/plugins/GrecaptchaGraphQLProvider",
303
310
  "targetExport": "GraphQLProvider",
@@ -306,7 +313,6 @@ it('finds plugins', () => {
306
313
  },
307
314
  {
308
315
  "enabled": true,
309
- "ifConfig": "googleRecaptchaKey",
310
316
  "sourceExport": "ApolloErrorSnackbar",
311
317
  "sourceModule": "@graphcommerce/googlerecaptcha/plugins/GrecaptchaApolloErrorSnackbar",
312
318
  "targetExport": "ApolloErrorSnackbar",
@@ -315,7 +321,6 @@ it('finds plugins', () => {
315
321
  },
316
322
  {
317
323
  "enabled": true,
318
- "ifConfig": "googleRecaptchaKey",
319
324
  "sourceExport": "ApolloErrorFullPage",
320
325
  "sourceModule": "@graphcommerce/googlerecaptcha/plugins/GrecaptchaApolloErrorFullPage",
321
326
  "targetExport": "ApolloErrorFullPage",
@@ -324,7 +329,6 @@ it('finds plugins', () => {
324
329
  },
325
330
  {
326
331
  "enabled": true,
327
- "ifConfig": "googleRecaptchaKey",
328
332
  "sourceExport": "ApolloErrorAlert",
329
333
  "sourceModule": "@graphcommerce/googlerecaptcha/plugins/GrecaptchaApolloErrorAlert",
330
334
  "targetExport": "ApolloErrorAlert",
@@ -548,6 +552,14 @@ it('finds plugins', () => {
548
552
  "targetModule": "@graphcommerce/graphql",
549
553
  "type": "component",
550
554
  },
555
+ {
556
+ "enabled": true,
557
+ "sourceExport": "meshConfig",
558
+ "sourceModule": "@graphcommerce/magento-store/plugins/meshMagentoStore",
559
+ "targetExport": "meshConfig",
560
+ "targetModule": "@graphcommerce/graphql-mesh/meshConfig",
561
+ "type": "function",
562
+ },
551
563
  {
552
564
  "enabled": true,
553
565
  "sourceExport": "graphqlConfig",
@@ -556,6 +568,22 @@ it('finds plugins', () => {
556
568
  "targetModule": "@graphcommerce/graphql",
557
569
  "type": "function",
558
570
  },
571
+ {
572
+ "enabled": true,
573
+ "sourceExport": "getPrivateQueryContext",
574
+ "sourceModule": "@graphcommerce/magento-store/plugins/magentoCurrencyCode",
575
+ "targetExport": "getPrivateQueryContext",
576
+ "targetModule": "@graphcommerce/graphql",
577
+ "type": "function",
578
+ },
579
+ {
580
+ "enabled": true,
581
+ "sourceExport": "usePrivateQueryContext",
582
+ "sourceModule": "@graphcommerce/magento-store/plugins/magentoCurrencyCode",
583
+ "targetExport": "usePrivateQueryContext",
584
+ "targetModule": "@graphcommerce/graphql",
585
+ "type": "function",
586
+ },
559
587
  {
560
588
  "enabled": true,
561
589
  "sourceExport": "meshConfig",
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
 
3
- const isDefinedNonNullAny = (v) => v !== undefined && v !== null;
3
+ const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
4
4
  const definedNonNullAnySchema = z.any().refine((v) => isDefinedNonNullAny(v));
5
5
  const CartPermissionsSchema = z.enum(["CUSTOMER_ONLY", "DISABLED", "ENABLED"]);
6
6
  const CompareVariantSchema = z.enum(["CHECKBOX", "ICON"]);
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
- import fs from 'node:fs';
1
+ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(import.meta.url);import fs from 'node:fs';
2
2
  import path from 'node:path';
3
- import { createRequire } from 'module';
4
3
  import assert from 'assert';
5
4
  import crypto from 'crypto';
6
5
  import webpack from 'webpack';
@@ -54,12 +53,6 @@ function findParentPath(directory) {
54
53
  return null;
55
54
  }
56
55
 
57
- var require$1 = (
58
- true
59
- ? /* @__PURE__ */ createRequire(import.meta.url)
60
- : require
61
- );
62
-
63
56
  class TopologicalSort {
64
57
  #nodes;
65
58
  #visitedNodes;
@@ -83,12 +76,12 @@ class TopologicalSort {
83
76
  const sourceNode = this.#nodes.get(fromKey);
84
77
  const targetNode = this.#nodes.get(toKey);
85
78
  assert.strictEqual(
86
- sourceNode !== undefined,
79
+ sourceNode !== void 0,
87
80
  true,
88
81
  `Source package with key ${fromKey} doesn't exist`
89
82
  );
90
83
  assert.strictEqual(
91
- targetNode !== undefined,
84
+ targetNode !== void 0,
92
85
  true,
93
86
  `Target package with key ${toKey} doesn't exist`
94
87
  );
@@ -176,7 +169,7 @@ function sig() {
176
169
 
177
170
  const resolveCache = /* @__PURE__ */ new Map();
178
171
  function findPackageJson(id, root) {
179
- let dir = id.startsWith("/") ? id : require$1.resolve(id);
172
+ let dir = id.startsWith("/") ? id : require.resolve(id);
180
173
  let packageJsonLocation = path.join(dir, "package.json");
181
174
  while (!fs.existsSync(packageJsonLocation)) {
182
175
  dir = path.dirname(dir);
@@ -189,7 +182,7 @@ function resolveRecursivePackageJson(dependencyPath, dependencyStructure, root,
189
182
  const isRoot = dependencyPath === root;
190
183
  let fileName;
191
184
  try {
192
- fileName = require$1.resolve(path.join(dependencyPath, "package.json"));
185
+ fileName = require.resolve(path.join(dependencyPath, "package.json"));
193
186
  } catch (e2) {
194
187
  fileName = findPackageJson(dependencyPath, root);
195
188
  }
@@ -414,7 +407,7 @@ var defaultReconciler = function (target, source, property) {
414
407
  };
415
408
  var DeepMerger = /** @class */ (function () {
416
409
  function DeepMerger(reconciler) {
417
- if (reconciler === undefined) { reconciler = defaultReconciler; }
410
+ if (reconciler === void 0) { reconciler = defaultReconciler; }
418
411
  this.reconciler = reconciler;
419
412
  this.isObject = isNonNullObject;
420
413
  this.pastCopies = new Set();
@@ -521,7 +514,7 @@ function diff(item1, item2) {
521
514
  if (!isSame) return item2;
522
515
  if (isArray(item1) && isArray(item2)) {
523
516
  const res = item1.map((val, idx) => diff(val, item2[idx])).filter((val) => !!val);
524
- return res.length ? res : undefined;
517
+ return res.length ? res : void 0;
525
518
  }
526
519
  if (isObject$1(item1) && isObject$1(item2)) {
527
520
  const entriesRight = Object.fromEntries(
@@ -531,9 +524,9 @@ function diff(item1, item2) {
531
524
  Object.entries(item2).map(([key, val]) => [key, diff(item1[key], val)]).filter((entry) => !!entry[1])
532
525
  );
533
526
  const entries = { ...entriesRight, ...entriesLeft };
534
- return Object.keys(entries).length ? entries : undefined;
527
+ return Object.keys(entries).length ? entries : void 0;
535
528
  }
536
- return item2 === item1 ? undefined : item2;
529
+ return item2 === item1 ? void 0 : item2;
537
530
  }
538
531
 
539
532
  const fmt$1 = (s) => s.split(/(\d+)/).map((v) => lodash.snakeCase(v)).join("");
@@ -621,7 +614,7 @@ function mergeEnvIntoConfig(schema, config, env) {
621
614
  const envValue = filteredEnv[envVar];
622
615
  applyResult.push({ envVar, envValue, dotVar, error });
623
616
  });
624
- return [undefined, applyResult];
617
+ return [void 0, applyResult];
625
618
  }
626
619
  Object.entries(result.data).forEach(([envVar, value]) => {
627
620
  const dotVar = envToDot[envVar];
@@ -655,9 +648,9 @@ function formatAppliedEnv(applyResult) {
655
648
  return `${chalk.yellowBright(` \u203C ${envVariableFmt}`)} => ${warning.join(", ")}`;
656
649
  }
657
650
  if (!dotVar) return chalk.red(`${envVariableFmt} => ignored (no matching config)`);
658
- if (from === undefined && to === undefined) return ` = ${baseLog}: (ignored)`;
659
- if (from === undefined && to !== undefined) return ` ${chalk.green("+")} ${baseLog}`;
660
- if (from !== undefined && to === undefined) return ` ${chalk.red("-")} ${baseLog}`;
651
+ if (from === void 0 && to === void 0) return ` = ${baseLog}: (ignored)`;
652
+ if (from === void 0 && to !== void 0) return ` ${chalk.green("+")} ${baseLog}`;
653
+ if (from !== void 0 && to === void 0) return ` ${chalk.red("-")} ${baseLog}`;
661
654
  return ` ${chalk.yellowBright("~")} ${baseLog}`;
662
655
  });
663
656
  let header = chalk.blueBright("info");
@@ -668,7 +661,7 @@ function formatAppliedEnv(applyResult) {
668
661
  }
669
662
 
670
663
  function flattenKeys(value, initialPathPrefix, stringify) {
671
- if (value === null || value === undefined || typeof value === "number") {
664
+ if (value === null || value === void 0 || typeof value === "number") {
672
665
  return { [initialPathPrefix]: value };
673
666
  }
674
667
  if (typeof value === "string") {
@@ -848,7 +841,7 @@ function extractValue(node, path, optional = false) {
848
841
  if (isIdentifier(node)) {
849
842
  switch (node.value) {
850
843
  case "undefined":
851
- return undefined;
844
+ return void 0;
852
845
  default:
853
846
  return RUNTIME_VALUE;
854
847
  }
@@ -862,7 +855,7 @@ function extractValue(node, path, optional = false) {
862
855
  }
863
856
  arr.push(extractValue(elem.expression, path, optional));
864
857
  } else {
865
- arr.push(undefined);
858
+ arr.push(void 0);
866
859
  }
867
860
  }
868
861
  return arr;
@@ -913,7 +906,7 @@ function extractExports(module) {
913
906
  case "VariableDeclaration":
914
907
  moduleItem.declaration.declarations.forEach((decl) => {
915
908
  if (isIdentifier(decl.id) && decl.init) {
916
- exports[decl.id.value] = extractValue(decl.init, undefined, true);
909
+ exports[decl.id.value] = extractValue(decl.init, void 0, true);
917
910
  }
918
911
  });
919
912
  break;
@@ -930,7 +923,7 @@ const pluginConfigParsed = z.object({
930
923
  ifConfig: z.union([z.string(), z.tuple([z.string(), z.unknown()])]).optional()
931
924
  });
932
925
  function nonNullable(value) {
933
- return value !== null && value !== undefined;
926
+ return value !== null && value !== void 0;
934
927
  }
935
928
  const isObject = (input) => typeof input === "object" && input !== null && !Array.isArray(input);
936
929
  function parseStructure(ast, gcConfig, sourceModule) {
@@ -965,7 +958,7 @@ function parseStructure(ast, gcConfig, sourceModule) {
965
958
  if (!parsed.success) {
966
959
  if (errors.length)
967
960
  console.error(parsed.error.errors.map((e) => `${e.path} ${e.message}`).join("\n"));
968
- return undefined;
961
+ return void 0;
969
962
  }
970
963
  let enabled = true;
971
964
  if (parsed.data.ifConfig) {
@@ -1062,7 +1055,7 @@ function printSync(m) {
1062
1055
  }
1063
1056
 
1064
1057
  function parseAndFindExport(resolved, findExport, resolve) {
1065
- if (!resolved?.source) return undefined;
1058
+ if (!resolved?.source) return void 0;
1066
1059
  const ast = parseSync(resolved.source);
1067
1060
  for (const node of ast.body) {
1068
1061
  if (node.type === "ExportDeclaration") {
@@ -1108,24 +1101,24 @@ function parseAndFindExport(resolved, findExport, resolve) {
1108
1101
  if (newResolved && resolved.dependency !== newResolved.dependency) return newResolved;
1109
1102
  }
1110
1103
  }
1111
- return undefined;
1104
+ return void 0;
1112
1105
  }
1113
1106
  function findOriginalSource(plug, resolved, resolve) {
1114
1107
  if (!resolved?.source)
1115
1108
  return {
1116
- resolved: undefined,
1109
+ resolved: void 0,
1117
1110
  error: new Error(`Plugin: Can not find module ${plug.targetModule} for ${plug.sourceModule}`)
1118
1111
  };
1119
1112
  const newResolved = parseAndFindExport(resolved, plug.targetExport, resolve);
1120
1113
  if (!newResolved) {
1121
1114
  return {
1122
- resolved: undefined,
1115
+ resolved: void 0,
1123
1116
  error: new Error(
1124
1117
  `Plugin target not found ${plug.targetModule}#${plug.sourceExport} for plugin ${plug.sourceModule}#${plug.sourceExport}`
1125
1118
  )
1126
1119
  };
1127
1120
  }
1128
- return { resolved: newResolved, error: undefined };
1121
+ return { resolved: newResolved, error: void 0 };
1129
1122
  }
1130
1123
 
1131
1124
  class Visitor {
@@ -2747,7 +2740,7 @@ async function generateInterceptors(plugins, resolve, config, force) {
2747
2740
  await Promise.all(
2748
2741
  Object.entries(byTargetModuleAndExport).map(async ([target, interceptor]) => {
2749
2742
  const file = `${interceptor.fromRoot}.interceptor.tsx`;
2750
- const originalSource = !force && await fs$1.access(file, fs$1.constants.F_OK).then(() => true).catch(() => false) ? (await fs$1.readFile(file)).toString() : undefined;
2743
+ const originalSource = !force && await fs$1.access(file, fs$1.constants.F_OK).then(() => true).catch(() => false) ? (await fs$1.readFile(file)).toString() : void 0;
2751
2744
  return [
2752
2745
  target,
2753
2746
  await generateInterceptor(interceptor, config ?? {}, originalSource)
@@ -2885,7 +2878,7 @@ function domains(config) {
2885
2878
  defaultLocale: loc.locale,
2886
2879
  locales: [...acc[loc.domain]?.locales ?? [], loc.locale],
2887
2880
  domain: loc.domain,
2888
- http: process.env.NODE_ENV === "development" || undefined
2881
+ http: process.env.NODE_ENV === "development" || void 0
2889
2882
  };
2890
2883
  return acc;
2891
2884
  },
@@ -2920,7 +2913,7 @@ function withGraphCommerce(nextConfig, cwd = process.cwd()) {
2920
2913
  remotePatterns: [
2921
2914
  "magentoEndpoint" in graphcommerceConfig ? {
2922
2915
  hostname: new URL(graphcommerceConfig.magentoEndpoint).hostname
2923
- } : undefined,
2916
+ } : void 0,
2924
2917
  { hostname: "**.graphassets.com" },
2925
2918
  { hostname: "*.graphcommerce.org" },
2926
2919
  ...nextConfig.images?.remotePatterns ?? []
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/next-config",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "9.1.0-canary.15",
5
+ "version": "9.1.0-canary.17",
6
6
  "type": "module",
7
7
  "types": "./src/index.ts",
8
8
  "exports": {
@@ -43,7 +43,7 @@
43
43
  "zod": "^3.24.1"
44
44
  },
45
45
  "peerDependencies": {
46
- "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.15",
46
+ "@graphcommerce/prettier-config-pwa": "^9.1.0-canary.17",
47
47
  "@lingui/loader": "*",
48
48
  "@lingui/macro": "*",
49
49
  "@lingui/react": "*",