nuxt-callapp 4.1.1 → 4.7.0
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.
- package/LICENSE +21 -0
- package/README.md +76 -5
- package/dist/module.json +3 -3
- package/dist/runtime/call-app.d.ts +19 -1
- package/package.json +22 -19
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 xjccc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -15,13 +15,25 @@
|
|
|
15
15
|
|
|
16
16
|
A nuxt module for [callapp-lib](https://github.com/suanmei/callapp-lib)
|
|
17
17
|
|
|
18
|
-
- [✨ Release Notes](/CHANGELOG.md)
|
|
18
|
+
- [✨ Release Notes](https://github.com/xjccc/nuxt-callapp/blob/main/CHANGELOG.md)
|
|
19
19
|
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/nuxt-callapp?file=playground%2Fapp.vue) -->
|
|
20
20
|
<!-- - [📖 Documentation](https://example.com) -->
|
|
21
21
|
|
|
22
22
|
## Features
|
|
23
23
|
|
|
24
|
-
-
|
|
24
|
+
- Configure `callapp-lib` through `nuxt.config.ts`.
|
|
25
|
+
- Open an app with `$useCallApp`, or create an independent instance with `$createCallApp`.
|
|
26
|
+
- Client-only plugin with TypeScript declarations for both helpers.
|
|
27
|
+
|
|
28
|
+
## Compatibility
|
|
29
|
+
|
|
30
|
+
Version 4.7.0 has been tested with Nuxt 4.7.0 on Node.js 26.0.0.
|
|
31
|
+
The published 4.6.0 release was tested with Nuxt 4.6.2 on the same Node.js version.
|
|
32
|
+
|
|
33
|
+
- The `@nuxt/kit` dependency requires Node.js `^20.19.0 || >=22.12.0`.
|
|
34
|
+
- Nuxt 4.6.2 and 4.7.0 require Node.js `^22.22.3 || ^24.15.0 || >=26.0.0`.
|
|
35
|
+
|
|
36
|
+
Choose a Node.js version supported by both your Nuxt version and `@nuxt/kit`.
|
|
25
37
|
|
|
26
38
|
## Quick Setup
|
|
27
39
|
|
|
@@ -40,12 +52,12 @@ npm install --save-dev nuxt-callapp
|
|
|
40
52
|
|
|
41
53
|
2. Add `nuxt-callapp` to the `modules` section of `nuxt.config.ts`
|
|
42
54
|
|
|
43
|
-
```
|
|
55
|
+
```ts
|
|
44
56
|
export default defineNuxtConfig({
|
|
45
57
|
modules: [
|
|
46
58
|
'nuxt-callapp'
|
|
47
59
|
],
|
|
48
|
-
|
|
60
|
+
callapp: {
|
|
49
61
|
scheme: {
|
|
50
62
|
protocol: 'zhihu',
|
|
51
63
|
},
|
|
@@ -65,8 +77,67 @@ export default defineNuxtConfig({
|
|
|
65
77
|
})
|
|
66
78
|
```
|
|
67
79
|
|
|
68
|
-
|
|
80
|
+
3. Open an app from a client-side interaction
|
|
81
|
+
|
|
82
|
+
`$useCallApp` uses the `callapp` options from `nuxt.config.ts` and reuses its
|
|
83
|
+
CallApp instance:
|
|
84
|
+
|
|
85
|
+
```vue
|
|
86
|
+
<script setup lang="ts">
|
|
87
|
+
import { useNuxtApp } from '#app'
|
|
88
|
+
|
|
89
|
+
const { $useCallApp } = useNuxtApp()
|
|
90
|
+
|
|
91
|
+
function openApp() {
|
|
92
|
+
$useCallApp({ path: 'question/270839820/answer/477722658' })
|
|
93
|
+
}
|
|
94
|
+
</script>
|
|
95
|
+
|
|
96
|
+
<template>
|
|
97
|
+
<button @click="openApp">Open in Zhihu</button>
|
|
98
|
+
</template>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
To create an independent instance, pass the full options to `$createCallApp`.
|
|
102
|
+
These options are not merged with `nuxt.config.ts`:
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<script setup lang="ts">
|
|
106
|
+
import { useNuxtApp } from '#app'
|
|
107
|
+
|
|
108
|
+
const { $createCallApp } = useNuxtApp()
|
|
109
|
+
|
|
110
|
+
function openApp() {
|
|
111
|
+
const callApp = $createCallApp({
|
|
112
|
+
scheme: { protocol: 'zhihu' },
|
|
113
|
+
appstore: 'https://itunes.apple.com/cn/app/id432274380',
|
|
114
|
+
fallback: 'https://oia.zhihu.com/',
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
callApp.open({ path: 'question/270839820/answer/477722658' })
|
|
118
|
+
}
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<template>
|
|
122
|
+
<button @click="openApp">Open with custom options</button>
|
|
123
|
+
</template>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Both helpers are injected only on the client. Call them from a browser event
|
|
127
|
+
handler or `onMounted`; do not invoke them during server rendering.
|
|
128
|
+
See [callapp-lib](https://github.com/suanmei/callapp-lib) for options and
|
|
129
|
+
platform-specific behavior.
|
|
130
|
+
|
|
131
|
+
## Development and release checks
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pnpm install --frozen-lockfile
|
|
135
|
+
pnpm release:check
|
|
136
|
+
```
|
|
69
137
|
|
|
138
|
+
`release:check` prepares generated types, runs lint, type checking and tests,
|
|
139
|
+
then builds the module and the playground for production. The `release` script
|
|
140
|
+
runs these checks before creating a release commit or tag.
|
|
70
141
|
|
|
71
142
|
<!-- Badges -->
|
|
72
143
|
[npm-version-src]: https://img.shields.io/npm/v/nuxt-callapp/latest.svg?style=flat&colorA=020420&colorB=00DC82
|
package/dist/module.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import CallApp from 'callapp-lib';
|
|
2
2
|
import type { CallappConfig, CallappOptions } from 'callapp-lib/dist/type/types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* create CallApp instance
|
|
5
|
+
* @param options
|
|
6
|
+
* @returns instance
|
|
7
|
+
*/
|
|
8
|
+
declare function createCallApp(options: CallappOptions): CallApp;
|
|
9
|
+
/**
|
|
10
|
+
* callapp function
|
|
11
|
+
* @param config
|
|
12
|
+
* @param callback
|
|
13
|
+
*/
|
|
14
|
+
declare function useCallApp(config: CallappConfig, callback?: (instance: CallApp) => void): void;
|
|
15
|
+
declare const _default: import("nuxt/app").Plugin<{
|
|
16
|
+
createCallApp: typeof createCallApp;
|
|
17
|
+
useCallApp: typeof useCallApp;
|
|
18
|
+
}> & import("nuxt/app").ObjectPlugin<{
|
|
19
|
+
createCallApp: typeof createCallApp;
|
|
20
|
+
useCallApp: typeof useCallApp;
|
|
21
|
+
}>;
|
|
4
22
|
export default _default;
|
|
5
23
|
declare module '#app' {
|
|
6
24
|
interface NuxtApp {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-callapp",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "A Nuxt module for callapp-lib",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "xjccc",
|
|
@@ -33,10 +33,12 @@
|
|
|
33
33
|
"dev": "nuxi dev playground",
|
|
34
34
|
"dev:build": "nuxi build playground",
|
|
35
35
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
36
|
-
"release": "
|
|
36
|
+
"release:check": "npm run dev:prepare && npm run lint && npm run typecheck && npm run test && npm run prepack && npm run dev:build",
|
|
37
|
+
"release": "npm run release:check && changelogen --release && npm publish && git push --follow-tags",
|
|
37
38
|
"echo:husky": "echo 'npx nano-staged' > .husky/pre-commit && echo 'npx --no-install commitlint --edit \"$1\"' > .husky/commit-msg",
|
|
38
39
|
"lint": "eslint .",
|
|
39
40
|
"lint:fix": "eslint . --fix",
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
40
42
|
"prepare": "husky",
|
|
41
43
|
"commit": "git-cz",
|
|
42
44
|
"test": "vitest run",
|
|
@@ -48,27 +50,28 @@
|
|
|
48
50
|
}
|
|
49
51
|
},
|
|
50
52
|
"dependencies": {
|
|
51
|
-
"@nuxt/kit": "^4.
|
|
53
|
+
"@nuxt/kit": "^4.7.0",
|
|
52
54
|
"callapp-lib": "^3.5.3",
|
|
53
|
-
"defu": "^6.1.
|
|
55
|
+
"defu": "^6.1.7"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
56
|
-
"@commitlint/cli": "^
|
|
57
|
-
"@commitlint/config-conventional": "^
|
|
58
|
-
"@nuxt/devtools": "^
|
|
59
|
-
"@nuxt/eslint-config": "^1.
|
|
60
|
-
"@nuxt/module-builder": "^1.0.
|
|
61
|
-
"@nuxt/schema": "^4.
|
|
62
|
-
"@nuxt/test-utils": "^4.
|
|
63
|
-
"@types/node": "^
|
|
58
|
+
"@commitlint/cli": "^21.2.4",
|
|
59
|
+
"@commitlint/config-conventional": "^21.2.4",
|
|
60
|
+
"@nuxt/devtools": "^4.2.1",
|
|
61
|
+
"@nuxt/eslint-config": "^1.17.0",
|
|
62
|
+
"@nuxt/module-builder": "^1.0.4",
|
|
63
|
+
"@nuxt/schema": "^4.7.0",
|
|
64
|
+
"@nuxt/test-utils": "^4.4.0",
|
|
65
|
+
"@types/node": "^26.6.5",
|
|
64
66
|
"changelogen": "^0.6.2",
|
|
65
|
-
"commitizen": "^4.3.
|
|
66
|
-
"cz-git": "^1.
|
|
67
|
-
"eslint": "^10.0
|
|
67
|
+
"commitizen": "^4.3.2",
|
|
68
|
+
"cz-git": "^1.14.0",
|
|
69
|
+
"eslint": "^10.13.0",
|
|
68
70
|
"husky": "^9.1.7",
|
|
69
|
-
"nano-staged": "^0.
|
|
70
|
-
"nuxt": "^4.
|
|
71
|
-
"
|
|
71
|
+
"nano-staged": "^1.0.2",
|
|
72
|
+
"nuxt": "^4.7.0",
|
|
73
|
+
"typescript": "^5.9.3",
|
|
74
|
+
"vitest": "^5.1.1"
|
|
72
75
|
},
|
|
73
76
|
"husky": {
|
|
74
77
|
"hooks": {
|
|
@@ -78,4 +81,4 @@
|
|
|
78
81
|
"nano-staged": {
|
|
79
82
|
"*": "eslint . --fix"
|
|
80
83
|
}
|
|
81
|
-
}
|
|
84
|
+
}
|