@nuxt/bridge-edge 3.3.1-28639631.d765eb0 → 3.3.1-28662432.1fd9e98

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.3.1-28639631.d765eb0";
6
+ const version = "3.3.1-28662432.1fd9e98";
7
7
 
8
8
  const middlewareTemplate = {
9
9
  filename: "middleware.js",
@@ -181,7 +181,9 @@ function clearNuxtDataByKey(nuxtApp, key) {
181
181
  nuxtApp._asyncData[key].status.value = "idle";
182
182
  }
183
183
  if (key in nuxtApp._asyncDataPromises) {
184
- nuxtApp._asyncDataPromises[key].cancelled = true;
184
+ if (nuxtApp._asyncDataPromises[key]) {
185
+ nuxtApp._asyncDataPromises[key].cancelled = true;
186
+ }
185
187
  nuxtApp._asyncDataPromises[key] = void 0;
186
188
  }
187
189
  }
@@ -6,10 +6,40 @@ export declare const useRoute: () => Route;
6
6
  export interface AddRouteMiddlewareOptions {
7
7
  global?: boolean;
8
8
  }
9
+ type Without<T, U> = {
10
+ [P in Exclude<keyof T, keyof U>]?: never;
11
+ };
12
+ type XOR<T, U> = (T | U) extends Object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
13
+ export type OpenWindowFeatures = {
14
+ popup?: boolean;
15
+ noopener?: boolean;
16
+ noreferrer?: boolean;
17
+ } & XOR<{
18
+ width?: number;
19
+ }, {
20
+ innerWidth?: number;
21
+ }> & XOR<{
22
+ height?: number;
23
+ }, {
24
+ innerHeight?: number;
25
+ }> & XOR<{
26
+ left?: number;
27
+ }, {
28
+ screenX?: number;
29
+ }> & XOR<{
30
+ top?: number;
31
+ }, {
32
+ screenY?: number;
33
+ }>;
34
+ export type OpenOptions = {
35
+ target: '_blank' | '_parent' | '_self' | '_top' | (string & {});
36
+ windowFeatures?: OpenWindowFeatures;
37
+ };
9
38
  export interface NavigateToOptions {
10
39
  replace?: boolean;
11
40
  redirectCode?: number;
12
41
  external?: boolean;
42
+ open?: OpenOptions;
13
43
  }
14
44
  export declare const navigateTo: (to: RawLocation | undefined | null, options?: NavigateToOptions) => Promise<void | Route | NavigationFailure | false> | false | void | RawLocation | Route;
15
45
  /** This will abort navigation within a Nuxt route middleware handler. */
@@ -24,4 +54,8 @@ interface AddRouteMiddleware {
24
54
  (middleware: RouteMiddleware): void;
25
55
  }
26
56
  export declare const addRouteMiddleware: AddRouteMiddleware;
57
+ /**
58
+ * @internal
59
+ */
60
+ export declare function resolveRouteObject(to: Exclude<RawLocation, string>): string;
27
61
  export {};
@@ -53,7 +53,13 @@ export const navigateTo = (to, options) => {
53
53
  if (!to) {
54
54
  to = "/";
55
55
  }
56
- const toPath = typeof to === "string" ? to : withQuery(to.path || "/", to.query || {}) + (to.hash || "");
56
+ const toPath = typeof to === "string" ? to : "path" in to ? resolveRouteObject(to) : useRouter().resolve(to).href;
57
+ if (process.client && options?.open) {
58
+ const { target = "_blank", windowFeatures = {} } = options.open;
59
+ const features = Object.entries(windowFeatures).filter(([_, value]) => value !== void 0).map(([feature, value]) => `${feature.toLowerCase()}=${value}`).join(", ");
60
+ open(toPath, target, features);
61
+ return Promise.resolve();
62
+ }
57
63
  const isExternal = options?.external || hasProtocol(toPath, { acceptRelative: true });
58
64
  if (isExternal && !options?.external) {
59
65
  throw new Error("Navigating to external URL is not allowed by default. Use `nagivateTo (url, { external: true })`.");
@@ -122,3 +128,6 @@ export const addRouteMiddleware = (name, middleware, options = {}) => {
122
128
  nuxtApp._middleware.named[name] = convertToLegacyMiddleware(middleware);
123
129
  }
124
130
  };
131
+ export function resolveRouteObject(to) {
132
+ return withQuery(to.path || "", to.query || {}) + (to.hash || "");
133
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/bridge-edge",
3
- "version": "3.3.1-28639631.d765eb0",
3
+ "version": "3.3.1-28662432.1fd9e98",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/bridge.git"
@@ -22,23 +22,23 @@
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.24.7",
25
- "@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.3.1-28639631.d765eb0",
25
+ "@nuxt/bridge-schema": "npm:@nuxt/bridge-schema-edge@3.3.1-28662432.1fd9e98",
26
26
  "@nuxt/devalue": "^2.0.2",
27
- "@nuxt/kit": "3.12.1",
27
+ "@nuxt/kit": "3.12.2",
28
28
  "@nuxt/postcss8": "^1.1.3",
29
- "@nuxt/schema": "3.12.1",
29
+ "@nuxt/schema": "3.12.2",
30
30
  "@nuxt/ui-templates": "^1.3.4",
31
31
  "@rollup/plugin-replace": "^5.0.7",
32
32
  "@unhead/ssr": "^1.9.13",
33
33
  "@unhead/vue": "^1.9.13",
34
34
  "@vitejs/plugin-legacy": "^5.4.1",
35
35
  "@vitejs/plugin-vue2": "^2.3.1",
36
- "acorn": "^8.11.3",
36
+ "acorn": "^8.12.0",
37
37
  "cookie-es": "^1.1.0",
38
38
  "defu": "^6.1.4",
39
39
  "destr": "^2.0.3",
40
40
  "enhanced-resolve": "^5.17.0",
41
- "esbuild-loader": "^4.1.0",
41
+ "esbuild-loader": "^4.2.0",
42
42
  "escape-string-regexp": "^5.0.0",
43
43
  "estree-walker": "^3.0.3",
44
44
  "externality": "^1.0.2",
@@ -74,18 +74,18 @@
74
74
  "unimport": "^3.7.2",
75
75
  "unplugin": "^1.10.1",
76
76
  "untyped": "^1.4.2",
77
- "vite": "~5.3.0",
77
+ "vite": "~5.3.1",
78
78
  "vite-node": "^1.6.0",
79
79
  "vue-bundle-renderer": "^2.1.0"
80
80
  },
81
81
  "devDependencies": {
82
- "@nuxt/types": "^2.17.3",
82
+ "@nuxt/types": "^2.18.1",
83
83
  "@nuxtjs/eslint-config": "^12.0.0",
84
84
  "@nuxtjs/eslint-config-typescript": "^12.1.0",
85
85
  "@types/fs-extra": "^9.0.13",
86
86
  "@types/hash-sum": "^1.0.2",
87
87
  "@types/node-fetch": "^3.0.2",
88
- "nuxt": "^2.17.2",
88
+ "nuxt": "^2.18.1",
89
89
  "rollup": "^4.18.0",
90
90
  "unbuild": "2.0.0",
91
91
  "vue": "^2.7.15",