@nuxt/bridge-edge 3.0.0-27287360.4e9a272 → 3.0.0-27291641.d4d886e

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 { defineNuxtModule, addPluginTemplate } from '@nuxt/kit';
3
3
  import hash from 'hash-sum';
4
4
  import { resolve } from 'pathe';
5
5
 
6
- const version = "3.0.0-27287360.4e9a272";
6
+ const version = "3.0.0-27291641.d4d886e";
7
7
 
8
8
  const middlewareTemplate = {
9
9
  filename: "middleware.js",
@@ -62,24 +62,23 @@ export { ref }
62
62
 
63
63
  // Common deprecation utils
64
64
  // TODO: Add migration guide docs to @nuxtjs/composition-api
65
- const checkDocsMsg = 'Please see https://go.nuxtjs.dev/bridge-capi for more information.'
65
+ const checkDocsMsg = 'Please see https://v3.nuxtjs.org/getting-started/bridge-composition-api for more information.'
66
66
  const msgPrefix = '[bridge] [legacy capi]'
67
67
  const unsupported = message => () => { throw new Error(`${msgPrefix} ${message} ${checkDocsMsg}`) }
68
68
  const _warned = {}
69
69
  const warnOnce = (id, message) => {
70
70
  if (!_warned[id]) {
71
- console.warn(msgPrefix, message)
71
+ console.warn(msgPrefix, message, checkDocsMsg)
72
72
  _warned[id] = true
73
73
  }
74
74
  }
75
75
 
76
- // TODO: Add warning back once we had replacement for useAsync and useMeta
77
76
  // Warn in case of having any imports from `@nuxtjs/composition-api`
78
- // warnOnce('import', `\`@nuxtjs/composition-api\` is deprecated. ${checkDocsMsg}`)
77
+ warnOnce('import', `\`@nuxtjs/composition-api\` is deprecated. ${checkDocsMsg}`)
79
78
 
80
79
  // Stub functions that provided type support
81
- export const defineNuxtMiddleware = unsupported('You are using `defineNuxtMiddleware`, which is not supported. You can remove wrapper function to keep using Nuxt 2 middleware.')
82
- export const defineNuxtPlugin = unsupported('You are using `defineNuxtPlugin`, which can be replaced with `defineNuxtPlugin` (import from `#app`).')
80
+ export const defineNuxtMiddleware = unsupported('You are using `defineNuxtMiddleware`, which is not supported.')
81
+ export const defineNuxtPlugin = unsupported('You are using `defineNuxtPlugin`, which has a Nuxt 3-compatible replacement.')
83
82
 
84
83
  // Internal exports
85
84
  export const setMetaPlugin = unsupported('`setMetaPlugin` is an internal function that is no longer used.')
@@ -87,10 +86,10 @@ export const setSSRContext = unsupported('`setSSRContext` is an internal functio
87
86
  export const globalPlugin = unsupported('`globalPlugin` is an internal function that is no longer used.')
88
87
 
89
88
  // Deprecated functions
90
- export const withContext = unsupported('`withContext` is a deprecated method that is no longer provided and can be replaced with `useNuxtApp` (import from `#app`).')
89
+ export const withContext = unsupported('`withContext` is a deprecated method that is no longer provided, but which has a Nuxt 3-compatible replacement.')
91
90
  export const useStatic = unsupported('`useStatic` is a deprecated method that is no longer provided.')
92
- export const reqRef = unsupported('`reqRef` is a deprecated method that is no longer provided and can be replaced with `ref` (import from `@vue/composition-api`).')
93
- export const reqSsrRef = unsupported('`reqSsrRef` is no longer provided and can be replaced with `useState` (import from `#app`).')
91
+ export const reqRef = unsupported('`reqRef` is a deprecated method that is no longer provided, but which has a Nuxt 3-compatible replacement.')
92
+ export const reqSsrRef = unsupported('`reqSsrRef` is no longer provided, but has a Nuxt 3-compatible replacement.')
94
93
 
95
94
  // ssrRef helpers
96
95
  const sanitise = val => (val && JSON.parse(JSON.stringify(val))) || val
@@ -100,13 +99,13 @@ export const ssrRef = (value, key) => {
100
99
  const vm = getVM()
101
100
  if (!vm) { throw new Error('ssrRef no longer supports global/ambient context and must be called within a setup() function') }
102
101
 
103
- warnOnce('ssrRef', '`ssrRef` is deprecated and can be replaced with `useState` (import from `#app`).')
102
+ warnOnce('ssrRef', '`ssrRef` is deprecated and has a Nuxt 3-compatible replacement.')
104
103
 
105
104
  return useState(key, value instanceof Function ? value : () => value)
106
105
  }
107
106
 
108
107
  export const shallowSsrRef = (value, key) => {
109
- warnOnce('shallowSsrRef', '`shallowSsrRef` is deprecated and can be replaced with `useState` (import from `#app`).')
108
+ warnOnce('shallowSsrRef', '`shallowSsrRef` is deprecated and has a Nuxt 3-compatible replacement.')
110
109
 
111
110
  const ref = ssrRef(value, key)
112
111
 
@@ -118,7 +117,7 @@ export const shallowSsrRef = (value, key) => {
118
117
  }
119
118
 
120
119
  export const ssrPromise = (value, key) => {
121
- warnOnce('ssrPromise', 'ssrPromise is deprecated. Please use an alternative implementation.')
120
+ warnOnce('ssrPromise', 'ssrPromise is deprecated.')
122
121
 
123
122
  const ssrRefs = useSSRRefs()
124
123
  const promise = Promise.resolve(isHMR() ? getValue(value) : ssrRefs[key] ?? getValue(value))
@@ -129,13 +128,13 @@ export const ssrPromise = (value, key) => {
129
128
 
130
129
  // Composition API functions
131
130
  export const onGlobalSetup = (fn) => {
132
- warnOnce('onGlobalSetup', '`onGlobalSetup` is deprecated and can be replaced with `defineNuxtPlugin(nuxtApp => nuxtApp.provide)` (import from `#app`).')
131
+ warnOnce('onGlobalSetup', '`onGlobalSetup` is deprecated.')
133
132
  const app = useNuxtApp()
134
133
  app._setupFns.push(fn)
135
134
  }
136
135
 
137
136
  export const useAsync = (cb, key) => {
138
- warnOnce('useAsync', 'You are using `useAsync`, which is deprecated.')
137
+ warnOnce('useAsync', 'You are using `useAsync`, which has a Nuxt 3-compatible replacement.')
139
138
 
140
139
  const _ref = isRef(key) ? key : ssrRef(null, key)
141
140
 
@@ -148,7 +147,7 @@ export const useAsync = (cb, key) => {
148
147
  }
149
148
 
150
149
  export const useContext = () => {
151
- warnOnce('useContext', 'You are using `useContext`, which can be replaced with `useNuxtApp` (import from `#app`).')
150
+ warnOnce('useContext', 'You are using `useContext`, which has a Nuxt 3-compatible replacement.')
152
151
 
153
152
  const route = useRoute()
154
153
  const nuxt = useNuxtApp()
@@ -215,6 +214,7 @@ export const defineComponent = (options) => {
215
214
  }
216
215
 
217
216
  export const useMeta = (init) => {
217
+ warnOnce('useMeta', 'You are using `useMeta`, which has a replacement provided by Nuxt Bridge.')
218
218
  const vm = getCurrentInstance()
219
219
  const refreshMeta = () => vm.$meta().refresh()
220
220
 
@@ -242,23 +242,24 @@ export const useMeta = (init) => {
242
242
 
243
243
  // Wrapped properties
244
244
  export const wrapProperty = (property, makeComputed = true) => () => {
245
+ warnOnce('wrapProperty', 'You are using `wrapProperty`, which is deprecated.')
245
246
  const vm = getCurrentInstance()
246
247
  return makeComputed ? computed(() => vm[property]) : vm[property]
247
248
  }
248
249
 
249
250
  export const useRouter = () => {
250
- warnOnce('useRouter', 'You are using `useRouter`, which can be replaced with `useRouter` (import from `#app`).')
251
+ warnOnce('useRouter', 'You are using `useRouter`, which has a Nuxt 3-compatible replacement.')
251
252
  return _useRouter()
252
253
  }
253
254
 
254
255
  export const useRoute = () => {
255
- warnOnce('useRoute', 'You are using `useRoute`, which can be replaced with `useRoute` (import from `#app`).')
256
+ warnOnce('useRoute', 'You are using `useRoute`, which has a Nuxt 3-compatible replacement.')
256
257
  const vm = getCurrentInstance()
257
258
  return computed(() => vm.$route)
258
259
  }
259
260
 
260
261
  export const useStore = () => {
261
- warnOnce('useRoute', 'You are using `useStore`, which can be replaced with `useNuxtApp` (import from `#app`).')
262
+ warnOnce('useRoute', 'You are using `useStore`, which has a Nuxt 3-compatible replacement.')
262
263
  return getCurrentInstance().$store
263
264
  }
264
265
 
@@ -484,6 +485,7 @@ async function callFetches () {
484
485
  const isSsrHydration = vm => vm.$vnode?.elm?.dataset?.fetchKey
485
486
 
486
487
  export const useFetch = (callback) => {
488
+ warnOnce('useFetch', 'You are using `useFetch`, which has a Nuxt 3-compatible replacement.')
487
489
  const vm = getCurrentInstance()
488
490
  const nuxt = useNuxtApp()
489
491
 
@@ -62,24 +62,23 @@ export { ref }
62
62
 
63
63
  // Common deprecation utils
64
64
  // TODO: Add migration guide docs to @nuxtjs/composition-api
65
- const checkDocsMsg = 'Please see https://go.nuxtjs.dev/bridge-capi for more information.'
65
+ const checkDocsMsg = 'Please see https://v3.nuxtjs.org/getting-started/bridge-composition-api for more information.'
66
66
  const msgPrefix = '[bridge] [legacy capi]'
67
67
  const unsupported = message => () => { throw new Error(`${msgPrefix} ${message} ${checkDocsMsg}`) }
68
68
  const _warned = {}
69
69
  const warnOnce = (id, message) => {
70
70
  if (!_warned[id]) {
71
- console.warn(msgPrefix, message)
71
+ console.warn(msgPrefix, message, checkDocsMsg)
72
72
  _warned[id] = true
73
73
  }
74
74
  }
75
75
 
76
- // TODO: Add warning back once we had replacement for useAsync and useMeta
77
76
  // Warn in case of having any imports from `@nuxtjs/composition-api`
78
- // warnOnce('import', `\`@nuxtjs/composition-api\` is deprecated. ${checkDocsMsg}`)
77
+ warnOnce('import', `\`@nuxtjs/composition-api\` is deprecated. ${checkDocsMsg}`)
79
78
 
80
79
  // Stub functions that provided type support
81
- export const defineNuxtMiddleware = unsupported('You are using `defineNuxtMiddleware`, which is not supported. You can remove wrapper function to keep using Nuxt 2 middleware.')
82
- export const defineNuxtPlugin = unsupported('You are using `defineNuxtPlugin`, which can be replaced with `defineNuxtPlugin` (import from `#app`).')
80
+ export const defineNuxtMiddleware = unsupported('You are using `defineNuxtMiddleware`, which is not supported.')
81
+ export const defineNuxtPlugin = unsupported('You are using `defineNuxtPlugin`, which has a Nuxt 3-compatible replacement.')
83
82
 
84
83
  // Internal exports
85
84
  export const setMetaPlugin = unsupported('`setMetaPlugin` is an internal function that is no longer used.')
@@ -87,10 +86,10 @@ export const setSSRContext = unsupported('`setSSRContext` is an internal functio
87
86
  export const globalPlugin = unsupported('`globalPlugin` is an internal function that is no longer used.')
88
87
 
89
88
  // Deprecated functions
90
- export const withContext = unsupported('`withContext` is a deprecated method that is no longer provided and can be replaced with `useNuxtApp` (import from `#app`).')
89
+ export const withContext = unsupported('`withContext` is a deprecated method that is no longer provided, but which has a Nuxt 3-compatible replacement.')
91
90
  export const useStatic = unsupported('`useStatic` is a deprecated method that is no longer provided.')
92
- export const reqRef = unsupported('`reqRef` is a deprecated method that is no longer provided and can be replaced with `ref` (import from `@vue/composition-api`).')
93
- export const reqSsrRef = unsupported('`reqSsrRef` is no longer provided and can be replaced with `useState` (import from `#app`).')
91
+ export const reqRef = unsupported('`reqRef` is a deprecated method that is no longer provided, but which has a Nuxt 3-compatible replacement.')
92
+ export const reqSsrRef = unsupported('`reqSsrRef` is no longer provided, but has a Nuxt 3-compatible replacement.')
94
93
 
95
94
  // ssrRef helpers
96
95
  const sanitise = val => (val && JSON.parse(JSON.stringify(val))) || val
@@ -100,13 +99,13 @@ export const ssrRef = (value, key) => {
100
99
  const vm = getVM()
101
100
  if (!vm) { throw new Error('ssrRef no longer supports global/ambient context and must be called within a setup() function') }
102
101
 
103
- warnOnce('ssrRef', '`ssrRef` is deprecated and can be replaced with `useState` (import from `#app`).')
102
+ warnOnce('ssrRef', '`ssrRef` is deprecated and has a Nuxt 3-compatible replacement.')
104
103
 
105
104
  return useState(key, value instanceof Function ? value : () => value)
106
105
  }
107
106
 
108
107
  export const shallowSsrRef = (value, key) => {
109
- warnOnce('shallowSsrRef', '`shallowSsrRef` is deprecated and can be replaced with `useState` (import from `#app`).')
108
+ warnOnce('shallowSsrRef', '`shallowSsrRef` is deprecated and has a Nuxt 3-compatible replacement.')
110
109
 
111
110
  const ref = ssrRef(value, key)
112
111
 
@@ -118,7 +117,7 @@ export const shallowSsrRef = (value, key) => {
118
117
  }
119
118
 
120
119
  export const ssrPromise = (value, key) => {
121
- warnOnce('ssrPromise', 'ssrPromise is deprecated. Please use an alternative implementation.')
120
+ warnOnce('ssrPromise', 'ssrPromise is deprecated.')
122
121
 
123
122
  const ssrRefs = useSSRRefs()
124
123
  const promise = Promise.resolve(isHMR() ? getValue(value) : ssrRefs[key] ?? getValue(value))
@@ -129,13 +128,13 @@ export const ssrPromise = (value, key) => {
129
128
 
130
129
  // Composition API functions
131
130
  export const onGlobalSetup = (fn) => {
132
- warnOnce('onGlobalSetup', '`onGlobalSetup` is deprecated and can be replaced with `defineNuxtPlugin(nuxtApp => nuxtApp.provide)` (import from `#app`).')
131
+ warnOnce('onGlobalSetup', '`onGlobalSetup` is deprecated.')
133
132
  const app = useNuxtApp()
134
133
  app._setupFns.push(fn)
135
134
  }
136
135
 
137
136
  export const useAsync = (cb, key) => {
138
- warnOnce('useAsync', 'You are using `useAsync`, which is deprecated.')
137
+ warnOnce('useAsync', 'You are using `useAsync`, which has a Nuxt 3-compatible replacement.')
139
138
 
140
139
  const _ref = isRef(key) ? key : ssrRef(null, key)
141
140
 
@@ -148,7 +147,7 @@ export const useAsync = (cb, key) => {
148
147
  }
149
148
 
150
149
  export const useContext = () => {
151
- warnOnce('useContext', 'You are using `useContext`, which can be replaced with `useNuxtApp` (import from `#app`).')
150
+ warnOnce('useContext', 'You are using `useContext`, which has a Nuxt 3-compatible replacement.')
152
151
 
153
152
  const route = useRoute()
154
153
  const nuxt = useNuxtApp()
@@ -215,6 +214,7 @@ export const defineComponent = (options) => {
215
214
  }
216
215
 
217
216
  export const useMeta = (init) => {
217
+ warnOnce('useMeta', 'You are using `useMeta`, which has a replacement provided by Nuxt Bridge.')
218
218
  const vm = getCurrentInstance()
219
219
  const refreshMeta = () => vm.$meta().refresh()
220
220
 
@@ -242,23 +242,24 @@ export const useMeta = (init) => {
242
242
 
243
243
  // Wrapped properties
244
244
  export const wrapProperty = (property, makeComputed = true) => () => {
245
+ warnOnce('wrapProperty', 'You are using `wrapProperty`, which is deprecated.')
245
246
  const vm = getCurrentInstance()
246
247
  return makeComputed ? computed(() => vm[property]) : vm[property]
247
248
  }
248
249
 
249
250
  export const useRouter = () => {
250
- warnOnce('useRouter', 'You are using `useRouter`, which can be replaced with `useRouter` (import from `#app`).')
251
+ warnOnce('useRouter', 'You are using `useRouter`, which has a Nuxt 3-compatible replacement.')
251
252
  return _useRouter()
252
253
  }
253
254
 
254
255
  export const useRoute = () => {
255
- warnOnce('useRoute', 'You are using `useRoute`, which can be replaced with `useRoute` (import from `#app`).')
256
+ warnOnce('useRoute', 'You are using `useRoute`, which has a Nuxt 3-compatible replacement.')
256
257
  const vm = getCurrentInstance()
257
258
  return computed(() => vm.$route)
258
259
  }
259
260
 
260
261
  export const useStore = () => {
261
- warnOnce('useRoute', 'You are using `useStore`, which can be replaced with `useNuxtApp` (import from `#app`).')
262
+ warnOnce('useRoute', 'You are using `useStore`, which has a Nuxt 3-compatible replacement.')
262
263
  return getCurrentInstance().$store
263
264
  }
264
265
 
@@ -484,6 +485,7 @@ async function callFetches () {
484
485
  const isSsrHydration = vm => vm.$vnode?.elm?.dataset?.fetchKey
485
486
 
486
487
  export const useFetch = (callback) => {
488
+ warnOnce('useFetch', 'You are using `useFetch`, which has a Nuxt 3-compatible replacement.')
487
489
  const vm = getCurrentInstance()
488
490
  const nuxt = useNuxtApp()
489
491
 
@@ -132,6 +132,7 @@ export const Meta = defineComponent({
132
132
  charset: String,
133
133
  content: String,
134
134
  httpEquiv: String,
135
+ key: String,
135
136
  name: String
136
137
  },
137
138
  setup: setupForUseMeta((meta) => ({
@@ -12,9 +12,12 @@ export interface MetaObject extends Record<string, any> {
12
12
  * @default `'width=device-width, initial-scale=1'`
13
13
  */
14
14
  viewport?: string;
15
- }
16
- declare module '@nuxt/kit' {
17
- interface ConfigSchema {
18
- meta: MetaObject;
19
- }
15
+ /** Each item in the array maps to a newly-created `<meta>` element, where object properties map to attributes. */
16
+ meta: Array<Record<string, any>>;
17
+ /** Each item in the array maps to a newly-created `<link>` element, where object properties map to attributes. */
18
+ link: Array<Record<string, any>>;
19
+ /** Each item in the array maps to a newly-created `<style>` element, where object properties map to attributes. */
20
+ style: Array<Record<string, any>>;
21
+ /** Each item in the array maps to a newly-created `<script>` element, where object properties map to attributes. */
22
+ script: Array<Record<string, any>>;
20
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/bridge-edge",
3
- "version": "3.0.0-27287360.4e9a272",
3
+ "version": "3.0.0-27291641.d4d886e",
4
4
  "repository": "nuxt/framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,12 +19,12 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@babel/plugin-transform-typescript": "^7.16.1",
22
- "@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27287360.4e9a272",
23
- "@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-27287360.4e9a272",
22
+ "@nuxt/kit": "npm:@nuxt/kit-edge@3.0.0-27291641.d4d886e",
23
+ "@nuxt/nitro": "npm:@nuxt/nitro-edge@3.0.0-27291641.d4d886e",
24
24
  "@nuxt/postcss8": "^1.1.3",
25
25
  "@vitejs/plugin-legacy": "^1.6.2",
26
26
  "@vue/composition-api": "^1.4.0",
27
- "@vueuse/head": "^0.7.0",
27
+ "@vueuse/head": "^0.7.2",
28
28
  "acorn": "^8.6.0",
29
29
  "consola": "^2.15.3",
30
30
  "defu": "^5.0.0",
@@ -38,7 +38,7 @@
38
38
  "mlly": "^0.3.13",
39
39
  "murmurhash-es": "^0.1.1",
40
40
  "node-fetch": "^3.1.0",
41
- "nuxi": "npm:nuxi-edge@3.0.0-27287360.4e9a272",
41
+ "nuxi": "npm:nuxi-edge@3.0.0-27291641.d4d886e",
42
42
  "p-debounce": "^4.0.0",
43
43
  "pathe": "^0.2.0",
44
44
  "postcss": "^8",