@faststore/core 3.0.147 → 3.0.148

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.
Files changed (31) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/eslint/.cache_1gneedd +1 -1
  6. package/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/.next/cache/webpack/client-production/index.pack +0 -0
  8. package/.next/cache/webpack/server-production/0.pack +0 -0
  9. package/.next/cache/webpack/server-production/index.pack +0 -0
  10. package/.next/next-minimal-server.js.nft.json +1 -1
  11. package/.next/next-server.js.nft.json +1 -1
  12. package/.next/prerender-manifest.js +1 -1
  13. package/.next/prerender-manifest.json +1 -1
  14. package/.next/routes-manifest.json +1 -1
  15. package/.next/server/middleware-build-manifest.js +1 -1
  16. package/.next/server/pages/en-US/404.html +1 -1
  17. package/.next/server/pages/en-US/500.html +1 -1
  18. package/.next/server/pages/en-US/account.html +1 -1
  19. package/.next/server/pages/en-US/checkout.html +1 -1
  20. package/.next/server/pages/en-US/login.html +1 -1
  21. package/.next/server/pages/en-US/s.html +1 -1
  22. package/.next/server/pages/en-US.html +2 -2
  23. package/.next/server/pages-manifest.json +1 -1
  24. package/.next/trace +99 -99
  25. package/.turbo/turbo-build.log +2 -2
  26. package/.turbo/turbo-lint.log +1 -1
  27. package/.turbo/turbo-test.log +5 -5
  28. package/package.json +2 -2
  29. package/src/middleware__DISABLED.ts +65 -0
  30. /package/.next/static/{reGKblCOqNFVd4TEgr48u → xMJeuq2CpfkQ-Z8xALZD0}/_buildManifest.js +0 -0
  31. /package/.next/static/{reGKblCOqNFVd4TEgr48u → xMJeuq2CpfkQ-Z8xALZD0}/_ssgManifest.js +0 -0
@@ -38,8 +38,8 @@ https://nextjs.org/telemetry
38
38
  Collecting page data ...
39
39
  Generating static pages (0/7) ...
40
40
 
41
41
  Generating static pages (1/7)
42
-
43
42
  Generating static pages (3/7)
44
43
  Warning: Dynamic Content not found for the page: home. Refer to the Dynamic Content documentation at https://developers.vtex.com/docs/guides/faststore/dynamic-content-overview for mapping the page and the corresponding data-fetching function.
44
+
45
45
  Generating static pages (3/7)
46
46
 
47
47
  Generating static pages (5/7)
48
48
 
49
49
  ✓ Generating static pages (7/7)
50
50
  Finalizing page optimization ...
@@ -74,4 +74,4 @@ Route (pages) Size First Load JS
74
74
  ○ (Static) automatically rendered as static HTML (uses no initial props)
75
75
  ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps)
76
76
 
77
- Done in 69.85s.
77
+ Done in 72.55s.
@@ -1,4 +1,4 @@
1
1
  yarn run v1.22.22
2
2
  $ next lint
3
3
  ✔ No ESLint warnings or errors
4
- Done in 5.86s.
4
+ Done in 6.02s.
@@ -1,12 +1,12 @@
1
1
  yarn run v1.22.22
2
2
  $ jest
3
- PASS test/server/cms/index.test.ts (33.741 s)
4
- PASS test/utils/multipleTemplates.test.ts (35.13 s)
5
- PASS test/server/index.test.ts (38.233 s)
3
+ PASS test/utils/multipleTemplates.test.ts (34.693 s)
4
+ PASS test/server/cms/index.test.ts (35.568 s)
5
+ PASS test/server/index.test.ts (38.301 s)
6
6
 
7
7
  Test Suites: 3 passed, 3 total
8
8
  Tests: 19 passed, 19 total
9
9
  Snapshots: 0 total
10
- Time: 39.356 s
10
+ Time: 39.41 s
11
11
  Ran all test suites.
12
- Done in 40.97s.
12
+ Done in 41.20s.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "3.0.147",
3
+ "version": "3.0.148",
4
4
  "license": "MIT",
5
5
  "repository": "vtex/faststore",
6
6
  "browserslist": "supports es6-module and not dead",
@@ -128,5 +128,5 @@
128
128
  "node": "18.19.0",
129
129
  "yarn": "1.19.1"
130
130
  },
131
- "gitHead": "5d3b33b0e294206f3e85574eb64096691a78fcbf"
131
+ "gitHead": "95acfb993977fe1cca3873b845c6b7861483ac1e"
132
132
  }
@@ -0,0 +1,65 @@
1
+ /*
2
+ * This middleware is disabled by default. Only stores that are in
3
+ * homebrew and want this functionality will be able to enable it via
4
+ * a feature flag. When the flag is active, the CLI at build time will
5
+ * check whether the ENABLE_REDIRECTS_MIDDLEWARE flag is set or not,
6
+ * if so, the file name will be changed to middleware.ts and nextjs
7
+ * will know how to automatically deal with it.
8
+ */
9
+
10
+ import { NextResponse } from 'next/server'
11
+ import type { NextRequest } from 'next/server'
12
+ import storeConfig from 'discovery.config'
13
+
14
+ type Redirect = {
15
+ from: string
16
+ to: string
17
+ type: 'permanent' | 'temporary'
18
+ }
19
+ interface RedirectsClient {
20
+ get(from: string): Promise<Redirect | null>
21
+ }
22
+
23
+ class DynamoRedirectsClient implements RedirectsClient {
24
+ async get(from: string): Promise<Redirect | null> {
25
+ // TODO: Implement DynamoDB client. Ensure that the cluster has access to DynamoDB first.
26
+ return null
27
+ }
28
+ }
29
+
30
+ const redirectsClient = new DynamoRedirectsClient()
31
+
32
+ export async function middleware(request: NextRequest) {
33
+ const { pathname } = request.nextUrl
34
+
35
+ const redirect = await redirectsClient.get(pathname)
36
+
37
+ if (redirect) {
38
+ const redirectUrl = new URL(redirect.to, storeConfig.storeUrl)
39
+ const redirectStatusCode = redirect.type === 'permanent' ? 301 : 302
40
+
41
+ const response = NextResponse.redirect(redirectUrl, redirectStatusCode)
42
+
43
+ response.headers.set(
44
+ 'Cache-Control',
45
+ 'public, max-age=300, stale-while-revalidate=31536000'
46
+ )
47
+
48
+ return response
49
+ }
50
+
51
+ return NextResponse.next()
52
+ }
53
+
54
+ export const config = {
55
+ matcher: [
56
+ /*
57
+ * Match all request paths except for the ones starting with:
58
+ * - api (API routes)
59
+ * - _next/static (static files)
60
+ * - _next/image (image optimization files)
61
+ * - favicon.ico (favicon file)
62
+ */
63
+ '/((?!api|_next/static|_next/image|favicon.ico).*)',
64
+ ],
65
+ }