@faststore/core 3.33.5 → 3.35.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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +14 -14
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +1 -1
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/1506.js +1 -1
- package/.next/server/chunks/3117.js +1 -1
- package/.next/server/chunks/8646.js +1 -1
- package/.next/server/chunks/9594.js +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/api/graphql.js +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/account.html +2 -2
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +2 -2
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/{1552.e7cece605fc2e1cd.js → 1552.b5a073e7ac834965.js} +1 -1
- package/.next/static/chunks/pages/{_app-e03902a5f8bdaf99.js → _app-836e2ad874a5b36e.js} +1 -1
- package/.next/static/chunks/{webpack-1965210fb17803bd.js → webpack-c5394865bff5422b.js} +1 -1
- package/.next/trace +122 -122
- package/.turbo/turbo-build.log +14 -14
- package/.turbo/turbo-test.log +5 -5
- package/CHANGELOG.md +12 -0
- package/discovery.config.default.js +4 -0
- package/package.json +3 -3
- package/src/Layout.tsx +3 -2
- package/src/pages/api/graphql.ts +20 -1
- package/src/sdk/analytics/hooks/usePageViewEvent.ts +1 -1
- /package/.next/static/{CJW5ZDBeoNH6idspHRDIr → Mhu8_zB9OvbEDLsJZoDbf}/_buildManifest.js +0 -0
- /package/.next/static/{CJW5ZDBeoNH6idspHRDIr → Mhu8_zB9OvbEDLsJZoDbf}/_ssgManifest.js +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@3.
|
|
2
|
+
> @faststore/core@3.34.0 prebuild /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> na run partytown && na run generate
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @faststore/core@3.
|
|
6
|
+
> @faststore/core@3.34.0 partytown /home/runner/work/faststore/faststore/packages/core
|
|
7
7
|
> partytown copylib ./public/~partytown
|
|
8
8
|
|
|
9
9
|
Partytown lib copied to: /home/runner/work/faststore/faststore/packages/core/public/~partytown
|
|
10
10
|
|
|
11
|
-
> @faststore/core@3.
|
|
11
|
+
> @faststore/core@3.34.0 generate /home/runner/work/faststore/faststore/packages/core
|
|
12
12
|
> na run generate:schema && na run generate:codegen && na run format:generated
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
> @faststore/core@3.
|
|
15
|
+
> @faststore/core@3.34.0 generate:schema /home/runner/work/faststore/faststore/packages/core
|
|
16
16
|
> tsx src/server/generator/generateGraphQLSchemaFile.ts
|
|
17
17
|
|
|
18
18
|
Schema GraphQL file generated successfully
|
|
19
19
|
|
|
20
|
-
> @faststore/core@3.
|
|
20
|
+
> @faststore/core@3.34.0 generate:codegen /home/runner/work/faststore/faststore/packages/core
|
|
21
21
|
> graphql-codegen
|
|
22
22
|
|
|
23
23
|
[STARTED] Parse Configuration
|
|
@@ -37,11 +37,11 @@ Running lifecycle hook "afterStart" scripts...
|
|
|
37
37
|
[CLI] Loading Documents
|
|
38
38
|
[CLI] Generating output
|
|
39
39
|
|
|
40
|
-
> @faststore/core@3.
|
|
40
|
+
> @faststore/core@3.34.0 format:generated /home/runner/work/faststore/faststore/packages/core
|
|
41
41
|
> prettier --write "@generated/**/*.{ts,js,tsx,jsx,json}" --loglevel error
|
|
42
42
|
|
|
43
43
|
|
|
44
|
-
> @faststore/core@3.
|
|
44
|
+
> @faststore/core@3.34.0 build /home/runner/work/faststore/faststore/packages/core
|
|
45
45
|
> next build
|
|
46
46
|
|
|
47
47
|
⚠ No build cache found. Please configure build caching for faster rebuilds. Read more: https://nextjs.org/docs/messages/no-cache
|
|
@@ -69,7 +69,7 @@ Warning: Dynamic Content not found for the page: home. Refer to the Dynamic Cont
|
|
|
69
69
|
Route (pages) Size First Load JS
|
|
70
70
|
┌ ● / 3.86 kB 124 kB
|
|
71
71
|
├ └ css/b1806cbafd0c1f81.css 3.06 kB
|
|
72
|
-
├ /_app 0 B 92.
|
|
72
|
+
├ /_app 0 B 92.4 kB
|
|
73
73
|
├ ● /[...slug] 2.34 kB 133 kB
|
|
74
74
|
├ ● /[slug]/p 35.5 kB 156 kB
|
|
75
75
|
├ ├ css/a3ca6a9b63f657be.css 5.75 kB
|
|
@@ -78,18 +78,18 @@ Route (pages) Size First Load JS
|
|
|
78
78
|
├ ○ /404 1.48 kB 122 kB
|
|
79
79
|
├ ● /500 1.48 kB 122 kB
|
|
80
80
|
├ ● /account 712 B 121 kB
|
|
81
|
-
├ λ /api/graphql 0 B 92.
|
|
82
|
-
├ λ /api/health/live 0 B 92.
|
|
83
|
-
├ λ /api/health/ready 0 B 92.
|
|
84
|
-
├ λ /api/preview 0 B 92.
|
|
81
|
+
├ λ /api/graphql 0 B 92.4 kB
|
|
82
|
+
├ λ /api/health/live 0 B 92.4 kB
|
|
83
|
+
├ λ /api/health/ready 0 B 92.4 kB
|
|
84
|
+
├ λ /api/preview 0 B 92.4 kB
|
|
85
85
|
├ ● /checkout 694 B 121 kB
|
|
86
86
|
├ ● /login 1.59 kB 122 kB
|
|
87
87
|
└ ● /s 3.18 kB 134 kB
|
|
88
88
|
+ First Load JS shared by all 95.8 kB
|
|
89
89
|
├ chunks/framework-807b0f81cbc129f0.js 45.4 kB
|
|
90
90
|
├ chunks/main-5569625b3fdd6741.js 33.1 kB
|
|
91
|
-
├ chunks/pages/_app-
|
|
92
|
-
├ chunks/webpack-
|
|
91
|
+
├ chunks/pages/_app-836e2ad874a5b36e.js 10.3 kB
|
|
92
|
+
├ chunks/webpack-c5394865bff5422b.js 3.58 kB
|
|
93
93
|
└ css/0a57ee6c7a57788c.css 3.49 kB
|
|
94
94
|
|
|
95
95
|
λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps)
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
> @faststore/core@3.
|
|
2
|
+
> @faststore/core@3.34.0 test /home/runner/work/faststore/faststore/packages/core
|
|
3
3
|
> jest
|
|
4
4
|
|
|
5
|
-
PASS test/server/cms/global.test.ts (
|
|
6
|
-
PASS test/utils/multipleTemplates.test.ts (
|
|
5
|
+
PASS test/server/cms/global.test.ts (25.214 s)
|
|
6
|
+
PASS test/utils/multipleTemplates.test.ts (26.454 s)
|
|
7
7
|
PASS test/server/cms/index.test.ts
|
|
8
|
-
PASS test/server/index.test.ts (
|
|
8
|
+
PASS test/server/index.test.ts (32.955 s)
|
|
9
9
|
|
|
10
10
|
Test Suites: 4 passed, 4 total
|
|
11
11
|
Tests: 22 passed, 22 total
|
|
12
12
|
Snapshots: 0 total
|
|
13
|
-
Time:
|
|
13
|
+
Time: 34.128 s
|
|
14
14
|
Ran all test suites.
|
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.35.0](https://github.com/vtex/faststore/compare/v3.34.0...v3.35.0) (2025-04-08)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- add API GraphQL cache control using flags ([#2756](https://github.com/vtex/faststore/issues/2756)) ([8b4dc64](https://github.com/vtex/faststore/commit/8b4dc6485f9e262cc5da47a51c3075715acdb0db))
|
|
11
|
+
|
|
12
|
+
# [3.34.0](https://github.com/vtex/faststore/compare/v3.33.5...v3.34.0) (2025-04-08)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- prevents double page_view events ([#2767](https://github.com/vtex/faststore/issues/2767)) ([82fca88](https://github.com/vtex/faststore/commit/82fca888b6d203744ad66e6e009046d3088f42db))
|
|
17
|
+
|
|
6
18
|
## [3.33.5](https://github.com/vtex/faststore/compare/v3.33.4...v3.33.5) (2025-04-03)
|
|
7
19
|
|
|
8
20
|
### Bug Fixes
|
|
@@ -131,5 +131,9 @@ module.exports = {
|
|
|
131
131
|
enableRedirects: false,
|
|
132
132
|
enableSearchSSR: false,
|
|
133
133
|
enableVtexAssetsLoader: false,
|
|
134
|
+
graphqlCacheControl: {
|
|
135
|
+
maxAge: 0, // 0 disables cache, 5 * 60 enable cache control maxAge 5 minutes
|
|
136
|
+
staleWhileRevalidate: 60,
|
|
137
|
+
},
|
|
134
138
|
},
|
|
135
139
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.35.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "vtex/faststore",
|
|
6
6
|
"browserslist": "supports es6-module and not dead",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@envelop/graphql-jit": "^8.0.3",
|
|
45
45
|
"@envelop/parser-cache": "^6.0.2",
|
|
46
46
|
"@envelop/validation-cache": "^6.0.2",
|
|
47
|
-
"@faststore/api": "^3.
|
|
47
|
+
"@faststore/api": "^3.35.0",
|
|
48
48
|
"@faststore/components": "^3.28.0",
|
|
49
49
|
"@faststore/graphql-utils": "^3.28.0",
|
|
50
50
|
"@faststore/lighthouse": "^3.28.0",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"ts-jest": "29.1.1",
|
|
106
106
|
"typescript": "5.3.2"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "d7888ccc4f9e5511cc18a483d5d0014fdf15f6ab"
|
|
109
109
|
}
|
package/src/Layout.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { useMemo, type PropsWithChildren, type ReactElement } from 'react'
|
|
2
2
|
|
|
3
3
|
import { usePageViewEvent } from './sdk/analytics/hooks/usePageViewEvent'
|
|
4
4
|
|
|
5
5
|
function Layout({ children }: PropsWithChildren) {
|
|
6
|
-
|
|
6
|
+
const props = useMemo(() => (children as ReactElement)?.props, [])
|
|
7
|
+
usePageViewEvent(props)
|
|
7
8
|
|
|
8
9
|
return <>{children}</>
|
|
9
10
|
}
|
package/src/pages/api/graphql.ts
CHANGED
|
@@ -2,6 +2,9 @@ import { isFastStoreError, stringifyCacheControl } from '@faststore/api'
|
|
|
2
2
|
import type { NextApiHandler, NextApiRequest } from 'next'
|
|
3
3
|
|
|
4
4
|
import { execute } from '../../server'
|
|
5
|
+
import discoveryConfig from 'discovery.config'
|
|
6
|
+
|
|
7
|
+
const ONE_MINUTE = 60
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* This function replaces the setCookie domain so that we can use localhost in dev environment.
|
|
@@ -84,6 +87,23 @@ const handler: NextApiHandler = async (request, response) => {
|
|
|
84
87
|
? stringifyCacheControl(extensions.cacheControl)
|
|
85
88
|
: 'no-cache, no-store'
|
|
86
89
|
|
|
90
|
+
if (
|
|
91
|
+
request.method === 'GET' &&
|
|
92
|
+
discoveryConfig?.experimental?.graphqlCacheControl?.maxAge
|
|
93
|
+
) {
|
|
94
|
+
const maxAge = discoveryConfig.experimental.graphqlCacheControl.maxAge
|
|
95
|
+
const staleWhileRevalidate =
|
|
96
|
+
discoveryConfig?.experimental?.graphqlCacheControl
|
|
97
|
+
?.staleWhileRevalidate ?? ONE_MINUTE
|
|
98
|
+
|
|
99
|
+
response.setHeader(
|
|
100
|
+
'cache-control',
|
|
101
|
+
`public, s-maxage=${maxAge}, stale-while-revalidate=${staleWhileRevalidate}`
|
|
102
|
+
)
|
|
103
|
+
} else {
|
|
104
|
+
response.setHeader('cache-control', cacheControl)
|
|
105
|
+
}
|
|
106
|
+
|
|
87
107
|
const setCookieValues = Array.from(extensions.cookies.values())
|
|
88
108
|
if (setCookieValues.length > 0 && !hasErrors) {
|
|
89
109
|
response.setHeader(
|
|
@@ -96,7 +116,6 @@ const handler: NextApiHandler = async (request, response) => {
|
|
|
96
116
|
)
|
|
97
117
|
}
|
|
98
118
|
|
|
99
|
-
response.setHeader('cache-control', cacheControl)
|
|
100
119
|
response.setHeader('content-type', 'application/json')
|
|
101
120
|
response.send(JSON.stringify({ data, errors }))
|
|
102
121
|
} catch (err) {
|
|
File without changes
|
|
File without changes
|