@vuepress/utils 2.0.0-beta.53 → 2.0.0-beta.54
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 +4 -2
- package/dist/index.js +17 -8
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { default as chalk } from 'chalk';
|
|
2
1
|
export { default as debug } from 'debug';
|
|
3
2
|
export { default as fs } from 'fs-extra';
|
|
4
3
|
export { globby } from 'globby';
|
|
5
4
|
export { default as hash } from 'hash-sum';
|
|
6
5
|
import { Ora } from 'ora';
|
|
7
6
|
export { default as ora } from 'ora';
|
|
7
|
+
export { default as colors } from 'picocolors';
|
|
8
8
|
export { default as path } from 'upath';
|
|
9
9
|
import { HeadConfig, HeadAttrsConfig } from '@vuepress/shared';
|
|
10
10
|
|
|
@@ -57,6 +57,8 @@ declare const renderHead: ([tag, attrs, innerHTML,]: HeadConfig) => string;
|
|
|
57
57
|
*/
|
|
58
58
|
declare const renderHeadAttrs: (attrs: HeadAttrsConfig) => string;
|
|
59
59
|
|
|
60
|
+
declare const sanitizeFileName: (name: string) => string;
|
|
61
|
+
|
|
60
62
|
declare const withSpinner: (msg: string) => <T>(target: (spinner?: Ora) => Promise<T>) => Promise<T>;
|
|
61
63
|
|
|
62
|
-
export { createError, error, formatMs, getDirname, importFile, importFileDefault, info, isChildPath, logger, renderHead, renderHeadAttrs, success, tip, warn, withSpinner };
|
|
64
|
+
export { createError, error, formatMs, getDirname, importFile, importFileDefault, info, isChildPath, logger, renderHead, renderHeadAttrs, sanitizeFileName, success, tip, warn, withSpinner };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import chalk2 from "chalk";
|
|
3
2
|
import debug from "debug";
|
|
4
3
|
import fs from "fs-extra";
|
|
5
4
|
import { globby } from "globby";
|
|
6
5
|
import hash from "hash-sum";
|
|
7
6
|
import ora2 from "ora";
|
|
7
|
+
import colors2 from "picocolors";
|
|
8
8
|
import path3 from "upath";
|
|
9
9
|
|
|
10
10
|
// src/getDirname.ts
|
|
@@ -37,21 +37,21 @@ var isChildPath = (child, parent) => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
// src/logger.ts
|
|
40
|
-
import
|
|
40
|
+
import colors from "picocolors";
|
|
41
41
|
var info = (...args) => {
|
|
42
|
-
console.log(
|
|
42
|
+
console.log(colors.cyan("info"), ...args);
|
|
43
43
|
};
|
|
44
44
|
var tip = (...args) => {
|
|
45
|
-
console.log(
|
|
45
|
+
console.log(colors.blue("tip"), ...args);
|
|
46
46
|
};
|
|
47
47
|
var success = (...args) => {
|
|
48
|
-
console.log(
|
|
48
|
+
console.log(colors.green("success"), ...args);
|
|
49
49
|
};
|
|
50
50
|
var warn = (...args) => {
|
|
51
|
-
console.warn(
|
|
51
|
+
console.warn(colors.yellow("warning"), ...args);
|
|
52
52
|
};
|
|
53
53
|
var error = (...args) => {
|
|
54
|
-
console.error(
|
|
54
|
+
console.error(colors.red("error"), ...args);
|
|
55
55
|
};
|
|
56
56
|
var createError = (message) => {
|
|
57
57
|
error(message);
|
|
@@ -84,6 +84,14 @@ var renderHead = ([
|
|
|
84
84
|
return `${openTag}${innerHTML}</${tag}>`;
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
+
// src/sanitizeFileName.ts
|
|
88
|
+
var INVALID_CHAR_REGEX = /[\x00-\x1F\x7F<>*#"{}|^[\]`;?:&=+$,]/g;
|
|
89
|
+
var DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
|
90
|
+
var sanitizeFileName = (name) => {
|
|
91
|
+
const driveLetter = DRIVE_LETTER_REGEX.exec(name)?.[0] || "";
|
|
92
|
+
return driveLetter + name.substring(driveLetter.length).replace(INVALID_CHAR_REGEX, "_").replace(/^_+/, "");
|
|
93
|
+
};
|
|
94
|
+
|
|
87
95
|
// src/withSpinner.ts
|
|
88
96
|
import process from "process";
|
|
89
97
|
import ora from "ora";
|
|
@@ -104,7 +112,7 @@ var withSpinner = (msg) => async (target) => {
|
|
|
104
112
|
}
|
|
105
113
|
};
|
|
106
114
|
export {
|
|
107
|
-
|
|
115
|
+
colors2 as colors,
|
|
108
116
|
createError,
|
|
109
117
|
debug,
|
|
110
118
|
error,
|
|
@@ -122,6 +130,7 @@ export {
|
|
|
122
130
|
path3 as path,
|
|
123
131
|
renderHead,
|
|
124
132
|
renderHeadAttrs,
|
|
133
|
+
sanitizeFileName,
|
|
125
134
|
success,
|
|
126
135
|
tip,
|
|
127
136
|
warn,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuepress/utils",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.54",
|
|
4
4
|
"description": "Utils package of VuePress",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vuepress",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"@types/debug": "^4.1.7",
|
|
31
31
|
"@types/fs-extra": "^9.0.13",
|
|
32
32
|
"@types/hash-sum": "^1.0.0",
|
|
33
|
-
"@vuepress/shared": "2.0.0-beta.53",
|
|
34
|
-
"chalk": "^5.1.2",
|
|
35
33
|
"debug": "^4.3.4",
|
|
36
|
-
"fs-extra": "^
|
|
34
|
+
"fs-extra": "^11.1.0",
|
|
37
35
|
"globby": "^13.1.2",
|
|
38
36
|
"hash-sum": "^2.0.0",
|
|
39
37
|
"ora": "^6.1.2",
|
|
40
|
-
"
|
|
38
|
+
"picocolors": "^1.0.0",
|
|
39
|
+
"upath": "^2.0.1",
|
|
40
|
+
"@vuepress/shared": "2.0.0-beta.54"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|