@weapp-tailwindcss/shared 2.0.0 → 2.0.1
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/README.en.md +9 -0
- package/README.md +5 -95
- package/dist/{extractors.mjs → extractors.cjs} +5 -1
- package/dist/extractors.js +1 -5
- package/dist/{index.mjs → index.cjs} +29 -5
- package/dist/index.d.ts +1 -2
- package/dist/index.js +5 -29
- package/dist/node.cjs +24 -0
- package/dist/node.d.ts +0 -1
- package/dist/node.js +9 -458
- package/package.json +12 -13
- package/dist/node.mjs +0 -464
- /package/dist/{chunk-D6vf50IK.js → rolldown-runtime-D6vf50IK.cjs} +0 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @weapp-tailwindcss/shared
|
|
2
|
+
|
|
3
|
+
> English | [简体中文](./README.md)
|
|
4
|
+
|
|
5
|
+
This package is the shared utility layer used by multiple weapp-tailwindcss packages, covering strings, paths, regex helpers, object merging, selector handling, and related primitives.
|
|
6
|
+
|
|
7
|
+
## Website
|
|
8
|
+
|
|
9
|
+
For setup guides, configuration references, and framework examples, see the [official weapp-tailwindcss documentation](https://tw.icebreaker.top).
|
package/README.md
CHANGED
|
@@ -1,99 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
# @weapp-tailwindcss/shared
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> 简体中文 | [English](./README.en.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
</a>
|
|
5
|
+
这个包是 weapp-tailwindcss 多个子包共用的基础工具层,提供字符串、路径、正则、对象合并和选择器处理等通用能力。
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## 官网
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</p>
|
|
13
|
-
|
|
14
|
-
> 简体中文(zh-cn) | [English](./README_en.md)
|
|
15
|
-
|
|
16
|
-

|
|
17
|
-

|
|
18
|
-

|
|
19
|
-
[](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml)
|
|
20
|
-
[](https://codecov.io/gh/sonofmagic/weapp-tailwindcss)
|
|
21
|
-
|
|
22
|
-
> [!NOTE]
|
|
23
|
-
> 降低开发维护成本,提升开发效率的 `小程序` `tailwindcss` 全方面解决方案
|
|
24
|
-
>
|
|
25
|
-
> `weapp-tailwindcss@4.2.x` 现已支持 `uni-app x` 同时构建 `Web`,`小程序`,`安卓`,`IOS`,`鸿蒙`,详见 [**uni-app x 专题**](https://tw.icebreaker.top/docs/uni-app-x)
|
|
26
|
-
|
|
27
|
-
\[[文档地址](https://tw.icebreaker.top)\] \| \[[备用文档地址](https://ice-tw.netlify.app/)\] \| \[[加入技术交流群](https://tw.icebreaker.top/docs/community/group)\]
|
|
28
|
-
|
|
29
|
-
- [特性](#特性)
|
|
30
|
-
- [版本对应](#版本对应)
|
|
31
|
-
- [安装与使用方式](#安装与使用方式)
|
|
32
|
-
- [生态和解决方案](#生态和解决方案)
|
|
33
|
-
- [常见问题](#常见问题)
|
|
34
|
-
- [各个框架的模板](#各个框架的模板)
|
|
35
|
-
- [旧版本迁移指南](#旧版本迁移指南)
|
|
36
|
-
- [配置项参考](#配置项参考)
|
|
37
|
-
- [Contribute](#contribute)
|
|
38
|
-
- [License](#license)
|
|
39
|
-
- [Star History](#star-history)
|
|
40
|
-
- [Related projects](#related-projects)
|
|
41
|
-
- [weapp-vite](#weapp-vite)
|
|
42
|
-
|
|
43
|
-
## 特性
|
|
44
|
-
|
|
45
|
-
| 不仅仅是`webpack` | 主流框架与原生开发支持 |
|
|
46
|
-
| --------------------------------------------------- | ----------------------------------------------- |
|
|
47
|
-
|  |  |
|
|
48
|
-
|
|
49
|
-
核心插件支持 `webpack`/`vite`/`rspack`/`rollup`/`rolldown`/`gulp` 为基底的框架类小程序开发,涵盖了市面上几乎所有的主流的开发框架。
|
|
50
|
-
|
|
51
|
-
也支持直接从各个开发者工具中,直接创建的原生小程序应用。
|
|
52
|
-
|
|
53
|
-
这些插件能够自动识别并精确处理所有 `tailwindcss` 的工具类来适配小程序环境。
|
|
54
|
-
|
|
55
|
-
## 版本对应
|
|
56
|
-
|
|
57
|
-
目前,`weapp-tailwindcss` 的 `5.x` 版本
|
|
58
|
-
|
|
59
|
-
- 支持最新版本的 `tailwindcss v4` 和 `v3`。
|
|
60
|
-
- 支持 `webpack5`、`vite`、`rspack`、`rollup`、`rolldown` 和 `gulp` 这些打包工具,也支持纯 `Nodejs` API 的方式,集成到你自己的构建工具中。
|
|
61
|
-
|
|
62
|
-
> `weapp-tailwindcss@5` 面向 Tailwind CSS v3/v4 和现代构建链路,不再内置 Webpack4、PostCSS7、Tailwind CSS v2 兼容入口。`weapp-tailwindcss@5` 需要 `nodejs` 版本 `^20.19.0 || >=22.12.0`,建议安装 `nodejs` 的 `LTS` 版本,详见 [nodejs/release](https://github.com/nodejs/release)
|
|
63
|
-
|
|
64
|
-
## [安装与使用方式](https://tw.icebreaker.top/docs/quick-start/install)
|
|
65
|
-
|
|
66
|
-
## [生态和解决方案](https://tw.icebreaker.top/docs/community/templates)
|
|
67
|
-
|
|
68
|
-
## [常见问题](https://tw.icebreaker.top/docs/issues/)
|
|
69
|
-
|
|
70
|
-
## [各个框架的模板](https://tw.icebreaker.top/docs/community/templates)
|
|
71
|
-
|
|
72
|
-
## [旧版本迁移指南](https://tw.icebreaker.top/docs/migrations/v2)
|
|
73
|
-
|
|
74
|
-
## [配置项参考](https://tw.icebreaker.top/docs/api/interfaces/UserDefinedOptions)
|
|
75
|
-
|
|
76
|
-
## Contribute
|
|
77
|
-
|
|
78
|
-
我们邀请你来贡献和帮助改进 `weapp-tailwindcss` 💚💚💚
|
|
79
|
-
|
|
80
|
-
以下有几个方式可以参与:
|
|
81
|
-
|
|
82
|
-
- 报告错误:如果您遇到任何错误或问题,请提`issue`并提供完善的错误信息和复现方式。
|
|
83
|
-
- 建议:有增强 `weapp-tailwindcss` 的想法吗?请提 `issue` 来分享您的建议。
|
|
84
|
-
- 文档:如果您对文档有更好的见解或者更棒的修辞方式,欢迎 `pr`。
|
|
85
|
-
- 代码:任何人的代码都不是完美的,我们欢迎你通过 `pr` 给代码提供更好的质量与活力。
|
|
86
|
-
|
|
87
|
-
## License
|
|
88
|
-
|
|
89
|
-
[MIT](./LICENSE)
|
|
90
|
-
|
|
91
|
-
## Star History
|
|
92
|
-
|
|
93
|
-
[](https://star-history.com/#sonofmagic/weapp-tailwindcss&Date)
|
|
94
|
-
|
|
95
|
-
## Related projects
|
|
96
|
-
|
|
97
|
-
### weapp-vite
|
|
98
|
-
|
|
99
|
-
[weapp-vite](https://vite.icebreaker.top/): 把现代化的开发模式带入小程序开发!
|
|
9
|
+
更多接入方式、配置说明和框架示例见 [weapp-tailwindcss 官方文档](https://tw.icebreaker.top)。
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
1
2
|
//#region src/extractors/split.ts
|
|
2
3
|
const validateFilterRE = /[\w\u00A0-\uFFFF%-?]/;
|
|
3
4
|
function isValidSelector(selector = "") {
|
|
@@ -60,4 +61,7 @@ function splitCode(code, _allowDoubleQuotes = false) {
|
|
|
60
61
|
return splitCandidateTokens(code);
|
|
61
62
|
}
|
|
62
63
|
//#endregion
|
|
63
|
-
|
|
64
|
+
exports.isValidSelector = isValidSelector;
|
|
65
|
+
exports.splitCandidateTokens = splitCandidateTokens;
|
|
66
|
+
exports.splitCode = splitCode;
|
|
67
|
+
exports.validateFilterRE = validateFilterRE;
|
package/dist/extractors.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
1
|
//#region src/extractors/split.ts
|
|
3
2
|
const validateFilterRE = /[\w\u00A0-\uFFFF%-?]/;
|
|
4
3
|
function isValidSelector(selector = "") {
|
|
@@ -61,7 +60,4 @@ function splitCode(code, _allowDoubleQuotes = false) {
|
|
|
61
60
|
return splitCandidateTokens(code);
|
|
62
61
|
}
|
|
63
62
|
//#endregion
|
|
64
|
-
|
|
65
|
-
exports.splitCandidateTokens = splitCandidateTokens;
|
|
66
|
-
exports.splitCode = splitCode;
|
|
67
|
-
exports.validateFilterRE = validateFilterRE;
|
|
63
|
+
export { isValidSelector, splitCandidateTokens, splitCode, validateFilterRE };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
|
|
3
|
+
let defu = require("defu");
|
|
4
|
+
let get_value = require("get-value");
|
|
5
|
+
get_value = require_rolldown_runtime.__toESM(get_value, 1);
|
|
6
|
+
let set_value = require("set-value");
|
|
7
|
+
set_value = require_rolldown_runtime.__toESM(set_value, 1);
|
|
4
8
|
//#region src/index.ts
|
|
5
9
|
const HTTP_PATTERN = /^https?:\/\//i;
|
|
6
10
|
const CLEAN_URL_REGEXP = /[?#].*$/;
|
|
@@ -64,11 +68,31 @@ function removeExt(file) {
|
|
|
64
68
|
if (!file) return file;
|
|
65
69
|
return file.replace(REMOVE_EXT_RE, "");
|
|
66
70
|
}
|
|
67
|
-
const defuOverrideArray = createDefu((obj, key, value) => {
|
|
71
|
+
const defuOverrideArray = (0, defu.createDefu)((obj, key, value) => {
|
|
68
72
|
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
69
73
|
obj[key] = value;
|
|
70
74
|
return true;
|
|
71
75
|
}
|
|
72
76
|
});
|
|
73
77
|
//#endregion
|
|
74
|
-
|
|
78
|
+
exports.cleanUrl = cleanUrl;
|
|
79
|
+
Object.defineProperty(exports, "defu", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function() {
|
|
82
|
+
return defu.defu;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
exports.defuOverrideArray = defuOverrideArray;
|
|
86
|
+
exports.ensurePosix = ensurePosix;
|
|
87
|
+
exports.getValue = get_value.default;
|
|
88
|
+
exports.groupBy = groupBy;
|
|
89
|
+
exports.isHttp = isHttp;
|
|
90
|
+
exports.isMap = isMap;
|
|
91
|
+
exports.isRegexp = isRegexp;
|
|
92
|
+
exports.noop = noop;
|
|
93
|
+
exports.normalizeRelativeImport = normalizeRelativeImport;
|
|
94
|
+
exports.normalizeRoot = normalizeRoot;
|
|
95
|
+
exports.regExpTest = regExpTest;
|
|
96
|
+
exports.removeExt = removeExt;
|
|
97
|
+
exports.setValue = set_value.default;
|
|
98
|
+
exports.toArray = toArray;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { defu } from "defu";
|
|
1
2
|
import getValue from "get-value";
|
|
2
3
|
import setValue from "set-value";
|
|
3
|
-
import { defu } from "defu";
|
|
4
|
-
|
|
5
4
|
//#region src/index.d.ts
|
|
6
5
|
declare function isRegexp(value: unknown): value is RegExp;
|
|
7
6
|
declare function isMap<T = unknown, K = unknown>(value: unknown): value is Map<T, K>;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
let get_value = require("get-value");
|
|
5
|
-
get_value = require_chunk.__toESM(get_value);
|
|
6
|
-
let set_value = require("set-value");
|
|
7
|
-
set_value = require_chunk.__toESM(set_value);
|
|
1
|
+
import { createDefu, defu } from "defu";
|
|
2
|
+
import getValue from "get-value";
|
|
3
|
+
import setValue from "set-value";
|
|
8
4
|
//#region src/index.ts
|
|
9
5
|
const HTTP_PATTERN = /^https?:\/\//i;
|
|
10
6
|
const CLEAN_URL_REGEXP = /[?#].*$/;
|
|
@@ -68,31 +64,11 @@ function removeExt(file) {
|
|
|
68
64
|
if (!file) return file;
|
|
69
65
|
return file.replace(REMOVE_EXT_RE, "");
|
|
70
66
|
}
|
|
71
|
-
const defuOverrideArray =
|
|
67
|
+
const defuOverrideArray = createDefu((obj, key, value) => {
|
|
72
68
|
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
73
69
|
obj[key] = value;
|
|
74
70
|
return true;
|
|
75
71
|
}
|
|
76
72
|
});
|
|
77
73
|
//#endregion
|
|
78
|
-
|
|
79
|
-
Object.defineProperty(exports, "defu", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
get: function() {
|
|
82
|
-
return defu.defu;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
exports.defuOverrideArray = defuOverrideArray;
|
|
86
|
-
exports.ensurePosix = ensurePosix;
|
|
87
|
-
exports.getValue = get_value.default;
|
|
88
|
-
exports.groupBy = groupBy;
|
|
89
|
-
exports.isHttp = isHttp;
|
|
90
|
-
exports.isMap = isMap;
|
|
91
|
-
exports.isRegexp = isRegexp;
|
|
92
|
-
exports.noop = noop;
|
|
93
|
-
exports.normalizeRelativeImport = normalizeRelativeImport;
|
|
94
|
-
exports.normalizeRoot = normalizeRoot;
|
|
95
|
-
exports.regExpTest = regExpTest;
|
|
96
|
-
exports.removeExt = removeExt;
|
|
97
|
-
exports.setValue = set_value.default;
|
|
98
|
-
exports.toArray = toArray;
|
|
74
|
+
export { cleanUrl, defu, defuOverrideArray, ensurePosix, getValue, groupBy, isHttp, isMap, isRegexp, noop, normalizeRelativeImport, normalizeRoot, regExpTest, removeExt, setValue, toArray };
|
package/dist/node.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-D6vf50IK.cjs");
|
|
3
|
+
let node_crypto = require("node:crypto");
|
|
4
|
+
node_crypto = require_rolldown_runtime.__toESM(node_crypto, 1);
|
|
5
|
+
let pathe = require("pathe");
|
|
6
|
+
pathe = require_rolldown_runtime.__toESM(pathe, 1);
|
|
7
|
+
//#region src/node.ts
|
|
8
|
+
function md5(input) {
|
|
9
|
+
return node_crypto.default.createHash("md5").update(input).digest("hex");
|
|
10
|
+
}
|
|
11
|
+
function removeAllExtensions(filePath) {
|
|
12
|
+
if (!filePath) return "";
|
|
13
|
+
let baseName = pathe.default.basename(filePath);
|
|
14
|
+
let ext = pathe.default.extname(baseName);
|
|
15
|
+
while (ext) {
|
|
16
|
+
baseName = baseName.slice(0, -ext.length);
|
|
17
|
+
ext = pathe.default.extname(baseName);
|
|
18
|
+
}
|
|
19
|
+
const dir = pathe.default.dirname(filePath);
|
|
20
|
+
return dir === "." ? baseName : pathe.default.join(dir, baseName);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.md5 = md5;
|
|
24
|
+
exports.removeAllExtensions = removeAllExtensions;
|
package/dist/node.d.ts
CHANGED
package/dist/node.js
CHANGED
|
@@ -1,468 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
let node_crypto = require("node:crypto");
|
|
4
|
-
node_crypto = require_chunk.__toESM(node_crypto);
|
|
5
|
-
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
6
|
-
let _lazyMatch = () => {
|
|
7
|
-
var __lib__ = (() => {
|
|
8
|
-
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
9
|
-
for (var n in e) m(r, n, {
|
|
10
|
-
get: e[n],
|
|
11
|
-
enumerable: true
|
|
12
|
-
});
|
|
13
|
-
}, H = (r, e, n, a) => {
|
|
14
|
-
if (e && typeof e == "object" || typeof e == "function") for (let t of G(e)) !T.call(r, t) && t !== n && m(r, t, {
|
|
15
|
-
get: () => e[t],
|
|
16
|
-
enumerable: !(a = V(e, t)) || a.enumerable
|
|
17
|
-
});
|
|
18
|
-
return r;
|
|
19
|
-
}, J = (r) => H(m({}, "__esModule", { value: true }), r), w = {};
|
|
20
|
-
q(w, { default: () => re });
|
|
21
|
-
var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
|
|
22
|
-
const e = /* @__PURE__ */ new Map();
|
|
23
|
-
return (n) => {
|
|
24
|
-
const a = e.get(n);
|
|
25
|
-
if (a) return a;
|
|
26
|
-
const t = r(n);
|
|
27
|
-
return e.set(n, t), t;
|
|
28
|
-
};
|
|
29
|
-
}, rr = (r, e, n = {}) => {
|
|
30
|
-
const a = {
|
|
31
|
-
cache: {},
|
|
32
|
-
input: r,
|
|
33
|
-
index: 0,
|
|
34
|
-
indexMax: 0,
|
|
35
|
-
options: n,
|
|
36
|
-
output: []
|
|
37
|
-
};
|
|
38
|
-
if (v(e)(a) && a.index === r.length) return a.output;
|
|
39
|
-
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
40
|
-
}, i = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
41
|
-
const n = {};
|
|
42
|
-
for (const a of r) {
|
|
43
|
-
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
44
|
-
const t = a.charCodeAt(0);
|
|
45
|
-
n[t] = true;
|
|
46
|
-
}
|
|
47
|
-
return (a) => {
|
|
48
|
-
const t = a.index, o = a.input;
|
|
49
|
-
for (; a.index < o.length && o.charCodeAt(a.index) in n;) a.index += 1;
|
|
50
|
-
const u = a.index;
|
|
51
|
-
if (u > t) {
|
|
52
|
-
if (!h(e) && !a.options.silent) {
|
|
53
|
-
const s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
|
|
54
|
-
h(c) || a.output.push(c);
|
|
55
|
-
}
|
|
56
|
-
a.indexMax = Math.max(a.indexMax, a.index);
|
|
57
|
-
}
|
|
58
|
-
return true;
|
|
59
|
-
};
|
|
60
|
-
}, nr = (r, e) => {
|
|
61
|
-
const n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
62
|
-
return g((o) => {
|
|
63
|
-
t.lastIndex = o.index;
|
|
64
|
-
const u = t.exec(o.input);
|
|
65
|
-
if (u) {
|
|
66
|
-
if (!h(e) && !o.options.silent) {
|
|
67
|
-
const s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
68
|
-
h(s) || o.output.push(s);
|
|
69
|
-
}
|
|
70
|
-
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
|
|
71
|
-
} else return false;
|
|
72
|
-
});
|
|
73
|
-
}, ar = (r, e) => (n) => {
|
|
74
|
-
if (n.input.startsWith(r, n.index)) {
|
|
75
|
-
if (!h(e) && !n.options.silent) {
|
|
76
|
-
const t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
77
|
-
h(t) || n.output.push(t);
|
|
78
|
-
}
|
|
79
|
-
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
|
|
80
|
-
} else return false;
|
|
81
|
-
}, C = (r, e, n, a) => {
|
|
82
|
-
const t = v(r);
|
|
83
|
-
return g(_(M((o) => {
|
|
84
|
-
let u = 0;
|
|
85
|
-
for (; u < n;) {
|
|
86
|
-
const s = o.index;
|
|
87
|
-
if (!t(o) || (u += 1, o.index === s)) break;
|
|
88
|
-
}
|
|
89
|
-
return u >= e;
|
|
90
|
-
})));
|
|
91
|
-
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, Infinity), x = (r, e) => {
|
|
92
|
-
const n = r.map(v);
|
|
93
|
-
return g(_(M((a) => {
|
|
94
|
-
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return false;
|
|
95
|
-
return true;
|
|
96
|
-
})));
|
|
97
|
-
}, l = (r, e) => {
|
|
98
|
-
const n = r.map(v);
|
|
99
|
-
return g(_((a) => {
|
|
100
|
-
for (let t = 0, o = n.length; t < o; t++) if (n[t](a)) return true;
|
|
101
|
-
return false;
|
|
102
|
-
}));
|
|
103
|
-
}, M = (r, e = false) => {
|
|
104
|
-
const n = v(r);
|
|
105
|
-
return (a) => {
|
|
106
|
-
const t = a.index, o = a.output.length, u = n(a);
|
|
107
|
-
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
108
|
-
};
|
|
109
|
-
}, _ = (r, e) => {
|
|
110
|
-
return v(r);
|
|
111
|
-
}, g = (() => {
|
|
112
|
-
let r = 0;
|
|
113
|
-
return (e) => {
|
|
114
|
-
const n = v(e), a = r += 1;
|
|
115
|
-
return (t) => {
|
|
116
|
-
var o;
|
|
117
|
-
if (t.options.memoization === false) return n(t);
|
|
118
|
-
const u = t.index, s = (o = t.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
119
|
-
if (c === false) return false;
|
|
120
|
-
if (W(c)) return t.index = c, true;
|
|
121
|
-
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), true;
|
|
122
|
-
{
|
|
123
|
-
const Z = t.output.length;
|
|
124
|
-
if (n(t)) {
|
|
125
|
-
const D = t.index, U = t.output.length;
|
|
126
|
-
if (U > Z) {
|
|
127
|
-
const ee = t.output.slice(Z, U);
|
|
128
|
-
s.set(u, {
|
|
129
|
-
index: D,
|
|
130
|
-
output: ee
|
|
131
|
-
});
|
|
132
|
-
} else s.set(u, D);
|
|
133
|
-
return true;
|
|
134
|
-
} else return s.set(u, false), false;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
})(), E = (r) => {
|
|
139
|
-
let e;
|
|
140
|
-
return (n) => (e || (e = v(r())), e(n));
|
|
141
|
-
}, v = Y((r) => {
|
|
142
|
-
if (d(r)) return Q(r) ? E(r) : r;
|
|
143
|
-
if (b(r) || X(r)) return i(r);
|
|
144
|
-
if (A(r)) return x(r);
|
|
145
|
-
if (K(r)) return l(Object.values(r));
|
|
146
|
-
throw new Error("Invalid rule");
|
|
147
|
-
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
148
|
-
let e = "";
|
|
149
|
-
for (; r > 0;) e = P[(r - 1) % 26] + e, r = Math.floor((r - 1) / 26);
|
|
150
|
-
return e;
|
|
151
|
-
}, O = (r) => {
|
|
152
|
-
let e = 0;
|
|
153
|
-
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
154
|
-
return e;
|
|
155
|
-
}, S = (r, e) => {
|
|
156
|
-
if (e < r) return S(e, r);
|
|
157
|
-
const n = [];
|
|
158
|
-
for (; r <= e;) n.push(r++);
|
|
159
|
-
return n;
|
|
160
|
-
}, or = (r, e, n) => S(r, e).map((a) => String(a).padStart(n, "0")), R = (r, e) => S(O(r), O(e)).map(ir), p = (r) => r, z = (r) => ur((e) => rr(e, r, { memoization: false }).join("")), ur = (r) => {
|
|
161
|
-
const e = {};
|
|
162
|
-
return (n) => e[n] ?? (e[n] = r(n));
|
|
163
|
-
}, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i(/./, p), fr = l([i(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), i(/^(!!)+/, "")]), j = l([
|
|
164
|
-
i(/\/(\*\*\/)+/, "(?:/.+/|/)"),
|
|
165
|
-
i(/^(\*\*\/)+/, "(?:^|.*/)"),
|
|
166
|
-
i(/\/(\*\*)$/, "(?:/.*|$)"),
|
|
167
|
-
i(/\*\*/, ".*")
|
|
168
|
-
]), N = l([i(/\*\/(?!\*\*\/)/, "[^/]*/"), i(/\*/, "[^/]*")]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Er = l([
|
|
169
|
-
y,
|
|
170
|
-
i(/[$.*+?^(){}[\|]/, (r) => `\\${r}`),
|
|
171
|
-
br,
|
|
172
|
-
i(/[^\]]/, p)
|
|
173
|
-
]), B = x([
|
|
174
|
-
$r,
|
|
175
|
-
tr(Ar),
|
|
176
|
-
f(Er),
|
|
177
|
-
wr
|
|
178
|
-
]), Pr = i("{", "(?:"), Or = i("}", ")"), I = x([
|
|
179
|
-
Pr,
|
|
180
|
-
l([
|
|
181
|
-
i(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")),
|
|
182
|
-
i(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => R(e, n).join("|")),
|
|
183
|
-
i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n) => R(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase())
|
|
184
|
-
]),
|
|
185
|
-
Or
|
|
186
|
-
]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i(/[^}]/, p), F = x([
|
|
187
|
-
kr,
|
|
188
|
-
f(l([
|
|
189
|
-
j,
|
|
190
|
-
N,
|
|
191
|
-
k,
|
|
192
|
-
B,
|
|
193
|
-
I,
|
|
194
|
-
E(() => F),
|
|
195
|
-
y,
|
|
196
|
-
Fr,
|
|
197
|
-
Ir,
|
|
198
|
-
Lr
|
|
199
|
-
])),
|
|
200
|
-
Br
|
|
201
|
-
]), L = z(f(l([
|
|
202
|
-
sr,
|
|
203
|
-
cr,
|
|
204
|
-
lr,
|
|
205
|
-
fr,
|
|
206
|
-
j,
|
|
207
|
-
N,
|
|
208
|
-
k,
|
|
209
|
-
B,
|
|
210
|
-
I,
|
|
211
|
-
F,
|
|
212
|
-
y,
|
|
213
|
-
pr,
|
|
214
|
-
vr
|
|
215
|
-
]))), Tr = i(/\\./, p), qr = i(/./, p), Yr = z(f(l([
|
|
216
|
-
Tr,
|
|
217
|
-
i(/\*\*\*+/, "*"),
|
|
218
|
-
i(/([^/{[(!])\*\*/, (r, e) => `${e}*`),
|
|
219
|
-
i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`),
|
|
220
|
-
qr
|
|
221
|
-
]))), $ = (r, e) => {
|
|
222
|
-
const n = Array.isArray(r) ? r : [r];
|
|
223
|
-
if (!n.length) return false;
|
|
224
|
-
const a = n.map($.compile), t = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
225
|
-
return a.some((s) => s.test(o));
|
|
226
|
-
};
|
|
227
|
-
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
228
|
-
var re = $;
|
|
229
|
-
return J(w);
|
|
230
|
-
})();
|
|
231
|
-
return __lib__.default || __lib__;
|
|
232
|
-
};
|
|
233
|
-
let _match;
|
|
234
|
-
const zeptomatch = (path, pattern) => {
|
|
235
|
-
if (!_match) {
|
|
236
|
-
_match = _lazyMatch();
|
|
237
|
-
_lazyMatch = null;
|
|
238
|
-
}
|
|
239
|
-
return _match(path, pattern);
|
|
240
|
-
};
|
|
241
|
-
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
242
|
-
function normalizeWindowsPath(input = "") {
|
|
243
|
-
if (!input) return input;
|
|
244
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
245
|
-
}
|
|
246
|
-
const _UNC_REGEX = /^[/\\]{2}/;
|
|
247
|
-
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
248
|
-
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
249
|
-
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
250
|
-
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
251
|
-
const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
252
|
-
const normalize = function(path) {
|
|
253
|
-
if (path.length === 0) return ".";
|
|
254
|
-
path = normalizeWindowsPath(path);
|
|
255
|
-
const isUNCPath = path.match(_UNC_REGEX);
|
|
256
|
-
const isPathAbsolute = isAbsolute(path);
|
|
257
|
-
const trailingSeparator = path[path.length - 1] === "/";
|
|
258
|
-
path = normalizeString(path, !isPathAbsolute);
|
|
259
|
-
if (path.length === 0) {
|
|
260
|
-
if (isPathAbsolute) return "/";
|
|
261
|
-
return trailingSeparator ? "./" : ".";
|
|
262
|
-
}
|
|
263
|
-
if (trailingSeparator) path += "/";
|
|
264
|
-
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
265
|
-
if (isUNCPath) {
|
|
266
|
-
if (!isPathAbsolute) return `//./${path}`;
|
|
267
|
-
return `//${path}`;
|
|
268
|
-
}
|
|
269
|
-
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
270
|
-
};
|
|
271
|
-
const join = function(...segments) {
|
|
272
|
-
let path = "";
|
|
273
|
-
for (const seg of segments) {
|
|
274
|
-
if (!seg) continue;
|
|
275
|
-
if (path.length > 0) {
|
|
276
|
-
const pathTrailing = path[path.length - 1] === "/";
|
|
277
|
-
const segLeading = seg[0] === "/";
|
|
278
|
-
if (pathTrailing && segLeading) path += seg.slice(1);
|
|
279
|
-
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
280
|
-
} else path += seg;
|
|
281
|
-
}
|
|
282
|
-
return normalize(path);
|
|
283
|
-
};
|
|
284
|
-
function cwd() {
|
|
285
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
286
|
-
return "/";
|
|
287
|
-
}
|
|
288
|
-
const resolve = function(...arguments_) {
|
|
289
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
290
|
-
let resolvedPath = "";
|
|
291
|
-
let resolvedAbsolute = false;
|
|
292
|
-
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
293
|
-
const path = index >= 0 ? arguments_[index] : cwd();
|
|
294
|
-
if (!path || path.length === 0) continue;
|
|
295
|
-
resolvedPath = `${path}/${resolvedPath}`;
|
|
296
|
-
resolvedAbsolute = isAbsolute(path);
|
|
297
|
-
}
|
|
298
|
-
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
299
|
-
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
300
|
-
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
301
|
-
};
|
|
302
|
-
function normalizeString(path, allowAboveRoot) {
|
|
303
|
-
let res = "";
|
|
304
|
-
let lastSegmentLength = 0;
|
|
305
|
-
let lastSlash = -1;
|
|
306
|
-
let dots = 0;
|
|
307
|
-
let char = null;
|
|
308
|
-
for (let index = 0; index <= path.length; ++index) {
|
|
309
|
-
if (index < path.length) char = path[index];
|
|
310
|
-
else if (char === "/") break;
|
|
311
|
-
else char = "/";
|
|
312
|
-
if (char === "/") {
|
|
313
|
-
if (lastSlash === index - 1 || dots === 1);
|
|
314
|
-
else if (dots === 2) {
|
|
315
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
316
|
-
if (res.length > 2) {
|
|
317
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
318
|
-
if (lastSlashIndex === -1) {
|
|
319
|
-
res = "";
|
|
320
|
-
lastSegmentLength = 0;
|
|
321
|
-
} else {
|
|
322
|
-
res = res.slice(0, lastSlashIndex);
|
|
323
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
324
|
-
}
|
|
325
|
-
lastSlash = index;
|
|
326
|
-
dots = 0;
|
|
327
|
-
continue;
|
|
328
|
-
} else if (res.length > 0) {
|
|
329
|
-
res = "";
|
|
330
|
-
lastSegmentLength = 0;
|
|
331
|
-
lastSlash = index;
|
|
332
|
-
dots = 0;
|
|
333
|
-
continue;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
if (allowAboveRoot) {
|
|
337
|
-
res += res.length > 0 ? "/.." : "..";
|
|
338
|
-
lastSegmentLength = 2;
|
|
339
|
-
}
|
|
340
|
-
} else {
|
|
341
|
-
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
342
|
-
else res = path.slice(lastSlash + 1, index);
|
|
343
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
344
|
-
}
|
|
345
|
-
lastSlash = index;
|
|
346
|
-
dots = 0;
|
|
347
|
-
} else if (char === "." && dots !== -1) ++dots;
|
|
348
|
-
else dots = -1;
|
|
349
|
-
}
|
|
350
|
-
return res;
|
|
351
|
-
}
|
|
352
|
-
const isAbsolute = function(p) {
|
|
353
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
354
|
-
};
|
|
355
|
-
const toNamespacedPath = function(p) {
|
|
356
|
-
return normalizeWindowsPath(p);
|
|
357
|
-
};
|
|
358
|
-
const extname = function(p) {
|
|
359
|
-
if (p === "..") return "";
|
|
360
|
-
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
361
|
-
return match && match[1] || "";
|
|
362
|
-
};
|
|
363
|
-
const relative = function(from, to) {
|
|
364
|
-
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
365
|
-
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
366
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
|
|
367
|
-
const _fromCopy = [..._from];
|
|
368
|
-
for (const segment of _fromCopy) {
|
|
369
|
-
if (_to[0] !== segment) break;
|
|
370
|
-
_from.shift();
|
|
371
|
-
_to.shift();
|
|
372
|
-
}
|
|
373
|
-
return [..._from.map(() => ".."), ..._to].join("/");
|
|
374
|
-
};
|
|
375
|
-
const dirname = function(p) {
|
|
376
|
-
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
377
|
-
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
378
|
-
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
379
|
-
};
|
|
380
|
-
const format = function(p) {
|
|
381
|
-
const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
|
|
382
|
-
const segments = [
|
|
383
|
-
p.root,
|
|
384
|
-
p.dir,
|
|
385
|
-
p.base ?? (p.name ?? "") + ext
|
|
386
|
-
].filter(Boolean);
|
|
387
|
-
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
|
|
388
|
-
};
|
|
389
|
-
const basename = function(p, extension) {
|
|
390
|
-
const segments = normalizeWindowsPath(p).split("/");
|
|
391
|
-
let lastSegment = "";
|
|
392
|
-
for (let i = segments.length - 1; i >= 0; i--) {
|
|
393
|
-
const val = segments[i];
|
|
394
|
-
if (val) {
|
|
395
|
-
lastSegment = val;
|
|
396
|
-
break;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
400
|
-
};
|
|
401
|
-
const parse = function(p) {
|
|
402
|
-
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
403
|
-
const base = basename(p);
|
|
404
|
-
const extension = extname(base);
|
|
405
|
-
return {
|
|
406
|
-
root,
|
|
407
|
-
dir: dirname(p),
|
|
408
|
-
base,
|
|
409
|
-
ext: extension,
|
|
410
|
-
name: base.slice(0, base.length - extension.length)
|
|
411
|
-
};
|
|
412
|
-
};
|
|
413
|
-
const matchesGlob = (path, pattern) => {
|
|
414
|
-
return zeptomatch(pattern, normalize(path));
|
|
415
|
-
};
|
|
416
|
-
const _path = {
|
|
417
|
-
__proto__: null,
|
|
418
|
-
basename,
|
|
419
|
-
dirname,
|
|
420
|
-
extname,
|
|
421
|
-
format,
|
|
422
|
-
isAbsolute,
|
|
423
|
-
join,
|
|
424
|
-
matchesGlob,
|
|
425
|
-
normalize,
|
|
426
|
-
normalizeString,
|
|
427
|
-
parse,
|
|
428
|
-
relative,
|
|
429
|
-
resolve,
|
|
430
|
-
sep: "/",
|
|
431
|
-
toNamespacedPath
|
|
432
|
-
};
|
|
433
|
-
//#endregion
|
|
434
|
-
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs
|
|
435
|
-
const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
|
|
436
|
-
const _platforms = {
|
|
437
|
-
posix: void 0,
|
|
438
|
-
win32: void 0
|
|
439
|
-
};
|
|
440
|
-
const mix = (del = delimiter) => {
|
|
441
|
-
return new Proxy(_path, { get(_, prop) {
|
|
442
|
-
if (prop === "delimiter") return del;
|
|
443
|
-
if (prop === "posix") return posix;
|
|
444
|
-
if (prop === "win32") return win32;
|
|
445
|
-
return _platforms[prop] || _path[prop];
|
|
446
|
-
} });
|
|
447
|
-
};
|
|
448
|
-
const posix = /* @__PURE__ */ mix(":");
|
|
449
|
-
const win32 = /* @__PURE__ */ mix(";");
|
|
450
|
-
//#endregion
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import path from "pathe";
|
|
451
3
|
//#region src/node.ts
|
|
452
4
|
function md5(input) {
|
|
453
|
-
return
|
|
5
|
+
return crypto.createHash("md5").update(input).digest("hex");
|
|
454
6
|
}
|
|
455
7
|
function removeAllExtensions(filePath) {
|
|
456
8
|
if (!filePath) return "";
|
|
457
|
-
let baseName =
|
|
458
|
-
let ext =
|
|
9
|
+
let baseName = path.basename(filePath);
|
|
10
|
+
let ext = path.extname(baseName);
|
|
459
11
|
while (ext) {
|
|
460
12
|
baseName = baseName.slice(0, -ext.length);
|
|
461
|
-
ext =
|
|
13
|
+
ext = path.extname(baseName);
|
|
462
14
|
}
|
|
463
|
-
const dir =
|
|
464
|
-
return dir === "." ? baseName :
|
|
15
|
+
const dir = path.dirname(filePath);
|
|
16
|
+
return dir === "." ? baseName : path.join(dir, baseName);
|
|
465
17
|
}
|
|
466
18
|
//#endregion
|
|
467
|
-
|
|
468
|
-
exports.removeAllExtensions = removeAllExtensions;
|
|
19
|
+
export { md5, removeAllExtensions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/shared",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.0.1",
|
|
4
5
|
"description": "@weapp-tailwindcss/shared",
|
|
5
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
7
|
"license": "MIT",
|
|
@@ -17,22 +18,22 @@
|
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
19
20
|
"types": "./dist/index.d.ts",
|
|
20
|
-
"import": "./dist/index.
|
|
21
|
-
"require": "./dist/index.
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
22
23
|
},
|
|
23
24
|
"./extractors": {
|
|
24
25
|
"types": "./dist/extractors.d.ts",
|
|
25
|
-
"import": "./dist/extractors.
|
|
26
|
-
"require": "./dist/extractors.
|
|
26
|
+
"import": "./dist/extractors.js",
|
|
27
|
+
"require": "./dist/extractors.cjs"
|
|
27
28
|
},
|
|
28
29
|
"./node": {
|
|
29
30
|
"types": "./dist/node.d.ts",
|
|
30
|
-
"import": "./dist/node.
|
|
31
|
-
"require": "./dist/node.
|
|
31
|
+
"import": "./dist/node.js",
|
|
32
|
+
"require": "./dist/node.cjs"
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
|
-
"main": "./dist/index.
|
|
35
|
-
"module": "./dist/index.
|
|
35
|
+
"main": "./dist/index.cjs",
|
|
36
|
+
"module": "./dist/index.js",
|
|
36
37
|
"types": "./dist/index.d.ts",
|
|
37
38
|
"files": [
|
|
38
39
|
"dist"
|
|
@@ -42,12 +43,10 @@
|
|
|
42
43
|
},
|
|
43
44
|
"dependencies": {
|
|
44
45
|
"defu": "^6.1.7",
|
|
45
|
-
"get-value": "^4.0
|
|
46
|
+
"get-value": "^4.1.0",
|
|
47
|
+
"pathe": "^2.0.3",
|
|
46
48
|
"set-value": "^4.1.0"
|
|
47
49
|
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"pathe": "^2.0.3"
|
|
50
|
-
},
|
|
51
50
|
"scripts": {
|
|
52
51
|
"dev": "tsdown --watch --sourcemap",
|
|
53
52
|
"build": "tsdown",
|
package/dist/node.mjs
DELETED
|
@@ -1,464 +0,0 @@
|
|
|
1
|
-
import crypto from "node:crypto";
|
|
2
|
-
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
3
|
-
let _lazyMatch = () => {
|
|
4
|
-
var __lib__ = (() => {
|
|
5
|
-
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
6
|
-
for (var n in e) m(r, n, {
|
|
7
|
-
get: e[n],
|
|
8
|
-
enumerable: true
|
|
9
|
-
});
|
|
10
|
-
}, H = (r, e, n, a) => {
|
|
11
|
-
if (e && typeof e == "object" || typeof e == "function") for (let t of G(e)) !T.call(r, t) && t !== n && m(r, t, {
|
|
12
|
-
get: () => e[t],
|
|
13
|
-
enumerable: !(a = V(e, t)) || a.enumerable
|
|
14
|
-
});
|
|
15
|
-
return r;
|
|
16
|
-
}, J = (r) => H(m({}, "__esModule", { value: true }), r), w = {};
|
|
17
|
-
q(w, { default: () => re });
|
|
18
|
-
var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
|
|
19
|
-
const e = /* @__PURE__ */ new Map();
|
|
20
|
-
return (n) => {
|
|
21
|
-
const a = e.get(n);
|
|
22
|
-
if (a) return a;
|
|
23
|
-
const t = r(n);
|
|
24
|
-
return e.set(n, t), t;
|
|
25
|
-
};
|
|
26
|
-
}, rr = (r, e, n = {}) => {
|
|
27
|
-
const a = {
|
|
28
|
-
cache: {},
|
|
29
|
-
input: r,
|
|
30
|
-
index: 0,
|
|
31
|
-
indexMax: 0,
|
|
32
|
-
options: n,
|
|
33
|
-
output: []
|
|
34
|
-
};
|
|
35
|
-
if (v(e)(a) && a.index === r.length) return a.output;
|
|
36
|
-
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
37
|
-
}, i = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
38
|
-
const n = {};
|
|
39
|
-
for (const a of r) {
|
|
40
|
-
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
41
|
-
const t = a.charCodeAt(0);
|
|
42
|
-
n[t] = true;
|
|
43
|
-
}
|
|
44
|
-
return (a) => {
|
|
45
|
-
const t = a.index, o = a.input;
|
|
46
|
-
for (; a.index < o.length && o.charCodeAt(a.index) in n;) a.index += 1;
|
|
47
|
-
const u = a.index;
|
|
48
|
-
if (u > t) {
|
|
49
|
-
if (!h(e) && !a.options.silent) {
|
|
50
|
-
const s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
|
|
51
|
-
h(c) || a.output.push(c);
|
|
52
|
-
}
|
|
53
|
-
a.indexMax = Math.max(a.indexMax, a.index);
|
|
54
|
-
}
|
|
55
|
-
return true;
|
|
56
|
-
};
|
|
57
|
-
}, nr = (r, e) => {
|
|
58
|
-
const n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
59
|
-
return g((o) => {
|
|
60
|
-
t.lastIndex = o.index;
|
|
61
|
-
const u = t.exec(o.input);
|
|
62
|
-
if (u) {
|
|
63
|
-
if (!h(e) && !o.options.silent) {
|
|
64
|
-
const s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
65
|
-
h(s) || o.output.push(s);
|
|
66
|
-
}
|
|
67
|
-
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
|
|
68
|
-
} else return false;
|
|
69
|
-
});
|
|
70
|
-
}, ar = (r, e) => (n) => {
|
|
71
|
-
if (n.input.startsWith(r, n.index)) {
|
|
72
|
-
if (!h(e) && !n.options.silent) {
|
|
73
|
-
const t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
74
|
-
h(t) || n.output.push(t);
|
|
75
|
-
}
|
|
76
|
-
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
|
|
77
|
-
} else return false;
|
|
78
|
-
}, C = (r, e, n, a) => {
|
|
79
|
-
const t = v(r);
|
|
80
|
-
return g(_(M((o) => {
|
|
81
|
-
let u = 0;
|
|
82
|
-
for (; u < n;) {
|
|
83
|
-
const s = o.index;
|
|
84
|
-
if (!t(o) || (u += 1, o.index === s)) break;
|
|
85
|
-
}
|
|
86
|
-
return u >= e;
|
|
87
|
-
})));
|
|
88
|
-
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, Infinity), x = (r, e) => {
|
|
89
|
-
const n = r.map(v);
|
|
90
|
-
return g(_(M((a) => {
|
|
91
|
-
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return false;
|
|
92
|
-
return true;
|
|
93
|
-
})));
|
|
94
|
-
}, l = (r, e) => {
|
|
95
|
-
const n = r.map(v);
|
|
96
|
-
return g(_((a) => {
|
|
97
|
-
for (let t = 0, o = n.length; t < o; t++) if (n[t](a)) return true;
|
|
98
|
-
return false;
|
|
99
|
-
}));
|
|
100
|
-
}, M = (r, e = false) => {
|
|
101
|
-
const n = v(r);
|
|
102
|
-
return (a) => {
|
|
103
|
-
const t = a.index, o = a.output.length, u = n(a);
|
|
104
|
-
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
105
|
-
};
|
|
106
|
-
}, _ = (r, e) => {
|
|
107
|
-
return v(r);
|
|
108
|
-
}, g = (() => {
|
|
109
|
-
let r = 0;
|
|
110
|
-
return (e) => {
|
|
111
|
-
const n = v(e), a = r += 1;
|
|
112
|
-
return (t) => {
|
|
113
|
-
var o;
|
|
114
|
-
if (t.options.memoization === false) return n(t);
|
|
115
|
-
const u = t.index, s = (o = t.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
116
|
-
if (c === false) return false;
|
|
117
|
-
if (W(c)) return t.index = c, true;
|
|
118
|
-
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), true;
|
|
119
|
-
{
|
|
120
|
-
const Z = t.output.length;
|
|
121
|
-
if (n(t)) {
|
|
122
|
-
const D = t.index, U = t.output.length;
|
|
123
|
-
if (U > Z) {
|
|
124
|
-
const ee = t.output.slice(Z, U);
|
|
125
|
-
s.set(u, {
|
|
126
|
-
index: D,
|
|
127
|
-
output: ee
|
|
128
|
-
});
|
|
129
|
-
} else s.set(u, D);
|
|
130
|
-
return true;
|
|
131
|
-
} else return s.set(u, false), false;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
})(), E = (r) => {
|
|
136
|
-
let e;
|
|
137
|
-
return (n) => (e || (e = v(r())), e(n));
|
|
138
|
-
}, v = Y((r) => {
|
|
139
|
-
if (d(r)) return Q(r) ? E(r) : r;
|
|
140
|
-
if (b(r) || X(r)) return i(r);
|
|
141
|
-
if (A(r)) return x(r);
|
|
142
|
-
if (K(r)) return l(Object.values(r));
|
|
143
|
-
throw new Error("Invalid rule");
|
|
144
|
-
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
145
|
-
let e = "";
|
|
146
|
-
for (; r > 0;) e = P[(r - 1) % 26] + e, r = Math.floor((r - 1) / 26);
|
|
147
|
-
return e;
|
|
148
|
-
}, O = (r) => {
|
|
149
|
-
let e = 0;
|
|
150
|
-
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
151
|
-
return e;
|
|
152
|
-
}, S = (r, e) => {
|
|
153
|
-
if (e < r) return S(e, r);
|
|
154
|
-
const n = [];
|
|
155
|
-
for (; r <= e;) n.push(r++);
|
|
156
|
-
return n;
|
|
157
|
-
}, or = (r, e, n) => S(r, e).map((a) => String(a).padStart(n, "0")), R = (r, e) => S(O(r), O(e)).map(ir), p = (r) => r, z = (r) => ur((e) => rr(e, r, { memoization: false }).join("")), ur = (r) => {
|
|
158
|
-
const e = {};
|
|
159
|
-
return (n) => e[n] ?? (e[n] = r(n));
|
|
160
|
-
}, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i(/./, p), fr = l([i(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), i(/^(!!)+/, "")]), j = l([
|
|
161
|
-
i(/\/(\*\*\/)+/, "(?:/.+/|/)"),
|
|
162
|
-
i(/^(\*\*\/)+/, "(?:^|.*/)"),
|
|
163
|
-
i(/\/(\*\*)$/, "(?:/.*|$)"),
|
|
164
|
-
i(/\*\*/, ".*")
|
|
165
|
-
]), N = l([i(/\*\/(?!\*\*\/)/, "[^/]*/"), i(/\*/, "[^/]*")]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Er = l([
|
|
166
|
-
y,
|
|
167
|
-
i(/[$.*+?^(){}[\|]/, (r) => `\\${r}`),
|
|
168
|
-
br,
|
|
169
|
-
i(/[^\]]/, p)
|
|
170
|
-
]), B = x([
|
|
171
|
-
$r,
|
|
172
|
-
tr(Ar),
|
|
173
|
-
f(Er),
|
|
174
|
-
wr
|
|
175
|
-
]), Pr = i("{", "(?:"), Or = i("}", ")"), I = x([
|
|
176
|
-
Pr,
|
|
177
|
-
l([
|
|
178
|
-
i(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")),
|
|
179
|
-
i(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => R(e, n).join("|")),
|
|
180
|
-
i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n) => R(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase())
|
|
181
|
-
]),
|
|
182
|
-
Or
|
|
183
|
-
]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i(/[^}]/, p), F = x([
|
|
184
|
-
kr,
|
|
185
|
-
f(l([
|
|
186
|
-
j,
|
|
187
|
-
N,
|
|
188
|
-
k,
|
|
189
|
-
B,
|
|
190
|
-
I,
|
|
191
|
-
E(() => F),
|
|
192
|
-
y,
|
|
193
|
-
Fr,
|
|
194
|
-
Ir,
|
|
195
|
-
Lr
|
|
196
|
-
])),
|
|
197
|
-
Br
|
|
198
|
-
]), L = z(f(l([
|
|
199
|
-
sr,
|
|
200
|
-
cr,
|
|
201
|
-
lr,
|
|
202
|
-
fr,
|
|
203
|
-
j,
|
|
204
|
-
N,
|
|
205
|
-
k,
|
|
206
|
-
B,
|
|
207
|
-
I,
|
|
208
|
-
F,
|
|
209
|
-
y,
|
|
210
|
-
pr,
|
|
211
|
-
vr
|
|
212
|
-
]))), Tr = i(/\\./, p), qr = i(/./, p), Yr = z(f(l([
|
|
213
|
-
Tr,
|
|
214
|
-
i(/\*\*\*+/, "*"),
|
|
215
|
-
i(/([^/{[(!])\*\*/, (r, e) => `${e}*`),
|
|
216
|
-
i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`),
|
|
217
|
-
qr
|
|
218
|
-
]))), $ = (r, e) => {
|
|
219
|
-
const n = Array.isArray(r) ? r : [r];
|
|
220
|
-
if (!n.length) return false;
|
|
221
|
-
const a = n.map($.compile), t = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
222
|
-
return a.some((s) => s.test(o));
|
|
223
|
-
};
|
|
224
|
-
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
225
|
-
var re = $;
|
|
226
|
-
return J(w);
|
|
227
|
-
})();
|
|
228
|
-
return __lib__.default || __lib__;
|
|
229
|
-
};
|
|
230
|
-
let _match;
|
|
231
|
-
const zeptomatch = (path, pattern) => {
|
|
232
|
-
if (!_match) {
|
|
233
|
-
_match = _lazyMatch();
|
|
234
|
-
_lazyMatch = null;
|
|
235
|
-
}
|
|
236
|
-
return _match(path, pattern);
|
|
237
|
-
};
|
|
238
|
-
const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
239
|
-
function normalizeWindowsPath(input = "") {
|
|
240
|
-
if (!input) return input;
|
|
241
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
242
|
-
}
|
|
243
|
-
const _UNC_REGEX = /^[/\\]{2}/;
|
|
244
|
-
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
245
|
-
const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
246
|
-
const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
247
|
-
const _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
248
|
-
const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
249
|
-
const normalize = function(path) {
|
|
250
|
-
if (path.length === 0) return ".";
|
|
251
|
-
path = normalizeWindowsPath(path);
|
|
252
|
-
const isUNCPath = path.match(_UNC_REGEX);
|
|
253
|
-
const isPathAbsolute = isAbsolute(path);
|
|
254
|
-
const trailingSeparator = path[path.length - 1] === "/";
|
|
255
|
-
path = normalizeString(path, !isPathAbsolute);
|
|
256
|
-
if (path.length === 0) {
|
|
257
|
-
if (isPathAbsolute) return "/";
|
|
258
|
-
return trailingSeparator ? "./" : ".";
|
|
259
|
-
}
|
|
260
|
-
if (trailingSeparator) path += "/";
|
|
261
|
-
if (_DRIVE_LETTER_RE.test(path)) path += "/";
|
|
262
|
-
if (isUNCPath) {
|
|
263
|
-
if (!isPathAbsolute) return `//./${path}`;
|
|
264
|
-
return `//${path}`;
|
|
265
|
-
}
|
|
266
|
-
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
267
|
-
};
|
|
268
|
-
const join = function(...segments) {
|
|
269
|
-
let path = "";
|
|
270
|
-
for (const seg of segments) {
|
|
271
|
-
if (!seg) continue;
|
|
272
|
-
if (path.length > 0) {
|
|
273
|
-
const pathTrailing = path[path.length - 1] === "/";
|
|
274
|
-
const segLeading = seg[0] === "/";
|
|
275
|
-
if (pathTrailing && segLeading) path += seg.slice(1);
|
|
276
|
-
else path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
277
|
-
} else path += seg;
|
|
278
|
-
}
|
|
279
|
-
return normalize(path);
|
|
280
|
-
};
|
|
281
|
-
function cwd() {
|
|
282
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
|
|
283
|
-
return "/";
|
|
284
|
-
}
|
|
285
|
-
const resolve = function(...arguments_) {
|
|
286
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
287
|
-
let resolvedPath = "";
|
|
288
|
-
let resolvedAbsolute = false;
|
|
289
|
-
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
290
|
-
const path = index >= 0 ? arguments_[index] : cwd();
|
|
291
|
-
if (!path || path.length === 0) continue;
|
|
292
|
-
resolvedPath = `${path}/${resolvedPath}`;
|
|
293
|
-
resolvedAbsolute = isAbsolute(path);
|
|
294
|
-
}
|
|
295
|
-
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
296
|
-
if (resolvedAbsolute && !isAbsolute(resolvedPath)) return `/${resolvedPath}`;
|
|
297
|
-
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
298
|
-
};
|
|
299
|
-
function normalizeString(path, allowAboveRoot) {
|
|
300
|
-
let res = "";
|
|
301
|
-
let lastSegmentLength = 0;
|
|
302
|
-
let lastSlash = -1;
|
|
303
|
-
let dots = 0;
|
|
304
|
-
let char = null;
|
|
305
|
-
for (let index = 0; index <= path.length; ++index) {
|
|
306
|
-
if (index < path.length) char = path[index];
|
|
307
|
-
else if (char === "/") break;
|
|
308
|
-
else char = "/";
|
|
309
|
-
if (char === "/") {
|
|
310
|
-
if (lastSlash === index - 1 || dots === 1);
|
|
311
|
-
else if (dots === 2) {
|
|
312
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
313
|
-
if (res.length > 2) {
|
|
314
|
-
const lastSlashIndex = res.lastIndexOf("/");
|
|
315
|
-
if (lastSlashIndex === -1) {
|
|
316
|
-
res = "";
|
|
317
|
-
lastSegmentLength = 0;
|
|
318
|
-
} else {
|
|
319
|
-
res = res.slice(0, lastSlashIndex);
|
|
320
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
321
|
-
}
|
|
322
|
-
lastSlash = index;
|
|
323
|
-
dots = 0;
|
|
324
|
-
continue;
|
|
325
|
-
} else if (res.length > 0) {
|
|
326
|
-
res = "";
|
|
327
|
-
lastSegmentLength = 0;
|
|
328
|
-
lastSlash = index;
|
|
329
|
-
dots = 0;
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
if (allowAboveRoot) {
|
|
334
|
-
res += res.length > 0 ? "/.." : "..";
|
|
335
|
-
lastSegmentLength = 2;
|
|
336
|
-
}
|
|
337
|
-
} else {
|
|
338
|
-
if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
|
|
339
|
-
else res = path.slice(lastSlash + 1, index);
|
|
340
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
341
|
-
}
|
|
342
|
-
lastSlash = index;
|
|
343
|
-
dots = 0;
|
|
344
|
-
} else if (char === "." && dots !== -1) ++dots;
|
|
345
|
-
else dots = -1;
|
|
346
|
-
}
|
|
347
|
-
return res;
|
|
348
|
-
}
|
|
349
|
-
const isAbsolute = function(p) {
|
|
350
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
351
|
-
};
|
|
352
|
-
const toNamespacedPath = function(p) {
|
|
353
|
-
return normalizeWindowsPath(p);
|
|
354
|
-
};
|
|
355
|
-
const extname = function(p) {
|
|
356
|
-
if (p === "..") return "";
|
|
357
|
-
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
358
|
-
return match && match[1] || "";
|
|
359
|
-
};
|
|
360
|
-
const relative = function(from, to) {
|
|
361
|
-
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
362
|
-
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
363
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) return _to.join("/");
|
|
364
|
-
const _fromCopy = [..._from];
|
|
365
|
-
for (const segment of _fromCopy) {
|
|
366
|
-
if (_to[0] !== segment) break;
|
|
367
|
-
_from.shift();
|
|
368
|
-
_to.shift();
|
|
369
|
-
}
|
|
370
|
-
return [..._from.map(() => ".."), ..._to].join("/");
|
|
371
|
-
};
|
|
372
|
-
const dirname = function(p) {
|
|
373
|
-
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
374
|
-
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) segments[0] += "/";
|
|
375
|
-
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
376
|
-
};
|
|
377
|
-
const format = function(p) {
|
|
378
|
-
const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
|
|
379
|
-
const segments = [
|
|
380
|
-
p.root,
|
|
381
|
-
p.dir,
|
|
382
|
-
p.base ?? (p.name ?? "") + ext
|
|
383
|
-
].filter(Boolean);
|
|
384
|
-
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
|
|
385
|
-
};
|
|
386
|
-
const basename = function(p, extension) {
|
|
387
|
-
const segments = normalizeWindowsPath(p).split("/");
|
|
388
|
-
let lastSegment = "";
|
|
389
|
-
for (let i = segments.length - 1; i >= 0; i--) {
|
|
390
|
-
const val = segments[i];
|
|
391
|
-
if (val) {
|
|
392
|
-
lastSegment = val;
|
|
393
|
-
break;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
397
|
-
};
|
|
398
|
-
const parse = function(p) {
|
|
399
|
-
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
400
|
-
const base = basename(p);
|
|
401
|
-
const extension = extname(base);
|
|
402
|
-
return {
|
|
403
|
-
root,
|
|
404
|
-
dir: dirname(p),
|
|
405
|
-
base,
|
|
406
|
-
ext: extension,
|
|
407
|
-
name: base.slice(0, base.length - extension.length)
|
|
408
|
-
};
|
|
409
|
-
};
|
|
410
|
-
const matchesGlob = (path, pattern) => {
|
|
411
|
-
return zeptomatch(pattern, normalize(path));
|
|
412
|
-
};
|
|
413
|
-
const _path = {
|
|
414
|
-
__proto__: null,
|
|
415
|
-
basename,
|
|
416
|
-
dirname,
|
|
417
|
-
extname,
|
|
418
|
-
format,
|
|
419
|
-
isAbsolute,
|
|
420
|
-
join,
|
|
421
|
-
matchesGlob,
|
|
422
|
-
normalize,
|
|
423
|
-
normalizeString,
|
|
424
|
-
parse,
|
|
425
|
-
relative,
|
|
426
|
-
resolve,
|
|
427
|
-
sep: "/",
|
|
428
|
-
toNamespacedPath
|
|
429
|
-
};
|
|
430
|
-
//#endregion
|
|
431
|
-
//#region ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs
|
|
432
|
-
const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
|
|
433
|
-
const _platforms = {
|
|
434
|
-
posix: void 0,
|
|
435
|
-
win32: void 0
|
|
436
|
-
};
|
|
437
|
-
const mix = (del = delimiter) => {
|
|
438
|
-
return new Proxy(_path, { get(_, prop) {
|
|
439
|
-
if (prop === "delimiter") return del;
|
|
440
|
-
if (prop === "posix") return posix;
|
|
441
|
-
if (prop === "win32") return win32;
|
|
442
|
-
return _platforms[prop] || _path[prop];
|
|
443
|
-
} });
|
|
444
|
-
};
|
|
445
|
-
const posix = /* @__PURE__ */ mix(":");
|
|
446
|
-
const win32 = /* @__PURE__ */ mix(";");
|
|
447
|
-
//#endregion
|
|
448
|
-
//#region src/node.ts
|
|
449
|
-
function md5(input) {
|
|
450
|
-
return crypto.createHash("md5").update(input).digest("hex");
|
|
451
|
-
}
|
|
452
|
-
function removeAllExtensions(filePath) {
|
|
453
|
-
if (!filePath) return "";
|
|
454
|
-
let baseName = posix.basename(filePath);
|
|
455
|
-
let ext = posix.extname(baseName);
|
|
456
|
-
while (ext) {
|
|
457
|
-
baseName = baseName.slice(0, -ext.length);
|
|
458
|
-
ext = posix.extname(baseName);
|
|
459
|
-
}
|
|
460
|
-
const dir = posix.dirname(filePath);
|
|
461
|
-
return dir === "." ? baseName : posix.join(dir, baseName);
|
|
462
|
-
}
|
|
463
|
-
//#endregion
|
|
464
|
-
export { md5, removeAllExtensions };
|
|
File without changes
|