next-ws 2.1.1 → 2.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/cli.cjs +25 -2
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var import_minimist = __toESM(require("minimist"));
28
28
 
29
29
  // package.json
30
- var version = "2.1.1";
30
+ var version = "2.1.2";
31
31
 
32
32
  // src/commands/helpers/define.ts
33
33
  function defineCommandGroup(definition) {
@@ -757,6 +757,22 @@ var patchRouterServer = definePatchStep({
757
757
  }).toSource();
758
758
  }
759
759
  });
760
+ var patchNextTypesPlugin = definePatchStep({
761
+ title: "Add UPGRADE as allowed export from route modules",
762
+ path: "next:dist/build/webpack/plugins/next-types-plugin/index.js",
763
+ async transform(code) {
764
+ return (0, import_jscodeshift.default)(code).find(import_jscodeshift.default.MemberExpression, {
765
+ property: { name: "HTTP_METHODS" }
766
+ }).at(0).replaceWith((path) => {
767
+ if (path.parent.value.type === "SpreadElement") return path.node;
768
+ return import_jscodeshift.default.arrayExpression([
769
+ import_jscodeshift.default.spreadElement(path.node),
770
+ import_jscodeshift.default.literal("UPGRADE"),
771
+ import_jscodeshift.default.literal("SOCKET")
772
+ ]);
773
+ }).toSource();
774
+ }
775
+ });
760
776
  var patchHeaders = definePatchStep({
761
777
  title: "Add WebSocket contextual headers resolution to request headers",
762
778
  path: "next:dist/client/components/headers.js",
@@ -804,7 +820,13 @@ var patchCookies = definePatchStep({
804
820
  var patch_1_default = definePatch({
805
821
  name: "patch-1",
806
822
  versions: ">=13.5.1 <=14.2.32",
807
- steps: [patchNextNodeServer, patchRouterServer, patchHeaders, patchCookies]
823
+ steps: [
824
+ patchNextNodeServer,
825
+ patchNextTypesPlugin,
826
+ patchRouterServer,
827
+ patchHeaders,
828
+ patchCookies
829
+ ]
808
830
  });
809
831
 
810
832
  // src/patches/patch-2.ts
@@ -824,6 +846,7 @@ var patch_2_default = definePatch({
824
846
  steps: [
825
847
  patchNextNodeServer,
826
848
  patchRouterServer,
849
+ patchNextTypesPlugin,
827
850
  patchHeaders2,
828
851
  patchCookies2
829
852
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-ws",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Add support for WebSockets in the Next.js app directory",
5
5
  "license": "MIT",
6
6
  "keywords": [