@jayfong/x-utils 1.0.0-202407012223 → 1.0.0-202407020954
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/_cjs/env.js +3 -4
- package/_cjs/pinyin.js +5 -0
- package/env.js +3 -3
- package/ocr.d.ts +7 -0
- package/package.json +1 -1
- package/pinyin.d.ts +5 -0
- package/pinyin.js +5 -0
- package/upload.d.ts +6 -0
package/_cjs/env.js
CHANGED
|
@@ -36,18 +36,17 @@ var import_vtils = require("vtils");
|
|
|
36
36
|
var import_fs = require("./fs.js");
|
|
37
37
|
var import_path = require("./path.js");
|
|
38
38
|
var import_yaml = require("./yaml.js");
|
|
39
|
-
const import_meta = {};
|
|
40
39
|
class XEnv {
|
|
41
40
|
static getEnvVarsFromFile = (0, import_vtils.memoize)(async () => {
|
|
42
|
-
const envYmlFile = import_path.XPath.join(
|
|
41
|
+
const envYmlFile = import_path.XPath.join(process.cwd(), ".env.yml");
|
|
43
42
|
if (await import_fs.XFs.pathExists(envYmlFile)) {
|
|
44
43
|
return import_yaml.XYaml.read(envYmlFile);
|
|
45
44
|
}
|
|
46
|
-
const envYamlFile = import_path.XPath.join(
|
|
45
|
+
const envYamlFile = import_path.XPath.join(process.cwd(), ".env.yaml");
|
|
47
46
|
if (await import_fs.XFs.pathExists(envYamlFile)) {
|
|
48
47
|
return import_yaml.XYaml.read(envYamlFile);
|
|
49
48
|
}
|
|
50
|
-
const dotenvFile = import_path.XPath.join(
|
|
49
|
+
const dotenvFile = import_path.XPath.join(process.cwd(), ".env");
|
|
51
50
|
if (await import_fs.XFs.pathExists(dotenvFile)) {
|
|
52
51
|
const dotenvContent = await import_fs.XFs.readFile(dotenvFile, "utf-8");
|
|
53
52
|
return import_dotenv.default.parse(dotenvContent);
|
package/_cjs/pinyin.js
CHANGED
|
@@ -23,6 +23,11 @@ __export(pinyin_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(pinyin_exports);
|
|
24
24
|
var import_pinyin_pro = require("pinyin-pro");
|
|
25
25
|
class XPinyin {
|
|
26
|
+
/**
|
|
27
|
+
* - `我们` => `['wo', 'men']`
|
|
28
|
+
*
|
|
29
|
+
* - `2` => `['2']`
|
|
30
|
+
*/
|
|
26
31
|
static getTonelessPinyin(text) {
|
|
27
32
|
return (0, import_pinyin_pro.pinyin)(text, {
|
|
28
33
|
type: "array",
|
package/env.js
CHANGED
|
@@ -5,15 +5,15 @@ import { XPath } from "./path.js";
|
|
|
5
5
|
import { XYaml } from "./yaml.js";
|
|
6
6
|
class XEnv {
|
|
7
7
|
static getEnvVarsFromFile = memoize(async () => {
|
|
8
|
-
const envYmlFile = XPath.join(
|
|
8
|
+
const envYmlFile = XPath.join(process.cwd(), ".env.yml");
|
|
9
9
|
if (await XFs.pathExists(envYmlFile)) {
|
|
10
10
|
return XYaml.read(envYmlFile);
|
|
11
11
|
}
|
|
12
|
-
const envYamlFile = XPath.join(
|
|
12
|
+
const envYamlFile = XPath.join(process.cwd(), ".env.yaml");
|
|
13
13
|
if (await XFs.pathExists(envYamlFile)) {
|
|
14
14
|
return XYaml.read(envYamlFile);
|
|
15
15
|
}
|
|
16
|
-
const dotenvFile = XPath.join(
|
|
16
|
+
const dotenvFile = XPath.join(process.cwd(), ".env");
|
|
17
17
|
if (await XFs.pathExists(dotenvFile)) {
|
|
18
18
|
const dotenvContent = await XFs.readFile(dotenvFile, "utf-8");
|
|
19
19
|
return dotenv.parse(dotenvContent);
|
package/ocr.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* 环境变量:
|
|
4
|
+
*
|
|
5
|
+
* - `X_OCR_RECOGNIZE_SERVER_URL`: 文字识别服务地址
|
|
6
|
+
* - `X_OCR_RECOGNIZE_CAPTCHA_SERVER_URL`: 验证码识别服务地址
|
|
7
|
+
* - `X_OCR_RECOGNIZE_CAPTCHA_SERVER_TOKEN`: 验证码识别服务令牌
|
|
8
|
+
*/
|
|
2
9
|
export declare class XOcr {
|
|
3
10
|
static recognize(url: string, { serverUrl, }?: {
|
|
4
11
|
serverUrl?: string;
|
package/package.json
CHANGED
package/pinyin.d.ts
CHANGED
package/pinyin.js
CHANGED