@nuxt/bridge-edge 3.0.0-27417251.3fccbfa → 3.0.0-27418474.8adff2e

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.
@@ -1,10 +1,9 @@
1
- import consola from 'consola';
2
- import { defineNuxtModule, addPluginTemplate } from '@nuxt/kit';
1
+ import { defineNuxtModule, logger, addPluginTemplate } from '@nuxt/kit';
3
2
  import hash from 'hash-sum';
4
3
  import { resolve } from 'pathe';
5
4
  import { genImport, genObjectFromRawEntries } from 'knitwork';
6
5
 
7
- const version = "3.0.0-27417251.3fccbfa";
6
+ const version = "3.0.0-27418474.8adff2e";
8
7
 
9
8
  const middlewareTemplate = {
10
9
  filename: "middleware.js",
@@ -136,7 +135,7 @@ const module = defineNuxtModule({
136
135
  setup(viteOptions, nuxt) {
137
136
  nuxt.options.cli.badgeMessages.push(`\u26A1 Vite Mode Enabled (v${version})`);
138
137
  if (viteOptions.experimentWarning !== false && !nuxt.options.test) {
139
- consola.log("\u{1F9EA} Vite mode is experimental and some nuxt modules might be incompatible\n", " If found a bug, please report via https://github.com/nuxt/vite/issues with a minimal reproduction.");
138
+ logger.log("\u{1F9EA} Vite mode is experimental and some nuxt modules might be incompatible\n", " If found a bug, please report via https://github.com/nuxt/framework/issues with a minimal reproduction.");
140
139
  }
141
140
  nuxt.options.build.loadingScreen = false;
142
141
  nuxt.options.build.indicator = false;
@@ -1,6 +1,6 @@
1
1
  import { resolve, join } from 'pathe';
2
2
  import * as vite from 'vite';
3
- import consola from 'consola';
3
+ import { logger } from '@nuxt/kit';
4
4
  import { joinURL, withoutLeadingSlash } from 'ufo';
5
5
  import { d as distDir } from './module.mjs';
6
6
  import { createVuePlugin } from 'vite-plugin-vue2';
@@ -16,7 +16,6 @@ import { genObjectFromRawEntries, genDynamicImport } from 'knitwork';
16
16
  import { findExports } from 'mlly';
17
17
  import createResolver from 'postcss-import-resolver';
18
18
  import defu from 'defu';
19
- import '@nuxt/kit';
20
19
  import 'node-fetch';
21
20
  import '@nuxt/nitro';
22
21
  import 'path';
@@ -41,7 +40,7 @@ async function warmupViteServer(server, entries) {
41
40
  try {
42
41
  await server.transformRequest(url);
43
42
  } catch (e) {
44
- consola.debug("Warmup for %s failed with: %s", url, e);
43
+ logger.debug("Warmup for %s failed with: %s", url, e);
45
44
  }
46
45
  const deps = Array.from(server.moduleGraph.urlToModuleMap.get(url)?.importedModules || []);
47
46
  await Promise.all(deps.map((m) => warmup(m.url)));
@@ -144,9 +143,9 @@ async function buildClient(ctx) {
144
143
  await ctx.nuxt.callHook("vite:extendConfig", clientConfig, { isClient: true, isServer: false });
145
144
  if (!ctx.nuxt.options.dev) {
146
145
  const start = Date.now();
147
- consola.info("Building client...");
146
+ logger.info("Building client...");
148
147
  await vite.build(clientConfig);
149
- consola.success(`Client built in ${Date.now() - start}ms`);
148
+ logger.success(`Client built in ${Date.now() - start}ms`);
150
149
  return;
151
150
  }
152
151
  const viteServer = await vite.createServer(clientConfig);
@@ -534,10 +533,10 @@ async function buildServer(ctx) {
534
533
  const onBuild = () => ctx.nuxt.callHook("build:resources", wpfs);
535
534
  if (!ctx.nuxt.options.dev) {
536
535
  const start = Date.now();
537
- consola.info("Building server...");
536
+ logger.info("Building server...");
538
537
  await vite.build(serverConfig);
539
538
  await onBuild();
540
- consola.success(`Server built in ${Date.now() - start}ms`);
539
+ logger.success(`Server built in ${Date.now() - start}ms`);
541
540
  return;
542
541
  }
543
542
  const viteServer = await vite.createServer(serverConfig);
@@ -721,8 +720,8 @@ async function bundle(nuxt, builder) {
721
720
  ctx.nuxt.hook("vite:serverCreated", (server) => {
722
721
  const start = Date.now();
723
722
  warmupViteServer(server, ["/.nuxt/entry.mjs"]).then(() => {
724
- consola.info(`Vite warmed up in ${Date.now() - start}ms`);
725
- }).catch(consola.error);
723
+ logger.info(`Vite warmed up in ${Date.now() - start}ms`);
724
+ }).catch(logger.error);
726
725
  });
727
726
  }
728
727
  await buildClient(ctx);
@@ -102,10 +102,10 @@ export const useNuxt2Meta = (metaOptions) => {
102
102
  const originalHead = app.head;
103
103
  app.head = function() {
104
104
  const head = originalHead.call(this) || {};
105
- return defu(unwrap(metaInfoFromOptions(metaOptions)), head);
105
+ return defu(unwrap(metaInfoFromOptions(metaOptions)()), head);
106
106
  };
107
107
  } else {
108
- app.head = defu(unwrap(metaInfoFromOptions(metaOptions)), app.head);
108
+ app.head = defu(unwrap(metaInfoFromOptions(metaOptions)()), app.head);
109
109
  }
110
110
  }
111
111
  };
@@ -5,5 +5,5 @@ export declare type FetchResult<ReqT extends FetchRequest> = TypedInternalRespon
5
5
  export declare type UseFetchOptions<DataT, Transform extends _Transform<DataT, any> = _Transform<DataT, DataT>, PickKeys extends KeyOfRes<Transform> = KeyOfRes<Transform>> = AsyncDataOptions<DataT, Transform, PickKeys> & FetchOptions & {
6
6
  key?: string;
7
7
  };
8
- export declare function useFetch<ReqT extends string = string, ResT = FetchResult<ReqT>, Transform extends (res: ResT) => any = (res: ResT) => ResT, PickKeys extends KeyOfRes<Transform> = KeyOfRes<Transform>>(url: ReqT, opts?: UseFetchOptions<ResT, Transform, PickKeys>): import("./asyncData").AsyncData<import("./asyncData").PickFrom<ReturnType<Transform>, PickKeys>>;
9
- export declare function useLazyFetch<ReqT extends string = string, ResT = FetchResult<ReqT>, Transform extends (res: ResT) => any = (res: ResT) => ResT, PickKeys extends KeyOfRes<Transform> = KeyOfRes<Transform>>(url: ReqT, opts?: Omit<UseFetchOptions<ResT, Transform, PickKeys>, 'lazy'>): import("./asyncData").AsyncData<import("./asyncData").PickFrom<ReturnType<Transform>, PickKeys>>;
8
+ export declare function useFetch<ResT = void, ReqT extends string = string, _ResT = ResT extends void ? FetchResult<ReqT> : ResT, Transform extends (res: _ResT) => any = (res: _ResT) => _ResT, PickKeys extends KeyOfRes<Transform> = KeyOfRes<Transform>>(url: ReqT, opts?: UseFetchOptions<_ResT, Transform, PickKeys>): import("./asyncData").AsyncData<import("./asyncData").PickFrom<ReturnType<Transform>, PickKeys>>;
9
+ export declare function useLazyFetch<ResT = void, ReqT extends string = string, _ResT = ResT extends void ? FetchResult<ReqT> : ResT, Transform extends (res: _ResT) => any = (res: _ResT) => _ResT, PickKeys extends KeyOfRes<Transform> = KeyOfRes<Transform>>(url: ReqT, opts?: Omit<UseFetchOptions<_ResT, Transform, PickKeys>, 'lazy'>): import("./asyncData").AsyncData<import("./asyncData").PickFrom<ReturnType<Transform>, PickKeys>>;
@@ -4,8 +4,12 @@ import { defineNuxtPlugin } from "#app";
4
4
  export default defineNuxtPlugin((nuxtApp) => {
5
5
  const head = createHead();
6
6
  nuxtApp.vueApp.use(head);
7
+ let headReady = false;
7
8
  nuxtApp.hooks.hookOnce("app:mounted", () => {
8
- watchEffect(() => head.updateDOM());
9
+ watchEffect(() => {
10
+ head.updateDOM();
11
+ });
12
+ headReady = true;
9
13
  });
10
14
  nuxtApp._useMeta = (meta) => {
11
15
  const headObj = ref(meta);
@@ -13,12 +17,18 @@ export default defineNuxtPlugin((nuxtApp) => {
13
17
  if (process.server) {
14
18
  return;
15
19
  }
20
+ if (headReady) {
21
+ watchEffect(() => {
22
+ head.updateDOM();
23
+ });
24
+ }
16
25
  const vm = getCurrentInstance();
17
26
  if (!vm) {
18
27
  return;
19
28
  }
20
29
  onBeforeUnmount(() => {
21
30
  head.removeHeadObjs(headObj);
31
+ head.updateDOM();
22
32
  });
23
33
  };
24
34
  if (process.server) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/bridge-edge",
3
- "version": "3.0.0-27417251.3fccbfa",
3
+ "version": "3.0.0-27418474.8adff2e",
4
4
  "repository": "nuxt/framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,15 +21,14 @@
21
21
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
22
22
  "@babel/plugin-proposal-optional-chaining": "^7.16.7",
23
23
  "@babel/plugin-transform-typescript": "^7.16.8",
24
- "@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27417251.3fccbfa",
25
- "@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-27417251.3fccbfa",
24
+ "@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27418474.8adff2e",
25
+ "@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-27418474.8adff2e",
26
26
  "@nuxt/postcss8": "^1.1.3",
27
- "@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-27417251.3fccbfa",
27
+ "@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-27418474.8adff2e",
28
28
  "@vitejs/plugin-legacy": "^1.6.4",
29
29
  "@vue/composition-api": "^1.4.6",
30
30
  "@vueuse/head": "^0.7.5",
31
31
  "acorn": "^8.7.0",
32
- "consola": "^2.15.3",
33
32
  "cookie-es": "^0.5.0",
34
33
  "defu": "^5.0.1",
35
34
  "destr": "^1.1.0",
@@ -46,7 +45,7 @@
46
45
  "mlly": "^0.4.2",
47
46
  "murmurhash-es": "^0.1.1",
48
47
  "node-fetch": "^3.2.0",
49
- "nuxi": "npm:nuxi-edge@3.0.0-27417251.3fccbfa",
48
+ "nuxi": "npm:nuxi-edge@3.0.0-27418474.8adff2e",
50
49
  "p-debounce": "^4.0.0",
51
50
  "pathe": "^0.2.0",
52
51
  "postcss": "^8",