@nuxt/bridge-edge 3.1.0-28500083.f0b2ea4 → 3.1.0-28514334.c16a529

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 @@ import hash from 'hash-sum';
3
3
  import { resolve } from 'pathe';
4
4
  import { genImport, genObjectFromRawEntries } from 'knitwork';
5
5
 
6
- const version = "3.1.0-28500083.f0b2ea4";
6
+ const version = "3.1.0-28514334.c16a529";
7
7
 
8
8
  const middlewareTemplate = {
9
9
  filename: "middleware.js",
@@ -26,7 +26,7 @@ export interface AsyncDataOptions<ResT, DataT = ResT, PickKeys extends KeysOf<Da
26
26
  * A `null` or `undefined` return value will trigger a fetch.
27
27
  * Default is `key => nuxt.isHydrating ? nuxt.payload.data[key] : nuxt.static.data[key]` which only caches data when payloadExtraction is enabled.
28
28
  */
29
- getCachedData?: (key: string) => DataT;
29
+ getCachedData?: (key: string, nuxtApp: NuxtAppCompat) => DataT;
30
30
  /**
31
31
  * A function that can be used to alter handler function result after resolving
32
32
  */
@@ -20,7 +20,7 @@ export function useAsyncData(...args) {
20
20
  options.server = options.server ?? true;
21
21
  options.default = options.default ?? getDefault;
22
22
  options.getCachedData = options.getCachedData ?? getDefaultCachedData;
23
- const hasCachedData = () => ![null, void 0].includes(options.getCachedData(key));
23
+ const hasCachedData = () => options.getCachedData(key, nuxt) != null;
24
24
  options.lazy = options.lazy ?? false;
25
25
  options.immediate = options.immediate ?? true;
26
26
  options.deep = options.deep ?? false;
@@ -32,7 +32,7 @@ export function useAsyncData(...args) {
32
32
  nuxt.payload._errors[key] = nuxt.payload._errors[key] ?? null;
33
33
  const _ref = options.deep ? ref : shallowRef;
34
34
  nuxt._asyncData[key] = {
35
- data: _ref(options.getCachedData(key) ?? options.default()),
35
+ data: _ref(options.getCachedData(key, nuxt) ?? options.default()),
36
36
  pending: ref(!hasCachedData()),
37
37
  error: toRef(nuxt.payload._errors, key),
38
38
  status: ref("idle")
@@ -47,7 +47,7 @@ export function useAsyncData(...args) {
47
47
  nuxt._asyncDataPromises[key].cancelled = true;
48
48
  }
49
49
  if ((opts._initial || nuxt.isHydrating && opts._initial !== false) && hasCachedData()) {
50
- return Promise.resolve(options.getCachedData(key));
50
+ return Promise.resolve(options.getCachedData(key, nuxt));
51
51
  }
52
52
  asyncData.pending.value = true;
53
53
  asyncData.status.value = "pending";
@@ -28,7 +28,13 @@ export function useCookie(name, _opts) {
28
28
  console.warn(`[nuxt] not setting cookie \`${name}\` as it has already expired.`);
29
29
  }
30
30
  if (process.client) {
31
- const channel = typeof BroadcastChannel === "undefined" ? null : new BroadcastChannel(`nuxt:cookies:${name}`);
31
+ let channel = null;
32
+ try {
33
+ if (typeof BroadcastChannel !== "undefined") {
34
+ channel = new BroadcastChannel(`nuxt:cookies:${name}`);
35
+ }
36
+ } catch {
37
+ }
32
38
  const callback = () => {
33
39
  if (opts.readonly || isEqual(cookie.value, cookies[name])) {
34
40
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/bridge-edge",
3
- "version": "3.1.0-28500083.f0b2ea4",
3
+ "version": "3.1.0-28514334.c16a529",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/bridge.git"
@@ -22,22 +22,22 @@
22
22
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
23
23
  "@babel/plugin-proposal-optional-chaining": "^7.21.0",
24
24
  "@babel/plugin-transform-typescript": "^7.23.6",
25
- "@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.1.0-28500083.f0b2ea4",
25
+ "@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.1.0-28514334.c16a529",
26
26
  "@nuxt/devalue": "^2.0.2",
27
- "@nuxt/kit": "3.10.3",
27
+ "@nuxt/kit": "3.11.1",
28
28
  "@nuxt/postcss8": "^1.1.3",
29
- "@nuxt/schema": "3.10.3",
29
+ "@nuxt/schema": "3.11.1",
30
30
  "@nuxt/ui-templates": "^1.3.1",
31
31
  "@rollup/plugin-replace": "^5.0.5",
32
- "@unhead/ssr": "^1.8.12",
33
- "@unhead/vue": "^1.8.12",
32
+ "@unhead/ssr": "^1.8.20",
33
+ "@unhead/vue": "^1.8.20",
34
34
  "@vitejs/plugin-legacy": "^5.3.2",
35
35
  "@vitejs/plugin-vue2": "^2.3.1",
36
36
  "acorn": "^8.11.3",
37
37
  "cookie-es": "^1.0.0",
38
38
  "defu": "^6.1.4",
39
39
  "destr": "^2.0.3",
40
- "enhanced-resolve": "^5.15.1",
40
+ "enhanced-resolve": "^5.16.0",
41
41
  "esbuild-loader": "^4.1.0",
42
42
  "escape-string-regexp": "^5.0.0",
43
43
  "estree-walker": "^3.0.3",
@@ -52,7 +52,7 @@
52
52
  "knitwork": "^1.0.0",
53
53
  "magic-string": "^0.30.8",
54
54
  "mlly": "^1.6.1",
55
- "nitropack": "^2.9.2",
55
+ "nitropack": "^2.9.4",
56
56
  "node-fetch": "^3.3.2",
57
57
  "nypm": "^0.3.8",
58
58
  "ofetch": "^1.3.3",
@@ -60,22 +60,22 @@
60
60
  "pathe": "^1.1.2",
61
61
  "perfect-debounce": "^1.0.0",
62
62
  "pkg-types": "^1.0.3",
63
- "postcss": "^8.4.35",
63
+ "postcss": "^8.4.36",
64
64
  "postcss-import": "^16.0.1",
65
65
  "postcss-import-resolver": "^2.0.0",
66
- "postcss-preset-env": "^9.5.0",
66
+ "postcss-preset-env": "^9.5.2",
67
67
  "postcss-url": "^10.1.3",
68
68
  "scule": "^1.3.0",
69
69
  "semver": "^7.6.0",
70
70
  "std-env": "^3.7.0",
71
- "terser": "^5.29.1",
72
- "ufo": "^1.4.0",
71
+ "terser": "^5.29.2",
72
+ "ufo": "^1.5.2",
73
73
  "unctx": "^2.3.1",
74
74
  "unimport": "^3.7.1",
75
- "unplugin": "^1.9.0",
75
+ "unplugin": "^1.10.0",
76
76
  "untyped": "^1.4.2",
77
- "vite": "~5.1.5",
78
- "vite-node": "^1.3.1",
77
+ "vite": "~5.1.6",
78
+ "vite-node": "^1.4.0",
79
79
  "vue-bundle-renderer": "^2.0.0"
80
80
  },
81
81
  "devDependencies": {
@@ -86,7 +86,7 @@
86
86
  "@types/hash-sum": "^1.0.2",
87
87
  "@types/node-fetch": "^3.0.2",
88
88
  "nuxt": "^2.17.2",
89
- "rollup": "^4.12.1",
89
+ "rollup": "^4.13.0",
90
90
  "unbuild": "2.0.0",
91
91
  "vue": "^2.7.15",
92
92
  "vue-router": "^3.6.5"
@@ -94,7 +94,7 @@
94
94
  "engines": {
95
95
  "node": "^14.16.0 || ^16.11.0 || >=17.0.0"
96
96
  },
97
- "packageManager": "pnpm@8.15.4",
97
+ "packageManager": "pnpm@8.15.5",
98
98
  "_name": "@nuxt/bridge",
99
99
  "scripts": {
100
100
  "build": "pnpm prepack"