nuxt-callapp 4.0.1 → 4.6.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/README.md +76 -5
- package/dist/module.json +3 -3
- package/dist/module.mjs +2 -2
- package/dist/runtime/call-app.d.ts +19 -1
- package/package.json +25 -22
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.6.0 has been tested with Nuxt 4.6.2 and Node.js 26.0.0.
|
|
31
|
+
|
|
32
|
+
- The `@nuxt/kit` dependency requires Node.js `^20.19.0 || >=22.12.0`.
|
|
33
|
+
- Nuxt 4.6.2 requires Node.js `^22.22.3 || ^24.15.0 || >=26.0.0`.
|
|
34
|
+
|
|
35
|
+
Choose a Node.js version supported by both your Nuxt version and `@nuxt/kit`.
|
|
36
|
+
Other Nuxt versions have not been validated for this release.
|
|
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
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addPlugin } from '@nuxt/kit';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
|
|
4
|
-
const module = defineNuxtModule({
|
|
4
|
+
const module$1 = defineNuxtModule({
|
|
5
5
|
meta: {
|
|
6
6
|
name: "nuxt-callapp",
|
|
7
7
|
configKey: "callapp"
|
|
@@ -26,4 +26,4 @@ const module = defineNuxtModule({
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
export { module as default };
|
|
29
|
+
export { module$1 as default };
|
|
@@ -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("#app").Plugin<{
|
|
16
|
+
createCallApp: typeof createCallApp;
|
|
17
|
+
useCallApp: typeof useCallApp;
|
|
18
|
+
}> & import("#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.0
|
|
3
|
+
"version": "4.6.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": "
|
|
37
|
-
"
|
|
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",
|
|
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,34 +50,35 @@
|
|
|
48
50
|
}
|
|
49
51
|
},
|
|
50
52
|
"dependencies": {
|
|
51
|
-
"@nuxt/kit": "^4.
|
|
53
|
+
"@nuxt/kit": "^4.6.2",
|
|
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": "^3.
|
|
63
|
-
"@types/node": "^
|
|
58
|
+
"@commitlint/cli": "^21.2.4",
|
|
59
|
+
"@commitlint/config-conventional": "^21.2.4",
|
|
60
|
+
"@nuxt/devtools": "4.0.0-beta.6",
|
|
61
|
+
"@nuxt/eslint-config": "^1.17.0",
|
|
62
|
+
"@nuxt/module-builder": "^1.0.3",
|
|
63
|
+
"@nuxt/schema": "^4.6.2",
|
|
64
|
+
"@nuxt/test-utils": "^4.3.4",
|
|
65
|
+
"@types/node": "^26.6.5",
|
|
64
66
|
"changelogen": "^0.6.2",
|
|
65
|
-
"commitizen": "^4.3.
|
|
66
|
-
"cz-git": "^1.
|
|
67
|
-
"eslint": "^
|
|
67
|
+
"commitizen": "^4.3.2",
|
|
68
|
+
"cz-git": "^1.14.0",
|
|
69
|
+
"eslint": "^10.13.0",
|
|
68
70
|
"husky": "^9.1.7",
|
|
69
|
-
"
|
|
70
|
-
"nuxt": "^4.
|
|
71
|
-
"
|
|
71
|
+
"nano-staged": "^1.0.2",
|
|
72
|
+
"nuxt": "^4.6.2",
|
|
73
|
+
"typescript": "^5.9.3",
|
|
74
|
+
"vitest": "^5.0.5"
|
|
72
75
|
},
|
|
73
76
|
"husky": {
|
|
74
77
|
"hooks": {
|
|
75
|
-
"pre-commit": "
|
|
78
|
+
"pre-commit": "nano-staged"
|
|
76
79
|
}
|
|
77
80
|
},
|
|
78
|
-
"
|
|
81
|
+
"nano-staged": {
|
|
79
82
|
"*": "eslint . --fix"
|
|
80
83
|
}
|
|
81
|
-
}
|
|
84
|
+
}
|