@vuepress/shared 2.0.0-beta.4 → 2.0.0-beta.42
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/dist/index.cjs +198 -0
- package/dist/index.d.ts +289 -0
- package/dist/index.js +152 -0
- package/package.json +37 -13
- package/CHANGELOG.md +0 -152
- package/lib/esm/index.d.ts +0 -2
- package/lib/esm/index.js +0 -2
- package/lib/esm/types/head.d.ts +0 -27
- package/lib/esm/types/head.js +0 -1
- package/lib/esm/types/index.d.ts +0 -5
- package/lib/esm/types/index.js +0 -5
- package/lib/esm/types/locale.d.ts +0 -13
- package/lib/esm/types/locale.js +0 -1
- package/lib/esm/types/page.d.ts +0 -70
- package/lib/esm/types/page.js +0 -1
- package/lib/esm/types/site.d.ts +0 -42
- package/lib/esm/types/site.js +0 -1
- package/lib/esm/types/ssr.d.ts +0 -8
- package/lib/esm/types/ssr.js +0 -1
- package/lib/esm/utils/dedupeHead.d.ts +0 -7
- package/lib/esm/utils/dedupeHead.js +0 -18
- package/lib/esm/utils/ensureEndingSlash.d.ts +0 -4
- package/lib/esm/utils/ensureEndingSlash.js +0 -4
- package/lib/esm/utils/ensureLeadingSlash.d.ts +0 -4
- package/lib/esm/utils/ensureLeadingSlash.js +0 -4
- package/lib/esm/utils/formatDateString.d.ts +0 -4
- package/lib/esm/utils/formatDateString.js +0 -14
- package/lib/esm/utils/htmlEscape.d.ts +0 -4
- package/lib/esm/utils/htmlEscape.js +0 -12
- package/lib/esm/utils/htmlUnescape.d.ts +0 -4
- package/lib/esm/utils/htmlUnescape.js +0 -17
- package/lib/esm/utils/index.d.ts +0 -18
- package/lib/esm/utils/index.js +0 -18
- package/lib/esm/utils/isLinkExternal.d.ts +0 -4
- package/lib/esm/utils/isLinkExternal.js +0 -15
- package/lib/esm/utils/isLinkHttp.d.ts +0 -8
- package/lib/esm/utils/isLinkHttp.js +0 -8
- package/lib/esm/utils/isLinkMailto.d.ts +0 -4
- package/lib/esm/utils/isLinkMailto.js +0 -4
- package/lib/esm/utils/isLinkTel.d.ts +0 -4
- package/lib/esm/utils/isLinkTel.js +0 -4
- package/lib/esm/utils/isPlainObject.d.ts +0 -4
- package/lib/esm/utils/isPlainObject.js +0 -4
- package/lib/esm/utils/normalizePackageName.d.ts +0 -4
- package/lib/esm/utils/normalizePackageName.js +0 -37
- package/lib/esm/utils/removeEndingSlash.d.ts +0 -4
- package/lib/esm/utils/removeEndingSlash.js +0 -4
- package/lib/esm/utils/removeLeadingSlash.d.ts +0 -4
- package/lib/esm/utils/removeLeadingSlash.js +0 -4
- package/lib/esm/utils/resolveHeadIdentifier.d.ts +0 -5
- package/lib/esm/utils/resolveHeadIdentifier.js +0 -18
- package/lib/esm/utils/resolveLocalePath.d.ts +0 -5
- package/lib/esm/utils/resolveLocalePath.js +0 -18
- package/lib/esm/utils/resolveRoutePathFromUrl.d.ts +0 -1
- package/lib/esm/utils/resolveRoutePathFromUrl.js +0 -5
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -14
- package/lib/tsconfig.esm.tsbuildinfo +0 -2410
- package/lib/types/head.d.ts +0 -27
- package/lib/types/head.js +0 -2
- package/lib/types/index.d.ts +0 -5
- package/lib/types/index.js +0 -17
- package/lib/types/locale.d.ts +0 -13
- package/lib/types/locale.js +0 -2
- package/lib/types/page.d.ts +0 -70
- package/lib/types/page.js +0 -2
- package/lib/types/site.d.ts +0 -42
- package/lib/types/site.js +0 -2
- package/lib/types/ssr.d.ts +0 -8
- package/lib/types/ssr.js +0 -2
- package/lib/utils/dedupeHead.d.ts +0 -7
- package/lib/utils/dedupeHead.js +0 -22
- package/lib/utils/ensureEndingSlash.d.ts +0 -4
- package/lib/utils/ensureEndingSlash.js +0 -8
- package/lib/utils/ensureLeadingSlash.d.ts +0 -4
- package/lib/utils/ensureLeadingSlash.js +0 -8
- package/lib/utils/formatDateString.d.ts +0 -4
- package/lib/utils/formatDateString.js +0 -18
- package/lib/utils/htmlEscape.d.ts +0 -4
- package/lib/utils/htmlEscape.js +0 -16
- package/lib/utils/htmlUnescape.d.ts +0 -4
- package/lib/utils/htmlUnescape.js +0 -21
- package/lib/utils/index.d.ts +0 -18
- package/lib/utils/index.js +0 -35
- package/lib/utils/isLinkExternal.d.ts +0 -4
- package/lib/utils/isLinkExternal.js +0 -19
- package/lib/utils/isLinkHttp.d.ts +0 -8
- package/lib/utils/isLinkHttp.js +0 -12
- package/lib/utils/isLinkMailto.d.ts +0 -4
- package/lib/utils/isLinkMailto.js +0 -8
- package/lib/utils/isLinkTel.d.ts +0 -4
- package/lib/utils/isLinkTel.js +0 -8
- package/lib/utils/isPlainObject.d.ts +0 -4
- package/lib/utils/isPlainObject.js +0 -8
- package/lib/utils/normalizePackageName.d.ts +0 -4
- package/lib/utils/normalizePackageName.js +0 -41
- package/lib/utils/removeEndingSlash.d.ts +0 -4
- package/lib/utils/removeEndingSlash.js +0 -8
- package/lib/utils/removeLeadingSlash.d.ts +0 -4
- package/lib/utils/removeLeadingSlash.js +0 -8
- package/lib/utils/resolveHeadIdentifier.d.ts +0 -5
- package/lib/utils/resolveHeadIdentifier.js +0 -22
- package/lib/utils/resolveLocalePath.d.ts +0 -5
- package/lib/utils/resolveLocalePath.js +0 -22
- package/lib/utils/resolveRoutePathFromUrl.d.ts +0 -1
- package/lib/utils/resolveRoutePathFromUrl.js +0 -9
package/CHANGELOG.md
DELETED
|
@@ -1,152 +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.4](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.3...v2.0.0-beta.4) (2021-03-20)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @vuepress/shared
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [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)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @vuepress/shared
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [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)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @vuepress/shared
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [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)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Code Refactoring
|
|
34
|
-
|
|
35
|
-
* **core:** remove theme data from site data ([187aef3](https://github.com/vuepress/vuepress-next/commit/187aef36607efc62d7b2d5c773553f89685cf64c))
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### BREAKING CHANGES
|
|
39
|
-
|
|
40
|
-
* **core:** `themeConfig` is not available in site data any more
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
# [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)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### Code Refactoring
|
|
50
|
-
|
|
51
|
-
* **core:** change page default date to 0000-00-00 ([1ce602e](https://github.com/vuepress/vuepress-next/commit/1ce602ef811f29f083a8d10695a7b212ed82cae5))
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
### BREAKING CHANGES
|
|
55
|
-
|
|
56
|
-
* **core:** change page default date from 1970-01-01 to 0000-00-00
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# [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)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
### Features
|
|
66
|
-
|
|
67
|
-
* **core:** make language available in page data ([03bb09f](https://github.com/vuepress/vuepress-next/commit/03bb09fd51aeaff56d26820a1401b87ea8bdeb38))
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# [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)
|
|
74
|
-
|
|
75
|
-
**Note:** Version bump only for package @vuepress/shared
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# [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)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### Features
|
|
85
|
-
|
|
86
|
-
* **shared:** optimize frontmatter type and support generics ([8a7025f](https://github.com/vuepress/vuepress-next/commit/8a7025ff39b4656f98f9a35e93848373ce72ddbe))
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
# [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)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
### Bug Fixes
|
|
96
|
-
|
|
97
|
-
* **core:** fix site locale data type ([7898500](https://github.com/vuepress/vuepress-next/commit/7898500f8b611662777ca3bdeb89c5b3bb658595))
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
# [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)
|
|
104
|
-
|
|
105
|
-
**Note:** Version bump only for package @vuepress/shared
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
# [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)
|
|
112
|
-
|
|
113
|
-
**Note:** Version bump only for package @vuepress/shared
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
# [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)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
### Features
|
|
123
|
-
|
|
124
|
-
* **shared:** add esm build ([f8463e7](https://github.com/vuepress/vuepress-next/commit/f8463e791c909493e343d98468663c9d31bcbb5f))
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
# 2.0.0-alpha.1 (2020-12-01)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
### Bug Fixes
|
|
134
|
-
|
|
135
|
-
* **shared:** missing type inference for resolveLocaleConfigItem ([3e230fd](https://github.com/vuepress/vuepress-next/commit/3e230fd72020ba2e2e9d9c0fef90f035410c184f))
|
|
136
|
-
* **shared:** remove title from ssr context ([6eddf75](https://github.com/vuepress/vuepress-next/commit/6eddf75ea14cac471d93fcfbee2df03c1089ac58))
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
### Features
|
|
140
|
-
|
|
141
|
-
* **shared:** add children field in page header ([6f29d05](https://github.com/vuepress/vuepress-next/commit/6f29d05e6103d172ffe9263ff964c45afd82a4c1))
|
|
142
|
-
* **shared:** add head utils ([f020af0](https://github.com/vuepress/vuepress-next/commit/f020af0d6abcb5505692e9ecd3ae16d8b846008f))
|
|
143
|
-
* **shared:** add htmlUnescape and htmlEscape utils ([5e55f95](https://github.com/vuepress/vuepress-next/commit/5e55f95bcfd0b039ca1f4398f8d064af9fe4223a))
|
|
144
|
-
* **shared:** add isLinkAbsolute and isLinkHttp utils ([bbe8e99](https://github.com/vuepress/vuepress-next/commit/bbe8e995d2f93ff9d8919d699be81d429e0d6abd))
|
|
145
|
-
* **shared:** add link utils ([59e8fd5](https://github.com/vuepress/vuepress-next/commit/59e8fd521a92dc5ed4e1ea5d313dac40b46e7a90))
|
|
146
|
-
* **shared:** add resolveRoutePathFromUrl util ([460f39b](https://github.com/vuepress/vuepress-next/commit/460f39ba26cda4601b02fc8c0437a88a36d6dd59))
|
|
147
|
-
* **shared:** add utils to resolve locale data ([4d5ccd5](https://github.com/vuepress/vuepress-next/commit/4d5ccd56cac166bd76260b3ba3aedac562deead2))
|
|
148
|
-
* **shared:** expose isPlainObject util ([1558de3](https://github.com/vuepress/vuepress-next/commit/1558de3248f12f2a2508bfb5ebbe53ca26c466cb))
|
|
149
|
-
* **shared:** extract locale path util ([54b747c](https://github.com/vuepress/vuepress-next/commit/54b747c96e6c81f1af289317e7b80c5daff6f517))
|
|
150
|
-
* **shared:** make PageData type extendable ([aacbecc](https://github.com/vuepress/vuepress-next/commit/aacbeccb26ff7d58776678faffdc8fdabcaf36c3))
|
|
151
|
-
* **shared:** migrate isPlainObject with generics support ([fb1f7c3](https://github.com/vuepress/vuepress-next/commit/fb1f7c301514759a63443b19b5d62362d098fde7))
|
|
152
|
-
* **shared:** optimize type definitions and remove resolveSiteLocaleData ([e1d58f6](https://github.com/vuepress/vuepress-next/commit/e1d58f6f3e40458e03e660e15ffc10e7e3acc7f5))
|
package/lib/esm/index.d.ts
DELETED
package/lib/esm/index.js
DELETED
package/lib/esm/types/head.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Config for `<head>` tags
|
|
3
|
-
*
|
|
4
|
-
* @example ['link', { rel: 'icon', href: '/logo.png' }]
|
|
5
|
-
* @example ['style', { type: 'text/css' }, 'p { color: red; }']
|
|
6
|
-
*
|
|
7
|
-
* @remark suffix `Config` means this is for user config
|
|
8
|
-
*/
|
|
9
|
-
export declare type HeadConfig = [HeadTagEmpty, HeadAttrsConfig] | [HeadTagNonEmpty, HeadAttrsConfig, string];
|
|
10
|
-
/**
|
|
11
|
-
* Allowed tags in `<head>`
|
|
12
|
-
*
|
|
13
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head
|
|
14
|
-
*/
|
|
15
|
-
export declare type HeadTag = HeadTagNonEmpty | HeadTagEmpty;
|
|
16
|
-
/**
|
|
17
|
-
* Non-empty tags in `<head>`
|
|
18
|
-
*/
|
|
19
|
-
export declare type HeadTagNonEmpty = 'title' | 'style' | 'script' | 'noscript' | 'template';
|
|
20
|
-
/**
|
|
21
|
-
* Empty tags in `<head>`
|
|
22
|
-
*/
|
|
23
|
-
export declare type HeadTagEmpty = 'base' | 'link' | 'meta' | 'script';
|
|
24
|
-
/**
|
|
25
|
-
* Attributes to be set for tags in `<head>`
|
|
26
|
-
*/
|
|
27
|
-
export declare type HeadAttrsConfig = Record<string, string | boolean>;
|
package/lib/esm/types/head.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/types/index.d.ts
DELETED
package/lib/esm/types/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Locales config, a key-value object
|
|
3
|
-
*
|
|
4
|
-
* - Key is the locale path (prefix)
|
|
5
|
-
* - Value is the locales data
|
|
6
|
-
*
|
|
7
|
-
* @remark suffix `Config` means this is for user config
|
|
8
|
-
*/
|
|
9
|
-
export declare type LocaleConfig<T extends LocaleData = LocaleData> = Record<string, Partial<T>>;
|
|
10
|
-
/**
|
|
11
|
-
* Locales data
|
|
12
|
-
*/
|
|
13
|
-
export declare type LocaleData = Record<string, any>;
|
package/lib/esm/types/locale.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/types/page.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { HeadConfig } from './head';
|
|
2
|
-
/**
|
|
3
|
-
* Vuepress page data
|
|
4
|
-
*/
|
|
5
|
-
export declare type PageData<ExtendedPageData extends Record<any, any> = Record<never, never>> = ExtendedPageData & {
|
|
6
|
-
/**
|
|
7
|
-
* Identifier of the page
|
|
8
|
-
*
|
|
9
|
-
* Will also be used as the component name
|
|
10
|
-
*
|
|
11
|
-
* @example 'v-foobar'
|
|
12
|
-
*/
|
|
13
|
-
key: string;
|
|
14
|
-
/**
|
|
15
|
-
* Route path of the page
|
|
16
|
-
*
|
|
17
|
-
* Firstly inferred from the file path
|
|
18
|
-
*
|
|
19
|
-
* Might be overridden by permalink
|
|
20
|
-
*
|
|
21
|
-
* @example '/guide/index.html'
|
|
22
|
-
* @example '/2020/02/02/hello-world.html'
|
|
23
|
-
*/
|
|
24
|
-
path: string;
|
|
25
|
-
/**
|
|
26
|
-
* Title of the page
|
|
27
|
-
*/
|
|
28
|
-
title: string;
|
|
29
|
-
/**
|
|
30
|
-
* Language of the page
|
|
31
|
-
*/
|
|
32
|
-
lang: string;
|
|
33
|
-
/**
|
|
34
|
-
* Front matter of the page
|
|
35
|
-
*/
|
|
36
|
-
frontmatter: PageFrontmatter;
|
|
37
|
-
/**
|
|
38
|
-
* Excerpt of the page
|
|
39
|
-
*/
|
|
40
|
-
excerpt: string;
|
|
41
|
-
/**
|
|
42
|
-
* Headers of the page
|
|
43
|
-
*/
|
|
44
|
-
headers: PageHeader[];
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Vuepress page frontmatter
|
|
48
|
-
*
|
|
49
|
-
* Notice that frontmatter is parsed from yaml or other languages,
|
|
50
|
-
* so we cannot guarantee the type safety
|
|
51
|
-
*/
|
|
52
|
-
export declare type PageFrontmatter<T extends Record<any, any> = Record<string, unknown>> = Partial<T> & {
|
|
53
|
-
layout?: string;
|
|
54
|
-
permalink?: string;
|
|
55
|
-
permalinkPattern?: string;
|
|
56
|
-
date?: string | Date;
|
|
57
|
-
lang?: string;
|
|
58
|
-
title?: string;
|
|
59
|
-
description?: string;
|
|
60
|
-
head?: HeadConfig[];
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Vuepress page header
|
|
64
|
-
*/
|
|
65
|
-
export interface PageHeader {
|
|
66
|
-
level: number;
|
|
67
|
-
title: string;
|
|
68
|
-
slug: string;
|
|
69
|
-
children: PageHeader[];
|
|
70
|
-
}
|
package/lib/esm/types/page.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/types/site.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { HeadConfig } from './head';
|
|
2
|
-
import type { LocaleConfig } from './locale';
|
|
3
|
-
/**
|
|
4
|
-
* Vuepress site data
|
|
5
|
-
*/
|
|
6
|
-
export interface SiteData extends SiteLocaleData {
|
|
7
|
-
base: string;
|
|
8
|
-
locales: SiteLocaleConfig;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Locales data of vuepress site
|
|
12
|
-
*
|
|
13
|
-
* If they are set in the root of site data, they will be used
|
|
14
|
-
* as the default value
|
|
15
|
-
*
|
|
16
|
-
* If they are set in the `locales` of site data, they will be
|
|
17
|
-
* used for specific locale
|
|
18
|
-
*/
|
|
19
|
-
export interface SiteLocaleData {
|
|
20
|
-
lang: string;
|
|
21
|
-
title: string;
|
|
22
|
-
description: string;
|
|
23
|
-
head: HeadConfig[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Site locale config
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* {
|
|
30
|
-
* '/en/': {
|
|
31
|
-
* lang: 'en-US',
|
|
32
|
-
* title: 'Hello',
|
|
33
|
-
* },
|
|
34
|
-
* '/zh/: {
|
|
35
|
-
* lang: 'zh-CN',
|
|
36
|
-
* title: '你好',
|
|
37
|
-
* }
|
|
38
|
-
* }
|
|
39
|
-
*
|
|
40
|
-
* @remark suffix `Config` means this is for user config
|
|
41
|
-
*/
|
|
42
|
-
export declare type SiteLocaleConfig = LocaleConfig<SiteLocaleData>;
|
package/lib/esm/types/site.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/types/ssr.d.ts
DELETED
package/lib/esm/types/ssr.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { resolveHeadIdentifier } from './resolveHeadIdentifier';
|
|
2
|
-
/**
|
|
3
|
-
* Dedupe head config with identifier
|
|
4
|
-
*
|
|
5
|
-
* Items that appear earlier have higher priority
|
|
6
|
-
*/
|
|
7
|
-
export const dedupeHead = (head) => {
|
|
8
|
-
const identifierSet = new Set();
|
|
9
|
-
const result = [];
|
|
10
|
-
head.forEach((item) => {
|
|
11
|
-
const identifier = resolveHeadIdentifier(item);
|
|
12
|
-
if (!identifierSet.has(identifier)) {
|
|
13
|
-
identifierSet.add(identifier);
|
|
14
|
-
result.push(item);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return result;
|
|
18
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format a date string to `yyyy-MM-dd`
|
|
3
|
-
*/
|
|
4
|
-
export const formatDateString = (str, defaultDateString = '') => {
|
|
5
|
-
// match the `yyyy-(M)M-(d)d` pattern
|
|
6
|
-
const dateMatch = str.match(/\b(\d{4})-(\d{1,2})-(\d{1,2})\b/);
|
|
7
|
-
// return `defaultDateString` if no matched pattern
|
|
8
|
-
if (dateMatch === null) {
|
|
9
|
-
return defaultDateString;
|
|
10
|
-
}
|
|
11
|
-
// fill leading zeros for month and day
|
|
12
|
-
const [, yearStr, monthStr, dayStr] = dateMatch;
|
|
13
|
-
return [yearStr, monthStr.padStart(2, '0'), dayStr.padStart(2, '0')].join('-');
|
|
14
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const htmlEscapeMap = {
|
|
2
|
-
'&': '&',
|
|
3
|
-
'<': '<',
|
|
4
|
-
'>': '>',
|
|
5
|
-
"'": ''',
|
|
6
|
-
'"': '"',
|
|
7
|
-
};
|
|
8
|
-
const htmlEscapeRegexp = /[&<>'"]/g;
|
|
9
|
-
/**
|
|
10
|
-
* Escape html chars
|
|
11
|
-
*/
|
|
12
|
-
export const htmlEscape = (str) => str.replace(htmlEscapeRegexp, (char) => htmlEscapeMap[char]);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const htmlUnescapeMap = {
|
|
2
|
-
'&': '&',
|
|
3
|
-
'&': '&',
|
|
4
|
-
'<': '<',
|
|
5
|
-
'<': '<',
|
|
6
|
-
'>': '>',
|
|
7
|
-
'>': '>',
|
|
8
|
-
''': "'",
|
|
9
|
-
''': "'",
|
|
10
|
-
'"': '"',
|
|
11
|
-
'"': '"',
|
|
12
|
-
};
|
|
13
|
-
const htmlUnescapeRegexp = /&(amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
|
|
14
|
-
/**
|
|
15
|
-
* Unescape html chars
|
|
16
|
-
*/
|
|
17
|
-
export const htmlUnescape = (str) => str.replace(htmlUnescapeRegexp, (char) => htmlUnescapeMap[char]);
|
package/lib/esm/utils/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { isArray, isFunction, isPromise, isString } from '@vue/shared';
|
|
2
|
-
export * from './dedupeHead';
|
|
3
|
-
export * from './ensureLeadingSlash';
|
|
4
|
-
export * from './ensureEndingSlash';
|
|
5
|
-
export * from './formatDateString';
|
|
6
|
-
export * from './htmlEscape';
|
|
7
|
-
export * from './htmlUnescape';
|
|
8
|
-
export * from './isLinkExternal';
|
|
9
|
-
export * from './isLinkHttp';
|
|
10
|
-
export * from './isLinkMailto';
|
|
11
|
-
export * from './isLinkTel';
|
|
12
|
-
export * from './isPlainObject';
|
|
13
|
-
export * from './normalizePackageName';
|
|
14
|
-
export * from './removeEndingSlash';
|
|
15
|
-
export * from './removeLeadingSlash';
|
|
16
|
-
export * from './resolveHeadIdentifier';
|
|
17
|
-
export * from './resolveLocalePath';
|
|
18
|
-
export * from './resolveRoutePathFromUrl';
|
package/lib/esm/utils/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export { isArray, isFunction, isPromise, isString } from '@vue/shared';
|
|
2
|
-
export * from './dedupeHead';
|
|
3
|
-
export * from './ensureLeadingSlash';
|
|
4
|
-
export * from './ensureEndingSlash';
|
|
5
|
-
export * from './formatDateString';
|
|
6
|
-
export * from './htmlEscape';
|
|
7
|
-
export * from './htmlUnescape';
|
|
8
|
-
export * from './isLinkExternal';
|
|
9
|
-
export * from './isLinkHttp';
|
|
10
|
-
export * from './isLinkMailto';
|
|
11
|
-
export * from './isLinkTel';
|
|
12
|
-
export * from './isPlainObject';
|
|
13
|
-
export * from './normalizePackageName';
|
|
14
|
-
export * from './removeEndingSlash';
|
|
15
|
-
export * from './removeLeadingSlash';
|
|
16
|
-
export * from './resolveHeadIdentifier';
|
|
17
|
-
export * from './resolveLocalePath';
|
|
18
|
-
export * from './resolveRoutePathFromUrl';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { isLinkHttp } from './isLinkHttp';
|
|
2
|
-
/**
|
|
3
|
-
* Determine a link is external or not
|
|
4
|
-
*/
|
|
5
|
-
export const isLinkExternal = (link, base = '/') => {
|
|
6
|
-
// http link
|
|
7
|
-
if (isLinkHttp(link)) {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
// absolute link that does not start with `base`
|
|
11
|
-
if (link.startsWith('/') && !link.startsWith(base)) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalize package name
|
|
3
|
-
*/
|
|
4
|
-
export const normalizePackageName = (request, org, type = null) => {
|
|
5
|
-
// org prefix and type prefix
|
|
6
|
-
const orgPrefix = `${org}-`;
|
|
7
|
-
const typePrefix = type === null ? '' : `${type}-`;
|
|
8
|
-
// scoped package pattern
|
|
9
|
-
const scopedMatch = request.match(/^@(.*)\/(.*)$/);
|
|
10
|
-
// handle non-scoped package
|
|
11
|
-
if (scopedMatch === null) {
|
|
12
|
-
// full name, return as is
|
|
13
|
-
if (request.startsWith(`${orgPrefix}${typePrefix}`)) {
|
|
14
|
-
return request;
|
|
15
|
-
}
|
|
16
|
-
// short name, add org prefix and type prefix
|
|
17
|
-
return `${orgPrefix}${typePrefix}${request}`;
|
|
18
|
-
}
|
|
19
|
-
// handle scoped package
|
|
20
|
-
const [, reqOrg, reqName] = scopedMatch;
|
|
21
|
-
// handle default org
|
|
22
|
-
if (reqOrg === org) {
|
|
23
|
-
// full name, return as is
|
|
24
|
-
if (reqName.startsWith(typePrefix)) {
|
|
25
|
-
return request;
|
|
26
|
-
}
|
|
27
|
-
// short name, add type prefix
|
|
28
|
-
return `@${reqOrg}/${typePrefix}${reqName}`;
|
|
29
|
-
}
|
|
30
|
-
// handle other org
|
|
31
|
-
// full name, return as is
|
|
32
|
-
if (reqName.startsWith(`${orgPrefix}${typePrefix}`)) {
|
|
33
|
-
return request;
|
|
34
|
-
}
|
|
35
|
-
// short name, add org prefix and type prefix
|
|
36
|
-
return `@${reqOrg}/${orgPrefix}${typePrefix}${reqName}`;
|
|
37
|
-
};
|