@vuepress/client 2.0.0-beta.9 → 2.0.0-rc.1
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 +1 -1
- package/README.md +12 -0
- package/dist/app.d.ts +7 -0
- package/dist/app.js +353 -0
- package/dist/chunk-PEQEPZ75.js +339 -0
- package/dist/createVueAppFunction-YNGNKfE3.d.ts +9 -0
- package/dist/index.d.ts +283 -0
- package/dist/index.js +64 -0
- package/dist/setupDevtools-X4YFRK4B.js +89 -0
- package/package.json +52 -17
- package/templates/build.html +16 -0
- package/templates/{index.dev.html → dev.html} +2 -0
- package/types.d.ts +6 -3
- package/CHANGELOG.md +0 -229
- package/lib/app.d.ts +0 -18
- package/lib/app.js +0 -139
- package/lib/client.d.ts +0 -1
- package/lib/client.js +0 -14
- package/lib/components/Content.d.ts +0 -7
- package/lib/components/Content.js +0 -34
- package/lib/components/OutboundLink.css +0 -7
- package/lib/components/OutboundLink.d.ts +0 -3
- package/lib/components/OutboundLink.js +0 -24
- package/lib/components/Vuepress.d.ts +0 -5
- package/lib/components/Vuepress.js +0 -33
- package/lib/components/index.d.ts +0 -3
- package/lib/components/index.js +0 -3
- package/lib/index.d.ts +0 -7
- package/lib/index.js +0 -5
- package/lib/injections/index.d.ts +0 -10
- package/lib/injections/index.js +0 -10
- package/lib/injections/pageData.d.ts +0 -7
- package/lib/injections/pageData.js +0 -32
- package/lib/injections/pageFrontmatter.d.ts +0 -7
- package/lib/injections/pageFrontmatter.js +0 -10
- package/lib/injections/pageHead.d.ts +0 -15
- package/lib/injections/pageHead.js +0 -33
- package/lib/injections/pageHeadTitle.d.ts +0 -11
- package/lib/injections/pageHeadTitle.js +0 -13
- package/lib/injections/pageLang.d.ts +0 -13
- package/lib/injections/pageLang.js +0 -16
- package/lib/injections/pagesData.d.ts +0 -6
- package/lib/injections/pagesData.js +0 -6
- package/lib/injections/routeLocale.d.ts +0 -10
- package/lib/injections/routeLocale.js +0 -14
- package/lib/injections/siteData.d.ts +0 -6
- package/lib/injections/siteData.js +0 -10
- package/lib/injections/siteLocaleData.d.ts +0 -12
- package/lib/injections/siteLocaleData.js +0 -17
- package/lib/injections/updateHead.d.ts +0 -15
- package/lib/injections/updateHead.js +0 -100
- package/lib/server.d.ts +0 -8
- package/lib/server.js +0 -10
- package/lib/types/clientAppEnhance.d.ts +0 -8
- package/lib/types/clientAppEnhance.js +0 -1
- package/lib/types/clientAppSetup.d.ts +0 -1
- package/lib/types/clientAppSetup.js +0 -1
- package/lib/types/index.d.ts +0 -7
- package/lib/types/index.js +0 -2
- package/lib/types/internal/clientAppEnhances.d.ts +0 -5
- package/lib/types/internal/clientAppRootComponents.d.ts +0 -5
- package/lib/types/internal/clientAppSetups.d.ts +0 -5
- package/lib/types/internal/layoutComponents.d.ts +0 -5
- package/lib/types/internal/pagesComponent.d.ts +0 -5
- package/lib/types/internal/pagesData.d.ts +0 -5
- package/lib/types/internal/pagesRoutes.d.ts +0 -5
- package/lib/types/internal/siteData.d.ts +0 -5
- package/lib/utils/defineClientAppEnhance.d.ts +0 -2
- package/lib/utils/defineClientAppEnhance.js +0 -1
- package/lib/utils/defineClientAppSetup.d.ts +0 -2
- package/lib/utils/defineClientAppSetup.js +0 -1
- package/lib/utils/index.d.ts +0 -3
- package/lib/utils/index.js +0 -3
- package/lib/utils/withBase.d.ts +0 -4
- package/lib/utils/withBase.js +0 -11
- package/templates/index.ssr.html +0 -12
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// src/setupDevtools.ts
|
|
2
|
+
import { setupDevtoolsPlugin } from "@vue/devtools-api";
|
|
3
|
+
import { watch } from "vue";
|
|
4
|
+
var PLUGIN_ID = "org.vuejs.vuepress";
|
|
5
|
+
var PLUGIN_LABEL = "VuePress";
|
|
6
|
+
var PLUGIN_COMPONENT_STATE_TYPE = PLUGIN_LABEL;
|
|
7
|
+
var INSPECTOR_ID = PLUGIN_ID;
|
|
8
|
+
var INSPECTOR_LABEL = PLUGIN_LABEL;
|
|
9
|
+
var INSPECTOR_GLOBAL_COMPUTED_ID = "global-computed";
|
|
10
|
+
var INSPECTOR_GLOBAL_COMPUTED_LABEL = "Global Computed";
|
|
11
|
+
var setupDevtools = (app, globalComputed) => {
|
|
12
|
+
setupDevtoolsPlugin(
|
|
13
|
+
{
|
|
14
|
+
// fix recursive reference
|
|
15
|
+
app,
|
|
16
|
+
id: PLUGIN_ID,
|
|
17
|
+
label: PLUGIN_LABEL,
|
|
18
|
+
packageName: "@vuepress/client",
|
|
19
|
+
homepage: "https://v2.vuepress.vuejs.org",
|
|
20
|
+
logo: "https://v2.vuepress.vuejs.org/images/hero.png",
|
|
21
|
+
componentStateTypes: [PLUGIN_COMPONENT_STATE_TYPE]
|
|
22
|
+
},
|
|
23
|
+
(api) => {
|
|
24
|
+
const globalComputedEntries = Object.entries(globalComputed);
|
|
25
|
+
const globalComputedKeys = Object.keys(globalComputed);
|
|
26
|
+
const globalComputedValues = Object.values(globalComputed);
|
|
27
|
+
api.on.inspectComponent((payload) => {
|
|
28
|
+
payload.instanceData.state.push(
|
|
29
|
+
...globalComputedEntries.map(([name, item]) => ({
|
|
30
|
+
type: PLUGIN_COMPONENT_STATE_TYPE,
|
|
31
|
+
editable: false,
|
|
32
|
+
key: name,
|
|
33
|
+
value: item.value
|
|
34
|
+
}))
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
api.addInspector({
|
|
38
|
+
id: INSPECTOR_ID,
|
|
39
|
+
label: INSPECTOR_LABEL,
|
|
40
|
+
icon: "article"
|
|
41
|
+
});
|
|
42
|
+
api.on.getInspectorTree((payload) => {
|
|
43
|
+
if (payload.inspectorId !== INSPECTOR_ID)
|
|
44
|
+
return;
|
|
45
|
+
payload.rootNodes = [
|
|
46
|
+
{
|
|
47
|
+
id: INSPECTOR_GLOBAL_COMPUTED_ID,
|
|
48
|
+
label: INSPECTOR_GLOBAL_COMPUTED_LABEL,
|
|
49
|
+
children: globalComputedKeys.map((name) => ({
|
|
50
|
+
id: name,
|
|
51
|
+
label: name
|
|
52
|
+
}))
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
});
|
|
56
|
+
api.on.getInspectorState((payload) => {
|
|
57
|
+
if (payload.inspectorId !== INSPECTOR_ID)
|
|
58
|
+
return;
|
|
59
|
+
if (payload.nodeId === INSPECTOR_GLOBAL_COMPUTED_ID) {
|
|
60
|
+
payload.state = {
|
|
61
|
+
[INSPECTOR_GLOBAL_COMPUTED_LABEL]: globalComputedEntries.map(
|
|
62
|
+
([name, item]) => ({
|
|
63
|
+
key: name,
|
|
64
|
+
value: item.value
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (globalComputedKeys.includes(payload.nodeId)) {
|
|
70
|
+
payload.state = {
|
|
71
|
+
[INSPECTOR_GLOBAL_COMPUTED_LABEL]: [
|
|
72
|
+
{
|
|
73
|
+
key: payload.nodeId,
|
|
74
|
+
value: globalComputed[payload.nodeId].value
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
watch(globalComputedValues, () => {
|
|
81
|
+
api.notifyComponentUpdate();
|
|
82
|
+
api.sendInspectorState(INSPECTOR_ID);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
setupDevtools
|
|
89
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/client",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-rc.1",
|
|
4
4
|
"description": "Client package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -8,33 +8,68 @@
|
|
|
8
8
|
],
|
|
9
9
|
"homepage": "https://github.com/vuepress",
|
|
10
10
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/vuepress/
|
|
11
|
+
"url": "https://github.com/vuepress/core/issues"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
|
-
"url": "git+https://github.com/vuepress/
|
|
15
|
+
"url": "git+https://github.com/vuepress/core.git"
|
|
16
16
|
},
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"author": "
|
|
19
|
-
"
|
|
20
|
-
"
|
|
18
|
+
"author": "meteorlxy",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": "./dist/index.js",
|
|
22
|
+
"./app": "./dist/app.js",
|
|
23
|
+
"./package.json": "./package.json",
|
|
24
|
+
"./templates/*": "./templates/*",
|
|
25
|
+
"./types": "./types.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"module": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
21
30
|
"files": [
|
|
22
|
-
"
|
|
31
|
+
"dist",
|
|
23
32
|
"templates",
|
|
24
33
|
"types.d.ts"
|
|
25
34
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "tsc -b tsconfig.build.json",
|
|
28
|
-
"clean": "rimraf lib *.tsbuildinfo",
|
|
29
|
-
"copy": "cpx \"src/**/*.{d.ts,css}\" lib"
|
|
30
|
-
},
|
|
31
35
|
"dependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"
|
|
34
|
-
"vue
|
|
36
|
+
"@vue/devtools-api": "^6.5.1",
|
|
37
|
+
"@vueuse/core": "^10.7.2",
|
|
38
|
+
"vue": "^3.4.15",
|
|
39
|
+
"vue-router": "^4.2.5",
|
|
40
|
+
"@vuepress/shared": "2.0.0-rc.1"
|
|
35
41
|
},
|
|
36
42
|
"publishConfig": {
|
|
37
43
|
"access": "public"
|
|
38
44
|
},
|
|
39
|
-
"
|
|
40
|
-
|
|
45
|
+
"tsup": {
|
|
46
|
+
"clean": true,
|
|
47
|
+
"dts": [
|
|
48
|
+
"./src/app.ts",
|
|
49
|
+
"./src/index.ts"
|
|
50
|
+
],
|
|
51
|
+
"entry": [
|
|
52
|
+
"./src/app.ts",
|
|
53
|
+
"./src/index.ts"
|
|
54
|
+
],
|
|
55
|
+
"external": [
|
|
56
|
+
"@internal/clientConfigs",
|
|
57
|
+
"@internal/layoutComponents",
|
|
58
|
+
"@internal/pagesComponents",
|
|
59
|
+
"@internal/pagesData",
|
|
60
|
+
"@internal/pagesRoutes",
|
|
61
|
+
"@internal/siteData"
|
|
62
|
+
],
|
|
63
|
+
"format": [
|
|
64
|
+
"esm"
|
|
65
|
+
],
|
|
66
|
+
"outDir": "./dist",
|
|
67
|
+
"sourcemap": false,
|
|
68
|
+
"target": "es2022",
|
|
69
|
+
"tsconfig": "./tsconfig.dts.json"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "tsup",
|
|
73
|
+
"clean": "rimraf dist"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="{{ lang }}">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<meta name="generator" content="VuePress {{ version }}">
|
|
7
|
+
<!--vuepress-ssr-head-->
|
|
8
|
+
<!--vuepress-ssr-styles-->
|
|
9
|
+
<!--vuepress-ssr-preload-->
|
|
10
|
+
<!--vuepress-ssr-prefetch-->
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div id="app"><!--vuepress-ssr-content--></div>
|
|
14
|
+
<!--vuepress-ssr-scripts-->
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
package/types.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
declare const
|
|
3
|
-
declare const
|
|
1
|
+
declare const __VUEPRESS_VERSION__: string
|
|
2
|
+
declare const __VUEPRESS_BASE__: string
|
|
3
|
+
declare const __VUEPRESS_DEV__: boolean
|
|
4
|
+
declare const __VUEPRESS_SSR__: boolean
|
|
4
5
|
declare const __VUE_HMR_RUNTIME__: Record<string, any>
|
|
6
|
+
declare const __VUE_OPTIONS_API__: boolean
|
|
7
|
+
declare const __VUE_PROD_DEVTOOLS__: boolean
|
package/CHANGELOG.md
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [2.0.0-beta.9](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.8...v2.0.0-beta.9) (2021-04-21)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* **client:** provide client types file ([89a32b5](https://github.com/vuepress/vuepress-next/commit/89a32b50767ef82556f5ae3300ec016e0acaf0e5))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# [2.0.0-beta.8](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.7...v2.0.0-beta.8) (2021-04-11)
|
|
18
|
-
|
|
19
|
-
**Note:** Version bump only for package @vuepress/client
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
# [2.0.0-beta.7](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.6...v2.0.0-beta.7) (2021-04-09)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
### Bug Fixes
|
|
29
|
-
|
|
30
|
-
* **client:** install vue-router after clientAppEnhance (close [#100](https://github.com/vuepress/vuepress-next/issues/100)) ([2f5450f](https://github.com/vuepress/vuepress-next/commit/2f5450f0b8dcc4aa49b1c19a1adea6e84a1594c4))
|
|
31
|
-
* **client:** make page data hmr work as expected ([374ae43](https://github.com/vuepress/vuepress-next/commit/374ae43545c982ecc8762776035cc92359b874f5))
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
# [2.0.0-beta.6](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.5...v2.0.0-beta.6) (2021-03-26)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
### Reverts
|
|
41
|
-
|
|
42
|
-
* refactor(client): remove extra handling for router base ([6205279](https://github.com/vuepress/vuepress-next/commit/620527917e4d3ee7cfa4c1db7d3cadc36a30eaab))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
# [2.0.0-beta.5](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.4...v2.0.0-beta.5) (2021-03-26)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### Bug Fixes
|
|
52
|
-
|
|
53
|
-
* **client:** ensure page component is loaded before route resolve ([598adf3](https://github.com/vuepress/vuepress-next/commit/598adf38b1f9edd3034bb011358a1a9d3bcb6b9e))
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
### Performance Improvements
|
|
57
|
-
|
|
58
|
-
* improve HMR support ([38f0073](https://github.com/vuepress/vuepress-next/commit/38f007335864db4c9125ea5905ca91850fb7103b))
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# [2.0.0-beta.4](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.3...v2.0.0-beta.4) (2021-03-20)
|
|
65
|
-
|
|
66
|
-
**Note:** Version bump only for package @vuepress/client
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
# [2.0.0-beta.1](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.0...v2.0.0-beta.1) (2021-03-13)
|
|
73
|
-
|
|
74
|
-
**Note:** Version bump only for package @vuepress/client
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
# [2.0.0-beta.0](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.26...v2.0.0-beta.0) (2021-03-13)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
### Features
|
|
84
|
-
|
|
85
|
-
* implement vite hmr ([525c18d](https://github.com/vuepress/vuepress-next/commit/525c18d5a64fbdbdeb5ce1348ec1e1ead3dbd8f9))
|
|
86
|
-
* **client:** add defineClientAppEnhance and defineClientAppSetup utils ([1520517](https://github.com/vuepress/vuepress-next/commit/15205172c3b56fc8a879bba040f4ecc815d2c924))
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
# [2.0.0-alpha.25](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.24...v2.0.0-alpha.25) (2021-02-20)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
### Code Refactoring
|
|
96
|
-
|
|
97
|
-
* **core:** remove theme data from site data ([187aef3](https://github.com/vuepress/vuepress-next/commit/187aef36607efc62d7b2d5c773553f89685cf64c))
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### BREAKING CHANGES
|
|
101
|
-
|
|
102
|
-
* **core:** `themeConfig` is not available in site data any more
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
# [2.0.0-alpha.24](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2021-02-13)
|
|
109
|
-
|
|
110
|
-
**Note:** Version bump only for package @vuepress/client
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
# [2.0.0-alpha.22](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.21...v2.0.0-alpha.22) (2021-02-10)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### Bug Fixes
|
|
120
|
-
|
|
121
|
-
* **client:** only watch route path to update head ([3174f5a](https://github.com/vuepress/vuepress-next/commit/3174f5a676d95943df256b2be31227eb844d0144))
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
# [2.0.0-alpha.20](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.19...v2.0.0-alpha.20) (2021-02-04)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
### Features
|
|
131
|
-
|
|
132
|
-
* **core:** make language available in page data ([03bb09f](https://github.com/vuepress/vuepress-next/commit/03bb09fd51aeaff56d26820a1401b87ea8bdeb38))
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
# [2.0.0-alpha.19](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.18...v2.0.0-alpha.19) (2021-01-24)
|
|
139
|
-
|
|
140
|
-
**Note:** Version bump only for package @vuepress/client
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
# [2.0.0-alpha.18](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.17...v2.0.0-alpha.18) (2021-01-17)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
### Bug Fixes
|
|
150
|
-
|
|
151
|
-
* **client:** load existing head tags on mounted ([15722c5](https://github.com/vuepress/vuepress-next/commit/15722c5175e44a8d6363bfe5f138f2c2c8edeec3))
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
### Features
|
|
155
|
-
|
|
156
|
-
* **client:** make usePageFrontmatter generic ([2c5e5c1](https://github.com/vuepress/vuepress-next/commit/2c5e5c1400469a3cb4da2856104514a9413bff8a))
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
# [2.0.0-alpha.16](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.15...v2.0.0-alpha.16) (2021-01-11)
|
|
163
|
-
|
|
164
|
-
**Note:** Version bump only for package @vuepress/client
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
# [2.0.0-alpha.15](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.14...v2.0.0-alpha.15) (2021-01-04)
|
|
171
|
-
|
|
172
|
-
**Note:** Version bump only for package @vuepress/client
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
# [2.0.0-alpha.13](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.12...v2.0.0-alpha.13) (2020-12-23)
|
|
179
|
-
|
|
180
|
-
**Note:** Version bump only for package @vuepress/client
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
# [2.0.0-alpha.7](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.6...v2.0.0-alpha.7) (2020-12-09)
|
|
187
|
-
|
|
188
|
-
**Note:** Version bump only for package @vuepress/client
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
# [2.0.0-alpha.6](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2020-12-09)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
### Features
|
|
198
|
-
|
|
199
|
-
* **client:** remove built-in debug component ([a5962bb](https://github.com/vuepress/vuepress-next/commit/a5962bb82483f56800b33b4e35c50dcb49fd48b1))
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
# 2.0.0-alpha.1 (2020-12-01)
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
### Bug Fixes
|
|
209
|
-
|
|
210
|
-
* **client:** do not prepend base to http url ([9e4e623](https://github.com/vuepress/vuepress-next/commit/9e4e6233ce988bf3b6ebbbb1bc60f83a26f6709c))
|
|
211
|
-
* **client:** wrap ssr-app with a parent div ([c65b6c4](https://github.com/vuepress/vuepress-next/commit/c65b6c47f084466dde9daf17d1c1d00b88f6682d))
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
### Features
|
|
215
|
-
|
|
216
|
-
* **client:** add built-in styles for Debug component ([1b3b028](https://github.com/vuepress/vuepress-next/commit/1b3b028e0cd078eb6f074c36696255df1cf49267))
|
|
217
|
-
* **client:** add ClientOnly component ([e2cad36](https://github.com/vuepress/vuepress-next/commit/e2cad36c5f859240e5fac62c38fbaa14b39defab))
|
|
218
|
-
* **client:** add global computed and updateHead ([df83b88](https://github.com/vuepress/vuepress-next/commit/df83b887a69db9290a22d0731056f4ac2b6f0014))
|
|
219
|
-
* **client:** add global data utils ([46b9fc5](https://github.com/vuepress/vuepress-next/commit/46b9fc579f51c1f037f4850f8699074805799884))
|
|
220
|
-
* **client:** add OutboundLink component ([4107add](https://github.com/vuepress/vuepress-next/commit/4107add516e7acd0cbdc4a526bf4772c54fb6108))
|
|
221
|
-
* **client:** add siteLocale in debug component ([e1d663b](https://github.com/vuepress/vuepress-next/commit/e1d663b4ece27012c72383f5eecb90c5fb2195ef))
|
|
222
|
-
* **client:** add themeData injections ([04cafe2](https://github.com/vuepress/vuepress-next/commit/04cafe23ec835d9efc9a2b1ab8be8b7d8f0a22b4))
|
|
223
|
-
* **client:** add withBase util ([f234c5d](https://github.com/vuepress/vuepress-next/commit/f234c5d74f148b55b265d13dc2c868d8531d192a))
|
|
224
|
-
* **client:** augment route meta type ([6f4e1f5](https://github.com/vuepress/vuepress-next/commit/6f4e1f5995351a0dd6ebf257e1889d26e77d26e4))
|
|
225
|
-
* **client:** make siteData injections generic ([86b9416](https://github.com/vuepress/vuepress-next/commit/86b941646b7554b404a621a3616a7a81958c12c3))
|
|
226
|
-
* **client:** provide site locale data ([00455bd](https://github.com/vuepress/vuepress-next/commit/00455bdf21736254c8a3a488cdf8245e80742398))
|
|
227
|
-
* **client:** set scrollBehavior for vue-router ([f7a12ce](https://github.com/vuepress/vuepress-next/commit/f7a12ceaa1e20ba2e87fa34c692a754fcc3f34f4))
|
|
228
|
-
* **client:** support clientAppRootComponentFiles ([188c1a0](https://github.com/vuepress/vuepress-next/commit/188c1a04fed8ed6614b45a6a0c1cb3d07a4ca112))
|
|
229
|
-
* **client:** take 404 as the fallback layout ([bb34903](https://github.com/vuepress/vuepress-next/commit/bb349038da090d0e5fd9069ff5cfa3372c95dc0b))
|
package/lib/app.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { CreateAppFunction, App } from 'vue';
|
|
2
|
-
import type { Router, RouterHistory } from 'vue-router';
|
|
3
|
-
export declare type AppCreator = CreateAppFunction<Element>;
|
|
4
|
-
export declare type HistoryCreator = (base?: string) => RouterHistory;
|
|
5
|
-
export declare type CreateVueAppResult = {
|
|
6
|
-
app: App;
|
|
7
|
-
router: Router;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Create a vue app
|
|
11
|
-
*
|
|
12
|
-
* Accepting different app creator and history creator, so it
|
|
13
|
-
* can be reused for both client side and server side
|
|
14
|
-
*/
|
|
15
|
-
export declare const createVueApp: ({ appCreator, historyCreator, }: {
|
|
16
|
-
appCreator: AppCreator;
|
|
17
|
-
historyCreator: HistoryCreator;
|
|
18
|
-
}) => Promise<CreateVueAppResult>;
|
package/lib/app.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { computed, h } from 'vue';
|
|
2
|
-
import { createRouter, RouterView, START_LOCATION } from 'vue-router';
|
|
3
|
-
import { removeEndingSlash } from '@vuepress/shared';
|
|
4
|
-
import { clientAppEnhances } from '@internal/clientAppEnhances';
|
|
5
|
-
import { clientAppRootComponents } from '@internal/clientAppRootComponents';
|
|
6
|
-
import { clientAppSetups } from '@internal/clientAppSetups';
|
|
7
|
-
import { pagesComponent } from '@internal/pagesComponent';
|
|
8
|
-
import { pagesRoutes } from '@internal/pagesRoutes';
|
|
9
|
-
import { siteData, pageData, resolvePageData, pageFrontmatterSymbol, resolvePageFrontmatter, pageHeadSymbol, resolvePageHead, pageHeadTitleSymbol, resolvePageHeadTitle, pageLangSymbol, resolvePageLang, routeLocaleSymbol, resolveRouteLocale, siteLocaleDataSymbol, resolveSiteLocaleData, useUpdateHead, } from './injections';
|
|
10
|
-
import { Content, OutboundLink } from './components';
|
|
11
|
-
import { withBase } from './utils';
|
|
12
|
-
/**
|
|
13
|
-
* Create a vue app
|
|
14
|
-
*
|
|
15
|
-
* Accepting different app creator and history creator, so it
|
|
16
|
-
* can be reused for both client side and server side
|
|
17
|
-
*/
|
|
18
|
-
export const createVueApp = async ({ appCreator, historyCreator, }) => {
|
|
19
|
-
// options to create vue app
|
|
20
|
-
const appOptions = {
|
|
21
|
-
setup() {
|
|
22
|
-
// auto update head
|
|
23
|
-
useUpdateHead();
|
|
24
|
-
// invoke all clientAppSetups
|
|
25
|
-
for (const clientAppSetup of clientAppSetups) {
|
|
26
|
-
clientAppSetup();
|
|
27
|
-
}
|
|
28
|
-
return () => [
|
|
29
|
-
h(RouterView),
|
|
30
|
-
...clientAppRootComponents.map((comp) => h(comp)),
|
|
31
|
-
];
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
// create vue app
|
|
35
|
-
const app = appCreator(appOptions);
|
|
36
|
-
// create vue-router
|
|
37
|
-
const router = createRouter({
|
|
38
|
-
// TODO: it might be an issue of vue-router that have to remove the ending slash
|
|
39
|
-
history: historyCreator(removeEndingSlash(siteData.value.base)),
|
|
40
|
-
routes: pagesRoutes,
|
|
41
|
-
scrollBehavior: (to, from, savedPosition) => {
|
|
42
|
-
if (savedPosition) {
|
|
43
|
-
return savedPosition;
|
|
44
|
-
}
|
|
45
|
-
if (to.hash) {
|
|
46
|
-
return { el: to.hash };
|
|
47
|
-
}
|
|
48
|
-
return { top: 0 };
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
router.beforeResolve(async (to, from) => {
|
|
52
|
-
var _a;
|
|
53
|
-
if (to.path !== from.path || from === START_LOCATION) {
|
|
54
|
-
// ensure page data and page component have been loaded
|
|
55
|
-
;
|
|
56
|
-
[pageData.value] = await Promise.all([
|
|
57
|
-
resolvePageData(to.path),
|
|
58
|
-
(_a = pagesComponent[to.path]) === null || _a === void 0 ? void 0 : _a.__asyncLoader(),
|
|
59
|
-
]);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
// create global computed
|
|
63
|
-
const routeLocale = computed(() => resolveRouteLocale(siteData.value.locales, router.currentRoute.value.path));
|
|
64
|
-
const siteLocaleData = computed(() => resolveSiteLocaleData(siteData.value, routeLocale.value));
|
|
65
|
-
const pageFrontmatter = computed(() => resolvePageFrontmatter(pageData.value));
|
|
66
|
-
const pageHeadTitle = computed(() => resolvePageHeadTitle(pageData.value, siteLocaleData.value));
|
|
67
|
-
const pageHead = computed(() => resolvePageHead(pageHeadTitle.value, pageFrontmatter.value, siteLocaleData.value));
|
|
68
|
-
const pageLang = computed(() => resolvePageLang(pageData.value));
|
|
69
|
-
// provide global computed
|
|
70
|
-
app.provide(routeLocaleSymbol, routeLocale);
|
|
71
|
-
app.provide(siteLocaleDataSymbol, siteLocaleData);
|
|
72
|
-
app.provide(pageFrontmatterSymbol, pageFrontmatter);
|
|
73
|
-
app.provide(pageHeadTitleSymbol, pageHeadTitle);
|
|
74
|
-
app.provide(pageHeadSymbol, pageHead);
|
|
75
|
-
app.provide(pageLangSymbol, pageLang);
|
|
76
|
-
// provide global data & helpers
|
|
77
|
-
Object.defineProperties(app.config.globalProperties, {
|
|
78
|
-
$routeLocale: {
|
|
79
|
-
get() {
|
|
80
|
-
return routeLocale.value;
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
$site: {
|
|
84
|
-
get() {
|
|
85
|
-
return siteData.value;
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
$siteLocale: {
|
|
89
|
-
get() {
|
|
90
|
-
return siteLocaleData.value;
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
$page: {
|
|
94
|
-
get() {
|
|
95
|
-
return pageData.value;
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
$frontmatter: {
|
|
99
|
-
get() {
|
|
100
|
-
return pageFrontmatter.value;
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
$lang: {
|
|
104
|
-
get() {
|
|
105
|
-
return pageLang.value;
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
$headTitle: {
|
|
109
|
-
get() {
|
|
110
|
-
return pageHeadTitle.value;
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
$withBase: {
|
|
114
|
-
get() {
|
|
115
|
-
return withBase;
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
// register built-in components
|
|
120
|
-
/* eslint-disable vue/match-component-file-name */
|
|
121
|
-
app.component('ClientOnly', __SSR__ ? () => null : (_, ctx) => { var _a, _b; return (_b = (_a = ctx.slots).default) === null || _b === void 0 ? void 0 : _b.call(_a); });
|
|
122
|
-
app.component('Content', Content);
|
|
123
|
-
app.component('OutboundLink', OutboundLink);
|
|
124
|
-
/* eslint-enable vue/match-component-file-name */
|
|
125
|
-
// invoke all clientAppEnhances
|
|
126
|
-
for (const clientAppEnhance of clientAppEnhances) {
|
|
127
|
-
await clientAppEnhance({ app, router, siteData });
|
|
128
|
-
}
|
|
129
|
-
// vue-router will start to initialize once it is installed
|
|
130
|
-
// via `app.use()`, but users might make some modifications
|
|
131
|
-
// to router in `clientAppEnhance`, so we install it after
|
|
132
|
-
// that. This can also avoid the `scrollBehavior` issue on
|
|
133
|
-
// initial navigation.
|
|
134
|
-
app.use(router);
|
|
135
|
-
return {
|
|
136
|
-
app,
|
|
137
|
-
router,
|
|
138
|
-
};
|
|
139
|
-
};
|
package/lib/client.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/client.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createApp } from 'vue';
|
|
2
|
-
import { createWebHistory } from 'vue-router';
|
|
3
|
-
import { createVueApp } from './app';
|
|
4
|
-
/**
|
|
5
|
-
* Client entry point
|
|
6
|
-
*/
|
|
7
|
-
createVueApp({
|
|
8
|
-
appCreator: createApp,
|
|
9
|
-
historyCreator: createWebHistory,
|
|
10
|
-
}).then(({ app, router }) => {
|
|
11
|
-
router.isReady().then(() => {
|
|
12
|
-
app.mount('#app');
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { h } from 'vue';
|
|
2
|
-
import { pagesComponent } from '@internal/pagesComponent';
|
|
3
|
-
import { usePageData } from '../injections';
|
|
4
|
-
/**
|
|
5
|
-
* Markdown rendered content
|
|
6
|
-
*/
|
|
7
|
-
export const Content = (props) => {
|
|
8
|
-
let key;
|
|
9
|
-
// use the page key from props directly
|
|
10
|
-
if (props.pagePath) {
|
|
11
|
-
key = props.pagePath;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
// get current page key from page data
|
|
15
|
-
const page = usePageData();
|
|
16
|
-
key = page.value.path;
|
|
17
|
-
}
|
|
18
|
-
const component = pagesComponent[key];
|
|
19
|
-
// use page component
|
|
20
|
-
if (component) {
|
|
21
|
-
return h(component);
|
|
22
|
-
}
|
|
23
|
-
// fallback
|
|
24
|
-
return h('div', __DEV__
|
|
25
|
-
? 'Page does not exist. This is a fallback content.'
|
|
26
|
-
: '404 Not Found');
|
|
27
|
-
};
|
|
28
|
-
Content.displayName = 'Content';
|
|
29
|
-
Content.props = {
|
|
30
|
-
pagePath: {
|
|
31
|
-
type: String,
|
|
32
|
-
required: false,
|
|
33
|
-
},
|
|
34
|
-
};
|