@nuxt/bridge-edge 3.0.0-27491656.26f8d8e → 3.0.0-27494841.2c540e7

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.
@@ -154,8 +154,16 @@ async function setupNitroBridge() {
154
154
  nuxt.options.app.assetsPath = nuxt.options.app.buildAssetsDir;
155
155
  nuxt.options.app.baseURL = nuxt.options.app.baseURL || nuxt.options.app.basePath;
156
156
  nuxt.options.app.cdnURL = nuxt.options.app.cdnURL || "";
157
- nuxt.options.publicRuntimeConfig.app = nuxt.options.publicRuntimeConfig.app || {};
158
- Object.assign(nuxt.options.publicRuntimeConfig.app, nuxt.options.publicRuntimeConfig._app);
157
+ const publicConfig = nuxt.options.publicRuntimeConfig;
158
+ const appConfig = { ...publicConfig._app, ...publicConfig.app };
159
+ delete publicConfig.app;
160
+ delete publicConfig._app;
161
+ nuxt.options.runtimeConfig = defu(nuxt.options.runtimeConfig, {
162
+ ...publicConfig,
163
+ ...nuxt.options.privateRuntimeConfig,
164
+ public: publicConfig,
165
+ app: appConfig
166
+ });
159
167
  nuxt.options.build.loadingScreen = false;
160
168
  nuxt.options.build.indicator = false;
161
169
  if (nuxt.options.build.analyze === true) {
@@ -179,11 +187,10 @@ async function setupNitroBridge() {
179
187
  handlers: [],
180
188
  devHandlers: [],
181
189
  runtimeConfig: {
182
- ...nuxt.options.publicRuntimeConfig,
183
- ...nuxt.options.privateRuntimeConfig,
184
- public: nuxt.options.publicRuntimeConfig,
190
+ ...nuxt.options.runtimeConfig,
185
191
  nitro: {
186
- envPrefix: "NUXT_"
192
+ envPrefix: "NUXT_",
193
+ ...nuxt.options.runtimeConfig.nitro
187
194
  }
188
195
  },
189
196
  typescript: {
@@ -473,21 +480,13 @@ const schemaTemplate = {
473
480
  " interface NuxtConfig {",
474
481
  ...moduleInfo.filter(Boolean).map((meta) => ` [${genString(meta.configKey)}]?: typeof ${genDynamicImport(meta.importName, { wrapper: false })}.default extends NuxtModule<infer O> ? Partial<O> : Record<string, any>`),
475
482
  " }",
476
- generateTypes(resolveSchema(nuxt.options.publicRuntimeConfig), {
477
- interfaceName: "PublicRuntimeConfig",
483
+ generateTypes(resolveSchema(nuxt.options.runtimeConfig), {
484
+ interfaceName: "RuntimeConfig",
478
485
  addExport: false,
479
486
  addDefaults: false,
480
487
  allowExtraKeys: false,
481
488
  indentation: 2
482
489
  }),
483
- generateTypes(resolveSchema(nuxt.options.privateRuntimeConfig), {
484
- interfaceName: "PrivateRuntimeConfig",
485
- addExport: false,
486
- addDefaults: false,
487
- indentation: 2,
488
- allowExtraKeys: false,
489
- defaultDescrption: "This value is only accessible from server-side."
490
- }),
491
490
  "}"
492
491
  ].join("\n");
493
492
  }
@@ -1166,10 +1165,8 @@ const metaModule = defineNuxtModule({
1166
1165
  nuxt.options.build.transpile.push("@vueuse/head");
1167
1166
  nuxt.options.alias["#head"] = runtimeDir;
1168
1167
  const globalMeta = defu(nuxt.options.app.head, {
1169
- meta: [
1170
- { charset: options.charset },
1171
- { name: "viewport", content: options.viewport }
1172
- ]
1168
+ charset: options.charset,
1169
+ viewport: options.viewport
1173
1170
  });
1174
1171
  addTemplate({
1175
1172
  filename: "meta.config.mjs",
@@ -1187,7 +1184,7 @@ const setupMeta = async (opts) => {
1187
1184
  if (opts.needsExplicitEnable) {
1188
1185
  const metaPath = addTemplate({
1189
1186
  filename: "meta.mjs",
1190
- getContents: () => `export const useHead = () => console.warn('${msgPrefix} To use \`useHead\`, please set \`bridge.meta\` to \`true\` in your \`nuxt.config\`. ${checkDocsMsg}')`
1187
+ getContents: () => `export const useHead = () => console.warn('${msgPrefix} To enable experimental \`useHead\` support, set \`bridge.meta\` to \`true\` in your \`nuxt.config\`. ${checkDocsMsg}')`
1191
1188
  });
1192
1189
  nuxt.options.alias["#head"] = metaPath.dst;
1193
1190
  return;
@@ -28,7 +28,7 @@ import 'unimport';
28
28
  import 'scule';
29
29
  import 'unplugin-vue2-script-setup/nuxt';
30
30
 
31
- const version = "3.0.0-27491656.26f8d8e";
31
+ const version = "3.0.0-27494841.2c540e7";
32
32
 
33
33
  const middlewareTemplate = {
34
34
  filename: "middleware.js",
@@ -1,5 +1,6 @@
1
1
  import { createHead, renderHeadToString } from "@vueuse/head";
2
- import { ref, watchEffect, onBeforeUnmount, getCurrentInstance } from "vue";
2
+ import { computed, ref, watchEffect, onBeforeUnmount, getCurrentInstance } from "vue";
3
+ import defu from "defu";
3
4
  import { defineNuxtPlugin } from "#app";
4
5
  export default defineNuxtPlugin((nuxtApp) => {
5
6
  const head = createHead();
@@ -11,8 +12,25 @@ export default defineNuxtPlugin((nuxtApp) => {
11
12
  });
12
13
  headReady = true;
13
14
  });
14
- nuxtApp._useHead = (meta) => {
15
- const headObj = ref(meta);
15
+ const titleTemplate = ref();
16
+ nuxtApp._useHead = (_meta) => {
17
+ const meta = ref(_meta);
18
+ if ("titleTemplate" in meta.value) {
19
+ titleTemplate.value = meta.value.titleTemplate;
20
+ }
21
+ const headObj = computed(() => {
22
+ const overrides = { meta: [] };
23
+ if (titleTemplate.value && "title" in meta.value) {
24
+ overrides.title = typeof titleTemplate.value === "function" ? titleTemplate.value(meta.value.title) : titleTemplate.value.replace(/%s/g, meta.value.title);
25
+ }
26
+ if (meta.value.charset) {
27
+ overrides.meta.push({ key: "charset", charset: meta.value.charset });
28
+ }
29
+ if (meta.value.viewport) {
30
+ overrides.meta.push({ name: "viewport", content: meta.value.viewport });
31
+ }
32
+ return defu(overrides, meta.value);
33
+ });
16
34
  head.addHeadObjs(headObj);
17
35
  if (process.server) {
18
36
  return;
@@ -1,2 +1,2 @@
1
- declare const _default: import("h3").EventHandler;
1
+ declare const _default: import("h3").EventHandler<Promise<void>>;
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/bridge-edge",
3
- "version": "3.0.0-27491656.26f8d8e",
3
+ "version": "3.0.0-27494841.2c540e7",
4
4
  "repository": "nuxt/framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,13 +21,12 @@
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-27491656.26f8d8e",
24
+ "@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27494841.2c540e7",
25
25
  "@nuxt/postcss8": "^1.1.3",
26
- "@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-27491656.26f8d8e",
26
+ "@nuxt/schema": "npm:@nuxt/schema-edge@3.0.0-27494841.2c540e7",
27
27
  "@nuxt/ui-templates": "npm:@nuxt/ui-templates-edge@latest",
28
28
  "@vitejs/plugin-legacy": "^1.8.0",
29
29
  "@vue/composition-api": "^1.4.9",
30
- "@vueuse/head": "^0.7.5",
31
30
  "acorn": "^8.7.0",
32
31
  "cookie-es": "^0.5.0",
33
32
  "defu": "^6.0.0",
@@ -39,7 +38,7 @@
39
38
  "fs-extra": "^10.0.1",
40
39
  "get-port-please": "^2.4.3",
41
40
  "globby": "^13.1.1",
42
- "h3": "^0.7.1",
41
+ "h3": "^0.7.2",
43
42
  "hash-sum": "^2.0.0",
44
43
  "knitwork": "^0.1.1",
45
44
  "magic-string": "^0.26.1",
@@ -47,7 +46,7 @@
47
46
  "murmurhash-es": "^0.1.1",
48
47
  "nitropack": "^0.2.1",
49
48
  "node-fetch": "^3.2.3",
50
- "nuxi": "npm:nuxi-edge@3.0.0-27491656.26f8d8e",
49
+ "nuxi": "npm:nuxi-edge@3.0.0-27494841.2c540e7",
51
50
  "ohash": "^0.1.0",
52
51
  "pathe": "^0.2.0",
53
52
  "perfect-debounce": "^0.1.3",
@@ -73,6 +72,7 @@
73
72
  "@types/fs-extra": "^9.0.13",
74
73
  "@types/hash-sum": "^1.0.0",
75
74
  "@types/node-fetch": "^3.0.2",
75
+ "@vueuse/head": "^0.7.5",
76
76
  "nuxt": "^2",
77
77
  "unbuild": "latest",
78
78
  "vue": "^2",