@vuepress/shared 2.0.0-beta.7 → 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.
Files changed (107) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +12 -0
  3. package/dist/index.d.ts +274 -0
  4. package/dist/index.js +138 -0
  5. package/package.json +33 -15
  6. package/CHANGELOG.md +0 -160
  7. package/lib/esm/index.d.ts +0 -2
  8. package/lib/esm/index.js +0 -2
  9. package/lib/esm/types/head.d.ts +0 -27
  10. package/lib/esm/types/head.js +0 -1
  11. package/lib/esm/types/index.d.ts +0 -5
  12. package/lib/esm/types/index.js +0 -5
  13. package/lib/esm/types/locale.d.ts +0 -13
  14. package/lib/esm/types/locale.js +0 -1
  15. package/lib/esm/types/page.d.ts +0 -70
  16. package/lib/esm/types/page.js +0 -1
  17. package/lib/esm/types/site.d.ts +0 -42
  18. package/lib/esm/types/site.js +0 -1
  19. package/lib/esm/types/ssr.d.ts +0 -8
  20. package/lib/esm/types/ssr.js +0 -1
  21. package/lib/esm/utils/dedupeHead.d.ts +0 -7
  22. package/lib/esm/utils/dedupeHead.js +0 -18
  23. package/lib/esm/utils/ensureEndingSlash.d.ts +0 -4
  24. package/lib/esm/utils/ensureEndingSlash.js +0 -4
  25. package/lib/esm/utils/ensureLeadingSlash.d.ts +0 -4
  26. package/lib/esm/utils/ensureLeadingSlash.js +0 -4
  27. package/lib/esm/utils/formatDateString.d.ts +0 -4
  28. package/lib/esm/utils/formatDateString.js +0 -14
  29. package/lib/esm/utils/htmlEscape.d.ts +0 -4
  30. package/lib/esm/utils/htmlEscape.js +0 -12
  31. package/lib/esm/utils/htmlUnescape.d.ts +0 -4
  32. package/lib/esm/utils/htmlUnescape.js +0 -17
  33. package/lib/esm/utils/index.d.ts +0 -18
  34. package/lib/esm/utils/index.js +0 -18
  35. package/lib/esm/utils/isLinkExternal.d.ts +0 -4
  36. package/lib/esm/utils/isLinkExternal.js +0 -15
  37. package/lib/esm/utils/isLinkHttp.d.ts +0 -8
  38. package/lib/esm/utils/isLinkHttp.js +0 -8
  39. package/lib/esm/utils/isLinkMailto.d.ts +0 -4
  40. package/lib/esm/utils/isLinkMailto.js +0 -4
  41. package/lib/esm/utils/isLinkTel.d.ts +0 -4
  42. package/lib/esm/utils/isLinkTel.js +0 -4
  43. package/lib/esm/utils/isPlainObject.d.ts +0 -4
  44. package/lib/esm/utils/isPlainObject.js +0 -4
  45. package/lib/esm/utils/normalizePackageName.d.ts +0 -4
  46. package/lib/esm/utils/normalizePackageName.js +0 -37
  47. package/lib/esm/utils/removeEndingSlash.d.ts +0 -4
  48. package/lib/esm/utils/removeEndingSlash.js +0 -4
  49. package/lib/esm/utils/removeLeadingSlash.d.ts +0 -4
  50. package/lib/esm/utils/removeLeadingSlash.js +0 -4
  51. package/lib/esm/utils/resolveHeadIdentifier.d.ts +0 -5
  52. package/lib/esm/utils/resolveHeadIdentifier.js +0 -18
  53. package/lib/esm/utils/resolveLocalePath.d.ts +0 -5
  54. package/lib/esm/utils/resolveLocalePath.js +0 -18
  55. package/lib/esm/utils/resolveRoutePathFromUrl.d.ts +0 -1
  56. package/lib/esm/utils/resolveRoutePathFromUrl.js +0 -5
  57. package/lib/index.d.ts +0 -2
  58. package/lib/index.js +0 -14
  59. package/lib/tsconfig.esm.tsbuildinfo +0 -2410
  60. package/lib/types/head.d.ts +0 -27
  61. package/lib/types/head.js +0 -2
  62. package/lib/types/index.d.ts +0 -5
  63. package/lib/types/index.js +0 -17
  64. package/lib/types/locale.d.ts +0 -13
  65. package/lib/types/locale.js +0 -2
  66. package/lib/types/page.d.ts +0 -70
  67. package/lib/types/page.js +0 -2
  68. package/lib/types/site.d.ts +0 -42
  69. package/lib/types/site.js +0 -2
  70. package/lib/types/ssr.d.ts +0 -8
  71. package/lib/types/ssr.js +0 -2
  72. package/lib/utils/dedupeHead.d.ts +0 -7
  73. package/lib/utils/dedupeHead.js +0 -22
  74. package/lib/utils/ensureEndingSlash.d.ts +0 -4
  75. package/lib/utils/ensureEndingSlash.js +0 -8
  76. package/lib/utils/ensureLeadingSlash.d.ts +0 -4
  77. package/lib/utils/ensureLeadingSlash.js +0 -8
  78. package/lib/utils/formatDateString.d.ts +0 -4
  79. package/lib/utils/formatDateString.js +0 -18
  80. package/lib/utils/htmlEscape.d.ts +0 -4
  81. package/lib/utils/htmlEscape.js +0 -16
  82. package/lib/utils/htmlUnescape.d.ts +0 -4
  83. package/lib/utils/htmlUnescape.js +0 -21
  84. package/lib/utils/index.d.ts +0 -18
  85. package/lib/utils/index.js +0 -35
  86. package/lib/utils/isLinkExternal.d.ts +0 -4
  87. package/lib/utils/isLinkExternal.js +0 -19
  88. package/lib/utils/isLinkHttp.d.ts +0 -8
  89. package/lib/utils/isLinkHttp.js +0 -12
  90. package/lib/utils/isLinkMailto.d.ts +0 -4
  91. package/lib/utils/isLinkMailto.js +0 -8
  92. package/lib/utils/isLinkTel.d.ts +0 -4
  93. package/lib/utils/isLinkTel.js +0 -8
  94. package/lib/utils/isPlainObject.d.ts +0 -4
  95. package/lib/utils/isPlainObject.js +0 -8
  96. package/lib/utils/normalizePackageName.d.ts +0 -4
  97. package/lib/utils/normalizePackageName.js +0 -41
  98. package/lib/utils/removeEndingSlash.d.ts +0 -4
  99. package/lib/utils/removeEndingSlash.js +0 -8
  100. package/lib/utils/removeLeadingSlash.d.ts +0 -4
  101. package/lib/utils/removeLeadingSlash.js +0 -8
  102. package/lib/utils/resolveHeadIdentifier.d.ts +0 -5
  103. package/lib/utils/resolveHeadIdentifier.js +0 -22
  104. package/lib/utils/resolveLocalePath.d.ts +0 -5
  105. package/lib/utils/resolveLocalePath.js +0 -22
  106. package/lib/utils/resolveRoutePathFromUrl.d.ts +0 -1
  107. package/lib/utils/resolveRoutePathFromUrl.js +0 -9
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018-present, Yuxi (Evan) You
3
+ Copyright (c) 2018-present, VuePress Community
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # @vuepress/shared
2
+
3
+ [![npm](https://badgen.net/npm/v/@vuepress/shared/next)](https://www.npmjs.com/package/@vuepress/shared)
4
+ [![license](https://badgen.net/github/license/vuepress/core)](https://github.com/vuepress/core/blob/main/LICENSE)
5
+
6
+ ## Documentation
7
+
8
+ https://v2.vuepress.vuejs.org
9
+
10
+ ## License
11
+
12
+ [MIT](https://github.com/vuepress/core/blob/main/LICENSE)
@@ -0,0 +1,274 @@
1
+ import { MarkdownItHeader } from '@mdit-vue/types';
2
+
3
+ /**
4
+ * Config for `<head>` tags
5
+ */
6
+ type HeadConfig = [HeadTagEmpty, HeadAttrsConfig] | [HeadTagNonEmpty, HeadAttrsConfig, string];
7
+ /**
8
+ * Allowed tags in `<head>`
9
+ *
10
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head
11
+ */
12
+ type HeadTag = HeadTagNonEmpty | HeadTagEmpty;
13
+ /**
14
+ * Non-empty tags in `<head>`
15
+ */
16
+ type HeadTagNonEmpty = 'title' | 'style' | 'script' | 'noscript' | 'template';
17
+ /**
18
+ * Empty tags in `<head>`
19
+ */
20
+ type HeadTagEmpty = 'base' | 'link' | 'meta' | 'script';
21
+ /**
22
+ * Attributes to be set for tags in `<head>`
23
+ */
24
+ type HeadAttrsConfig = Record<string, string | boolean>;
25
+
26
+ /**
27
+ * Locales config, a key-value object
28
+ *
29
+ * - Key is the locale path (prefix)
30
+ * - Value is the locales data
31
+ *
32
+ * @remark suffix `Config` means this is for user config
33
+ */
34
+ type LocaleConfig<T extends LocaleData = LocaleData> = Record<string, Partial<T>>;
35
+ /**
36
+ * Locales data
37
+ */
38
+ type LocaleData = Record<never, never>;
39
+
40
+ /**
41
+ * Base type of vuepress page
42
+ */
43
+ interface PageBase<ExtraPageFrontmatter extends Record<any, any> = Record<string, unknown>> {
44
+ /**
45
+ * Identifier of the page
46
+ *
47
+ * Will also be used as the component name
48
+ *
49
+ * @example 'v-foobar'
50
+ */
51
+ key: string;
52
+ /**
53
+ * Route path of the page
54
+ *
55
+ * Firstly inferred from the file path
56
+ *
57
+ * Might be overridden by permalink
58
+ *
59
+ * @example '/guide/index.html'
60
+ * @example '/2020/02/02/hello-world.html'
61
+ */
62
+ path: string;
63
+ /**
64
+ * Title of the page
65
+ */
66
+ title: string;
67
+ /**
68
+ * Language of the page
69
+ */
70
+ lang: string;
71
+ /**
72
+ * Front matter of the page
73
+ */
74
+ frontmatter: PageFrontmatter<ExtraPageFrontmatter>;
75
+ /**
76
+ * Headers of the page
77
+ */
78
+ headers: PageHeader[];
79
+ }
80
+ /**
81
+ * Vuepress page data
82
+ */
83
+ type PageData<ExtraPageData extends Record<any, any> = Record<never, never>, ExtraPageFrontmatter extends Record<any, any> = Record<string, unknown>> = PageBase<ExtraPageFrontmatter> & ExtraPageData;
84
+ /**
85
+ * Vuepress page frontmatter
86
+ *
87
+ * Notice that frontmatter is parsed from yaml or other languages,
88
+ * so we cannot guarantee the type safety
89
+ */
90
+ type PageFrontmatter<T extends Record<any, any> = Record<string, unknown>> = Partial<T> & {
91
+ date?: string | Date;
92
+ description?: string;
93
+ head?: HeadConfig[];
94
+ lang?: string;
95
+ layout?: string;
96
+ permalink?: string;
97
+ permalinkPattern?: string | null;
98
+ routeMeta?: Record<string, unknown>;
99
+ title?: string;
100
+ };
101
+ /**
102
+ * Vuepress page header
103
+ */
104
+ type PageHeader = MarkdownItHeader;
105
+
106
+ /**
107
+ * Vuepress site data
108
+ */
109
+ interface SiteData extends SiteLocaleData {
110
+ /**
111
+ * The base URL the site will be deployed at
112
+ *
113
+ * It should always start and end with a slash
114
+ *
115
+ * @default '/'
116
+ */
117
+ base: '/' | `/${string}/`;
118
+ /**
119
+ * Specify locales for i18n support
120
+ *
121
+ * It will override the root-level site data in different subpath
122
+ *
123
+ * @example
124
+ * {
125
+ * '/en/': {
126
+ * lang: 'en-US',
127
+ * title: 'Hello',
128
+ * description: 'This will take effect under /en/ subpath',
129
+ * },
130
+ * '/zh/': {
131
+ * lang: 'zh-CN',
132
+ * title: '你好',
133
+ * description: '它将会在 /zh/ 子路径下生效',
134
+ * }
135
+ * }
136
+ */
137
+ locales: SiteLocaleConfig;
138
+ }
139
+ /**
140
+ * Locales data of vuepress site
141
+ *
142
+ * If they are set in the root of site data, they will be used
143
+ * as the default value
144
+ *
145
+ * If they are set in the `locales` of site data, they will be
146
+ * used for specific locale
147
+ */
148
+ interface SiteLocaleData {
149
+ /**
150
+ * Language for the site
151
+ *
152
+ * @default 'en-US'
153
+ */
154
+ lang: string;
155
+ /**
156
+ * Title for the site
157
+ *
158
+ * @default ''
159
+ */
160
+ title: string;
161
+ /**
162
+ * Description for the site
163
+ *
164
+ * @default ''
165
+ */
166
+ description: string;
167
+ /**
168
+ * Head config
169
+ *
170
+ * Descibe the tags to be appended into the `<head>` tag
171
+ *
172
+ * @default []
173
+ *
174
+ * @example ['link', { rel: 'icon', href: '/logo.png' }]
175
+ * @example ['style', { type: 'text/css' }, 'p { color: red; }']
176
+ */
177
+ head: HeadConfig[];
178
+ }
179
+ /**
180
+ * Site locale config
181
+ */
182
+ type SiteLocaleConfig = LocaleConfig<SiteLocaleData>;
183
+
184
+ /**
185
+ * Context for SSR
186
+ */
187
+ interface VuepressSSRContext {
188
+ lang: string;
189
+ head: HeadConfig[];
190
+ }
191
+
192
+ /**
193
+ * Dedupe head config with identifier
194
+ *
195
+ * Items that appear earlier have higher priority
196
+ */
197
+ declare const dedupeHead: (head: HeadConfig[]) => HeadConfig[];
198
+
199
+ /**
200
+ * Ensure a url string to have leading slash /
201
+ */
202
+ declare const ensureLeadingSlash: (str: string) => string;
203
+
204
+ /**
205
+ * Ensure a url string to have ending slash /
206
+ */
207
+ declare const ensureEndingSlash: (str: string) => string;
208
+
209
+ /**
210
+ * Format a date string to `yyyy-MM-dd`
211
+ */
212
+ declare const formatDateString: (str: string, defaultDateString?: string) => string;
213
+
214
+ /**
215
+ * Determine a link is external or not
216
+ */
217
+ declare const isLinkExternal: (link: string, base?: string) => boolean;
218
+
219
+ /**
220
+ * Determine a link is http link or not
221
+ *
222
+ * - http://github.com
223
+ * - https://github.com
224
+ * - //github.com
225
+ */
226
+ declare const isLinkHttp: (link: string) => boolean;
227
+
228
+ /**
229
+ * Determine a link has protocol or not
230
+ */
231
+ declare const isLinkWithProtocol: (link: string) => boolean;
232
+
233
+ /**
234
+ * Check if a value is plain object, with generic type support
235
+ */
236
+ declare const isPlainObject: <T extends Record<any, any> = Record<any, any>>(val: unknown) => val is T;
237
+
238
+ /**
239
+ * Omit properties from an object
240
+ */
241
+ declare const omit: <T extends Record<string, unknown>, U extends string[]>(obj: T, ...keys: U) => Omit<T, U[number]>;
242
+
243
+ /**
244
+ * Remove ending slash / from a string
245
+ */
246
+ declare const removeEndingSlash: (str: string) => string;
247
+
248
+ /**
249
+ * Remove leading slash / from a string
250
+ */
251
+ declare const removeLeadingSlash: (str: string) => string;
252
+
253
+ /**
254
+ * Resolve identifier of a tag, to avoid duplicated tags in `<head>`
255
+ */
256
+ declare const resolveHeadIdentifier: ([tag, attrs, content]: HeadConfig) => string | null;
257
+
258
+ /**
259
+ * Resolve the matched locale path of route path
260
+ */
261
+ declare const resolveLocalePath: (locales: LocaleConfig, routePath: string) => string;
262
+
263
+ declare const resolveRoutePathFromUrl: (url: string, base?: string) => string;
264
+
265
+ /**
266
+ * Check if a value is a function
267
+ */
268
+ declare const isFunction: (val: unknown) => val is Function;
269
+ /**
270
+ * Check if a value is a string
271
+ */
272
+ declare const isString: (val: unknown) => val is string;
273
+
274
+ export { type HeadAttrsConfig, type HeadConfig, type HeadTag, type HeadTagEmpty, type HeadTagNonEmpty, type LocaleConfig, type LocaleData, type PageBase, type PageData, type PageFrontmatter, type PageHeader, type SiteData, type SiteLocaleConfig, type SiteLocaleData, type VuepressSSRContext, dedupeHead, ensureEndingSlash, ensureLeadingSlash, formatDateString, isFunction, isLinkExternal, isLinkHttp, isLinkWithProtocol, isPlainObject, isString, omit, removeEndingSlash, removeLeadingSlash, resolveHeadIdentifier, resolveLocalePath, resolveRoutePathFromUrl };
package/dist/index.js ADDED
@@ -0,0 +1,138 @@
1
+ // src/utils/resolveHeadIdentifier.ts
2
+ var TAGS_ALLOWED = ["link", "meta", "script", "style", "noscript", "template"];
3
+ var TAGS_UNIQUE = ["title", "base"];
4
+ var resolveHeadIdentifier = ([tag, attrs, content]) => {
5
+ if (TAGS_UNIQUE.includes(tag)) {
6
+ return tag;
7
+ }
8
+ if (!TAGS_ALLOWED.includes(tag)) {
9
+ return null;
10
+ }
11
+ if (tag === "meta" && attrs.name) {
12
+ return `${tag}.${attrs.name}`;
13
+ }
14
+ if (tag === "template" && attrs.id) {
15
+ return `${tag}.${attrs.id}`;
16
+ }
17
+ return JSON.stringify([
18
+ tag,
19
+ Object.entries(attrs).map(([key, value]) => {
20
+ if (typeof value === "boolean") {
21
+ return value ? [key, ""] : null;
22
+ }
23
+ return [key, value];
24
+ }).filter((item) => item != null).sort(([keyA], [keyB]) => keyA.localeCompare(keyB)),
25
+ content
26
+ ]);
27
+ };
28
+
29
+ // src/utils/dedupeHead.ts
30
+ var dedupeHead = (head) => {
31
+ const identifierSet = /* @__PURE__ */ new Set();
32
+ const result = [];
33
+ head.forEach((item) => {
34
+ const identifier = resolveHeadIdentifier(item);
35
+ if (identifier && !identifierSet.has(identifier)) {
36
+ identifierSet.add(identifier);
37
+ result.push(item);
38
+ }
39
+ });
40
+ return result;
41
+ };
42
+
43
+ // src/utils/ensureLeadingSlash.ts
44
+ var ensureLeadingSlash = (str) => str[0] === "/" ? str : `/${str}`;
45
+
46
+ // src/utils/ensureEndingSlash.ts
47
+ var ensureEndingSlash = (str) => str[str.length - 1] === "/" || str.endsWith(".html") ? str : `${str}/`;
48
+
49
+ // src/utils/formatDateString.ts
50
+ var formatDateString = (str, defaultDateString = "") => {
51
+ const dateMatch = str.match(/\b(\d{4})-(\d{1,2})-(\d{1,2})\b/);
52
+ if (dateMatch === null) {
53
+ return defaultDateString;
54
+ }
55
+ const [, yearStr, monthStr, dayStr] = dateMatch;
56
+ return [yearStr, monthStr.padStart(2, "0"), dayStr.padStart(2, "0")].join("-");
57
+ };
58
+
59
+ // src/utils/isLinkHttp.ts
60
+ var isLinkHttp = (link) => /^(https?:)?\/\//.test(link);
61
+
62
+ // src/utils/isLinkExternal.ts
63
+ var markdownLinkRegexp = /.md((\?|#).*)?$/;
64
+ var isLinkExternal = (link, base = "/") => {
65
+ if (isLinkHttp(link)) {
66
+ return true;
67
+ }
68
+ if (link.startsWith("/") && !link.startsWith(base) && !markdownLinkRegexp.test(link)) {
69
+ return true;
70
+ }
71
+ return false;
72
+ };
73
+
74
+ // src/utils/isLinkWithProtocol.ts
75
+ var isLinkWithProtocol = (link) => /^[a-z][a-z0-9+.-]*:/.test(link);
76
+
77
+ // src/utils/isPlainObject.ts
78
+ var isPlainObject = (val) => Object.prototype.toString.call(val) === "[object Object]";
79
+
80
+ // src/utils/omit.ts
81
+ var omit = (obj, ...keys) => {
82
+ const result = { ...obj };
83
+ for (const key of keys) {
84
+ delete result[key];
85
+ }
86
+ return result;
87
+ };
88
+
89
+ // src/utils/removeEndingSlash.ts
90
+ var removeEndingSlash = (str) => str[str.length - 1] === "/" ? str.slice(0, -1) : str;
91
+
92
+ // src/utils/removeLeadingSlash.ts
93
+ var removeLeadingSlash = (str) => str[0] === "/" ? str.slice(1) : str;
94
+
95
+ // src/utils/resolveLocalePath.ts
96
+ var resolveLocalePath = (locales, routePath) => {
97
+ const localePaths = Object.keys(locales).sort((a, b) => {
98
+ const levelDelta = b.split("/").length - a.split("/").length;
99
+ if (levelDelta !== 0) {
100
+ return levelDelta;
101
+ }
102
+ return b.length - a.length;
103
+ });
104
+ for (const localePath of localePaths) {
105
+ if (routePath.startsWith(localePath)) {
106
+ return localePath;
107
+ }
108
+ }
109
+ return "/";
110
+ };
111
+
112
+ // src/utils/resolveRoutePathFromUrl.ts
113
+ var resolveRoutePathFromUrl = (url, base = "/") => {
114
+ const pathname = url.replace(/^(https?:)?\/\/[^/]*/, "");
115
+ return pathname.startsWith(base) ? `/${pathname.slice(base.length)}` : pathname;
116
+ };
117
+
118
+ // src/utils/typeGuards.ts
119
+ var isFunction = (val) => typeof val === "function";
120
+ var isString = (val) => typeof val === "string";
121
+ export {
122
+ dedupeHead,
123
+ ensureEndingSlash,
124
+ ensureLeadingSlash,
125
+ formatDateString,
126
+ isFunction,
127
+ isLinkExternal,
128
+ isLinkHttp,
129
+ isLinkWithProtocol,
130
+ isPlainObject,
131
+ isString,
132
+ omit,
133
+ removeEndingSlash,
134
+ removeLeadingSlash,
135
+ resolveHeadIdentifier,
136
+ resolveLocalePath,
137
+ resolveRoutePathFromUrl
138
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/shared",
3
- "version": "2.0.0-beta.7",
3
+ "version": "2.0.0-rc.1",
4
4
  "description": "Utils that shared between VuePress node and client",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -9,29 +9,47 @@
9
9
  ],
10
10
  "homepage": "https://github.com/vuepress",
11
11
  "bugs": {
12
- "url": "https://github.com/vuepress/vuepress-next/issues"
12
+ "url": "https://github.com/vuepress/core/issues"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "git+https://github.com/vuepress/vuepress-next.git"
16
+ "url": "git+https://github.com/vuepress/core.git"
17
17
  },
18
18
  "license": "MIT",
19
- "author": "Evan You",
20
- "main": "lib/index.js",
21
- "module": "lib/esm/index.js",
22
- "types": "lib/index.d.ts",
19
+ "author": "meteorlxy",
20
+ "type": "module",
21
+ "exports": {
22
+ ".": "./dist/index.js",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "main": "./dist/index.js",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
23
28
  "files": [
24
- "lib"
29
+ "dist"
25
30
  ],
26
- "scripts": {
27
- "build": "tsc -b tsconfig.build.json",
28
- "clean": "rimraf lib *.tsbuildinfo"
29
- },
30
31
  "dependencies": {
31
- "@vue/shared": "^3.0.11"
32
+ "@mdit-vue/types": "^2.0.0"
32
33
  },
33
34
  "publishConfig": {
34
35
  "access": "public"
35
36
  },
36
- "gitHead": "f798c4df7489d7fbf27bf430ea547413e8655af4"
37
- }
37
+ "tsup": {
38
+ "clean": true,
39
+ "dts": "./src/index.ts",
40
+ "entry": [
41
+ "./src/index.ts"
42
+ ],
43
+ "format": [
44
+ "esm"
45
+ ],
46
+ "outDir": "./dist",
47
+ "sourcemap": false,
48
+ "target": "es2022",
49
+ "tsconfig": "../../tsconfig.dts.json"
50
+ },
51
+ "scripts": {
52
+ "build": "tsup",
53
+ "clean": "rimraf dist"
54
+ }
55
+ }
package/CHANGELOG.md DELETED
@@ -1,160 +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.7](https://github.com/vuepress/vuepress-next/compare/v2.0.0-beta.6...v2.0.0-beta.7) (2021-04-09)
7
-
8
- **Note:** Version bump only for package @vuepress/shared
9
-
10
-
11
-
12
-
13
-
14
- # [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)
15
-
16
- **Note:** Version bump only for package @vuepress/shared
17
-
18
-
19
-
20
-
21
-
22
- # [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)
23
-
24
- **Note:** Version bump only for package @vuepress/shared
25
-
26
-
27
-
28
-
29
-
30
- # [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)
31
-
32
- **Note:** Version bump only for package @vuepress/shared
33
-
34
-
35
-
36
-
37
-
38
- # [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)
39
-
40
-
41
- ### Code Refactoring
42
-
43
- * **core:** remove theme data from site data ([187aef3](https://github.com/vuepress/vuepress-next/commit/187aef36607efc62d7b2d5c773553f89685cf64c))
44
-
45
-
46
- ### BREAKING CHANGES
47
-
48
- * **core:** `themeConfig` is not available in site data any more
49
-
50
-
51
-
52
-
53
-
54
- # [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)
55
-
56
-
57
- ### Code Refactoring
58
-
59
- * **core:** change page default date to 0000-00-00 ([1ce602e](https://github.com/vuepress/vuepress-next/commit/1ce602ef811f29f083a8d10695a7b212ed82cae5))
60
-
61
-
62
- ### BREAKING CHANGES
63
-
64
- * **core:** change page default date from 1970-01-01 to 0000-00-00
65
-
66
-
67
-
68
-
69
-
70
- # [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)
71
-
72
-
73
- ### Features
74
-
75
- * **core:** make language available in page data ([03bb09f](https://github.com/vuepress/vuepress-next/commit/03bb09fd51aeaff56d26820a1401b87ea8bdeb38))
76
-
77
-
78
-
79
-
80
-
81
- # [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)
82
-
83
- **Note:** Version bump only for package @vuepress/shared
84
-
85
-
86
-
87
-
88
-
89
- # [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)
90
-
91
-
92
- ### Features
93
-
94
- * **shared:** optimize frontmatter type and support generics ([8a7025f](https://github.com/vuepress/vuepress-next/commit/8a7025ff39b4656f98f9a35e93848373ce72ddbe))
95
-
96
-
97
-
98
-
99
-
100
- # [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)
101
-
102
-
103
- ### Bug Fixes
104
-
105
- * **core:** fix site locale data type ([7898500](https://github.com/vuepress/vuepress-next/commit/7898500f8b611662777ca3bdeb89c5b3bb658595))
106
-
107
-
108
-
109
-
110
-
111
- # [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)
112
-
113
- **Note:** Version bump only for package @vuepress/shared
114
-
115
-
116
-
117
-
118
-
119
- # [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)
120
-
121
- **Note:** Version bump only for package @vuepress/shared
122
-
123
-
124
-
125
-
126
-
127
- # [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)
128
-
129
-
130
- ### Features
131
-
132
- * **shared:** add esm build ([f8463e7](https://github.com/vuepress/vuepress-next/commit/f8463e791c909493e343d98468663c9d31bcbb5f))
133
-
134
-
135
-
136
-
137
-
138
- # 2.0.0-alpha.1 (2020-12-01)
139
-
140
-
141
- ### Bug Fixes
142
-
143
- * **shared:** missing type inference for resolveLocaleConfigItem ([3e230fd](https://github.com/vuepress/vuepress-next/commit/3e230fd72020ba2e2e9d9c0fef90f035410c184f))
144
- * **shared:** remove title from ssr context ([6eddf75](https://github.com/vuepress/vuepress-next/commit/6eddf75ea14cac471d93fcfbee2df03c1089ac58))
145
-
146
-
147
- ### Features
148
-
149
- * **shared:** add children field in page header ([6f29d05](https://github.com/vuepress/vuepress-next/commit/6f29d05e6103d172ffe9263ff964c45afd82a4c1))
150
- * **shared:** add head utils ([f020af0](https://github.com/vuepress/vuepress-next/commit/f020af0d6abcb5505692e9ecd3ae16d8b846008f))
151
- * **shared:** add htmlUnescape and htmlEscape utils ([5e55f95](https://github.com/vuepress/vuepress-next/commit/5e55f95bcfd0b039ca1f4398f8d064af9fe4223a))
152
- * **shared:** add isLinkAbsolute and isLinkHttp utils ([bbe8e99](https://github.com/vuepress/vuepress-next/commit/bbe8e995d2f93ff9d8919d699be81d429e0d6abd))
153
- * **shared:** add link utils ([59e8fd5](https://github.com/vuepress/vuepress-next/commit/59e8fd521a92dc5ed4e1ea5d313dac40b46e7a90))
154
- * **shared:** add resolveRoutePathFromUrl util ([460f39b](https://github.com/vuepress/vuepress-next/commit/460f39ba26cda4601b02fc8c0437a88a36d6dd59))
155
- * **shared:** add utils to resolve locale data ([4d5ccd5](https://github.com/vuepress/vuepress-next/commit/4d5ccd56cac166bd76260b3ba3aedac562deead2))
156
- * **shared:** expose isPlainObject util ([1558de3](https://github.com/vuepress/vuepress-next/commit/1558de3248f12f2a2508bfb5ebbe53ca26c466cb))
157
- * **shared:** extract locale path util ([54b747c](https://github.com/vuepress/vuepress-next/commit/54b747c96e6c81f1af289317e7b80c5daff6f517))
158
- * **shared:** make PageData type extendable ([aacbecc](https://github.com/vuepress/vuepress-next/commit/aacbeccb26ff7d58776678faffdc8fdabcaf36c3))
159
- * **shared:** migrate isPlainObject with generics support ([fb1f7c3](https://github.com/vuepress/vuepress-next/commit/fb1f7c301514759a63443b19b5d62362d098fde7))
160
- * **shared:** optimize type definitions and remove resolveSiteLocaleData ([e1d58f6](https://github.com/vuepress/vuepress-next/commit/e1d58f6f3e40458e03e660e15ffc10e7e3acc7f5))
@@ -1,2 +0,0 @@
1
- export * from './types';
2
- export * from './utils';
package/lib/esm/index.js DELETED
@@ -1,2 +0,0 @@
1
- export * from './types';
2
- export * from './utils';
@@ -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>;