a-calc 3.0.1 → 3.0.2
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/a-calc.versions.js +185 -68
- package/browser/index.js +2 -2
- package/browser/wasm_calc_bg.wasm +0 -0
- package/calc.d.ts +61 -55
- package/cjs/chunks/calc.js +2 -2
- package/cjs/chunks/wasm_calc_bg.wasm +0 -0
- package/cjs/package.json +3 -3
- package/es/chunks/calc.js +2 -2
- package/es/chunks/wasm_calc_bg.wasm +0 -0
- package/es/package.json +3 -3
- package/package.json +8 -3
- package/ts-plugin/dist/config_extractor.js +1 -2
- package/ts-plugin/dist/utils.js +3 -4
- package/ts-plugin/dist/variable_extractor.js +1 -2
|
Binary file
|
package/es/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
2
|
+
"type": "module",
|
|
3
|
+
"types": "../calc.d.ts"
|
|
4
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "a-calc",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "A very powerful and easy-to-use number precision calculation and formatting library.",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -29,13 +29,18 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"dev": "rollup -c --environment build:dev",
|
|
31
31
|
"dev:w": "rollup -c -w --environment build:dev",
|
|
32
|
-
"build": "run-s
|
|
32
|
+
"build": "run-s build-only build:plugin test test:type test:package",
|
|
33
|
+
"build:plugin": "tsc --project ts-plugin/tsconfig.json",
|
|
33
34
|
"build-test": "rollup -c --environment build:build && npm run test",
|
|
34
35
|
"build-only": "rollup -c --environment build:build",
|
|
35
36
|
"build:w": "rollup -c -w --environment build:build",
|
|
36
37
|
"build:docs": "pnpm install --frozen-lockfile=false && vitepress build docs",
|
|
37
38
|
"test": "vitest run",
|
|
38
|
-
"test:
|
|
39
|
+
"test:package": "node --test test-package/*.test.mjs",
|
|
40
|
+
"test:type": "tsc --project tsconfig.types.json",
|
|
41
|
+
"bench": "node benchmark/perf_check.mjs && node benchmark/fmt-fast-path.mjs",
|
|
42
|
+
"prepack": "run-s build-only build:plugin",
|
|
43
|
+
"prepublishOnly": "npm run build",
|
|
39
44
|
"gen:version": "node gen_version_info.cjs",
|
|
40
45
|
"docs:dev": "vitepress dev docs",
|
|
41
46
|
"docs:build": "vitepress build docs",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extract_config_from_project =
|
|
3
|
+
exports.extract_config_from_project = extract_config_from_project;
|
|
4
4
|
/**
|
|
5
5
|
* 从项目中提取 set_config 配置的类型信息
|
|
6
6
|
*/
|
|
@@ -18,7 +18,6 @@ function extract_config_from_project(ts_module, program, logger) {
|
|
|
18
18
|
}
|
|
19
19
|
return result;
|
|
20
20
|
}
|
|
21
|
-
exports.extract_config_from_project = extract_config_from_project;
|
|
22
21
|
function visit_node(ts_module, node, type_checker, result, logger) {
|
|
23
22
|
// 查找 set_config 调用
|
|
24
23
|
if (ts_module.isCallExpression(node)) {
|
package/ts-plugin/dist/utils.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.is_in_acalc_string = is_in_acalc_string;
|
|
4
|
+
exports.get_text_before_cursor = get_text_before_cursor;
|
|
5
|
+
exports.detect_trigger = detect_trigger;
|
|
4
6
|
/**
|
|
5
7
|
* 检测位置是否在 calc/fmt 等函数的字符串参数内
|
|
6
8
|
*/
|
|
@@ -73,7 +75,6 @@ function is_in_acalc_string(ts_module, source_file, position, type_checker, logg
|
|
|
73
75
|
visit(source_file);
|
|
74
76
|
return result;
|
|
75
77
|
}
|
|
76
|
-
exports.is_in_acalc_string = is_in_acalc_string;
|
|
77
78
|
/**
|
|
78
79
|
* 检测是否是链式调用的格式化参数
|
|
79
80
|
* cadd(1, 2).mul(3)("=2") 中最后的括号
|
|
@@ -224,7 +225,6 @@ function get_string_content(ts_module, node) {
|
|
|
224
225
|
function get_text_before_cursor(content, offset) {
|
|
225
226
|
return content.slice(0, offset);
|
|
226
227
|
}
|
|
227
|
-
exports.get_text_before_cursor = get_text_before_cursor;
|
|
228
228
|
/**
|
|
229
229
|
* 检测补全触发类型
|
|
230
230
|
* @param text_before 光标前的文本
|
|
@@ -291,7 +291,6 @@ function detect_trigger(text_before, is_format_only) {
|
|
|
291
291
|
}
|
|
292
292
|
return null;
|
|
293
293
|
}
|
|
294
|
-
exports.detect_trigger = detect_trigger;
|
|
295
294
|
/**
|
|
296
295
|
* 检测是否在格式化区域
|
|
297
296
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.extract_variables_from_arg =
|
|
3
|
+
exports.extract_variables_from_arg = extract_variables_from_arg;
|
|
4
4
|
/**
|
|
5
5
|
* 从第二个参数中提取所有可用变量
|
|
6
6
|
*/
|
|
@@ -24,7 +24,6 @@ function extract_variables_from_arg(ts_module, arg, type_checker, logger) {
|
|
|
24
24
|
logger.info(`a-calc-ts-plugin: extracted ${result.length} variables`);
|
|
25
25
|
return result;
|
|
26
26
|
}
|
|
27
|
-
exports.extract_variables_from_arg = extract_variables_from_arg;
|
|
28
27
|
/**
|
|
29
28
|
* 检查是否是数组类型
|
|
30
29
|
*/
|