@blocklet/meta 1.16.5 → 1.16.6-beta-8be2fe37
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/lib/url-path-friendly.d.ts +1 -4
- package/lib/url-path-friendly.js +3 -34
- package/package.json +14 -15
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const urlPathFriendly: (name: string, { keepSlash }?: {
|
|
3
|
-
keepSlash: boolean;
|
|
4
|
-
}) => string;
|
|
1
|
+
import { urlPathFriendly, isValidUrlPath } from '@abtnode/util/lib/url-path-friendly';
|
|
5
2
|
export { isValidUrlPath };
|
|
6
3
|
export default urlPathFriendly;
|
package/lib/url-path-friendly.js
CHANGED
|
@@ -1,37 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isValidUrlPath = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
// Check if the path contains any non-ASCII characters
|
|
10
|
-
if (/[^\x20-\x7F]/.test(name)) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
// Check if the resulting string matches the pattern of a valid URL path
|
|
14
|
-
const regex = /^[a-z0-9/\-._]*$/i;
|
|
15
|
-
return regex.test(name) && !name.includes('//');
|
|
16
|
-
};
|
|
17
|
-
exports.isValidUrlPath = isValidUrlPath;
|
|
18
|
-
const urlPathFriendly = (name, { keepSlash = true } = { keepSlash: true }) => {
|
|
19
|
-
// Replace non-URL path friendly characters with hyphens
|
|
20
|
-
const pathFriendlyStr = name
|
|
21
|
-
.trim()
|
|
22
|
-
.replace(/[^\x20-\x7F]/g, '')
|
|
23
|
-
.replace(/[^a-z0-9_.\-/]/gi, '-')
|
|
24
|
-
.toLowerCase();
|
|
25
|
-
// Remove consecutive hyphens
|
|
26
|
-
const noConsecutiveHyphens = pathFriendlyStr.replace(/-+/g, '-');
|
|
27
|
-
// Replace consecutive periods with a single period
|
|
28
|
-
const result = noConsecutiveHyphens.replace(/\.+/g, '.');
|
|
29
|
-
// Remove consecutive slashes if keepSlash is true
|
|
30
|
-
const noConsecutiveSlashes = result.replace(/\/+/g, '/');
|
|
31
|
-
// Remove leading/trailing slashes if keepSlash is false
|
|
32
|
-
if (!keepSlash) {
|
|
33
|
-
return noConsecutiveSlashes.replace(/^\/|\/$/g, '');
|
|
34
|
-
}
|
|
35
|
-
return noConsecutiveSlashes;
|
|
36
|
-
};
|
|
37
|
-
exports.default = urlPathFriendly;
|
|
4
|
+
const url_path_friendly_1 = require("@abtnode/util/lib/url-path-friendly");
|
|
5
|
+
Object.defineProperty(exports, "isValidUrlPath", { enumerable: true, get: function () { return url_path_friendly_1.isValidUrlPath; } });
|
|
6
|
+
exports.default = url_path_friendly_1.urlPathFriendly;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.
|
|
6
|
+
"version": "1.16.6-beta-8be2fe37",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -24,19 +24,18 @@
|
|
|
24
24
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@abtnode/
|
|
28
|
-
"@abtnode/
|
|
29
|
-
"@
|
|
30
|
-
"@arcblock/did": "1.18.
|
|
31
|
-
"@arcblock/did-
|
|
32
|
-
"@arcblock/
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@ocap/
|
|
36
|
-
"@ocap/
|
|
37
|
-
"@ocap/
|
|
38
|
-
"@ocap/
|
|
39
|
-
"@ocap/wallet": "1.18.68",
|
|
27
|
+
"@abtnode/constant": "1.16.6-beta-8be2fe37",
|
|
28
|
+
"@abtnode/util": "1.16.6-beta-8be2fe37",
|
|
29
|
+
"@arcblock/did": "1.18.71",
|
|
30
|
+
"@arcblock/did-ext": "1.18.71",
|
|
31
|
+
"@arcblock/did-util": "1.18.71",
|
|
32
|
+
"@arcblock/jwt": "1.18.71",
|
|
33
|
+
"@blocklet/constant": "1.16.6-beta-8be2fe37",
|
|
34
|
+
"@ocap/asset": "1.18.71",
|
|
35
|
+
"@ocap/mcrypto": "1.18.71",
|
|
36
|
+
"@ocap/types": "1.18.71",
|
|
37
|
+
"@ocap/util": "1.18.71",
|
|
38
|
+
"@ocap/wallet": "1.18.71",
|
|
40
39
|
"ajv": "^8.11.0",
|
|
41
40
|
"axios": "^0.27.2",
|
|
42
41
|
"cjk-length": "^1.0.0",
|
|
@@ -80,5 +79,5 @@
|
|
|
80
79
|
"ts-node": "^10.9.1",
|
|
81
80
|
"typescript": "^4.8.4"
|
|
82
81
|
},
|
|
83
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "27229a1a62850e95907b7a53e0259a809d99377b"
|
|
84
83
|
}
|