@wzyjs/utils 0.3.20 → 0.3.22

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.
@@ -6,12 +6,17 @@ interface UploadFile {
6
6
  /**
7
7
  * 上传文件到 Cloudflare R2
8
8
  * @param params - 上传参数
9
- * @returns 上传后的文件信息 { url, name }
9
+ * @returns 上传后的文件信息 { objectKey }
10
10
  */
11
11
  export declare function uploadFile(params: UploadFile): Promise<{
12
- url: string;
13
12
  objectKey: string;
14
13
  }>;
14
+ /**
15
+ * 拼接 Cloudflare R2 文件的公开访问 URL
16
+ * @param objectKey - 文件在 R2 中的 Key
17
+ * @returns 文件的完整访问 URL
18
+ */
19
+ export declare function getPublicUrl(objectKey: string): string;
15
20
  /**
16
21
  * 从 Cloudflare R2 删除文件
17
22
  * @param objectKey - 文件在 S3 中的 Key
package/dist/node.cjs.js CHANGED
@@ -4,39 +4,60 @@ var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
- var __moduleCache = /* @__PURE__ */ new WeakMap;
19
32
  var __toCommonJS = (from) => {
20
- var entry = __moduleCache.get(from), desc;
33
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
21
34
  if (entry)
22
35
  return entry;
23
36
  entry = __defProp({}, "__esModule", { value: true });
24
- if (from && typeof from === "object" || typeof from === "function")
25
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
26
- get: () => from[key],
27
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
28
- }));
37
+ if (from && typeof from === "object" || typeof from === "function") {
38
+ for (var key of __getOwnPropNames(from))
39
+ if (!__hasOwnProp.call(entry, key))
40
+ __defProp(entry, key, {
41
+ get: __accessProp.bind(from, key),
42
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
43
+ });
44
+ }
29
45
  __moduleCache.set(from, entry);
30
46
  return entry;
31
47
  };
48
+ var __moduleCache;
32
49
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
50
+ var __returnValue = (v) => v;
51
+ function __exportSetter(name, newValue) {
52
+ this[name] = __returnValue.bind(null, newValue);
53
+ }
33
54
  var __export = (target, all) => {
34
55
  for (var name in all)
35
56
  __defProp(target, name, {
36
57
  get: all[name],
37
58
  enumerable: true,
38
59
  configurable: true,
39
- set: (newValue) => all[name] = () => newValue
60
+ set: __exportSetter.bind(all, name)
40
61
  });
41
62
  };
42
63
 
@@ -722,7 +743,7 @@ var require_lodash = __commonJS((exports2, module2) => {
722
743
  function unicodeWords(string) {
723
744
  return string.match(reUnicodeWord) || [];
724
745
  }
725
- var runInContext = function runInContext(context) {
746
+ var runInContext = function runInContext2(context) {
726
747
  context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
727
748
  var { Array: Array2, Date: Date2, Error: Error2, Function: Function2, Math: Math2, Object: Object2, RegExp: RegExp2, String: String2, TypeError: TypeError2 } = context;
728
749
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
@@ -5235,7 +5256,7 @@ __p += '`;
5235
5256
  lodash.replace = replace;
5236
5257
  lodash.result = result;
5237
5258
  lodash.round = round;
5238
- lodash.runInContext = runInContext;
5259
+ lodash.runInContext = runInContext2;
5239
5260
  lodash.sample = sample;
5240
5261
  lodash.size = size;
5241
5262
  lodash.snakeCase = snakeCase;
@@ -13536,7 +13557,7 @@ var require_dist6 = __commonJS((exports2) => {
13536
13557
 
13537
13558
  // ../../node_modules/estraverse/estraverse.js
13538
13559
  var require_estraverse = __commonJS((exports2) => {
13539
- (function clone(exports3) {
13560
+ (function clone2(exports3) {
13540
13561
  var Syntax, VisitorOption, VisitorKeys, BREAK, SKIP, REMOVE;
13541
13562
  function deepCopy(obj) {
13542
13563
  var ret = {}, key2, val;
@@ -13734,7 +13755,7 @@ var require_estraverse = __commonJS((exports2) => {
13734
13755
  this.parent = parent;
13735
13756
  this.key = key2;
13736
13757
  }
13737
- Reference.prototype.replace = function replace(node) {
13758
+ Reference.prototype.replace = function replace2(node) {
13738
13759
  this.parent[this.key] = node;
13739
13760
  };
13740
13761
  Reference.prototype.remove = function remove() {
@@ -13753,15 +13774,15 @@ var require_estraverse = __commonJS((exports2) => {
13753
13774
  this.ref = ref;
13754
13775
  }
13755
13776
  function Controller() {}
13756
- Controller.prototype.path = function path() {
13777
+ Controller.prototype.path = function path2() {
13757
13778
  var i, iz, j, jz, result, element;
13758
- function addToPath(result2, path2) {
13759
- if (Array.isArray(path2)) {
13760
- for (j = 0, jz = path2.length;j < jz; ++j) {
13761
- result2.push(path2[j]);
13779
+ function addToPath(result2, path3) {
13780
+ if (Array.isArray(path3)) {
13781
+ for (j = 0, jz = path3.length;j < jz; ++j) {
13782
+ result2.push(path3[j]);
13762
13783
  }
13763
13784
  } else {
13764
- result2.push(path2);
13785
+ result2.push(path3);
13765
13786
  }
13766
13787
  }
13767
13788
  if (!this.__current.path) {
@@ -13849,7 +13870,7 @@ var require_estraverse = __commonJS((exports2) => {
13849
13870
  }
13850
13871
  return false;
13851
13872
  }
13852
- Controller.prototype.traverse = function traverse(root, visitor) {
13873
+ Controller.prototype.traverse = function traverse2(root, visitor) {
13853
13874
  var worklist, leavelist, element, node, nodeType, ret, key2, current, current2, candidates, candidate, sentinel;
13854
13875
  this.__initialize(root, visitor);
13855
13876
  sentinel = {};
@@ -13922,7 +13943,7 @@ var require_estraverse = __commonJS((exports2) => {
13922
13943
  }
13923
13944
  }
13924
13945
  };
13925
- Controller.prototype.replace = function replace(root, visitor) {
13946
+ Controller.prototype.replace = function replace2(root, visitor) {
13926
13947
  var worklist, leavelist, node, nodeType, target, element, current, current2, candidates, candidate, sentinel, outer, key2;
13927
13948
  function removeElem(element2) {
13928
13949
  var i, key3, nextElem, parent;
@@ -14132,7 +14153,7 @@ var require_estraverse = __commonJS((exports2) => {
14132
14153
  exports3.VisitorOption = VisitorOption;
14133
14154
  exports3.Controller = Controller;
14134
14155
  exports3.cloneEnvironment = function() {
14135
- return clone({});
14156
+ return clone2({});
14136
14157
  };
14137
14158
  return exports3;
14138
14159
  })(exports2);
@@ -25676,12 +25697,12 @@ var require_path = __commonJS((exports2, module2) => {
25676
25697
  var types2 = fork.use(types_1.default);
25677
25698
  var isArray = types2.builtInTypes.array;
25678
25699
  var isNumber = types2.builtInTypes.number;
25679
- var Path = function Path(value, parentPath, name) {
25680
- if (!(this instanceof Path)) {
25700
+ var Path = function Path2(value, parentPath, name) {
25701
+ if (!(this instanceof Path2)) {
25681
25702
  throw new Error("Path constructor cannot be invoked without 'new'");
25682
25703
  }
25683
25704
  if (parentPath) {
25684
- if (!(parentPath instanceof Path)) {
25705
+ if (!(parentPath instanceof Path2)) {
25685
25706
  throw new Error("");
25686
25707
  }
25687
25708
  } else {
@@ -25977,14 +25998,14 @@ var require_scope = __commonJS((exports2, module2) => {
25977
25998
  var Expression = namedTypes.Expression;
25978
25999
  var isArray = types2.builtInTypes.array;
25979
26000
  var b = types2.builders;
25980
- var Scope = function Scope(path2, parentScope) {
25981
- if (!(this instanceof Scope)) {
26001
+ var Scope = function Scope2(path2, parentScope) {
26002
+ if (!(this instanceof Scope2)) {
25982
26003
  throw new Error("Scope constructor cannot be invoked without 'new'");
25983
26004
  }
25984
26005
  ScopeType.assert(path2.value);
25985
26006
  var depth;
25986
26007
  if (parentScope) {
25987
- if (!(parentScope instanceof Scope)) {
26008
+ if (!(parentScope instanceof Scope2)) {
25988
26009
  throw new Error("");
25989
26010
  }
25990
26011
  depth = parentScope.depth + 1;
@@ -26222,8 +26243,8 @@ var require_node_path = __commonJS((exports2, module2) => {
26222
26243
  var isArray = types2.builtInTypes.array;
26223
26244
  var Path = fork.use(path_1.default);
26224
26245
  var Scope = fork.use(scope_1.default);
26225
- var NodePath = function NodePath(value, parentPath, name) {
26226
- if (!(this instanceof NodePath)) {
26246
+ var NodePath = function NodePath2(value, parentPath, name) {
26247
+ if (!(this instanceof NodePath2)) {
26227
26248
  throw new Error("NodePath constructor cannot be invoked without 'new'");
26228
26249
  }
26229
26250
  Path.call(this, value, parentPath, name);
@@ -26573,8 +26594,8 @@ var require_path_visitor = __commonJS((exports2, module2) => {
26573
26594
  var isObject = types2.builtInTypes.object;
26574
26595
  var isFunction = types2.builtInTypes.function;
26575
26596
  var undefined2;
26576
- var PathVisitor = function PathVisitor() {
26577
- if (!(this instanceof PathVisitor)) {
26597
+ var PathVisitor = function PathVisitor2() {
26598
+ if (!(this instanceof PathVisitor2)) {
26578
26599
  throw new Error("PathVisitor constructor cannot be invoked without 'new'");
26579
26600
  }
26580
26601
  this._reusableContextStack = [];
@@ -26611,8 +26632,8 @@ var require_path_visitor = __commonJS((exports2, module2) => {
26611
26632
  if (!isObject.check(methods)) {
26612
26633
  return new PathVisitor;
26613
26634
  }
26614
- var Visitor = function Visitor() {
26615
- if (!(this instanceof Visitor)) {
26635
+ var Visitor = function Visitor2() {
26636
+ if (!(this instanceof Visitor2)) {
26616
26637
  throw new Error("Visitor constructor cannot be invoked without 'new'");
26617
26638
  }
26618
26639
  PathVisitor.call(this);
@@ -31571,7 +31592,7 @@ __export(exports_node, {
31571
31592
  amount: () => amount,
31572
31593
  ai: () => exports_ai,
31573
31594
  addIssueToContext: () => addIssueToContext,
31574
- _: () => import_lodash.default,
31595
+ _: () => _,
31575
31596
  ZodVoid: () => ZodVoid,
31576
31597
  ZodUnknown: () => ZodUnknown,
31577
31598
  ZodUnion: () => ZodUnion,
@@ -35603,10 +35624,10 @@ var coerce = {
35603
35624
  var NEVER = INVALID;
35604
35625
  // src/node.ts
35605
35626
  var cheerio = __toESM(require("cheerio"));
35606
- var import_lodash = __toESM(require_lodash());
35607
35627
  var import_axios10 = __toESM(require("axios"));
35608
35628
  var import_json53 = __toESM(require("json5"));
35609
35629
  var import_consola = __toESM(require("consola"));
35630
+ var import_lodash = __toESM(require_lodash(), 1);
35610
35631
 
35611
35632
  // src/common/ai/index.ts
35612
35633
  var exports_ai = {};
@@ -36271,12 +36292,12 @@ var generateUniqueFileName = (name) => {
36271
36292
  };
36272
36293
 
36273
36294
  // ../../node_modules/decimal.js/decimal.mjs
36274
- /*!
36275
- * decimal.js v10.6.0
36276
- * An arbitrary-precision Decimal type for JavaScript.
36277
- * https://github.com/MikeMcl/decimal.js
36278
- * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
36279
- * MIT Licence
36295
+ /*!
36296
+ * decimal.js v10.6.0
36297
+ * An arbitrary-precision Decimal type for JavaScript.
36298
+ * https://github.com/MikeMcl/decimal.js
36299
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
36300
+ * MIT Licence
36280
36301
  */
36281
36302
  var EXP_LIMIT = 9000000000000000;
36282
36303
  var MAX_DIGITS = 1e9;
@@ -38957,11 +38978,12 @@ var uploadFileToOss = async (params) => {
38957
38978
  var exports_cloudflare = {};
38958
38979
  __export(exports_cloudflare, {
38959
38980
  uploadFile: () => uploadFile,
38981
+ getPublicUrl: () => getPublicUrl,
38960
38982
  deleteFile: () => deleteFile
38961
38983
  });
38962
38984
  var import_client_s3 = require("@aws-sdk/client-s3");
38963
- var import_node_http_handler = __toESM(require_dist_cjs5());
38964
- var import_proxy_agent = __toESM(require_dist11());
38985
+ var import_node_http_handler = __toESM(require_dist_cjs5(), 1);
38986
+ var import_proxy_agent = __toESM(require_dist11(), 1);
38965
38987
  var s3Client = null;
38966
38988
  var getS3Client = () => {
38967
38989
  if (!s3Client) {
@@ -39004,15 +39026,25 @@ async function uploadFile(params) {
39004
39026
  ContentDisposition: "inline",
39005
39027
  CacheControl: "public, max-age=31536000, immutable"
39006
39028
  }));
39007
- const url2 = `${process.env.CLOUDFLARE_PUBLIC_URL}/${fileName}`;
39008
39029
  return {
39009
- url: url2,
39010
39030
  objectKey: fileName
39011
39031
  };
39012
39032
  } catch (error) {
39013
39033
  throw new Error(`上传到 Cloudflare 失败: ${error}`);
39014
39034
  }
39015
39035
  }
39036
+ function getPublicUrl(objectKey) {
39037
+ if (!objectKey) {
39038
+ return "";
39039
+ }
39040
+ const publicUrl = process.env.CLOUDFLARE_PUBLIC_URL;
39041
+ if (!publicUrl) {
39042
+ throw new Error("CLOUDFLARE_PUBLIC_URL environment variable is not set");
39043
+ }
39044
+ const baseUrl = publicUrl.endsWith("/") ? publicUrl.slice(0, -1) : publicUrl;
39045
+ const key2 = objectKey.startsWith("/") ? objectKey : `/${objectKey}`;
39046
+ return `${baseUrl}${key2}`;
39047
+ }
39016
39048
  async function deleteFile(objectKey) {
39017
39049
  const client = getS3Client();
39018
39050
  try {
@@ -39257,3 +39289,6 @@ var processFile = async (params) => {
39257
39289
  ext
39258
39290
  };
39259
39291
  };
39292
+
39293
+ // src/node.ts
39294
+ var _ = import_lodash.default;
package/dist/node.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  export * from 'zod';
2
2
  export * as cheerio from 'cheerio';
3
- export { default as _ } from 'lodash';
4
3
  export { default as axios } from 'axios';
5
4
  export { default as json5 } from 'json5';
6
5
  export { default as consola } from 'consola';
6
+ import lodash from 'lodash';
7
+ export declare const _: lodash.LoDashStatic;
7
8
  export * from './common';
8
9
  export * as oss from './node/oss';
9
10
  export * as cron from './node/cron';
package/dist/node.esm.js CHANGED
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
19
37
  var __export = (target, all) => {
20
38
  for (var name in all)
21
39
  __defProp(target, name, {
22
40
  get: all[name],
23
41
  enumerable: true,
24
42
  configurable: true,
25
- set: (newValue) => all[name] = () => newValue
43
+ set: __exportSetter.bind(all, name)
26
44
  });
27
45
  };
28
46
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
@@ -709,7 +727,7 @@ var require_lodash = __commonJS((exports, module) => {
709
727
  function unicodeWords(string) {
710
728
  return string.match(reUnicodeWord) || [];
711
729
  }
712
- var runInContext = function runInContext(context) {
730
+ var runInContext = function runInContext2(context) {
713
731
  context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
714
732
  var { Array: Array2, Date: Date2, Error: Error2, Function: Function2, Math: Math2, Object: Object2, RegExp: RegExp2, String: String2, TypeError: TypeError2 } = context;
715
733
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
@@ -5222,7 +5240,7 @@ __p += '`;
5222
5240
  lodash.replace = replace;
5223
5241
  lodash.result = result;
5224
5242
  lodash.round = round;
5225
- lodash.runInContext = runInContext;
5243
+ lodash.runInContext = runInContext2;
5226
5244
  lodash.sample = sample;
5227
5245
  lodash.size = size;
5228
5246
  lodash.snakeCase = snakeCase;
@@ -12804,7 +12822,7 @@ var require_dist6 = __commonJS((exports) => {
12804
12822
 
12805
12823
  // ../../node_modules/estraverse/estraverse.js
12806
12824
  var require_estraverse = __commonJS((exports) => {
12807
- (function clone(exports2) {
12825
+ (function clone2(exports2) {
12808
12826
  var Syntax, VisitorOption, VisitorKeys, BREAK, SKIP, REMOVE;
12809
12827
  function deepCopy(obj) {
12810
12828
  var ret = {}, key2, val;
@@ -13002,7 +13020,7 @@ var require_estraverse = __commonJS((exports) => {
13002
13020
  this.parent = parent;
13003
13021
  this.key = key2;
13004
13022
  }
13005
- Reference.prototype.replace = function replace(node) {
13023
+ Reference.prototype.replace = function replace2(node) {
13006
13024
  this.parent[this.key] = node;
13007
13025
  };
13008
13026
  Reference.prototype.remove = function remove() {
@@ -13021,15 +13039,15 @@ var require_estraverse = __commonJS((exports) => {
13021
13039
  this.ref = ref;
13022
13040
  }
13023
13041
  function Controller() {}
13024
- Controller.prototype.path = function path() {
13042
+ Controller.prototype.path = function path2() {
13025
13043
  var i, iz, j, jz, result, element;
13026
- function addToPath(result2, path2) {
13027
- if (Array.isArray(path2)) {
13028
- for (j = 0, jz = path2.length;j < jz; ++j) {
13029
- result2.push(path2[j]);
13044
+ function addToPath(result2, path3) {
13045
+ if (Array.isArray(path3)) {
13046
+ for (j = 0, jz = path3.length;j < jz; ++j) {
13047
+ result2.push(path3[j]);
13030
13048
  }
13031
13049
  } else {
13032
- result2.push(path2);
13050
+ result2.push(path3);
13033
13051
  }
13034
13052
  }
13035
13053
  if (!this.__current.path) {
@@ -13117,7 +13135,7 @@ var require_estraverse = __commonJS((exports) => {
13117
13135
  }
13118
13136
  return false;
13119
13137
  }
13120
- Controller.prototype.traverse = function traverse(root, visitor) {
13138
+ Controller.prototype.traverse = function traverse2(root, visitor) {
13121
13139
  var worklist, leavelist, element, node, nodeType, ret, key2, current, current2, candidates, candidate, sentinel;
13122
13140
  this.__initialize(root, visitor);
13123
13141
  sentinel = {};
@@ -13190,7 +13208,7 @@ var require_estraverse = __commonJS((exports) => {
13190
13208
  }
13191
13209
  }
13192
13210
  };
13193
- Controller.prototype.replace = function replace(root, visitor) {
13211
+ Controller.prototype.replace = function replace2(root, visitor) {
13194
13212
  var worklist, leavelist, node, nodeType, target, element, current, current2, candidates, candidate, sentinel, outer, key2;
13195
13213
  function removeElem(element2) {
13196
13214
  var i, key3, nextElem, parent;
@@ -13400,7 +13418,7 @@ var require_estraverse = __commonJS((exports) => {
13400
13418
  exports2.VisitorOption = VisitorOption;
13401
13419
  exports2.Controller = Controller;
13402
13420
  exports2.cloneEnvironment = function() {
13403
- return clone({});
13421
+ return clone2({});
13404
13422
  };
13405
13423
  return exports2;
13406
13424
  })(exports);
@@ -24944,12 +24962,12 @@ var require_path = __commonJS((exports, module) => {
24944
24962
  var types2 = fork.use(types_1.default);
24945
24963
  var isArray = types2.builtInTypes.array;
24946
24964
  var isNumber = types2.builtInTypes.number;
24947
- var Path = function Path(value, parentPath, name) {
24948
- if (!(this instanceof Path)) {
24965
+ var Path = function Path2(value, parentPath, name) {
24966
+ if (!(this instanceof Path2)) {
24949
24967
  throw new Error("Path constructor cannot be invoked without 'new'");
24950
24968
  }
24951
24969
  if (parentPath) {
24952
- if (!(parentPath instanceof Path)) {
24970
+ if (!(parentPath instanceof Path2)) {
24953
24971
  throw new Error("");
24954
24972
  }
24955
24973
  } else {
@@ -25245,14 +25263,14 @@ var require_scope = __commonJS((exports, module) => {
25245
25263
  var Expression = namedTypes.Expression;
25246
25264
  var isArray = types2.builtInTypes.array;
25247
25265
  var b = types2.builders;
25248
- var Scope = function Scope(path2, parentScope) {
25249
- if (!(this instanceof Scope)) {
25266
+ var Scope = function Scope2(path2, parentScope) {
25267
+ if (!(this instanceof Scope2)) {
25250
25268
  throw new Error("Scope constructor cannot be invoked without 'new'");
25251
25269
  }
25252
25270
  ScopeType.assert(path2.value);
25253
25271
  var depth;
25254
25272
  if (parentScope) {
25255
- if (!(parentScope instanceof Scope)) {
25273
+ if (!(parentScope instanceof Scope2)) {
25256
25274
  throw new Error("");
25257
25275
  }
25258
25276
  depth = parentScope.depth + 1;
@@ -25490,8 +25508,8 @@ var require_node_path = __commonJS((exports, module) => {
25490
25508
  var isArray = types2.builtInTypes.array;
25491
25509
  var Path = fork.use(path_1.default);
25492
25510
  var Scope = fork.use(scope_1.default);
25493
- var NodePath = function NodePath(value, parentPath, name) {
25494
- if (!(this instanceof NodePath)) {
25511
+ var NodePath = function NodePath2(value, parentPath, name) {
25512
+ if (!(this instanceof NodePath2)) {
25495
25513
  throw new Error("NodePath constructor cannot be invoked without 'new'");
25496
25514
  }
25497
25515
  Path.call(this, value, parentPath, name);
@@ -25841,8 +25859,8 @@ var require_path_visitor = __commonJS((exports, module) => {
25841
25859
  var isObject = types2.builtInTypes.object;
25842
25860
  var isFunction = types2.builtInTypes.function;
25843
25861
  var undefined2;
25844
- var PathVisitor = function PathVisitor() {
25845
- if (!(this instanceof PathVisitor)) {
25862
+ var PathVisitor = function PathVisitor2() {
25863
+ if (!(this instanceof PathVisitor2)) {
25846
25864
  throw new Error("PathVisitor constructor cannot be invoked without 'new'");
25847
25865
  }
25848
25866
  this._reusableContextStack = [];
@@ -25879,8 +25897,8 @@ var require_path_visitor = __commonJS((exports, module) => {
25879
25897
  if (!isObject.check(methods)) {
25880
25898
  return new PathVisitor;
25881
25899
  }
25882
- var Visitor = function Visitor() {
25883
- if (!(this instanceof Visitor)) {
25900
+ var Visitor = function Visitor2() {
25901
+ if (!(this instanceof Visitor2)) {
25884
25902
  throw new Error("Visitor constructor cannot be invoked without 'new'");
25885
25903
  }
25886
25904
  PathVisitor.call(this);
@@ -34704,9 +34722,9 @@ var NEVER = INVALID;
34704
34722
  // src/node.ts
34705
34723
  var import_lodash = __toESM(require_lodash(), 1);
34706
34724
  import * as cheerio from "cheerio";
34707
- import { default as default3 } from "axios";
34708
- import { default as default4 } from "json5";
34709
- import { default as default5 } from "consola";
34725
+ import { default as default2 } from "axios";
34726
+ import { default as default3 } from "json5";
34727
+ import { default as default4 } from "consola";
34710
34728
 
34711
34729
  // src/common/ai/index.ts
34712
34730
  var exports_ai = {};
@@ -35371,12 +35389,12 @@ var generateUniqueFileName = (name) => {
35371
35389
  };
35372
35390
 
35373
35391
  // ../../node_modules/decimal.js/decimal.mjs
35374
- /*!
35375
- * decimal.js v10.6.0
35376
- * An arbitrary-precision Decimal type for JavaScript.
35377
- * https://github.com/MikeMcl/decimal.js
35378
- * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
35379
- * MIT Licence
35392
+ /*!
35393
+ * decimal.js v10.6.0
35394
+ * An arbitrary-precision Decimal type for JavaScript.
35395
+ * https://github.com/MikeMcl/decimal.js
35396
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
35397
+ * MIT Licence
35380
35398
  */
35381
35399
  var EXP_LIMIT = 9000000000000000;
35382
35400
  var MAX_DIGITS = 1e9;
@@ -38057,6 +38075,7 @@ var uploadFileToOss = async (params) => {
38057
38075
  var exports_cloudflare = {};
38058
38076
  __export(exports_cloudflare, {
38059
38077
  uploadFile: () => uploadFile,
38078
+ getPublicUrl: () => getPublicUrl,
38060
38079
  deleteFile: () => deleteFile
38061
38080
  });
38062
38081
  import { S3Client, PutObjectCommand, DeleteObjectCommand } from "@aws-sdk/client-s3";
@@ -38777,15 +38796,25 @@ async function uploadFile(params) {
38777
38796
  ContentDisposition: "inline",
38778
38797
  CacheControl: "public, max-age=31536000, immutable"
38779
38798
  }));
38780
- const url2 = `${process.env.CLOUDFLARE_PUBLIC_URL}/${fileName}`;
38781
38799
  return {
38782
- url: url2,
38783
38800
  objectKey: fileName
38784
38801
  };
38785
38802
  } catch (error) {
38786
38803
  throw new Error(`上传到 Cloudflare 失败: ${error}`);
38787
38804
  }
38788
38805
  }
38806
+ function getPublicUrl(objectKey) {
38807
+ if (!objectKey) {
38808
+ return "";
38809
+ }
38810
+ const publicUrl = process.env.CLOUDFLARE_PUBLIC_URL;
38811
+ if (!publicUrl) {
38812
+ throw new Error("CLOUDFLARE_PUBLIC_URL environment variable is not set");
38813
+ }
38814
+ const baseUrl = publicUrl.endsWith("/") ? publicUrl.slice(0, -1) : publicUrl;
38815
+ const key2 = objectKey.startsWith("/") ? objectKey : `/${objectKey}`;
38816
+ return `${baseUrl}${key2}`;
38817
+ }
38789
38818
  async function deleteFile(objectKey) {
38790
38819
  const client = getS3Client();
38791
38820
  try {
@@ -39030,8 +39059,9 @@ var processFile = async (params) => {
39030
39059
  ext
39031
39060
  };
39032
39061
  };
39033
- var export__ = import_lodash.default;
39034
39062
 
39063
+ // src/node.ts
39064
+ var _ = import_lodash.default;
39035
39065
  export {
39036
39066
  exports_external as z,
39037
39067
  watch,
@@ -39085,7 +39115,7 @@ export {
39085
39115
  lazyType as lazy,
39086
39116
  late,
39087
39117
  jsonParse,
39088
- default4 as json5,
39118
+ default3 as json5,
39089
39119
  isValidNumber,
39090
39120
  isValid,
39091
39121
  isJson,
@@ -39128,20 +39158,20 @@ export {
39128
39158
  dateType as date,
39129
39159
  custom,
39130
39160
  exports_cron as cron,
39131
- default5 as consola,
39161
+ default4 as consola,
39132
39162
  coerce,
39133
39163
  chinaDayjs,
39134
39164
  cheerio,
39135
39165
  calcJsText,
39136
39166
  booleanType as boolean,
39137
39167
  bigIntType as bigint,
39138
- default3 as axios,
39168
+ default2 as axios,
39139
39169
  arrayType as array,
39140
39170
  anyType as any,
39141
39171
  amount,
39142
39172
  exports_ai as ai,
39143
39173
  addIssueToContext,
39144
- export__ as _,
39174
+ _,
39145
39175
  ZodVoid,
39146
39176
  ZodUnknown,
39147
39177
  ZodUnion,