nuxt-outfit 1.0.5 → 1.0.7

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.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@nuxt/outfit",
3
3
  "configKey": "outfit",
4
- "version": "1.0.5"
4
+ "version": "1.0.7"
5
5
  }
@@ -1,6 +1,5 @@
1
1
  import { useRuntimeConfig, useRequestEvent, useRequestHeaders } from "#imports";
2
2
  import { appendHeader } from "h3";
3
- import { parse, splitCookiesString as split } from "set-cookie-parser";
4
3
  import { serialize } from "cookie";
5
4
  export const useSpaHeaders = (additionalHeaders = {}) => {
6
5
  if (process.client) {
@@ -15,7 +14,8 @@ export const useSpaHeaders = (additionalHeaders = {}) => {
15
14
  if (!Object.prototype.hasOwnProperty.call(headers, "referer")) {
16
15
  headers.referer = `${headers.host}/${event.node.req.originalUrl}`;
17
16
  }
18
- const parseCookie = (cookies) => {
17
+ const parseCookie = async (cookies) => {
18
+ const { parse, splitCookiesString: split } = await import("set-cookie-parser");
19
19
  return parse(split(cookies)).map((cookie) => serialize(cookie.name, cookie.value, cookie));
20
20
  };
21
21
  const serverOptions = {
@@ -23,11 +23,11 @@ export const useSpaHeaders = (additionalHeaders = {}) => {
23
23
  ...additionalHeaders,
24
24
  ...headers
25
25
  },
26
- // eslint-disable-next-line
27
26
  async onResponse({ response }) {
28
27
  const { status, headers: headers2 } = response;
29
28
  if (goodResponses.includes(status)) {
30
- appendHeader(event, "Set-Cookie", parseCookie(headers2.get("set-cookie")));
29
+ const incomingHeaders = await parseCookie(headers2.get("set-cookie"));
30
+ appendHeader(event, "Set-Cookie", incomingHeaders);
31
31
  }
32
32
  }
33
33
  };
@@ -1,10 +1,9 @@
1
1
  import { defineNuxtPlugin, useRuntimeConfig } from "#imports";
2
- import { io } from "socket.io-client";
3
2
  import Echo from "laravel-echo";
4
- export default defineNuxtPlugin((nuxtApp) => {
3
+ export default defineNuxtPlugin(async (nuxtApp) => {
5
4
  const options = useRuntimeConfig().public.outfit.echo;
6
5
  if (options.broadcaster === "socket.io") {
7
- options.client = io;
6
+ options.client = await import("socket.io-client");
8
7
  }
9
8
  nuxtApp.provide("echo", new Echo(options));
10
9
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-outfit",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Outfit - Connection Laravel and Nuxt",
5
5
  "repository": {
6
6
  "type": "git",