@opennextjs/aws 3.6.5 → 3.7.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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/dist/adapters/cache.js +4 -4
  3. package/dist/adapters/composable-cache.js +14 -4
  4. package/dist/adapters/edge-adapter.js +5 -1
  5. package/dist/adapters/middleware.js +18 -8
  6. package/dist/build/copyTracedFiles.js +10 -5
  7. package/dist/build/createAssets.js +55 -51
  8. package/dist/build/createServerBundle.js +0 -1
  9. package/dist/build/patch/patches/index.d.ts +0 -1
  10. package/dist/build/patch/patches/index.js +0 -1
  11. package/dist/build/patch/patches/patchNextServer.d.ts +13 -3
  12. package/dist/build/patch/patches/patchNextServer.js +82 -44
  13. package/dist/core/createMainHandler.js +4 -1
  14. package/dist/core/requestHandler.js +11 -2
  15. package/dist/core/resolve.d.ts +5 -0
  16. package/dist/core/resolve.js +11 -0
  17. package/dist/core/routing/cacheInterceptor.js +13 -1
  18. package/dist/core/routing/matcher.d.ts +5 -0
  19. package/dist/core/routing/matcher.js +9 -3
  20. package/dist/core/routing/util.js +2 -0
  21. package/dist/core/routingHandler.d.ts +5 -1
  22. package/dist/core/routingHandler.js +75 -52
  23. package/dist/overrides/assetResolver/dummy.d.ts +8 -0
  24. package/dist/overrides/assetResolver/dummy.js +9 -0
  25. package/dist/overrides/converters/edge.js +7 -1
  26. package/dist/types/global.d.ts +9 -1
  27. package/dist/types/next-types.d.ts +2 -0
  28. package/dist/types/open-next.d.ts +8 -1
  29. package/dist/types/overrides.d.ts +19 -5
  30. package/dist/utils/cache.d.ts +2 -1
  31. package/dist/utils/cache.js +32 -0
  32. package/dist/utils/promise.d.ts +2 -1
  33. package/dist/utils/promise.js +3 -2
  34. package/package.json +1 -1
  35. package/dist/build/patch/patches/dropBabel.d.ts +0 -20
  36. package/dist/build/patch/patches/dropBabel.js +0 -72
@@ -1,72 +0,0 @@
1
- /**
2
- * Patches to avoid pulling babel (~4MB).
3
- *
4
- * Details:
5
- * - empty `NextServer#runMiddleware` and `NextServer#runEdgeFunction` that are not used
6
- * - drop `next/dist/server/node-environment-extensions/error-inspect.js`
7
- */
8
- import { getCrossPlatformPathRegex } from "../../../utils/regex.js";
9
- import { patchCode } from "../astCodePatcher.js";
10
- export const patchDropBabel = {
11
- name: "patch-drop-babel",
12
- patches: [
13
- // Empty the body of `NextServer#runMiddleware`
14
- {
15
- field: {
16
- pathFilter: getCrossPlatformPathRegex(String.raw `/next/dist/server/next-server\.js$`, {
17
- escape: false,
18
- }),
19
- contentFilter: /runMiddleware\(/,
20
- patchCode: async ({ code }) => patchCode(code, createEmptyBodyRule("runMiddleware")),
21
- },
22
- },
23
- // Empty the body of `NextServer#runEdgeFunction`
24
- {
25
- field: {
26
- pathFilter: getCrossPlatformPathRegex(String.raw `/next/dist/server/next-server\.js$`, {
27
- escape: false,
28
- }),
29
- contentFilter: /runEdgeFunction\(/,
30
- patchCode: async ({ code }) => patchCode(code, createEmptyBodyRule("runEdgeFunction")),
31
- },
32
- },
33
- // Drop `error-inspect` that pulls babel
34
- {
35
- field: {
36
- pathFilter: getCrossPlatformPathRegex(String.raw `next/dist/server/node-environment\.js$`, {
37
- escape: false,
38
- }),
39
- contentFilter: /error-inspect/,
40
- patchCode: async ({ code }) => patchCode(code, errorInspectRule),
41
- },
42
- },
43
- ],
44
- };
45
- /**
46
- * Swaps the body for a throwing implementation
47
- *
48
- * @param methodName The name of the method
49
- * @returns A rule to replace the body with a `throw`
50
- */
51
- export function createEmptyBodyRule(methodName) {
52
- return `
53
- rule:
54
- pattern:
55
- selector: method_definition
56
- context: "class { async ${methodName}($$$PARAMS) { $$$_ } }"
57
- fix: |-
58
- async ${methodName}($$$PARAMS) {
59
- throw new Error("${methodName} should not be called with OpenNext");
60
- }
61
- `;
62
- }
63
- /**
64
- * Drops `require("./node-environment-extensions/error-inspect");`
65
- */
66
- export const errorInspectRule = `
67
- rule:
68
- pattern: require("./node-environment-extensions/error-inspect");
69
- fix: |-
70
- // Removed by OpenNext
71
- // require("./node-environment-extensions/error-inspect");
72
- `;