@graphcommerce/next-config 9.0.0-canary.103 → 9.0.0-canary.104
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 +6 -0
- package/__tests__/interceptors/generateInterceptors.ts +5 -6
- package/dist/config/commands/generateConfig.js +1 -1
- package/dist/interceptors/Visitor.js +4 -7
- package/dist/interceptors/extractExports.js +1 -0
- package/dist/interceptors/generateInterceptors.js +1 -0
- package/dist/interceptors/writeInterceptors.js +2 -2
- package/dist/withGraphCommerce.js +1 -0
- package/package.json +1 -1
- package/src/config/commands/generateConfig.ts +1 -1
- package/src/config/utils/mergeEnvIntoConfig.ts +10 -10
- package/src/interceptors/Visitor.ts +6 -9
- package/src/interceptors/extractExports.ts +2 -0
- package/src/interceptors/findOriginalSource.ts +1 -1
- package/src/interceptors/generateInterceptors.ts +1 -1
- package/src/interceptors/writeInterceptors.ts +2 -2
- package/src/withGraphCommerce.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.0-canary.104
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2423](https://github.com/graphcommerce-org/graphcommerce/pull/2423) [`dbf233b`](https://github.com/graphcommerce-org/graphcommerce/commit/dbf233bb6d11432a8effc38fd4672aaa0856e1aa) - Added graphql.config.ts to projects ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
3
9
|
## 9.0.0-canary.103
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GraphCommerceConfig } from '../../src/generated/config'
|
|
2
2
|
import { findOriginalSource } from '../../src/interceptors/findOriginalSource'
|
|
3
|
-
import {
|
|
3
|
+
import { SOURCE_END, SOURCE_START } from '../../src/interceptors/generateInterceptor'
|
|
4
4
|
import { generateInterceptors } from '../../src/interceptors/generateInterceptors'
|
|
5
5
|
import { parseStructure } from '../../src/interceptors/parseStructure'
|
|
6
6
|
import { parseSync } from '../../src/interceptors/swc'
|
|
@@ -547,7 +547,7 @@ it('correctly reports an error for an incorrect export', async () => {
|
|
|
547
547
|
googleRecaptchaKey: '123',
|
|
548
548
|
googleAnalyticsId: '123',
|
|
549
549
|
demoMode: true,
|
|
550
|
-
} as GraphCommerceConfig
|
|
550
|
+
} as unknown as GraphCommerceConfig
|
|
551
551
|
|
|
552
552
|
const src = `
|
|
553
553
|
import { getSitemapPaths as getSitemapPathsType } from '@graphcommerce/magento-product'
|
|
@@ -566,8 +566,7 @@ export const plugin: FunctionPlugin<typeof getSitemapPathsType> = (prev, ...args
|
|
|
566
566
|
console.error = jest.fn()
|
|
567
567
|
const plugins = parseStructure(parseSync(src), fakeconfig, './plugins/MyPlugin.tsx')
|
|
568
568
|
|
|
569
|
-
|
|
570
|
-
expect(console.error.mock.calls[0][0]).toMatchInlineSnapshot(
|
|
569
|
+
expect((console.error as jest.Mock).mock.calls[0][0]).toMatchInlineSnapshot(
|
|
571
570
|
'"Plugin configuration invalid! See ./plugins/MyPlugin.tsx"',
|
|
572
571
|
)
|
|
573
572
|
|
|
@@ -616,7 +615,7 @@ export const Plugin = ConfigurableProductPageName
|
|
|
616
615
|
demoMode: true,
|
|
617
616
|
configurableVariantForSimple: true,
|
|
618
617
|
configurableVariantValues: { content: true, gallery: true, url: true },
|
|
619
|
-
} as GraphCommerceConfig
|
|
618
|
+
} as unknown as GraphCommerceConfig
|
|
620
619
|
|
|
621
620
|
const firstFile = parseStructure(parseSync(src1), config, './plugins/MyPlugin')
|
|
622
621
|
|
|
@@ -742,7 +741,7 @@ it('Can correctly find exports that are default exports', async () => {
|
|
|
742
741
|
demoMode: true,
|
|
743
742
|
configurableVariantForSimple: true,
|
|
744
743
|
configurableVariantValues: { content: true, gallery: true, url: true },
|
|
745
|
-
} as GraphCommerceConfig
|
|
744
|
+
} as unknown as GraphCommerceConfig
|
|
746
745
|
|
|
747
746
|
const plugins = parseStructure(parseSync(pluginSource), config, './plugins/MyProjectIcon')
|
|
748
747
|
|
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateConfig = generateConfig;
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
7
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
9
8
|
const cli_1 = require("@graphql-codegen/cli");
|
|
10
9
|
const core_1 = require("@swc/core");
|
|
11
10
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
12
|
const isMonorepo_1 = require("../../utils/isMonorepo");
|
|
13
13
|
const resolveDependenciesSync_1 = require("../../utils/resolveDependenciesSync");
|
|
14
14
|
const resolveDependency_1 = require("../../utils/resolveDependency");
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* This is an implementation of
|
|
4
|
-
* https://github.com/swc-project/swc/blob/main/node-swc/src/Visitor.ts
|
|
5
|
-
*
|
|
6
|
-
* The JS API is deprecated, but there doesn't seem to be a valid alternative at this point.
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
exports.Visitor = void 0;
|
|
4
|
+
/* eslint-disable no-param-reassign */
|
|
5
|
+
/* eslint-disable class-methods-use-this */
|
|
6
|
+
/* eslint-disable consistent-return */
|
|
10
7
|
/**
|
|
11
8
|
* @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
|
|
12
9
|
*/
|
|
@@ -594,7 +591,7 @@ class Visitor {
|
|
|
594
591
|
return n;
|
|
595
592
|
}
|
|
596
593
|
visitTsFnParameters(params) {
|
|
597
|
-
return params
|
|
594
|
+
return params.map(this.visitTsFnParameter.bind(this));
|
|
598
595
|
}
|
|
599
596
|
visitTsFnParameter(n) {
|
|
600
597
|
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.RUNTIME_VALUE = exports.UnsupportedValueError = exports.NoSuchDeclarationError = void 0;
|
|
4
5
|
exports.extractExports = extractExports;
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateInterceptors = generateInterceptors;
|
|
7
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
7
8
|
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
8
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
10
|
const findOriginalSource_1 = require("./findOriginalSource");
|
|
@@ -4,10 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.writeInterceptors = writeInterceptors;
|
|
7
|
-
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
7
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
10
8
|
const glob_1 = require("glob");
|
|
9
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const resolveDependenciesSync_1 = require("../utils/resolveDependenciesSync");
|
|
12
12
|
function checkFileExists(file) {
|
|
13
13
|
return promises_1.default
|
|
@@ -58,6 +58,7 @@ function withGraphCommerce(nextConfig, cwd) {
|
|
|
58
58
|
remotePatterns: [
|
|
59
59
|
{ hostname: new URL(graphcommerceConfig.magentoEndpoint).hostname },
|
|
60
60
|
{ hostname: 'media.graphassets.com' },
|
|
61
|
+
{ hostname: '*.graphcommerce.org' },
|
|
61
62
|
...(nextConfig.images?.remotePatterns ?? []),
|
|
62
63
|
],
|
|
63
64
|
},
|
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.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.104",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "src/index.ts",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { writeFileSync } from 'fs'
|
|
2
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
2
|
import { generate } from '@graphql-codegen/cli'
|
|
4
3
|
import { transformFileSync } from '@swc/core'
|
|
5
4
|
import dotenv from 'dotenv'
|
|
5
|
+
import { writeFileSync } from 'fs'
|
|
6
6
|
import { isMonorepo } from '../../utils/isMonorepo'
|
|
7
7
|
import { resolveDependenciesSync } from '../../utils/resolveDependenciesSync'
|
|
8
8
|
import { resolveDependency } from '../../utils/resolveDependency'
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
import {
|
|
2
|
+
import { cloneDeep, mergeDeep } from '@apollo/client/utilities'
|
|
3
3
|
import chalk from 'chalk'
|
|
4
4
|
import { get, set } from 'lodash'
|
|
5
5
|
import snakeCase from 'lodash/snakeCase'
|
|
6
|
-
import type { ZodRawShape, ZodTypeAny
|
|
6
|
+
import type { ZodAny, ZodRawShape, ZodTypeAny } from 'zod'
|
|
7
7
|
import {
|
|
8
|
-
z,
|
|
9
|
-
ZodObject,
|
|
10
|
-
ZodBoolean,
|
|
11
8
|
ZodArray,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
ZodNullable,
|
|
15
|
-
ZodOptional,
|
|
9
|
+
ZodBoolean,
|
|
10
|
+
ZodDefault,
|
|
16
11
|
ZodEffects,
|
|
17
12
|
ZodEnum,
|
|
18
|
-
|
|
13
|
+
ZodNullable,
|
|
14
|
+
ZodNumber,
|
|
15
|
+
ZodObject,
|
|
16
|
+
ZodOptional,
|
|
17
|
+
ZodString,
|
|
18
|
+
z,
|
|
19
19
|
} from 'zod'
|
|
20
20
|
import diff from './diff'
|
|
21
21
|
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This is an implementation of
|
|
3
|
-
* https://github.com/swc-project/swc/blob/main/
|
|
3
|
+
* https://github.com/swc-project/swc/blob/main/packages/core/src/Visitor.ts
|
|
4
4
|
*
|
|
5
5
|
* The JS API is deprecated, but there doesn't seem to be a valid alternative at this point.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
9
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
10
|
-
/* eslint-disable no-param-reassign */
|
|
11
|
-
/* eslint-disable class-methods-use-this */
|
|
12
|
-
/* eslint-disable consistent-return */
|
|
13
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
14
7
|
import type {
|
|
15
8
|
Accessibility,
|
|
16
9
|
Argument,
|
|
@@ -188,6 +181,10 @@ import type {
|
|
|
188
181
|
YieldExpression,
|
|
189
182
|
} from '@swc/types'
|
|
190
183
|
|
|
184
|
+
/* eslint-disable no-param-reassign */
|
|
185
|
+
/* eslint-disable class-methods-use-this */
|
|
186
|
+
/* eslint-disable consistent-return */
|
|
187
|
+
|
|
191
188
|
/**
|
|
192
189
|
* @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
|
|
193
190
|
*/
|
|
@@ -872,7 +869,7 @@ export class Visitor {
|
|
|
872
869
|
}
|
|
873
870
|
|
|
874
871
|
visitTsFnParameters(params: TsFnParameter[]): TsFnParameter[] {
|
|
875
|
-
return params
|
|
872
|
+
return params.map(this.visitTsFnParameter.bind(this))
|
|
876
873
|
}
|
|
877
874
|
|
|
878
875
|
visitTsFnParameter(n: TsFnParameter): TsFnParameter {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
1
|
import type { ExportAllDeclaration } from '@swc/core'
|
|
2
|
+
import path from 'path'
|
|
3
3
|
import type { ResolveDependency, ResolveDependencyReturn } from '../utils/resolveDependency'
|
|
4
4
|
import type { PluginConfig } from './generateInterceptor'
|
|
5
5
|
import { parseSync } from './swc'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
1
2
|
import fs from 'node:fs/promises'
|
|
2
3
|
import path from 'node:path'
|
|
3
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
4
|
import type { GraphCommerceDebugConfig } from '../generated/config'
|
|
5
5
|
import type { ResolveDependency } from '../utils/resolveDependency'
|
|
6
6
|
import { findOriginalSource } from './findOriginalSource'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import fs from 'node:fs/promises'
|
|
2
|
-
import path from 'path'
|
|
3
1
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
2
|
import { sync as globSync } from 'glob'
|
|
3
|
+
import fs from 'node:fs/promises'
|
|
4
|
+
import path from 'path'
|
|
5
5
|
import { resolveDependenciesSync } from '../utils/resolveDependenciesSync'
|
|
6
6
|
import type { GenerateInterceptorsReturn } from './generateInterceptors'
|
|
7
7
|
|
package/src/withGraphCommerce.ts
CHANGED
|
@@ -72,6 +72,7 @@ export function withGraphCommerce(nextConfig: NextConfig, cwd: string): NextConf
|
|
|
72
72
|
remotePatterns: [
|
|
73
73
|
{ hostname: new URL(graphcommerceConfig.magentoEndpoint).hostname },
|
|
74
74
|
{ hostname: 'media.graphassets.com' },
|
|
75
|
+
{ hostname: '*.graphcommerce.org' },
|
|
75
76
|
...(nextConfig.images?.remotePatterns ?? []),
|
|
76
77
|
],
|
|
77
78
|
},
|