@netlify/redirects 3.1.1 → 3.1.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.
Files changed (2) hide show
  1. package/dist/main.js +9 -1
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -59,6 +59,7 @@ var createRewriter = async function({
59
59
  configPath,
60
60
  configRedirects,
61
61
  geoCountry,
62
+ ignoreSPARedirect = false,
62
63
  jwtRoleClaim,
63
64
  jwtSecret,
64
65
  projectDir,
@@ -68,7 +69,13 @@ var createRewriter = async function({
68
69
  const redirectsFiles = [
69
70
  .../* @__PURE__ */ new Set([path.resolve(publicDir ?? "", REDIRECTS_FILE_NAME), path.resolve(projectDir, REDIRECTS_FILE_NAME)])
70
71
  ];
71
- const redirects = await parseRedirects({ configRedirects, redirectsFiles, configPath });
72
+ let redirects = await parseRedirects({ configRedirects, redirectsFiles, configPath });
73
+ if (ignoreSPARedirect) {
74
+ redirects = redirects.filter((redirect) => {
75
+ const isSPARedirect = redirect.origin === "/*" && redirect.to === "/index.html" && redirect.status === 200;
76
+ return !isSPARedirect;
77
+ });
78
+ }
72
79
  const getMatcher = async () => {
73
80
  if (matcher) return matcher;
74
81
  if (redirects.length !== 0) {
@@ -150,6 +157,7 @@ var RedirectsHandler = class {
150
157
  configPath,
151
158
  configRedirects,
152
159
  geoCountry,
160
+ ignoreSPARedirect: true,
153
161
  jwtRoleClaim,
154
162
  jwtSecret,
155
163
  projectDir,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/redirects",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "TypeScript implementation of Netlify's rewrites and redirects engine",
5
5
  "type": "module",
6
6
  "engines": {