@opennextjs/aws 3.9.13 → 3.9.14
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CodePatcher } from "../codePatcher.js";
|
|
2
2
|
export declare const disablePreloadingRule = "\nrule:\n kind: statement_block\n inside:\n kind: if_statement\n any:\n - has:\n kind: member_expression\n pattern: this.nextConfig.experimental.preloadEntriesOnStart\n stopBy: end\n - has:\n kind: binary_expression\n pattern: appDocumentPreloading === true\n stopBy: end\nfix:\n '{}'\n";
|
|
3
3
|
export declare const removeMiddlewareManifestRule = "\nrule:\n kind: statement_block\n inside:\n kind: method_definition\n has:\n kind: property_identifier\n regex: ^getMiddlewareManifest$\nfix:\n '{return null;}'\n";
|
|
4
|
+
export declare const emptyHandleNextImageRequestRule = "\nrule:\n kind: assignment_expression\n pattern: this.handleNextImageRequest = $VALUE\n inside:\n kind: method_definition\n stopBy: end\n has:\n kind: property_identifier\n regex: ^constructor$\n inside:\n kind: class_body\nfix:\n this.handleNextImageRequest = async (req, res, parsedUrl) => false\n";
|
|
4
5
|
/**
|
|
5
6
|
* Swaps the body for a throwing implementation
|
|
6
7
|
*
|
|
@@ -30,6 +30,23 @@ rule:
|
|
|
30
30
|
fix:
|
|
31
31
|
'{return null;}'
|
|
32
32
|
`;
|
|
33
|
+
// Make `handleNextImageRequest` a no-op to avoid pulling `sharp`
|
|
34
|
+
// Apply to Next 14, 15, and 16
|
|
35
|
+
export const emptyHandleNextImageRequestRule = `
|
|
36
|
+
rule:
|
|
37
|
+
kind: assignment_expression
|
|
38
|
+
pattern: this.handleNextImageRequest = $VALUE
|
|
39
|
+
inside:
|
|
40
|
+
kind: method_definition
|
|
41
|
+
stopBy: end
|
|
42
|
+
has:
|
|
43
|
+
kind: property_identifier
|
|
44
|
+
regex: ^constructor$
|
|
45
|
+
inside:
|
|
46
|
+
kind: class_body
|
|
47
|
+
fix:
|
|
48
|
+
this.handleNextImageRequest = async (req, res, parsedUrl) => false
|
|
49
|
+
`;
|
|
33
50
|
/**
|
|
34
51
|
* Swaps the body for a throwing implementation
|
|
35
52
|
*
|
|
@@ -81,6 +98,12 @@ export const patchNextServer = {
|
|
|
81
98
|
contentFilter: /imageOptimizer\(/,
|
|
82
99
|
patchCode: createPatchCode(createEmptyBodyRule("imageOptimizer")),
|
|
83
100
|
},
|
|
101
|
+
// Make `handleNextImageRequest` a no-op to avoid pulling `sharp` - unused in OpenNext
|
|
102
|
+
{
|
|
103
|
+
pathFilter,
|
|
104
|
+
contentFilter: /handleNextImageRequest/,
|
|
105
|
+
patchCode: createPatchCode(emptyHandleNextImageRequestRule),
|
|
106
|
+
},
|
|
84
107
|
// Disable Next background preloading done at creation of `NextServer`
|
|
85
108
|
{
|
|
86
109
|
versions: ">=14.0.0",
|