@netlify/plugin-nextjs 4.21.3 → 4.22.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.
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isBundleSizeCheckDisabled = exports.getCustomImageResponseHeaders = exports.isNextAuthInstalled = exports.findModuleFromBase = exports.shouldSkip = exports.getPreviewRewrites = exports.getApiRewrites = exports.redirectsForNextRouteWithData = exports.redirectsForNextRoute = exports.isApiRoute = exports.routeToDataRoute = exports.netlifyRoutesForNextRouteWithData = exports.toNetlifyRoute = void 0;
6
+ exports.getRemotePatterns = exports.isBundleSizeCheckDisabled = exports.getCustomImageResponseHeaders = exports.isNextAuthInstalled = exports.findModuleFromBase = exports.shouldSkip = exports.getPreviewRewrites = exports.getApiRewrites = exports.redirectsForNextRouteWithData = exports.redirectsForNextRoute = exports.isApiRoute = exports.routeToDataRoute = exports.netlifyRoutesForNextRouteWithData = exports.toNetlifyRoute = void 0;
7
7
  const globby_1 = __importDefault(require("globby"));
8
8
  const pathe_1 = require("pathe");
9
9
  const constants_1 = require("../constants");
@@ -156,4 +156,17 @@ const getCustomImageResponseHeaders = (headers) => {
156
156
  exports.getCustomImageResponseHeaders = getCustomImageResponseHeaders;
157
157
  const isBundleSizeCheckDisabled = () => process.env.DISABLE_BUNDLE_ZIP_SIZE_CHECK === '1' || process.env.DISABLE_BUNDLE_ZIP_SIZE_CHECK === 'true';
158
158
  exports.isBundleSizeCheckDisabled = isBundleSizeCheckDisabled;
159
+ const getRemotePatterns = (experimental, images) => {
160
+ var _a;
161
+ // Where remote patterns is configured pre-v12.2.5
162
+ if ((_a = experimental.images) === null || _a === void 0 ? void 0 : _a.remotePatterns) {
163
+ return experimental.images.remotePatterns;
164
+ }
165
+ // Where remote patterns is configured after v12.2.5
166
+ if (images.remotePatterns) {
167
+ return images.remotePatterns || [];
168
+ }
169
+ return [];
170
+ };
171
+ exports.getRemotePatterns = getRemotePatterns;
159
172
  /* eslint-enable max-lines */
package/lib/index.js CHANGED
@@ -40,7 +40,6 @@ const plugin = {
40
40
  }
41
41
  const { publish } = netlifyConfig.build;
42
42
  (0, verification_1.checkNextSiteHasBuilt)({ publish, failBuild });
43
- let experimentalRemotePatterns = [];
44
43
  const { appDir, basePath, i18n, images, target, ignore, trailingSlash, outdir, experimental } = await (0, config_1.getNextConfig)({
45
44
  publish,
46
45
  failBuild,
@@ -68,9 +67,6 @@ const plugin = {
68
67
  `));
69
68
  }
70
69
  }
71
- if (experimental.images) {
72
- experimentalRemotePatterns = experimental.images.remotePatterns || [];
73
- }
74
70
  if ((0, utils_1.isNextAuthInstalled)()) {
75
71
  const config = await (0, config_1.getRequiredServerFiles)(publish);
76
72
  const userDefinedNextAuthUrl = config.config.env.NEXTAUTH_URL;
@@ -102,7 +98,7 @@ const plugin = {
102
98
  imageconfig: images,
103
99
  netlifyConfig,
104
100
  basePath,
105
- remotePatterns: experimentalRemotePatterns,
101
+ remotePatterns: (0, utils_1.getRemotePatterns)(experimental, images),
106
102
  responseHeaders: (0, utils_1.getCustomImageResponseHeaders)(netlifyConfig.headers),
107
103
  });
108
104
  await (0, redirects_1.generateRedirects)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.21.3",
3
+ "version": "4.22.0",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "lib/index.js",
6
6
  "files": [