Skip to content

Commit 98e100a

Browse files
committed
chore: rename to @vue/composition-api
1 parent 64aa6a8 commit 98e100a

File tree

6 files changed

+46
-63
lines changed

6 files changed

+46
-63
lines changed

CHANGELOG.md

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,3 @@
1-
# 3.0.0-beta.0
2-
3-
`vue-function-api` v3.0.0 reflects the new [Composition API](https://vue-composition-api-rfc.netlify.com/) RFC.
4-
The version is limited to beta until the RFC has been merged.
5-
6-
## Changed
7-
* rename `value` to `ref`.
8-
* rename `state` to `reactive`.
9-
* remove `ref` from `SetupContext`.
10-
* export `plugin` as `default export`
11-
```js
12-
import VueFunctionApi from 'vue-function-api';
13-
Vue.use(VueFunctionApi);
14-
```
15-
16-
## Added
17-
* new APIs `toRefs` and `isRef`.
18-
191
# 2.2.0
202
* Improve typescript support.
213
* Export `createElement`.
@@ -24,15 +6,15 @@ The version is limited to beta until the RFC has been merged.
246
* Allow string keys in `provide`/`inject`.
257

268
# 2.1.2
27-
* Remove auto-unwrapping for Array ([#53](https://github.com/vuejs/vue-function-api/issues/53)).
9+
* Remove auto-unwrapping for Array ([#53](https://github.com/vuejs/composition-api/issues/53)).
2810

2911
# 2.1.1
30-
* Export `set` from `vue-function-api`. Using exported `set` whenever you need to use [Vue.set](https://vuejs.org/v2/api/#Vue-set) or [vm.$set](https://vuejs.org/v2/api/#vm-set). The custom `set` ensures that auto-unwrapping works for the new property.
12+
* Export `set()` function. Using exported `set` whenever you need to use [Vue.set](https://vuejs.org/v2/api/#Vue-set) or [vm.$set](https://vuejs.org/v2/api/#vm-set). The custom `set` ensures that auto-unwrapping works for the new property.
3113
* Add a new signature of `provide`: `provide(key, value)`.
3214
* Fix multiple `provide` invoking per component.
3315
* Fix order of `setup` invoking.
34-
* `onErrorCaptured` not triggered ([#25](https://github.com/vuejs/vue-function-api/issues/25)).
35-
* Fix `this` losing in nested setup call ([#38](https://github.com/vuejs/vue-function-api/issues/38)).
16+
* `onErrorCaptured` not triggered ([#25](https://github.com/vuejs/composition-api/issues/25)).
17+
* Fix `this` losing in nested setup call ([#38](https://github.com/vuejs/composition-api/issues/38)).
3618
* Fix some edge cases of unwarpping.
3719
* Change `context.slots`'s value. It now proxies to `$scopeSlots` instead of `$slots`.
3820

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> [Vue Composition API](https://vue-composition-api-rfc.netlify.com/)
44
5-
`vue-function-api` provides a way to use Vue3's **Composition api** in `Vue2.x`.
5+
`@vue/composition-api` provides a way to use Vue3's **Composition api** in `Vue2.x`.
66

77
[**中文文档**](./README.zh-CN.md)
88

@@ -15,39 +15,39 @@
1515
- [TypeScript](#TypeScript)
1616
- [Limitations](#Limitations)
1717
- [API](https://vue-composition-api-rfc.netlify.com/api.html)
18-
- [Changelog](https://github.com/vuejs/vue-function-api/blob/master/CHANGELOG.md)
18+
- [Changelog](https://github.com/vuejs/composition-api/blob/master/CHANGELOG.md)
1919

2020
# Installation
2121

2222
**npm**
2323

2424
```bash
25-
npm install vue-function-api --save
25+
npm install @vue/composition-api --save
2626
```
2727

2828
**yarn**
2929

3030
```bash
31-
yarn add vue-function-api
31+
yarn add @vue/composition-api
3232
```
3333

3434
**CDN**
3535

3636
```html
37-
<script src="https://unpkg.com/vue-function-api/dist/vue-function-api.umd.js"></script>
37+
<script src="https://unpkg.com/@vue/composition-api/dist/vue-composition-api.umd.js"></script>
3838
```
3939

40-
By using the global variable `window.vueFunctionApi`
40+
By using the global variable `window.vueCompositionApi`
4141

4242
# Usage
4343

44-
You must explicitly install `vue-function-api` via `Vue.use()`:
44+
You must install `@vue/composition-api` via `Vue.use()` before using other APIs:
4545

4646
```js
4747
import Vue from 'vue';
48-
import VueFunctionApi from 'vue-function-api';
48+
import VueCompositionApi from '@vue/composition-api';
4949

50-
Vue.use(VueFunctionApi);
50+
Vue.use(VueCompositionApi);
5151
```
5252

5353
After installing the plugin you can use the [Composition API](https://vue-composition-api-rfc.netlify.com/) to compose your component.
@@ -57,7 +57,7 @@ After installing the plugin you can use the [Composition API](https://vue-compos
5757
To let TypeScript properly infer types inside Vue component options, you need to define components with `createComponent`:
5858

5959
```ts
60-
import { createComponent } from 'vue-function-api';
60+
import { createComponent } from '@vue/composition-api';
6161

6262
const Component = createComponent({
6363
// type inference enabled
@@ -240,7 +240,7 @@ export default {
240240
241241
If you really want to use template refs in this case, you can access `vm.$refs` via `SetupContext.refs`.
242242
243-
> :warning: **Warning**: The `SetupContext.refs` won't existed in `Vue3.0`. `Vue-function-api` provide it as a workaround here.
243+
> :warning: **Warning**: The `SetupContext.refs` won't existed in `Vue3.0`. `@vue/composition-api` provide it as a workaround here.
244244
245245
```js
246246
export default {
@@ -266,11 +266,11 @@ You may also need to augment the `SetupContext` when wokring with TypeScript:
266266
267267
```ts
268268
import Vue from 'vue';
269-
import VueFunctionApi from 'vue-function-api';
269+
import VueCompositionApi from '@vue/composition-api';
270270

271-
Vue.use(VueFunctionApi);
271+
Vue.use(VueCompositionApi);
272272

273-
declare module 'vue-function-api/dist/component/component' {
273+
declare module '@vue/composition-api/dist/component/component' {
274274
interface SetupContext {
275275
readonly refs: { [key: string]: Vue | Element | Vue[] | Element[] };
276276
}

README.zh-CN.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> [Vue Composition API](https://vue-composition-api-rfc.netlify.com/)
44
5-
`vue-function-api` 使开发者们可以在 `Vue2.x` 中使用 `Vue3` 引入的**基于函数****逻辑复用机制**
5+
`@vue/composition-api` 使开发者们可以在 `Vue2.x` 中使用 `Vue3` 引入的**基于函数****逻辑复用机制**
66

77
[**English Version**](./README.md)
88

@@ -15,39 +15,39 @@
1515
- [TypeScript](#TypeScript)
1616
- [限制](#限制)
1717
- [API](https://vue-composition-api-rfc.netlify.com/api.html)
18-
- [Changelog](https://github.com/vuejs/vue-function-api/blob/master/CHANGELOG.md)
18+
- [Changelog](https://github.com/vuejs/composition-api/blob/master/CHANGELOG.md)
1919

2020
# 安装
2121

2222
**npm**
2323

2424
```bash
25-
npm install vue-function-api --save
25+
npm install @vue/composition-api --save
2626
```
2727

2828
**yarn**
2929

3030
```bash
31-
yarn add vue-function-api
31+
yarn add @vue/composition-api
3232
```
3333

3434
**CDN**
3535

3636
```html
37-
<script src="https://unpkg.com/vue-function-api/dist/vue-function-api.umd.js"></script>
37+
<script src="https://unpkg.com/@vue/composition-api/dist/vue-composition-api.umd.js"></script>
3838
```
3939

40-
通过全局变量 `window.vueFunctionApi` 来使用。
40+
通过全局变量 `window.vueCompositionApi` 来使用。
4141

4242
# 使用
4343

44-
您必须显式地通过 `Vue.use()` 来安装 `vue-function-api`:
44+
在使用任何 `@vue/composition-api` 提供的能力前,必须先通过 `Vue.use()` 进行安装:
4545

4646
```js
4747
import Vue from 'vue';
48-
import VueFunctionApi from 'vue-function-api';
48+
import VueCompositionApi from '@vue/composition-api';
4949

50-
Vue.use(VueFunctionApi);
50+
Vue.use(VueCompositionApi);
5151
```
5252

5353
安装插件后,您就可以使用新的[Composition API](https://vue-composition-api-rfc.netlify.com/)来开发组件了。
@@ -57,7 +57,7 @@ Vue.use(VueFunctionApi);
5757
为了让 TypeScript 正确的推到类型,我们必须使用 `createComponent` 来定义组件:
5858

5959
```ts
60-
import { createComponent } from 'vue-function-api';
60+
import { createComponent } from '@vue/composition-api';
6161

6262
const Component = createComponent({
6363
// 启用类型推断
@@ -237,7 +237,7 @@ export default {
237237
238238
如果你依然选择在 `setup()` 中写 `render` 函数,那么你可以使用 `SetupContext.refs` 来访问模板引用,它等价于 vue2 中的 `this.$refs`:
239239
240-
> :warning: **警告**: `SetupContext.refs` 并不属于 `Vue3.0` 的一部分, `Vue-function-api` 将其曝光在 `SetupContext` 中只是临时提供的一种变通方案。
240+
> :warning: **警告**: `SetupContext.refs` 并不属于 `Vue3.0` 的一部分, `@vue/composition-api` 将其曝光在 `SetupContext` 中只是临时提供的一种变通方案。
241241
242242
```js
243243
export default {
@@ -263,11 +263,11 @@ export default {
263263
264264
```ts
265265
import Vue from 'vue';
266-
import VueFunctionApi from 'vue-function-api';
266+
import VueCompositionApi from '@vue/composition-api';
267267

268-
Vue.use(VueFunctionApi);
268+
Vue.use(VueCompositionApi);
269269

270-
declare module 'vue-function-api/dist/component/component' {
270+
declare module '@vue/composition-api/dist/component/component' {
271271
interface SetupContext {
272272
readonly refs: { [key: string]: Vue | Element | Vue[] | Element[] };
273273
}

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
2-
"name": "vue-function-api",
2+
"name": "@vue/composition-api",
33
"version": "3.0.0-beta.0",
44
"description": "Provide logic composition capabilities for Vue.",
55
"keywords": [
66
"vue",
7+
"composition-api",
78
"function-api"
89
],
9-
"main": "dist/vue-function-api.js",
10-
"umd:main": "dist/vue-function-api.umd.js",
11-
"module": "dist/vue-function-api.module.js",
10+
"main": "dist/vue-composition-api.js",
11+
"umd:main": "dist/vue-composition-api.umd.js",
12+
"module": "dist/vue-composition-api.module.js",
1213
"typings": "dist/index.d.ts",
1314
"author": {
1415
"name": "liximomo",
@@ -26,9 +27,9 @@
2627
"release": "bash scripts/release.sh"
2728
},
2829
"bugs": {
29-
"url": "https://github.com/vuejs/vue-function-api/issues"
30+
"url": "https://github.com/vuejs/composition-api/issues"
3031
},
31-
"homepage": "https://github.com/vuejs/vue-function-api#readme",
32+
"homepage": "https://github.com/vuejs/composition-api#readme",
3233
"devDependencies": {
3334
"@types/jest": "^24.0.13",
3435
"@types/node": "^12.0.2",

rollup.config.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@ import replace from 'rollup-plugin-replace';
77

88
const builds = {
99
'cjs-dev': {
10-
outFile: 'vue-function-api.js',
10+
outFile: 'vue-composition-api.js',
1111
format: 'cjs',
1212
mode: 'development',
1313
},
1414
'cjs-prod': {
15-
outFile: 'vue-function-api.min.js',
15+
outFile: 'vue-composition-api.min.js',
1616
format: 'cjs',
1717
mode: 'production',
1818
},
1919
'umd-dev': {
20-
outFile: 'vue-function-api.umd.js',
20+
outFile: 'vue-composition-api.umd.js',
2121
format: 'umd',
2222
mode: 'development',
2323
},
2424
'umd-prod': {
25-
outFile: 'vue-function-api.umd.min.js',
25+
outFile: 'vue-composition-api.umd.min.js',
2626
format: 'umd',
2727
mode: 'production',
2828
},
2929
es: {
30-
outFile: 'vue-function-api.module.js',
30+
outFile: 'vue-composition-api.module.js',
3131
format: 'es',
3232
mode: 'development',
3333
},
@@ -48,7 +48,7 @@ function genConfig({ outFile, format, mode }) {
4848
vue: 'Vue',
4949
},
5050
exports: 'named',
51-
name: format === 'umd' ? 'vueFunctionApi' : undefined,
51+
name: format === 'umd' ? 'vueCompositionApi' : undefined,
5252
},
5353
external: ['vue'],
5454
plugins: [

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function hasOwn(obj: Object | any[], key: string): boolean {
3434
}
3535

3636
export function assert(condition: any, msg: string) {
37-
if (!condition) throw new Error(`[vue-function-api] ${msg}`);
37+
if (!condition) throw new Error(`[vue-composition-api] ${msg}`);
3838
}
3939

4040
export function isArray<T>(x: unknown): x is T[] {

0 commit comments

Comments
 (0)