@vuepress/utils 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.
@@ -5,7 +5,7 @@ const shared_1 = require("@vuepress/shared");
5
5
  /**
6
6
  * Check if a module is esm with `export default`
7
7
  */
8
- const hasExportDefault = (mod) => shared_1.isPlainObject(mod) &&
8
+ const hasExportDefault = (mod) => (0, shared_1.isPlainObject)(mod) &&
9
9
  !!mod.__esModule &&
10
10
  Object.prototype.hasOwnProperty.call(mod, 'default');
11
11
  exports.hasExportDefault = hasExportDefault;
package/lib/hash.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const hash: (val: unknown) => string;
package/lib/hash.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hash = void 0;
4
+ const hashSum = require("hash-sum");
5
+ exports.hash = hashSum;
package/lib/index.d.ts CHANGED
@@ -1,14 +1,13 @@
1
- import * as debug from 'debug';
2
1
  import * as chalk from 'chalk';
3
- import * as fs from 'fs-extra';
2
+ import * as debug from 'debug';
4
3
  import * as globby from 'globby';
5
4
  import * as ora from 'ora';
6
- import * as path from 'upath';
7
- import hash = require('hash-sum');
8
- export { debug, chalk, fs, globby, hash, ora, path };
5
+ export { debug, chalk, globby, ora };
6
+ export * as fs from 'fs-extra';
7
+ export * as path from 'upath';
9
8
  export * from './hasExportDefault';
9
+ export * from './hash';
10
10
  export * from './logger';
11
11
  export * from './renderHead';
12
12
  export * from './renderHeadAttrs';
13
- export * from './requireResolve';
14
13
  export * from './withSpinner';
package/lib/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -10,24 +14,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
15
  };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.path = exports.ora = exports.hash = exports.globby = exports.fs = exports.chalk = exports.debug = void 0;
14
- const debug = require("debug");
15
- exports.debug = debug;
17
+ exports.path = exports.fs = exports.ora = exports.globby = exports.chalk = exports.debug = void 0;
16
18
  const chalk = require("chalk");
17
19
  exports.chalk = chalk;
18
- const fs = require("fs-extra");
19
- exports.fs = fs;
20
+ const debug = require("debug");
21
+ exports.debug = debug;
20
22
  const globby = require("globby");
21
23
  exports.globby = globby;
22
24
  const ora = require("ora");
23
25
  exports.ora = ora;
24
- const path = require("upath");
25
- exports.path = path;
26
- const hash = require("hash-sum");
27
- exports.hash = hash;
26
+ exports.fs = require("fs-extra");
27
+ exports.path = require("upath");
28
28
  __exportStar(require("./hasExportDefault"), exports);
29
+ __exportStar(require("./hash"), exports);
29
30
  __exportStar(require("./logger"), exports);
30
31
  __exportStar(require("./renderHead"), exports);
31
32
  __exportStar(require("./renderHeadAttrs"), exports);
32
- __exportStar(require("./requireResolve"), exports);
33
33
  __exportStar(require("./withSpinner"), exports);
package/lib/logger.d.ts CHANGED
@@ -3,10 +3,12 @@ export declare const tip: (...args: any[]) => void;
3
3
  export declare const success: (...args: any[]) => void;
4
4
  export declare const warn: (...args: any[]) => void;
5
5
  export declare const error: (...args: any[]) => void;
6
+ export declare const createError: (message?: string | undefined) => Error;
6
7
  export declare const logger: {
7
8
  info: (...args: any[]) => void;
8
9
  tip: (...args: any[]) => void;
9
10
  success: (...args: any[]) => void;
10
11
  warn: (...args: any[]) => void;
11
12
  error: (...args: any[]) => void;
13
+ createError: (message?: string | undefined) => Error;
12
14
  };
package/lib/logger.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logger = exports.error = exports.warn = exports.success = exports.tip = exports.info = void 0;
3
+ exports.logger = exports.createError = exports.error = exports.warn = exports.success = exports.tip = exports.info = void 0;
4
4
  const chalk = require("chalk");
5
5
  const info = (...args) => {
6
6
  console.log(chalk.cyan('info'), ...args);
@@ -22,10 +22,16 @@ const error = (...args) => {
22
22
  console.error(chalk.red('error'), ...args);
23
23
  };
24
24
  exports.error = error;
25
+ const createError = (message) => {
26
+ (0, exports.error)(message);
27
+ return new Error(message);
28
+ };
29
+ exports.createError = createError;
25
30
  exports.logger = {
26
31
  info: exports.info,
27
32
  tip: exports.tip,
28
33
  success: exports.success,
29
34
  warn: exports.warn,
30
35
  error: exports.error,
36
+ createError: exports.createError,
31
37
  };
package/lib/renderHead.js CHANGED
@@ -6,7 +6,7 @@ const renderHeadAttrs_1 = require("./renderHeadAttrs");
6
6
  * Render head config to string
7
7
  */
8
8
  const renderHead = ([tag, attrs, innerHTML = '',]) => {
9
- const openTag = `<${tag}${renderHeadAttrs_1.renderHeadAttrs(attrs)}>`;
9
+ const openTag = `<${tag}${(0, renderHeadAttrs_1.renderHeadAttrs)(attrs)}>`;
10
10
  if (tag === 'link' || tag === 'meta' || tag === 'base') {
11
11
  return openTag;
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/utils",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.42",
4
4
  "description": "Utils package of VuePress",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -15,31 +15,29 @@
15
15
  "url": "git+https://github.com/vuepress/vuepress-next.git"
16
16
  },
17
17
  "license": "MIT",
18
- "author": "Evan You",
18
+ "author": "meteorlxy",
19
19
  "main": "lib/index.js",
20
20
  "types": "lib/index.d.ts",
21
21
  "files": [
22
22
  "lib"
23
23
  ],
24
- "scripts": {
25
- "build": "tsc -b tsconfig.build.json",
26
- "clean": "rimraf lib *.tsbuildinfo"
27
- },
28
24
  "dependencies": {
29
- "@types/debug": "^4.1.5",
30
- "@types/fs-extra": "^9.0.8",
31
- "@types/hash-sum": "^1.0.0",
32
- "@vuepress/shared": "2.0.0-beta.4",
33
- "chalk": "^4.1.0",
34
- "debug": "^4.3.1",
35
- "fs-extra": "^9.1.0",
36
- "globby": "^11.0.2",
25
+ "@types/debug": "^4.1.7",
26
+ "@types/fs-extra": "^9.0.13",
27
+ "@vuepress/shared": "2.0.0-beta.42",
28
+ "chalk": "^4.1.2",
29
+ "debug": "^4.3.4",
30
+ "fs-extra": "^10.0.1",
31
+ "globby": "^11.0.4",
37
32
  "hash-sum": "^2.0.0",
38
- "ora": "^5.3.0",
33
+ "ora": "^5.4.1",
39
34
  "upath": "^2.0.1"
40
35
  },
41
36
  "publishConfig": {
42
37
  "access": "public"
43
38
  },
44
- "gitHead": "d42716e1b5b682ffb5d7cf124d0a24344493c467"
45
- }
39
+ "scripts": {
40
+ "build": "tsc -b tsconfig.build.json",
41
+ "clean": "rimraf lib *.tsbuildinfo"
42
+ }
43
+ }
package/CHANGELOG.md DELETED
@@ -1,121 +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/utils
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/utils
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/utils
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
- **Note:** Version bump only for package @vuepress/utils
33
-
34
-
35
-
36
-
37
-
38
- # [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)
39
-
40
- **Note:** Version bump only for package @vuepress/utils
41
-
42
-
43
-
44
-
45
-
46
- # [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)
47
-
48
- **Note:** Version bump only for package @vuepress/utils
49
-
50
-
51
-
52
-
53
-
54
- # [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)
55
-
56
- **Note:** Version bump only for package @vuepress/utils
57
-
58
-
59
-
60
-
61
-
62
- # [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)
63
-
64
- **Note:** Version bump only for package @vuepress/utils
65
-
66
-
67
-
68
-
69
-
70
- # [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)
71
-
72
- **Note:** Version bump only for package @vuepress/utils
73
-
74
-
75
-
76
-
77
-
78
- # [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)
79
-
80
- **Note:** Version bump only for package @vuepress/utils
81
-
82
-
83
-
84
-
85
-
86
- # [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)
87
-
88
- **Note:** Version bump only for package @vuepress/utils
89
-
90
-
91
-
92
-
93
-
94
- # [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)
95
-
96
- **Note:** Version bump only for package @vuepress/utils
97
-
98
-
99
-
100
-
101
-
102
- # [2.0.0-alpha.4](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2020-12-02)
103
-
104
-
105
- ### Features
106
-
107
- * **utils:** add hasExportDefault util ([575a9c5](https://github.com/vuepress/vuepress-next/commit/575a9c5d9eee44c0ce20b0712830e2eb2a303780))
108
-
109
-
110
-
111
-
112
-
113
- # 2.0.0-alpha.1 (2020-12-01)
114
-
115
-
116
- ### Features
117
-
118
- * **utils:** add logger and debug utils ([203d58d](https://github.com/vuepress/vuepress-next/commit/203d58d8d97c6a3158d4a783188ce2b64e54f19c))
119
- * **utils:** add ora util ([f67b4d3](https://github.com/vuepress/vuepress-next/commit/f67b4d3f62fee077f947362c975c08c81470b0b0))
120
- * **utils:** add withSpinner util ([82c6bb5](https://github.com/vuepress/vuepress-next/commit/82c6bb5d3e3a76088ee286fc10dabd9da4d59b22))
121
- * **utils:** disable withSpinner if DEBUG env is set ([af19507](https://github.com/vuepress/vuepress-next/commit/af1950784fb17c258a4c07dbaf7439cf0ec2c762))
@@ -1,7 +0,0 @@
1
- /**
2
- * Wrapper of `require.resolve` of nodejs
3
- *
4
- * Return `null` if the module cannot be resolved
5
- * instead of throwing an error
6
- */
7
- export declare const requireResolve: (request: string) => string | null;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.requireResolve = void 0;
4
- /**
5
- * Wrapper of `require.resolve` of nodejs
6
- *
7
- * Return `null` if the module cannot be resolved
8
- * instead of throwing an error
9
- */
10
- const requireResolve = (request) => {
11
- try {
12
- return require.resolve(request);
13
- }
14
- catch (_a) {
15
- return null;
16
- }
17
- };
18
- exports.requireResolve = requireResolve;