Skip to content

Commit 8607e2d

Browse files
committed
Merge branch 'main' into markdown-links
2 parents eabcadb + 9003521 commit 8607e2d

File tree

9 files changed

+299
-216
lines changed

9 files changed

+299
-216
lines changed

.github/workflows/check.yml

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
- name: Build
3838
run: pnpm build
3939

40+
- name: Check Types
41+
run: pnpm check-types
42+
4043
- name: Lint
4144
run: pnpm lint
4245

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
"type": "module",
66
"scripts": {
77
"build": "pnpm -r --workspace-concurrency=1 --stream build",
8+
"check-types": "vue-tsc --noEmit",
89
"clean": "pnpm --parallel --stream clean",
910
"format": "prettier --write .",
1011
"lint": "eslint --ext .cjs,.js,.ts,.vue . && prettier --check .",
1112
"lint:fix": "eslint --fix --ext .cjs,.js,.ts,.vue . && prettier --write .",
1213
"prepare": "husky",
1314
"release": "pnpm release:check && pnpm release:version && pnpm release:publish",
1415
"release:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
15-
"release:check": "pnpm lint && pnpm clean && pnpm build && pnpm test",
16+
"release:check": "pnpm lint && pnpm clean && pnpm build && pnpm check-types && pnpm test",
1617
"release:publish": "pnpm -r publish --tag next",
1718
"release:version": "bumpp -r --execute=\"pnpm release:changelog\" --commit \"build: publish v%s\" --all",
1819
"test": "pnpm test:unit && pnpm test:e2e",
@@ -33,7 +34,7 @@
3334
"@commitlint/cli": "^19.3.0",
3435
"@commitlint/config-conventional": "^19.2.2",
3536
"@commitlint/types": "^19.0.3",
36-
"@types/node": "^20.12.11",
37+
"@types/node": "^20.12.12",
3738
"@types/webpack-env": "^1.18.5",
3839
"@vitest/coverage-istanbul": "^1.6.0",
3940
"bumpp": "^9.4.1",
@@ -51,7 +52,8 @@
5152
"tsup": "^8.0.2",
5253
"typescript": "^5.4.5",
5354
"vite": "~5.2.11",
54-
"vitest": "^1.6.0"
55+
"vitest": "^1.6.0",
56+
"vue-tsc": "^2.0.17"
5557
},
5658
"packageManager": "[email protected]",
5759
"engines": {

packages/client/src/resolvers.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const resolvers = reactive({
4343
resolvePageHead: (
4444
pageHeadTitle: PageHeadTitle,
4545
pageFrontmatter: PageFrontmatter,
46-
siteLocaleDate: SiteData,
46+
siteLocaleDate: SiteLocaleData,
4747
): PageHead => {
4848
const description = isString(pageFrontmatter.description)
4949
? pageFrontmatter.description
@@ -64,7 +64,7 @@ export const resolvers = reactive({
6464
*/
6565
resolvePageHeadTitle: (
6666
pageData: PageData,
67-
siteLocaleDate: SiteData,
67+
siteLocaleDate: SiteLocaleData,
6868
): PageHeadTitle =>
6969
[pageData.title, siteLocaleDate.title].filter((item) => !!item).join(' | '),
7070

@@ -73,8 +73,10 @@ export const resolvers = reactive({
7373
*
7474
* It would be used as the `lang` attribute of `<html>` tag
7575
*/
76-
resolvePageLang: (pageData: PageData, siteLocaleData: SiteData): PageLang =>
77-
pageData.lang || siteLocaleData.lang || LANG_DEFAULT,
76+
resolvePageLang: (
77+
pageData: PageData,
78+
siteLocaleData: SiteLocaleData,
79+
): PageLang => pageData.lang || siteLocaleData.lang || LANG_DEFAULT,
7880

7981
/**
8082
* Resolve layout component of current page

packages/client/src/setupDevtools.ts

+17-20
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
import { setupDevtoolsPlugin } from '@vue/devtools-api'
22
import { watch } from 'vue'
33
import type { App } from 'vue'
4-
import type { GlobalComputed } from './setupGlobalComputed.js'
4+
import type { ClientData } from './types/index.js'
55

66
const PLUGIN_ID = 'org.vuejs.vuepress'
77
const PLUGIN_LABEL = 'VuePress'
88
const PLUGIN_COMPONENT_STATE_TYPE = PLUGIN_LABEL
99

1010
const INSPECTOR_ID = PLUGIN_ID
1111
const INSPECTOR_LABEL = PLUGIN_LABEL
12-
const INSPECTOR_GLOBAL_COMPUTED_ID = 'global-computed'
13-
const INSPECTOR_GLOBAL_COMPUTED_LABEL = 'Global Computed'
12+
const INSPECTOR_CLIENT_DATA_ID = 'client-data'
13+
const INSPECTOR_CLIENT_DATA_LABEL = 'Client Data'
1414

15-
export const setupDevtools = (
16-
app: App,
17-
globalComputed: GlobalComputed,
18-
): void => {
15+
export const setupDevtools = (app: App, clientData: ClientData): void => {
1916
setupDevtoolsPlugin(
2017
{
2118
// fix recursive reference
@@ -28,14 +25,14 @@ export const setupDevtools = (
2825
componentStateTypes: [PLUGIN_COMPONENT_STATE_TYPE],
2926
},
3027
(api) => {
31-
const globalComputedEntries = Object.entries(globalComputed)
32-
const globalComputedKeys = Object.keys(globalComputed)
33-
const globalComputedValues = Object.values(globalComputed)
28+
const clientDataEntries = Object.entries(clientData)
29+
const clientDataKeys = Object.keys(clientData)
30+
const clientDataValues = Object.values(clientData)
3431

3532
// setup component state
3633
api.on.inspectComponent((payload) => {
3734
payload.instanceData.state.push(
38-
...globalComputedEntries.map(([name, item]) => ({
35+
...clientDataEntries.map(([name, item]) => ({
3936
type: PLUGIN_COMPONENT_STATE_TYPE,
4037
editable: false,
4138
key: name,
@@ -54,9 +51,9 @@ export const setupDevtools = (
5451
if (payload.inspectorId !== INSPECTOR_ID) return
5552
payload.rootNodes = [
5653
{
57-
id: INSPECTOR_GLOBAL_COMPUTED_ID,
58-
label: INSPECTOR_GLOBAL_COMPUTED_LABEL,
59-
children: globalComputedKeys.map((name) => ({
54+
id: INSPECTOR_CLIENT_DATA_ID,
55+
label: INSPECTOR_CLIENT_DATA_LABEL,
56+
children: clientDataKeys.map((name) => ({
6057
id: name,
6158
label: name,
6259
})),
@@ -65,30 +62,30 @@ export const setupDevtools = (
6562
})
6663
api.on.getInspectorState((payload) => {
6764
if (payload.inspectorId !== INSPECTOR_ID) return
68-
if (payload.nodeId === INSPECTOR_GLOBAL_COMPUTED_ID) {
65+
if (payload.nodeId === INSPECTOR_CLIENT_DATA_ID) {
6966
payload.state = {
70-
[INSPECTOR_GLOBAL_COMPUTED_LABEL]: globalComputedEntries.map(
67+
[INSPECTOR_CLIENT_DATA_LABEL]: clientDataEntries.map(
7168
([name, item]) => ({
7269
key: name,
7370
value: item.value,
7471
}),
7572
),
7673
}
7774
}
78-
if (globalComputedKeys.includes(payload.nodeId)) {
75+
if (clientDataKeys.includes(payload.nodeId)) {
7976
payload.state = {
80-
[INSPECTOR_GLOBAL_COMPUTED_LABEL]: [
77+
[INSPECTOR_CLIENT_DATA_LABEL]: [
8178
{
8279
key: payload.nodeId,
83-
value: globalComputed[payload.nodeId].value,
80+
value: clientData[payload.nodeId].value,
8481
},
8582
],
8683
}
8784
}
8885
})
8986

9087
// refresh the component state and inspector state
91-
watch(globalComputedValues, () => {
88+
watch(clientDataValues, () => {
9289
api.notifyComponentUpdate()
9390
api.sendInspectorState(INSPECTOR_ID)
9491
})

packages/core/tests/pluginApi/createHookQueue.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,12 @@ describe('core > pluginApi > createHookQueue', () => {
299299
pluginName: 'test2',
300300
hook: func2,
301301
})
302-
const result = await hook.process(app)
302+
const result = await hook.process(app, true)
303303

304304
expect(func1).toHaveBeenCalledTimes(1)
305-
expect(func1).toHaveBeenCalledWith(app)
305+
expect(func1).toHaveBeenCalledWith(app, true)
306306
expect(func2).toHaveBeenCalledTimes(1)
307-
expect(func2).toHaveBeenCalledWith(app)
307+
expect(func2).toHaveBeenCalledWith(app, true)
308308
expect(result).toEqual([{ foo: 'foo' }, { bar: 'bar' }])
309309
}),
310310
)

packages/markdown/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
"clean": "rimraf dist"
3232
},
3333
"dependencies": {
34-
"@mdit-vue/plugin-component": "^2.1.2",
35-
"@mdit-vue/plugin-frontmatter": "^2.1.2",
36-
"@mdit-vue/plugin-headers": "^2.1.2",
37-
"@mdit-vue/plugin-sfc": "^2.1.2",
38-
"@mdit-vue/plugin-title": "^2.1.2",
39-
"@mdit-vue/plugin-toc": "^2.1.2",
40-
"@mdit-vue/shared": "^2.1.2",
34+
"@mdit-vue/plugin-component": "^2.1.3",
35+
"@mdit-vue/plugin-frontmatter": "^2.1.3",
36+
"@mdit-vue/plugin-headers": "^2.1.3",
37+
"@mdit-vue/plugin-sfc": "^2.1.3",
38+
"@mdit-vue/plugin-title": "^2.1.3",
39+
"@mdit-vue/plugin-toc": "^2.1.3",
40+
"@mdit-vue/shared": "^2.1.3",
4141
"@mdit-vue/types": "^2.1.0",
4242
"@types/markdown-it": "^14.1.1",
4343
"@types/markdown-it-emoji": "^3.0.1",

packages/markdown/src/plugins/importCodePlugin/createImportCodeBlockRule.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { path } from '@vuepress/utils'
2-
import type ParserBlock from 'markdown-it/lib/parser_block.mjs'
2+
import type { RuleBlock } from 'markdown-it/lib/parser_block.mjs'
33
import type { ImportCodePluginOptions } from './importCodePlugin.js'
44
import type { ImportCodeTokenMeta } from './types.js'
55

@@ -13,9 +13,7 @@ const START_CODES = [64, 91, 99, 111, 100, 101]
1313
const SYNTAX_RE = /^@\[code(?:{(?:(\d+)?-(\d+)?)})?(?: ([^\]]+))?\]\(([^)]*)\)/
1414

1515
export const createImportCodeBlockRule =
16-
({
17-
handleImportPath = (str) => str,
18-
}: ImportCodePluginOptions): ParserBlock.RuleBlock =>
16+
({ handleImportPath = (str) => str }: ImportCodePluginOptions): RuleBlock =>
1917
(state, startLine, endLine, silent): boolean => {
2018
// if it's indented more than 3 spaces, it should be a code block
2119
/* istanbul ignore if */

packages/utils/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"globby": "^14.0.1",
4141
"hash-sum": "^2.0.0",
4242
"ora": "^8.0.1",
43-
"picocolors": "^1.0.0",
43+
"picocolors": "^1.0.1",
4444
"upath": "^2.0.1"
4545
},
4646
"publishConfig": {

0 commit comments

Comments
 (0)