@vuepress/utils 2.0.0-rc.0 → 2.0.0-rc.10

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/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/utils
2
+
3
+ [![npm](https://badgen.net/npm/v/@vuepress/utils/next)](https://www.npmjs.com/package/@vuepress/utils)
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)
package/dist/index.d.ts CHANGED
@@ -51,6 +51,11 @@ declare const isChildPath: (child: string, parent: string) => boolean;
51
51
 
52
52
  declare const sanitizeFileName: (name: string) => string;
53
53
 
54
+ /**
55
+ * Transforms a path to a file name, replacing slashes with underscores
56
+ */
57
+ declare const transformPathToFileName: (rawPath: string) => string;
58
+
54
59
  /**
55
60
  * Render head config to string
56
61
  */
@@ -120,4 +125,4 @@ type TemplateRenderer = (template: string, context: TemplateRendererContext) =>
120
125
  */
121
126
  declare const templateRenderer: TemplateRenderer;
122
127
 
123
- export { TEMPLATE_RENDERER_OUTLETS, TemplateRenderer, TemplateRendererContext, createError, error, formatMs, getDirname, importFile, importFileDefault, info, isChildPath, logger, renderHead, renderHeadAttrs, sanitizeFileName, success, templateRenderer, tip, warn, withSpinner };
128
+ export { TEMPLATE_RENDERER_OUTLETS, type TemplateRenderer, type TemplateRendererContext, createError, error, formatMs, getDirname, importFile, importFileDefault, info, isChildPath, logger, renderHead, renderHeadAttrs, sanitizeFileName, success, templateRenderer, tip, transformPathToFileName, warn, withSpinner };
package/dist/index.js CHANGED
@@ -94,6 +94,9 @@ var sanitizeFileName = (name) => {
94
94
  return driveLetter + name.substring(driveLetter.length).replace(INVALID_CHAR_REGEX, "_").replace(/^_+/, "");
95
95
  };
96
96
 
97
+ // src/module/transformPathToFileName.ts
98
+ var transformPathToFileName = (rawPath) => sanitizeFileName(rawPath.replace(/\//g, "_"));
99
+
97
100
  // src/ssr/renderHeadAttrs.ts
98
101
  var renderHeadAttrs = (attrs) => Object.entries(attrs).filter((item) => item[1] !== false).map(
99
102
  ([key, value]) => value === true ? ` ${key}` : ` ${key}="${attrs[key]}"`
@@ -148,6 +151,7 @@ export {
148
151
  success,
149
152
  templateRenderer,
150
153
  tip,
154
+ transformPathToFileName,
151
155
  warn,
152
156
  withSpinner
153
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuepress/utils",
3
- "version": "2.0.0-rc.0",
3
+ "version": "2.0.0-rc.10",
4
4
  "description": "Utils package of VuePress",
5
5
  "keywords": [
6
6
  "vuepress",
@@ -8,11 +8,11 @@
8
8
  ],
9
9
  "homepage": "https://github.com/vuepress",
10
10
  "bugs": {
11
- "url": "https://github.com/vuepress/vuepress-next/issues"
11
+ "url": "https://github.com/vuepress/core/issues"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",
15
- "url": "git+https://github.com/vuepress/vuepress-next.git"
15
+ "url": "git+https://github.com/vuepress/core.git"
16
16
  },
17
17
  "license": "MIT",
18
18
  "author": "meteorlxy",
@@ -31,13 +31,13 @@
31
31
  "@types/fs-extra": "^11.0.4",
32
32
  "@types/hash-sum": "^1.0.2",
33
33
  "debug": "^4.3.4",
34
- "fs-extra": "^11.1.1",
35
- "globby": "^14.0.0",
34
+ "fs-extra": "^11.2.0",
35
+ "globby": "^14.0.1",
36
36
  "hash-sum": "^2.0.0",
37
- "ora": "^7.0.1",
38
- "picocolors": "^1.0.0",
37
+ "ora": "^8.0.1",
38
+ "picocolors": "^1.0.1",
39
39
  "upath": "^2.0.1",
40
- "@vuepress/shared": "2.0.0-rc.0"
40
+ "@vuepress/shared": "2.0.0-rc.10"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"
@@ -54,7 +54,7 @@
54
54
  "outDir": "./dist",
55
55
  "sourcemap": false,
56
56
  "target": "es2022",
57
- "tsconfig": "../tsconfig.dts.json"
57
+ "tsconfig": "../../tsconfig.dts.json"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsup",