@vuepress/utils 2.0.0-rc.23 → 2.0.0-rc.25
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.d.ts +14 -12
- package/dist/index.js +20 -17
- package/package.json +9 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { default as debug } from 'debug';
|
|
2
2
|
export { default as fs } from 'fs-extra';
|
|
3
|
-
export { globby } from 'globby';
|
|
4
3
|
export { default as hash } from 'hash-sum';
|
|
5
4
|
import { Ora } from 'ora';
|
|
6
5
|
export { default as ora } from 'ora';
|
|
7
6
|
export { default as colors } from 'picocolors';
|
|
7
|
+
export { default as picomatch } from 'picomatch';
|
|
8
|
+
import * as tinyglobby from 'tinyglobby';
|
|
9
|
+
export { tinyglobby };
|
|
8
10
|
export { default as path } from 'upath';
|
|
9
11
|
import { HeadConfig, HeadAttrsConfig } from '@vuepress/shared';
|
|
10
12
|
|
|
@@ -69,16 +71,16 @@ declare const renderHeadAttrs: (attrs: HeadAttrsConfig) => string;
|
|
|
69
71
|
/**
|
|
70
72
|
* HTML outlets of the template renderer
|
|
71
73
|
*/
|
|
72
|
-
declare
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
74
|
+
declare enum TemplateRendererOutlet {
|
|
75
|
+
Content = "<!--vuepress-ssr-content-->",
|
|
76
|
+
Head = "<!--vuepress-ssr-head-->",
|
|
77
|
+
Lang = "{{ lang }}",
|
|
78
|
+
Prefetch = "<!--vuepress-ssr-prefetch-->",
|
|
79
|
+
Preload = "<!--vuepress-ssr-preload-->",
|
|
80
|
+
Scripts = "<!--vuepress-ssr-scripts-->",
|
|
81
|
+
Styles = "<!--vuepress-ssr-styles-->",
|
|
82
|
+
Version = "{{ version }}"
|
|
83
|
+
}
|
|
82
84
|
/**
|
|
83
85
|
* Context type of the template renderer
|
|
84
86
|
*/
|
|
@@ -125,4 +127,4 @@ type TemplateRenderer = (template: string, context: TemplateRendererContext) =>
|
|
|
125
127
|
*/
|
|
126
128
|
declare const templateRenderer: TemplateRenderer;
|
|
127
129
|
|
|
128
|
-
export {
|
|
130
|
+
export { type TemplateRenderer, type TemplateRendererContext, TemplateRendererOutlet, createError, error, formatMs, getDirname, importFile, importFileDefault, info, isChildPath, logger, renderHead, renderHeadAttrs, sanitizeFileName, success, templateRenderer, tip, transformPathToFileName, warn, withSpinner };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import debug from "debug";
|
|
3
3
|
import fs from "fs-extra";
|
|
4
|
-
import { globby } from "globby";
|
|
5
4
|
import hash from "hash-sum";
|
|
6
5
|
import ora2 from "ora";
|
|
7
6
|
import colors2 from "picocolors";
|
|
7
|
+
import picomatch from "picomatch";
|
|
8
|
+
import * as tinyglobby from "tinyglobby";
|
|
8
9
|
import path3 from "upath";
|
|
9
10
|
|
|
10
11
|
// src/console/formatMs.ts
|
|
@@ -44,7 +45,7 @@ var logger = {
|
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
// src/console/withSpinner.ts
|
|
47
|
-
import process from "
|
|
48
|
+
import process from "process";
|
|
48
49
|
import ora from "ora";
|
|
49
50
|
var withSpinner = (msg) => async (target) => {
|
|
50
51
|
if (process.env.DEBUG) {
|
|
@@ -64,12 +65,12 @@ var withSpinner = (msg) => async (target) => {
|
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
// src/module/getDirname.ts
|
|
67
|
-
import { fileURLToPath } from "
|
|
68
|
+
import { fileURLToPath } from "url";
|
|
68
69
|
import path from "upath";
|
|
69
70
|
var getDirname = (importMetaUrl) => path.dirname(fileURLToPath(importMetaUrl));
|
|
70
71
|
|
|
71
72
|
// src/module/importFile.ts
|
|
72
|
-
import { pathToFileURL } from "
|
|
73
|
+
import { pathToFileURL } from "url";
|
|
73
74
|
var importFile = async (filePath) => import(pathToFileURL(filePath).toString());
|
|
74
75
|
var importFileDefault = async (filePath) => importFile(filePath).then((m) => m.default);
|
|
75
76
|
|
|
@@ -115,19 +116,20 @@ var renderHead = ([
|
|
|
115
116
|
};
|
|
116
117
|
|
|
117
118
|
// src/ssr/templateRenderer.ts
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
var TemplateRendererOutlet = /* @__PURE__ */ ((TemplateRendererOutlet2) => {
|
|
120
|
+
TemplateRendererOutlet2["Content"] = "<!--vuepress-ssr-content-->";
|
|
121
|
+
TemplateRendererOutlet2["Head"] = "<!--vuepress-ssr-head-->";
|
|
122
|
+
TemplateRendererOutlet2["Lang"] = "{{ lang }}";
|
|
123
|
+
TemplateRendererOutlet2["Prefetch"] = "<!--vuepress-ssr-prefetch-->";
|
|
124
|
+
TemplateRendererOutlet2["Preload"] = "<!--vuepress-ssr-preload-->";
|
|
125
|
+
TemplateRendererOutlet2["Scripts"] = "<!--vuepress-ssr-scripts-->";
|
|
126
|
+
TemplateRendererOutlet2["Styles"] = "<!--vuepress-ssr-styles-->";
|
|
127
|
+
TemplateRendererOutlet2["Version"] = "{{ version }}";
|
|
128
|
+
return TemplateRendererOutlet2;
|
|
129
|
+
})(TemplateRendererOutlet || {});
|
|
130
|
+
var templateRenderer = (template, { content, head, lang, prefetch, preload, scripts, styles, version }) => template.replace("<!--vuepress-ssr-content-->" /* Content */, () => content).replace("<!--vuepress-ssr-head-->" /* Head */, head).replace("{{ lang }}" /* Lang */, lang).replace("<!--vuepress-ssr-prefetch-->" /* Prefetch */, prefetch).replace("<!--vuepress-ssr-preload-->" /* Preload */, preload).replace("<!--vuepress-ssr-scripts-->" /* Scripts */, scripts).replace("<!--vuepress-ssr-styles-->" /* Styles */, styles).replace("{{ version }}" /* Version */, version);
|
|
129
131
|
export {
|
|
130
|
-
|
|
132
|
+
TemplateRendererOutlet,
|
|
131
133
|
colors2 as colors,
|
|
132
134
|
createError,
|
|
133
135
|
debug,
|
|
@@ -135,7 +137,6 @@ export {
|
|
|
135
137
|
formatMs,
|
|
136
138
|
fs,
|
|
137
139
|
getDirname,
|
|
138
|
-
globby,
|
|
139
140
|
hash,
|
|
140
141
|
importFile,
|
|
141
142
|
importFileDefault,
|
|
@@ -144,11 +145,13 @@ export {
|
|
|
144
145
|
logger,
|
|
145
146
|
ora2 as ora,
|
|
146
147
|
path3 as path,
|
|
148
|
+
picomatch,
|
|
147
149
|
renderHead,
|
|
148
150
|
renderHeadAttrs,
|
|
149
151
|
sanitizeFileName,
|
|
150
152
|
success,
|
|
151
153
|
templateRenderer,
|
|
154
|
+
tinyglobby,
|
|
152
155
|
tip,
|
|
153
156
|
transformPathToFileName,
|
|
154
157
|
warn,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/utils",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.25",
|
|
4
4
|
"description": "Utils package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"./package.json": "./package.json"
|
|
23
23
|
},
|
|
24
24
|
"main": "./dist/index.js",
|
|
25
|
+
"module": "./dist/index.js",
|
|
25
26
|
"types": "./dist/index.d.ts",
|
|
26
27
|
"files": [
|
|
27
28
|
"dist"
|
|
@@ -30,14 +31,16 @@
|
|
|
30
31
|
"@types/debug": "^4.1.12",
|
|
31
32
|
"@types/fs-extra": "^11.0.4",
|
|
32
33
|
"@types/hash-sum": "^1.0.2",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
34
|
+
"@types/picomatch": "^4.0.2",
|
|
35
|
+
"debug": "^4.4.1",
|
|
36
|
+
"fs-extra": "^11.3.1",
|
|
36
37
|
"hash-sum": "^2.0.0",
|
|
37
38
|
"ora": "^8.2.0",
|
|
38
39
|
"picocolors": "^1.1.1",
|
|
40
|
+
"picomatch": "^4.0.3",
|
|
41
|
+
"tinyglobby": "^0.2.14",
|
|
39
42
|
"upath": "^2.0.1",
|
|
40
|
-
"@vuepress/shared": "2.0.0-rc.
|
|
43
|
+
"@vuepress/shared": "2.0.0-rc.25"
|
|
41
44
|
},
|
|
42
45
|
"publishConfig": {
|
|
43
46
|
"access": "public"
|
|
@@ -53,7 +56,7 @@
|
|
|
53
56
|
],
|
|
54
57
|
"outDir": "./dist",
|
|
55
58
|
"sourcemap": false,
|
|
56
|
-
"target": "
|
|
59
|
+
"target": "es2023",
|
|
57
60
|
"tsconfig": "../../tsconfig.dts.json"
|
|
58
61
|
},
|
|
59
62
|
"scripts": {
|