mirror of https://github.com/vuejs/core.git
Merge remote-tracking branch 'origin/main' into minor
This commit is contained in:
commit
d523d24ac0
|
@ -37,7 +37,7 @@ jobs:
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: Download Size Data
|
- name: Download Size Data
|
||||||
uses: dawidd6/action-download-artifact@v7
|
uses: dawidd6/action-download-artifact@v9
|
||||||
with:
|
with:
|
||||||
name: size-data
|
name: size-data
|
||||||
run_id: ${{ github.event.workflow_run.id }}
|
run_id: ${{ github.event.workflow_run.id }}
|
||||||
|
@ -56,7 +56,7 @@ jobs:
|
||||||
path: temp/size/base.txt
|
path: temp/size/base.txt
|
||||||
|
|
||||||
- name: Download Previous Size Data
|
- name: Download Previous Size Data
|
||||||
uses: dawidd6/action-download-artifact@v7
|
uses: dawidd6/action-download-artifact@v9
|
||||||
with:
|
with:
|
||||||
branch: ${{ steps.pr-base.outputs.content }}
|
branch: ${{ steps.pr-base.outputs.content }}
|
||||||
workflow: size-data.yml
|
workflow: size-data.yml
|
||||||
|
|
|
@ -44,7 +44,9 @@ Please make sure to read the [Contributing Guide](https://github.com/vuejs/core/
|
||||||
|
|
||||||
Thank you to all the people who already contributed to Vue!
|
Thank you to all the people who already contributed to Vue!
|
||||||
|
|
||||||
<a href="https://github.com/vuejs/core/graphs/contributors"><img src="https://opencollective.com/vuejs/contributors.svg?width=890" /></a>
|
<a href="https://github.com/vuejs/core/graphs/contributors"><img src="https://opencollective.com/vuejs/contributors.svg?width=890&limit=500" /></a>
|
||||||
|
|
||||||
|
<sub>_Note: Showing the first 500 contributors only due to GitHub image size limitations_</sub>
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[build.environment]
|
[build.environment]
|
||||||
NODE_VERSION = "18"
|
NODE_VERSION = "22"
|
||||||
NPM_FLAGS = "--version" # prevent Netlify npm install
|
NPM_FLAGS = "--version" # prevent Netlify npm install
|
||||||
|
|
38
package.json
38
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "3.5.13",
|
"version": "3.5.13",
|
||||||
"packageManager": "pnpm@10.4.1",
|
"packageManager": "pnpm@10.6.5",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node scripts/dev.js",
|
"dev": "node scripts/dev.js",
|
||||||
|
@ -65,52 +65,52 @@
|
||||||
"@babel/parser": "catalog:",
|
"@babel/parser": "catalog:",
|
||||||
"@babel/types": "catalog:",
|
"@babel/types": "catalog:",
|
||||||
"@rollup/plugin-alias": "^5.1.1",
|
"@rollup/plugin-alias": "^5.1.1",
|
||||||
"@rollup/plugin-commonjs": "^28.0.2",
|
"@rollup/plugin-commonjs": "^28.0.3",
|
||||||
"@rollup/plugin-json": "^6.1.0",
|
"@rollup/plugin-json": "^6.1.0",
|
||||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
"@rollup/plugin-replace": "5.0.4",
|
"@rollup/plugin-replace": "5.0.4",
|
||||||
"@swc/core": "^1.10.16",
|
"@swc/core": "^1.11.12",
|
||||||
"@types/hash-sum": "^1.0.2",
|
"@types/hash-sum": "^1.0.2",
|
||||||
"@types/node": "^22.13.4",
|
"@types/node": "^22.13.13",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@types/serve-handler": "^6.1.4",
|
"@types/serve-handler": "^6.1.4",
|
||||||
"@vitest/coverage-v8": "^3.0.5",
|
"@vitest/coverage-v8": "^3.0.9",
|
||||||
"@vitest/eslint-plugin": "^1.1.31",
|
"@vitest/eslint-plugin": "^1.1.38",
|
||||||
"@vue/consolidate": "1.0.0",
|
"@vue/consolidate": "1.0.0",
|
||||||
"conventional-changelog-cli": "^5.0.0",
|
"conventional-changelog-cli": "^5.0.0",
|
||||||
"enquirer": "^2.4.1",
|
"enquirer": "^2.4.1",
|
||||||
"esbuild": "^0.25.0",
|
"esbuild": "^0.25.1",
|
||||||
"esbuild-plugin-polyfill-node": "^0.3.0",
|
"esbuild-plugin-polyfill-node": "^0.3.0",
|
||||||
"eslint": "^9.20.1",
|
"eslint": "^9.23.0",
|
||||||
"eslint-plugin-import-x": "^4.6.1",
|
"eslint-plugin-import-x": "^4.9.1",
|
||||||
"estree-walker": "catalog:",
|
"estree-walker": "catalog:",
|
||||||
"jsdom": "^26.0.0",
|
"jsdom": "^26.0.0",
|
||||||
"lint-staged": "^15.4.3",
|
"lint-staged": "^15.5.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"magic-string": "^0.30.17",
|
"magic-string": "^0.30.17",
|
||||||
"markdown-table": "^3.0.4",
|
"markdown-table": "^3.0.4",
|
||||||
"marked": "13.0.3",
|
"marked": "13.0.3",
|
||||||
"npm-run-all2": "^7.0.2",
|
"npm-run-all2": "^7.0.2",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
"prettier": "^3.5.1",
|
"prettier": "^3.5.3",
|
||||||
"pretty-bytes": "^6.1.1",
|
"pretty-bytes": "^6.1.1",
|
||||||
"pug": "^3.0.3",
|
"pug": "^3.0.3",
|
||||||
"puppeteer": "~24.2.1",
|
"puppeteer": "~24.4.0",
|
||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"rollup": "^4.34.7",
|
"rollup": "^4.37.0",
|
||||||
"rollup-plugin-dts": "^6.1.1",
|
"rollup-plugin-dts": "^6.2.1",
|
||||||
"rollup-plugin-esbuild": "^6.2.0",
|
"rollup-plugin-esbuild": "^6.2.1",
|
||||||
"rollup-plugin-polyfill-node": "^0.13.0",
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
||||||
"semver": "^7.7.1",
|
"semver": "^7.7.1",
|
||||||
"serve": "^14.2.4",
|
"serve": "^14.2.4",
|
||||||
"serve-handler": "^6.1.6",
|
"serve-handler": "^6.1.6",
|
||||||
"simple-git-hooks": "^2.11.1",
|
"simple-git-hooks": "^2.12.1",
|
||||||
"todomvc-app-css": "^2.4.3",
|
"todomvc-app-css": "^2.4.3",
|
||||||
"tslib": "^2.8.1",
|
"tslib": "^2.8.1",
|
||||||
"typescript": "~5.6.2",
|
"typescript": "~5.6.2",
|
||||||
"typescript-eslint": "^8.24.0",
|
"typescript-eslint": "^8.27.0",
|
||||||
"vite": "catalog:",
|
"vite": "catalog:",
|
||||||
"vitest": "^3.0.5"
|
"vitest": "^3.0.9"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"peerDependencyRules": {
|
"peerDependencyRules": {
|
||||||
|
|
|
@ -9,7 +9,7 @@ app.directive<HTMLElement, string, 'prevent' | 'stop', 'arg1' | 'arg2'>(
|
||||||
mounted(el, binding) {
|
mounted(el, binding) {
|
||||||
expectType<HTMLElement>(el)
|
expectType<HTMLElement>(el)
|
||||||
expectType<string>(binding.value)
|
expectType<string>(binding.value)
|
||||||
expectType<{ prevent: boolean; stop: boolean }>(binding.modifiers)
|
expectType<{ prevent?: boolean; stop?: boolean }>(binding.modifiers)
|
||||||
expectType<'arg1' | 'arg2'>(binding.arg!)
|
expectType<'arg1' | 'arg2'>(binding.arg!)
|
||||||
|
|
||||||
// @ts-expect-error not any
|
// @ts-expect-error not any
|
||||||
|
|
|
@ -12,8 +12,11 @@ app.use(PluginWithoutType, 2)
|
||||||
app.use(PluginWithoutType, { anything: 'goes' }, true)
|
app.use(PluginWithoutType, { anything: 'goes' }, true)
|
||||||
|
|
||||||
type PluginOptions = {
|
type PluginOptions = {
|
||||||
|
/** option1 */
|
||||||
option1?: string
|
option1?: string
|
||||||
|
/** option2 */
|
||||||
option2: number
|
option2: number
|
||||||
|
/** option3 */
|
||||||
option3: boolean
|
option3: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +28,20 @@ const PluginWithObjectOptions = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const objectPluginOptional = {
|
||||||
|
install(app: App, options?: PluginOptions) {},
|
||||||
|
}
|
||||||
|
app.use(objectPluginOptional)
|
||||||
|
app.use(
|
||||||
|
objectPluginOptional,
|
||||||
|
// Test JSDoc and `go to definition` for options
|
||||||
|
{
|
||||||
|
option1: 'foo',
|
||||||
|
option2: 1,
|
||||||
|
option3: true,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
for (const Plugin of [
|
for (const Plugin of [
|
||||||
PluginWithObjectOptions,
|
PluginWithObjectOptions,
|
||||||
PluginWithObjectOptions.install,
|
PluginWithObjectOptions.install,
|
||||||
|
@ -92,7 +109,27 @@ const PluginTyped: Plugin<PluginOptions> = (app, options) => {}
|
||||||
|
|
||||||
// @ts-expect-error: needs options
|
// @ts-expect-error: needs options
|
||||||
app.use(PluginTyped)
|
app.use(PluginTyped)
|
||||||
app.use(PluginTyped, { option2: 2, option3: true })
|
app.use(
|
||||||
|
PluginTyped,
|
||||||
|
// Test autocomplete for options
|
||||||
|
{
|
||||||
|
option1: '',
|
||||||
|
option2: 2,
|
||||||
|
option3: true,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
const functionPluginOptional = (app: App, options?: PluginOptions) => {}
|
||||||
|
app.use(functionPluginOptional)
|
||||||
|
app.use(functionPluginOptional, { option2: 2, option3: true })
|
||||||
|
|
||||||
|
// type optional params
|
||||||
|
const functionPluginOptional2: Plugin<[options?: PluginOptions]> = (
|
||||||
|
app,
|
||||||
|
options,
|
||||||
|
) => {}
|
||||||
|
app.use(functionPluginOptional2)
|
||||||
|
app.use(functionPluginOptional2, { option2: 2, option3: true })
|
||||||
|
|
||||||
// vuetify usage
|
// vuetify usage
|
||||||
const key: string = ''
|
const key: string = ''
|
||||||
|
|
|
@ -29,7 +29,7 @@ describe('custom', () => {
|
||||||
value: number
|
value: number
|
||||||
oldValue: number | null
|
oldValue: number | null
|
||||||
arg?: 'Arg'
|
arg?: 'Arg'
|
||||||
modifiers: Record<'a' | 'b', boolean>
|
modifiers: Partial<Record<'a' | 'b', boolean>>
|
||||||
}>(testDirective<number, 'a' | 'b', 'Arg'>())
|
}>(testDirective<number, 'a' | 'b', 'Arg'>())
|
||||||
|
|
||||||
expectType<{
|
expectType<{
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
type MaybeRefOrGetter,
|
type MaybeRefOrGetter,
|
||||||
type Ref,
|
type Ref,
|
||||||
type ShallowRef,
|
type ShallowRef,
|
||||||
|
type TemplateRef,
|
||||||
type ToRefs,
|
type ToRefs,
|
||||||
type WritableComputedRef,
|
type WritableComputedRef,
|
||||||
computed,
|
computed,
|
||||||
|
@ -535,7 +536,7 @@ expectType<string>(toValue(unref2))
|
||||||
|
|
||||||
// useTemplateRef
|
// useTemplateRef
|
||||||
const tRef = useTemplateRef('foo')
|
const tRef = useTemplateRef('foo')
|
||||||
expectType<Readonly<ShallowRef<unknown>>>(tRef)
|
expectType<TemplateRef>(tRef)
|
||||||
|
|
||||||
const tRef2 = useTemplateRef<HTMLElement>('bar')
|
const tRef2 = useTemplateRef<HTMLElement>('bar')
|
||||||
expectType<Readonly<ShallowRef<HTMLElement | null>>>(tRef2)
|
expectType<TemplateRef<HTMLElement>>(tRef2)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"vite": "catalog:"
|
"vite": "catalog:"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/repl": "^4.4.3",
|
"@vue/repl": "^4.5.1",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"vue": "workspace:*"
|
"vue": "workspace:*"
|
||||||
|
|
|
@ -17,7 +17,10 @@ export async function downloadProject(store: ReplStore) {
|
||||||
|
|
||||||
// basic structure
|
// basic structure
|
||||||
zip.file('index.html', index)
|
zip.file('index.html', index)
|
||||||
zip.file('package.json', pkg)
|
zip.file(
|
||||||
|
'package.json',
|
||||||
|
pkg.replace(`"vue": "latest"`, `"vue": "${store.vueVersion || 'latest'}"`),
|
||||||
|
)
|
||||||
zip.file('vite.config.js', config)
|
zip.file('vite.config.js', config)
|
||||||
zip.file('README.md', readme)
|
zip.file('README.md', readme)
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
"serve": "vite preview"
|
"serve": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"vue": "^3.4.0"
|
"vue": "latest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.2.1",
|
"@vitejs/plugin-vue": "^5.2.3",
|
||||||
"vite": "^6.1.0"
|
"vite": "^6.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
"@vue/shared": "workspace:*",
|
"@vue/shared": "workspace:*",
|
||||||
"estree-walker": "catalog:",
|
"estree-walker": "catalog:",
|
||||||
"magic-string": "catalog:",
|
"magic-string": "catalog:",
|
||||||
"postcss": "^8.5.1",
|
"postcss": "^8.5.3",
|
||||||
"source-map-js": "catalog:"
|
"source-map-js": "catalog:"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -60,8 +60,8 @@
|
||||||
"merge-source-map": "^1.1.0",
|
"merge-source-map": "^1.1.0",
|
||||||
"minimatch": "~10.0.1",
|
"minimatch": "~10.0.1",
|
||||||
"postcss-modules": "^6.0.1",
|
"postcss-modules": "^6.0.1",
|
||||||
"postcss-selector-parser": "^7.0.0",
|
"postcss-selector-parser": "^7.1.0",
|
||||||
"pug": "^3.0.3",
|
"pug": "^3.0.3",
|
||||||
"sass": "^1.85.0"
|
"sass": "^1.86.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { isRef, ref } from '../src/ref'
|
import { isRef, ref, shallowRef } from '../src/ref'
|
||||||
import {
|
import {
|
||||||
isProxy,
|
isProxy,
|
||||||
isReactive,
|
isReactive,
|
||||||
|
@ -426,4 +426,17 @@ describe('reactivity/reactive', () => {
|
||||||
map.set(void 0, 1)
|
map.set(void 0, 1)
|
||||||
expect(c.value).toBe(1)
|
expect(c.value).toBe(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('should return true for reactive objects', () => {
|
||||||
|
expect(isReactive(reactive({}))).toBe(true)
|
||||||
|
expect(isReactive(readonly(reactive({})))).toBe(true)
|
||||||
|
expect(isReactive(ref({}).value)).toBe(true)
|
||||||
|
expect(isReactive(readonly(ref({})).value)).toBe(true)
|
||||||
|
expect(isReactive(shallowReactive({}))).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('should return false for non-reactive objects', () => {
|
||||||
|
expect(isReactive(ref(true))).toBe(false)
|
||||||
|
expect(isReactive(shallowRef({}).value)).toBe(false)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -108,9 +108,9 @@ export declare const ShallowReactiveMarker: unique symbol
|
||||||
export type ShallowReactive<T> = T & { [ShallowReactiveMarker]?: true }
|
export type ShallowReactive<T> = T & { [ShallowReactiveMarker]?: true }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shallow version of {@link reactive()}.
|
* Shallow version of {@link reactive}.
|
||||||
*
|
*
|
||||||
* Unlike {@link reactive()}, there is no deep conversion: only root-level
|
* Unlike {@link reactive}, there is no deep conversion: only root-level
|
||||||
* properties are reactive for a shallow reactive object. Property values are
|
* properties are reactive for a shallow reactive object. Property values are
|
||||||
* stored and exposed as-is - this also means properties with ref values will
|
* stored and exposed as-is - this also means properties with ref values will
|
||||||
* not be automatically unwrapped.
|
* not be automatically unwrapped.
|
||||||
|
@ -178,7 +178,7 @@ export type DeepReadonly<T> = T extends Builtin
|
||||||
* the original.
|
* the original.
|
||||||
*
|
*
|
||||||
* A readonly proxy is deep: any nested property accessed will be readonly as
|
* A readonly proxy is deep: any nested property accessed will be readonly as
|
||||||
* well. It also has the same ref-unwrapping behavior as {@link reactive()},
|
* well. It also has the same ref-unwrapping behavior as {@link reactive},
|
||||||
* except the unwrapped values will also be made readonly.
|
* except the unwrapped values will also be made readonly.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
|
@ -215,9 +215,9 @@ export function readonly<T extends object>(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shallow version of {@link readonly()}.
|
* Shallow version of {@link readonly}.
|
||||||
*
|
*
|
||||||
* Unlike {@link readonly()}, there is no deep conversion: only root-level
|
* Unlike {@link readonly}, there is no deep conversion: only root-level
|
||||||
* properties are made readonly. Property values are stored and exposed as-is -
|
* properties are made readonly. Property values are stored and exposed as-is -
|
||||||
* this also means properties with ref values will not be automatically
|
* this also means properties with ref values will not be automatically
|
||||||
* unwrapped.
|
* unwrapped.
|
||||||
|
@ -298,8 +298,8 @@ function createReactiveObject(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an object is a proxy created by {@link reactive()} or
|
* Checks if an object is a proxy created by {@link reactive} or
|
||||||
* {@link shallowReactive()} (or {@link ref()} in some cases).
|
* {@link shallowReactive} (or {@link ref} in some cases).
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```js
|
* ```js
|
||||||
|
@ -327,7 +327,7 @@ export function isReactive(value: unknown): boolean {
|
||||||
* readonly object can change, but they can't be assigned directly via the
|
* readonly object can change, but they can't be assigned directly via the
|
||||||
* passed object.
|
* passed object.
|
||||||
*
|
*
|
||||||
* The proxies created by {@link readonly()} and {@link shallowReadonly()} are
|
* The proxies created by {@link readonly} and {@link shallowReadonly} are
|
||||||
* both considered readonly, as is a computed ref without a set function.
|
* both considered readonly, as is a computed ref without a set function.
|
||||||
*
|
*
|
||||||
* @param value - The value to check.
|
* @param value - The value to check.
|
||||||
|
@ -343,7 +343,7 @@ export function isShallow(value: unknown): boolean {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if an object is a proxy created by {@link reactive},
|
* Checks if an object is a proxy created by {@link reactive},
|
||||||
* {@link readonly}, {@link shallowReactive} or {@link shallowReadonly()}.
|
* {@link readonly}, {@link shallowReactive} or {@link shallowReadonly}.
|
||||||
*
|
*
|
||||||
* @param value - The value to check.
|
* @param value - The value to check.
|
||||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#isproxy}
|
||||||
|
@ -356,8 +356,8 @@ export function isProxy(value: any): boolean {
|
||||||
* Returns the raw, original object of a Vue-created proxy.
|
* Returns the raw, original object of a Vue-created proxy.
|
||||||
*
|
*
|
||||||
* `toRaw()` can return the original object from proxies created by
|
* `toRaw()` can return the original object from proxies created by
|
||||||
* {@link reactive()}, {@link readonly()}, {@link shallowReactive()} or
|
* {@link reactive}, {@link readonly}, {@link shallowReactive} or
|
||||||
* {@link shallowReadonly()}.
|
* {@link shallowReadonly}.
|
||||||
*
|
*
|
||||||
* This is an escape hatch that can be used to temporarily read without
|
* This is an escape hatch that can be used to temporarily read without
|
||||||
* incurring proxy access / tracking overhead or write without triggering
|
* incurring proxy access / tracking overhead or write without triggering
|
||||||
|
@ -397,7 +397,7 @@ export type Raw<T> = T & { [RawSymbol]?: true }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* **Warning:** `markRaw()` together with the shallow APIs such as
|
* **Warning:** `markRaw()` together with the shallow APIs such as
|
||||||
* {@link shallowReactive()} allow you to selectively opt-out of the default
|
* {@link shallowReactive} allow you to selectively opt-out of the default
|
||||||
* deep reactive/readonly conversion and embed raw, non-proxied objects in your
|
* deep reactive/readonly conversion and embed raw, non-proxied objects in your
|
||||||
* state graph.
|
* state graph.
|
||||||
*
|
*
|
||||||
|
|
|
@ -70,7 +70,7 @@ export type ShallowRef<T = any, S = T> = Ref<T, S> & {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shallow version of {@link ref()}.
|
* Shallow version of {@link ref}.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```js
|
* ```js
|
||||||
|
@ -237,7 +237,7 @@ export function unref<T>(ref: MaybeRef<T> | ComputedRef<T>): T {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes values / refs / getters to values.
|
* Normalizes values / refs / getters to values.
|
||||||
* This is similar to {@link unref()}, except that it also normalizes getters.
|
* This is similar to {@link unref}, except that it also normalizes getters.
|
||||||
* If the argument is a getter, it will be invoked and its return value will
|
* If the argument is a getter, it will be invoked and its return value will
|
||||||
* be returned.
|
* be returned.
|
||||||
*
|
*
|
||||||
|
@ -347,7 +347,7 @@ export type ToRefs<T = any> = {
|
||||||
/**
|
/**
|
||||||
* Converts a reactive object to a plain object where each property of the
|
* Converts a reactive object to a plain object where each property of the
|
||||||
* resulting object is a ref pointing to the corresponding property of the
|
* resulting object is a ref pointing to the corresponding property of the
|
||||||
* original object. Each individual ref is created using {@link toRef()}.
|
* original object. Each individual ref is created using {@link toRef}.
|
||||||
*
|
*
|
||||||
* @param object - Reactive object to be made into an object of linked refs.
|
* @param object - Reactive object to be made into an object of linked refs.
|
||||||
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
* @see {@link https://vuejs.org/api/reactivity-utilities.html#torefs}
|
||||||
|
|
|
@ -36,9 +36,9 @@ export interface App<HostElement = any> {
|
||||||
|
|
||||||
use<Options extends unknown[]>(
|
use<Options extends unknown[]>(
|
||||||
plugin: Plugin<Options>,
|
plugin: Plugin<Options>,
|
||||||
...options: Options
|
...options: NoInfer<Options>
|
||||||
): this
|
): this
|
||||||
use<Options>(plugin: Plugin<Options>, options: Options): this
|
use<Options>(plugin: Plugin<Options>, options: NoInfer<Options>): this
|
||||||
|
|
||||||
mixin(mixin: ComponentOptions): this
|
mixin(mixin: ComponentOptions): this
|
||||||
component(name: string): Component | undefined
|
component(name: string): Component | undefined
|
||||||
|
@ -215,9 +215,11 @@ export type ObjectPlugin<Options = any[]> = {
|
||||||
export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> &
|
export type FunctionPlugin<Options = any[]> = PluginInstallFunction<Options> &
|
||||||
Partial<ObjectPlugin<Options>>
|
Partial<ObjectPlugin<Options>>
|
||||||
|
|
||||||
export type Plugin<Options = any[]> =
|
export type Plugin<
|
||||||
| FunctionPlugin<Options>
|
Options = any[],
|
||||||
| ObjectPlugin<Options>
|
// TODO: in next major Options extends unknown[] and remove P
|
||||||
|
P extends unknown[] = Options extends unknown[] ? Options : [Options],
|
||||||
|
> = FunctionPlugin<P> | ObjectPlugin<P>
|
||||||
|
|
||||||
export function createAppContext(): AppContext {
|
export function createAppContext(): AppContext {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -4,6 +4,8 @@ import {
|
||||||
isReadonly,
|
isReadonly,
|
||||||
isRef,
|
isRef,
|
||||||
isShallow,
|
isShallow,
|
||||||
|
pauseTracking,
|
||||||
|
resetTracking,
|
||||||
toRaw,
|
toRaw,
|
||||||
} from '@vue/reactivity'
|
} from '@vue/reactivity'
|
||||||
import { EMPTY_OBJ, extend, isArray, isFunction, isObject } from '@vue/shared'
|
import { EMPTY_OBJ, extend, isArray, isFunction, isObject } from '@vue/shared'
|
||||||
|
@ -34,13 +36,16 @@ export function initCustomFormatter(): void {
|
||||||
if (obj.__isVue) {
|
if (obj.__isVue) {
|
||||||
return ['div', vueStyle, `VueInstance`]
|
return ['div', vueStyle, `VueInstance`]
|
||||||
} else if (isRef(obj)) {
|
} else if (isRef(obj)) {
|
||||||
|
// avoid tracking during debugger accessing
|
||||||
|
pauseTracking()
|
||||||
|
const value = obj.value
|
||||||
|
resetTracking()
|
||||||
return [
|
return [
|
||||||
'div',
|
'div',
|
||||||
{},
|
{},
|
||||||
['span', vueStyle, genRefFlag(obj)],
|
['span', vueStyle, genRefFlag(obj)],
|
||||||
'<',
|
'<',
|
||||||
// avoid debugger accessing value affecting behavior
|
formatValue(value),
|
||||||
formatValue('_value' in obj ? obj._value : obj),
|
|
||||||
`>`,
|
`>`,
|
||||||
]
|
]
|
||||||
} else if (isReactive(obj)) {
|
} else if (isReactive(obj)) {
|
||||||
|
|
|
@ -111,7 +111,9 @@ export type Directive<
|
||||||
| ObjectDirective<HostElement, Value, Modifiers, Arg>
|
| ObjectDirective<HostElement, Value, Modifiers, Arg>
|
||||||
| FunctionDirective<HostElement, Value, Modifiers, Arg>
|
| FunctionDirective<HostElement, Value, Modifiers, Arg>
|
||||||
|
|
||||||
export type DirectiveModifiers<K extends string = string> = Record<K, boolean>
|
export type DirectiveModifiers<K extends string = string> = Partial<
|
||||||
|
Record<K, boolean>
|
||||||
|
>
|
||||||
|
|
||||||
export function validateDirectiveName(name: string): void {
|
export function validateDirectiveName(name: string): void {
|
||||||
if (isBuiltInDirective(name)) {
|
if (isBuiltInDirective(name)) {
|
||||||
|
|
|
@ -5,9 +5,11 @@ import { EMPTY_OBJ } from '@vue/shared'
|
||||||
|
|
||||||
export const knownTemplateRefs: WeakSet<ShallowRef> = new WeakSet()
|
export const knownTemplateRefs: WeakSet<ShallowRef> = new WeakSet()
|
||||||
|
|
||||||
|
export type TemplateRef<T = unknown> = Readonly<ShallowRef<T | null>>
|
||||||
|
|
||||||
export function useTemplateRef<T = unknown, Keys extends string = string>(
|
export function useTemplateRef<T = unknown, Keys extends string = string>(
|
||||||
key: Keys,
|
key: Keys,
|
||||||
): Readonly<ShallowRef<T | null>> {
|
): TemplateRef<T> {
|
||||||
const i = getCurrentInstance()
|
const i = getCurrentInstance()
|
||||||
const r = shallowRef(null)
|
const r = shallowRef(null)
|
||||||
if (i) {
|
if (i) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ export { defineComponent } from './apiDefineComponent'
|
||||||
export { defineAsyncComponent } from './apiAsyncComponent'
|
export { defineAsyncComponent } from './apiAsyncComponent'
|
||||||
export { useAttrs, useSlots } from './apiSetupHelpers'
|
export { useAttrs, useSlots } from './apiSetupHelpers'
|
||||||
export { useModel } from './helpers/useModel'
|
export { useModel } from './helpers/useModel'
|
||||||
export { useTemplateRef } from './helpers/useTemplateRef'
|
export { useTemplateRef, type TemplateRef } from './helpers/useTemplateRef'
|
||||||
export { useId } from './helpers/useId'
|
export { useId } from './helpers/useId'
|
||||||
export {
|
export {
|
||||||
hydrateOnIdle,
|
hydrateOnIdle,
|
||||||
|
|
1564
pnpm-lock.yaml
1564
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -3,10 +3,10 @@ packages:
|
||||||
- 'packages-private/*'
|
- 'packages-private/*'
|
||||||
|
|
||||||
catalog:
|
catalog:
|
||||||
'@babel/parser': ^7.25.3
|
'@babel/parser': ^7.26.10
|
||||||
'@babel/types': ^7.25.2
|
'@babel/types': ^7.26.10
|
||||||
'estree-walker': ^2.0.2
|
'estree-walker': ^2.0.2
|
||||||
'magic-string': ^0.30.11
|
'magic-string': ^0.30.17
|
||||||
'source-map-js': ^1.2.1
|
'source-map-js': ^1.2.1
|
||||||
'vite': ^5.4.14
|
'vite': ^5.4.14
|
||||||
'@vitejs/plugin-vue': ^5.2.1
|
'@vitejs/plugin-vue': ^5.2.3
|
||||||
|
|
|
@ -36,7 +36,7 @@ exec('pnpm', ['build', 'vue', '-f', 'global-runtime']).then(() => {
|
||||||
prodBuild.includes('annotation,annotation-xml,maction')
|
prodBuild.includes('annotation,annotation-xml,maction')
|
||||||
) {
|
) {
|
||||||
errors.push(
|
errors.push(
|
||||||
'prod build contains unexpected domTagConifg lists.\n' +
|
'prod build contains unexpected domTagConfig lists.\n' +
|
||||||
'This means helpers like isHTMLTag() is used in runtime code paths when it should be compiler-only.',
|
'This means helpers like isHTMLTag() is used in runtime code paths when it should be compiler-only.',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue